[FFmpeg-devel] [PATCH] MOV YUV2 fourcc -> PIX_FMT_YUYV422 mapping

Jai Menon jmenon86
Mon Mar 30 07:42:10 CEST 2009


On 3/26/09, Reimar D?ffinger <Reimar.Doeffinger at gmx.de> wrote:
> On Thu, Mar 26, 2009 at 02:22:03PM +0530, Jai Menon wrote:
>  > On 3/26/09, Michael Niedermayer <michaelni at gmx.at> wrote:
>  > > On Wed, Mar 25, 2009 at 08:47:33AM -0700, Baptiste Coudurier wrote:
>  > >  > On 3/25/2009 8:35 AM, Reimar D?ffinger wrote:
>  > >  > > On Wed, Mar 25, 2009 at 03:01:50PM +0100, Michael Niedermayer wrote:
>  > >  > >> On Wed, Mar 25, 2009 at 09:48:51AM +0530, Jai Menon wrote:
>  > >  > >>> Index: libavcodec/rawdec.c
>  > >  > >>> ===================================================================
>  > >  > >>> --- libavcodec/rawdec.c   (revision 17944)
>  > >  > >>> +++ libavcodec/rawdec.c   (working copy)
>  > >  > >>> @@ -144,6 +144,13 @@
>  > >  > >>>          picture->data[2] = tmp;
>  > >  > >>>      }
>  > >  > >>>
>  > >  > >>> +    if(avctx->codec_tag == MKTAG('y', 'u', 'v', '2')) {
>  > >  > >>> +        int i;
>  > >  > >>> +        for(i=1; i<picture->linesize[0]*avctx->height; i+=2) {
>  > >  > >>> +            picture->data[0][i] ^= 128;
>  > >  > >>> +        }
>  > >  > >>> +    }
>
>
> I think you should avoid writing to the padding pixels, particularly
>  since this would not work for negative linesize i.e. something
>  like
>  uint8_t *line = picture->data[0];
>  for (y = 0; y < avctx->height; y++) {
>     for (x = 0; x < avctx->width; x++)
>         line[2*x + 1] ^= 0x80; // convert signed to unsigned
>     line += picture->linesize[0];
>
> }
>

Changed. I didn't realize linesize could be negative.

>  > Are you suggesting adding a similar if case in raw_encode which sets
>  > the sign bit? such a patch will be quite intrusive, especially for a
>  > pixel fmt which most people won't use :)
>
>
> Huh? Wouldn't you just need to add exactly the same code between
>  avpicture_layout and the return?

Nevermind, I was looking at adding it in imgconvert code :)
Revised patch attached.

-- 
Regards,

Jai
-------------- next part --------------
A non-text attachment was scrubbed...
Name: yuv2_mov_fourcc.patch
Type: text/x-patch
Size: 2720 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090330/a66810e9/attachment.bin>



More information about the ffmpeg-devel mailing list