Add macro to determine type of global motion computation

Change-Id: Ic369befe02d92f5dded18d998dce7c41f748812e
diff --git a/av1/encoder/encodeframe.c b/av1/encoder/encodeframe.c
index 60e62ae..6ad4ea0 100644
--- a/av1/encoder/encodeframe.c
+++ b/av1/encoder/encodeframe.c
@@ -5637,10 +5637,10 @@
                    (MAX_PARAMDIM - 1) * sizeof(*params_by_motion));
           }
 
-          compute_global_motion_feature_based(
-              model, cpi->source, ref_buf[frame],
-              cpi->common.seq_params.bit_depth, inliers_by_motion,
-              params_by_motion, RANSAC_NUM_MOTIONS);
+          compute_global_motion(model, cpi->source, ref_buf[frame],
+                                cpi->common.seq_params.bit_depth,
+                                inliers_by_motion, params_by_motion,
+                                RANSAC_NUM_MOTIONS);
 
           for (i = 0; i < RANSAC_NUM_MOTIONS; ++i) {
             if (inliers_by_motion[i] == 0) continue;
diff --git a/av1/encoder/global_motion.c b/av1/encoder/global_motion.c
index 7a64291..3aaf22d 100644
--- a/av1/encoder/global_motion.c
+++ b/av1/encoder/global_motion.c
@@ -29,6 +29,7 @@
 #define MIN_INLIER_PROB 0.1
 
 #define MIN_TRANS_THRESH (1 * GM_TRANS_DECODE_FACTOR)
+#define USE_GM_FEATURE_BASED 1
 
 // Border over which to compute the global motion
 #define ERRORADV_BORDER 0
@@ -259,12 +260,11 @@
   return buf_8bit;
 }
 
-int compute_global_motion_feature_based(TransformationType type,
-                                        YV12_BUFFER_CONFIG *frm,
-                                        YV12_BUFFER_CONFIG *ref, int bit_depth,
-                                        int *num_inliers_by_motion,
-                                        double *params_by_motion,
-                                        int num_motions) {
+#if USE_GM_FEATURE_BASED
+static int compute_global_motion_feature_based(
+    TransformationType type, YV12_BUFFER_CONFIG *frm, YV12_BUFFER_CONFIG *ref,
+    int bit_depth, int *num_inliers_by_motion, double *params_by_motion,
+    int num_motions) {
   int i;
   int num_frm_corners, num_ref_corners;
   int num_correspondences;
@@ -315,7 +315,7 @@
   }
   return 0;
 }
-
+#else
 static ImagePyramid *alloc_pyramid(int width, int height, int pad_size) {
   ImagePyramid *pyr = aom_malloc(sizeof(*pyr));
   // 2 * width * height is the upper bound for a buffer that fits
@@ -388,12 +388,10 @@
   }
 }
 
-int compute_global_motion_disflow_based(TransformationType type,
-                                        YV12_BUFFER_CONFIG *frm,
-                                        YV12_BUFFER_CONFIG *ref, int bit_depth,
-                                        int *num_inliers_by_motion,
-                                        double *params_by_motion,
-                                        int num_motions) {
+static int compute_global_motion_disflow_based(
+    TransformationType type, YV12_BUFFER_CONFIG *frm, YV12_BUFFER_CONFIG *ref,
+    int bit_depth, int *num_inliers_by_motion, double *params_by_motion,
+    int num_motions) {
   unsigned char *frm_buffer = frm->y_buffer;
   unsigned char *ref_buffer = ref->y_buffer;
   const int frm_width = frm->y_width;
@@ -437,3 +435,19 @@
   free_pyramid(ref_pyr);
   return 0;
 }
+#endif
+
+int compute_global_motion(TransformationType type, YV12_BUFFER_CONFIG *frm,
+                          YV12_BUFFER_CONFIG *ref, int bit_depth,
+                          int *num_inliers_by_motion, double *params_by_motion,
+                          int num_motions) {
+#if USE_GM_FEATURE_BASED
+  return compute_global_motion_feature_based(type, frm, ref, bit_depth,
+                                             num_inliers_by_motion,
+                                             params_by_motion, num_motions);
+#else
+  return compute_global_motion_disflow_based(type, frm, ref, bit_depth,
+                                             num_inliers_by_motion,
+                                             params_by_motion, num_motions);
+#endif
+}
diff --git a/av1/encoder/global_motion.h b/av1/encoder/global_motion.h
index 87f80a7..81eed08 100644
--- a/av1/encoder/global_motion.h
+++ b/av1/encoder/global_motion.h
@@ -52,19 +52,10 @@
   number of inlier feature points for each motion. Params for which the
   num_inliers entry is 0 should be ignored by the caller.
 */
-int compute_global_motion_feature_based(TransformationType type,
-                                        YV12_BUFFER_CONFIG *frm,
-                                        YV12_BUFFER_CONFIG *ref, int bit_depth,
-                                        int *num_inliers_by_motion,
-                                        double *params_by_motion,
-                                        int num_motions);
-
-int compute_global_motion_disflow_based(TransformationType type,
-                                        YV12_BUFFER_CONFIG *frm,
-                                        YV12_BUFFER_CONFIG *ref, int bit_depth,
-                                        int *num_inliers_by_motion,
-                                        double *params_by_motion,
-                                        int num_motions);
+int compute_global_motion(TransformationType type, YV12_BUFFER_CONFIG *frm,
+                          YV12_BUFFER_CONFIG *ref, int bit_depth,
+                          int *num_inliers_by_motion, double *params_by_motion,
+                          int num_motions);
 #ifdef __cplusplus
 }  // extern "C"
 #endif