Use AOM_TUNE_PSNR by default for alpha (#2949)
diff --git a/CHANGELOG.md b/CHANGELOG.md index 2db5f9d..2d09c62 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md
@@ -45,6 +45,8 @@ Header OBU, for compatibility with libraries that wrongly ignore the colr box. * Use a "quality to quantizer (QP)" mapping formula designed for AOM_TUNE_IQ. * Set tuning before applying the user-provided specific aom codec options. +* Use AOM_TUNE_PSNR by default when encoding alpha with libaom because + AOM_TUNE_SSIM causes ringing for alpha. ### Removed since 1.3.0
diff --git a/apps/avifenc.c b/apps/avifenc.c index c68eea2..1dfee92 100644 --- a/apps/avifenc.c +++ b/apps/avifenc.c
@@ -320,7 +320,8 @@ printf(" enable-chroma-deltaq=B : Enable delta quantization in chroma planes. 0=disable (default), 1=enable\n"); printf(" end-usage=MODE : Rate control mode, one of 'vbr', 'cbr', 'cq', or 'q'\n"); printf(" sharpness=S : Bias towards block sharpness in rate-distortion optimization of transform coefficients in 0..7. (Default: 0)\n"); - printf(" tune=METRIC : Tune the encoder for distortion metric, one of 'psnr', 'ssim' (default for aom) or 'iq'.\n"); + printf(" tune=METRIC : Tune the encoder for distortion metric, one of 'psnr', 'ssim' or 'iq'.\n"); + printf(" (Default for color: ssim, default for alpha: psnr)\n"); printf(" film-grain-test=TEST : Film grain test vectors in 0..16. 0=none (default), 1=test1, 2=test2, ... 16=test16\n"); printf(" film-grain-table=FILENAME : Path to file containing film grain parameters\n"); printf("\n");
diff --git a/src/codec_aom.c b/src/codec_aom.c index c235db1..319aecf 100644 --- a/src/codec_aom.c +++ b/src/codec_aom.c
@@ -660,7 +660,12 @@ aom_tune_metric libavifDefaultTuneMetric = AOM_TUNE_PSNR; // Meaningless unless useLibavifDefaultTuneMetric. if (quality != AVIF_QUALITY_LOSSLESS && !avifAOMOptionsContainExplicitTuning(codec, alpha)) { useLibavifDefaultTuneMetric = AVIF_TRUE; - libavifDefaultTuneMetric = AOM_TUNE_SSIM; + if (alpha) { + // Minimize ringing for alpha. + libavifDefaultTuneMetric = AOM_TUNE_PSNR; + } else { + libavifDefaultTuneMetric = AOM_TUNE_SSIM; + } } struct aom_codec_enc_cfg * cfg = &codec->internal->cfg;