Skip to contentSkip to conversation

v4l library YVYU decoding

PATCH In review Jean-Francois Moine 2 participants 2 messages Sep 1, 2008 – Sep 3, 2008 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 v4l library YVYU decoding

Hi Hans,

Here is a new YVYU decoding patch which replaces the previous one.

Sorry for it is not tested: the webcam 046d:0896 does not work well.

Cheers.

Signature · 2 lines
Ken ar c'hentañ |             ** Breizh ha Linux atav! **
Jef             |               http://moinejf.free.fr/

This patch adds the decoding of YVYU images generated by vc0321.

v4l2-apps/lib/libv4l/libv4lconvert/libv4lconvert-priv.h renamed from v4l2-apps/lib/libv4l/libv4lconvert/libv4lconvert-priv.h.orig +13 -0
@@ -59,6 +59,10 @@
 #define V4L2_PIX_FMT_SRGGB8 v4l2_fourcc('R','G','G','B')
 #endif
 
+#ifndef V4L2_PIX_FMT_YVYU
+#define V4L2_PIX_FMT_YVYU v4l2_fourcc('Y', 'V', 'Y', 'U')
+#endif
+
 #define V4LCONVERT_ERROR_MSG_SIZE 256
 
 #define V4LCONVERT_ERR(...) \
@@ -87,6 +91,15 @@
 void v4lconvert_yuv420_to_bgr24(const unsigned char *src, unsigned char *dst,
   int width, int height);
 
+void v4lconvert_yvyu_to_rgb24(const unsigned char *src, unsigned char *dst,
+  int width, int height);
+
+void v4lconvert_yvyu_to_bgr24(const unsigned char *src, unsigned char *dst,
+  int width, int height);
+
+void v4lconvert_yvyu_to_yuv420(const unsigned char *src, unsigned char *dst,
+  int width, int height);
+
 void v4lconvert_swap_rgb(const unsigned char *src, unsigned char *dst,
   int width, int height);
 
v4l2-apps/lib/libv4l/libv4lconvert/libv4lconvert.c renamed from v4l2-apps/lib/libv4l/libv4lconvert/libv4lconvert.c.orig +18 -0
@@ -49,6 +49,7 @@
   V4L2_PIX_FMT_SN9C10X,
   V4L2_PIX_FMT_PAC207,
   V4L2_PIX_FMT_PJPG,
+  V4L2_PIX_FMT_YVYU,
 };
 
 static const unsigned int supported_dst_pixfmts[] = {
@@ -518,6 +519,23 @@
       }
       break;
 
+    case V4L2_PIX_FMT_YVYU:
+      switch (dest_fmt->fmt.pix.pixelformat) {
+      case V4L2_PIX_FMT_RGB24:
+	v4lconvert_yvyu_to_rgb24(src, dest, dest_fmt->fmt.pix.width,
+				   dest_fmt->fmt.pix.height);
+	break;
+      case V4L2_PIX_FMT_BGR24:
+	v4lconvert_yvyu_to_bgr24(src, dest, dest_fmt->fmt.pix.width,
+				   dest_fmt->fmt.pix.height);
+	break;
+      default:
+	v4lconvert_yvyu_to_yuv420(src, dest, dest_fmt->fmt.pix.width,
+		    dest_fmt->fmt.pix.height);
+	break;
+      }
+      break;
+
     default:
       V4LCONVERT_ERR("Unknown src format in conversion\n");
       errno = EINVAL;
v4l2-apps/lib/libv4l/libv4lconvert/rgbyuv.c renamed from v4l2-apps/lib/libv4l/libv4lconvert/rgbyuv.c.orig +85 -0

91 lines not on this page · raw message

--
video4linux-list mailing list
Unsubscribe mailto:[email protected]?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

#1 lore raw
Quoted 6 lines · Jean-Francois Moine

Hi Hans,

Here is a new YVYU decoding patch which replaces the previous one.

Sorry for it is not tested: the webcam 046d:0896 does not work well.

Thanks,

I've found a cam which does YUYV and used your patch to add YUYV support as well, that seems to work well so I guess YVYU will work well too.

This support is in the just released 0.4.3 release (I must still send the announcement).

Regards,

Hans

--
video4linux-list mailing list
Unsubscribe mailto:[email protected]?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list