[FFmpeg-devel] [PATCH]Swap U&V for Metasoft MJPEG codec

Michael Niedermayer michaelni
Mon Jan 25 13:14:10 CET 2010


On Mon, Jan 25, 2010 at 11:59:15AM +0100, Carl Eugen Hoyos wrote:
> On Monday 25 January 2010 11:37:54 Michael Niedermayer wrote:
> > On Fri, Jan 22, 2010 at 12:02:48PM +0100, Carl Eugen Hoyos wrote:
> > > Hi!
> > >
> > > Attached patch fixes issue 1611.
> > >
> > > Please comment, Carl Eugen
> > >
> > >  mjpegdec.c |    2 ++
> > >  1 file changed, 2 insertions(+)
> > > bd9ad0f927d349b8db30ac535a20cb528f993b2e  patchissue1611.diff
> >
> > your patch looks like it does swap data1/2 from get_buffer() so what the
> > decoder outputs does not match what it got from get_buffer(), this seems
> > problematic
> > adjusting comp_index where it is initialized seems better if this is
> > possible
> 
> New patch attached.
> 
> Carl Eugen

>  mjpegdec.c |    2 ++
>  1 file changed, 2 insertions(+)
> 635b0c141511fb4d6c6ab980cfe90cf86a45d25b  patchissue1611.diff
> Index: libavcodec/mjpegdec.c
> ===================================================================
> --- libavcodec/mjpegdec.c	(revision 21431)
> +++ libavcodec/mjpegdec.c	(working copy)
> @@ -932,6 +932,8 @@
>          if (!s->vlcs[0][s->dc_index[i]].table || !s->vlcs[1][s->ac_index[i]].table)
>              goto out_of_range;
>      }
> +    if (s->avctx->codec_tag == MKTAG('M', 'T', 'S', 'J'))
> +        FFSWAP(int, s->comp_index[1], s->comp_index[2]);

this could cause mismatches as the other variables arent swaped
also nb_components would have to be checked to be at least 3.

Iam not sure where the best place is to do the swap but i think
a little farther up might be easier.

+if (s->avctx->codec_tag == MKTAG('M', 'T', 'S', 'J') && nb_components==3 && s->nb_components==3 && i)
+    index=i;
 s->comp_index[i] = index;
or so
but i could be missing more issues ...


[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

It is dangerous to be right in matters on which the established authorities
are wrong. -- Voltaire
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100125/cc562f9a/attachment.pgp>



More information about the ffmpeg-devel mailing list