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

Function avifReadCodecConfigProperty

src/read.c:6053–6075  ·  view source on GitHub ↗

Populates depth, yuvFormat and yuvChromaSamplePosition fields on 'image' based on data from the codec config property (e.g. "av1C").

Source from the content-addressed store, hash-verified

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)
6054{
6055 const avifProperty * configProp = avifPropertyArrayFind(properties, avifGetConfigurationPropertyName(codecType));
6056 if (configProp) {
6057 image->depth = avifCodecConfigurationBoxGetDepth(&configProp->u.av1C);
6058 if (configProp->u.av1C.monochrome) {
6059 image->yuvFormat = AVIF_PIXEL_FORMAT_YUV400;
6060 } else {
6061 if (configProp->u.av1C.chromaSubsamplingX && configProp->u.av1C.chromaSubsamplingY) {
6062 image->yuvFormat = AVIF_PIXEL_FORMAT_YUV420;
6063 } else if (configProp->u.av1C.chromaSubsamplingX) {
6064 image->yuvFormat = AVIF_PIXEL_FORMAT_YUV422;
6065 } else {
6066 image->yuvFormat = AVIF_PIXEL_FORMAT_YUV444;
6067 }
6068 }
6069 image->yuvChromaSamplePosition = (avifChromaSamplePosition)configProp->u.av1C.chromaSamplePosition;
6070 } else {
6071 // A configuration property box is mandatory in all valid AVIF configurations. Bail out.
6072 return AVIF_RESULT_BMFF_PARSE_FAILED;
6073 }
6074 return AVIF_RESULT_OK;
6075}
6076
6077avifResult avifDecoderReset(avifDecoder * decoder)
6078{

Callers 1

avifDecoderResetFunction · 0.85

Tested by

no test coverage detected