avoid shift of negative values
Rewrite operations to remove left shift.
Change-Id: I21f839e3615b725bb599174a581232e1aad46ac5
diff --git a/av1/common/mv.h b/av1/common/mv.h
index bf43a6a..799c27b 100644
--- a/av1/common/mv.h
+++ b/av1/common/mv.h
@@ -190,10 +190,10 @@
}
static INLINE int convert_to_trans_prec(int allow_hp, int coor) {
- const int shift =
- allow_hp ? WARPEDMODEL_PREC_BITS - 3 : WARPEDMODEL_PREC_BITS - 2;
- const int scale = allow_hp ? 0 : 1;
- return (ROUND_POWER_OF_TWO_SIGNED(coor, shift) << scale);
+ if (allow_hp)
+ return ROUND_POWER_OF_TWO_SIGNED(coor, WARPEDMODEL_PREC_BITS - 3);
+ else
+ return ROUND_POWER_OF_TWO_SIGNED(coor, WARPEDMODEL_PREC_BITS - 2) * 2;
}
// Convert a global motion translation vector (which may have more bits than a
@@ -227,6 +227,7 @@
assert(gm->wmmat[5] == gm->wmmat[2]);
assert(gm->wmmat[4] == -gm->wmmat[3]);
}
+
xc = mat[2] * x + mat[3] * y + mat[0];
yc = mat[4] * x + mat[5] * y + mat[1];