diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2015-09-22 20:17:40 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2015-09-22 21:02:50 +0200 |
commit | 31623e9d1ea960035cee59839e016397a559dab3 (patch) | |
tree | 549b32a71d0bd107e6a790a7aae8dd66aeb698b0 | |
parent | f9f0b4c08e7dc2c178ede137af4f64ca84ab2deb (diff) | |
download | ffmpeg-31623e9d1ea960035cee59839e016397a559dab3.tar.gz |
avcodec/mpegvideo_enc: Avoid fine lambda steps in VBV retry code when RD is not in use
Reduces the number of times the vbv retry code is used and should have no
effect on quality
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | libavcodec/mpegvideo_enc.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c index 8aca1d0b3a..76eb40f073 100644 --- a/libavcodec/mpegvideo_enc.c +++ b/libavcodec/mpegvideo_enc.c @@ -1824,16 +1824,18 @@ vbv_retry: if (avctx->rc_buffer_size) { RateControlContext *rcc = &s->rc_context; int max_size = FFMAX(rcc->buffer_index * avctx->rc_max_available_vbv_use, rcc->buffer_index - 500); + int hq = (s->avctx->mb_decision == FF_MB_DECISION_RD || s->avctx->trellis); + int min_step = hq ? 1 : (1<<(FF_LAMBDA_SHIFT + 7))/139; if (put_bits_count(&s->pb) > max_size && s->lambda < s->lmax) { - s->next_lambda = FFMAX(s->lambda + 1, s->lambda * + s->next_lambda = FFMAX(s->lambda + min_step, s->lambda * (s->qscale + 1) / s->qscale); if (s->adaptive_quant) { int i; for (i = 0; i < s->mb_height * s->mb_stride; i++) s->lambda_table[i] = - FFMAX(s->lambda_table[i] + 1, + FFMAX(s->lambda_table[i] + min_step, s->lambda_table[i] * (s->qscale + 1) / s->qscale); } |