Skip to content

Commit 9688dcf

Browse files
y-guyonvrabaud
andauthored
Use AOM_TUNE_IQ by default for YUV (AOMediaCodec#2830)
Enable TUNE_IQ by default starting with libaom v3.13.0. Update avifenc --help. Add CHANGELOG entry. Co-authored-by: Vincent Rabaud <vrabaud@google.com>
1 parent c79a400 commit 9688dcf

3 files changed

Lines changed: 17 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ The changes are relative to the previous release, unless the baseline is specifi
5656
* Set tuning before applying the user-provided specific aom codec options.
5757
* Use AOM_TUNE_PSNR by default when encoding alpha with libaom because
5858
AOM_TUNE_SSIM causes ringing for alpha.
59+
* Use AOM_TUNE_IQ by default when encoding still non-RGB color samples with
60+
libaom v3.13.0 or later.
5961
* Converting an image containing a gain map using avifenc with the --grid flag
6062
now also splits the gain map into a grid.
6163

apps/avifenc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ static void syntaxLong(void)
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");
323323
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");
324+
printf(" (Default for color: still non-RGB images (libaom v3.13.0+): iq, otherwise: ssim; default for alpha: psnr)\n");
325325
printf(" film-grain-test=TEST : Film grain test vectors in 0..16. 0=none (default), 1=test1, 2=test2, ... 16=test16\n");
326326
printf(" film-grain-table=FILENAME : Path to file containing film grain parameters\n");
327327
printf("\n");

src/codec_aom.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -757,6 +757,20 @@ static avifResult aomCodecEncodeImage(avifCodec * codec,
757757
libavifDefaultTuneMetric = AOM_TUNE_PSNR;
758758
} else {
759759
libavifDefaultTuneMetric = AOM_TUNE_SSIM;
760+
#if defined(AOM_HAVE_TUNE_IQ)
761+
// AOM_TUNE_IQ has been tuned for the YCbCr family of color spaces, and is favored for
762+
// its low perceptual distortion. AOM_TUNE_IQ partially generalizes to, and benefits
763+
// from other "YUV-like" spaces (e.g. YCgCo and ICtCp) including monochrome (luma only).
764+
// AOM_TUNE_IQ sets --deltaq-mode=6 which can only be used in all intra mode.
765+
// AOM_TUNE_IQ was introduced in libaom v3.12.0 but it has significantly different bit
766+
// allocation characteristics compared to v3.13.0. AOM_TUNE_IQ is used by default
767+
// starting with v3.13.0 for fewer behavior changes in libavif.
768+
static const int aomVersion_3_13_0 = (3 << 16) | (13 << 8);
769+
if (image->matrixCoefficients != AVIF_MATRIX_COEFFICIENTS_IDENTITY && aomUsage == AOM_USAGE_ALL_INTRA &&
770+
aomVersion >= aomVersion_3_13_0) {
771+
libavifDefaultTuneMetric = AOM_TUNE_IQ;
772+
}
773+
#endif
760774
}
761775
}
762776
}

0 commit comments

Comments
 (0)