[Gridflow-cvs] [svn] commit: r5609 - in /trunk/src: fftw.cxx gem.cxx jpeg.cxx mpeg3.cxx opencv.cxx quicktimeapple.cxx quicktimehw.cxx

svn-gridflow at artengine.ca svn-gridflow at artengine.ca
Wed May 5 22:35:33 EDT 2010


Author: pboivin
Date: Wed May  5 22:35:32 2010
New Revision: 5609

Log:
passage de P<Dim> à Dim

Modified:
    trunk/src/fftw.cxx
    trunk/src/gem.cxx
    trunk/src/jpeg.cxx
    trunk/src/mpeg3.cxx
    trunk/src/opencv.cxx
    trunk/src/quicktimeapple.cxx
    trunk/src/quicktimehw.cxx

Modified: trunk/src/fftw.cxx
==============================================================================
--- trunk/src/fftw.cxx (original)
+++ trunk/src/fftw.cxx Wed May  5 22:35:32 2010
@@ -49,29 +49,29 @@
 GRID_INLET(0) {
 	if (in->nt != float32_e)                  RAISE("expecting float32");
 	if (real && sign==-1) {
-	  if (in->dim->n != 2 && in->dim->n != 3) RAISE("expecting 2 or 3 dimensions: rows,columns,channels?");
+	  if (in.dim.n != 2 && in.dim.n != 3) RAISE("expecting 2 or 3 dimensions: rows,columns,channels?");
 	} else {
-	  if (in->dim->n != 3 && in->dim->n != 4) RAISE("expecting 3 or 4 dimensions: rows,columns,channels?,complex");
-	  if (in->dim->get(in->dim->n-1)!=2)      RAISE("expecting Dim(...,2): real,imaginary (got %d)",in->dim->get(2));
+	  if (in.dim.n != 3 && in.dim.n != 4) RAISE("expecting 3 or 4 dimensions: rows,columns,channels?,complex");
+	  if (in.dim[in.dim.n-1]!=2)      RAISE("expecting Dim(...,2): real,imaginary (got %d)",in.dim[2]);
 	}
 	in->set_chunk(0);
 } GRID_FLOW {
 	if (skip==1 && real) RAISE("can't do 1-D FFT in real mode, sorry");
 	Dim dim;
-	if (!real) dim = in->dim;
+	if (!real) dim = in.dim;
 	else if (sign==-1) {
 		int v[Dim::MAX_DIM];
-		for (int i=0; i<in->dim->n; i++) v[i]=in->dim->v[i];
-		v[in->dim->n] = 2;
-		dim = Dim(in->dim->n+1,v);
-	} else dim = Dim(in->dim->n-1,in->dim->v);
-	GridOutlet out(this,0,dim,in->nt);
-	float32 *tada = (float32 *)memalign(16,dim->prod()*sizeof(float32));
-	long chans = in->dim->n>=3 ? in->dim->get(2) : 1;
+		for (int i=0; i<in.dim.n; i++) v[i]=in.dim[i];
+		v[in.dim.n] = 2;
+		dim = Dim(in.dim.n+1,v);
+	} else dim = Dim(in.dim.n-1,in.dim.v);
+	GridOutlet out(this,0,dim,in.nt);
+	float32 *tada = (float32 *)memalign(16,dim.prod()*sizeof(float32));
+	long chans = in.dim.n>=3 ? in.dim[2] : 1;
 	CHECK_ALIGN16(data,in->nt)
 	CHECK_ALIGN16(tada,in->nt)
-	if (plan && haslastdim && !lastdim.equal(in->dim) && chans!=lastchans && real==lastreal) {fftwf_destroy_plan(plan); plan=0;}
-	int v[] = {in->dim->v[0],in->dim->v[1],in->dim->n>2?in->dim->v[2]:1};
+	if (plan && haslastdim && !lastdim.equal(in.dim) && chans!=lastchans && real==lastreal) {fftwf_destroy_plan(plan); plan=0;}
+	int v[] = {in.dim[0],in.dim[1],in.dim.n>2?in.dim[2]:1};
 //	if (chans==1) {
 //		if (skip==0) plan = fftwf_plan_dft_2d(v[0],v[1],data,tada,sign,0);
 //		if (skip==1) plan = fftwf_plan_many_dft(1,&v[1],v[0],data,0,1,v[1],tada,0,1,v[1],sign,0);
@@ -79,7 +79,7 @@
 	if (skip==0) {
 		//plan = fftwf_plan_dft_2d(v[0],v[1],data,tada,sign,0);
 		if (!plan) {
-			int embed[] = {dim->v[0],dim->v[1]};
+			int embed[] = {dim[0],dim[1]};
 			if (!real)         {plan=fftwf_plan_many_dft(    2,&v[0],chans,C(data),0    ,chans,1,C(tada),0    ,chans,1,sign,0);}
 			else if (sign==-1) {plan=fftwf_plan_many_dft_r2c(2,&v[0],chans,  data ,embed,chans,1,C(tada),embed,chans,1,0);}
 			else               {plan=fftwf_plan_many_dft_c2r(2,&v[0],chans,C(data),embed,chans,1,  tada ,embed,chans,1,0);}
@@ -105,9 +105,9 @@
 			}
 		}
 	}
-	out.send(out.dim->prod(),tada);
+	out.send(out.dim.prod(),tada);
 	free(tada);
-	lastdim=in->dim; lastchans=chans; lastreal=real;
+	lastdim=in.dim; lastchans=chans; lastreal=real;
 } GRID_END
 \end class {install("#fft",1,1);}
 void startup_fftw () {

Modified: trunk/src/gem.cxx
==============================================================================
--- trunk/src/gem.cxx (original)
+++ trunk/src/gem.cxx Wed May  5 22:35:32 2010
@@ -155,16 +155,16 @@
 //#define NTIMES(FOO) for (; N>=4; N-=4) {FOO FOO FOO FOO} for (; N; N--) {FOO}
 
 GRID_INLET(1) {
-	if (in->dim->n != 3) RAISE("expecting 3 dimensions: rows,columns,channels");
-	int c = in->dim->get(2);
-	if (c!=3 && c!=4)    RAISE("expecting 3 or 4 channels (got %d)",in->dim->get(2));
+	if (in.dim.n != 3) RAISE("expecting 3 dimensions: rows,columns,channels");
+	int c = in.dim[2];
+	if (c!=3 && c!=4)    RAISE("expecting 3 or 4 channels (got %d)",in.dim[2]);
 	in->set_chunk(1);
 	imageStruct &im = m_pixBlock.image;
 	im.clear();
-	im.ysize = in->dim->get(0);
-	im.xsize = in->dim->get(1);
+	im.ysize = in.dim[0];
+	im.xsize = in.dim[1];
 	im.type = GL_UNSIGNED_BYTE;
-	switch (in->dim->get(2)) {
+	switch (in.dim[2]) {
 	    case 1: im.csize = 1; im.format = GL_LUMINANCE; break;
 	    case 3: im.csize = 4; im.format = GEM_RGBA;     break;
 	    case 4: im.csize = 4; im.format = GEM_RGBA;     break;
@@ -174,8 +174,8 @@
 } GRID_FLOW {
 	uint8 *buf = (uint8 *)m_pixBlock.image.data;
 	long sxc = in.dim.prod(1);
-	long sx = in->dim->v[1];
-	long chans = in->dim->get(2);
+	long sx = in.dim[1];
+	long chans = in.dim[2];
 	imageStruct &im = m_pixBlock.image;
 	im.upsidedown = !yflip;
 	for (long y=dex/sxc; n; data+=sxc, n-=sxc, y++) {

Modified: trunk/src/jpeg.cxx
==============================================================================
--- trunk/src/jpeg.cxx (original)
+++ trunk/src/jpeg.cxx Wed May  5 22:35:32 2010
@@ -52,26 +52,26 @@
 };
 
 GRID_INLET(0) {
-	if (in->dim->n!=3)      RAISE("expecting 3 dimensions: rows,columns,channels");
-	if (in->dim->get(2)!=3) RAISE("expecting 3 channels (got %d)",in->dim->get(2));
+	if (in.dim.n!=3)      RAISE("expecting 3 dimensions: rows,columns,channels");
+	if (in.dim[2]!=3) RAISE("expecting 3 channels (got %d)",in.dim[2]);
 	in->set_chunk(1);
 	cjpeg.err = jpeg_std_error(&jerr);
 	jpeg_create_compress(&cjpeg);
 	jpeg_stdio_dest(&cjpeg,f);
-	cjpeg.image_width = in->dim->get(1);
-	cjpeg.image_height = in->dim->get(0);
+	cjpeg.image_width = in.dim[1];
+	cjpeg.image_height = in.dim[0];
 	cjpeg.input_components = 3;
 	cjpeg.in_color_space = JCS_RGB;
 	jpeg_set_defaults(&cjpeg);
 	jpeg_set_quality(&cjpeg,quality,false);
 	jpeg_start_compress(&cjpeg,TRUE);
 } GRID_FLOW {
-	int rowsize = in->dim->get(1)*in->dim->get(2);
-	int rowsize2 = in->dim->get(1)*3;
+	int rowsize = in.dim[1]*in.dim[2];
+	int rowsize2 = in.dim[1]*3;
 	uint8 row[rowsize2];
 	uint8 *rows[1] = {row};
 	while (n) {
-		bit_packing->pack(in->dim->get(1),data,row);
+		bit_packing->pack(in.dim[1],data,row);
 		jpeg_write_scanlines(&cjpeg,rows,1);
 		n-=rowsize; data+=rowsize;
 	}

Modified: trunk/src/mpeg3.cxx
==============================================================================
--- trunk/src/mpeg3.cxx (original)
+++ trunk/src/mpeg3.cxx Wed May  5 22:35:32 2010
@@ -70,7 +70,7 @@
 	for (int i=0; i<sy; i++) rows[i]=buf+i*sx*channels;
 	mpeg3_read_frame(mpeg,rows,0,0,sx,sy,sx,sy,MPEG3_RGB888,track);
 	GridOutlet out(this,0,Dim(sy,sx,channels),cast);
-	int bs = out.dim->prod(1);
+	int bs = out.dim.prod(1);
 	for(int y=0; y<sy; y++) out.send(bs,buf+channels*sx*y);
 	DELBUF(buf);
 //	return INT2NUM(nframe);

Modified: trunk/src/opencv.cxx
==============================================================================
--- trunk/src/opencv.cxx (original)
+++ trunk/src/opencv.cxx Wed May  5 22:35:32 2010
@@ -145,10 +145,10 @@
 
 IplImage *cvImageGrid(PtrGrid g /*, CvMode mode */) {
 	Dim &d = g->dim;
-	if (d->n!=3) RAISE("expected 3 dimensions, got %s",d->to_s());
+	if (d.n!=3) RAISE("expected 3 dimensions, got %s",d.to_s());
 	int channels=g->dim[2];
 	if (channels>64) RAISE("too many channels. max 64, got %d",channels);
-	CvSize size = {d->v[1],d->v[0]};
+	CvSize size = {d[1],d[0]};
 	IplImage *a = cvCreateImageHeader(size,ipl_eltype(g->nt),channels);
 	cvSetData(a,g->data,g->dim.prod(1)*(number_type_table[g->nt].size/8));
 	return a;

Modified: trunk/src/quicktimeapple.cxx
==============================================================================
--- trunk/src/quicktimeapple.cxx (original)
+++ trunk/src/quicktimeapple.cxx Wed May  5 22:35:32 2010
@@ -186,7 +186,7 @@
 	if (in.dim.n != 3)
 		RAISE("expecting 3 dimensions: rows,columns,channels");
 	if (in.dim.get(2) != 3)
-		RAISE("expecting 3 channels (got %d)",in->dim->get(2));
+		RAISE("expecting 3 channels (got %d)",in.dim[2]);
 	in->set_chunk(0);
 } GRID_FLOW {
 } GRID_FINISH {

Modified: trunk/src/quicktimehw.cxx
==============================================================================
--- trunk/src/quicktimehw.cxx (original)
+++ trunk/src/quicktimehw.cxx Wed May  5 22:35:32 2010
@@ -129,7 +129,7 @@
 	case 32: colorspace=BC_RGBA8888; break;
 	default: post("strange quicktime. ask matju."); break;
 	}
-	if (doforce) {sy = force->get(0); sx = force->get(1);}
+	if (doforce) {sy = force[0]; sx = force[1];}
 	uint8 buf[sy*sx*channels];
 	uint8 *rows[sy]; for (int i=0; i<sy; i++) rows[i]=buf+i*sx*channels;
 	quicktime_decode_scaled(anim,0,0,sx,sy,sx,sy,colorspace,rows,track);



More information about the Gridflow-cvs mailing list