[FFmpeg-cvslog] Support decoding fourcc YVYU.

Carl Eugen Hoyos git at videolan.org
Sun May 27 01:14:20 CEST 2012


ffmpeg | branch: master | Carl Eugen Hoyos <cehoyos at ag.or.at> | Sun May 27 01:13:37 2012 +0200| [ab7d6cb8f770c3b88a8139d1182fcc934062f891] | committer: Carl Eugen Hoyos

Support decoding fourcc YVYU.

Based on work by ami_stuff.

Fixes ticket #1352

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ab7d6cb8f770c3b88a8139d1182fcc934062f891
---

 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 c084d14..6afbd02 100644
--- a/libavcodec/raw.c
+++ b/libavcodec/raw.c
@@ -157,6 +157,7 @@ const PixelFormatTag ff_raw_pix_fmt_tags[] = {
     /* special */
     { PIX_FMT_RGB565LE,MKTAG( 3 ,  0 ,  0 ,  0 ) }, /* flipped RGB565LE */
     { PIX_FMT_YUV444P, MKTAG('Y', 'V', '2', '4') }, /* YUV444P, swapped UV */
+    { PIX_FMT_YUYV422, MKTAG('Y', 'V', 'Y', 'U') }, /* YUYV, swapped UV */
 
     { PIX_FMT_NONE, 0 },
 };
diff --git a/libavcodec/rawdec.c b/libavcodec/rawdec.c
index 8d2390e..dd4355f 100644
--- a/libavcodec/rawdec.c
+++ b/libavcodec/rawdec.c
@@ -235,6 +235,16 @@ static int raw_decode(AVCodecContext *avctx,
             line += picture->linesize[0];
         }
     }
+    if(avctx->codec_tag == AV_RL32("YVYU") &&
+       avctx->pix_fmt   == 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];
+        }
+    }
 
     *data_size = sizeof(AVPicture);
     return buf_size;
diff --git a/libavformat/riff.c b/libavformat/riff.c
index fb3e8ac..add8440 100644
--- a/libavformat/riff.c
+++ b/libavformat/riff.c
@@ -199,6 +199,7 @@ const AVCodecTag ff_codec_bmp_tags[] = {
     { CODEC_ID_RAWVIDEO,     MKTAG('Y', 'U', 'V', '9') },
     { CODEC_ID_RAWVIDEO,     MKTAG('Y', 'V', 'U', '9') },
     { CODEC_ID_RAWVIDEO,     MKTAG('a', 'u', 'v', '2') },
+    { CODEC_ID_RAWVIDEO,     MKTAG('Y', 'V', 'Y', 'U') },
     { CODEC_ID_FRWU,         MKTAG('F', 'R', 'W', 'U') },
     { CODEC_ID_R10K,         MKTAG('R', '1', '0', 'k') },
     { CODEC_ID_R210,         MKTAG('r', '2', '1', '0') },



More information about the ffmpeg-cvslog mailing list