]> git.sesse.net Git - vlc/commitdiff
- fix qmax/qmin if statements
authorIlkka Ollakka <ileoo@videolan.org>
Tue, 29 Jan 2008 11:47:23 +0000 (11:47 +0000)
committerIlkka Ollakka <ileoo@videolan.org>
Tue, 29 Jan 2008 11:47:23 +0000 (11:47 +0000)
- 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

index a16fe6c5ef1dc936a6d545498c441d2fa81ea5c7..1275c1c93033ccaa5f692c92c519dcfa2694ca7b 100644 (file)
@@ -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;