[vlc-commits] avcodec: make clearer that i_quality is setted only then qscale is within 0 .01..255

Ilkka Ollakka git at videolan.org
Mon Apr 15 15:50:00 CEST 2013


vlc | branch: master | Ilkka Ollakka <ileoo at videolan.org> | Mon Apr 15 16:40:15 2013 +0300| [d81246260d9264764a8be57f6d7bee1c5115f042] | committer: Ilkka Ollakka

avcodec: make clearer that i_quality is setted only then qscale is within 0.01..255

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=d81246260d9264764a8be57f6d7bee1c5115f042
---

 modules/codec/avcodec/encoder.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/modules/codec/avcodec/encoder.c b/modules/codec/avcodec/encoder.c
index a19cdc8..3b1c478 100644
--- a/modules/codec/avcodec/encoder.c
+++ b/modules/codec/avcodec/encoder.c
@@ -346,8 +346,12 @@ int OpenEncoder( vlc_object_t *p_this )
     p_sys->b_mpeg4_matrix = var_GetBool( p_enc, ENC_CFG_PREFIX "mpeg4-matrix" );
 
     f_val = var_GetFloat( p_enc, ENC_CFG_PREFIX "qscale" );
-    if( f_val < 0.01 || f_val > 255.0 ) f_val = 0;
-    p_sys->i_quality = (int)(FF_QP2LAMBDA * f_val + 0.5);
+
+    p_sys->i_quality = 0;
+    if( f_val < 0.01 || f_val > 255.0 )
+        f_val = 0;
+    else
+        p_sys->i_quality = (int)(FF_QP2LAMBDA * f_val + 0.5);
 
     psz_val = var_GetString( p_enc, ENC_CFG_PREFIX "hq" );
     p_sys->i_hq = FF_MB_DECISION_RD;



More information about the vlc-commits mailing list