Hi! Attached patch fixes decoding of a sample mentioned in ticket #8930.
Please comment, Carl Eugen
From 40fd2f1655839f721ef988d1369c45e00fa9c40b Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos <ceffm...@gmail.com> Date: Sun, 28 Mar 2021 00:27:23 +0100 Subject: [PATCH] lavc/mjpegdec: Support pixel format 0x11412100. Fixes decoding of Nene421-rgb.jpg --- libavcodec/mjpegdec.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c index 5583d2aa35..3731b2fa1b 100644 --- a/libavcodec/mjpegdec.c +++ b/libavcodec/mjpegdec.c @@ -603,6 +603,19 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s) s->avctx->color_range = s->cs_itu601 ? AVCOL_RANGE_MPEG : AVCOL_RANGE_JPEG; } break; + case 0x11412100: + if (s->bits > 8) + goto unk_pixfmt; + if (s->component_id[0] == 'R' - 1 && s->component_id[1] == 'G' - 1 && s->component_id[2] == 'B' - 1) { + s->avctx->pix_fmt = AV_PIX_FMT_GBRP; + s->upscale_h[0] = 0; + s->upscale_h[1] = 1; + s->upscale_h[2] = 4; + } else { + goto unk_pixfmt; + } + s->avctx->color_range = s->cs_itu601 ? AVCOL_RANGE_MPEG : AVCOL_RANGE_JPEG; + break; case 0x21111100: if (s->component_id[0] == 'Q' && s->component_id[1] == 'F' && s->component_id[2] == 'A') { if (s->bits <= 8) s->avctx->pix_fmt = AV_PIX_FMT_GBRP; @@ -2696,6 +2709,12 @@ the_end: for (index = w - 3; index > 0; index--) { line[index] = (line[index / 3] + line[(index + 1) / 3] + line[(index + 2) / 3] + 1) / 3; } + } else if (s->upscale_h[p] == 4 && w >= 4 && !is16bit){ + line [w - 1] = line [w - 1 >> 2]; + line [w - 2] = line [w - 1 >> 2] * 3 + line [w - 2 >> 2] >> 2; + line [w - 3] = line [w - 1 >> 2] + line [w - 2 >> 2] >> 1; + for (index = w - 4; index > 0; index--) + line[index] = (line[index + 3 >> 2] + line[index + 2 >> 2] + line[index + 1 >> 2] + line[index >> 2]) >> 2; } line += s->linesize[p]; } -- 2.30.1
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".