Skip to contentSkip to conversation

YVYU decoding

PATCH In review Jean-Francois Moine 2 participants 2 messages Aug 29, 2008 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 YVYU decoding

Hi Hans,

Here is a patch for decoding the YVYU frames of the vc0321.

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 +10 -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,12 @@
 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_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 +14 -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,19 @@
       }
       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;
+      }
+      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 +52 -0

58 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 4 lines · Jean-Francois Moine

Hi Hans,

Here is a patch for decoding the YVYU frames of the vc0321.

Thanks, I'll apply it, but you are missing YVYU (packed) -> YUV420 (planar) conversion, while some apps do default to requesting YUV420 (planar) and as your patch claims that libv4lconvert supports YUYV (there is no way to claim partial support) those apps will get their request granted.

Any chance you could add YVYU (packed) -> YUV420 (planar) conversion, this should be easy, just average the U and V values of one YVYU pack from 2 adjecent rows, and of course do the packed -> planar conversion. If you cannot I can write code for this, can you test it then?

Regards,

Hans

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