| 5387 | } |
| 5388 | |
| 5389 | static avifBool avifTilesCanBeDecodedWithSameCodecInstance(const avifDecoderData * data) |
| 5390 | { |
| 5391 | int32_t numImageBuffers = 0, numStolenImageBuffers = 0; |
| 5392 | for (int c = 0; c < AVIF_ITEM_CATEGORY_COUNT; ++c) { |
| 5393 | if (data->tileInfos[c].tileCount > 0) { |
| 5394 | ++numImageBuffers; |
| 5395 | } |
| 5396 | // The sample operations require multiple buffers for compositing so no plane is stolen |
| 5397 | // when there is a 'sato' Sample Transform derived image item. |
| 5398 | if (c >= AVIF_SAMPLE_TRANSFORM_MIN_CATEGORY && c <= AVIF_SAMPLE_TRANSFORM_MAX_CATEGORY && data->tileInfos[c].tileCount > 0) { |
| 5399 | continue; |
| 5400 | } |
| 5401 | if (data->tileInfos[c].tileCount == 1) { |
| 5402 | ++numStolenImageBuffers; |
| 5403 | } |
| 5404 | } |
| 5405 | if (numStolenImageBuffers > 0 && numImageBuffers > 1) { |
| 5406 | // Single tile image with single tile alpha plane or gain map. In this case each tile needs its own decoder since the planes will be |
| 5407 | // "stolen". Stealing either the color or the alpha plane (or gain map) will invalidate the other ones when decode is called the second |
| 5408 | // (or third) time. |
| 5409 | return AVIF_FALSE; |
| 5410 | } |
| 5411 | const uint8_t firstTileOperatingPoint = data->tiles.tile[0].operatingPoint; |
| 5412 | const avifBool firstTileAllLayers = data->tiles.tile[0].input->allLayers; |
| 5413 | for (unsigned int i = 1; i < data->tiles.count; ++i) { |
| 5414 | const avifTile * tile = &data->tiles.tile[i]; |
| 5415 | if (tile->operatingPoint != firstTileOperatingPoint || tile->input->allLayers != firstTileAllLayers) { |
| 5416 | return AVIF_FALSE; |
| 5417 | } |
| 5418 | // avifDecoderItemValidateProperties() verified during avifDecoderParse() that all tiles |
| 5419 | // share the same coding format so no need to check for codecType equality here. |
| 5420 | } |
| 5421 | return AVIF_TRUE; |
| 5422 | } |
| 5423 | |
| 5424 | static avifResult avifDecoderCreateCodecs(avifDecoder * decoder) |
| 5425 | { |
no outgoing calls
no test coverage detected