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

Jai Menon jmenon86
Wed Apr 1 06:53:52 CEST 2009


On 3/31/09, Michael Niedermayer <michaelni at gmx.at> wrote:
> On Tue, Mar 31, 2009 at 10:10:28AM +0530, Jai Menon wrote:
>  > On Mon, Mar 30, 2009 at 11:01 PM, Michael Niedermayer <michaelni at gmx.at> wrote:
>
> [...]
>  > revised patch attached.
>  > --
>  > Regards,
>  >
>  > Jai
>
>
> > Index: libavcodec/rawenc.c
>  > ===================================================================
>  > --- libavcodec/rawenc.c       (revision 17944)
>  > +++ libavcodec/rawenc.c       (working copy)
>
> > @@ -40,8 +40,20 @@
>
> >  static int raw_encode(AVCodecContext *avctx,
>  >                              unsigned char *frame, int buf_size, void *data)
>  >  {
>  > -    return avpicture_layout((AVPicture *)data, avctx->pix_fmt, avctx->width,
>  > +    int ret = avpicture_layout((AVPicture *)data, avctx->pix_fmt, avctx->width,
>  >                                                 avctx->height, frame, buf_size);
>  > +
>
>
> > +    if(avctx->codec_tag == MKTAG('y', 'u', 'v', '2') && (ret > 0) &&
>  > +       (avctx->pix_fmt == PIX_FMT_YUYV422)) {
>
>  superflous ()
>  AV_RL32("yuv2")

removed ()s and using AV_RL32 now. requires #including intreadwrite.h
though. for future reference, is this the way to go from now on for
fourccs/tags etc?

>  > +        int x, y;
>  > +        uint8_t *line = frame;
>
> > +        for(y = 0; y < avctx->height; y++) {
>
> > +            for(x = 0; x < avctx->width; x++)
>  > +                line[2*x + 1] ^= 0x80;
>
> > +            line += avctx->width;
>  > +        }
>  > +    }
>  > +    return ret;
>  >  }
>  >
>  >  AVCodec rawvideo_encoder = {
>
>
>  > Index: libavcodec/rawdec.c
>  > ===================================================================
>  > --- libavcodec/rawdec.c       (revision 17944)
>  > +++ libavcodec/rawdec.c       (working copy)
>
> > @@ -144,6 +144,16 @@
>
> >          picture->data[2] = tmp;
>  >      }
>  >
>  > +    if(avctx->codec_tag == MKTAG('y', 'u', 'v', '2')) {
>
>
> this too shoulld check pix_fmt i think

but the yuv2 fourcc is only hooked up to yuyv422 pixfmt. anyway, added
the check.

[...]

revised patch attached.

-- 
Regards,

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



More information about the ffmpeg-devel mailing list