[NORMATIVE] Clip mv projection range

Guard the motion vector projection range to fit in 16 bits.

BUG=aomedia:1676

Change-Id: I903ad5ee4e79b2a23088ddc81bf09e3c279cc02e
diff --git a/av1/common/mvref_common.c b/av1/common/mvref_common.c
index bb315bf..2e1b5ee 100644
--- a/av1/common/mvref_common.c
+++ b/av1/common/mvref_common.c
@@ -32,10 +32,10 @@
   den = AOMMIN(den, MAX_FRAME_DISTANCE);
   num = num > 0 ? AOMMIN(num, MAX_FRAME_DISTANCE)
                 : AOMMAX(num, -MAX_FRAME_DISTANCE);
-  output->row =
-      (int16_t)(ROUND_POWER_OF_TWO_SIGNED(ref.row * num * div_mult[den], 14));
-  output->col =
-      (int16_t)(ROUND_POWER_OF_TWO_SIGNED(ref.col * num * div_mult[den], 14));
+  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);
+  output->row = (int16_t)clamp(mv_row, INT16_MIN, INT16_MAX);
+  output->col = (int16_t)clamp(mv_col, INT16_MIN, INT16_MAX);
 }
 
 void av1_copy_frame_mvs(const AV1_COMMON *const cm, MODE_INFO *mi, int mi_row,