Skip to content

Commit 5b14acb

Browse files
y-guyonvrabaud
andcommitted
Use AOM_TUNE_IQ by default
Co-authored-by: Vincent Rabaud <vrabaud@google.com>
1 parent 1e295ed commit 5b14acb

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ The changes are relative to the previous release, unless the baseline is specifi
4747
* Set tuning before applying the user-provided specific aom codec options.
4848
* Use AOM_TUNE_PSNR by default when encoding alpha with libaom because
4949
AOM_TUNE_SSIM causes ringing for alpha.
50+
* Use AOM_TUNE_IQ by default when encoding still luma and chroma with libaom.
5051

5152
### Removed since 1.3.0
5253

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 images (aom v3.12+): 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: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -665,15 +665,22 @@ static avifResult aomCodecEncodeImage(avifCodec * codec,
665665
libavifDefaultTuneMetric = AOM_TUNE_PSNR;
666666
} else {
667667
libavifDefaultTuneMetric = AOM_TUNE_SSIM;
668+
#if defined(AOM_HAVE_TUNE_IQ) && defined(AOM_USAGE_ALL_INTRA) && defined(ALL_INTRA_HAS_SPEEDS_7_TO_9)
669+
// AOM_TUNE_IQ is favored for its low perceptual distortion on luma and chroma samples.
670+
// AOM_TUNE_IQ sets --deltaq-mode=6 which can only be used in all intra mode.
671+
if (image->matrixCoefficients != AVIF_MATRIX_COEFFICIENTS_IDENTITY && (addImageFlags & AVIF_ADD_IMAGE_FLAG_SINGLE)) {
672+
libavifDefaultTuneMetric = AOM_TUNE_IQ;
673+
}
674+
#endif
668675
}
669676
}
670677

671678
struct aom_codec_enc_cfg * cfg = &codec->internal->cfg;
672679
avifBool quantizerUpdated = AVIF_FALSE;
673680
// True if libavif knows that tune=iq is used, either by default by libavif, or explicitly set by the user.
674681
// False otherwise (including if libaom uses tune=iq by default, which is not the case as of v1.13.1 and earlier versions).
675-
// This is only accurate for the first frame but tune=iq is only supported for still images in libavif and
676-
// for all-intra coding in libaom (at least up to v1.13.1) anyway.
682+
// This is only accurate for the first frame but tune=iq is only supported for all-intra coding in libaom (at least up to v1.13.1),
683+
// and thus only supported for still images in libavif.
677684
const avifBool useTuneIq = useLibavifDefaultTuneMetric ? libavifDefaultTuneMetric == AOM_TUNE_IQ : avifImageUsesTuneIq(codec, alpha);
678685
const int quantizer = aomQualityToQuantizer(quality, useTuneIq);
679686

0 commit comments

Comments
 (0)