From: Leo Izen <leo.izen@gmail.com>
To: ffmpeg-devel@ffmpeg.org
Cc: Leo Izen <leo.izen@gmail.com>
Subject: [FFmpeg-devel] [PATCH v4 1/2] avcodec/mjpegdec: fix remaining RGB JPEGs
Date: Thu, 20 Apr 2023 12:54:59 -0400
Message-ID: <20230420165500.49516-2-leo.izen@gmail.com> (raw)
In-Reply-To: <20230420165500.49516-1-leo.izen@gmail.com>
The change introduced in b18a9c29713abc3a1b081de3f320ab53a47120c6
created a regression for non-subsampled progressive RGB jpegs. This
should fix that.
Additionally, this should fix other RGB JPEGs broken before the recent
patches, such as those in Trac issue #10190.
---
libavcodec/mjpegdec.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
index c41d4bce5e..9b55002c4b 100644
--- a/libavcodec/mjpegdec.c
+++ b/libavcodec/mjpegdec.c
@@ -604,7 +604,7 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
if (s->bits <= 8) s->avctx->pix_fmt = AV_PIX_FMT_GBRP;
else
goto unk_pixfmt;
- s->upscale_v[0] = s->upscale_v[1] = 1;
+ s->upscale_v[1] = s->upscale_v[2] = 1;
} else {
if (pix_fmt_id == 0x14111100)
s->upscale_v[1] = s->upscale_v[2] = 1;
@@ -619,7 +619,7 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
if (s->bits <= 8) s->avctx->pix_fmt = AV_PIX_FMT_GBRP;
else
goto unk_pixfmt;
- s->upscale_h[0] = s->upscale_h[1] = 1;
+ s->upscale_h[1] = s->upscale_h[2] = 1;
} else {
if (s->bits <= 8) s->avctx->pix_fmt = s->cs_itu601 ? AV_PIX_FMT_YUV422P : AV_PIX_FMT_YUVJ422P;
else s->avctx->pix_fmt = AV_PIX_FMT_YUV422P16;
@@ -1698,9 +1698,6 @@ int ff_mjpeg_decode_sos(MJpegDecodeContext *s, const uint8_t *mb_bitmask,
s->h_scount[i] = s->h_count[index];
s->v_scount[i] = s->v_count[index];
- if(nb_components == 3 && s->nb_components == 3 && s->avctx->pix_fmt == AV_PIX_FMT_GBRP)
- index = (index+2)%3;
-
s->comp_index[i] = index;
s->dc_index[i] = get_bits(&s->gb, 4);
@@ -2724,7 +2721,7 @@ the_end:
}
}
- if (s->avctx->pix_fmt == AV_PIX_FMT_GBRP && s->progressive) {
+ if (s->avctx->pix_fmt == AV_PIX_FMT_GBRP) {
av_assert0(s->nb_components == 3);
FFSWAP(uint8_t *, frame->data[0], frame->data[2]);
FFSWAP(uint8_t *, frame->data[0], frame->data[1]);
--
2.40.0
_______________________________________________
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".
next prev parent reply other threads:[~2023-04-20 16:55 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-20 16:54 [FFmpeg-devel] [PATCH v4 0/2] RGB mjpeg fixes Leo Izen
2023-04-20 16:54 ` Leo Izen [this message]
2023-04-20 23:53 ` [FFmpeg-devel] [PATCH v4 1/2] avcodec/mjpegdec: fix remaining RGB JPEGs Michael Niedermayer
2023-04-21 14:03 ` Leo Izen
2023-04-20 16:55 ` [FFmpeg-devel] [PATCH v4 2/2] fate: add tests for RGB jpegs Leo Izen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230420165500.49516-2-leo.izen@gmail.com \
--to=leo.izen@gmail.com \
--cc=ffmpeg-devel@ffmpeg.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git