MCPcopy Create free account
hub / github.com/AOMediaCodec/libavif / avifDecoderAdoptGridTileCodecTypeIfNeeded

Function avifDecoderAdoptGridTileCodecTypeIfNeeded

src/read.c:1678–1693  ·  view source on GitHub ↗

If the item is a grid, copies the codec type property (av1C or av2C) from the first grid tile to the grid item. Also checks that all tiles have the same codec type and that it's valid.

Source from the content-addressed store, hash-verified

1676// If the item is a grid, copies the codec type property (av1C or av2C) from the first grid tile to the grid item.
1677// Also checks that all tiles have the same codec type and that it's valid.
1678static avifResult avifDecoderAdoptGridTileCodecTypeIfNeeded(avifDecoder * decoder, avifDecoderItem * item, const avifTileInfo * info)
1679{
1680 if ((info->grid.rows > 0) && (info->grid.columns > 0)) {
1681 // The number of tiles was verified in avifDecoderItemReadAndParse().
1682 const uint32_t numTiles = info->grid.rows * info->grid.columns;
1683 uint32_t * dimgIdxToItemIdx = (uint32_t *)avifAlloc(numTiles * sizeof(uint32_t));
1684 AVIF_CHECKERR(dimgIdxToItemIdx != NULL, AVIF_RESULT_OUT_OF_MEMORY);
1685 avifResult result = avifFillDimgIdxToItemIdxArray(dimgIdxToItemIdx, numTiles, item);
1686 if (result == AVIF_RESULT_OK) {
1687 result = avifDecoderAdoptGridTileCodecType(decoder, item, dimgIdxToItemIdx, numTiles);
1688 }
1689 avifFree(dimgIdxToItemIdx);
1690 AVIF_CHECKRES(result);
1691 }
1692 return AVIF_RESULT_OK;
1693}
1694
1695// Creates the tiles and associate them to the items in the order of the 'dimg' association.
1696static avifResult avifDecoderGenerateImageGridTiles(avifDecoder * decoder,

Callers 1

avifDecoderResetFunction · 0.85

Calls 4

avifAllocFunction · 0.85
avifFreeFunction · 0.85

Tested by

no test coverage detected