aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/ratecontrol.c
diff options
context:
space:
mode:
authorBaptiste Coudurier <baptiste.coudurier@smartjog.com>2008-11-29 14:08:48 +0000
committerStefano Sabatini <stefano.sabatini-lala@poste.it>2008-11-29 14:08:48 +0000
commit3bff4d8b7a9342e795c925ebab407cead2b9b54e (patch)
tree3c0aa9012cba95c2f5543d7b6334821bc908496c /libavcodec/ratecontrol.c
parentcd0e37d3b16c403d922857ffb7df35ed6e89e50d (diff)
downloadffmpeg-3bff4d8b7a9342e795c925ebab407cead2b9b54e.tar.gz
Implement the fields rc_max_available_vbv_use and
rc_min_vbv_overflow_use in AVCodecContext, and use their values in the ratecontrol code rather than hardcoded ones. See the thread: "[RFC] ratecontrol buffer size magic". Patch by Baptiste Coudurier. Originally committed as revision 15955 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/ratecontrol.c')
-rw-r--r--libavcodec/ratecontrol.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libavcodec/ratecontrol.c b/libavcodec/ratecontrol.c
index 8e248b9083..c88059aa41 100644
--- a/libavcodec/ratecontrol.c
+++ b/libavcodec/ratecontrol.c
@@ -461,7 +461,7 @@ static double modify_qscale(MpegEncContext *s, RateControlEntry *rce, double q,
else if(d<0.0001) d=0.0001;
q*= pow(d, 1.0/s->avctx->rc_buffer_aggressivity);
- q_limit= bits2qp(rce, FFMAX((min_rate - buffer_size + rcc->buffer_index)*3, 1));
+ q_limit= bits2qp(rce, FFMAX((min_rate - buffer_size + rcc->buffer_index) * s->avctx->rc_min_vbv_overflow_use, 1));
if(q > q_limit){
if(s->avctx->debug&FF_DEBUG_RC){
av_log(s->avctx, AV_LOG_DEBUG, "limiting QP %f -> %f\n", q, q_limit);
@@ -476,7 +476,7 @@ static double modify_qscale(MpegEncContext *s, RateControlEntry *rce, double q,
else if(d<0.0001) d=0.0001;
q/= pow(d, 1.0/s->avctx->rc_buffer_aggressivity);
- q_limit= bits2qp(rce, FFMAX(rcc->buffer_index/3, 1));
+ q_limit= bits2qp(rce, FFMAX(rcc->buffer_index * s->avctx->rc_max_available_vbv_use, 1));
if(q < q_limit){
if(s->avctx->debug&FF_DEBUG_RC){
av_log(s->avctx, AV_LOG_DEBUG, "limiting QP %f -> %f\n", q, q_limit);