[NORMATIVE] Fix clamping in get_mv_projection()
get_mv_projection() is currently able to produce motion vectors which
are invalid (according to is_mv_valid() in the decoder). This can be
fixed by adjusting the range of the clamp operation.
BUG=aomedia:1947
Change-Id: I309463be4be868a20042ac26307b84efb63665d6
diff --git a/av1/common/mvref_common.c b/av1/common/mvref_common.c
index 33cdb61..d692137 100644
--- a/av1/common/mvref_common.c
+++ b/av1/common/mvref_common.c
@@ -29,8 +29,8 @@
: AOMMAX(num, -MAX_FRAME_DISTANCE);
int mv_row = ROUND_POWER_OF_TWO_SIGNED(ref.row * num * div_mult[den], 14);
int mv_col = ROUND_POWER_OF_TWO_SIGNED(ref.col * num * div_mult[den], 14);
- const int clamp_max = (1 << 14) - 1;
- const int clamp_min = -(1 << 14);
+ const int clamp_max = MV_UPP - 1;
+ const int clamp_min = MV_LOW + 1;
output->row = (int16_t)clamp(mv_row, clamp_min, clamp_max);
output->col = (int16_t)clamp(mv_col, clamp_min, clamp_max);
}