diff --git a/CHANGELOG.md b/CHANGELOG.md index 42c2a01ec7..9d1fad08d2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -55,7 +55,6 @@ The changes are relative to the previous release, unless the baseline is specifi * Deprecate avifCropRectConvertCleanApertureBox() and avifCleanApertureBoxConvertCropRect(). Replace them with avifCropRectFromCleanApertureBox() and avifCleanApertureBoxFromCropRect(). -* Ignore descriptive properties associated after transformative ones. * Reject non-essential transformative properties. ## [1.1.1] - 2024-07-30 diff --git a/src/read.c b/src/read.c index a0f8d5db81..4173726375 100644 --- a/src/read.c +++ b/src/read.c @@ -2735,7 +2735,6 @@ static avifResult avifParseItemPropertyAssociation(avifMeta * meta, const uint8_ uint8_t associationCount; AVIF_CHECKERR(avifROStreamRead(&s, &associationCount, 1), AVIF_RESULT_BMFF_PARSE_FAILED); - avifBool transformativePropertySeen = AVIF_FALSE; for (uint8_t associationIndex = 0; associationIndex < associationCount; ++associationIndex) { uint8_t essential; AVIF_CHECKERR(avifROStreamReadBitsU8(&s, &essential, /*bitCount=*/1), AVIF_RESULT_BMFF_PARSE_FAILED); // bit(1) essential; @@ -2766,23 +2765,6 @@ static avifResult avifParseItemPropertyAssociation(avifMeta * meta, const uint8_ // Copy property to item const avifProperty * srcProp = &meta->properties.prop[propertyIndex]; - // ISO/IEC 23000-22:2019/Amd. 2:2021 Section 7.3.9: - // All transformative properties associated with coded and derived images shall be marked as essential, - // and shall be from the set defined in 7.3.6.7 or the applicable MIAF profile. No other essential - // transformative property shall be associated with such images. - const avifBool isTransformative = !memcmp(srcProp->type, "clap", 4) || !memcmp(srcProp->type, "irot", 4) || - !memcmp(srcProp->type, "imir", 4); - // ISO/IEC 23008-12:2022 Section 3.1.28: - // item property: descriptive or transformative information - const avifBool isDescriptive = !isTransformative; - // ISO/IEC 23008-12:2022 Section 6.5.1: - // Readers shall allow and ignore descriptive properties following the first transformative or - // unrecognized property, whichever is earlier, in the sequence associating properties with an item. - // No need to check for unrecognized properties as they cannot be transformative according to MIAF. - if (transformativePropertySeen && isDescriptive) { - continue; - } - // Some properties are supported and parsed by libavif. // Other properties are forwarded to the user as opaque blobs. const avifBool supportedType = !srcProp->isOpaque; @@ -2870,11 +2852,6 @@ static avifResult avifParseItemPropertyAssociation(avifMeta * meta, const uint8_ AVIF_CHECKRES( avifRWDataSet(&dstProp->u.opaque.boxPayload, srcProp->u.opaque.boxPayload.data, srcProp->u.opaque.boxPayload.size)); } - - if (isTransformative) { - AVIF_ASSERT_OR_RETURN(supportedType); - transformativePropertySeen = AVIF_TRUE; - } } } return AVIF_RESULT_OK; diff --git a/tests/gtest/aviftransformtest.cc b/tests/gtest/aviftransformtest.cc index 6cad08f1cd..558e4ba57b 100644 --- a/tests/gtest/aviftransformtest.cc +++ b/tests/gtest/aviftransformtest.cc @@ -85,11 +85,15 @@ TEST(TransformTest, ClopIrotImor) { ASSERT_EQ(avifDecoderSetIOFile(decoder.get(), path.c_str()), AVIF_RESULT_OK); ASSERT_EQ(avifDecoderParse(decoder.get()), AVIF_RESULT_OK); - // 'imor' shall be ignored by libavif as it is after a transformative property - // in the 'ipma' association order. - ASSERT_EQ(decoder->image->numProperties, 1u); + // 'imor' should be ignored as it is after a transformative property in the + // 'ipma' association order. libavif still surfaces it because this constraint + // is relaxed in Amd2 of HEIF ISO/IEC 23008-12. + // See https://github.com/MPEGGroup/FileFormat/issues/113. + ASSERT_EQ(decoder->image->numProperties, 2u); const avifImageItemProperty& clop = decoder->image->properties[0]; EXPECT_EQ(std::string(clop.boxtype, clop.boxtype + 4), "clop"); + const avifImageItemProperty& imor = decoder->image->properties[1]; + EXPECT_EQ(std::string(imor.boxtype, imor.boxtype + 4), "imor"); } //------------------------------------------------------------------------------