[Gridflow-cvs] [svn] commit: r5490 - /trunk/src/quicktimecamera.cxx

svn-gridflow at artengine.ca svn-gridflow at artengine.ca
Mon Apr 19 19:54:07 EDT 2010


Author: pboivin
Date: Mon Apr 19 19:54:06 2010
New Revision: 5490

Log:
fix for yuv, rgb and rgba on OSX ppc

Modified:
    trunk/src/quicktimecamera.cxx

Modified: trunk/src/quicktimecamera.cxx
==============================================================================
--- trunk/src/quicktimecamera.cxx (original)
+++ trunk/src/quicktimecamera.cxx Mon Apr 19 19:54:06 2010
@@ -320,6 +320,7 @@
 	//if (c=="magic") {} else
 	   RAISE("got '%s' but supported colorspaces are: y yuv rgb rgba",c.data());
 	uint32 masks[4]={0x0000ff00,0x00ff0000,0xff000000,0x00000000};
+	if (!is_le()) swap32(4,masks);
 	bit_packing3 = new BitPacking(is_le(),4,3,masks);
 	//bit_packing4 = new BitPacking(is_le(),bytes,4,masks);
 	this->colorspace=gensym(c.data());
@@ -366,9 +367,13 @@
 		//bit_packing3->unpack(sx,buf+y*sx*bit_packing3->bytes,rgb);
 		bit_packing3->unpack(n,buf,buf2);
 		out.send(dim->prod(),buf2);
-	} else if (cs=="rgba") { // does this really work on PPC ?
+	} else if (cs=="rgba") {
 		int n = dim->prod()/4;
-		for (int i=0; i<n; i++) ((uint32 *)buf2)[i] = (((uint32 *)buf)[i] >> 8) | 0xff000000;
+		if (is_le()) {
+			for (int i=0; i<n; i++) ((uint32 *)buf2)[i] = (((uint32 *)buf)[i] >> 8) | 0xff000000;
+		} else {
+			for (int i=0; i<n; i++) ((uint32 *)buf2)[i] = (((uint32 *)buf)[i] << 8) | 0x000000ff;
+		}
 		out.send(dim->prod(),buf2);
 	} else
 		RAISE("colorspace problem");



More information about the Gridflow-cvs mailing list