Add config flag to calc psnr using av2 ctc type peak
CONFIG_AV2CTC_PSNR_PEAK is a new config flag added to use
AV2 CTC style peak value for PSNR {1020 and 2040 for 10- and 12-bit}
as opposed to {1023 and 2047 for 10- and 12-bit}.
The flag is on by default.
Cherry-picked from main branch.
diff --git a/aom_dsp/psnr.c b/aom_dsp/psnr.c
index 6c01624..93708a4 100644
--- a/aom_dsp/psnr.c
+++ b/aom_dsp/psnr.c
@@ -370,7 +370,11 @@
int i;
uint64_t total_sse = 0;
uint32_t total_samples = 0;
+#if CONFIG_AV2CTC_PSNR_PEAK
+ const double peak = (double)(255 << (in_bit_depth - 8));
+#else
const double peak = (double)((1 << in_bit_depth) - 1);
+#endif // CONFIG_AV2CTC_PSNR_PEAK
const unsigned int input_shift = bit_depth - in_bit_depth;
for (i = 0; i < 3; ++i) {
diff --git a/build/cmake/aom_config_defaults.cmake b/build/cmake/aom_config_defaults.cmake
index 8f863b1..9466391 100644
--- a/build/cmake/aom_config_defaults.cmake
+++ b/build/cmake/aom_config_defaults.cmake
@@ -133,6 +133,8 @@
"AV1 experiment flag for optical flow API.")
set_aom_config_var(CONFIG_ZERO_OFFSET_BITUPSHIFT 1
"Use zero offset for non-normative bit upshift")
+set_aom_config_var(CONFIG_AV2CTC_PSNR_PEAK 1
+ "Use AV2 CTC type PSNR peak for 10- and 12-bit")
# AV2 experiment flags.
set_aom_config_var(CONFIG_REMOVE_DIST_WTD_COMP 1