* Additional changes for PR #477 * clang-format all files * Make it clear in avifenc syntax that -p signals prem in the resultant AVIF * Fix tref prem parsing to match tref auxl parsing (same syntax/box) * parenthesize binops in assignments (style) * Continue new convertResult pattern in avifImageYUVToRGB instead of early-out * Replace pColorIrefType/pColorIrefToID with new avifEncoderDataFindItemByID() call, as avifEncoderItem* mem storage may shift during new calls to avifEncoderDataCreateItem() so deep pointers into them during this is bad, plus this happens to remove accidental Hungarian notation, which is good
diff --git a/src/read.c b/src/read.c index 941b20d..db18c9a 100644 --- a/src/read.c +++ b/src/read.c
@@ -2033,12 +2033,13 @@ if (!memcmp(header.type, "auxl", 4)) { uint32_t toID; - CHECK(avifROStreamReadU32(&s, &toID)); // unsigned int(32) track_IDs[] + CHECK(avifROStreamReadU32(&s, &toID)); // unsigned int(32) track_IDs[]; CHECK(avifROStreamSkip(&s, header.size - sizeof(uint32_t))); // just take the first one track->auxForID = toID; } else if (!memcmp(header.type, "prem", 4)) { uint32_t byID; - CHECK(avifROStreamReadU32(&s, &byID)); // unsigned int(32) to_item_ID + CHECK(avifROStreamReadU32(&s, &byID)); // unsigned int(32) track_IDs[]; + CHECK(avifROStreamSkip(&s, header.size - sizeof(uint32_t))); // just take the first one track->premByID = byID; } else { CHECK(avifROStreamSkip(&s, header.size)); @@ -2613,7 +2614,7 @@ decoder->image->width = colorTrack->width; decoder->image->height = colorTrack->height; decoder->alphaPresent = (alphaTrack != NULL); - decoder->image->alphaPremultiplied = decoder->alphaPresent && colorTrack->premByID == alphaTrack->id; + decoder->image->alphaPremultiplied = decoder->alphaPresent && (colorTrack->premByID == alphaTrack->id); } else { // Create from items @@ -2770,7 +2771,7 @@ decoder->image->height = 0; } decoder->alphaPresent = (alphaItem != NULL); - decoder->image->alphaPremultiplied = decoder->alphaPresent && colorItem->premByID == alphaItem->id; + decoder->image->alphaPremultiplied = decoder->alphaPresent && (colorItem->premByID == alphaItem->id); } // Sanity check tiles