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

Function avifDecoderGenerateImageTiles

src/read.c:6018–6050  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6016}
6017
6018static avifResult avifDecoderGenerateImageTiles(avifDecoder * decoder, avifTileInfo * info, avifDecoderItem * item, avifItemCategory itemCategory)
6019{
6020 const uint32_t previousTileCount = decoder->data->tiles.count;
6021 if ((info->grid.rows > 0) && (info->grid.columns > 0)) {
6022 // The number of tiles was verified in avifDecoderItemReadAndParse().
6023 const uint32_t numTiles = info->grid.rows * info->grid.columns;
6024 uint32_t * dimgIdxToItemIdx = (uint32_t *)avifAlloc(numTiles * sizeof(uint32_t));
6025 AVIF_CHECKERR(dimgIdxToItemIdx != NULL, AVIF_RESULT_OUT_OF_MEMORY);
6026 avifResult result = avifFillDimgIdxToItemIdxArray(dimgIdxToItemIdx, numTiles, item);
6027 if (result == AVIF_RESULT_OK) {
6028 result = avifDecoderGenerateImageGridTiles(decoder, item, itemCategory, dimgIdxToItemIdx, numTiles);
6029 }
6030 avifFree(dimgIdxToItemIdx);
6031 AVIF_CHECKRES(result);
6032 } else {
6033 AVIF_CHECKERR(item->size != 0, AVIF_RESULT_MISSING_IMAGE_ITEM);
6034
6035 const avifCodecType codecType = avifGetCodecType(item->type);
6036 AVIF_ASSERT_OR_RETURN(codecType != AVIF_CODEC_TYPE_UNKNOWN);
6037 avifTile * tile =
6038 avifDecoderDataCreateTile(decoder->data, codecType, item->width, item->height, avifDecoderItemOperatingPoint(item));
6039 AVIF_CHECKERR(tile, AVIF_RESULT_OUT_OF_MEMORY);
6040 AVIF_CHECKRES(avifCodecDecodeInputFillFromDecoderItem(tile->input,
6041 item,
6042 decoder->allowProgressive,
6043 decoder->imageCountLimit,
6044 decoder->io->sizeHint,
6045 &decoder->diag));
6046 tile->input->itemCategory = itemCategory;
6047 }
6048 info->tileCount = decoder->data->tiles.count - previousTileCount;
6049 return AVIF_RESULT_OK;
6050}
6051
6052// Populates depth, yuvFormat and yuvChromaSamplePosition fields on 'image' based on data from the codec config property (e.g. "av1C").
6053static avifResult avifReadCodecConfigProperty(avifImage * image, const avifPropertyArray * properties, avifCodecType codecType)

Callers 1

avifDecoderResetFunction · 0.85

Calls 8

avifAllocFunction · 0.85
avifFreeFunction · 0.85
avifGetCodecTypeFunction · 0.85

Tested by

no test coverage detected