From 9e6650e9b523db04fa916af69bf5cfaa9fee6c4e Mon Sep 17 00:00:00 2001 From: Fiona Glaser Date: Sat, 19 Sep 2009 09:50:59 -0700 Subject: [PATCH] Fix integer overflow in 2-pass VBV Bug caused slight undersizing in 2-pass mode in some cases. --- encoder/ratecontrol.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/encoder/ratecontrol.c b/encoder/ratecontrol.c index c6b9f6d2..72d3c372 100644 --- a/encoder/ratecontrol.c +++ b/encoder/ratecontrol.c @@ -1936,7 +1936,7 @@ static int vbv_pass2( x264_t *h ) adj_max = fix_underflow(h, t0, t1, 1.001, qscale_min, qscale_max); expected_bits = count_expected_bits(h); - } while((expected_bits < .995*all_available_bits) && ((int)(expected_bits+.5) > (int)(prev_bits+.5)) ); + } while((expected_bits < .995*all_available_bits) && ((int64_t)(expected_bits+.5) > (int64_t)(prev_bits+.5)) ); if (!adj_max) x264_log( h, X264_LOG_WARNING, "vbv-maxrate issue, qpmax or vbv-maxrate too low\n"); -- 2.40.0