Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/codec_aom.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,11 @@ static avifBool aomCodecGetNextImage(struct avifCodec * codec,
assert(sample);

aom_codec_iface_t * const decoderInterface = aom_codec_av1_dx();
#if !defined(AOM_CTRL_AOMD_SET_FRAME_SIZE_LIMIT)
// The AOMD_SET_FRAME_SIZE_LIMIT codec control (added in libaom v3.14.0),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leftover comma

// is the best way to impose a maximum on AV1 frame size. When
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"best" is vague. Is there a more accurate adjective?

// AOMD_SET_FRAME_SIZE_LIMIT is not available, approximate it with
// aom_codec_peek_stream_info() and avifDimensionsTooLarge().
struct aom_codec_stream_info streamInfo = { 0 };
aom_codec_err_t err = aom_codec_peek_stream_info(decoderInterface, sample->data.data, sample->data.size, &streamInfo);
if (err != AOM_CODEC_OK) {
Expand All @@ -119,6 +124,7 @@ static avifBool aomCodecGetNextImage(struct avifCodec * codec,
return AVIF_FALSE;
}
}
#endif // !defined(AOM_CTRL_AOMD_SET_FRAME_SIZE_LIMIT)

if (!codec->internal->decoderInitialized) {
aom_codec_dec_cfg_t cfg;
Expand All @@ -131,6 +137,11 @@ static avifBool aomCodecGetNextImage(struct avifCodec * codec,
}
codec->internal->decoderInitialized = AVIF_TRUE;

#if defined(AOM_CTRL_AOMD_SET_FRAME_SIZE_LIMIT)
if (codec->imageSizeLimit != 0 && aom_codec_control(&codec->internal->decoder, AOMD_SET_FRAME_SIZE_LIMIT, codec->imageSizeLimit)) {
Comment thread
wantehchang marked this conversation as resolved.
return AVIF_FALSE;
}
#endif // defined(AOM_CTRL_AOMD_SET_FRAME_SIZE_LIMIT)
if (aom_codec_control(&codec->internal->decoder, AV1D_SET_OUTPUT_ALL_LAYERS, codec->allLayers)) {
return AVIF_FALSE;
}
Expand Down
Loading