[Ffmpeg-devel] Re: [PATCH] YVU9 support

Fabrizio Gennari fabrizio.ge
Sun Mar 5 22:18:37 CET 2006


>Add new values at the end of the list instead so it avoids breaking
>binary compatibility.  Apart from that the patch looks good.

Here is the same patch, only with the new value in enum PixelFormat just
before PIX_FMT_NB.

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	5 Mar 2006 18:16:12 -0000
@@ -262,6 +262,7 @@
     PIX_FMT_XVMC_MPEG2_IDCT,
     PIX_FMT_UYVY422,   ///< Packed pixel, Cb Y0 Cr Y1
     PIX_FMT_UYVY411,   ///< Packed pixel, Cb Y0 Y1 Cr Y2 Y3
+    PIX_FMT_YVU410P,   ///< Planar YVU 4:1:0 (1 Cr & Cb sample per 4x4 Y samples)
     PIX_FMT_NB,
 };
 
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	5 Mar 2006 18:16:14 -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	5 Mar 2006 18:16:14 -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	5 Mar 2006 18:16:15 -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