Add pointers to temp buffers in 'xd'.

Based on comments in
https://aomedia-review.googlesource.com/c/aom/+/70022

This avoids passing the temp buffer pointers and/or 'x' all the way
through the call chain.

BUG=aomedia:2135

Change-Id: I32f0a0b006d9fb24ee1b85ff1f33012bdb0eeb42
diff --git a/av1/common/blockd.h b/av1/common/blockd.h
index 9b962fd..a2311c1 100644
--- a/av1/common/blockd.h
+++ b/av1/common/blockd.h
@@ -496,6 +496,8 @@
   int bck_offset;
 } JNT_COMP_PARAMS;
 
+// Most/all of the pointers are mere pointers to actual arrays are allocated
+// elsewhere. This is mostly for coding convenience.
 typedef struct macroblockd {
   struct macroblockd_plane plane[MAX_MB_PLANE];
 
@@ -595,6 +597,9 @@
   uint16_t cb_offset[MAX_MB_PLANE];
   uint16_t txb_offset[MAX_MB_PLANE];
   uint16_t color_index_map_offset[2];
+
+  CONV_BUF_TYPE *tmp_conv_dst;
+  uint8_t *tmp_obmc_bufs[2];
 } MACROBLOCKD;
 
 static INLINE int get_bitdepth_data_path_index(const MACROBLOCKD *xd) {
diff --git a/av1/common/reconinter.h b/av1/common/reconinter.h
index 0909932..67725b2 100644
--- a/av1/common/reconinter.h
+++ b/av1/common/reconinter.h
@@ -84,7 +84,6 @@
 
 struct build_prediction_ctxt {
   const AV1_COMMON *cm;
-  CONV_BUF_TYPE *tmp_conv_dst;
   int mi_row;
   int mi_col;
   uint8_t **tmp_buf;
diff --git a/av1/decoder/decodeframe.c b/av1/decoder/decodeframe.c
index 30f5277..03cedef 100644
--- a/av1/decoder/decodeframe.c
+++ b/av1/decoder/decodeframe.c
@@ -191,11 +191,10 @@
   (void)tx_size;
 }
 
-static void predict_inter_block_void(AV1_COMMON *const cm, const ThreadData *td,
+static void predict_inter_block_void(AV1_COMMON *const cm,
                                      MACROBLOCKD *const xd, int mi_row,
                                      int mi_col, BLOCK_SIZE bsize) {
   (void)cm;
-  (void)td;
   (void)xd;
   (void)mi_row;
   (void)mi_col;
@@ -625,7 +624,6 @@
 }
 
 static INLINE void dec_build_inter_predictors(const AV1_COMMON *cm,
-                                              CONV_BUF_TYPE *tmp_conv_dst,
                                               MACROBLOCKD *xd, int plane,
                                               const MB_MODE_INFO *mi,
                                               int build_for_obmc, int bw,
@@ -692,7 +690,7 @@
         int tmp_dst_stride = 8;
         assert(bw < 8 || bh < 8);
         ConvolveParams conv_params = get_conv_params_no_round(
-            0, plane, tmp_conv_dst, tmp_dst_stride, is_compound, xd->bd);
+            0, plane, xd->tmp_conv_dst, tmp_dst_stride, is_compound, xd->bd);
         conv_params.use_jnt_comp_avg = 0;
         struct buf_2d *const dst_buf = &pd->dst;
         uint8_t *dst = dst_buf->buf + dst_buf->stride * y + x;
@@ -796,7 +794,7 @@
     }
 
     ConvolveParams conv_params = get_conv_params_no_round(
-        0, plane, tmp_conv_dst, MAX_SB_SIZE, is_compound, xd->bd);
+        0, plane, xd->tmp_conv_dst, MAX_SB_SIZE, is_compound, xd->bd);
     av1_jnt_comp_weight_assign(cm, mi, 0, &conv_params.fwd_offset,
                                &conv_params.bck_offset,
                                &conv_params.use_jnt_comp_avg, is_compound);
@@ -829,9 +827,11 @@
   }
 }
 
-static void dec_build_inter_predictors_for_planes(
-    const AV1_COMMON *cm, const ThreadData *td, MACROBLOCKD *xd,
-    BLOCK_SIZE bsize, int mi_row, int mi_col, int plane_from, int plane_to) {
+static void dec_build_inter_predictors_for_planes(const AV1_COMMON *cm,
+                                                  MACROBLOCKD *xd,
+                                                  BLOCK_SIZE bsize, int mi_row,
+                                                  int mi_col, int plane_from,
+                                                  int plane_to) {
   int plane;
   const int mi_x = mi_col * MI_SIZE;
   const int mi_y = mi_row * MI_SIZE;
@@ -844,18 +844,15 @@
                              pd->subsampling_y))
       continue;
 
-    dec_build_inter_predictors(cm, td->tmp_conv_dst, xd, plane, xd->mi[0], 0,
-                               bw, bh, mi_x, mi_y);
+    dec_build_inter_predictors(cm, xd, plane, xd->mi[0], 0, bw, bh, mi_x, mi_y);
   }
 }
 
 static void dec_build_inter_predictors_sby(const AV1_COMMON *cm,
-                                           const ThreadData *td,
                                            MACROBLOCKD *xd, int mi_row,
                                            int mi_col, BUFFER_SET *ctx,
                                            BLOCK_SIZE bsize) {
-  dec_build_inter_predictors_for_planes(cm, td, xd, bsize, mi_row, mi_col, 0,
-                                        0);
+  dec_build_inter_predictors_for_planes(cm, xd, bsize, mi_row, mi_col, 0, 0);
 
   if (is_interintra_pred(xd->mi[0])) {
     BUFFER_SET default_ctx = { { xd->plane[0].dst.buf, NULL, NULL },
@@ -867,11 +864,10 @@
 }
 
 static void dec_build_inter_predictors_sbuv(const AV1_COMMON *cm,
-                                            const ThreadData *td,
                                             MACROBLOCKD *xd, int mi_row,
                                             int mi_col, BUFFER_SET *ctx,
                                             BLOCK_SIZE bsize) {
-  dec_build_inter_predictors_for_planes(cm, td, xd, bsize, mi_row, mi_col, 1,
+  dec_build_inter_predictors_for_planes(cm, xd, bsize, mi_row, mi_col, 1,
                                         MAX_MB_PLANE - 1);
 
   if (is_interintra_pred(xd->mi[0])) {
@@ -886,14 +882,13 @@
   }
 }
 
-static void dec_build_inter_predictors_sb(const AV1_COMMON *cm,
-                                          const ThreadData *td, MACROBLOCKD *xd,
+static void dec_build_inter_predictors_sb(const AV1_COMMON *cm, MACROBLOCKD *xd,
                                           int mi_row, int mi_col,
                                           BUFFER_SET *ctx, BLOCK_SIZE bsize) {
   const int num_planes = av1_num_planes(cm);
-  dec_build_inter_predictors_sby(cm, td, xd, mi_row, mi_col, ctx, bsize);
+  dec_build_inter_predictors_sby(cm, xd, mi_row, mi_col, ctx, bsize);
   if (num_planes > 1)
-    dec_build_inter_predictors_sbuv(cm, td, xd, mi_row, mi_col, ctx, bsize);
+    dec_build_inter_predictors_sbuv(cm, xd, mi_row, mi_col, ctx, bsize);
 }
 
 static INLINE void dec_build_prediction_by_above_pred(
@@ -918,14 +913,14 @@
                    block_size_high[BLOCK_64X64] >> (pd->subsampling_y + 1));
 
     if (av1_skip_u4x4_pred_in_obmc(bsize, pd, 0)) continue;
-    dec_build_inter_predictors(ctxt->cm, ctxt->tmp_conv_dst, xd, j,
-                               &backup_mbmi, 1, bw, bh, mi_x, mi_y);
+    dec_build_inter_predictors(ctxt->cm, xd, j, &backup_mbmi, 1, bw, bh, mi_x,
+                               mi_y);
   }
 }
 
 static void dec_build_prediction_by_above_preds(
-    const AV1_COMMON *cm, const ThreadData *td, MACROBLOCKD *xd, int mi_row,
-    int mi_col, uint8_t *tmp_buf[MAX_MB_PLANE], int tmp_width[MAX_MB_PLANE],
+    const AV1_COMMON *cm, MACROBLOCKD *xd, int mi_row, int mi_col,
+    uint8_t *tmp_buf[MAX_MB_PLANE], int tmp_width[MAX_MB_PLANE],
     int tmp_height[MAX_MB_PLANE], int tmp_stride[MAX_MB_PLANE]) {
   if (!xd->up_available) return;
 
@@ -936,11 +931,10 @@
   int pred_height = AOMMIN(this_height / 2, 32);
   xd->mb_to_bottom_edge += (this_height - pred_height) * 8;
 
-  struct build_prediction_ctxt ctxt = {
-    cm,         td->tmp_conv_dst, mi_row,
-    mi_col,     tmp_buf,          tmp_width,
-    tmp_height, tmp_stride,       xd->mb_to_right_edge
-  };
+  struct build_prediction_ctxt ctxt = { cm,         mi_row,
+                                        mi_col,     tmp_buf,
+                                        tmp_width,  tmp_height,
+                                        tmp_stride, xd->mb_to_right_edge };
   BLOCK_SIZE bsize = xd->mi[0]->sb_type;
   foreach_overlappable_nb_above(cm, xd, mi_col,
                                 max_neighbor_obmc[mi_size_wide_log2[bsize]],
@@ -972,14 +966,14 @@
     int bh = (left_mi_height << MI_SIZE_LOG2) >> pd->subsampling_y;
 
     if (av1_skip_u4x4_pred_in_obmc(bsize, pd, 1)) continue;
-    dec_build_inter_predictors(ctxt->cm, ctxt->tmp_conv_dst, xd, j,
-                               &backup_mbmi, 1, bw, bh, mi_x, mi_y);
+    dec_build_inter_predictors(ctxt->cm, xd, j, &backup_mbmi, 1, bw, bh, mi_x,
+                               mi_y);
   }
 }
 
 static void dec_build_prediction_by_left_preds(
-    const AV1_COMMON *cm, const ThreadData *td, MACROBLOCKD *xd, int mi_row,
-    int mi_col, uint8_t *tmp_buf[MAX_MB_PLANE], int tmp_width[MAX_MB_PLANE],
+    const AV1_COMMON *cm, MACROBLOCKD *xd, int mi_row, int mi_col,
+    uint8_t *tmp_buf[MAX_MB_PLANE], int tmp_width[MAX_MB_PLANE],
     int tmp_height[MAX_MB_PLANE], int tmp_stride[MAX_MB_PLANE]) {
   if (!xd->left_available) return;
 
@@ -990,11 +984,10 @@
   int pred_width = AOMMIN(this_width / 2, 32);
   xd->mb_to_right_edge += (this_width - pred_width) * 8;
 
-  struct build_prediction_ctxt ctxt = {
-    cm,         td->tmp_conv_dst, mi_row,
-    mi_col,     tmp_buf,          tmp_width,
-    tmp_height, tmp_stride,       xd->mb_to_bottom_edge
-  };
+  struct build_prediction_ctxt ctxt = { cm,         mi_row,
+                                        mi_col,     tmp_buf,
+                                        tmp_width,  tmp_height,
+                                        tmp_stride, xd->mb_to_bottom_edge };
   BLOCK_SIZE bsize = xd->mi[0]->sb_type;
   foreach_overlappable_nb_left(cm, xd, mi_row,
                                max_neighbor_obmc[mi_size_high_log2[bsize]],
@@ -1006,7 +999,6 @@
 }
 
 static void dec_build_obmc_inter_predictors_sb(const AV1_COMMON *cm,
-                                               const ThreadData *td,
                                                MACROBLOCKD *xd, int mi_row,
                                                int mi_col) {
   const int num_planes = av1_num_planes(cm);
@@ -1020,27 +1012,27 @@
 
   if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
     int len = sizeof(uint16_t);
-    dst_buf1[0] = CONVERT_TO_BYTEPTR(td->tmp_obmc_bufs[0]);
+    dst_buf1[0] = CONVERT_TO_BYTEPTR(xd->tmp_obmc_bufs[0]);
     dst_buf1[1] =
-        CONVERT_TO_BYTEPTR(td->tmp_obmc_bufs[0] + MAX_SB_SQUARE * len);
+        CONVERT_TO_BYTEPTR(xd->tmp_obmc_bufs[0] + MAX_SB_SQUARE * len);
     dst_buf1[2] =
-        CONVERT_TO_BYTEPTR(td->tmp_obmc_bufs[0] + MAX_SB_SQUARE * 2 * len);
-    dst_buf2[0] = CONVERT_TO_BYTEPTR(td->tmp_obmc_bufs[1]);
+        CONVERT_TO_BYTEPTR(xd->tmp_obmc_bufs[0] + MAX_SB_SQUARE * 2 * len);
+    dst_buf2[0] = CONVERT_TO_BYTEPTR(xd->tmp_obmc_bufs[1]);
     dst_buf2[1] =
-        CONVERT_TO_BYTEPTR(td->tmp_obmc_bufs[1] + MAX_SB_SQUARE * len);
+        CONVERT_TO_BYTEPTR(xd->tmp_obmc_bufs[1] + MAX_SB_SQUARE * len);
     dst_buf2[2] =
-        CONVERT_TO_BYTEPTR(td->tmp_obmc_bufs[1] + MAX_SB_SQUARE * 2 * len);
+        CONVERT_TO_BYTEPTR(xd->tmp_obmc_bufs[1] + MAX_SB_SQUARE * 2 * len);
   } else {
-    dst_buf1[0] = td->tmp_obmc_bufs[0];
-    dst_buf1[1] = td->tmp_obmc_bufs[0] + MAX_SB_SQUARE;
-    dst_buf1[2] = td->tmp_obmc_bufs[0] + MAX_SB_SQUARE * 2;
-    dst_buf2[0] = td->tmp_obmc_bufs[1];
-    dst_buf2[1] = td->tmp_obmc_bufs[1] + MAX_SB_SQUARE;
-    dst_buf2[2] = td->tmp_obmc_bufs[1] + MAX_SB_SQUARE * 2;
+    dst_buf1[0] = xd->tmp_obmc_bufs[0];
+    dst_buf1[1] = xd->tmp_obmc_bufs[0] + MAX_SB_SQUARE;
+    dst_buf1[2] = xd->tmp_obmc_bufs[0] + MAX_SB_SQUARE * 2;
+    dst_buf2[0] = xd->tmp_obmc_bufs[1];
+    dst_buf2[1] = xd->tmp_obmc_bufs[1] + MAX_SB_SQUARE;
+    dst_buf2[2] = xd->tmp_obmc_bufs[1] + MAX_SB_SQUARE * 2;
   }
-  dec_build_prediction_by_above_preds(cm, td, xd, mi_row, mi_col, dst_buf1,
+  dec_build_prediction_by_above_preds(cm, xd, mi_row, mi_col, dst_buf1,
                                       dst_width1, dst_height1, dst_stride1);
-  dec_build_prediction_by_left_preds(cm, td, xd, mi_row, mi_col, dst_buf2,
+  dec_build_prediction_by_left_preds(cm, xd, mi_row, mi_col, dst_buf2,
                                      dst_width2, dst_height2, dst_stride2);
   av1_setup_dst_planes(xd->plane, xd->mi[0]->sb_type, get_frame_new_buffer(cm),
                        mi_row, mi_col, 0, num_planes);
@@ -1055,9 +1047,8 @@
   }
 }
 
-static void predict_inter_block(AV1_COMMON *const cm, const ThreadData *td,
-                                MACROBLOCKD *const xd, int mi_row, int mi_col,
-                                BLOCK_SIZE bsize) {
+static void predict_inter_block(AV1_COMMON *const cm, MACROBLOCKD *const xd,
+                                int mi_row, int mi_col, BLOCK_SIZE bsize) {
   MB_MODE_INFO *mbmi = xd->mi[0];
   const int num_planes = av1_num_planes(cm);
   for (int ref = 0; ref < 1 + has_second_ref(mbmi); ++ref) {
@@ -1075,9 +1066,9 @@
     }
   }
 
-  dec_build_inter_predictors_sb(cm, td, xd, mi_row, mi_col, NULL, bsize);
+  dec_build_inter_predictors_sb(cm, xd, mi_row, mi_col, NULL, bsize);
   if (mbmi->motion_mode == OBMC_CAUSAL) {
-    dec_build_obmc_inter_predictors_sb(cm, td, xd, mi_row, mi_col);
+    dec_build_obmc_inter_predictors_sb(cm, xd, mi_row, mi_col);
   }
 #if CONFIG_MISMATCH_DEBUG
   for (int plane = 0; plane < num_planes; ++plane) {
@@ -1164,7 +1155,7 @@
       }
     }
   } else {
-    td->predict_inter_block_visit(cm, td, xd, mi_row, mi_col, bsize);
+    td->predict_inter_block_visit(cm, xd, mi_row, mi_col, bsize);
     // Reconstruction
     if (!mbmi->skip) {
       int eobtotal = 0;
@@ -2923,6 +2914,11 @@
   td->xd.corrupted = 0;
   td->xd.mc_buf[0] = td->mc_buf[0];
   td->xd.mc_buf[1] = td->mc_buf[1];
+  td->xd.tmp_conv_dst = td->tmp_conv_dst;
+  for (int j = 0; j < 2; ++j) {
+    td->xd.tmp_obmc_bufs[j] = td->tmp_obmc_bufs[j];
+  }
+
   for (tile_row = tile_rows_start; tile_row < tile_rows_end; ++tile_row) {
     const int row = inv_row_order ? tile_rows - 1 - tile_row : tile_row;
 
@@ -3417,6 +3413,10 @@
     thread_data->td->xd.corrupted = 0;
     thread_data->td->xd.mc_buf[0] = thread_data->td->mc_buf[0];
     thread_data->td->xd.mc_buf[1] = thread_data->td->mc_buf[1];
+    thread_data->td->xd.tmp_conv_dst = thread_data->td->tmp_conv_dst;
+    for (int j = 0; j < 2; ++j) {
+      thread_data->td->xd.tmp_obmc_bufs[j] = thread_data->td->tmp_obmc_bufs[j];
+    }
     winterface->sync(worker);
 
     worker->hook = worker_hook;
diff --git a/av1/decoder/decoder.h b/av1/decoder/decoder.h
index 592db79..5ca939c 100644
--- a/av1/decoder/decoder.h
+++ b/av1/decoder/decoder.h
@@ -40,7 +40,6 @@
                                           const TX_SIZE tx_size);
 
 typedef void (*predict_inter_block_visitor_fn_t)(AV1_COMMON *const cm,
-                                                 const struct ThreadData *td,
                                                  MACROBLOCKD *const xd,
                                                  int mi_row, int mi_col,
                                                  BLOCK_SIZE bsize);
@@ -58,6 +57,7 @@
   int32_t mc_buf_size;
   int mc_buf_use_highbd;  // Boolean: whether the byte pointers stored in
                           // mc_buf were converted from highbd pointers.
+
   CONV_BUF_TYPE *tmp_conv_dst;
   uint8_t *tmp_obmc_bufs[2];
 
diff --git a/av1/encoder/encodeframe.c b/av1/encoder/encodeframe.c
index a7fab9c..7accdd7 100644
--- a/av1/encoder/encodeframe.c
+++ b/av1/encoder/encodeframe.c
@@ -5463,10 +5463,9 @@
                            &xd->block_refs[ref]->sf, num_planes);
     }
 
-    av1_build_inter_predictors_sb(cm, x->tmp_conv_dst, xd, mi_row, mi_col, NULL,
-                                  bsize);
+    av1_build_inter_predictors_sb(cm, xd, mi_row, mi_col, NULL, bsize);
     if (mbmi->motion_mode == OBMC_CAUSAL)
-      av1_build_obmc_inter_predictors_sb(cm, x, mi_row, mi_col);
+      av1_build_obmc_inter_predictors_sb(cm, xd, mi_row, mi_col);
 
 #if CONFIG_MISMATCH_DEBUG
     if (dry_run == OUTPUT_ENABLED) {
diff --git a/av1/encoder/encoder.c b/av1/encoder/encoder.c
index a053935..4230f25 100644
--- a/av1/encoder/encoder.c
+++ b/av1/encoder/encoder.c
@@ -2399,12 +2399,14 @@
     CHECK_MEM_ERROR(
         cm, x->tmp_conv_dst,
         aom_memalign(32, MAX_SB_SIZE * MAX_SB_SIZE * sizeof(*x->tmp_conv_dst)));
+    x->e_mbd.tmp_conv_dst = x->tmp_conv_dst;
   }
   for (int i = 0; i < 2; ++i) {
     if (x->tmp_obmc_bufs[i] == NULL) {
       CHECK_MEM_ERROR(cm, x->tmp_obmc_bufs[i],
                       aom_memalign(16, 2 * MAX_MB_PLANE * MAX_SB_SQUARE *
                                            sizeof(*x->tmp_obmc_bufs[i])));
+      x->e_mbd.tmp_obmc_bufs[i] = x->tmp_obmc_bufs[i];
     }
   }
 
diff --git a/av1/encoder/ethread.c b/av1/encoder/ethread.c
index 7df8aea..6917c2f 100644
--- a/av1/encoder/ethread.c
+++ b/av1/encoder/ethread.c
@@ -215,6 +215,12 @@
         thread_data->td->mb.tmp_obmc_bufs[j] =
             thread_data->td->tmp_obmc_bufs[j];
       }
+
+      thread_data->td->mb.e_mbd.tmp_conv_dst = thread_data->td->mb.tmp_conv_dst;
+      for (int j = 0; j < 2; ++j) {
+        thread_data->td->mb.e_mbd.tmp_obmc_bufs[j] =
+            thread_data->td->mb.tmp_obmc_bufs[j];
+      }
     }
   }
 }
diff --git a/av1/encoder/firstpass.c b/av1/encoder/firstpass.c
index 66c904d..c2f2a4f 100644
--- a/av1/encoder/firstpass.c
+++ b/av1/encoder/firstpass.c
@@ -852,9 +852,8 @@
           xd->mi[0]->tx_size = TX_4X4;
           xd->mi[0]->ref_frame[0] = LAST_FRAME;
           xd->mi[0]->ref_frame[1] = NONE_FRAME;
-          av1_build_inter_predictors_sby(cm, x->tmp_conv_dst, xd,
-                                         mb_row * mb_scale, mb_col * mb_scale,
-                                         NULL, bsize);
+          av1_build_inter_predictors_sby(cm, xd, mb_row * mb_scale,
+                                         mb_col * mb_scale, NULL, bsize);
           av1_encode_sby_pass1(cm, x, bsize);
           sum_mvr += mv.row;
           sum_mvr_abs += abs(mv.row);
diff --git a/av1/encoder/mbgraph.c b/av1/encoder/mbgraph.c
index 44d05ba..1a35ff7 100644
--- a/av1/encoder/mbgraph.c
+++ b/av1/encoder/mbgraph.c
@@ -71,8 +71,8 @@
   xd->mi[0]->mv[0] = x->best_mv;
   xd->mi[0]->ref_frame[1] = NONE_FRAME;
 
-  av1_build_inter_predictors_sby(&cpi->common, x->tmp_conv_dst, xd, mb_row,
-                                 mb_col, NULL, BLOCK_16X16);
+  av1_build_inter_predictors_sby(&cpi->common, xd, mb_row, mb_col, NULL,
+                                 BLOCK_16X16);
 
   /* restore UMV window */
   x->mv_limits = tmp_mv_limits;
diff --git a/av1/encoder/mcomp.c b/av1/encoder/mcomp.c
index 51263f7..8f6de9b 100644
--- a/av1/encoder/mcomp.c
+++ b/av1/encoder/mcomp.c
@@ -915,8 +915,7 @@
   unsigned int mse;
   unsigned int sse;
 
-  av1_build_inter_predictors_sby(cm, x->tmp_conv_dst, xd, mi_row, mi_col, NULL,
-                                 bsize);
+  av1_build_inter_predictors_sby(cm, xd, mi_row, mi_col, NULL, bsize);
   mse = vfp->vf(dst, dst_stride, src, src_stride, &sse);
   mse += mv_err_cost(this_mv, &ref_mv.as_mv, x->nmvjointcost, x->mvcost,
                      x->errorperbit);
diff --git a/av1/encoder/rdopt.c b/av1/encoder/rdopt.c
index abbf11a..755e59f 100644
--- a/av1/encoder/rdopt.c
+++ b/av1/encoder/rdopt.c
@@ -7675,8 +7675,7 @@
   if (have_newmv_in_inter_mode(this_mode) && compound_type == COMPOUND_WEDGE) {
     *out_rate_mv = interinter_compound_motion_search(cpi, x, cur_mv, bsize,
                                                      this_mode, mi_row, mi_col);
-    av1_build_inter_predictors_sby(cm, x->tmp_conv_dst, xd, mi_row, mi_col, ctx,
-                                   bsize);
+    av1_build_inter_predictors_sby(cm, xd, mi_row, mi_col, ctx, bsize);
     model_rd_sb_fn[MODELRD_TYPE_MASKED_COMPOUND](
         cpi, bsize, x, xd, 0, 0, mi_row, mi_col, &rate_sum, &dist_sum,
         &tmp_skip_txfm_sb, &tmp_skip_sse_sb, NULL, NULL, NULL);
@@ -7932,8 +7931,7 @@
 
   if (skip_pred != cpi->default_interp_skip_flags) {
     if (skip_pred != DEFAULT_LUMA_INTERP_SKIP_FLAG) {
-      av1_build_inter_predictors_sby(cm, x->tmp_conv_dst, xd, mi_row, mi_col,
-                                     orig_dst, bsize);
+      av1_build_inter_predictors_sby(cm, xd, mi_row, mi_col, orig_dst, bsize);
 #if CONFIG_COLLECT_RD_STATS == 3
       RD_STATS rd_stats_y;
       select_tx_type_yrd(cpi, x, &rd_stats_y, bsize, mi_row, mi_col, INT64_MAX);
@@ -7958,8 +7956,8 @@
           mbmi->interp_filters = last_best;
           return 0;
         }
-        av1_build_inter_predictors_sbp(cm, x->tmp_conv_dst, xd, mi_row, mi_col,
-                                       orig_dst, bsize, plane);
+        av1_build_inter_predictors_sbp(cm, xd, mi_row, mi_col, orig_dst, bsize,
+                                       plane);
         model_rd_sb_fn[MODELRD_TYPE_INTERP_FILTER](
             cpi, bsize, x, xd, plane, plane, mi_row, mi_col, &tmp_rate_uv,
             &tmp_dist_uv, &tmp_skip_sb_uv, &tmp_skip_sse_uv, NULL, NULL, NULL);
@@ -8161,8 +8159,7 @@
   *switchable_rate =
       get_switchable_rate(x, mbmi->interp_filters, switchable_ctx);
   if (!skip_build_pred)
-    av1_build_inter_predictors_sb(cm, x->tmp_conv_dst, xd, mi_row, mi_col,
-                                  orig_dst, bsize);
+    av1_build_inter_predictors_sb(cm, xd, mi_row, mi_col, orig_dst, bsize);
 
 #if CONFIG_COLLECT_RD_STATS == 3
   RD_STATS rd_stats_y;
@@ -8304,8 +8301,7 @@
     // in either of the directions  Condition below is necessary, but not
     // sufficient
     assert((skip_hor == 1) || (skip_ver == 1));
-    av1_build_inter_predictors_sby(cm, x->tmp_conv_dst, xd, mi_row, mi_col,
-                                   orig_dst, bsize);
+    av1_build_inter_predictors_sby(cm, xd, mi_row, mi_col, orig_dst, bsize);
   }
   *skip_txfm_sb = best_skip_txfm_sb[1];
   *skip_sse_sb = best_skip_sse_sb[1];
@@ -8485,8 +8481,7 @@
   mbmi->ref_frame[1] = NONE_FRAME;
   xd->plane[0].dst.buf = tmp_buf;
   xd->plane[0].dst.stride = bw;
-  av1_build_inter_predictors_sby(cm, x->tmp_conv_dst, xd, mi_row, mi_col, NULL,
-                                 bsize);
+  av1_build_inter_predictors_sby(cm, xd, mi_row, mi_col, NULL, bsize);
 
   restore_dst_buf(xd, *orig_dst, num_planes);
   mbmi->ref_frame[1] = INTRA_FRAME;
@@ -8555,8 +8550,8 @@
                                       0);
         if (mbmi->mv[0].as_int != tmp_mv.as_int) {
           mbmi->mv[0].as_int = tmp_mv.as_int;
-          av1_build_inter_predictors_sby(cm, x->tmp_conv_dst, xd, mi_row,
-                                         mi_col, orig_dst, bsize);
+          av1_build_inter_predictors_sby(cm, xd, mi_row, mi_col, orig_dst,
+                                         bsize);
           model_rd_sb_fn[MODELRD_TYPE_MASKED_COMPOUND](
               cpi, bsize, x, xd, 0, 0, mi_row, mi_col, &rate_sum, &dist_sum,
               &tmp_skip_txfm_sb, &tmp_skip_sse_sb, NULL, NULL, NULL);
@@ -8583,16 +8578,14 @@
       } else {
         mbmi->use_wedge_interintra = 0;
         mbmi->mv[0].as_int = mv0.as_int;
-        av1_build_inter_predictors_sby(cm, x->tmp_conv_dst, xd, mi_row, mi_col,
-                                       orig_dst, bsize);
+        av1_build_inter_predictors_sby(cm, xd, mi_row, mi_col, orig_dst, bsize);
       }
     } else {
       mbmi->use_wedge_interintra = 0;
     }
   }  // if (is_interintra_wedge_used(bsize))
   if (num_planes > 1) {
-    av1_build_inter_predictors_sbuv(cm, x->tmp_conv_dst, xd, mi_row, mi_col,
-                                    orig_dst, bsize);
+    av1_build_inter_predictors_sbuv(cm, xd, mi_row, mi_col, orig_dst, bsize);
   }
   return 0;
 }
@@ -8687,8 +8680,7 @@
         tmp_rate2 = rate2_nocoeff - rate_mv + tmp_rate_mv;
       }
       if (mbmi->mv[0].as_int != cur_mv) {
-        av1_build_inter_predictors_sb(cm, x->tmp_conv_dst, xd, mi_row, mi_col,
-                                      orig_dst, bsize);
+        av1_build_inter_predictors_sb(cm, xd, mi_row, mi_col, orig_dst, bsize);
       }
       av1_build_obmc_inter_prediction(
           cm, xd, mi_row, mi_col, args->above_pred_buf, args->above_pred_stride,
@@ -8748,8 +8740,7 @@
           }
         }
 
-        av1_build_inter_predictors_sb(cm, x->tmp_conv_dst, xd, mi_row, mi_col,
-                                      NULL, bsize);
+        av1_build_inter_predictors_sb(cm, xd, mi_row, mi_col, NULL, bsize);
       } else {
         continue;
       }
@@ -8942,8 +8933,7 @@
   const AV1_COMMON *cm = &cpi->common;
   const int num_planes = av1_num_planes(cm);
   MACROBLOCKD *const xd = &x->e_mbd;
-  av1_build_inter_predictors_sb(cm, x->tmp_conv_dst, xd, mi_row, mi_col,
-                                orig_dst, bsize);
+  av1_build_inter_predictors_sb(cm, xd, mi_row, mi_col, orig_dst, bsize);
 
   int64_t total_sse = 0;
   for (int plane = 0; plane < num_planes; ++plane) {
@@ -9125,8 +9115,7 @@
       rs2 = masked_type_cost;
       const int64_t mode_rd = RDCOST(x->rdmult, rs2 + rd_stats->rate, 0);
       if (mode_rd < ref_best_rd) {
-        av1_build_inter_predictors_sby(cm, x->tmp_conv_dst, xd, mi_row, mi_col,
-                                       orig_dst, bsize);
+        av1_build_inter_predictors_sby(cm, xd, mi_row, mi_col, orig_dst, bsize);
         int64_t est_rd =
             estimate_yrd_for_sb(cpi, bsize, x, &rate_sum, &dist_sum,
                                 &tmp_skip_txfm_sb, &tmp_skip_sse_sb, INT64_MAX);
@@ -9437,8 +9426,8 @@
         // compound types searching uses tmp_dst buffer
         if (mbmi->interinter_comp.type == COMPOUND_AVERAGE) {
           if (num_planes > 1)
-            av1_build_inter_predictors_sbuv(cm, x->tmp_conv_dst, xd, mi_row,
-                                            mi_col, &orig_dst, bsize);
+            av1_build_inter_predictors_sbuv(cm, xd, mi_row, mi_col, &orig_dst,
+                                            bsize);
           skip_build_pred = 1;
         }
       }
@@ -9696,8 +9685,7 @@
     mbmi->interp_filters = av1_broadcast_interp_filter(BILINEAR);
     mbmi->skip = 0;
     x->skip = 0;
-    av1_build_inter_predictors_sb(cm, x->tmp_conv_dst, xd, mi_row, mi_col, NULL,
-                                  bsize);
+    av1_build_inter_predictors_sb(cm, xd, mi_row, mi_col, NULL, bsize);
 
     int *dvcost[2] = { (int *)&cpi->dv_cost[0][MV_MAX],
                        (int *)&cpi->dv_cost[1][MV_MAX] };
@@ -10078,10 +10066,9 @@
     }
 
     if (is_inter_mode(mbmi->mode)) {
-      av1_build_inter_predictors_sb(cm, x->tmp_conv_dst, xd, mi_row, mi_col,
-                                    NULL, bsize);
+      av1_build_inter_predictors_sb(cm, xd, mi_row, mi_col, NULL, bsize);
       if (mbmi->motion_mode == OBMC_CAUSAL)
-        av1_build_obmc_inter_predictors_sb(cm, x, mi_row, mi_col);
+        av1_build_obmc_inter_predictors_sb(cm, xd, mi_row, mi_col);
 
       av1_subtract_plane(x, bsize, 0);
       if (cm->tx_mode == TX_MODE_SELECT && !xd->lossless[mbmi->segment_id]) {
@@ -10245,10 +10232,10 @@
 
   if (check_num_overlappable_neighbors(mbmi) &&
       is_motion_variation_allowed_bsize(bsize)) {
-    av1_build_prediction_by_above_preds(cm, x, mi_row, mi_col,
+    av1_build_prediction_by_above_preds(cm, xd, mi_row, mi_col,
                                         args->above_pred_buf, dst_width1,
                                         dst_height1, args->above_pred_stride);
-    av1_build_prediction_by_left_preds(cm, x, mi_row, mi_col,
+    av1_build_prediction_by_left_preds(cm, xd, mi_row, mi_col,
                                        args->left_pred_buf, dst_width2,
                                        dst_height2, args->left_pred_stride);
     av1_setup_dst_planes(xd->plane, bsize, get_frame_new_buffer(cm), mi_row,
@@ -11557,10 +11544,9 @@
       RD_STATS rd_stats_y;
       RD_STATS rd_stats_uv;
 
-      av1_build_inter_predictors_sb(cm, x->tmp_conv_dst, xd, mi_row, mi_col,
-                                    NULL, bsize);
+      av1_build_inter_predictors_sb(cm, xd, mi_row, mi_col, NULL, bsize);
       if (mbmi->motion_mode == OBMC_CAUSAL)
-        av1_build_obmc_inter_predictors_sb(cm, x, mi_row, mi_col);
+        av1_build_obmc_inter_predictors_sb(cm, xd, mi_row, mi_col);
 
       if (!txfm_search(cpi, x, bsize, mi_row, mi_col, &rd_stats, &rd_stats_y,
                        &rd_stats_uv, mode_rate, search_state.best_rd)) {
diff --git a/av1/encoder/reconinter_enc.c b/av1/encoder/reconinter_enc.c
index 8aca98d..23d920f 100644
--- a/av1/encoder/reconinter_enc.c
+++ b/av1/encoder/reconinter_enc.c
@@ -26,7 +26,6 @@
 #include "av1/common/reconintra.h"
 #include "av1/common/onyxc_int.h"
 #include "av1/common/obmc.h"
-#include "av1/encoder/encoder.h"
 #include "av1/encoder/reconinter_enc.h"
 
 static INLINE void calc_subpel_params(
@@ -73,10 +72,8 @@
   }
 }
 
-static INLINE void build_inter_predictors(const AV1_COMMON *cm,
-                                          CONV_BUF_TYPE *tmp_conv_dst,
-                                          MACROBLOCKD *xd, int plane,
-                                          const MB_MODE_INFO *mi,
+static INLINE void build_inter_predictors(const AV1_COMMON *cm, MACROBLOCKD *xd,
+                                          int plane, const MB_MODE_INFO *mi,
                                           int build_for_obmc, int bw, int bh,
                                           int mi_x, int mi_y) {
   struct macroblockd_plane *const pd = &xd->plane[plane];
@@ -140,7 +137,7 @@
         int tmp_dst_stride = 8;
         assert(bw < 8 || bh < 8);
         ConvolveParams conv_params = get_conv_params_no_round(
-            0, plane, tmp_conv_dst, tmp_dst_stride, is_compound, xd->bd);
+            0, plane, xd->tmp_conv_dst, tmp_dst_stride, is_compound, xd->bd);
         conv_params.use_jnt_comp_avg = 0;
         struct buf_2d *const dst_buf = &pd->dst;
         uint8_t *dst = dst_buf->buf + dst_buf->stride * y + x;
@@ -196,7 +193,7 @@
 
   {
     ConvolveParams conv_params = get_conv_params_no_round(
-        0, plane, tmp_conv_dst, MAX_SB_SIZE, is_compound, xd->bd);
+        0, plane, xd->tmp_conv_dst, MAX_SB_SIZE, is_compound, xd->bd);
     av1_jnt_comp_weight_assign(cm, mi, 0, &conv_params.fwd_offset,
                                &conv_params.bck_offset,
                                &conv_params.use_jnt_comp_avg, is_compound);
@@ -239,7 +236,6 @@
 }
 
 static void build_inter_predictors_for_planes(const AV1_COMMON *cm,
-                                              CONV_BUF_TYPE *tmp_conv_dst,
                                               MACROBLOCKD *xd, BLOCK_SIZE bsize,
                                               int mi_row, int mi_col,
                                               int plane_from, int plane_to) {
@@ -255,36 +251,30 @@
                              pd->subsampling_y))
       continue;
 
-    build_inter_predictors(cm, tmp_conv_dst, xd, plane, xd->mi[0], 0, bw, bh,
-                           mi_x, mi_y);
+    build_inter_predictors(cm, xd, plane, xd->mi[0], 0, bw, bh, mi_x, mi_y);
   }
 }
 
-void av1_build_inter_predictors_sby(const AV1_COMMON *cm,
-                                    CONV_BUF_TYPE *tmp_conv_dst,
-                                    MACROBLOCKD *xd, int mi_row, int mi_col,
-                                    BUFFER_SET *ctx, BLOCK_SIZE bsize) {
-  av1_build_inter_predictors_sbp(cm, tmp_conv_dst, xd, mi_row, mi_col, ctx,
-                                 bsize, 0);
+void av1_build_inter_predictors_sby(const AV1_COMMON *cm, MACROBLOCKD *xd,
+                                    int mi_row, int mi_col, BUFFER_SET *ctx,
+                                    BLOCK_SIZE bsize) {
+  av1_build_inter_predictors_sbp(cm, xd, mi_row, mi_col, ctx, bsize, 0);
 }
 
-void av1_build_inter_predictors_sbuv(const AV1_COMMON *cm,
-                                     CONV_BUF_TYPE *tmp_conv_dst,
-                                     MACROBLOCKD *xd, int mi_row, int mi_col,
-                                     BUFFER_SET *ctx, BLOCK_SIZE bsize) {
+void av1_build_inter_predictors_sbuv(const AV1_COMMON *cm, MACROBLOCKD *xd,
+                                     int mi_row, int mi_col, BUFFER_SET *ctx,
+                                     BLOCK_SIZE bsize) {
   for (int plane_idx = 1; plane_idx < MAX_MB_PLANE; plane_idx++) {
-    av1_build_inter_predictors_sbp(cm, tmp_conv_dst, xd, mi_row, mi_col, ctx,
-                                   bsize, plane_idx);
+    av1_build_inter_predictors_sbp(cm, xd, mi_row, mi_col, ctx, bsize,
+                                   plane_idx);
   }
 }
 
-void av1_build_inter_predictors_sbp(const AV1_COMMON *cm,
-                                    CONV_BUF_TYPE *tmp_conv_dst,
-                                    MACROBLOCKD *xd, int mi_row, int mi_col,
-                                    BUFFER_SET *ctx, BLOCK_SIZE bsize,
-                                    int plane_idx) {
-  build_inter_predictors_for_planes(cm, tmp_conv_dst, xd, bsize, mi_row, mi_col,
-                                    plane_idx, plane_idx);
+void av1_build_inter_predictors_sbp(const AV1_COMMON *cm, MACROBLOCKD *xd,
+                                    int mi_row, int mi_col, BUFFER_SET *ctx,
+                                    BLOCK_SIZE bsize, int plane_idx) {
+  build_inter_predictors_for_planes(cm, xd, bsize, mi_row, mi_col, plane_idx,
+                                    plane_idx);
 
   if (is_interintra_pred(xd->mi[0])) {
     BUFFER_SET default_ctx = { { NULL, NULL, NULL }, { 0, 0, 0 } };
@@ -299,16 +289,13 @@
   }
 }
 
-void av1_build_inter_predictors_sb(const AV1_COMMON *cm,
-                                   CONV_BUF_TYPE *tmp_conv_dst, MACROBLOCKD *xd,
+void av1_build_inter_predictors_sb(const AV1_COMMON *cm, MACROBLOCKD *xd,
                                    int mi_row, int mi_col, BUFFER_SET *ctx,
                                    BLOCK_SIZE bsize) {
   const int num_planes = av1_num_planes(cm);
-  av1_build_inter_predictors_sby(cm, tmp_conv_dst, xd, mi_row, mi_col, ctx,
-                                 bsize);
+  av1_build_inter_predictors_sby(cm, xd, mi_row, mi_col, ctx, bsize);
   if (num_planes > 1)
-    av1_build_inter_predictors_sbuv(cm, tmp_conv_dst, xd, mi_row, mi_col, ctx,
-                                    bsize);
+    av1_build_inter_predictors_sbuv(cm, xd, mi_row, mi_col, ctx, bsize);
 }
 
 // TODO(sarahparker):
@@ -364,19 +351,17 @@
                    block_size_high[BLOCK_64X64] >> (pd->subsampling_y + 1));
 
     if (av1_skip_u4x4_pred_in_obmc(bsize, pd, 0)) continue;
-    build_inter_predictors(ctxt->cm, ctxt->tmp_conv_dst, xd, j, above_mbmi, 1,
-                           bw, bh, mi_x, mi_y);
+    build_inter_predictors(ctxt->cm, xd, j, above_mbmi, 1, bw, bh, mi_x, mi_y);
   }
   *above_mbmi = backup_mbmi;
 }
 
-void av1_build_prediction_by_above_preds(const AV1_COMMON *cm, MACROBLOCK *x,
+void av1_build_prediction_by_above_preds(const AV1_COMMON *cm, MACROBLOCKD *xd,
                                          int mi_row, int mi_col,
                                          uint8_t *tmp_buf[MAX_MB_PLANE],
                                          int tmp_width[MAX_MB_PLANE],
                                          int tmp_height[MAX_MB_PLANE],
                                          int tmp_stride[MAX_MB_PLANE]) {
-  MACROBLOCKD *const xd = &x->e_mbd;
   if (!xd->up_available) return;
 
   // Adjust mb_to_bottom_edge to have the correct value for the OBMC
@@ -386,11 +371,10 @@
   int pred_height = AOMMIN(this_height / 2, 32);
   xd->mb_to_bottom_edge += (this_height - pred_height) * 8;
 
-  struct build_prediction_ctxt ctxt = {
-    cm,         x->tmp_conv_dst, mi_row,
-    mi_col,     tmp_buf,         tmp_width,
-    tmp_height, tmp_stride,      xd->mb_to_right_edge
-  };
+  struct build_prediction_ctxt ctxt = { cm,         mi_row,
+                                        mi_col,     tmp_buf,
+                                        tmp_width,  tmp_height,
+                                        tmp_stride, xd->mb_to_right_edge };
   BLOCK_SIZE bsize = xd->mi[0]->sb_type;
   foreach_overlappable_nb_above(cm, xd, mi_col,
                                 max_neighbor_obmc[mi_size_wide_log2[bsize]],
@@ -422,19 +406,17 @@
     int bh = (left_mi_height << MI_SIZE_LOG2) >> pd->subsampling_y;
 
     if (av1_skip_u4x4_pred_in_obmc(bsize, pd, 1)) continue;
-    build_inter_predictors(ctxt->cm, ctxt->tmp_conv_dst, xd, j, left_mbmi, 1,
-                           bw, bh, mi_x, mi_y);
+    build_inter_predictors(ctxt->cm, xd, j, left_mbmi, 1, bw, bh, mi_x, mi_y);
   }
   *left_mbmi = backup_mbmi;
 }
 
-void av1_build_prediction_by_left_preds(const AV1_COMMON *cm, MACROBLOCK *x,
+void av1_build_prediction_by_left_preds(const AV1_COMMON *cm, MACROBLOCKD *xd,
                                         int mi_row, int mi_col,
                                         uint8_t *tmp_buf[MAX_MB_PLANE],
                                         int tmp_width[MAX_MB_PLANE],
                                         int tmp_height[MAX_MB_PLANE],
                                         int tmp_stride[MAX_MB_PLANE]) {
-  MACROBLOCKD *const xd = &x->e_mbd;
   if (!xd->left_available) return;
 
   // Adjust mb_to_right_edge to have the correct value for the OBMC
@@ -444,11 +426,10 @@
   int pred_width = AOMMIN(this_width / 2, 32);
   xd->mb_to_right_edge += (this_width - pred_width) * 8;
 
-  struct build_prediction_ctxt ctxt = {
-    cm,         x->tmp_conv_dst, mi_row,
-    mi_col,     tmp_buf,         tmp_width,
-    tmp_height, tmp_stride,      xd->mb_to_bottom_edge
-  };
+  struct build_prediction_ctxt ctxt = { cm,         mi_row,
+                                        mi_col,     tmp_buf,
+                                        tmp_width,  tmp_height,
+                                        tmp_stride, xd->mb_to_bottom_edge };
   BLOCK_SIZE bsize = xd->mi[0]->sb_type;
   foreach_overlappable_nb_left(cm, xd, mi_row,
                                max_neighbor_obmc[mi_size_high_log2[bsize]],
@@ -459,9 +440,8 @@
   xd->mb_to_bottom_edge = ctxt.mb_to_far_edge;
 }
 
-void av1_build_obmc_inter_predictors_sb(const AV1_COMMON *cm, MACROBLOCK *x,
+void av1_build_obmc_inter_predictors_sb(const AV1_COMMON *cm, MACROBLOCKD *xd,
                                         int mi_row, int mi_col) {
-  MACROBLOCKD *const xd = &x->e_mbd;
   const int num_planes = av1_num_planes(cm);
   uint8_t *dst_buf1[MAX_MB_PLANE], *dst_buf2[MAX_MB_PLANE];
   int dst_stride1[MAX_MB_PLANE] = { MAX_SB_SIZE, MAX_SB_SIZE, MAX_SB_SIZE };
@@ -473,25 +453,27 @@
 
   if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
     int len = sizeof(uint16_t);
-    dst_buf1[0] = CONVERT_TO_BYTEPTR(x->tmp_obmc_bufs[0]);
-    dst_buf1[1] = CONVERT_TO_BYTEPTR(x->tmp_obmc_bufs[0] + MAX_SB_SQUARE * len);
+    dst_buf1[0] = CONVERT_TO_BYTEPTR(xd->tmp_obmc_bufs[0]);
+    dst_buf1[1] =
+        CONVERT_TO_BYTEPTR(xd->tmp_obmc_bufs[0] + MAX_SB_SQUARE * len);
     dst_buf1[2] =
-        CONVERT_TO_BYTEPTR(x->tmp_obmc_bufs[0] + MAX_SB_SQUARE * 2 * len);
-    dst_buf2[0] = CONVERT_TO_BYTEPTR(x->tmp_obmc_bufs[1]);
-    dst_buf2[1] = CONVERT_TO_BYTEPTR(x->tmp_obmc_bufs[1] + MAX_SB_SQUARE * len);
+        CONVERT_TO_BYTEPTR(xd->tmp_obmc_bufs[0] + MAX_SB_SQUARE * 2 * len);
+    dst_buf2[0] = CONVERT_TO_BYTEPTR(xd->tmp_obmc_bufs[1]);
+    dst_buf2[1] =
+        CONVERT_TO_BYTEPTR(xd->tmp_obmc_bufs[1] + MAX_SB_SQUARE * len);
     dst_buf2[2] =
-        CONVERT_TO_BYTEPTR(x->tmp_obmc_bufs[1] + MAX_SB_SQUARE * 2 * len);
+        CONVERT_TO_BYTEPTR(xd->tmp_obmc_bufs[1] + MAX_SB_SQUARE * 2 * len);
   } else {
-    dst_buf1[0] = x->tmp_obmc_bufs[0];
-    dst_buf1[1] = x->tmp_obmc_bufs[0] + MAX_SB_SQUARE;
-    dst_buf1[2] = x->tmp_obmc_bufs[0] + MAX_SB_SQUARE * 2;
-    dst_buf2[0] = x->tmp_obmc_bufs[1];
-    dst_buf2[1] = x->tmp_obmc_bufs[1] + MAX_SB_SQUARE;
-    dst_buf2[2] = x->tmp_obmc_bufs[1] + MAX_SB_SQUARE * 2;
+    dst_buf1[0] = xd->tmp_obmc_bufs[0];
+    dst_buf1[1] = xd->tmp_obmc_bufs[0] + MAX_SB_SQUARE;
+    dst_buf1[2] = xd->tmp_obmc_bufs[0] + MAX_SB_SQUARE * 2;
+    dst_buf2[0] = xd->tmp_obmc_bufs[1];
+    dst_buf2[1] = xd->tmp_obmc_bufs[1] + MAX_SB_SQUARE;
+    dst_buf2[2] = xd->tmp_obmc_bufs[1] + MAX_SB_SQUARE * 2;
   }
-  av1_build_prediction_by_above_preds(cm, x, mi_row, mi_col, dst_buf1,
+  av1_build_prediction_by_above_preds(cm, xd, mi_row, mi_col, dst_buf1,
                                       dst_width1, dst_height1, dst_stride1);
-  av1_build_prediction_by_left_preds(cm, x, mi_row, mi_col, dst_buf2,
+  av1_build_prediction_by_left_preds(cm, xd, mi_row, mi_col, dst_buf2,
                                      dst_width2, dst_height2, dst_stride2);
   av1_setup_dst_planes(xd->plane, xd->mi[0]->sb_type, get_frame_new_buffer(cm),
                        mi_row, mi_col, 0, num_planes);
diff --git a/av1/encoder/reconinter_enc.h b/av1/encoder/reconinter_enc.h
index 7f9414e..10d5e8c 100644
--- a/av1/encoder/reconinter_enc.h
+++ b/av1/encoder/reconinter_enc.h
@@ -18,30 +18,24 @@
 #include "av1/common/onyxc_int.h"
 #include "av1/common/convolve.h"
 #include "av1/common/warped_motion.h"
-#include "av1/encoder/encoder.h"
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-void av1_build_inter_predictors_sby(const AV1_COMMON *cm,
-                                    CONV_BUF_TYPE *tmp_conv_dst,
-                                    MACROBLOCKD *xd, int mi_row, int mi_col,
-                                    BUFFER_SET *ctx, BLOCK_SIZE bsize);
+void av1_build_inter_predictors_sby(const AV1_COMMON *cm, MACROBLOCKD *xd,
+                                    int mi_row, int mi_col, BUFFER_SET *ctx,
+                                    BLOCK_SIZE bsize);
 
-void av1_build_inter_predictors_sbuv(const AV1_COMMON *cm,
-                                     CONV_BUF_TYPE *tmp_conv_dst,
-                                     MACROBLOCKD *xd, int mi_row, int mi_col,
-                                     BUFFER_SET *ctx, BLOCK_SIZE bsize);
+void av1_build_inter_predictors_sbuv(const AV1_COMMON *cm, MACROBLOCKD *xd,
+                                     int mi_row, int mi_col, BUFFER_SET *ctx,
+                                     BLOCK_SIZE bsize);
 
-void av1_build_inter_predictors_sbp(const AV1_COMMON *cm,
-                                    CONV_BUF_TYPE *tmp_conv_dst,
-                                    MACROBLOCKD *xd, int mi_row, int mi_col,
-                                    BUFFER_SET *ctx, BLOCK_SIZE bsize,
-                                    int plane_idx);
+void av1_build_inter_predictors_sbp(const AV1_COMMON *cm, MACROBLOCKD *xd,
+                                    int mi_row, int mi_col, BUFFER_SET *ctx,
+                                    BLOCK_SIZE bsize, int plane_idx);
 
-void av1_build_inter_predictors_sb(const AV1_COMMON *cm,
-                                   CONV_BUF_TYPE *tmp_conv_dst, MACROBLOCKD *xd,
+void av1_build_inter_predictors_sb(const AV1_COMMON *cm, MACROBLOCKD *xd,
                                    int mi_row, int mi_col, BUFFER_SET *ctx,
                                    BLOCK_SIZE bsize);
 
@@ -97,21 +91,21 @@
   return 0;
 }
 
-void av1_build_prediction_by_above_preds(const AV1_COMMON *cm, MACROBLOCK *x,
+void av1_build_prediction_by_above_preds(const AV1_COMMON *cm, MACROBLOCKD *xd,
                                          int mi_row, int mi_col,
                                          uint8_t *tmp_buf[MAX_MB_PLANE],
                                          int tmp_width[MAX_MB_PLANE],
                                          int tmp_height[MAX_MB_PLANE],
                                          int tmp_stride[MAX_MB_PLANE]);
 
-void av1_build_prediction_by_left_preds(const AV1_COMMON *cm, MACROBLOCK *x,
+void av1_build_prediction_by_left_preds(const AV1_COMMON *cm, MACROBLOCKD *xd,
                                         int mi_row, int mi_col,
                                         uint8_t *tmp_buf[MAX_MB_PLANE],
                                         int tmp_width[MAX_MB_PLANE],
                                         int tmp_height[MAX_MB_PLANE],
                                         int tmp_stride[MAX_MB_PLANE]);
 
-void av1_build_obmc_inter_predictors_sb(const AV1_COMMON *cm, MACROBLOCK *x,
+void av1_build_obmc_inter_predictors_sb(const AV1_COMMON *cm, MACROBLOCKD *xd,
                                         int mi_row, int mi_col);
 
 void av1_build_inter_predictors_for_planes_single_buf(