[FFmpeg-cvslog] avcodec/mjpegdec: fix regression with baseline RGB JPEGs
Leo Izen
git at videolan.org
Mon Apr 17 17:46:00 EEST 2023
ffmpeg | branch: master | Leo Izen <leo.izen at gmail.com> | Thu Apr 13 08:45:06 2023 -0400| [c3625ccfcd74bacff2ec6764dea8ef2beb5e9ef7] | committer: Leo Izen
avcodec/mjpegdec: fix regression with baseline RGB JPEGs
Commit b18a9c29713abc3a1b081de3f320ab53a47120c6 introduced a regression
that broke some baseline RGB jpegs. (See Trac issue #4045). This fixes
that.
Signed-off-by: Leo Izen <leo.izen at gmail.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c3625ccfcd74bacff2ec6764dea8ef2beb5e9ef7
---
libavcodec/mjpegdec.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
index 3fc18aac73..01537d4774 100644
--- a/libavcodec/mjpegdec.c
+++ b/libavcodec/mjpegdec.c
@@ -1698,6 +1698,9 @@ 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);
@@ -2721,7 +2724,7 @@ the_end:
}
}
- if (s->avctx->pix_fmt == AV_PIX_FMT_GBRP) {
+ if (s->avctx->pix_fmt == AV_PIX_FMT_GBRP && s->progressive) {
av_assert0(s->nb_components == 3);
FFSWAP(uint8_t *, frame->data[0], frame->data[2]);
FFSWAP(uint8_t *, frame->data[0], frame->data[1]);
More information about the ffmpeg-cvslog
mailing list