[Ffmpeg-devel] [PATCH] YVU9 support

Fabrizio Gennari fabrizio.ge
Sun Mar 5 01:37:28 CET 2006


This patch adds support with AVI files with YVU9 video fourcc. This
format is identical to YUV9, except the order of channels U and V is
swapped

Regards,
Fabrizio

-------------- next part --------------
? yvupatch.txt
Index: libavcodec/avcodec.h
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavcodec/avcodec.h,v
retrieving revision 1.456
diff -u -r1.456 avcodec.h
--- libavcodec/avcodec.h	21 Feb 2006 22:05:13 -0000	1.456
+++ libavcodec/avcodec.h	4 Mar 2006 23:27:57 -0000
@@ -248,6 +248,7 @@
     PIX_FMT_YUV444P,   ///< Planar YUV 4:4:4 (1 Cr & Cb sample per 1x1 Y samples)
     PIX_FMT_RGBA32,    ///< Packed pixel, 4 bytes per pixel, BGRABGRA..., stored in cpu endianness
     PIX_FMT_YUV410P,   ///< Planar YUV 4:1:0 (1 Cr & Cb sample per 4x4 Y samples)
+    PIX_FMT_YVU410P,   ///< Planar YVU 4:1:0 (1 Cr & Cb sample per 4x4 Y samples)
     PIX_FMT_YUV411P,   ///< Planar YUV 4:1:1 (1 Cr & Cb sample per 4x1 Y samples)
     PIX_FMT_RGB565,    ///< always stored in cpu endianness
     PIX_FMT_RGB555,    ///< always stored in cpu endianness, most significant bit to 1
Index: libavcodec/imgconvert.c
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavcodec/imgconvert.c,v
retrieving revision 1.61
diff -u -r1.61 imgconvert.c
--- libavcodec/imgconvert.c	12 Jan 2006 22:43:15 -0000	1.61
+++ libavcodec/imgconvert.c	4 Mar 2006 23:27:58 -0000
@@ -113,6 +113,14 @@
         .depth = 8,
         .x_chroma_shift = 2, .y_chroma_shift = 2,
     },
+    [PIX_FMT_YVU410P] = {
+        .name = "yvu410p",
+        .nb_channels = 3,
+        .color_type = FF_COLOR_YUV,
+        .pixel_type = FF_PIXEL_PLANAR,
+        .depth = 8,
+        .x_chroma_shift = 2, .y_chroma_shift = 2,
+    },
     [PIX_FMT_YUV411P] = {
         .name = "yuv411p",
         .nb_channels = 3,
@@ -292,6 +300,17 @@
         picture->linesize[1] = w2;
         picture->linesize[2] = w2;
         return size + 2 * size2;
+    case PIX_FMT_YVU410P:
+        w2 = (width + (1 << pinfo->x_chroma_shift) - 1) >> pinfo->x_chroma_shift;
+        h2 = (height + (1 << pinfo->y_chroma_shift) - 1) >> pinfo->y_chroma_shift;
+        size2 = w2 * h2;
+        picture->data[0] = ptr;
+        picture->data[2] = picture->data[0] + size;
+        picture->data[1] = picture->data[2] + size2;
+        picture->linesize[0] = width;
+        picture->linesize[1] = w2;
+        picture->linesize[2] = w2;
+        return size + 2 * size2;
     case PIX_FMT_RGB24:
     case PIX_FMT_BGR24:
         picture->data[0] = ptr;
Index: libavcodec/raw.c
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavcodec/raw.c,v
retrieving revision 1.20
diff -u -r1.20 raw.c
--- libavcodec/raw.c	3 Mar 2006 21:33:06 -0000	1.20
+++ libavcodec/raw.c	4 Mar 2006 23:27:59 -0000
@@ -39,6 +39,7 @@
     { PIX_FMT_YUV420P, MKTAG('I', '4', '2', '0') }, /* Planar formats */
     { PIX_FMT_YUV420P, MKTAG('I', 'Y', 'U', 'V') },
     { PIX_FMT_YUV410P, MKTAG('Y', 'U', 'V', '9') },
+    { PIX_FMT_YVU410P, MKTAG('Y', 'V', 'U', '9') },
     { PIX_FMT_YUV411P, MKTAG('Y', '4', '1', 'B') },
     { PIX_FMT_YUV422P, MKTAG('Y', '4', '2', 'B') },
     { PIX_FMT_GRAY8,   MKTAG('Y', '8', '0', '0') },
Index: libavformat/avienc.c
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavformat/avienc.c,v
retrieving revision 1.128
diff -u -r1.128 avienc.c
--- libavformat/avienc.c	2 Mar 2006 20:44:35 -0000	1.128
+++ libavformat/avienc.c	4 Mar 2006 23:28:00 -0000
@@ -159,6 +159,7 @@
     { CODEC_ID_RAWVIDEO, MKTAG('Y', '4', '2', '2') },
     { CODEC_ID_RAWVIDEO, MKTAG('U', 'Y', 'V', 'Y') },
     { CODEC_ID_RAWVIDEO, MKTAG('I', 'Y', 'U', 'V') },
+    { CODEC_ID_RAWVIDEO, MKTAG('Y', 'V', 'U', '9') },
     { CODEC_ID_INDEO3, MKTAG('I', 'V', '3', '1') },
     { CODEC_ID_INDEO3, MKTAG('I', 'V', '3', '2') },
     { CODEC_ID_VP3, MKTAG('V', 'P', '3', '1') },



More information about the ffmpeg-devel mailing list