From: Wang Chuan <ouchuanm@outlook.com> To: ffmpeg-devel@ffmpeg.org Subject: [FFmpeg-devel] [PATCH] avcodec/mjpegdec: add support for decoding jpeg rgb file with subsampling Date: Sun, 26 Mar 2023 10:13:43 +0800 Message-ID: <ME3PR01MB56246FF97C049257887E5368DA8A9@ME3PR01MB5624.ausprd01.prod.outlook.com> (raw) Fixes ticket #10190 Signed-off-by: Wang Chuan <ouchuanm@outlook.com> --- libavcodec/mjpegdec.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c index c833d66c4d..aa58f336d4 100644 --- a/libavcodec/mjpegdec.c +++ b/libavcodec/mjpegdec.c @@ -574,6 +574,27 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s) if (s->bits <= 8) s->avctx->pix_fmt = s->cs_itu601 ? AV_PIX_FMT_YUV444P : AV_PIX_FMT_YUVJ444P; else goto unk_pixfmt; + if (s->component_id[0] == 'R' && s->component_id[1] == 'G' && s->component_id[2] == 'B') { + if (s->bits <= 8) + s->avctx->pix_fmt = AV_PIX_FMT_GBRP; + else + goto unk_pixfmt; + if (pix_fmt_id == 0x22221100) { + s->upscale_h[0] = s->upscale_v[0] = 0; + s->upscale_h[1] = s->upscale_v[1] = 1; + s->upscale_h[2] = s->upscale_v[2] = 0; + } else if (pix_fmt_id == 0x22112200) { + s->upscale_h[0] = s->upscale_v[0] = 1; + s->upscale_h[1] = s->upscale_v[1] = 0; + s->upscale_h[2] = s->upscale_v[2] = 0; + } else if (pix_fmt_id == 0x11222200) { + s->upscale_h[0] = s->upscale_v[0] = 0; + s->upscale_h[1] = s->upscale_v[1] = 0; + s->upscale_h[2] = s->upscale_v[2] = 1; + } else { + goto unk_pixfmt; + } + } s->avctx->color_range = s->cs_itu601 ? AVCOL_RANGE_MPEG : AVCOL_RANGE_JPEG; break; case 0x11000000: -- 2.37.1 (Apple Git-137.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-request@ffmpeg.org with subject "unsubscribe".
next reply other threads:[~2023-03-26 2:14 UTC|newest] Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-03-26 2:13 Wang Chuan [this message] 2023-03-26 11:28 ` Leo Izen 2023-03-27 6:06 ` Wang Chuan
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=ME3PR01MB56246FF97C049257887E5368DA8A9@ME3PR01MB5624.ausprd01.prod.outlook.com \ --to=ouchuanm@outlook.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