[Gridflow-cvs] [svn] commit: r5604 - in /trunk/src: opencv.cxx png.cxx quicktimeapple.cxx quicktimecamera.cxx quicktimehw.cxx sdl.cxx v4l2.cxx videodev.cxx x11.cxx

svn-gridflow at artengine.ca svn-gridflow at artengine.ca
Wed May 5 21:56:41 EDT 2010


Author: pboivin
Date: Wed May  5 21:56:39 2010
New Revision: 5604

Log:
passage de P<Dim> à Dim

Modified:
    trunk/src/opencv.cxx
    trunk/src/png.cxx
    trunk/src/quicktimeapple.cxx
    trunk/src/quicktimecamera.cxx
    trunk/src/quicktimehw.cxx
    trunk/src/sdl.cxx
    trunk/src/v4l2.cxx
    trunk/src/videodev.cxx
    trunk/src/x11.cxx

Modified: trunk/src/opencv.cxx
==============================================================================
--- trunk/src/opencv.cxx (original)
+++ trunk/src/opencv.cxx Wed May  5 21:56:39 2010
@@ -120,37 +120,37 @@
 
 CvArr *cvGrid(PtrGrid g, CvMode mode, int reqdims=-1) {
 	int channels=1;
-	int dims=g->dim->n;
+	int dims=g->dim.n;
 	//post("mode=%d",(int)mode);
-	if (mode==cv_mode_channels && g->dim->n==0) RAISE("CV: channels dimension required for 'mode channels'");
-	if ((mode==cv_mode_auto && g->dim->n>=3) || mode==cv_mode_channels) channels=g->dim->v[--dims];
+	if (mode==cv_mode_channels && g->dim.n==0) RAISE("CV: channels dimension required for 'mode channels'");
+	if ((mode==cv_mode_auto && g->dim.n>=3) || mode==cv_mode_channels) channels=g->dim[--dims];
 	if (channels>64) RAISE("CV: too many channels. max 64, got %d",channels);
 	//post("channels=%d dims=%d nt=%d",channels,dims,g->nt);
 	//post("bits=%d",number_type_table[g->nt].size);
-	//if (dims==2) return cvMat(g->dim->v[0],g->dim->v[1],cv_eltype(g->nt),g->data);
+	//if (dims==2) return cvMat(g->dim[0],g->dim[1],cv_eltype(g->nt),g->data);
 	if (reqdims>=0 && reqdims!=dims) RAISE("CV: wrong number of dimensions. expected %d, got %d", reqdims, dims);
 	if (dims==2) {
-		CvMat *a = cvCreateMatHeader(g->dim->v[0],g->dim->v[1],CV_MAKETYPE(cv_eltype(g->nt),channels));
-		cvSetData(a,g->data,g->dim->prod(1)*(number_type_table[g->nt].size/8));
+		CvMat *a = cvCreateMatHeader(g->dim[0],g->dim[1],CV_MAKETYPE(cv_eltype(g->nt),channels));
+		cvSetData(a,g->data,g->dim.prod(1)*(number_type_table[g->nt].size/8));
 		return a;
 	}
 	if (dims==1) {
-		CvMat *a = cvCreateMatHeader(g->dim->v[0],           1,CV_MAKETYPE(cv_eltype(g->nt),channels));
-		cvSetData(a,g->data,g->dim->prod(1)*(number_type_table[g->nt].size/8));
+		CvMat *a = cvCreateMatHeader(g->dim[0],           1,CV_MAKETYPE(cv_eltype(g->nt),channels));
+		cvSetData(a,g->data,g->dim.prod(1)*(number_type_table[g->nt].size/8));
 		return a;
 	}
-	RAISE("unsupported number of dimensions (got %d)",g->dim->n);
+	RAISE("unsupported number of dimensions (got %d)",g->dim.n);
 	//return 0;
 }
 
 IplImage *cvImageGrid(PtrGrid g /*, CvMode mode */) {
 	Dim &d = g->dim;
 	if (d->n!=3) RAISE("expected 3 dimensions, got %s",d->to_s());
-	int channels=g->dim->v[2];
+	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]};
 	IplImage *a = cvCreateImageHeader(size,ipl_eltype(g->nt),channels);
-	cvSetData(a,g->data,g->dim->prod(1)*(number_type_table[g->nt].size/8));
+	cvSetData(a,g->data,g->dim.prod(1)*(number_type_table[g->nt].size/8));
 	return a;
 }
 
@@ -215,11 +215,11 @@
 GRID_INLET(0) {
 	snap_backstore(r);
 	SAME_TYPE(in,r);
-	if (!in->dim->equal(r->dim)) RAISE("dimension mismatch: left:%s right:%s",in->dim->to_s(),r->dim->to_s());
-	in->set_chunk(0);
-} GRID_FLOW {
-	PtrGrid l = new Grid(in->dim,(T *)data);
-	PtrGrid o = new Grid(in->dim,in->nt);
+	if (!in->dim.equal(r->dim)) RAISE("dimension mismatch: left:%s right:%s",in.dim.to_s(),r->dim.to_s());
+	in->set_chunk(0);
+} GRID_FLOW {
+	PtrGrid l = new Grid(in.dim,(T *)data);
+	PtrGrid o = new Grid(in.dim,in.nt);
 	CvArr *a = cvGrid(l,mode);
 	CvArr *b = cvGrid(r,mode);
 	CvArr *c = cvGrid(o,mode);
@@ -227,8 +227,8 @@
 	cvRelease(&a);
 	cvRelease(&b);
 	cvRelease(&c);
-	out = new GridOutlet(this,0,in->dim,in->nt);
-	out->send(o->dim->prod(),(T *)o->data);
+	out = new GridOutlet(this,0,in.dim,in.nt);
+	out->send(o->dim.prod(),(T *)o->data);
 } GRID_END
 GRID_INPUT2(1,r) {} GRID_END
 \end class {}
@@ -256,21 +256,21 @@
 	\grin 0
 };
 GRID_INLET(0) {
-	if (in->dim->n!=2) RAISE("should have 2 dimensions");
-	if (in->dim->v[0] != in->dim->v[1]) RAISE("matrix should be square");
+	if (in.dim.n!=2) RAISE("should have 2 dimensions");
+	if (in.dim[0] != in.dim[1]) RAISE("matrix should be square");
 	in->set_chunk(0);
 } GRID_FLOW {
 	//post("l=%p, r=%p", &*l, &*r);
-	PtrGrid l = new Grid(in->dim,(T *)data);
-	PtrGrid o = new Grid(in->dim,in->nt);
+	PtrGrid l = new Grid(in.dim,(T *)data);
+	PtrGrid o = new Grid(in.dim,in.nt);
 	CvArr *a = cvGrid(l,mode);
 	CvArr *c = cvGrid(o,mode);
 	//post("a=%p, b=%p", a, b);
 	cvInvert(a,c);
 	cvRelease(&a);
 	cvRelease(&c);
-	out = new GridOutlet(this,0,in->dim,in->nt);
-	out->send(o->dim->prod(),(T *)o->data);
+	out = new GridOutlet(this,0,in.dim,in.nt);
+	out->send(o->dim.prod(),(T *)o->data);
 } GRID_END
 \end class {install("cv/#Invert",1,1);}
 
@@ -279,14 +279,14 @@
 	\constructor () {}
 };
 GRID_INLET(0) {
-	if (in->dim->n!=2) RAISE("should have 2 dimensions");
-	if (in->dim->v[0] != in->dim->v[1]) RAISE("matrix should be square");
-	in->set_chunk(0);
-} GRID_FLOW {
-	PtrGrid l = new Grid(in->dim,(T *)data);
-	PtrGrid o0 = new Grid(in->dim,in->nt);
-	PtrGrid o1 = new Grid(in->dim,in->nt);
-	PtrGrid o2 = new Grid(in->dim,in->nt);
+	if (in.dim.n!=2) RAISE("should have 2 dimensions");
+	if (in.dim[0] != in.dim[1]) RAISE("matrix should be square");
+	in->set_chunk(0);
+} GRID_FLOW {
+	PtrGrid l = new Grid(in.dim,(T *)data);
+	PtrGrid o0 = new Grid(in.dim,in.nt);
+	PtrGrid o1 = new Grid(in.dim,in.nt);
+	PtrGrid o2 = new Grid(in.dim,in.nt);
 	CvArr *a = cvGrid(l,mode);
 	CvArr *c0 = cvGrid(o0,mode);
 	CvArr *c1 = cvGrid(o1,mode);
@@ -296,9 +296,9 @@
 	cvRelease(&c0);
 	cvRelease(&c1);
 	cvRelease(&c2);
-	out = new GridOutlet(this,2,in->dim,in->nt); out->send(o2->dim->prod(),(T *)o2->data);
-	out = new GridOutlet(this,1,in->dim,in->nt); out->send(o1->dim->prod(),(T *)o1->data);
-	out = new GridOutlet(this,0,in->dim,in->nt); out->send(o0->dim->prod(),(T *)o0->data);
+	out = new GridOutlet(this,2,in.dim,in.nt); out->send(o2->dim.prod(),(T *)o2->data);
+	out = new GridOutlet(this,1,in.dim,in.nt); out->send(o1->dim.prod(),(T *)o1->data);
+	out = new GridOutlet(this,0,in.dim,in.nt); out->send(o0->dim.prod(),(T *)o0->data);
 } GRID_END
 \end class {install("cv/#SVD",1,3);}
 
@@ -321,11 +321,11 @@
 GRID_INLET(0) {
 	in->set_chunk(0);
 } GRID_FLOW {
-	PtrGrid l = new Grid(in->dim,in->nt); COPY((T *)*l,data,in.dim.prod());
+	PtrGrid l = new Grid(in.dim,in.nt); COPY((T *)*l,data,in.dim.prod());
 	IplImage *img = cvImageGrid(l);
 	cvEllipse(img,center,axes,angle,start_angle,end_angle,color,thickness,line_type,shift);
 	cvReleaseImageHeader(&img);
-	out = new GridOutlet(this,0,in->dim,in->nt); out->send(in.dim.prod(),(T *)*l);
+	out = new GridOutlet(this,0,in.dim,in.nt); out->send(in.dim.prod(),(T *)*l);
 } GRID_END
 \end class {install("cv/#Ellipse",1,2);}
 
@@ -340,7 +340,7 @@
 GRID_INLET(0) {
 	in->set_chunk(0);
 } GRID_FLOW {
-	PtrGrid l = new Grid(in->dim,(T *)data); CvArr *a = cvGrid(l,mode);
+	PtrGrid l = new Grid(in.dim,(T *)data); CvArr *a = cvGrid(l,mode);
 	CvSeq *seq = cvApproxPoly(a,sizeof(CvMat),storage,CV_POLY_APPROX_DP,accuracy,closed);
 	seq=seq; //blah
 } GRID_END
@@ -441,7 +441,7 @@
 GRID_INLET(0) {
 	in->set_chunk(0);
 } GRID_FLOW {
-	PtrGrid l = new Grid(in->dim,(T *)data);
+	PtrGrid l = new Grid(in.dim,(T *)data);
 	IplImage *img = cvImageGrid(l);
 	CvSeq *ret = cvHaarDetectObjects(img,cascade,storage,scale_factor,min_neighbors,flags);
 	int n = ret ? ret->total : 0;
@@ -473,7 +473,7 @@
 //for (CvTypeInfo *t = cvFirstType(); t; t=t->next) post("type %s",t->type_name);
 
 GRID_INLET(0) {
-	if (in->dim->n<1) RAISE("should have at least 1 dimension");
+	if (in.dim.n<1) RAISE("should have at least 1 dimension");
 	in->set_chunk(0);
 } GRID_FLOW {
 	int32 v[] = {in.dim.prod(0)/in.dim.prod(-1),in.dim.prod(-1)};
@@ -482,10 +482,10 @@
 	PtrGrid o = new Grid(Dim(1,v),int32_e);
 	CvArr *c = (CvMat *)cvGrid(o,mode);
 	cvKMeans2(a,numClusters,c,termcrit);
-	int w[in->dim->n];
-	COPY(w,in->dim->v,in->dim->n);
-	w[in->dim->n-1] = 1;
-	out = new GridOutlet(this,0,Dim(in->dim->n,w));
+	int w[in.dim.n];
+	COPY(w,in.dim.v,in.dim.n);
+	w[in.dim.n-1] = 1;
+	out = new GridOutlet(this,0,Dim(in.dim.n,w));
 	out->send(v[0],(int32 *)*o);
 	cvRelease(&a);
 	cvRelease(&c);
@@ -508,14 +508,14 @@
 GRID_INLET(0) {
 	in->set_chunk(0);
 } GRID_FLOW {
-	PtrGrid l = new Grid(in->dim,(T *)data);
+	PtrGrid l = new Grid(in.dim,(T *)data);
 	CvArr *a = (CvMat *)cvGrid(l,mode,2);
-	PtrGrid o = new Grid(in->dim,float32_e);
+	PtrGrid o = new Grid(in.dim,float32_e);
 	CvArr *c = (CvMat *)cvGrid(o,mode);
 	cvCornerHarris(a,c,block_size,aperture_size,k);
 	cvRelease(&a);
 	cvRelease(&c);
-	out = new GridOutlet(this,0,in->dim,in->nt); out->send(o->dim->prod(),(T *)o->data);
+	out = new GridOutlet(this,0,in.dim,in.nt); out->send(o->dim.prod(),(T *)o->data);
 } GRID_END
 
 \end class {install("cv/#CornerHarris",1,1);}

Modified: trunk/src/png.cxx
==============================================================================
--- trunk/src/png.cxx (original)
+++ trunk/src/png.cxx Wed May  5 21:56:39 2010
@@ -43,8 +43,8 @@
 };
 
 GRID_INLET(0) {
-	if (in->dim->n!=3) RAISE("expecting 3 dimensions: rows,columns,channels");
-	int sc = in->dim->get(2);
+	if (in.dim.n!=3) RAISE("expecting 3 dimensions: rows,columns,channels");
+	int sc = in.dim[2];
 	if (sc<1 || sc>4)  RAISE("expecting 1 to 4 channels (got %d)",sc);
 	in->set_chunk(0);
 } GRID_FLOW {
@@ -60,13 +60,13 @@
 		PNG_COLOR_TYPE_RGB,
 		PNG_COLOR_TYPE_RGBA,
 	};
-	int sc = in->dim->v[2];
-	png_set_IHDR(png,info,in->dim->v[1],in->dim->v[0],8, color_type[sc-1],
+	int sc = in.dim[2];
+	png_set_IHDR(png,info,in.dim[1],in.dim[0],8, color_type[sc-1],
                  PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT);
 	png_write_info(png,info);
 	png_set_packing(png);
 // this would have been the GRID_FLOW section
-	int rowsize = in->dim->get(1)*sc;
+	int rowsize = in.dim[1]*sc;
 	uint8 row[rowsize];
 	while (n) {
 		for (int i=0; i<rowsize; i++) row[i]=data[i];

Modified: trunk/src/quicktimeapple.cxx
==============================================================================
--- trunk/src/quicktimeapple.cxx (original)
+++ trunk/src/quicktimeapple.cxx Wed May  5 21:56:39 2010
@@ -71,9 +71,9 @@
 		SetMovieBox(movie, &r);
 		dim = Dim(r.bottom-r.top, r.right-r.left, 4);
 		SetMoviePlayHints(movie, hintsHighQuality, hintsHighQuality);
-		buffer = new uint8[dim->prod()];
-		buf2 = new uint8[dim->prod()];
-		err = QTNewGWorldFromPtr(&gw, k32ARGBPixelFormat, &r, NULL, NULL, 0, buffer, dim->prod(1));
+		buffer = new uint8[dim.prod()];
+		buf2 = new uint8[dim.prod()];
+		err = QTNewGWorldFromPtr(&gw, k32ARGBPixelFormat, &r, NULL, NULL, 0, buffer, dim.prod(1));
 		if (err) ERR("QTNewGWorldFromPtr");
 		_0_colorspace(0,0,gensym("rgba"));
 		return;
@@ -151,7 +151,7 @@
 			out.send(bs,b2);
 		}
 	} else if (cs=="rgb") {
-		int n = dim->prod()/3;
+		int n = dim.prod()/3;
 		/*for (int i=0,j=0; i<n; i+=4,j+=3) {
 			buf2[j+0] = buf[i+0];
 			buf2[j+1] = buf[i+1];
@@ -159,9 +159,9 @@
 		}*/
 		//bit_packing3->unpack(sx,buf+y*sx*bit_packing3->bytes,rgb);
 		bit_packing3->unpack(n,buf,buf2);
-		out.send(dim->prod(),buf2);
+		out.send(dim.prod(),buf2);
 	} else if (cs=="rgba") { // does this really work on PPC ?
-		int n = dim->prod()/4;
+		int n = dim.prod()/4;
 		if (is_le()) {
 			for (int i=0; i<n; i++) ((uint32 *)buf2)[i] = (((uint32 *)buf)[i] >> 8) | 0xff000000;
 
@@ -169,7 +169,7 @@
 			for (int i=0; i<n; i++) ((uint32 *)buf2)[i] = (((uint32 *)buf)[i] << 8) | 0x000000ff;
 		}
 		
-		out.send(dim->prod(),buf2);
+		out.send(dim.prod(),buf2);
 	} else
 		RAISE("colorspace problem");
 
@@ -183,9 +183,9 @@
 GRID_INLET(0) {
 	RAISE("Unimplemented. Sorry.");
 //!@#$
-	if (in->dim->n != 3)
+	if (in.dim.n != 3)
 		RAISE("expecting 3 dimensions: rows,columns,channels");
-	if (in->dim->get(2) != 3)
+	if (in.dim.get(2) != 3)
 		RAISE("expecting 3 channels (got %d)",in->dim->get(2));
 	in->set_chunk(0);
 } GRID_FLOW {

Modified: trunk/src/quicktimecamera.cxx
==============================================================================
--- trunk/src/quicktimecamera.cxx (original)
+++ trunk/src/quicktimecamera.cxx Wed May  5 21:56:39 2010
@@ -273,15 +273,15 @@
 	vdc = SGGetVideoDigitizerComponent(m_vc);
 
 	int sy = dim[0], sx = dim[1], sc = dim[2];
-	int dataSize = dim->prod();
+	int dataSize = dim.prod();
 	buf  = new uint8[sy*sx*4];
 	buf2 = new uint8[sy*sx*4];
 	m_rowBytes = sx*4;
 	e=QTNewGWorldFromPtr (&m_srcGWorld,k32ARGBPixelFormat,&rect,NULL,NULL,0,buf,m_rowBytes);
 	if (0/*yuv*/) {
-		int dataSize = dim->prod()*2/4;
+		int dataSize = dim.prod()*2/4;
 		buf = new uint8[dataSize];
-		m_rowBytes = dim->prod(1)*2/4;
+		m_rowBytes = dim.prod(1)*2/4;
 		e=QTNewGWorldFromPtr (&m_srcGWorld,k422YpCbCr8CodecType,&rect,NULL,NULL,0,buf,m_rowBytes);
 	}
 	if (e!=noErr) RAISE("error #%d at QTNewGWorldFromPtr",e);
@@ -397,7 +397,7 @@
 			out.send(bs,b2);
 		}
 	} else if (cs=="rgb") {
-		int n = dim->prod()/3;
+		int n = dim.prod()/3;
 		/*for (int i=0,j=0; i<n; i+=4,j+=3) {
 			buf2[j+0] = buf[i+0];
 			buf2[j+1] = buf[i+1];
@@ -405,15 +405,15 @@
 		}*/
 		//bit_packing3->unpack(sx,buf+y*sx*bit_packing3->bytes,rgb);
 		bit_packing3->unpack(n,buf,buf2);
-		out.send(dim->prod(),buf2);
+		out.send(dim.prod(),buf2);
 	} else if (cs=="rgba") {
-		int n = dim->prod()/4;
+		int n = dim.prod()/4;
 		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);
+		out.send(dim.prod(),buf2);
 	} else
 		RAISE("colorspace problem");
 	SGIdle(m_sg);

Modified: trunk/src/quicktimehw.cxx
==============================================================================
--- trunk/src/quicktimehw.cxx (original)
+++ trunk/src/quicktimehw.cxx Wed May  5 21:56:39 2010
@@ -154,21 +154,21 @@
 	// first frame: have to do setup
 	dim = Dim(height,width,3);
 	gotdim = true;
-	quicktime_set_video(anim,1,dim->get(1),dim->get(0),m_framerate,m_codec);
+	quicktime_set_video(anim,1,dim[1],dim[0],m_framerate,m_codec);
 	quicktime_set_cmodel(anim,colorspace);
 }
 
 GRID_INLET(0) {
-	if (in->dim->n != 3)           RAISE("expecting 3 dimensions: rows,columns,channels");
-	if (in->dim->get(2)!=channels) RAISE("expecting %d channels (got %d)",channels,in->dim->get(2));
+	if (in.dim.n != 3)           RAISE("expecting 3 dimensions: rows,columns,channels");
+	if (in.dim[2]!=channels) RAISE("expecting %d channels (got %d)",channels,in.dim[2]);
 	in->set_chunk(0);
 	if (gotdim) {
-		if (!dim->equal(in->dim)) RAISE("all frames should be same size");
+		if (!dim.equal(in.dim)) RAISE("all frames should be same size");
 	} else {
 		// first frame: have to do setup
-		dim = in->dim;
+		dim = in.dim;
 		// this is a duplicate: see _0_size. what should I do with that?
-		quicktime_set_video(anim,1,dim->get(1),dim->get(0),m_framerate,m_codec);
+		quicktime_set_video(anim,1,dim[1],dim[0],m_framerate,m_codec);
 		quicktime_set_cmodel(anim,colorspace);
 		quicktime_set_depth(anim,8*channels,track);
 	}

Modified: trunk/src/sdl.cxx
==============================================================================
--- trunk/src/sdl.cxx (original)
+++ trunk/src/sdl.cxx Wed May  5 21:56:39 2010
@@ -184,16 +184,16 @@
 void FormatSDL_call(FormatSDL *self) {self->call();}
 
 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: red,green,blue (got %d)",in->dim->get(2));
-	int sx = in->dim->get(1), osx = dim->get(1);
-	int sy = in->dim->get(0), osy = dim->get(0);
+	if (in.dim.n != 3) RAISE("expecting 3 dimensions: rows,columns,channels");
+	if (in.dim[2] != 3) RAISE("expecting 3 channels: red,green,blue (got %d)",in.dim[2]);
+	int sx = in.dim[1], osx = dim[1];
+	int sy = in.dim[0], osy = dim[0];
 	in->set_chunk(1);
 	if (sx!=osx || sy!=osy) resize_window(sx,sy);
 } GRID_FLOW {
 	int bypl = screen->pitch;
 	int sxc = in.dim.prod(1);
-	int sx = in->dim->get(1);
+	int sx = in.dim[1];
 	int y = dex/sxc;
 	if (SDL_MUSTLOCK(screen)) if (SDL_LockSurface(screen) < 0) return; //???
 	for (; n>0; y++, data+=sxc, n-=sxc) {
@@ -202,7 +202,7 @@
 	}
 	if (SDL_MUSTLOCK(screen)) SDL_UnlockSurface(screen);
 } GRID_FINISH {
-	SDL_UpdateRect(screen,0,0,in->dim->get(1),in->dim->get(0));
+	SDL_UpdateRect(screen,0,0,in.dim[1],in.dim[0]);
 } GRID_END
 
 \def 0 setcursor  (int shape) {SDL_ShowCursor(SDL_ENABLE);}

Modified: trunk/src/v4l2.cxx
==============================================================================
--- trunk/src/v4l2.cxx (original)
+++ trunk/src/v4l2.cxx Wed May  5 21:56:39 2010
@@ -211,7 +211,7 @@
 		t_atom a[2];
 		//SETFLOAT(a+0,cap.minheight); SETFLOAT(a+1,cap.minwidth); outlet_anything(outlets[0],gensym("minsize"),2,a);
 		//SETFLOAT(a+0,cap.maxheight); SETFLOAT(a+1,cap.maxwidth); outlet_anything(outlets[0],gensym("maxsize"),2,a);
-		SETFLOAT(a+0,dim->v[0]); SETFLOAT(a+1,dim->v[1]); outlet_anything(outlets[0],gensym("size"),2,a);
+		SETFLOAT(a+0,dim[0]); SETFLOAT(a+1,dim[1]); outlet_anything(outlets[0],gensym("size"),2,a);
 		SETSYMBOL(a,gensym("mmap")); outlet_anything(outlets[0],gensym("transfer"),1,a);
 	}
 }
@@ -267,8 +267,8 @@
 	//if (queuesize>=vmbuf.frames) RAISE("queue is full (vmbuf.frames=%d)",vmbuf.frames);
 	//vmmap.frame = queue[queuesize++] = next_frame;
 	//vmmap.format = vp.palette;
-	//vmmap.width  = dim->get(1);
-	//vmmap.height = dim->get(0);
+	//vmmap.width  = dim[1];
+	//vmmap.height = dim[0];
 	struct v4l2_buffer vbuf;
 	memset(&vbuf, 0, sizeof(buf)); //CLEAR(vbuf);
 	vbuf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
@@ -285,9 +285,9 @@
 	string cs = colorspace->s_name;
 	int downscale = cs=="magic";
 	/* picture is converted here. */
-	int sy = dim->get(0);
-	int sx = dim->get(1);
-	int bs = dim->prod(1); if (downscale) bs/=2;
+	int sy = dim[0];
+	int sx = dim[1];
+	int bs = dim.prod(1); if (downscale) bs/=2;
 	uint8 b2[bs];
 	//post("frame_finished sy=%d sx=%d bs=%d, vp.palette = %d; colorspace = %s",sy,sx,bs,vp.palette,cs.data());
 	int palette = fmt.fmt.pix.pixelformat;
@@ -481,7 +481,7 @@
 		bit_packing4 = new BitPacking(is_le(),3,4,masks);
 	} // else RAISE("huh?");
 	this->colorspace=gensym(c.data());
-	dim = Dim(dim->v[0],dim->v[1],c=="y"?1:3);
+	dim = Dim(dim[0],dim[1],c=="y"?1:3);
 }
 
 \def int auto_gain()        {return v4l2_get_control(fd,V4L2_CID_AUTOGAIN);}

Modified: trunk/src/videodev.cxx
==============================================================================
--- trunk/src/videodev.cxx (original)
+++ trunk/src/videodev.cxx Wed May  5 21:56:39 2010
@@ -320,14 +320,14 @@
 		string foo = choice_to_s(vp.palette,COUNT(video_palette_choice),video_palette_choice);
 		SETSYMBOL(a,gensym(foo.data()));
 		outlet_anything(outlets[0],gensym("palette"),1,a);
-		SETFLOAT(a+0,dim->v[0]); SETFLOAT(a+1,dim->v[1]); outlet_anything(outlets[0],gensym("size"),    2,a);
+		SETFLOAT(a+0,dim[0]); SETFLOAT(a+1,dim[1]); outlet_anything(outlets[0],gensym("size"),    2,a);
 	}
 }
 
 \def 0 size (int sy, int sx) {
 	VideoWindow grab_win;
 	// !@#$ bug here: won't flush the frame queue
-	dim = Dim(sy,sx,dim->v[2]);
+	dim = Dim(sy,sx,dim[2]);
 	WIOCTL(fd, VIDIOCGWIN, &grab_win);
 	if (debug) gfpost(&grab_win);
 	grab_win.clipcount = 0;
@@ -354,8 +354,8 @@
 	if (queuesize>=vmbuf.frames) RAISE("queue is full (vmbuf.frames=%d)",vmbuf.frames);
 	vmmap.frame = queue[queuesize++] = next_frame;
 	vmmap.format = vp.palette;
-	vmmap.width  = dim->get(1);
-	vmmap.height = dim->get(0);
+	vmmap.width  = dim[1];
+	vmmap.height = dim[0];
 	WIOCTL2(fd, VIDIOCMCAPTURE, &vmmap);
 	//gfpost(&vmmap);
 	next_frame = (next_frame+1) % vmbuf.frames;
@@ -365,9 +365,9 @@
 	string cs = colorspace->s_name;
 	int downscale = cs=="magic";
 	/* picture is converted here. */
-	int sy = dim->get(0);
-	int sx = dim->get(1);
-	int bs = dim->prod(1); if (downscale) bs/=2;
+	int sy = dim[0];
+	int sx = dim[1];
+	int bs = dim.prod(1); if (downscale) bs/=2;
 	uint8 b2[bs];
 	//post("frame_finished sy=%d sx=%d bs=%d, vp.palette = %d; colorspace = %s",sy,sx,bs,vp.palette,cs.data());
 	GridOutlet out(this,0,cs=="magic"?Dim(sy>>downscale,sx>>downscale,3):dim,cast);
@@ -599,7 +599,7 @@
 	if (palette==VIDEO_PALETTE_RGB24 ) RGB(0xff0000,0x00ff00,0x0000ff,3); else
 	if (palette==VIDEO_PALETTE_RGB32 ) RGB(0xff0000,0x00ff00,0x0000ff,4);
 	this->colorspace=gensym(c.data());
-	dim = Dim(dim->v[0],dim->v[1],c=="y"?1:c=="rgba"?4:3);
+	dim = Dim(dim[0],dim[1],c=="y"?1:c=="rgba"?4:3);
 }
 
 \def bool pwc ()         {return use_pwc;}

Modified: trunk/src/x11.cxx
==============================================================================
--- trunk/src/x11.cxx (original)
+++ trunk/src/x11.cxx Wed May  5 21:56:39 2010
@@ -312,7 +312,7 @@
 
 void FormatX11::show_section(int x, int y, int sx, int sy) {
 	if ((mode&2)==0) return;
-	int zy=dim->get(0), zx=dim->get(1);
+	int zy=dim[0], zx=dim[1];
 	if (y>zy||x>zx) return;
 	if (y+sy>zy) sy=zy-y;
 	if (x+sx>zx) sx=zx-x;
@@ -360,15 +360,15 @@
 	XWMHints wmh;
 	char buf[256],*bufp=buf;
 	if (title=="") {
-		sprintf(buf,"GridFlow (%d,%d,%d)",dim->get(0),dim->get(1),dim->get(2));
+		sprintf(buf,"GridFlow (%d,%d,%d)",dim[0],dim[1],dim[2]);
 	} else {
 		sprintf(buf,"%.255s",title.data());
 	}
 	XTextProperty wtitle; XStringListToTextProperty((char **)&bufp, 1, &wtitle);
 	XSizeHints sh;
 	sh.flags=PSize|PMaxSize|PMinSize;
-	sh.min_width  = sh.max_width  = sh.width  = dim->get(1);
-	sh.min_height = sh.max_height = sh.height = dim->get(0);
+	sh.min_width  = sh.max_width  = sh.width  = dim[1];
+	sh.min_height = sh.max_height = sh.height = dim[0];
 	wmh.input = True;
 	wmh.flags = InputHint;
 	XSetWMProperties(display,window,&wtitle,&wtitle,0,0,&sh,&wmh,0);
@@ -438,9 +438,9 @@
 void FormatX11_call(FormatX11 *p) {p->call();}
 
 \def 0 bang () {
-	XGetSubImage(display, window, 0, 0, dim->get(1), dim->get(0), (unsigned)-1, ZPixmap, ximage, 0, 0);
+	XGetSubImage(display, window, 0, 0, dim[1], dim[0], (unsigned)-1, ZPixmap, ximage, 0, 0);
 	GridOutlet out(this,0,dim,cast);
-	int sy=dim->get(0), sx=dim->get(1), bs=dim->prod(1);
+	int sy=dim[0], sx=dim[1], bs=dim.prod(1);
 	uint8 b2[bs];
 	for(int y=0; y<sy; y++) {
 		uint8 *b1 = image + ximage->bytes_per_line * y;
@@ -595,23 +595,23 @@
 }
 
 GRID_INLET(0) {
-	if (in->dim->n != 3)
+	if (in.dim.n != 3)
 		RAISE("expecting 3 dimensions: rows,columns,channels");
-	if (in->dim->get(2)!=3 && in->dim->get(2)!=4)
-		RAISE("expecting 3 or 4 channels: red,green,blue,ignored (got %d)",in->dim->get(2));
-	int sx = in->dim->get(1), osx = dim->get(1);
-	int sy = in->dim->get(0), osy = dim->get(0);
+	if (in.dim[2]!=3 && in.dim[2]!=4)
+		RAISE("expecting 3 or 4 channels: red,green,blue,ignored (got %d)",in.dim[2]);
+	int sx = in.dim[1], osx = dim[1];
+	int sy = in.dim[0], osy = dim[0];
 	in->set_chunk(1);
 	if (sx!=osx || sy!=osy) resize_window(sx,sy);
-	if (in->dim->get(2)!=bit_packing->size) {
+	if (in.dim[2]!=bit_packing->size) {
 		bit_packing->mask[3]=0;
 		bit_packing = new BitPacking(bit_packing->endian,
-		  bit_packing->bytes, in->dim->get(2), bit_packing->mask);
+		  bit_packing->bytes, in.dim[2], bit_packing->mask);
 	}
 } GRID_FLOW {
 	int bypl = ximage->bytes_per_line;
-	int sxc = in->dim->prod(1);
-	int sx = in->dim->get(1);
+	int sxc = in.dim.prod(1);
+	int sx = in.dim[1];
 	int y = dex/sxc;
 	for (; n>0; y++, data+=sxc, n-=sxc) {
 		// convert line
@@ -621,7 +621,7 @@
 		} else bit_packing->pack(sx, data, image+y*bypl);
 	}
 } GRID_FINISH {
-	show_section(0,0,in->dim->get(1),in->dim->get(0));
+	show_section(0,0,in.dim[1],in.dim[0]);
 } GRID_END
 
 \def 0 out_size (int sy, int sx) { resize_window(sx,sy); }



More information about the Gridflow-cvs mailing list