Message ID | 20230420165500.49516-2-leo.izen@gmail.com |
---|---|
State | Accepted |
Commit | 869248c053856e654002f0650b02d22648b563ba |
Headers | show |
Series | RGB mjpeg fixes | expand |
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 |
On Thu, Apr 20, 2023 at 12:54:59PM -0400, Leo Izen wrote: > 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(-) LGTM and thanks! [...]
On 4/20/23 19:53, Michael Niedermayer wrote: > On Thu, Apr 20, 2023 at 12:54:59PM -0400, Leo Izen wrote: >> 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(-) > > LGTM and thanks! > > Thanks, applied - Leo Izen (Traneptora / thebombzen)
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]);