Refactor av1_refining_search_8p_c() interface

Remove dependency on macroblock_plane.

Change-Id: I65543d479c4d4a0e7b7747540f538868290462e0
diff --git a/av1/encoder/mcomp.c b/av1/encoder/mcomp.c
index e71d3ef..7b80569 100644
--- a/av1/encoder/mcomp.c
+++ b/av1/encoder/mcomp.c
@@ -2018,7 +2018,9 @@
                              const aom_variance_fn_ptr_t *fn_ptr,
                              const uint8_t *mask, int mask_stride,
                              int invert_mask, const MV *center_mv,
-                             const uint8_t *second_pred) {
+                             const uint8_t *second_pred,
+                             const struct buf_2d *src,
+                             const struct buf_2d *pre) {
   static const search_neighbors neighbors[8] = {
     { { -1, 0 }, -1 * SEARCH_GRID_STRIDE_8P + 0 },
     { { 0, -1 }, 0 * SEARCH_GRID_STRIDE_8P - 1 },
@@ -2029,9 +2031,8 @@
     { { -1, 1 }, -1 * SEARCH_GRID_STRIDE_8P + 1 },
     { { 1, 1 }, 1 * SEARCH_GRID_STRIDE_8P + 1 }
   };
-  const MACROBLOCKD *const xd = &x->e_mbd;
-  const struct buf_2d *const what = &x->plane[0].src;
-  const struct buf_2d *const in_what = &xd->plane[0].pre[0];
+  const struct buf_2d *const what = src;
+  const struct buf_2d *const in_what = pre;
   const MV fcenter_mv = { center_mv->row >> 3, center_mv->col >> 3 };
   MV *best_mv = &x->best_mv.as_mv;
   unsigned int best_sad = INT_MAX;
diff --git a/av1/encoder/mcomp.h b/av1/encoder/mcomp.h
index da965e9..72169c9 100644
--- a/av1/encoder/mcomp.h
+++ b/av1/encoder/mcomp.h
@@ -133,7 +133,9 @@
                              const aom_variance_fn_ptr_t *fn_ptr,
                              const uint8_t *mask, int mask_stride,
                              int invert_mask, const MV *center_mv,
-                             const uint8_t *second_pred);
+                             const uint8_t *second_pred,
+                             const struct buf_2d *src,
+                             const struct buf_2d *pre);
 
 int av1_full_pixel_search(const struct AV1_COMP *cpi, MACROBLOCK *x,
                           BLOCK_SIZE bsize, MV *mvp_full, int step_param,
diff --git a/av1/encoder/rdopt.c b/av1/encoder/rdopt.c
index 2effddb..641d261 100644
--- a/av1/encoder/rdopt.c
+++ b/av1/encoder/rdopt.c
@@ -7087,9 +7087,9 @@
     best_mv->row >>= 3;
 
     // Small-range full-pixel motion search.
-    bestsme = av1_refining_search_8p_c(x, sadpb, search_range,
-                                       &cpi->fn_ptr[bsize], mask, mask_stride,
-                                       id, &ref_mv[id].as_mv, second_pred);
+    bestsme = av1_refining_search_8p_c(
+        x, sadpb, search_range, &cpi->fn_ptr[bsize], mask, mask_stride, id,
+        &ref_mv[id].as_mv, second_pred, &x->plane[0].src, &ref_yv12[id]);
     if (bestsme < INT_MAX) {
       if (mask)
         bestsme = av1_get_mvpred_mask_var(x, best_mv, &ref_mv[id].as_mv,
@@ -7645,6 +7645,7 @@
 
   // Store the first prediction buffer.
   struct buf_2d orig_yv12;
+  struct buf_2d ref_yv12 = pd->pre[ref_idx];
   if (ref_idx) {
     orig_yv12 = pd->pre[0];
     pd->pre[0] = pd->pre[ref_idx];
@@ -7681,9 +7682,9 @@
   best_mv->row >>= 3;
 
   // Small-range full-pixel motion search.
-  bestsme = av1_refining_search_8p_c(x, sadpb, search_range,
-                                     &cpi->fn_ptr[bsize], mask, mask_stride,
-                                     ref_idx, &ref_mv.as_mv, second_pred);
+  bestsme = av1_refining_search_8p_c(
+      x, sadpb, search_range, &cpi->fn_ptr[bsize], mask, mask_stride, ref_idx,
+      &ref_mv.as_mv, second_pred, &x->plane[0].src, &ref_yv12);
   if (bestsme < INT_MAX) {
     if (mask)
       bestsme =