| 2320 | } |
| 2321 | |
| 2322 | static avifResult avifDecoderSampleTransformItemValidateProperties(const avifDecoderItem * satoItem, avifDiagnostics * diag) |
| 2323 | { |
| 2324 | AVIF_ASSERT_OR_RETURN(memcmp(satoItem->type, "sato", 4) == 0); |
| 2325 | const avifProperty * pixiProp = avifPropertyArrayFind(&satoItem->properties, "pixi"); |
| 2326 | if (!pixiProp) { |
| 2327 | avifDiagnosticsPrintf(diag, "Item ID %u of type 'sato' is missing mandatory pixi property", satoItem->id); |
| 2328 | return AVIF_RESULT_BMFF_PARSE_FAILED; |
| 2329 | } |
| 2330 | for (uint8_t i = 1; i < pixiProp->u.pixi.planeCount; ++i) { |
| 2331 | // This is enforced in avifParsePixelInformationProperty(). |
| 2332 | AVIF_ASSERT_OR_RETURN(pixiProp->u.pixi.planeDepths[i] == pixiProp->u.pixi.planeDepths[0]); |
| 2333 | } |
| 2334 | AVIF_ASSERT_OR_RETURN(pixiProp->u.pixi.planeCount >= 1); |
| 2335 | const uint8_t depth = pixiProp->u.pixi.planeDepths[0]; |
| 2336 | if (depth != 8 && depth != 10 && depth != 12 && depth != 16) { |
| 2337 | avifDiagnosticsPrintf(diag, |
| 2338 | "Item ID %u of type 'sato' with depth %u (specified by pixi property) is not supported", |
| 2339 | satoItem->id, |
| 2340 | depth); |
| 2341 | return AVIF_RESULT_NOT_IMPLEMENTED; |
| 2342 | } |
| 2343 | |
| 2344 | const avifProperty * ispeProp = avifPropertyArrayFind(&satoItem->properties, "ispe"); |
| 2345 | if (!ispeProp) { |
| 2346 | avifDiagnosticsPrintf(diag, "Item ID %u of type 'sato' is missing mandatory ispe property", satoItem->id); |
| 2347 | return AVIF_RESULT_BMFF_PARSE_FAILED; |
| 2348 | } |
| 2349 | |
| 2350 | // Check that all input image items of the 'sato' derived image item share the same properties. |
| 2351 | for (uint32_t i = 0; i < satoItem->meta->items.count; ++i) { |
| 2352 | avifDecoderItem * inputImageItem = satoItem->meta->items.item[i]; |
| 2353 | if (inputImageItem->dimgForID != satoItem->id) { |
| 2354 | continue; |
| 2355 | } |
| 2356 | |
| 2357 | // Require all input image items of the 'sato' derived image item to be associated with a ImageSpatialExtentsProperty. |
| 2358 | const avifProperty * inputImageItemIspeProp = avifPropertyArrayFind(&inputImageItem->properties, "ispe"); |
| 2359 | if (inputImageItemIspeProp == NULL) { |
| 2360 | avifDiagnosticsPrintf(diag, "Item ID %u is missing mandatory ispe property", inputImageItem->id); |
| 2361 | return AVIF_RESULT_BMFF_PARSE_FAILED; |
| 2362 | } |
| 2363 | |
| 2364 | // The codec configuration property must be present, at least on the first cell for a 'grid' item. |
| 2365 | const avifProperty * inputImageItemCodecConfig = avifDecoderItemCodecConfigOrFirstCellCodecConfig(inputImageItem); |
| 2366 | if (inputImageItemCodecConfig == NULL) { |
| 2367 | avifDiagnosticsPrintf(diag, |
| 2368 | "Item ID %u of type '%.4s' is missing mandatory codec configuration property", |
| 2369 | inputImageItem->id, |
| 2370 | (const char *)inputImageItem->type); |
| 2371 | return AVIF_RESULT_BMFF_PARSE_FAILED; |
| 2372 | } |
| 2373 | |
| 2374 | for (uint32_t j = i + 1; j < satoItem->meta->items.count; ++j) { |
| 2375 | avifDecoderItem * otherInputImageItem = satoItem->meta->items.item[j]; |
| 2376 | if (otherInputImageItem->dimgForID != satoItem->id) { |
| 2377 | continue; |
| 2378 | } |
| 2379 |
no test coverage detected