diff options
author | Marco <marpan@google.com> | 2015-02-26 14:27:16 -0800 |
---|---|---|
committer | Marco <marpan@google.com> | 2015-02-26 15:27:21 -0800 |
commit | c3f7bb16b4384680ef67af7c67009c60bf85c6ec (patch) | |
tree | 5a134dc55ca906623d0c093663cb7d8fd5679e53 | |
parent | e2b4ef131312f2c649d159d21e2c486bdbac19b4 (diff) | |
download | libvpx-c3f7bb16b4384680ef67af7c67009c60bf85c6ec.tar libvpx-c3f7bb16b4384680ef67af7c67009c60bf85c6ec.tar.gz libvpx-c3f7bb16b4384680ef67af7c67009c60bf85c6ec.tar.bz2 libvpx-c3f7bb16b4384680ef67af7c67009c60bf85c6ec.zip |
Fix arithmetic overflow warnings.
Change-Id: Ib85b5bc135aa0907a76b8c74faafe577e27d014f
-rw-r--r-- | vp9/encoder/vp9_aq_cyclicrefresh.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/vp9/encoder/vp9_aq_cyclicrefresh.c b/vp9/encoder/vp9_aq_cyclicrefresh.c index ff08f04e6..154068052 100644 --- a/vp9/encoder/vp9_aq_cyclicrefresh.c +++ b/vp9/encoder/vp9_aq_cyclicrefresh.c @@ -368,9 +368,11 @@ void vp9_cyclic_refresh_setup(VP9_COMP *const cpi) { cr->time_for_refresh = 0; // Set rate threshold to some multiple (set to 2 for now) of the target // rate (target is given by sb64_target_rate and scaled by 256). - cr->thresh_rate_sb = (rc->sb64_target_rate << 8) << 1; + cr->thresh_rate_sb = ((int64_t)(rc->sb64_target_rate) << 8) << 1; // Distortion threshold, quadratic in Q, scale factor to be adjusted. - cr->thresh_dist_sb = (int)(q * q) << 2; + // q will not exceed 457, so (q * q) is within 32bit; see: + // vp9_convert_qindex_to_q(), vp9_ac_quant(), ac_qlookup*[]. + cr->thresh_dist_sb = ((int64_t)(q * q)) << 2; cr->motion_thresh = 32; // Set up segmentation. // Clear down the segment map. |