Skip to content

Commit 1e295ed

Browse files
authored
Use AOM_TUNE_PSNR by default for alpha (AOMediaCodec#2949)
1 parent 08d09e4 commit 1e295ed

3 files changed

Lines changed: 10 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ The changes are relative to the previous release, unless the baseline is specifi
4545
Header OBU, for compatibility with libraries that wrongly ignore the colr box.
4646
* Use a "quality to quantizer (QP)" mapping formula designed for AOM_TUNE_IQ.
4747
* Set tuning before applying the user-provided specific aom codec options.
48+
* Use AOM_TUNE_PSNR by default when encoding alpha with libaom because
49+
AOM_TUNE_SSIM causes ringing for alpha.
4850

4951
### Removed since 1.3.0
5052

apps/avifenc.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,8 @@ static void syntaxLong(void)
320320
printf(" enable-chroma-deltaq=B : Enable delta quantization in chroma planes. 0=disable (default), 1=enable\n");
321321
printf(" end-usage=MODE : Rate control mode, one of 'vbr', 'cbr', 'cq', or 'q'\n");
322322
printf(" sharpness=S : Bias towards block sharpness in rate-distortion optimization of transform coefficients in 0..7. (Default: 0)\n");
323-
printf(" tune=METRIC : Tune the encoder for distortion metric, one of 'psnr', 'ssim' (default for aom) or 'iq'.\n");
323+
printf(" tune=METRIC : Tune the encoder for distortion metric, one of 'psnr', 'ssim' or 'iq'.\n");
324+
printf(" (Default for color: ssim, default for alpha: psnr)\n");
324325
printf(" film-grain-test=TEST : Film grain test vectors in 0..16. 0=none (default), 1=test1, 2=test2, ... 16=test16\n");
325326
printf(" film-grain-table=FILENAME : Path to file containing film grain parameters\n");
326327
printf("\n");

src/codec_aom.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -660,7 +660,12 @@ static avifResult aomCodecEncodeImage(avifCodec * codec,
660660
aom_tune_metric libavifDefaultTuneMetric = AOM_TUNE_PSNR; // Meaningless unless useLibavifDefaultTuneMetric.
661661
if (quality != AVIF_QUALITY_LOSSLESS && !avifAOMOptionsContainExplicitTuning(codec, alpha)) {
662662
useLibavifDefaultTuneMetric = AVIF_TRUE;
663-
libavifDefaultTuneMetric = AOM_TUNE_SSIM;
663+
if (alpha) {
664+
// Minimize ringing for alpha.
665+
libavifDefaultTuneMetric = AOM_TUNE_PSNR;
666+
} else {
667+
libavifDefaultTuneMetric = AOM_TUNE_SSIM;
668+
}
664669
}
665670

666671
struct aom_codec_enc_cfg * cfg = &codec->internal->cfg;

0 commit comments

Comments
 (0)