]> git.videolan.org Git - x264.git/commitdiff
Fix integer overflow in 2-pass VBV
authorJason Garrett-Glaser <darkshikari@gmail.com>
Sat, 19 Sep 2009 16:50:59 +0000 (09:50 -0700)
committerJason Garrett-Glaser <darkshikari@gmail.com>
Mon, 21 Sep 2009 06:01:00 +0000 (23:01 -0700)
Bug caused slight undersizing in 2-pass mode in some cases.

encoder/ratecontrol.c

index d19cb26291a0718163bc6145c5eb498fc9aa1d91..b082cc77b10b86e053cf7b6b05c19518ac794a5c 100644 (file)
@@ -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");