Commit 45f1839d86 for aom
commit 45f1839d867c0623ce8945c0717d233a93d2f150
Author: Yunqing Wang <yunqingwang@google.com>
Date: Fri Sep 11 16:02:59 2026 -0700
Consolidate and remove tune for VMAF with pre-processing
The option "--tune=vmaf_with_preprocessing" is almost a subset of
"--tune=vmaf" and also has a similar performance. Consolidate these
2 options and remove vmaf_with_preprocessing one.
Bug: 560267484
Change-Id: I423180f986b3f288a39f1431147a8454834e82aa
diff --git a/aom/aomcx.h b/aom/aomcx.h
index 4730fb0c89..d9e533a7f8 100644
--- a/aom/aomcx.h
+++ b/aom/aomcx.h
@@ -1777,9 +1777,7 @@ typedef enum {
typedef enum {
AOM_TUNE_PSNR = 0,
AOM_TUNE_SSIM = 1,
- /* NOTE: enums 2 and 3 unused */
- AOM_TUNE_VMAF_WITH_PREPROCESSING = 4,
- /* NOTE: enum 5 unused */
+ /* NOTE: enums 2, 3, 4, and 5 unused */
AOM_TUNE_VMAF_MAX_GAIN = 6,
AOM_TUNE_VMAF_NEG_MAX_GAIN = 7,
AOM_TUNE_BUTTERAUGLI = 8,
diff --git a/av1/arg_defs.c b/av1/arg_defs.c
index 52f8400d99..d9627cd039 100644
--- a/av1/arg_defs.c
+++ b/av1/arg_defs.c
@@ -42,7 +42,6 @@ static const struct arg_enum_list end_usage_enum[] = { { "vbr", AOM_VBR },
static const struct arg_enum_list tuning_enum[] = {
{ "psnr", AOM_TUNE_PSNR },
{ "ssim", AOM_TUNE_SSIM },
- { "vmaf_with_preprocessing", AOM_TUNE_VMAF_WITH_PREPROCESSING },
{ "vmaf", AOM_TUNE_VMAF_MAX_GAIN },
{ "vmaf_neg", AOM_TUNE_VMAF_NEG_MAX_GAIN },
{ "butteraugli", AOM_TUNE_BUTTERAUGLI },
diff --git a/av1/encoder/encoder.c b/av1/encoder/encoder.c
index 4a30b9d8dd..daf31fba80 100644
--- a/av1/encoder/encoder.c
+++ b/av1/encoder/encoder.c
@@ -4773,12 +4773,10 @@ int av1_receive_raw_frame(AV1_COMP *cpi, aom_enc_frame_flags_t frame_flags,
}
#if CONFIG_TUNE_VMAF
- if (!is_stat_generation_stage(cpi) &&
- cpi->oxcf.tune_cfg.tuning == AOM_TUNE_VMAF_WITH_PREPROCESSING) {
- av1_vmaf_frame_preprocessing(cpi, sd);
- }
if (!is_stat_generation_stage(cpi) &&
cpi->oxcf.tune_cfg.tuning == AOM_TUNE_VMAF_MAX_GAIN) {
+ // Future work: frame-level preprocessing can be used here if the
+ // performance is similar.
av1_vmaf_blk_preprocessing(cpi, sd);
}
#endif
diff --git a/av1/encoder/encoder.h b/av1/encoder/encoder.h
index 9f4a111894..1b13fc9136 100644
--- a/av1/encoder/encoder.h
+++ b/av1/encoder/encoder.h
@@ -4457,8 +4457,7 @@ static inline int is_psnr_calc_enabled(const AV1_COMP *cpi) {
// Check if VMAF tuning is enabled.
static inline int is_vmaf_tuning_mode(const aom_tune_metric tuning) {
- return tuning == AOM_TUNE_VMAF_WITH_PREPROCESSING ||
- tuning == AOM_TUNE_VMAF_MAX_GAIN ||
+ return tuning == AOM_TUNE_VMAF_MAX_GAIN ||
tuning == AOM_TUNE_VMAF_NEG_MAX_GAIN;
}
diff --git a/av1/encoder/tune_vmaf.c b/av1/encoder/tune_vmaf.c
index 778420270c..981033de48 100644
--- a/av1/encoder/tune_vmaf.c
+++ b/av1/encoder/tune_vmaf.c
@@ -402,45 +402,6 @@ void av1_vmaf_neg_preprocessing(AV1_COMP *const cpi,
aom_free_frame_buffer(&blurred);
}
-void av1_vmaf_frame_preprocessing(AV1_COMP *const cpi,
- const YV12_BUFFER_CONFIG *const source) {
- const AV1_COMMON *const cm = &cpi->common;
- const int bit_depth = cpi->td.mb.e_mbd.bd;
- const int width = source->y_width;
- const int height = source->y_height;
-
- YV12_BUFFER_CONFIG source_extended, blurred;
- memset(&source_extended, 0, sizeof(source_extended));
- memset(&blurred, 0, sizeof(blurred));
- aom_alloc_frame_buffer(
- &source_extended, width, height, source->subsampling_x,
- source->subsampling_y, cm->seq_params->use_highbitdepth,
- cpi->oxcf.border_in_pixels, cm->features.byte_alignment, false, 0);
- aom_alloc_frame_buffer(
- &blurred, width, height, source->subsampling_x, source->subsampling_y,
- cm->seq_params->use_highbitdepth, cpi->oxcf.border_in_pixels,
- cm->features.byte_alignment, false, 0);
-
- av1_copy_and_extend_frame(source, &source_extended);
- gaussian_blur(bit_depth, &source_extended, &blurred);
- aom_free_frame_buffer(&source_extended);
-
- const GF_GROUP *const gf_group = &cpi->ppi->gf_group;
- const int layer_depth =
- AOMMIN(gf_group->layer_depth[cpi->gf_frame_index], MAX_ARF_LAYERS - 1);
- const double last_frame_unsharp_amount =
- get_layer_value(cpi->vmaf_info.last_frame_unsharp_amount, layer_depth);
-
- const double best_frame_unsharp_amount = find_best_frame_unsharp_amount(
- cpi, source, &blurred, last_frame_unsharp_amount, 0.05, 20, 1.01);
-
- cpi->vmaf_info.last_frame_unsharp_amount[layer_depth] =
- best_frame_unsharp_amount;
-
- unsharp(cpi, source, &blurred, source, best_frame_unsharp_amount);
- aom_free_frame_buffer(&blurred);
-}
-
void av1_vmaf_blk_preprocessing(AV1_COMP *const cpi,
const YV12_BUFFER_CONFIG *const source) {
const AV1_COMMON *const cm = &cpi->common;
diff --git a/av1/encoder/tune_vmaf.h b/av1/encoder/tune_vmaf.h
index 7e01435e4e..a79f90f68f 100644
--- a/av1/encoder/tune_vmaf.h
+++ b/av1/encoder/tune_vmaf.h
@@ -45,9 +45,6 @@ struct AV1_COMP;
void av1_vmaf_blk_preprocessing(struct AV1_COMP *cpi,
const YV12_BUFFER_CONFIG *source);
-void av1_vmaf_frame_preprocessing(struct AV1_COMP *cpi,
- const YV12_BUFFER_CONFIG *source);
-
void av1_vmaf_neg_preprocessing(struct AV1_COMP *cpi,
const YV12_BUFFER_CONFIG *source);
diff --git a/test/av1_convolve_test.cc b/test/av1_convolve_test.cc
index 4b444bdff0..7d1bef4086 100644
--- a/test/av1_convolve_test.cc
+++ b/test/av1_convolve_test.cc
@@ -1376,7 +1376,7 @@ class AV1Convolve2DTest : public AV1ConvolveTest<convolve_2d_func> {
private:
void TestConvolveVmaf() {
- // 8-tap Gaussian blur filter used by tune=vmaf_with_preprocessing
+ // 8-tap Gaussian blur filter used by tune=vmaf
// in av1/encoder/tune_vmaf.c.
// The array is of size 9 to allow passing kGaussFilter + 1 to
// _mm_loadu_si128() in prepare_coeffs_6t().