Commit 9395b34e authored by Yaowu Xu's avatar Yaowu Xu
Browse files

Upgrade to int64_t to avoid out-of-range

Change-Id: I64c523a34b4d69450759433e125a79e63d928037
parent b5da9ee8
......@@ -90,7 +90,8 @@ static INLINE int mv_cost(const MV *mv, const int *joint_cost,
int av1_mv_bit_cost(const MV *mv, const MV *ref, const int *mvjcost,
int *mvcost[2], int weight) {
const MV diff = { mv->row - ref->row, mv->col - ref->col };
return ROUND_POWER_OF_TWO(mv_cost(&diff, mvjcost, mvcost) * weight, 7);
return (int)ROUND_POWER_OF_TWO(
(int64_t)mv_cost(&diff, mvjcost, mvcost) * weight, 7);
}
#define PIXEL_TRANSFORM_ERROR_SCALE 4
......@@ -109,8 +110,8 @@ static int mv_err_cost(const MV *mv, const MV *ref, const int *mvjcost,
static int mvsad_err_cost(const MACROBLOCK *x, const MV *mv, const MV *ref,
int sad_per_bit) {
const MV diff = { (mv->row - ref->row) * 8, (mv->col - ref->col) * 8 };
return ROUND_POWER_OF_TWO(
(unsigned)mv_cost(&diff, x->nmvjointsadcost, x->mvsadcost) * sad_per_bit,
return (int)ROUND_POWER_OF_TWO(
(int64_t)mv_cost(&diff, x->nmvjointsadcost, x->mvsadcost) * sad_per_bit,
AV1_PROB_COST_SHIFT);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment