Allow a sufficient motion vector search range

This is an encode only change.

STATS_CHANGED
diff --git a/av1/encoder/mcomp.c b/av1/encoder/mcomp.c
index cfdc907..5c67b93 100644
--- a/av1/encoder/mcomp.c
+++ b/av1/encoder/mcomp.c
@@ -465,7 +465,11 @@
   int stage_index = 0;
   cfg->stride = stride;
   int radius = 1;
+#if CONFIG_MV_SEARCH_RANGE
+  for (stage_index = 0; stage_index < 16; ++stage_index) {
+#else
   for (stage_index = 0; stage_index < 15; ++stage_index) {
+#endif  // CONFIG_MV_SEARCH_RANGE
     int tan_radius = AOMMAX((int)(0.41 * radius), 1);
     int num_search_pts = 12;
     if (radius <= 5) {
@@ -496,7 +500,9 @@
     cfg->searches_per_step[stage_index] = num_search_pts;
     cfg->radius[stage_index] = radius;
     ++num_search_steps;
+#if !CONFIG_MV_SEARCH_RANGE
     if (stage_index < 12)
+#endif  // CONFIG_MV_SEARCH_RANGE
       radius = (int)AOMMAX((radius * 1.5 + 0.5), radius + 1);
   }
   cfg->num_search_steps = num_search_steps;
diff --git a/av1/encoder/mcomp.h b/av1/encoder/mcomp.h
index 4671d92..627a949 100644
--- a/av1/encoder/mcomp.h
+++ b/av1/encoder/mcomp.h
@@ -29,8 +29,13 @@
 // allowed initial step
 #define MAX_MVSEARCH_STEPS 11
 // Max full pel mv specified in the unit of full pixel
+#if CONFIG_MV_SEARCH_RANGE
+// Enable the use of motion vector in range [-2047, 2047].
+#define MAX_FULL_PEL_VAL ((1 << MV_CLASSES) - 1)
+#else
 // Enable the use of motion vector in range [-1023, 1023].
 #define MAX_FULL_PEL_VAL ((1 << (MAX_MVSEARCH_STEPS - 1)) - 1)
+#endif  // CONFIG_MV_SEARCH_RANGE
 // Maximum size of the first step in full pel units
 #define MAX_FIRST_STEP (1 << (MAX_MVSEARCH_STEPS - 1))
 
diff --git a/build/cmake/aom_config_defaults.cmake b/build/cmake/aom_config_defaults.cmake
index 03efe6e..1a13a23 100644
--- a/build/cmake/aom_config_defaults.cmake
+++ b/build/cmake/aom_config_defaults.cmake
@@ -199,6 +199,9 @@
 set_aom_config_var(CONFIG_NEW_DF 1
                    "AV2 experiment flag on new deblocking filter.")
 set_aom_config_var(CONFIG_TIP 1 "Enable temporal interpolated prediction (TIP)")
+# This is an encode-only change.
+set_aom_config_var(CONFIG_MV_SEARCH_RANGE 1
+                   "Enable a sufficient MV search range.")
 
 #
 # Variables in this section control optional features of the build system.