Commit 5e4f4196 authored by Yaowu Xu's avatar Yaowu Xu Committed by Gerrit Code Review
Browse files

Merge "Fix unit test failures"

parents b4874e2c 03094a55
...@@ -336,9 +336,11 @@ static int frame_max_bits(VP9_COMP *cpi) { ...@@ -336,9 +336,11 @@ static int frame_max_bits(VP9_COMP *cpi) {
const double max_bits = (1.0 * cpi->twopass.bits_left / const double max_bits = (1.0 * cpi->twopass.bits_left /
(cpi->twopass.total_stats.count - cpi->common.current_video_frame)) * (cpi->twopass.total_stats.count - cpi->common.current_video_frame)) *
(cpi->oxcf.two_pass_vbrmax_section / 100.0); (cpi->oxcf.two_pass_vbrmax_section / 100.0);
if (max_bits < 0)
// Trap case where we are out of bits. return 0;
return MAX((int)max_bits, 0); if (max_bits >= INT_MAX)
return INT_MAX;
return (int)max_bits;
} }
void vp9_init_first_pass(VP9_COMP *cpi) { void vp9_init_first_pass(VP9_COMP *cpi) {
......
...@@ -244,7 +244,7 @@ static void calc_iframe_target_size(VP9_COMP *cpi) { ...@@ -244,7 +244,7 @@ static void calc_iframe_target_size(VP9_COMP *cpi) {
cpi->rc.this_frame_target = target; cpi->rc.this_frame_target = target;
// Target rate per SB64 (including partial SB64s. // Target rate per SB64 (including partial SB64s.
cpi->rc.sb64_target_rate = (cpi->rc.this_frame_target * 64 * 64) / cpi->rc.sb64_target_rate = ((int64_t)cpi->rc.this_frame_target * 64 * 64) /
(cpi->common.width * cpi->common.height); (cpi->common.width * cpi->common.height);
} }
...@@ -274,7 +274,7 @@ static void calc_pframe_target_size(VP9_COMP *cpi) { ...@@ -274,7 +274,7 @@ static void calc_pframe_target_size(VP9_COMP *cpi) {
} }
// Target rate per SB64 (including partial SB64s. // Target rate per SB64 (including partial SB64s.
cpi->rc.sb64_target_rate = (cpi->rc.this_frame_target * 64 * 64) / cpi->rc.sb64_target_rate = ((int64_t)cpi->rc.this_frame_target * 64 * 64) /
(cpi->common.width * cpi->common.height); (cpi->common.width * cpi->common.height);
......
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