[x264-devel] commit: Fix integer overflow in 2-pass VBV (Jason Garrett-Glaser )

git version control git at videolan.org
Wed Sep 23 11:01:52 CEST 2009


x264 | branch: master | Jason Garrett-Glaser <darkshikari at gmail.com> | Sat Sep 19 09:50:59 2009 -0700| [d52d2db898fa4e7790964cd656a1da3a0c005881] | committer: Jason Garrett-Glaser 

Fix integer overflow in 2-pass VBV
Bug caused slight undersizing in 2-pass mode in some cases.

> http://git.videolan.org/gitweb.cgi/x264.git/?a=commit;h=d52d2db898fa4e7790964cd656a1da3a0c005881
---

 encoder/ratecontrol.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/encoder/ratecontrol.c b/encoder/ratecontrol.c
index d19cb26..b082cc7 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");



More information about the x264-devel mailing list