changeset 25182:b90f13d1f7eb

Add support for Apple's yuv2 raw format
author reimar
date Fri, 30 Nov 2007 11:31:31 +0000
parents b0180bc36b1e
children 2ef0fab3aa73
files etc/codecs.conf libmpcodecs/vd_raw.c
diffstat 2 files changed, 16 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/etc/codecs.conf	Fri Nov 30 11:10:38 2007 +0000
+++ b/etc/codecs.conf	Fri Nov 30 11:31:31 2007 +0000
@@ -2213,6 +2213,15 @@
   fourcc yuy2,YUY2
   out YUY2
 
+videocodec rawyuv2
+  info "RAW YUV2"
+  status working
+  driver raw
+  format 0x0 0x32565559
+  format 0x20776172 0x32565559
+  fourcc yuv2,YUV2
+  out YUY2
+
 videocodec rawuyvy
   info "RAW UYVY"
   status working
--- a/libmpcodecs/vd_raw.c	Fri Nov 30 11:10:38 2007 +0000
+++ b/libmpcodecs/vd_raw.c	Fri Nov 30 11:31:31 2007 +0000
@@ -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 +58,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 +106,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;
     }