[FFmpeg-devel] [PATCH] libvpx: rc buffer support

James Zern jzern
Mon Jul 26 21:39:11 CEST 2010


On Thu, Jul 22, 2010 at 08:26, Michael Niedermayer <michaelni at gmx.at> wrote:
> On Mon, Jun 14, 2010 at 04:06:51PM -0400, James Zern wrote:
>> The attached maps libvpx rc_buf* and rc_undershoot_pct.
>> rc_overshoot_pct is unused by VP8 so it is left untouched.
>> There didn't seem to be a direct mapping for rc_optimal_buf_sz so
>> instead of introducing a new parameter this sets it in line with the
>> recommended settings and library defaults (5/6 of the buffer_size).
>> The use of rc_buffer_aggressivity for rc_undershoot_pct may be
>> questionable, so if there's something more correct that I missed
>> please let me know. It does also alter the library default from 95 to
>> 100, but again this is more along the line of the recommended values
>> for VBR.
>
> if you send a patch that just sets things that match in sematic meaning
> il approve it.
> The rest should be handled via codec specific options once they are in
> svn
>
The attached drops the rc_undershoot_pct mapping. The rc_buf_*
settings are I believe correct in using
rc_buffer_size/rc_initial_buffer_occupancy.
-------------- next part --------------
Index: libavcodec/libvpxenc.c
===================================================================
--- libavcodec/libvpxenc.c	(revision 24512)
+++ libavcodec/libvpxenc.c	(working copy)
@@ -249,6 +249,14 @@ static av_cold int vp8_init(AVCodecConte
         enccfg.rc_2pass_vbr_maxsection_pct =
             avctx->rc_max_rate * 100 / avctx->bit_rate;
 
+    if (avctx->rc_buffer_size)
+        enccfg.rc_buf_sz         =
+            avctx->rc_buffer_size * 1000 / avctx->bit_rate;
+    if (avctx->rc_initial_buffer_occupancy)
+        enccfg.rc_buf_initial_sz =
+            avctx->rc_initial_buffer_occupancy * 1000 / avctx->bit_rate;
+    enccfg.rc_buf_optimal_sz     = enccfg.rc_buf_sz * 5 / 6;
+
     //_enc_init() will balk if kf_min_dist differs from max w/VPX_KF_AUTO
     if (avctx->keyint_min == avctx->gop_size)
         enccfg.kf_min_dist = avctx->keyint_min;



More information about the ffmpeg-devel mailing list