[Gridflow-cvs] [svn] commit: r4654 - in /trunk: doc/flow_classes/#from_pix-help.pd src/gem.cxx

gridflow-cvs at artengine.ca gridflow-cvs at artengine.ca
Sun Nov 1 20:12:11 EST 2009


Author: matju
Date: Sun Nov  1 20:12:10 2009
New Revision: 4654

Log:
added method 'cast', for quite large speed gains

Modified:
    trunk/doc/flow_classes/#from_pix-help.pd
    trunk/src/gem.cxx

Modified: trunk/doc/flow_classes/#from_pix-help.pd
==============================================================================
--- trunk/doc/flow_classes/#from_pix-help.pd (original)
+++ trunk/doc/flow_classes/#from_pix-help.pd Sun Nov  1 20:12:10 2009
@@ -1,10 +1,9 @@
-#N canvas 679 158 568 559 10;
-#X text 169 510 \, game_of_life_gem.pd in the examples folder;
-#X text 200 456 Grid with 4 channels;
-#X text 200 359 With one boolean argument that selects the order in
+#N canvas 679 158 568 581 10;
+#X text 169 532 \, game_of_life_gem.pd in the examples folder;
+#X text 200 478 Grid with 4 channels;
+#X text 200 381 With one boolean argument that selects the order in
 which the y dimension of the Grid will be read \, defaults to '1';
-#X text 103 510 [#to_pix];
-#X obj 22 149 #import_pix;
+#X text 103 532 [#to_pix];
 #X obj 37 128 tgl 15 0 empty empty empty 0 -6 0 8 -241291 -1 -1 0 1
 ;
 #X msg 54 127 yflip \$1;
@@ -13,58 +12,65 @@
 #X msg 391 55 create \, 1;
 #X obj 391 36 loadbang;
 #X msg 455 56 destroy;
-#X obj 22 191 #out window \, title imported_pix;
-#X text 33 169 Note : The fps is dependent on the gemwin framerate
+#X text 36 181 Note : The fps is dependent on the gemwin framerate
 ;
-#X text 100 149 <-- imports gemlist into Grids;
-#X text 200 337 Has to be a 'pix' gemlist;
-#X text 200 478 Passthrough outlet for gem chain;
+#X text 101 164 <-- imports gemlist into Grids;
+#X text 200 359 Has to be a 'pix' gemlist;
+#X text 200 500 Passthrough outlet for gem chain;
 #X obj 0 0 doc_h;
 #X obj 3 267 doc_c 0;
-#X obj 3 426 doc_o 2;
-#X obj 3 510 doc_also;
-#X obj 14 456 doc_oo 0;
-#X obj 14 478 doc_oo 1;
+#X obj 3 448 doc_o 2;
+#X obj 3 532 doc_also;
+#X obj 14 478 doc_oo 0;
+#X obj 14 500 doc_oo 1;
 #X obj 3 307 doc_i 2;
 #X obj 14 337 doc_ii 0;
-#X obj 14 394 doc_ii 1;
-#X text 200 394 dummy inlet existing only for weird reasons \, please
+#X obj 14 416 doc_ii 1;
+#X text 200 416 dummy inlet existing only for weird reasons \, please
 ignore.;
-#X obj 97 337 doc_m i0 gemlist;
-#X text 87 514 .................;
-#X obj 97 359 doc_m i0 yflip;
-#X obj 97 456 doc_m o0 grid;
-#X obj 97 478 doc_m o1 gemlist;
-#X obj 0 530 doc_f;
+#X obj 97 359 doc_m i0 gemlist;
+#X obj 97 381 doc_m i0 yflip;
+#X obj 97 478 doc_m o0 grid;
+#X obj 97 500 doc_m o1 gemlist;
+#X obj 0 552 doc_f;
 #X msg 30 82 open images/babbage.jpg;
-#X obj 97 394 doc_m i1 <none>;
+#X obj 97 416 doc_m i1 <none>;
 #X msg 186 90 open \$1;
 #X obj 186 71 openpanel;
 #X obj 186 54 bng 15 250 50 0 empty empty empty 17 7 0 10 -4034 -1
 -1;
 #X obj 30 62 loadbang;
-#X obj 22 210 fps;
-#X floatatom 22 229 5 0 0 0 - - -;
-#X obj 391 84 gemwin 60;
-#X connect 4 0 12 0;
-#X connect 5 0 6 0;
-#X connect 6 0 4 0;
-#X connect 7 0 8 0;
-#X connect 8 0 4 0;
-#X connect 9 0 41 0;
-#X connect 10 0 9 0;
-#X connect 11 0 41 0;
-#X connect 12 0 39 0;
-#X connect 20 1 3 0;
-#X connect 20 1 0 0;
-#X connect 27 1 15 0;
-#X connect 29 1 2 0;
-#X connect 30 1 1 0;
-#X connect 31 1 16 0;
-#X connect 33 0 8 0;
-#X connect 34 1 26 0;
-#X connect 35 0 8 0;
-#X connect 36 0 35 0;
-#X connect 37 0 36 0;
-#X connect 38 0 33 0;
-#X connect 39 0 40 0;
+#X obj 22 220 fps;
+#X floatatom 22 239 5 0 0 0 - - -;
+#X obj 22 201 #out window \, title imported_pix;
+#X obj 391 84 gemwin 120;
+#X msg 159 116 cast b;
+#X msg 159 135 cast i;
+#X obj 22 159 #import_pix;
+#X obj 97 337 doc_m i0 cast;
+#X text 200 337 numbertype of grid to be output;
+#X connect 4 0 5 0;
+#X connect 5 0 42 0;
+#X connect 6 0 7 0;
+#X connect 7 0 42 0;
+#X connect 8 0 39 0;
+#X connect 9 0 8 0;
+#X connect 10 0 39 0;
+#X connect 18 1 3 0;
+#X connect 18 1 0 0;
+#X connect 25 1 13 0;
+#X connect 26 1 2 0;
+#X connect 27 1 1 0;
+#X connect 28 1 14 0;
+#X connect 30 0 7 0;
+#X connect 31 1 24 0;
+#X connect 32 0 7 0;
+#X connect 33 0 32 0;
+#X connect 34 0 33 0;
+#X connect 35 0 30 0;
+#X connect 36 0 37 0;
+#X connect 38 0 36 0;
+#X connect 40 0 42 0;
+#X connect 41 0 42 0;
+#X connect 42 0 38 0;
+#X connect 43 1 44 0;

Modified: trunk/src/gem.cxx
==============================================================================
--- trunk/src/gem.cxx (original)
+++ trunk/src/gem.cxx Sun Nov  1 20:12:10 2009
@@ -118,6 +118,7 @@
 	GridFromPixHelper *helper;
 	P<BitPacking> bit_packing;
 	\attr bool yflip;
+	\attr NumberTypeE cast;
 	GridFromPix () : FObject(0,0,0,0) {RAISE("don't call this. this exists only to make GEM happy.");}
 	GridFromPix (BFObject *bself, MESSAGE) : FObject(bself,MESSAGE2) {
 		uint32 mask[4] = {0x0000ff,0x00ff00,0xff0000,0x000000};
@@ -127,6 +128,7 @@
 		helper = new GridFromPixHelper;
 		helper->boss = this;
 		bself->gemself = helper;
+		cast = int32_e;
 	}
 	virtual ~GridFromPix () {}
 	void render(GemState *state) {
@@ -135,7 +137,7 @@
 		if (im.format != GL_RGBA         ) {::post("can't produce grid from pix format %d",im.format); return;}
 		if (im.type   != GL_UNSIGNED_BYTE) {::post("can't produce grid from pix type %d",  im.type  ); return;}
 		int32 v[] = { im.ysize, im.xsize, im.csize };
-		GridOutlet out(this,0,new Dim(3,v));
+		GridOutlet out(this,0,new Dim(3,v),cast);
 		long sxc = im.xsize*im.csize;
 		long sy = v[0];
 		uint8 buf[sxc];



More information about the Gridflow-cvs mailing list