On Sun, 9 Mar 2014 08:14:24 +0100, Vittorio Giovara <[email protected]> wrote: > From: Carl Eugen Hoyos <[email protected]> > > Based on work by ami_stuff. > > Signed-off-by: Vittorio Giovara <[email protected]> > --- > libavcodec/raw.c | 1 + > libavcodec/rawdec.c | 10 ++++++++++ > libavformat/riff.c | 1 + > 3 files changed, 12 insertions(+) > > diff --git a/libavcodec/raw.c b/libavcodec/raw.c > index 4ccc6cc..28943ae 100644 > --- a/libavcodec/raw.c > +++ b/libavcodec/raw.c > @@ -163,6 +163,7 @@ const PixelFormatTag ff_raw_pix_fmt_tags[] = { > /* special */ > { AV_PIX_FMT_RGB565LE,MKTAG( 3 , 0 , 0 , 0 ) }, /* flipped RGB565LE */ > { AV_PIX_FMT_YUV444P, MKTAG('Y', 'V', '2', '4') }, /* YUV444P, swapped > UV */ > + { AV_PIX_FMT_YUYV422, MKTAG('Y', 'V', 'Y', 'U') }, /* YUYV, swapped UV */ > > { AV_PIX_FMT_NONE, 0 }, > }; > diff --git a/libavcodec/rawdec.c b/libavcodec/rawdec.c > index a8227c7..9ff03f7 100644 > --- a/libavcodec/rawdec.c > +++ b/libavcodec/rawdec.c > @@ -240,6 +240,16 @@ static int raw_decode(AVCodecContext *avctx, void *data, > int *got_frame, > line += picture->linesize[0]; > } > } > + if (avctx->codec_tag == AV_RL32("YVYU") && > + avctx->pix_fmt == AV_PIX_FMT_YUYV422) { > + int x, y; > + uint8_t *line = picture->data[0]; > + for (y = 0; y < avctx->height; y++) { > + for (x = 0; x < avctx->width - 1; x += 2) > + FFSWAP(uint8_t, line[2 * x + 1], line[2 * x + 3]); > + line += picture->linesize[0]; > + } > + } >
This should be a separate pixel format IMO, to be consistent with how NV12/NV21 or RGB/BGR are handled -- Anton Khirnov _______________________________________________ libav-devel mailing list [email protected] https://lists.libav.org/mailman/listinfo/libav-devel
