From 34b60fc51c5928b24c060d23ebb0f16fd802551a Mon Sep 17 00:00:00 2001 From: Wan-Teh Chang Date: Wed, 13 Dec 2023 13:24:26 -0800 Subject: [PATCH] Change some AVIF_COLOR_PRIMARIES_SRGB to BT709 In these places the use of AVIF_COLOR_PRIMARIES_BT709 is clearer. --- src/obu.c | 3 ++- src/reformat_libyuv.c | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/obu.c b/src/obu.c index 4edf191e15..bcc893e122 100644 --- a/src/obu.c +++ b/src/obu.c @@ -290,7 +290,8 @@ static avifBool parseSequenceHeaderColorConfig(avifBits * bits, avifSequenceHead header->av1C.chromaSubsamplingX = 1; header->av1C.chromaSubsamplingY = 1; header->yuvFormat = AVIF_PIXEL_FORMAT_YUV400; - } else if (header->colorPrimaries == AVIF_COLOR_PRIMARIES_SRGB && header->transferCharacteristics == AVIF_TRANSFER_CHARACTERISTICS_SRGB && + } else if (header->colorPrimaries == AVIF_COLOR_PRIMARIES_BT709 && + header->transferCharacteristics == AVIF_TRANSFER_CHARACTERISTICS_SRGB && header->matrixCoefficients == AVIF_MATRIX_COEFFICIENTS_IDENTITY) { header->range = AVIF_RANGE_FULL; header->av1C.chromaSubsamplingX = 0; diff --git a/src/reformat_libyuv.c b/src/reformat_libyuv.c index 0518fce8a1..13cfde132f 100644 --- a/src/reformat_libyuv.c +++ b/src/reformat_libyuv.c @@ -785,7 +785,7 @@ static void getLibYUVConstants(const avifImage * image, const struct YuvConstant break; case AVIF_MATRIX_COEFFICIENTS_CHROMA_DERIVED_NCL: switch (image->colorPrimaries) { - case AVIF_COLOR_PRIMARIES_SRGB: + case AVIF_COLOR_PRIMARIES_BT709: case AVIF_COLOR_PRIMARIES_UNSPECIFIED: #if LIBYUV_VERSION >= 1772 *matrixYUV = &kYuvF709Constants; @@ -844,7 +844,7 @@ static void getLibYUVConstants(const avifImage * image, const struct YuvConstant break; case AVIF_MATRIX_COEFFICIENTS_CHROMA_DERIVED_NCL: switch (image->colorPrimaries) { - case AVIF_COLOR_PRIMARIES_SRGB: + case AVIF_COLOR_PRIMARIES_BT709: case AVIF_COLOR_PRIMARIES_UNSPECIFIED: *matrixYUV = &kYuvH709Constants; *matrixYVU = &kYvuH709Constants;