ref: 2b0ed0842fca7b646f75e67388162903ce8f2ef6
parent: dfc888f1f8b5c76139b6126996d117853ceb16f9
parent: c3f7bb16b4384680ef67af7c67009c60bf85c6ec
author: Marco <[email protected]>
date: Fri Feb 27 06:53:57 EST 2015
Merge "Fix arithmetic overflow warnings."
--- a/vp9/encoder/vp9_aq_cyclicrefresh.c
+++ b/vp9/encoder/vp9_aq_cyclicrefresh.c
@@ -368,9 +368,11 @@
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.