This is an automatic generated email to let you know that the following patch 
were queued at the 
http://git.linuxtv.org/v4l-utils.git tree:

Subject: libv4lconvert: Add support for Xirlink C-It YYVYUY format
Author:  Hans de Goede <[email protected]>
Date:    Sun Jun 6 09:23:43 2010 +0200

This format is produced by some cameras with the Xirlink C-It chipset
(cameras formely handled by the v4l1 ibmcam driver).

Signed-off-by: Hans de Goede <[email protected]>

 include/linux/videodev2.h              |    1 +
 lib/libv4l2/libv4l2.c                  |    4 +-
 lib/libv4lconvert/libv4lconvert-priv.h |    4 +++
 lib/libv4lconvert/libv4lconvert.c      |    5 ++++
 lib/libv4lconvert/spca501.c            |   35 ++++++++++++++++++++++++++++++++
 5 files changed, 47 insertions(+), 2 deletions(-)

---

http://git.linuxtv.org/v4l-utils.git?a=commitdiff;h=653ce5f428022c3372326ebec8d9007f563c9fd0

diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index b5121be..cb91d23 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -362,6 +362,7 @@ struct v4l2_pix_format {
 #define V4L2_PIX_FMT_OV518    v4l2_fourcc('O', '5', '1', '8') /* ov518 JPEG */
 #define V4L2_PIX_FMT_STV0680  v4l2_fourcc('S', '6', '8', '0') /* stv0680 bayer 
*/
 #define V4L2_PIX_FMT_TM6000   v4l2_fourcc('T', 'M', '6', '0') /* tm5600/tm60x0 
*/
+#define V4L2_PIX_FMT_CIT_YYVYUY v4l2_fourcc('C', 'I', 'T', 'V') /* one line of 
Y then 1 line of VYUY */
 
 /*
  *     F O R M A T   E N U M E R A T I O N
diff --git a/lib/libv4l2/libv4l2.c b/lib/libv4l2/libv4l2.c
index 2d97881..7c595bf 100644
--- a/lib/libv4l2/libv4l2.c
+++ b/lib/libv4l2/libv4l2.c
@@ -329,7 +329,7 @@ static int v4l2_dequeue_and_convert(int index, struct 
v4l2_buffer *buf,
 
        if (result < 0 && errno == EPIPE) {
                V4L2_LOG("got %d consecutive short frame errors, "
-                        "returning short frame");
+                        "returning short frame", max_tries);
                result = devices[index].dest_fmt.fmt.pix.sizeimage;
                errno = 0;
        }
@@ -403,7 +403,7 @@ static int v4l2_read_and_convert(int index, unsigned char 
*dest, int dest_size)
 
        if (result < 0 && errno == EPIPE) {
                V4L2_LOG("got %d consecutive short frame errors, "
-                        "returning short frame");
+                        "returning short frame", max_tries);
                result = devices[index].dest_fmt.fmt.pix.sizeimage;
                errno = 0;
        }
diff --git a/lib/libv4lconvert/libv4lconvert-priv.h 
b/lib/libv4lconvert/libv4lconvert-priv.h
index c9fda05..6e880f8 100644
--- a/lib/libv4lconvert/libv4lconvert-priv.h
+++ b/lib/libv4lconvert/libv4lconvert-priv.h
@@ -145,6 +145,10 @@ void v4lconvert_spca505_to_yuv420(const unsigned char 
*src, unsigned char *dst,
 void v4lconvert_spca508_to_yuv420(const unsigned char *src, unsigned char *dst,
                int width, int height, int yvu);
 
+void v4lconvert_cit_yyvyuy_to_yuv420(const unsigned char *src,
+               unsigned char *ydest,
+               int width, int height, int yvu);
+
 int v4lconvert_cpia1_to_yuv420(struct v4lconvert_data *data,
                const unsigned char *src, int src_size,
                unsigned char *dst, int width, int height, int yvu);
diff --git a/lib/libv4lconvert/libv4lconvert.c 
b/lib/libv4lconvert/libv4lconvert.c
index 014c600..6d91d7c 100644
--- a/lib/libv4lconvert/libv4lconvert.c
+++ b/lib/libv4lconvert/libv4lconvert.c
@@ -56,6 +56,7 @@ static const struct v4lconvert_pixfmt supported_src_pixfmts[] 
= {
        { V4L2_PIX_FMT_SPCA501,      V4LCONVERT_NEEDS_CONVERSION },
        { V4L2_PIX_FMT_SPCA505,      V4LCONVERT_NEEDS_CONVERSION },
        { V4L2_PIX_FMT_SPCA508,      V4LCONVERT_NEEDS_CONVERSION },
+       { V4L2_PIX_FMT_CIT_YYVYUY,   V4LCONVERT_NEEDS_CONVERSION },
        { V4L2_PIX_FMT_CPIA1,        V4LCONVERT_NEEDS_CONVERSION },
        { V4L2_PIX_FMT_HM12,         V4LCONVERT_NEEDS_CONVERSION },
        { V4L2_PIX_FMT_MJPEG,        V4LCONVERT_COMPRESSED },
@@ -642,6 +643,7 @@ static int v4lconvert_convert_pixfmt(struct v4lconvert_data 
*data,
        case V4L2_PIX_FMT_SPCA501:
        case V4L2_PIX_FMT_SPCA505:
        case V4L2_PIX_FMT_SPCA508:
+       case V4L2_PIX_FMT_CIT_YYVYUY:
        case V4L2_PIX_FMT_SN9C20X_I420:
        case V4L2_PIX_FMT_CPIA1:
        case V4L2_PIX_FMT_OV511:
@@ -675,6 +677,9 @@ static int v4lconvert_convert_pixfmt(struct v4lconvert_data 
*data,
                case V4L2_PIX_FMT_SPCA508:
                        v4lconvert_spca508_to_yuv420(src, d, width, height, 
yvu);
                        break;
+               case V4L2_PIX_FMT_CIT_YYVYUY:
+                       v4lconvert_cit_yyvyuy_to_yuv420(src, d, width, height, 
yvu);
+                       break;
                case V4L2_PIX_FMT_SN9C20X_I420:
                        v4lconvert_sn9c20x_to_yuv420(src, d, width, height, 
yvu);
                        break;
diff --git a/lib/libv4lconvert/spca501.c b/lib/libv4lconvert/spca501.c
index d94c14b..438c1c3 100644
--- a/lib/libv4lconvert/spca501.c
+++ b/lib/libv4lconvert/spca501.c
@@ -16,6 +16,7 @@
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
+#include <string.h>
 #include "libv4lconvert-priv.h"
 
 /* YUYV per line */
@@ -144,3 +145,37 @@ void v4lconvert_spca508_to_yuv420(const unsigned char 
*src, unsigned char *dst,
                }
        }
 }
+
+/* Note this is not a spca specific format, bit it fits in this file in that
+   it is another funny yuv format */
+/* one line of Y then 1 line of VYUY */
+void v4lconvert_cit_yyvyuy_to_yuv420(const unsigned char *src,
+               unsigned char *ydest,
+               int width, int height, int yvu)
+{
+       int x, y;
+       unsigned char *udest, *vdest;
+
+       if (yvu) {
+               vdest = ydest + width * height;
+               udest = vdest + (width * height) / 4;
+       } else {
+               udest = ydest + width * height;
+               vdest = udest + (width * height) / 4;
+       }
+
+       for (y = 0; y < height; y += 2) {
+               /* copy 1 line of Y */
+               memcpy(ydest, src, width);
+               src += width;
+               ydest += width;
+
+               /* Split one line of VYUY */
+               for (x = 0; x < width; x += 2) {
+                       *vdest++ = *src++;
+                       *ydest++ = *src++;
+                       *udest++ = *src++;
+                       *ydest++ = *src++;
+               }
+       }
+}

_______________________________________________
linuxtv-commits mailing list
[email protected]
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits

Reply via email to