From: Leo Izen <leo.izen@gmail.com> To: ffmpeg-devel@ffmpeg.org Subject: Re: [FFmpeg-devel] [FFmpeg-cvslog] avcodec/mjpegdec: support weird RGB subsampling with progressive Date: Wed, 12 Apr 2023 12:13:39 -0400 Message-ID: <c972d7ee-2af3-9814-4860-9823b19f9396@gmail.com> (raw) In-Reply-To: <20230412153539.GA275136@pb2> On 4/12/23 11:35, Michael Niedermayer wrote: > Hi > > On Mon, Apr 10, 2023 at 08:56:19AM +0000, Leo Izen wrote: >> ffmpeg | branch: master | Leo Izen <leo.izen@gmail.com> | Thu Mar 16 15:32:14 2023 -0400| [b18a9c29713abc3a1b081de3f320ab53a47120c6] | committer: Leo Izen >> >> avcodec/mjpegdec: support weird RGB subsampling with progressive >> >> This allows weird subsampling with progressive JPEGs to be decoded, >> such as full-RG and only B subsampled. > > This breaks multiple jpeg files > > tickets/4045/1x2.jpg > tickets/4045/2x1.jpg > > [...] > I believe this should fix it. Should these two jpegs be added as FATE tests to prevent an issue like this in the future? 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]); _______________________________________________ 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".
prev parent reply other threads:[~2023-04-12 16:13 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top [not found] <20230410085620.577A841038A@natalya.videolan.org> 2023-04-12 15:35 ` Michael Niedermayer 2023-04-12 16:13 ` Leo Izen [this message]
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=c972d7ee-2af3-9814-4860-9823b19f9396@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