ref: 5e4f4196a98a015dc8d6c5c0127c1ab6fd05ac84
parent: b4874e2c82fc343b3e0a27feabb8b0a61c8eb184
parent: 03094a5533fee1435f9c9cfd1e6e812f17fdbf1f
author: Yaowu Xu <yaowu@google.com>
date: Tue Nov 26 06:22:30 EST 2013
Merge "Fix unit test failures"
--- a/vp9/encoder/vp9_firstpass.c
+++ b/vp9/encoder/vp9_firstpass.c
@@ -336,9 +336,11 @@
const double max_bits = (1.0 * cpi->twopass.bits_left /
(cpi->twopass.total_stats.count - cpi->common.current_video_frame)) *
(cpi->oxcf.two_pass_vbrmax_section / 100.0);
-
- // Trap case where we are out of bits.
- return MAX((int)max_bits, 0);
+ if (max_bits < 0)
+ return 0;
+ if (max_bits >= INT_MAX)
+ return INT_MAX;
+ return (int)max_bits;
}
void vp9_init_first_pass(VP9_COMP *cpi) {
--- a/vp9/encoder/vp9_ratectrl.c
+++ b/vp9/encoder/vp9_ratectrl.c
@@ -244,7 +244,7 @@
cpi->rc.this_frame_target = target;
// 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);
}
@@ -274,7 +274,7 @@
}
// 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);
--
⑨