Make horzonly-frame-superres a config flag.

This allows it to be enabled/disabled during configure/cmake and also
allows us to specify dependencies.

If 0: superres scaling happens for both width and height.
If 1: superres scaling happens ONLY for width.

Change-Id: Id00c2a9c9886b638e06c6b92de453b85bee1d8fa
diff --git a/av1/common/resize.c b/av1/common/resize.c
index b540b15..73f69c0 100644
--- a/av1/common/resize.c
+++ b/av1/common/resize.c
@@ -1172,12 +1172,12 @@
   if (denom != SCALE_NUMERATOR) {
     *width = *width * SCALE_NUMERATOR / denom;
     *width += *width & 1;  // Make it even.
-#if SCALE_HORIZONTAL_ONLY
+#if CONFIG_HORZONLY_FRAME_SUPERRES
     (void)height;
 #else
     *height = *height * SCALE_NUMERATOR / denom;
     *height += *height & 1;  // Make it even.
-#endif  // !SCALE_HORIZONTAL_ONLY
+#endif  // !CONFIG_HORZONLY_FRAME_SUPERRES
   }
 }
 
@@ -1186,11 +1186,11 @@
     // Note: av1_calculate_scaled_size() rounds *up* after division when the
     // resulting dimensions are odd. So here, we round *down*.
     *width = *width * denom / SCALE_NUMERATOR;
-#if SCALE_HORIZONTAL_ONLY
+#if CONFIG_HORZONLY_FRAME_SUPERRES
     (void)height;
 #else
     *height = *height * denom / SCALE_NUMERATOR;
-#endif  // !SCALE_HORIZONTAL_ONLY
+#endif  // !CONFIG_HORZONLY_FRAME_SUPERRES
   }
 }
 
diff --git a/av1/common/resize.h b/av1/common/resize.h
index 882147a..7834dfa 100644
--- a/av1/common/resize.h
+++ b/av1/common/resize.h
@@ -85,10 +85,6 @@
                                           YV12_BUFFER_CONFIG *unscaled,
                                           YV12_BUFFER_CONFIG *scaled);
 
-// If 0: resize and superres scaling happens for both width and height.
-// If 1: resize and superres scaling happens ONLY for width.
-#define SCALE_HORIZONTAL_ONLY 0
-
 // Calculates the scaled size from the given original dimensions and the scale
 // denominator.
 void av1_calculate_scaled_size(int *width, int *height, int denom);
diff --git a/av1/encoder/encoder.c b/av1/encoder/encoder.c
index 4c844d8..06621d5 100644
--- a/av1/encoder/encoder.c
+++ b/av1/encoder/encoder.c
@@ -4491,7 +4491,7 @@
 
 static int dimensions_are_ok(int owidth, int oheight, size_params_type *rsz) {
   return dimension_is_ok(owidth, rsz->resize_width, rsz->superres_denom) &&
-         (SCALE_HORIZONTAL_ONLY ||
+         (CONFIG_HORZONLY_FRAME_SUPERRES ||
           dimension_is_ok(oheight, rsz->resize_height, rsz->superres_denom));
 }
 
@@ -4505,14 +4505,14 @@
   }
 
 // Calculate current resize scale.
-#if SCALE_HORIZONTAL_ONLY
+#if CONFIG_HORZONLY_FRAME_SUPERRES
   int resize_denom =
       DIVIDE_AND_ROUND(owidth * SCALE_NUMERATOR, rsz->resize_width);
 #else
   int resize_denom =
       AOMMAX(DIVIDE_AND_ROUND(owidth * SCALE_NUMERATOR, rsz->resize_width),
              DIVIDE_AND_ROUND(oheight * SCALE_NUMERATOR, rsz->resize_height));
-#endif  // SCALE_HORIZONTAL_ONLY
+#endif  // CONFIG_HORZONLY_FRAME_SUPERRES
 
   if (resize_mode != RESIZE_RANDOM && superres_mode == SUPERRES_RANDOM) {
     // Alter superres scale as needed to enforce conformity.
diff --git a/build/cmake/aom_config_defaults.cmake b/build/cmake/aom_config_defaults.cmake
index 9d231ed..488401b 100644
--- a/build/cmake/aom_config_defaults.cmake
+++ b/build/cmake/aom_config_defaults.cmake
@@ -153,6 +153,7 @@
 set(CONFIG_FRAME_SUPERRES 0 CACHE NUMBER "AV1 experiment flag.")
 set(CONFIG_GLOBAL_MOTION 1 CACHE NUMBER "AV1 experiment flag.")
 set(CONFIG_HASH_ME 0 CACHE NUMBER "AV1 experiment flag.")
+set(CONFIG_HORZONLY_FRAME_SUPERRES 0 CACHE NUMBER "AV1 experiment flag.")
 set(CONFIG_INTERINTRA 1 CACHE NUMBER "AV1 experiment flag.")
 set(CONFIG_INTER_STATS_ONLY 0 CACHE NUMBER "AV1 experiment flag.")
 set(CONFIG_INTRABC 0 CACHE NUMBER "AV1 experiment flag.")
diff --git a/build/cmake/aom_experiment_deps.cmake b/build/cmake/aom_experiment_deps.cmake
index edd07f9..938af23 100644
--- a/build/cmake/aom_experiment_deps.cmake
+++ b/build/cmake/aom_experiment_deps.cmake
@@ -128,6 +128,12 @@
       change_config_and_warn(CONFIG_VAR_TX 0 CONFIG_PVQ)
     endif ()
   endif ()
+
+  if (CONFIG_HORZONLY_FRAME_SUPERRES)
+    if (NOT CONFIG_FRAME_SUPERRES)
+      change_config_and_warn(CONFIG_FRAME_SUPERRES 1 CONFIG_HORZONLY_FRAME_SUPERRES)
+    endif ()
+  endif ()
 endmacro ()
 
 endif ()  # AOM_BUILD_CMAKE_AOM_EXPERIMENT_DEPS_CMAKE_
diff --git a/configure b/configure
index e30da0b..50a5fb2 100755
--- a/configure
+++ b/configure
@@ -353,6 +353,7 @@
     opt_ref_mv
     tmv
     restrict_compressed_hdr
+    horzonly_frame_superres
 "
 CONFIG_LIST="
     dependency_tracking
@@ -587,6 +588,7 @@
     enabled txmg && enable_feature highbitdepth
     enabled ext_skip && enable_feature frame_marker
     enabled ext_skip && enable_feature ext_refs
+    enabled horzonly_frame_superres && enable_feature frame_superres
 
     if enabled rawbits && enabled ans; then
       log_echo "rawbits requires not ans, so disabling rawbits"