aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/mpegvideo.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2006-11-20 11:53:02 +0000
committerMichael Niedermayer <michaelni@gmx.at>2006-11-20 11:53:02 +0000
commitec9ed85dc73a9ead14dce086625996da8858c475 (patch)
tree64b9a0b5be1b9ae3f7c6496be7dd73588f75b511 /libavcodec/mpegvideo.c
parent789382d3403d08fed25246cebff2617c3a23ecc6 (diff)
downloadffmpeg-ec9ed85dc73a9ead14dce086625996da8858c475.tar.gz
infiinit loop fix for CBR + adaptive quant
Originally committed as revision 7133 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/mpegvideo.c')
-rw-r--r--libavcodec/mpegvideo.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index 791744d3f1..ae527d423a 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -2552,6 +2552,11 @@ vbv_retry:
if(put_bits_count(&s->pb) > max_size && s->lambda < s->avctx->lmax){
s->next_lambda= FFMAX(s->lambda+1, s->lambda*(s->qscale+1) / s->qscale);
+ if(s->adaptive_quant){
+ int i;
+ for(i=0; i<s->mb_height*s->mb_width; i++)
+ s->lambda_table[i]= FFMAX(s->lambda_table[i]+1, s->lambda_table[i]*(s->qscale+1) / s->qscale);
+ }
s->mb_skipped = 0; //done in MPV_frame_start()
if(s->pict_type==P_TYPE){ //done in encode_picture() so we must undo it
if(s->flipflop_rounding || s->codec_id == CODEC_ID_H263P || s->codec_id == CODEC_ID_MPEG4)