From 99da87a84b43806f69369ca4b5dcb7cffe9ce1f3 Mon Sep 17 00:00:00 2001 From: Ilkka Ollakka Date: Tue, 29 Jan 2008 11:47:23 +0000 Subject: [PATCH] - fix qmax/qmin if statements - if user requests certain bitrate, set defaults to qmax=51,qmin=10 if user hasn't defined them otherwise. Should help normal user to get bitrate he/she requests. --- modules/codec/ffmpeg/encoder.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/modules/codec/ffmpeg/encoder.c b/modules/codec/ffmpeg/encoder.c index a16fe6c5ef..1275c1c930 100644 --- a/modules/codec/ffmpeg/encoder.c +++ b/modules/codec/ffmpeg/encoder.c @@ -496,12 +496,25 @@ int E_(OpenEncoder)( vlc_object_t *p_this ) if( p_sys->i_vtolerance > 0 ) p_context->bit_rate_tolerance = p_sys->i_vtolerance; + /* usually if someone sets bitrate, he likes more to get that bitrate over quality + * should help 'normal' user to get asked bitrate + */ + if( p_enc->fmt_out.i_bitrate > 0 && p_sys->i_qmax == 0 && p_sys->i_qmin == 0 ) + { + p_sys->i_qmax = 51; + p_sys->i_qmin = 10; + } + if( p_sys->i_qmin > 0 ) + { p_context->mb_qmin = p_context->qmin = p_sys->i_qmin; p_context->mb_lmin = p_context->lmin = p_sys->i_qmin * FF_QP2LAMBDA; + } if( p_sys->i_qmax > 0 ) + { p_context->mb_qmax = p_context->qmax = p_sys->i_qmax; p_context->mb_lmax = p_context->lmax = p_sys->i_qmax * FF_QP2LAMBDA; + } p_context->max_qdiff = 3; p_context->mb_decision = p_sys->i_hq; -- 2.39.2