Fix grid item progressive propagation logic
Set the top level grid item's progressive to be true only if all
the grid items have progressive set to true (and not just the
first one).
diff --git a/src/read.c b/src/read.c
index a6ddc4f..32e279b 100644
--- a/src/read.c
+++ b/src/read.c
@@ -1426,6 +1426,7 @@
// Count number of dimg for this item, bail out if it doesn't match perfectly
unsigned int tilesAvailable = 0;
avifDecoderItem * firstTileItem = NULL;
+ avifBool progressive = AVIF_TRUE;
for (uint32_t i = 0; i < gridItem->meta->items.count; ++i) {
avifDecoderItem * item = gridItem->meta->items.item[i];
if (item->dimgForID != gridItem->id) {
@@ -1490,9 +1491,6 @@
AVIF_CHECKERR(dstProp != NULL, AVIF_RESULT_OUT_OF_MEMORY);
*dstProp = *srcProp;
- if (itemCategory == AVIF_ITEM_COLOR && item->progressive) {
- gridItem->progressive = AVIF_TRUE; // Propagate the progressive status to the top-level grid item.
- }
} else if (memcmp(item->type, firstTileItem->type, 4)) {
// MIAF (ISO 23000-22:2019), Section 7.3.11.4.1:
// All input images of a grid image item shall use the same coding format [...]
@@ -1504,8 +1502,15 @@
(const char *)firstTileItem->type);
return AVIF_RESULT_INVALID_IMAGE_GRID;
}
+ if (!item->progressive) {
+ progressive = AVIF_FALSE;
+ }
++tilesAvailable;
}
+ if (itemCategory == AVIF_ITEM_COLOR && progressive) {
+ // If all the items that make up the grid are progressive, then propagate that status to the top-level grid item.
+ gridItem->progressive = AVIF_TRUE;
+ }
if (tilesAvailable != grid->rows * grid->columns) {
avifDiagnosticsPrintf(&decoder->diag,