fixing qmin==qmax && qsquish==1

Originally committed as revision 865 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Michael Niedermayer 2002-08-25 23:49:50 +00:00
parent d0d816d8bf
commit c695ca3bce

View File

@ -387,7 +387,7 @@ static double modify_qscale(MpegEncContext *s, RateControlEntry *rce, double q,
}
}
if(s->avctx->rc_qsquish==0.0){
if(s->avctx->rc_qsquish==0.0 || qmin==qmax){
if (q<qmin) q=qmin;
else if(q>qmax) q=qmax;
}else{
@ -517,12 +517,12 @@ int ff_rate_estimate_qscale(MpegEncContext *s)
q= get_qscale(s, rce, rate_factor, picture_number);
assert(q>0.0);
//printf("%f ", q);
if (pict_type==I_TYPE && s->avctx->i_quant_factor>0.0)
q= rcc->next_p_qscale*s->avctx->i_quant_factor + s->avctx->i_quant_offset;
else if(pict_type==B_TYPE && s->avctx->b_quant_factor>0.0)
q= rcc->next_non_b_qscale*s->avctx->b_quant_factor + s->avctx->b_quant_offset;
//printf("%f ", q);
assert(q>0.0);
@ -540,6 +540,8 @@ int ff_rate_estimate_qscale(MpegEncContext *s)
rcc->pass1_wanted_bits+= s->bit_rate/fps;
assert(q>0.0);
if(pict_type != B_TYPE) rcc->next_non_b_qscale= q;
if(pict_type == P_TYPE) rcc->next_p_qscale= q;
}