Skip to content

Commit

Permalink
Apply comments
Browse files Browse the repository at this point in the history
  • Loading branch information
y-guyon committed Jan 15, 2025
1 parent 3cce15a commit ea725e9
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions src/read.c
Original file line number Diff line number Diff line change
Expand Up @@ -2762,16 +2762,16 @@ static avifResult avifParseItemPropertyAssociation(avifMeta * meta, const uint8_
// Copy property to item
const avifProperty * srcProp = &meta->properties.prop[propertyIndex];

// ISO/IEC 23000-22 Section 6.5.1:
// 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 Section 3.1.29:
// ISO/IEC 23008-12:2022 Section 3.1.28:
// item property: descriptive or transformative information
const avifBool isDescriptive = !isTransformative;
// ISO/IEC 23008-12 Section 7.3.9 :
// 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.
Expand Down Expand Up @@ -2815,8 +2815,9 @@ static avifResult avifParseItemPropertyAssociation(avifMeta * meta, const uint8_
// HEIF: Section 6.5.11.1: "essential shall be equal to 1 for an 'lsel' item property."
"lsel",

// MIAF: Section 7.3.9: "All transformative properties associated with coded and derived
// images shall be marked as essential"
// MIAF 2019/Amd. 2:2021: Section 7.3.9:
// All transformative properties associated with coded and derived images shall be
// marked as essential
// It makes no sense to allow for non-essential crop/orientation associated with an item
// that is not a coded or derived image, so for simplicity 'item' is not checked here.
"clap",
Expand All @@ -2840,22 +2841,16 @@ static avifResult avifParseItemPropertyAssociation(avifMeta * meta, const uint8_
avifProperty * dstProp = (avifProperty *)avifArrayPush(&item->properties);
AVIF_CHECKERR(dstProp != NULL, AVIF_RESULT_OUT_OF_MEMORY);
*dstProp = *srcProp;

if (isTransformative) {
transformativePropertySeen = AVIF_TRUE;
}
} else {
AVIF_ASSERT_OR_RETURN(!isTransformative);

if (essential) {
// ISO/IEC 23008-12 Section 10.2.1:
// Under any brand, the primary item (or an alternative if alternative support is required)
// shall be processable by a reader implementing only the required features of that brand.
// Specifically, given that each brand has a set of properties that a reader is required to
// support: the item shall not have properties that are marked as essential and are outside
// this set.
// Assuming this rule also applies to items whose primary item depends on (such as the cells
// of a grid).
// It is assumed that this rule also applies to items the primary item depends on (such as
// the cells of a grid).

// Discovered an essential item property that libavif doesn't support!
// Make a note to ignore this item later.
Expand All @@ -2871,6 +2866,11 @@ 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;
Expand Down

0 comments on commit ea725e9

Please sign in to comment.