diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2007-07-29 21:34:31 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2007-07-29 21:34:31 +0000 |
commit | 2711cb28f46463760f0326d806fe5ef9551ade2c (patch) | |
tree | 4f04370e4f83e1ac6190a01bc1fedbd71d0c4cfe /libavcodec/ratecontrol.c | |
parent | 3dd2a1c53f6678b1e30606116d835ee73238ae08 (diff) | |
download | ffmpeg-2711cb28f46463760f0326d806fe5ef9551ade2c.tar.gz |
prevent assert failure with negative quant_offset
Originally committed as revision 9830 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/ratecontrol.c')
-rw-r--r-- | libavcodec/ratecontrol.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/libavcodec/ratecontrol.c b/libavcodec/ratecontrol.c index d62bc851d8..961f83570a 100644 --- a/libavcodec/ratecontrol.c +++ b/libavcodec/ratecontrol.c @@ -371,6 +371,7 @@ static double get_qscale(MpegEncContext *s, RateControlEntry *rce, double rate_f q= -q*s->avctx->i_quant_factor + s->avctx->i_quant_offset; else if(pict_type==B_TYPE && s->avctx->b_quant_factor<0.0) q= -q*s->avctx->b_quant_factor + s->avctx->b_quant_offset; + if(q<1) q=1; return q; } @@ -386,6 +387,7 @@ static double get_diff_limited_q(MpegEncContext *s, RateControlEntry *rce, doubl q= last_p_q *FFABS(a->i_quant_factor) + a->i_quant_offset; else if(pict_type==B_TYPE && a->b_quant_factor>0.0) q= last_non_b_q* a->b_quant_factor + a->b_quant_offset; + if(q<1) q=1; /* last qscale / qdiff stuff */ if(rcc->last_non_b_pict_type==pict_type || pict_type!=I_TYPE){ |