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

Subject: libv4lconvert: Add support for V4L2_PIX_FMT_{NV16, NV61}
Author:  Niklas Söderlund <[email protected]>
Date:    Sat Mar 12 01:45:05 2016 +0100

NV16 and NV61 are two-plane versions of the YUV 4:2:2 formats YUYV and
YVYU. Support both formats by merging the two planes into a one and
falling through to the V4L2_PIX_FMT_{YUYV,YVYU} code path.

Signed-off-by: Niklas Söderlund <[email protected]>
Acked-by: Hans de Goede <[email protected]>
Signed-off-by: Hans Verkuil <[email protected]>

 lib/libv4lconvert/libv4lconvert-priv.h |  3 +++
 lib/libv4lconvert/libv4lconvert.c      | 31 +++++++++++++++++++++++++++++++
 lib/libv4lconvert/rgbyuv.c             | 15 +++++++++++++++
 3 files changed, 49 insertions(+)

---

http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=8bd2f0703bd0501b9423dc6d5f58af3ff8a414e0
diff --git a/lib/libv4lconvert/libv4lconvert-priv.h 
b/lib/libv4lconvert/libv4lconvert-priv.h
index b77e3d34cfa2..1740efc94456 100644
--- a/lib/libv4lconvert/libv4lconvert-priv.h
+++ b/lib/libv4lconvert/libv4lconvert-priv.h
@@ -129,6 +129,9 @@ void v4lconvert_yuyv_to_bgr24(const unsigned char *src, 
unsigned char *dst,
 void v4lconvert_yuyv_to_yuv420(const unsigned char *src, unsigned char *dst,
                int width, int height, int stride, int yvu);
 
+void v4lconvert_nv16_to_yuyv(const unsigned char *src, unsigned char *dest,
+               int width, int height);
+
 void v4lconvert_yvyu_to_rgb24(const unsigned char *src, unsigned char *dst,
                int width, int height, int stride);
 
diff --git a/lib/libv4lconvert/libv4lconvert.c 
b/lib/libv4lconvert/libv4lconvert.c
index f62aea1d0077..d3d89362d3ca 100644
--- a/lib/libv4lconvert/libv4lconvert.c
+++ b/lib/libv4lconvert/libv4lconvert.c
@@ -98,6 +98,8 @@ static const struct v4lconvert_pixfmt supported_src_pixfmts[] 
= {
        { V4L2_PIX_FMT_YUYV,            16,      5,      4,     0 },
        { V4L2_PIX_FMT_YVYU,            16,      5,      4,     0 },
        { V4L2_PIX_FMT_UYVY,            16,      5,      4,     0 },
+       { V4L2_PIX_FMT_NV16,            16,      5,      4,     1 },
+       { V4L2_PIX_FMT_NV61,            16,      5,      4,     1 },
        /* yuv 4:2:0 formats */
        { V4L2_PIX_FMT_SPCA501,         12,      6,      3,     1 },
        { V4L2_PIX_FMT_SPCA505,         12,      6,      3,     1 },
@@ -1229,6 +1231,20 @@ static int v4lconvert_convert_pixfmt(struct 
v4lconvert_data *data,
                }
                break;
 
+       case V4L2_PIX_FMT_NV16: {
+               unsigned char *tmpbuf;
+
+               tmpbuf = v4lconvert_alloc_buffer(width * height * 2,
+                               &data->convert_pixfmt_buf, 
&data->convert_pixfmt_buf_size);
+               if (!tmpbuf)
+                       return v4lconvert_oom_error(data);
+
+               v4lconvert_nv16_to_yuyv(src, tmpbuf, width, height);
+               src_pix_fmt = V4L2_PIX_FMT_YUYV;
+               src = tmpbuf;
+               bytesperline = bytesperline * 2;
+               /* fall through */
+       }
        case V4L2_PIX_FMT_YUYV:
                if (src_size < (width * height * 2)) {
                        V4LCONVERT_ERR("short yuyv data frame\n");
@@ -1251,6 +1267,21 @@ static int v4lconvert_convert_pixfmt(struct 
v4lconvert_data *data,
                }
                break;
 
+       case V4L2_PIX_FMT_NV61: {
+               unsigned char *tmpbuf;
+
+               tmpbuf = v4lconvert_alloc_buffer(width * height * 2,
+                               &data->convert_pixfmt_buf, 
&data->convert_pixfmt_buf_size);
+               if (!tmpbuf)
+                       return v4lconvert_oom_error(data);
+
+               /* Note NV61 is NV16 with U and V swapped so this becomes yvyu. 
*/
+               v4lconvert_nv16_to_yuyv(src, tmpbuf, width, height);
+               src_pix_fmt = V4L2_PIX_FMT_YVYU;
+               src = tmpbuf;
+               bytesperline = bytesperline * 2;
+               /* fall through */
+       }
        case V4L2_PIX_FMT_YVYU:
                if (src_size < (width * height * 2)) {
                        V4LCONVERT_ERR("short yvyu data frame\n");
diff --git a/lib/libv4lconvert/rgbyuv.c b/lib/libv4lconvert/rgbyuv.c
index 695255a00214..a0f8256bf7ab 100644
--- a/lib/libv4lconvert/rgbyuv.c
+++ b/lib/libv4lconvert/rgbyuv.c
@@ -295,6 +295,21 @@ void v4lconvert_yuyv_to_yuv420(const unsigned char *src, 
unsigned char *dest,
        }
 }
 
+void v4lconvert_nv16_to_yuyv(const unsigned char *src, unsigned char *dest,
+               int width, int height)
+{
+       const unsigned char *y, *cbcr;
+       int count = 0;
+
+       y = src;
+       cbcr = src + width*height;
+
+       while (count++ < width*height) {
+               *dest++ = *y++;
+               *dest++ = *cbcr++;
+       }
+}
+
 void v4lconvert_yvyu_to_bgr24(const unsigned char *src, unsigned char *dest,
                int width, int height, int stride)
 {

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

Reply via email to