Use 8x8 block resolution to store motion vectors

Store the reference frame motion vectors in 8x8 block resolution.

Change-Id: I5afde20c40f09b44e943034232359bdaac4a2b64
diff --git a/av1/decoder/decodemv.c b/av1/decoder/decodemv.c
index 0a599c7..4fea6d0 100644
--- a/av1/decoder/decodemv.c
+++ b/av1/decoder/decodemv.c
@@ -2929,7 +2929,10 @@
                         int y_mis) {
   AV1_COMMON *const cm = &pbi->common;
   MODE_INFO *const mi = xd->mi[0];
-  MV_REF *frame_mvs = cm->cur_frame->mvs + mi_row * cm->mi_cols + mi_col;
+  MV_REF *frame_mvs =
+      cm->cur_frame->mvs + (mi_row & 0xfffe) * cm->mi_cols + (mi_col & 0xfffe);
+  x_mis = AOMMAX(x_mis, 2);
+  y_mis = AOMMAX(y_mis, 2);
   int w, h;
 
 #if CONFIG_INTRABC
diff --git a/av1/encoder/encodeframe.c b/av1/encoder/encodeframe.c
index 821d0cc..459242a 100644
--- a/av1/encoder/encodeframe.c
+++ b/av1/encoder/encodeframe.c
@@ -591,9 +591,8 @@
   const struct segmentation *const seg = &cm->seg;
   const int bw = mi_size_wide[mi->mbmi.sb_type];
   const int bh = mi_size_high[mi->mbmi.sb_type];
-  const int x_mis = AOMMIN(bw, cm->mi_cols - mi_col);
-  const int y_mis = AOMMIN(bh, cm->mi_rows - mi_row);
-  MV_REF *const frame_mvs = cm->cur_frame->mvs + mi_row * cm->mi_cols + mi_col;
+  int x_mis = AOMMIN(bw, cm->mi_cols - mi_col);
+  int y_mis = AOMMIN(bh, cm->mi_rows - mi_row);
   int w, h;
 
   const int mis = cm->mi_stride;
@@ -757,6 +756,10 @@
     rdc->comp_pred_diff[REFERENCE_MODE_SELECT] += ctx->hybrid_pred_diff;
   }
 
+  MV_REF *const frame_mvs =
+      cm->cur_frame->mvs + (mi_row & 0xfffe) * cm->mi_cols + (mi_col & 0xfffe);
+  x_mis = AOMMAX(2, x_mis);
+  y_mis = AOMMAX(2, y_mis);
   for (h = 0; h < y_mis; ++h) {
     MV_REF *const frame_mv = frame_mvs + h * cm->mi_cols;
     for (w = 0; w < x_mis; ++w) {