Revert CICP enum clamping
These values might be used in the future. Reverts the
following two commits:
Revert "Validate CICP in all code paths"
This reverts commit ab86c0c1b7015e568dd8eff5ce5fcfda439895c3.
Revert "read.c: Clamp CICP enum values to valid range"
This reverts commit 2f45ea494894a59c7dc93aff314251b308d88223.
diff --git a/src/read.c b/src/read.c
index 03f69b1..c60a6c5 100644
--- a/src/read.c
+++ b/src/read.c
@@ -1519,22 +1519,6 @@
return AVIF_RESULT_OK;
}
-static void clampCicpToValidRange(avifColorPrimaries * colorPrimaries,
- avifTransferCharacteristics * transferCharacteristics,
- avifMatrixCoefficients * matrixCoefficients)
-{
- if (*colorPrimaries == 3 || (*colorPrimaries > AVIF_COLOR_PRIMARIES_DCI_P3 && *colorPrimaries < AVIF_COLOR_PRIMARIES_EBU3213) ||
- *colorPrimaries > AVIF_COLOR_PRIMARIES_EBU3213) {
- *colorPrimaries = AVIF_COLOR_PRIMARIES_UNSPECIFIED;
- }
- if (*transferCharacteristics == 3 || *transferCharacteristics > AVIF_TRANSFER_CHARACTERISTICS_HLG) {
- *transferCharacteristics = AVIF_TRANSFER_CHARACTERISTICS_UNSPECIFIED;
- }
- if (*matrixCoefficients == 3 || *matrixCoefficients >= AVIF_MATRIX_COEFFICIENTS_LAST) {
- *matrixCoefficients = AVIF_MATRIX_COEFFICIENTS_UNSPECIFIED;
- }
-}
-
// Allocates the dstImage. Also verifies some spec compliance rules for grids, if relevant.
static avifResult avifDecoderDataAllocateImagePlanes(avifDecoderData * data, const avifTileInfo * info, avifImage * dstImage)
{
@@ -1613,7 +1597,6 @@
dstImage->colorPrimaries = tile->image->colorPrimaries;
dstImage->transferCharacteristics = tile->image->transferCharacteristics;
dstImage->matrixCoefficients = tile->image->matrixCoefficients;
- clampCicpToValidRange(&dstImage->colorPrimaries, &dstImage->transferCharacteristics, &dstImage->matrixCoefficients);
}
}
@@ -2242,7 +2225,6 @@
AVIF_CHECK(avifROStreamReadU16(&s, &colr->colorPrimaries)); // unsigned int(16) colour_primaries;
AVIF_CHECK(avifROStreamReadU16(&s, &colr->transferCharacteristics)); // unsigned int(16) transfer_characteristics;
AVIF_CHECK(avifROStreamReadU16(&s, &colr->matrixCoefficients)); // unsigned int(16) matrix_coefficients;
- clampCicpToValidRange(&colr->colorPrimaries, &colr->transferCharacteristics, &colr->matrixCoefficients);
uint8_t full_range_flag;
AVIF_CHECK(avifROStreamReadBits8(&s, &full_range_flag, /*bitCount=*/1)); // unsigned int(1) full_range_flag;
colr->range = full_range_flag ? AVIF_RANGE_FULL : AVIF_RANGE_LIMITED;
@@ -4706,7 +4688,6 @@
*colorPrimaries = prop->u.colr.colorPrimaries;
*transferCharacteristics = prop->u.colr.transferCharacteristics;
*matrixCoefficients = prop->u.colr.matrixCoefficients;
- clampCicpToValidRange(colorPrimaries, transferCharacteristics, matrixCoefficients);
*yuvRange = prop->u.colr.range;
}
}
@@ -4847,9 +4828,6 @@
gainMap->image->colorPrimaries = prop->u.colr.colorPrimaries;
gainMap->image->transferCharacteristics = prop->u.colr.transferCharacteristics;
gainMap->image->matrixCoefficients = prop->u.colr.matrixCoefficients;
- clampCicpToValidRange(&gainMap->image->colorPrimaries,
- &gainMap->image->transferCharacteristics,
- &gainMap->image->matrixCoefficients);
gainMap->image->yuvRange = prop->u.colr.range;
break;
}
@@ -5437,9 +5415,6 @@
decoder->image->colorPrimaries = sequenceHeader.colorPrimaries;
decoder->image->transferCharacteristics = sequenceHeader.transferCharacteristics;
decoder->image->matrixCoefficients = sequenceHeader.matrixCoefficients;
- clampCicpToValidRange(&decoder->image->colorPrimaries,
- &decoder->image->transferCharacteristics,
- &decoder->image->matrixCoefficients);
decoder->image->yuvRange = sequenceHeader.range;
break;
}