Commit 9e6650e9 authored by Fiona Glaser's avatar Fiona Glaser

Fix integer overflow in 2-pass VBV

Bug caused slight undersizing in 2-pass mode in some cases.
parent c4c49802
...@@ -1936,7 +1936,7 @@ static int vbv_pass2( x264_t *h ) ...@@ -1936,7 +1936,7 @@ static int vbv_pass2( x264_t *h )
adj_max = fix_underflow(h, t0, t1, 1.001, qscale_min, qscale_max); adj_max = fix_underflow(h, t0, t1, 1.001, qscale_min, qscale_max);
expected_bits = count_expected_bits(h); 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) if (!adj_max)
x264_log( h, X264_LOG_WARNING, "vbv-maxrate issue, qpmax or vbv-maxrate too low\n"); x264_log( h, X264_LOG_WARNING, "vbv-maxrate issue, qpmax or vbv-maxrate too low\n");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment