Remove global offset components from warped motion samples

To calculate wmmat[2] to wmmat[5], we don't need the absolute
coordinates which include the global offset components. Hence,
while finding samples, we only need to gather the relative coordinates
that are the neighbor block center point's coordinates relative to the
left-top pixel of current block. This patch won't change bitstream.

Change-Id: Ifbe7769effe6253b27cf97ea9c942a3a29eb7f50
diff --git a/av1/common/mvref_common.c b/av1/common/mvref_common.c
index 0ca9b1f..1c7a407 100644
--- a/av1/common/mvref_common.c
+++ b/av1/common/mvref_common.c
@@ -1601,15 +1601,12 @@
 
 #if CONFIG_EXT_WARPED_MOTION
 static INLINE void record_samples(MB_MODE_INFO *mbmi, int *pts, int *pts_inref,
-                                  int global_offset_r, int global_offset_c,
                                   int row_offset, int sign_r, int col_offset,
                                   int sign_c) {
   int bw = block_size_wide[mbmi->sb_type];
   int bh = block_size_high[mbmi->sb_type];
-  int cr_offset = row_offset * MI_SIZE + sign_r * AOMMAX(bh, MI_SIZE) / 2 - 1;
-  int cc_offset = col_offset * MI_SIZE + sign_c * AOMMAX(bw, MI_SIZE) / 2 - 1;
-  int x = cc_offset + global_offset_c;
-  int y = cr_offset + global_offset_r;
+  int x = col_offset * MI_SIZE + sign_c * AOMMAX(bw, MI_SIZE) / 2 - 1;
+  int y = row_offset * MI_SIZE + sign_r * AOMMAX(bh, MI_SIZE) / 2 - 1;
 
   pts[0] = (x * 8);
   pts[1] = (y * 8);
@@ -1663,6 +1660,8 @@
 }
 
 // Note: Samples returned are at 1/8-pel precision
+// Sample are the neighbor block center point's coordinates relative to the
+// left-top pixel of current block.
 int findSamples(const AV1_COMMON *cm, MACROBLOCKD *xd, int mi_row, int mi_col,
                 int *pts, int *pts_inref) {
   MB_MODE_INFO *const mbmi0 = &(xd->mi[0]->mbmi);
@@ -1670,8 +1669,6 @@
   int up_available = xd->up_available;
   int left_available = xd->left_available;
   int i, mi_step = 1, np = 0;
-  int global_offset_c = mi_col * MI_SIZE;
-  int global_offset_r = mi_row * MI_SIZE;
 
   const TileInfo *const tile = &xd->tile;
   int do_tl = 1;
@@ -1692,8 +1689,7 @@
       if (col_offset + n8_w > xd->n8_w) do_tr = 0;
 
       if (mbmi->ref_frame[0] == ref_frame && mbmi->ref_frame[1] == NONE_FRAME) {
-        record_samples(mbmi, pts, pts_inref, global_offset_r, global_offset_c,
-                       0, -1, col_offset, 1);
+        record_samples(mbmi, pts, pts_inref, 0, -1, col_offset, 1);
         pts += 2;
         pts_inref += 2;
         np++;
@@ -1710,8 +1706,7 @@
 
         if (mbmi->ref_frame[0] == ref_frame &&
             mbmi->ref_frame[1] == NONE_FRAME) {
-          record_samples(mbmi, pts, pts_inref, global_offset_r, global_offset_c,
-                         0, -1, i, 1);
+          record_samples(mbmi, pts, pts_inref, 0, -1, i, 1);
           pts += 2;
           pts_inref += 2;
           np++;
@@ -1737,8 +1732,7 @@
       if (row_offset < 0) do_tl = 0;
 
       if (mbmi->ref_frame[0] == ref_frame && mbmi->ref_frame[1] == NONE_FRAME) {
-        record_samples(mbmi, pts, pts_inref, global_offset_r, global_offset_c,
-                       row_offset, 1, 0, -1);
+        record_samples(mbmi, pts, pts_inref, row_offset, 1, 0, -1);
         pts += 2;
         pts_inref += 2;
         np++;
@@ -1755,8 +1749,7 @@
 
         if (mbmi->ref_frame[0] == ref_frame &&
             mbmi->ref_frame[1] == NONE_FRAME) {
-          record_samples(mbmi, pts, pts_inref, global_offset_r, global_offset_c,
-                         i, 1, 0, -1);
+          record_samples(mbmi, pts, pts_inref, i, 1, 0, -1);
           pts += 2;
           pts_inref += 2;
           np++;
@@ -1776,8 +1769,7 @@
     MB_MODE_INFO *mbmi = &mi->mbmi;
 
     if (mbmi->ref_frame[0] == ref_frame && mbmi->ref_frame[1] == NONE_FRAME) {
-      record_samples(mbmi, pts, pts_inref, global_offset_r, global_offset_c, 0,
-                     -1, 0, -1);
+      record_samples(mbmi, pts, pts_inref, 0, -1, 0, -1);
       pts += 2;
       pts_inref += 2;
       np++;
@@ -1799,8 +1791,7 @@
       MB_MODE_INFO *mbmi = &mi->mbmi;
 
       if (mbmi->ref_frame[0] == ref_frame && mbmi->ref_frame[1] == NONE_FRAME) {
-        record_samples(mbmi, pts, pts_inref, global_offset_r, global_offset_c,
-                       0, -1, xd->n8_w, 1);
+        record_samples(mbmi, pts, pts_inref, 0, -1, xd->n8_w, 1);
         np++;
         if (np >= LEAST_SQUARES_SAMPLES_MAX) return LEAST_SQUARES_SAMPLES_MAX;
       }
@@ -1818,6 +1809,8 @@
 }
 
 // Note: Samples returned are at 1/8-pel precision
+// Sample are the neighbor block center point's coordinates relative to the
+// left-top pixel of current block.
 int findSamples(const AV1_COMMON *cm, MACROBLOCKD *xd, int mi_row, int mi_col,
                 int *pts, int *pts_inref) {
   MB_MODE_INFO *const mbmi0 = &(xd->mi[0]->mbmi);
@@ -1825,8 +1818,6 @@
   int up_available = xd->up_available;
   int left_available = xd->left_available;
   int i, mi_step, np = 0;
-  int global_offset_c = mi_col * MI_SIZE;
-  int global_offset_r = mi_row * MI_SIZE;
 
   // scan the above row
   if (up_available) {
@@ -1842,10 +1833,8 @@
       if (mbmi->ref_frame[0] == ref_frame && mbmi->ref_frame[1] == NONE_FRAME) {
         int bw = block_size_wide[mbmi->sb_type];
         int bh = block_size_high[mbmi->sb_type];
-        int cr_offset = -AOMMAX(bh, MI_SIZE) / 2 - 1;
-        int cc_offset = i * MI_SIZE + AOMMAX(bw, MI_SIZE) / 2 - 1;
-        int x = cc_offset + global_offset_c;
-        int y = cr_offset + global_offset_r;
+        int x = i * MI_SIZE + AOMMAX(bw, MI_SIZE) / 2 - 1;
+        int y = -AOMMAX(bh, MI_SIZE) / 2 - 1;
 
         pts[0] = (x * 8);
         pts[1] = (y * 8);
@@ -1873,10 +1862,8 @@
       if (mbmi->ref_frame[0] == ref_frame && mbmi->ref_frame[1] == NONE_FRAME) {
         int bw = block_size_wide[mbmi->sb_type];
         int bh = block_size_high[mbmi->sb_type];
-        int cr_offset = i * MI_SIZE + AOMMAX(bh, MI_SIZE) / 2 - 1;
-        int cc_offset = -AOMMAX(bw, MI_SIZE) / 2 - 1;
-        int x = cc_offset + global_offset_c;
-        int y = cr_offset + global_offset_r;
+        int x = -AOMMAX(bw, MI_SIZE) / 2 - 1;
+        int y = i * MI_SIZE + AOMMAX(bh, MI_SIZE) / 2 - 1;
 
         pts[0] = (x * 8);
         pts[1] = (y * 8);
@@ -1900,10 +1887,8 @@
     if (mbmi->ref_frame[0] == ref_frame && mbmi->ref_frame[1] == NONE_FRAME) {
       int bw = block_size_wide[mbmi->sb_type];
       int bh = block_size_high[mbmi->sb_type];
-      int cr_offset = -AOMMAX(bh, MI_SIZE) / 2 - 1;
-      int cc_offset = -AOMMAX(bw, MI_SIZE) / 2 - 1;
-      int x = cc_offset + global_offset_c;
-      int y = cr_offset + global_offset_r;
+      int x = -AOMMAX(bw, MI_SIZE) / 2 - 1;
+      int y = -AOMMAX(bh, MI_SIZE) / 2 - 1;
 
       pts[0] = (x * 8);
       pts[1] = (y * 8);