ref: 614f0727e4a0e823ec5345215cbfaf62e0eba14c
parent: e062eb16fb3070c9c5f6d04419243bd3e6d93de5
parent: ad43a73883b2e18e07fc30f82486e83bf1746cdb
author: Alex Converse <[email protected]>
date: Tue Feb 2 16:12:49 EST 2016
Merge "Fix a signed overflow in vp9 motion cost."
--- a/vp9/encoder/vp9_mcomp.c
+++ b/vp9/encoder/vp9_mcomp.c
@@ -86,7 +86,9 @@
if (mvcost) {
const MV diff = { mv->row - ref->row,
mv->col - ref->col };
- return ROUND_POWER_OF_TWO(mv_cost(&diff, mvjcost, mvcost) *
+ // TODO(aconverse): See if this shift needs to be tied to
+ // VP9_PROB_COST_SHIFT.
+ return ROUND_POWER_OF_TWO((unsigned)mv_cost(&diff, mvjcost, mvcost) *
error_per_bit, 13);
}
return 0;
@@ -96,8 +98,9 @@
int error_per_bit) {
const MV diff = { mv->row - ref->row,
mv->col - ref->col };
- return ROUND_POWER_OF_TWO(mv_cost(&diff, x->nmvjointsadcost,
- x->nmvsadcost) * error_per_bit, 8);
+ // TODO(aconverse): See if this shift needs to be tied to VP9_PROB_COST_SHIFT.
+ return ROUND_POWER_OF_TWO((unsigned)mv_cost(&diff, x->nmvjointsadcost,
+ x->nmvsadcost) * error_per_bit, 8);
}
void vp9_init_dsmotion_compensation(search_site_config *cfg, int stride) {