[FFmpeg-cvslog] avcodec/mpegvideo_enc: Only enforce rc_max_available_vbv_use on first encoding attempt

Michael Niedermayer git at videolan.org
Mon Sep 29 00:29:22 CEST 2014


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Sun Sep 28 23:40:02 2014 +0200| [755f7929c6aa919918df534ae68cc78441b186e7] | committer: Michael Niedermayer

avcodec/mpegvideo_enc: Only enforce rc_max_available_vbv_use on first encoding attempt

This reduces repeatly re-encoding to achieve VBV compliance

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=755f7929c6aa919918df534ae68cc78441b186e7
---

 libavcodec/mpegvideo_enc.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index 03b96e5..81298c8 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -1746,7 +1746,7 @@ vbv_retry:
 
         if (avctx->rc_buffer_size) {
             RateControlContext *rcc = &s->rc_context;
-            int max_size = rcc->buffer_index * avctx->rc_max_available_vbv_use;
+            int max_size = FFMAX(rcc->buffer_index * avctx->rc_max_available_vbv_use, rcc->buffer_index - 500);
 
             if (put_bits_count(&s->pb) > max_size &&
                 s->lambda < s->avctx->lmax) {



More information about the ffmpeg-cvslog mailing list