From 91d865c17da30a27cf934179d30eb8efaa25e5d0 Mon Sep 17 00:00:00 2001 From: Jason Garrett-Glaser Date: Sat, 9 Aug 2008 09:36:04 -0600 Subject: [PATCH] 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. --- encoder/ratecontrol.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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) ) { -- 2.47.3