diff mbox series

[FFmpeg-devel,1/5] avcodec/mjpegdec: Restrict AVID MJPEG to non-SMVJPEG

Message ID GV1P250MB0737145A1974D7C94305C3668F1A9@GV1P250MB0737.EURP250.PROD.OUTLOOK.COM
State Accepted
Commit 9cdecba3bdf39c3b3eec8048196328a058108f8a
Headers show
Series [FFmpeg-devel,1/5] avcodec/mjpegdec: Restrict AVID MJPEG to non-SMVJPEG | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Andreas Rheinhardt Dec. 7, 2022, 7 p.m. UTC
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.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/mjpegdec.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Andreas Rheinhardt Dec. 10, 2022, 10:51 a.m. UTC | #1
Andreas Rheinhardt:
> 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.
> 
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
> ---
>  libavcodec/mjpegdec.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
> index 9b7465abe7..28e2839072 100644
> --- a/libavcodec/mjpegdec.c
> +++ b/libavcodec/mjpegdec.c
> @@ -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);

Will apply this patchset tonight unless there are objections.

- Andreas
Paul B Mahol Dec. 10, 2022, 11:02 a.m. UTC | #2
On 12/7/22, Andreas Rheinhardt <andreas.rheinhardt@outlook.com> wrote:
> 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.
>
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
> ---
>  libavcodec/mjpegdec.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
> index 9b7465abe7..28e2839072 100644
> --- a/libavcodec/mjpegdec.c
> +++ b/libavcodec/mjpegdec.c
> @@ -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);
> --
> 2.34.1
>

LGTM

> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
>
diff mbox series

Patch

diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
index 9b7465abe7..28e2839072 100644
--- a/libavcodec/mjpegdec.c
+++ b/libavcodec/mjpegdec.c
@@ -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);