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

Function avifCodecCreateInternal

src/read.c:5358–5387  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5356}
5357
5358static avifResult avifCodecCreateInternal(avifCodecChoice choice, const avifTile * tile, avifDiagnostics * diag, avifCodec ** codec)
5359{
5360#if defined(AVIF_CODEC_AVM)
5361 // AVIF_CODEC_CHOICE_AUTO leads to AVIF_CODEC_TYPE_AV1 by default. Reroute correctly.
5362 if (choice == AVIF_CODEC_CHOICE_AUTO && tile->codecType == AVIF_CODEC_TYPE_AV2) {
5363 choice = AVIF_CODEC_CHOICE_AVM;
5364 }
5365#endif
5366
5367 const avifCodecType codecTypeFromChoice = avifCodecTypeFromChoice(choice, AVIF_CODEC_FLAG_CAN_DECODE);
5368 if (codecTypeFromChoice == AVIF_CODEC_TYPE_UNKNOWN) {
5369 avifDiagnosticsPrintf(diag,
5370 "Tile type is %s but there is no compatible codec available to decode it",
5371 avifGetConfigurationPropertyName(tile->codecType));
5372 return AVIF_RESULT_NO_CODEC_AVAILABLE;
5373 } else if (choice != AVIF_CODEC_CHOICE_AUTO && codecTypeFromChoice != tile->codecType) {
5374 avifDiagnosticsPrintf(diag,
5375 "Tile type is %s but incompatible %s codec was explicitly set as decoding implementation",
5376 avifGetConfigurationPropertyName(tile->codecType),
5377 avifCodecName(choice, AVIF_CODEC_FLAG_CAN_DECODE));
5378 return AVIF_RESULT_DECODE_COLOR_FAILED;
5379 }
5380
5381 AVIF_CHECKRES(avifCodecCreate(choice, AVIF_CODEC_FLAG_CAN_DECODE, codec));
5382 AVIF_CHECKERR(*codec, AVIF_RESULT_OUT_OF_MEMORY);
5383 (*codec)->diag = diag;
5384 (*codec)->operatingPoint = tile->operatingPoint;
5385 (*codec)->allLayers = tile->input->allLayers;
5386 return AVIF_RESULT_OK;
5387}
5388
5389static avifBool avifTilesCanBeDecodedWithSameCodecInstance(const avifDecoderData * data)
5390{

Callers 1

avifDecoderCreateCodecsFunction · 0.85

Calls 5

avifCodecTypeFromChoiceFunction · 0.85
avifDiagnosticsPrintfFunction · 0.85
avifCodecNameFunction · 0.85
avifCodecCreateFunction · 0.85

Tested by

no test coverage detected