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: libv4l: Add support for konica yuv420 format
Author:  Hans de Goede <[email protected]>
Date:    Thu Jul 1 20:32:15 2010 +0200

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

 include/linux/videodev2.h              |    1 +
 lib/libv4lconvert/libv4lconvert-priv.h |    4 +++
 lib/libv4lconvert/libv4lconvert.c      |    5 ++++
 lib/libv4lconvert/spca501.c            |   39 ++++++++++++++++++++++++++++++++
 4 files changed, 49 insertions(+), 0 deletions(-)

---

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

diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index cb91d23..b73fe20 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -363,6 +363,7 @@ struct v4l2_pix_format {
 #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 */
+#define V4L2_PIX_FMT_KONICA420  v4l2_fourcc('K', 'O', 'N', 'I') /* YUV420 
planar in blocks of 256 pixels */
 
 /*
  *     F O R M A T   E N U M E R A T I O N
diff --git a/lib/libv4lconvert/libv4lconvert-priv.h 
b/lib/libv4lconvert/libv4lconvert-priv.h
index b3e4c4e..61a8c39 100644
--- a/lib/libv4lconvert/libv4lconvert-priv.h
+++ b/lib/libv4lconvert/libv4lconvert-priv.h
@@ -149,6 +149,10 @@ void v4lconvert_cit_yyvyuy_to_yuv420(const unsigned char 
*src,
                unsigned char *ydest,
                int width, int height, int yvu);
 
+void v4lconvert_konica_yuv420_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 6d91d7c..f08996a 100644
--- a/lib/libv4lconvert/libv4lconvert.c
+++ b/lib/libv4lconvert/libv4lconvert.c
@@ -57,6 +57,7 @@ static const struct v4lconvert_pixfmt supported_src_pixfmts[] 
= {
        { 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_KONICA420,    V4LCONVERT_NEEDS_CONVERSION },
        { V4L2_PIX_FMT_CPIA1,        V4LCONVERT_NEEDS_CONVERSION },
        { V4L2_PIX_FMT_HM12,         V4LCONVERT_NEEDS_CONVERSION },
        { V4L2_PIX_FMT_MJPEG,        V4LCONVERT_COMPRESSED },
@@ -644,6 +645,7 @@ static int v4lconvert_convert_pixfmt(struct v4lconvert_data 
*data,
        case V4L2_PIX_FMT_SPCA505:
        case V4L2_PIX_FMT_SPCA508:
        case V4L2_PIX_FMT_CIT_YYVYUY:
+       case V4L2_PIX_FMT_KONICA420:
        case V4L2_PIX_FMT_SN9C20X_I420:
        case V4L2_PIX_FMT_CPIA1:
        case V4L2_PIX_FMT_OV511:
@@ -680,6 +682,9 @@ static int v4lconvert_convert_pixfmt(struct v4lconvert_data 
*data,
                case V4L2_PIX_FMT_CIT_YYVYUY:
                        v4lconvert_cit_yyvyuy_to_yuv420(src, d, width, height, 
yvu);
                        break;
+               case V4L2_PIX_FMT_KONICA420:
+                       v4lconvert_konica_yuv420_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 438c1c3..bf0e08a 100644
--- a/lib/libv4lconvert/spca501.c
+++ b/lib/libv4lconvert/spca501.c
@@ -179,3 +179,42 @@ void v4lconvert_cit_yyvyuy_to_yuv420(const unsigned char 
*src,
                }
        }
 }
+
+/* Note this is not a spca specific format, but it fits in this file in that
+   it is another funny yuv format */
+/* The konica gspca subdriver using cams send data in blocks of 256 pixels
+   in YUV420 format. */
+void v4lconvert_konica_yuv420_to_yuv420(const unsigned char *src,
+               unsigned char *ydest,
+               int width, int height, int yvu)
+{
+       int i, no_blocks;
+       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;
+       }
+
+       no_blocks = width * height * 3 / 2;
+       no_blocks /= 256;
+       for (i = 0; i < no_blocks; i++) {
+               /* copy 256 Y pixels */
+               memcpy(ydest, src, 256);
+               src += 256;
+               ydest += 256;
+
+               /* copy 64 U pixels */
+               memcpy(udest, src, 64);
+               src += 64;
+               udest += 64;
+
+               /* copy 64 V pixels */
+               memcpy(udest, src, 64);
+               src += 64;
+               udest += 64;
+       }
+}

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

Reply via email to