Pass inter prediction filter parameter

Make the decision outside av1_make_inter_predictor() function.

Change-Id: I002b5e81f961878d02d046a389fe8e27a19f46f4
diff --git a/aom_dsp/variance.c b/aom_dsp/variance.c
index 7280bf0..08a9b23 100644
--- a/aom_dsp/variance.c
+++ b/aom_dsp/variance.c
@@ -352,7 +352,7 @@
       av1_init_inter_params(
           &inter_pred_params, width, height, mi_y >> pd->subsampling_y,
           mi_x >> pd->subsampling_x, pd->subsampling_x, pd->subsampling_y,
-          xd->bd, is_cur_buf_hbd(xd), mi->use_intrabc, sf);
+          xd->bd, is_cur_buf_hbd(xd), mi->use_intrabc, sf, filters);
 
       // Get the inter predictor.
       av1_make_inter_predictor(pre, pre_buf->stride, comp_pred, width,
@@ -940,7 +940,7 @@
       av1_init_inter_params(
           &inter_pred_params, width, height, mi_y >> pd->subsampling_y,
           mi_x >> pd->subsampling_x, pd->subsampling_x, pd->subsampling_y,
-          xd->bd, is_cur_buf_hbd(xd), mi->use_intrabc, sf);
+          xd->bd, is_cur_buf_hbd(xd), mi->use_intrabc, sf, filters);
 
       // Get the inter predictor.
       av1_make_inter_predictor(pre, pre_buf->stride, comp_pred8, width,
diff --git a/aom_dsp/x86/highbd_variance_sse2.c b/aom_dsp/x86/highbd_variance_sse2.c
index 51ad3ae..bb56c06 100644
--- a/aom_dsp/x86/highbd_variance_sse2.c
+++ b/aom_dsp/x86/highbd_variance_sse2.c
@@ -684,7 +684,7 @@
       av1_init_inter_params(
           &inter_pred_params, width, height, mi_y >> pd->subsampling_y,
           mi_x >> pd->subsampling_x, pd->subsampling_x, pd->subsampling_y,
-          xd->bd, is_cur_buf_hbd(xd), mi->use_intrabc, sf);
+          xd->bd, is_cur_buf_hbd(xd), mi->use_intrabc, sf, filters);
 
       // Get the inter predictor.
       av1_make_inter_predictor(pre, pre_buf->stride, comp_pred8, width,
diff --git a/aom_dsp/x86/variance_sse2.c b/aom_dsp/x86/variance_sse2.c
index aba6b54..c631866 100644
--- a/aom_dsp/x86/variance_sse2.c
+++ b/aom_dsp/x86/variance_sse2.c
@@ -564,7 +564,7 @@
       av1_init_inter_params(
           &inter_pred_params, width, height, mi_y >> pd->subsampling_y,
           mi_x >> pd->subsampling_x, pd->subsampling_x, pd->subsampling_y,
-          xd->bd, is_cur_buf_hbd(xd), mi->use_intrabc, sf);
+          xd->bd, is_cur_buf_hbd(xd), mi->use_intrabc, sf, filters);
 
       // Get the inter predictor.
       av1_make_inter_predictor(pre, pre_buf->stride, comp_pred, width,
diff --git a/av1/common/convolve.c b/av1/common/convolve.c
index e52139e..7e64768 100644
--- a/av1/common/convolve.c
+++ b/av1/common/convolve.c
@@ -577,7 +577,7 @@
 
 void av1_convolve_2d_facade(const uint8_t *src, int src_stride, uint8_t *dst,
                             int dst_stride, int w, int h,
-                            int_interpfilters interp_filters,
+                            const InterpFilterParams *interp_filters[2],
                             const int subpel_x_qn, int x_step_q4,
                             const int subpel_y_qn, int y_step_q4, int scaled,
                             ConvolveParams *conv_params,
@@ -594,20 +594,12 @@
     return;
   }
 
-  InterpFilter filter_x = 0;
-  InterpFilter filter_y = 0;
   const int need_filter_params_x = (subpel_x_qn != 0) | scaled;
   const int need_filter_params_y = (subpel_y_qn != 0) | scaled;
-  if (need_filter_params_x) filter_x = interp_filters.as_filters.x_filter;
-  if (need_filter_params_y) filter_y = interp_filters.as_filters.y_filter;
   const InterpFilterParams *filter_params_x =
-      need_filter_params_x
-          ? av1_get_interp_filter_params_with_block_size(filter_x, w)
-          : NULL;
+      need_filter_params_x ? interp_filters[0] : NULL;
   const InterpFilterParams *filter_params_y =
-      need_filter_params_y
-          ? av1_get_interp_filter_params_with_block_size(filter_y, h)
-          : NULL;
+      need_filter_params_y ? interp_filters[1] : NULL;
 
   if (scaled) {
     convolve_2d_scale_wrapper(src, src_stride, dst, dst_stride, w, h,
@@ -1070,7 +1062,7 @@
 
 void av1_highbd_convolve_2d_facade(const uint8_t *src8, int src_stride,
                                    uint8_t *dst8, int dst_stride, int w, int h,
-                                   int_interpfilters interp_filters,
+                                   const InterpFilterParams *interp_filters[2],
                                    const int subpel_x_qn, int x_step_q4,
                                    const int subpel_y_qn, int y_step_q4,
                                    int scaled, ConvolveParams *conv_params,
@@ -1089,20 +1081,12 @@
     return;
   }
 
-  InterpFilter filter_x = 0;
-  InterpFilter filter_y = 0;
   const int need_filter_params_x = (subpel_x_qn != 0) | scaled;
   const int need_filter_params_y = (subpel_y_qn != 0) | scaled;
-  if (need_filter_params_x) filter_x = interp_filters.as_filters.x_filter;
-  if (need_filter_params_y) filter_y = interp_filters.as_filters.y_filter;
   const InterpFilterParams *filter_params_x =
-      need_filter_params_x
-          ? av1_get_interp_filter_params_with_block_size(filter_x, w)
-          : NULL;
+      need_filter_params_x ? interp_filters[0] : NULL;
   const InterpFilterParams *filter_params_y =
-      need_filter_params_y
-          ? av1_get_interp_filter_params_with_block_size(filter_y, h)
-          : NULL;
+      need_filter_params_y ? interp_filters[1] : NULL;
 
   if (scaled) {
     uint16_t *dst = CONVERT_TO_SHORTPTR(dst8);
diff --git a/av1/common/convolve.h b/av1/common/convolve.h
index 83232bd..06933a2 100644
--- a/av1/common/convolve.h
+++ b/av1/common/convolve.h
@@ -55,7 +55,7 @@
 
 void av1_convolve_2d_facade(const uint8_t *src, int src_stride, uint8_t *dst,
                             int dst_stride, int w, int h,
-                            int_interpfilters interp_filters,
+                            const InterpFilterParams *interp_filters[2],
                             const int subpel_x_qn, int x_step_q4,
                             const int subpel_y_qn, int y_step_q4, int scaled,
                             ConvolveParams *conv_params,
@@ -112,7 +112,7 @@
 
 void av1_highbd_convolve_2d_facade(const uint8_t *src8, int src_stride,
                                    uint8_t *dst, int dst_stride, int w, int h,
-                                   int_interpfilters interp_filters,
+                                   const InterpFilterParams *interp_filters[2],
                                    const int subpel_x_qn, int x_step_q4,
                                    const int subpel_y_qn, int y_step_q4,
                                    int scaled, ConvolveParams *conv_params,
diff --git a/av1/common/reconinter.c b/av1/common/reconinter.c
index 820bb1d..96c1dd8 100644
--- a/av1/common/reconinter.c
+++ b/av1/common/reconinter.c
@@ -60,7 +60,8 @@
                            int block_height, int pix_row, int pix_col,
                            int subsampling_x, int subsampling_y, int bit_depth,
                            int use_hbd_buf, int is_intrabc,
-                           const struct scale_factors *sf) {
+                           const struct scale_factors *sf,
+                           int_interpfilters interp_filters) {
   inter_pred_params->block_width = block_width;
   inter_pred_params->block_height = block_height;
   inter_pred_params->pix_row = pix_row;
@@ -72,6 +73,18 @@
   inter_pred_params->is_intrabc = is_intrabc;
   inter_pred_params->scale_factors = sf;
   inter_pred_params->mode = UNIFORM_PRED;
+
+  if (is_intrabc) {
+    inter_pred_params->interp_filter_params[0] = &av1_intrabc_filter_params;
+    inter_pred_params->interp_filter_params[1] = &av1_intrabc_filter_params;
+  } else {
+    inter_pred_params->interp_filter_params[0] =
+        av1_get_interp_filter_params_with_block_size(
+            interp_filters.as_filters.x_filter, block_width);
+    inter_pred_params->interp_filter_params[1] =
+        av1_get_interp_filter_params_with_block_size(
+            interp_filters.as_filters.y_filter, block_height);
+  }
 }
 
 void av1_init_warp_params(InterPredParams *inter_pred_params,
@@ -99,6 +112,8 @@
                               int_interpfilters interp_filters) {
   assert(IMPLIES(conv_params->is_compound, conv_params->dst != NULL));
 
+  (void)interp_filters;
+
   // TODO(jingning): av1_warp_plane() can be further cleaned up.
   if (inter_pred_params->mode == WARP_PRED) {
     av1_warp_plane(
@@ -119,21 +134,23 @@
       highbd_inter_predictor(
           src, src_stride, dst, dst_stride, subpel_params,
           inter_pred_params->scale_factors, inter_pred_params->block_width,
-          inter_pred_params->block_height, conv_params, interp_filters,
+          inter_pred_params->block_height, conv_params,
+          inter_pred_params->interp_filter_params,
           inter_pred_params->is_intrabc, inter_pred_params->bit_depth);
     } else {
       inter_predictor(src, src_stride, dst, dst_stride, subpel_params,
                       inter_pred_params->scale_factors,
                       inter_pred_params->block_width,
                       inter_pred_params->block_height, conv_params,
-                      interp_filters, inter_pred_params->is_intrabc);
+                      inter_pred_params->interp_filter_params,
+                      inter_pred_params->is_intrabc);
     }
 #else
-    inter_predictor(src, src_stride, dst, dst_stride, subpel_params,
-                    inter_pred_params->scale_factors,
-                    inter_pred_params->block_width,
-                    inter_pred_params->block_height, conv_params,
-                    interp_filters, inter_pred_params->is_intrabc);
+    inter_predictor(
+        src, src_stride, dst, dst_stride, subpel_params,
+        inter_pred_params->scale_factors, inter_pred_params->block_width,
+        inter_pred_params->block_height, conv_params,
+        inter_pred_params->interp_filter_params, inter_pred_params->is_intrabc);
 #endif
   }
 }
diff --git a/av1/common/reconinter.h b/av1/common/reconinter.h
index 3658058..0ff4bcf 100644
--- a/av1/common/reconinter.h
+++ b/av1/common/reconinter.h
@@ -103,6 +103,7 @@
   InterPredMode mode;
   WarpedMotionParams warp_params;
   ConvolveParams conv_params;
+  const InterpFilterParams *interp_filter_params[2];
   int block_width;
   int block_height;
   int pix_row;
@@ -120,7 +121,8 @@
                            int block_height, int pix_row, int pix_col,
                            int subsampling_x, int subsampling_y, int bit_depth,
                            int use_hbd_buf, int is_intrabc,
-                           const struct scale_factors *sf);
+                           const struct scale_factors *sf,
+                           int_interpfilters interp_filters);
 
 void av1_init_warp_params(InterPredParams *inter_pred_params,
                           struct buf_2d *ref_buf,
@@ -147,7 +149,7 @@
                                    const SubpelParams *subpel_params,
                                    const struct scale_factors *sf, int w, int h,
                                    ConvolveParams *conv_params,
-                                   int_interpfilters interp_filters,
+                                   const InterpFilterParams *interp_filters[2],
                                    int is_intrabc) {
   assert(conv_params->do_average == 0 || conv_params->do_average == 1);
   assert(sf);
@@ -167,13 +169,11 @@
   }
 }
 
-static INLINE void highbd_inter_predictor(const uint8_t *src, int src_stride,
-                                          uint8_t *dst, int dst_stride,
-                                          const SubpelParams *subpel_params,
-                                          const struct scale_factors *sf, int w,
-                                          int h, ConvolveParams *conv_params,
-                                          int_interpfilters interp_filters,
-                                          int is_intrabc, int bd) {
+static INLINE void highbd_inter_predictor(
+    const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride,
+    const SubpelParams *subpel_params, const struct scale_factors *sf, int w,
+    int h, ConvolveParams *conv_params,
+    const InterpFilterParams *interp_filters[2], int is_intrabc, int bd) {
   assert(conv_params->do_average == 0 || conv_params->do_average == 1);
   assert(sf);
   const int is_scaled = has_scale(subpel_params->xs, subpel_params->ys);
diff --git a/av1/decoder/decodeframe.c b/av1/decoder/decodeframe.c
index 69b1854..3af5b49 100644
--- a/av1/decoder/decodeframe.c
+++ b/av1/decoder/decodeframe.c
@@ -759,7 +759,8 @@
         av1_init_inter_params(
             &inter_pred_params, b4_w, b4_h, (mi_y >> pd->subsampling_y) + y,
             (mi_x >> pd->subsampling_x) + x, pd->subsampling_x,
-            pd->subsampling_y, xd->bd, is_cur_buf_hbd(xd), mi->use_intrabc, sf);
+            pd->subsampling_y, xd->bd, is_cur_buf_hbd(xd), mi->use_intrabc, sf,
+            this_mbmi->interp_filters);
 
         av1_make_inter_predictor(pre, src_stride, dst, dst_buf->stride,
                                  &inter_pred_params, &subpel_params,
@@ -833,7 +834,7 @@
       av1_init_inter_params(
           &inter_pred_params, bw, bh, mi_y >> pd->subsampling_y,
           mi_x >> pd->subsampling_x, pd->subsampling_x, pd->subsampling_y,
-          xd->bd, is_cur_buf_hbd(xd), mi->use_intrabc, sf);
+          xd->bd, is_cur_buf_hbd(xd), mi->use_intrabc, sf, mi->interp_filters);
 
       if (!build_for_obmc)
         av1_init_warp_params(&inter_pred_params, &pd->pre[ref], &warp_types,
diff --git a/av1/encoder/reconinter_enc.c b/av1/encoder/reconinter_enc.c
index 0798c15..6774e34 100644
--- a/av1/encoder/reconinter_enc.c
+++ b/av1/encoder/reconinter_enc.c
@@ -180,7 +180,8 @@
         av1_init_inter_params(
             &inter_pred_params, b4_w, b4_h, (mi_y >> pd->subsampling_y) + y,
             (mi_x >> pd->subsampling_x) + x, pd->subsampling_x,
-            pd->subsampling_y, xd->bd, is_cur_buf_hbd(xd), mi->use_intrabc, sf);
+            pd->subsampling_y, xd->bd, is_cur_buf_hbd(xd), mi->use_intrabc, sf,
+            this_mbmi->interp_filters);
         av1_make_inter_predictor(pre, pre_buf->stride, dst, dst_buf->stride,
                                  &inter_pred_params, &subpel_params,
                                  &conv_params, this_mbmi->interp_filters);
@@ -222,7 +223,7 @@
       av1_init_inter_params(
           &inter_pred_params, bw, bh, mi_y >> pd->subsampling_y,
           mi_x >> pd->subsampling_x, pd->subsampling_x, pd->subsampling_y,
-          xd->bd, is_cur_buf_hbd(xd), mi->use_intrabc, sf);
+          xd->bd, is_cur_buf_hbd(xd), mi->use_intrabc, sf, mi->interp_filters);
 
       if (!build_for_obmc)
         av1_init_warp_params(&inter_pred_params, &pd->pre[ref], &warp_types,
@@ -313,10 +314,10 @@
   src += (mv.row >> SCALE_SUBPEL_BITS) * src_stride +
          (mv.col >> SCALE_SUBPEL_BITS);
 
-  av1_init_inter_params(&inter_pred_params, w, h, p_col, p_row,
-                        xd->plane[plane].subsampling_x,
-                        xd->plane[plane].subsampling_y, xd->bd,
-                        is_cur_buf_hbd(xd), xd->mi[0]->use_intrabc, sf);
+  av1_init_inter_params(
+      &inter_pred_params, w, h, p_col, p_row, xd->plane[plane].subsampling_x,
+      xd->plane[plane].subsampling_y, xd->bd, is_cur_buf_hbd(xd),
+      xd->mi[0]->use_intrabc, sf, interp_filters);
 
   av1_make_inter_predictor(src, src_stride, dst, dst_stride, &inter_pred_params,
                            &subpel_params, conv_params, interp_filters);
@@ -504,7 +505,8 @@
 
   av1_init_inter_params(&inter_pred_params, bw, bh, pre_y, pre_x,
                         pd->subsampling_x, pd->subsampling_y, xd->bd,
-                        is_cur_buf_hbd(xd), mi->use_intrabc, sf);
+                        is_cur_buf_hbd(xd), mi->use_intrabc, sf,
+                        mi->interp_filters);
 
   av1_init_warp_params(&inter_pred_params, &pd->pre[ref], &warp_types, ref, xd,
                        mi);