From: Anton Mitrofanov Date: Mon, 30 May 2011 20:13:22 +0000 (+0400) Subject: Fix crash with VBV + forced QP X-Git-Url: http://www.zmx.ovh/git.videolan.org/?a=commitdiff_plain;h=774555b37ab6f3c2df7b1e2ac576c54e04a7381e;p=x264.git Fix crash with VBV + forced QP --- diff --git a/encoder/ratecontrol.c b/encoder/ratecontrol.c index af15d1f4..2e90fbe9 100644 --- a/encoder/ratecontrol.c +++ b/encoder/ratecontrol.c @@ -1256,11 +1256,7 @@ void x264_ratecontrol_start( x264_t *h, int i_force_qp, int overhead ) if( h->sh.i_type != SLICE_TYPE_B ) rc->bframes = h->fenc->i_bframes; - if( i_force_qp != X264_QP_AUTO ) - { - q = i_force_qp - 1; - } - else if( rc->b_abr ) + if( rc->b_abr ) { q = qscale2qp( rate_estimate_qscale( h ) ); } @@ -1284,6 +1280,8 @@ void x264_ratecontrol_start( x264_t *h, int i_force_qp, int overhead ) q -= 6*log2f( zone->f_bitrate_factor ); } } + if( i_force_qp != X264_QP_AUTO ) + q = i_force_qp - 1; q = x264_clip3f( q, h->param.rc.i_qp_min, h->param.rc.i_qp_max );