Set AV1 convolve function pointers

Set function pointers for AV1 convolve functions.

Change-Id: I9241ef31fcd060a6b76e0cac8e2452b0207df929
diff --git a/av1/common/convolve.c b/av1/common/convolve.c
index bd5d9ff..81c69ba 100644
--- a/av1/common/convolve.c
+++ b/av1/common/convolve.c
@@ -721,7 +721,8 @@
                             int dst_stride, int w, int h,
                             InterpFilters interp_filters, const int subpel_x_q4,
                             int x_step_q4, const int subpel_y_q4, int y_step_q4,
-                            int scaled, ConvolveParams *conv_params) {
+                            int scaled, ConvolveParams *conv_params,
+                            const struct scale_factors *sf) {
   (void)x_step_q4;
   (void)y_step_q4;
   (void)dst;
@@ -737,6 +738,7 @@
 #endif
 
 #if CONFIG_JNT_COMP
+  (void)sf;
   if (scaled) {
     av1_convolve_2d_scale(src, src_stride, conv_params->dst,
                           conv_params->dst_stride, w, h, &filter_params_x,
@@ -772,21 +774,9 @@
   } else {
     // Special case convolve functions should produce the same result as
     // av1_convolve_2d.
-    if (subpel_x_q4 == 0 && subpel_y_q4 == 0) {
-      av1_convolve_2d_copy(src, src_stride, dst, dst_stride, w, h,
-                           &filter_params_x, &filter_params_y, subpel_x_q4,
-                           subpel_y_q4, conv_params);
-    } else if (subpel_x_q4 == 0) {
-      av1_convolve_y(src, src_stride, dst, dst_stride, w, h, &filter_params_x,
-                     &filter_params_y, subpel_x_q4, subpel_y_q4, conv_params);
-    } else if (subpel_y_q4 == 0) {
-      av1_convolve_x(src, src_stride, dst, dst_stride, w, h, &filter_params_x,
-                     &filter_params_y, subpel_x_q4, subpel_y_q4, conv_params);
-    } else {
-      // subpel_x_q4 != 0 && subpel_y_q4 != 0
-      av1_convolve_2d(src, src_stride, dst, dst_stride, w, h, &filter_params_x,
-                      &filter_params_y, subpel_x_q4, subpel_y_q4, conv_params);
-    }
+    sf->convolve[subpel_x_q4 != 0][subpel_y_q4 != 0][1](
+        src, src_stride, dst, dst_stride, w, h, &filter_params_x,
+        &filter_params_y, subpel_x_q4, subpel_y_q4, conv_params);
   }
 #endif  // CONFIG_JNT_COMP
 }
diff --git a/av1/common/convolve.h b/av1/common/convolve.h
index 69c5714..f2e74e5 100644
--- a/av1/common/convolve.h
+++ b/av1/common/convolve.h
@@ -43,6 +43,13 @@
 #endif
 } ConvolveParams;
 
+typedef void (*aom_convolve_fn_t)(const uint8_t *src, int src_stride,
+                                  const uint8_t *dst, int dst_stride, int w,
+                                  int h, InterpFilterParams *filter_params_x,
+                                  InterpFilterParams *filter_params_y,
+                                  const int subpel_x_q4, const int subpel_y_q4,
+                                  ConvolveParams *conv_params);
+
 static INLINE ConvolveParams get_conv_params(int ref, int do_average,
                                              int plane) {
   ConvolveParams conv_params;
@@ -99,12 +106,13 @@
 
 struct AV1Common;
 void av1_convolve_init(struct AV1Common *cm);
-
+struct scale_factors;
 void av1_convolve_2d_facade(const uint8_t *src, int src_stride, uint8_t *dst,
                             int dst_stride, int w, int h,
                             InterpFilters interp_filters, const int subpel_x_q4,
                             int x_step_q4, const int subpel_y_q4, int y_step_q4,
-                            int scaled, ConvolveParams *conv_params);
+                            int scaled, ConvolveParams *conv_params,
+                            const struct scale_factors *sf);
 
 static INLINE ConvolveParams get_conv_params_no_round(int ref, int do_average,
                                                       int plane, int32_t *dst,
diff --git a/av1/common/reconinter.h b/av1/common/reconinter.h
index 1e484ab..5e17d96d 100644
--- a/av1/common/reconinter.h
+++ b/av1/common/reconinter.h
@@ -57,7 +57,7 @@
     if (conv_params->round == CONVOLVE_OPT_NO_ROUND) {
       av1_convolve_2d_facade(src, src_stride, dst, dst_stride, w, h,
                              interp_filters, subpel_x, xs, subpel_y, ys, 1,
-                             conv_params);
+                             conv_params, sf);
       conv_params->do_post_rounding = 1;
     } else {
       assert(conv_params->round == CONVOLVE_OPT_ROUND);
@@ -76,7 +76,7 @@
     if (conv_params->round == CONVOLVE_OPT_NO_ROUND) {
       av1_convolve_2d_facade(src, src_stride, dst, dst_stride, w, h,
                              interp_filters, subpel_x, xs, subpel_y, ys, 0,
-                             conv_params);
+                             conv_params, sf);
       conv_params->do_post_rounding = 1;
     } else {
       assert(conv_params->round == CONVOLVE_OPT_ROUND);
diff --git a/av1/common/scale.c b/av1/common/scale.c
index a581a5b..80572db 100644
--- a/av1/common/scale.c
+++ b/av1/common/scale.c
@@ -10,6 +10,7 @@
  */
 
 #include "./aom_dsp_rtcd.h"
+#include "./av1_rtcd.h"
 #include "av1/common/filter.h"
 #include "av1/common/scale.h"
 #include "aom_dsp/aom_filter.h"
@@ -180,4 +181,13 @@
     sf->highbd_predict[1][1][1] = aom_highbd_convolve8_avg;
   }
 #endif  // CONFIG_HIGHBITDEPTH
+
+  // subpel_x_q4 == 0 && subpel_y_q4 == 0
+  sf->convolve[0][0][1] = av1_convolve_2d_copy;
+  // subpel_x_q4 == 0
+  sf->convolve[0][1][1] = av1_convolve_y;
+  // subpel_y_q4 == 0
+  sf->convolve[1][0][1] = av1_convolve_x;
+  // subpel_x_q4 != 0 && subpel_y_q4 != 0
+  sf->convolve[1][1][1] = av1_convolve_2d;
 }
diff --git a/av1/common/scale.h b/av1/common/scale.h
index 900e6bf..ed5d034 100644
--- a/av1/common/scale.h
+++ b/av1/common/scale.h
@@ -12,6 +12,7 @@
 #ifndef AV1_COMMON_SCALE_H_
 #define AV1_COMMON_SCALE_H_
 
+#include "av1/common/convolve.h"
 #include "av1/common/mv.h"
 #include "aom_dsp/aom_convolve.h"
 
@@ -38,6 +39,9 @@
 #if CONFIG_HIGHBITDEPTH
   highbd_convolve_fn_t highbd_predict[2][2][2];  // horiz, vert, avg
 #endif                                           // CONFIG_HIGHBITDEPTH
+
+  // convolve_fn_ptr[subpel_x != 0][subpel_y != 0][is_compound]
+  aom_convolve_fn_t convolve[2][2][2];
 };
 
 MV32 av1_scale_mv(const MV *mv, int x, int y, const struct scale_factors *sf);