From: Jason Garrett-Glaser Date: Sat, 9 Aug 2008 15:36:04 +0000 (-0600) Subject: Prevent VBV from lowering quantizer too much X-Git-Url: http://www.zmx.ovh/git.videolan.org/?a=commitdiff_plain;h=91d865c17da30a27cf934179d30eb8efaa25e5d0;p=x264.git Prevent VBV from lowering quantizer too much This code seemed to act up unexpectedly sometimes, creating a situation where in 1-pass VBV mode, a frame's quantizer would drop all the way to qpmin and then shoot back upwards to qpmax, causing serious visual issues. This change may decrease bitrate in VBV mode, but that is preferable to the artifacting produced by this code. --- diff --git a/encoder/ratecontrol.c b/encoder/ratecontrol.c index 10f4df06..fc60c025 100644 --- a/encoder/ratecontrol.c +++ b/encoder/ratecontrol.c @@ -977,7 +977,7 @@ void x264_ratecontrol_mb( x264_t *h, int bits ) } while( rc->qpm > i_qp_min - && ((buffer_left_planned > rc->buffer_size * 0.4) || rc->qpm > h->fdec->i_row_qp[0]) + && rc->qpm > h->fdec->i_row_qp[0] && ((b1 < rc->frame_size_planned * 0.8 && rc->qpm <= prev_row_qp) || b1 < (rc->buffer_fill - rc->buffer_size + rc->buffer_rate) * 1.1) ) {