Skip to content

Commit f142cf1

Browse files
committed
Remove define check
Add non-RGB to avifenc help. Base tune default on aomUsage. Enable TUNE_IQ by default starting with libaom v3.13.0.
1 parent 13e766f commit f142cf1

3 files changed

Lines changed: 11 additions & 8 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ The changes are relative to the previous release, unless the baseline is specifi
5151
* Use AOM_TUNE_PSNR by default when encoding alpha with libaom because
5252
AOM_TUNE_SSIM causes ringing for alpha.
5353
* Use AOM_TUNE_IQ by default when encoding still non-RGB color samples with
54-
libaom.
54+
libaom v3.13.0 or later.
5555
* Converting an image containing a gain map using avifenc with the --grid flag
5656
now also splits the gain map into a grid.
5757

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: still images (libaom v3.12.0+): iq, otherwise: 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: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -728,13 +728,16 @@ static avifResult aomCodecEncodeImage(avifCodec * codec,
728728
} else {
729729
libavifDefaultTuneMetric = AOM_TUNE_SSIM;
730730
#if defined(AOM_HAVE_TUNE_IQ)
731-
#if !defined(AOM_USAGE_ALL_INTRA) || !defined(ALL_INTRA_HAS_SPEEDS_7_TO_9)
732-
#error "AOM_HAVE_TUNE_IQ was introduced after AOM_USAGE_ALL_INTRA and ALL_INTRA_HAS_SPEEDS_7_TO_9"
733-
#endif
734-
// AOM_TUNE_IQ has been tuned for the YCbCr family of color spaces, and is favored for its low perceptual distortion.
735-
// AOM_TUNE_IQ partially generalizes to, and benefits from other "YUV-like" spaces (e.g. YCgCo and ICtCp) including monochrome (luma only).
731+
// AOM_TUNE_IQ has been tuned for the YCbCr family of color spaces, and is favored for
732+
// its low perceptual distortion. AOM_TUNE_IQ partially generalizes to, and benefits
733+
// from other "YUV-like" spaces (e.g. YCgCo and ICtCp) including monochrome (luma only).
736734
// AOM_TUNE_IQ sets --deltaq-mode=6 which can only be used in all intra mode.
737-
if (image->matrixCoefficients != AVIF_MATRIX_COEFFICIENTS_IDENTITY && (addImageFlags & AVIF_ADD_IMAGE_FLAG_SINGLE)) {
735+
// AOM_TUNE_IQ was introduced in libaom v3.12.0 but it has significantly different bit
736+
// allocation characteristics compared to v3.13.0. AOM_TUNE_IQ is used by default
737+
// starting with v3.13.0 for fewer behavior changes in libavif.
738+
static const int aomVersion_3_13_0 = (3 << 16) | (13 << 8);
739+
if (image->matrixCoefficients != AVIF_MATRIX_COEFFICIENTS_IDENTITY && aomUsage == AOM_USAGE_ALL_INTRA &&
740+
aomVersion >= aomVersion_3_13_0) {
738741
libavifDefaultTuneMetric = AOM_TUNE_IQ;
739742
}
740743
#endif

0 commit comments

Comments
 (0)