ref: 1c9b0918b30cff580d952e52a85fb2b2a1b78d07
parent: 614f0727e4a0e823ec5345215cbfaf62e0eba14c
author: hui su <[email protected]>
date: Tue Feb 2 08:50:26 EST 2016
Fix some interger overflow errors Change-Id: I7e44bd952f28ce9925e8bdf6ee8ca2bb13de1b49
--- a/vp9/encoder/vp9_mcomp.c
+++ b/vp9/encoder/vp9_mcomp.c
@@ -153,10 +153,10 @@
*/
/* estimated cost of a motion vector (r,c) */
-#define MVC(r, c) \
- (mvcost ? \
- ((mvjcost[((r) != rr) * 2 + ((c) != rc)] + \
- mvcost[0][((r) - rr)] + mvcost[1][((c) - rc)]) * \
+#define MVC(r, c) \
+ (mvcost ? \
+ ((unsigned)(mvjcost[((r) != rr) * 2 + ((c) != rc)] + \
+ mvcost[0][((r) - rr)] + mvcost[1][((c) - rc)]) * \
error_per_bit + 4096) >> 13 : 0)
@@ -849,9 +849,9 @@
cost_list[i + 1] = fn_ptr->vf(what->buf, what->stride,
get_buf_from_mv(in_what, &this_mv),
in_what->stride, &sse) +
- // mvsad_err_cost(x, &this_mv, &fcenter_mv, sadpb);
- mv_err_cost(&this_mv, &fcenter_mv, x->nmvjointcost, x->mvcost,
- x->errorperbit);
+ mv_err_cost(&this_mv, &fcenter_mv,
+ x->nmvjointcost, x->mvcost,
+ x->errorperbit);
}
} else {
for (i = 0; i < 4; i++) {
@@ -863,9 +863,9 @@
cost_list[i + 1] = fn_ptr->vf(what->buf, what->stride,
get_buf_from_mv(in_what, &this_mv),
in_what->stride, &sse) +
- // mvsad_err_cost(x, &this_mv, &fcenter_mv, sadpb);
- mv_err_cost(&this_mv, &fcenter_mv, x->nmvjointcost, x->mvcost,
- x->errorperbit);
+ mv_err_cost(&this_mv, &fcenter_mv,
+ x->nmvjointcost, x->mvcost,
+ x->errorperbit);
}
}
}
--- a/vp9/encoder/x86/vp9_diamond_search_sad_avx.c
+++ b/vp9/encoder/x86/vp9_diamond_search_sad_avx.c
@@ -50,8 +50,9 @@
int error_per_bit) {
const int_mv diff = pack_int_mv(mv.as_mv.row - ref->row,
mv.as_mv.col - ref->col);
- return ROUND_POWER_OF_TWO(mv_cost(diff, x->nmvjointsadcost,
- x->nmvsadcost) * error_per_bit, 8);
+ return ROUND_POWER_OF_TWO((unsigned)mv_cost(diff, x->nmvjointsadcost,
+ x->nmvsadcost) *
+ error_per_bit, 8);
}
/*****************************************************************************