[MPlayer-dev-eng] [patch] v4l image upside down

Trent Piepho xyzzy at speakeasy.org
Fri Jul 6 01:28:28 CEST 2007


For some reason, rgb images are turned upside down in the v4l driver.  There
is nothing in the v4l1 standard that says RGB images are upside down.  The
v4l2 driver doesn't do this.  I've tested with the bttv, cx88, and zoran
drivers, and they all provide normal rgb images that don't need to be
vertically flipped.  This patch removes the unnecessary flip.


Index: stream/tvi_v4l.c
===================================================================
--- stream/tvi_v4l.c	(revision 23724)
+++ stream/tvi_v4l.c	(working copy)
@@ -1397,13 +1398,9 @@
 }

 // copies a video frame
-// for RGB (i.e. BGR in mplayer) flips the image upside down
 // for YV12 swaps the 2nd and 3rd plane
 static inline void copy_frame(priv_t *priv, unsigned char *dest, unsigned char *source)
 {
-    int i;
-    unsigned char *sptr;
-
     if(tv_param_automute>0){
         if (ioctl(priv->video_fd, VIDIOCGTUNER, &priv->tuner) >= 0) {
             if(tv_param_automute<<8>priv->tuner.signal){
@@ -1422,23 +1419,7 @@
         return;
     }

-    switch (priv->picture.palette) {
-    case VIDEO_PALETTE_RGB24:
-    case VIDEO_PALETTE_RGB32:
-    case VIDEO_PALETTE_RGB555:
-    case VIDEO_PALETTE_RGB565:
-        sptr = source + (priv->height-1)*priv->bytesperline;
-        for (i = 0; i < priv->height; i++) {
-            fast_memcpy(dest, sptr, priv->bytesperline);
-            dest += priv->bytesperline;
-            sptr -= priv->bytesperline;
-        }
-        break;
-    case VIDEO_PALETTE_UYVY:
-    case VIDEO_PALETTE_YUV420P:
-    default:
-        fast_memcpy(dest, source, priv->bytesperline * priv->height);
-    }
+    fast_memcpy(dest, source, priv->bytesperline * priv->height);

 }





More information about the MPlayer-dev-eng mailing list