[MPlayer-dev-eng] [PATCH] support for mov yuv2 fourcc

Reimar Döffinger Reimar.Doeffinger at stud.uni-karlsruhe.de
Thu Jun 7 19:23:55 CEST 2007


Hello,
yuv2 seems to be some format similar to yuy2 but with unsigned chrome (very weird).
Attached patch makes it play (sample at
http://samples.mplayerhq.hu/mov/yuv2.mov).
Does it look okay?

Greetings,
Reimar Döffinger
-------------- next part --------------
Index: etc/codecs.conf
===================================================================
--- etc/codecs.conf	(revision 23493)
+++ etc/codecs.conf	(working copy)
@@ -2190,6 +2196,7 @@
   format 0x0 0x32595559
   format 0x20776172
   fourcc yuy2,YUY2
+  fourcc yuv2 # this needs actual "decoding" since chroma is stored unsigned
   out YUY2
 
 videocodec rawuyvy
Index: libmpcodecs/vd_raw.c
===================================================================
--- libmpcodecs/vd_raw.c	(revision 23493)
+++ libmpcodecs/vd_raw.c	(working copy)
@@ -22,6 +22,7 @@
     switch(cmd){
     case VDCTRL_QUERY_FORMAT:
 	if (*(int *)arg == format) return CONTROL_TRUE;
+	if (*(int *)arg == IMGFMT_YUY2 && format == MKTAG('y', 'u', 'v', '2')) return CONTROL_TRUE;
 	return CONTROL_FALSE;
     }
     return CONTROL_UNKNOWN;
@@ -57,6 +59,7 @@
 static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){
     mp_image_t* mpi;
     int frame_size;
+    int format = sh->bih ? sh->bih->biCompression : sh->format;
     
     if(len<=0) return NULL; // skipped frame
 
@@ -104,6 +107,11 @@
 #endif
 	}
 	frame_size=mpi->stride[0]*mpi->h;
+	if (format == MKTAG('y', 'u', 'v', '2')) {
+	  int i;
+          for (i = 1; i < frame_size; i += 2)
+            mpi->planes[0][i] ^= 128;
+        }
 	if(mpi->bpp<8) frame_size=frame_size*mpi->bpp/8;
     }
 


More information about the MPlayer-dev-eng mailing list