[vlc-commits] commit: avcodec: adjust encoders vp8 defaults littlebit (Ilkka Ollakka )

git at videolan.org git at videolan.org
Tue Jun 1 20:28:33 CEST 2010


vlc/vlc-1.1 | branch: master | Ilkka Ollakka <ileoo at videolan.org> | Tue Jun  1 21:20:20 2010 +0300| [f34f27e3268ba15295086d7f9c96e895bf912156] | committer: Ilkka Ollakka 

avcodec: adjust encoders vp8 defaults littlebit
(cherry picked from commit ac3514edab1a5f94167d3dfa6cc88ce2adb317c9)

Signed-off-by: Ilkka Ollakka <ileoo at videolan.org>

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

 modules/codec/avcodec/encoder.c |   32 +++++++++++++++++++++++++++++---
 1 files changed, 29 insertions(+), 3 deletions(-)

diff --git a/modules/codec/avcodec/encoder.c b/modules/codec/avcodec/encoder.c
index 905c527..0ba4ffb 100644
--- a/modules/codec/avcodec/encoder.c
+++ b/modules/codec/avcodec/encoder.c
@@ -584,10 +584,36 @@ int OpenEncoder( vlc_object_t *p_this )
        libvpx-720p preset from libvpx ffmpeg-patch */
     if( i_codec_id == CODEC_ID_VP8 )
     {
+        /* Lets give bitrate tolerance */
         p_context->bit_rate_tolerance = __MAX(2 * p_enc->fmt_out.i_bitrate, p_sys->i_vtolerance );
-        /* I used Harrison-stetson method here to get there values */
-        p_context->rc_max_rate = 3 * p_enc->fmt_out.i_bitrate;
-        p_context->rc_min_rate = p_enc->fmt_out.i_bitrate / 200;
+        /* seems that ffmpeg presets have 720p as divider for buffers */
+        if( p_enc->fmt_out.video.i_width >= 720 )
+        {
+           /* Check that we don't overrun users qmin/qmax values */
+           if( !var_GetInteger( p_enc, ENC_CFG_PREFIX "qmin" ) )
+           {
+              p_context->mb_qmin = p_context->qmin = 10 * FF_QP2LAMBDA;
+              p_context->mb_lmin = p_context->lmin = 10 * FF_QP2LAMBDA;
+           }
+
+           if( !var_GetInteger( p_enc, ENC_CFG_PREFIX "qmax" ) )
+           {
+              p_context->mb_qmax = p_context->qmax = 42 * FF_QP2LAMBDA;
+              p_context->mb_lmax = p_context->lmax = 42 * FF_QP2LAMBDA;
+           }
+
+           p_context->rc_max_rate = 24 * 1000 * 1000; //24M
+           p_context->rc_min_rate = 100 * 1000; // 100k
+        } else {
+           if( !var_GetInteger( p_enc, ENC_CFG_PREFIX "qmin" ) )
+           {
+              p_context->mb_qmin = p_context->qmin = FF_QP2LAMBDA;
+              p_context->mb_lmin = p_context->lmin = FF_QP2LAMBDA;
+           }
+
+           p_context->rc_max_rate = 1.5 * 1000 * 1000; //1.5M
+           p_context->rc_min_rate = 40 * 1000; // 40k
+        }
 
 
 #if 0 /* enable when/if vp8 encoder is accepted in libavcodec */



More information about the vlc-commits mailing list