avcodec/mjpegdec: Restrict AVID MJPEG to non-SMVJPEG

AVID content is not supposed to be SMVJPEG; given that
both these codecs involve manipulating image dimensions
and cropping dimensions, it makes sense to restrict
the AVID codepaths to non-SMVJPEG codecs in order not
to have to think about what if SMVJPEG happens to
have a codec tag indicating AVID.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
Andreas Rheinhardt 2022-12-07 14:49:39 +01:00
parent 442bbdb3c5
commit 9cdecba3bd
1 changed files with 4 additions and 2 deletions

View File

@ -452,7 +452,8 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
if (ret < 0)
return ret;
if ((s->avctx->codec_tag == MKTAG('A', 'V', 'R', 'n') ||
if (s->avctx->codec_id != AV_CODEC_ID_SMVJPEG &&
(s->avctx->codec_tag == MKTAG('A', 'V', 'R', 'n') ||
s->avctx->codec_tag == MKTAG('A', 'V', 'D', 'J')) &&
s->orig_height < height)
s->avctx->height = AV_CEIL_RSHIFT(s->orig_height, s->avctx->lowres);
@ -2927,7 +2928,8 @@ the_end:
return ret;
}
}
if ((avctx->codec_tag == MKTAG('A', 'V', 'R', 'n') ||
if (avctx->codec_id != AV_CODEC_ID_SMVJPEG &&
(avctx->codec_tag == MKTAG('A', 'V', 'R', 'n') ||
avctx->codec_tag == MKTAG('A', 'V', 'D', 'J')) &&
avctx->coded_height > s->orig_height) {
frame->height = AV_CEIL_RSHIFT(avctx->coded_height, avctx->lowres);