DirectFB - Home of the pragmatist Roadmap


[directfb-dev] v4l planar patch
Mailing List archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[directfb-dev] v4l planar patch



Attached is a patch to add support for planar formats to the v4l video
provider. I'm not sure about bpp = 8. bttv won't accept bpp = 12 so I
figured it could be 8. I can't really test the overlay part because bttv
appears to be broken with yuv and overlay (even yuy2).

-- 
Ville Syrjälä
syrjala@sci.fi
http://www.sci.fi/~syrjala/
Index: interfaces/IDirectFBVideoProvider/idirectfbvideoprovider_v4l.c
===================================================================
RCS file: /cvs/directfb/DirectFB/interfaces/IDirectFBVideoProvider/idirectfbvideoprovider_v4l.c,v
retrieving revision 1.34
diff -u -r1.34 idirectfbvideoprovider_v4l.c
--- interfaces/IDirectFBVideoProvider/idirectfbvideoprovider_v4l.c	2 Jul 2002 17:03:02 -0000	1.34
+++ interfaces/IDirectFBVideoProvider/idirectfbvideoprovider_v4l.c	4 Jul 2002 22:55:16 -0000
@@ -475,6 +475,29 @@
                dst += dst_pitch;
                src += src_pitch;
           }
+          if (surface->format == DSPF_I420) {
+               h = surface->height / 2;
+               while (h--) {
+                    dfb_memcpy( dst, src, src_pitch );
+                    dst += dst_pitch;
+                    src += src_pitch;
+               }
+          } else if (surface->format == DSPF_YV12) {
+               h = surface->height / 4;
+               src += h * src_pitch;
+               while (h--) {
+                    dfb_memcpy( dst, src, src_pitch );
+                    dst += dst_pitch;
+                    src += src_pitch;
+               }
+               h = surface->height / 4;
+               src -=  2 * h * src_pitch;
+               while (h--) {
+                    dfb_memcpy( dst, src, src_pitch );
+                    dst += dst_pitch;
+                    src += src_pitch;
+               }
+          }
           dfb_surface_unlock( surface, 0 );
 
           if (data->destination->caps & DSCAPS_INTERLACED)
@@ -563,6 +586,10 @@
                bpp = 16;
                palette = VIDEO_PALETTE_UYVY;
                break;
+          case DSPF_I420:
+               bpp = 8;
+               palette = VIDEO_PALETTE_YUV420P;
+               break;
           case DSPF_RGB15:
                bpp = 15;
                palette = VIDEO_PALETTE_RGB555;
@@ -707,6 +734,14 @@
           case DSPF_UYVY:
                bpp = 16;
                palette = VIDEO_PALETTE_UYVY;
+               break;
+          case DSPF_I420:
+               bpp = 8;
+               palette = VIDEO_PALETTE_YUV420P;
+               break;
+          case DSPF_YV12:
+               bpp = 8;
+               palette = VIDEO_PALETTE_YUV420P;
                break;
           case DSPF_RGB15:
                bpp = 15;

Home | Main Index | Thread Index


directfb.org / Development / Old Archives