Commit 3d8bcb2a authored by Urvang Joshi's avatar Urvang Joshi

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
parent 938172c2
......@@ -1172,12 +1172,12 @@ void av1_calculate_scaled_size(int *width, int *height, int denom) {
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 @@ void av1_calculate_unscaled_size(int *width, int *height, int denom) {
// 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
}
}
......
......@@ -85,10 +85,6 @@ YV12_BUFFER_CONFIG *av1_scale_if_required(AV1_COMMON *cm,
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);
......
......@@ -4491,7 +4491,7 @@ static int dimension_is_ok(int orig_dim, int resized_dim, int denom) {
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 @@ static int validate_size_scales(RESIZE_MODE resize_mode,
}
// 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.
......
......@@ -153,6 +153,7 @@ set(CONFIG_FRAME_SIZE 0 CACHE NUMBER "AV1 experiment flag.")
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.")
......
......@@ -128,6 +128,12 @@ macro (fix_experiment_configs)
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_
......@@ -353,6 +353,7 @@ EXPERIMENT_LIST="
opt_ref_mv
tmv
restrict_compressed_hdr
horzonly_frame_superres
"
CONFIG_LIST="
dependency_tracking
......@@ -587,6 +588,7 @@ post_process_cmdline() {
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"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment