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

Function avifDecoderGenerateImageGridTiles

src/read.c:1696–1730  ·  view source on GitHub ↗

Creates the tiles and associate them to the items in the order of the 'dimg' association.

Source from the content-addressed store, hash-verified

1694
1695// Creates the tiles and associate them to the items in the order of the 'dimg' association.
1696static avifResult avifDecoderGenerateImageGridTiles(avifDecoder * decoder,
1697 avifDecoderItem * gridItem,
1698 avifItemCategory itemCategory,
1699 const uint32_t * dimgIdxToItemIdx,
1700 uint32_t numTiles)
1701{
1702 avifBool progressive = AVIF_TRUE;
1703 for (uint32_t dimgIdx = 0; dimgIdx < numTiles; ++dimgIdx) {
1704 const uint32_t itemIdx = dimgIdxToItemIdx[dimgIdx];
1705 AVIF_ASSERT_OR_RETURN(itemIdx < gridItem->meta->items.count);
1706 avifDecoderItem * item = gridItem->meta->items.item[itemIdx];
1707
1708 const avifCodecType tileCodecType = avifGetCodecType(item->type);
1709 AVIF_CHECKERR(tileCodecType != AVIF_CODEC_TYPE_UNKNOWN, AVIF_RESULT_INVALID_IMAGE_GRID);
1710 const avifTile * tile =
1711 avifDecoderDataCreateTile(decoder->data, tileCodecType, item->width, item->height, avifDecoderItemOperatingPoint(item));
1712 AVIF_CHECKERR(tile != NULL, AVIF_RESULT_OUT_OF_MEMORY);
1713 AVIF_CHECKRES(avifCodecDecodeInputFillFromDecoderItem(tile->input,
1714 item,
1715 decoder->allowProgressive,
1716 decoder->imageCountLimit,
1717 decoder->io->sizeHint,
1718 &decoder->diag));
1719 tile->input->itemCategory = itemCategory;
1720
1721 if (!item->progressive) {
1722 progressive = AVIF_FALSE;
1723 }
1724 }
1725 if (itemCategory == AVIF_ITEM_COLOR && progressive) {
1726 // If all the items that make up the grid are progressive, then propagate that status to the top-level grid item.
1727 gridItem->progressive = AVIF_TRUE;
1728 }
1729 return AVIF_RESULT_OK;
1730}
1731
1732// Allocates the dstImage. Also verifies some spec compliance rules for grids, if relevant.
1733static avifResult avifDecoderDataAllocateImagePlanes(const avifDecoderData * data, const avifTileInfo * info, avifImage * dstImage, avifBool * cicpSet)

Callers 1

Tested by

no test coverage detected