Text archives Help
- From: abe@sci.utah.edu
- To: manta@sci.utah.edu
- Subject: [MANTA] r507 - in branches/AFR/Engine: Control ImageTraversers ImageTraversers/AFR
- Date: Fri, 26 Aug 2005 16:40:49 -0600 (MDT)
Author: abe
Date: Fri Aug 26 16:40:47 2005
New Revision: 507
Modified:
branches/AFR/Engine/Control/AFRPipeline.cc
branches/AFR/Engine/ImageTraversers/AFImageTraverser.cc
branches/AFR/Engine/ImageTraversers/AFImageTraverser.h
branches/AFR/Engine/ImageTraversers/AFR/kdtree.cc
branches/AFR/Engine/ImageTraversers/AFR/sample.h
branches/AFR/Engine/ImageTraversers/AFR/tiles.cc
branches/AFR/Engine/ImageTraversers/AFR/tiles.h
Log:
this is the first working version with each thread having its own tree,
really fast on mac, need to fix barrier to get it run on itanium
Modified: branches/AFR/Engine/Control/AFRPipeline.cc
==============================================================================
--- branches/AFR/Engine/Control/AFRPipeline.cc (original)
+++ branches/AFR/Engine/Control/AFRPipeline.cc Fri Aug 26 16:40:47 2005
@@ -423,13 +423,9 @@
- if (proc == 0) {
- currentImageTraverser->masterThread( myContext, image );
- }
- else {
- // Have the Afr compliant image traverser render samples.
- currentImageTraverser->clientThread( myContext, image );
- }
+ currentImageTraverser->masterTask( myContext, image );
+ currentImageTraverser->clientTask( myContext, image );
+ image->setValid(true);
}
// Determine how to break out of inner loop.
!!!!!!!!!!!!!!!!!!!!!!!!!!
Modified: branches/AFR/Engine/ImageTraversers/AFImageTraverser.cc
==============================================================================
--- branches/AFR/Engine/ImageTraversers/AFImageTraverser.cc (original)
+++ branches/AFR/Engine/ImageTraversers/AFImageTraverser.cc Fri Aug 26
16:40:47 2005
@@ -47,22 +47,6 @@
AFImageTraverser::AFImageTraverser(const vector<string>& args)
{
myRandomNumber = NULL;
- // below we can easily pass command line arguments like
- // storing stream to some file
- // sampling rate etc.
- // This we will do later
- // following code is commented for demo purposes
- /*
- int argc = static_cast<int>(args.size());
- for(int i = 0; i<argc;i++) {
- string arg = args[i];
- if(arg == "-tilesize") {
- if(!getResolutionArg(i, args, xtilesize, ytilesize))
- throw IllegalArgument("AFImageTraverser -tilesize", i, args);
- } else {
- throw IllegalArgument("AFImageTraverser", i, args);
- }
- }*/
}
AFImageTraverser::~AFImageTraverser()
@@ -86,9 +70,11 @@
// and right eye)
int i;
int xres,yres;
+ num_clients = context.numProcs;
samplingrate = 400000; // let us for now assume something realistic
- samples_done = 0;
- initpass = false;
+ samples_done = new unsigned int[num_clients];
+ initpass = new bool[num_clients];
+ chunkTimeStamp = new double[num_clients];
// this will change when we can actually simulate
context.getResolution(stereo, xres, yres);
@@ -101,78 +87,32 @@
myRandomNumber[i].seed_rng(1234*(i+1)); // just to begin give a simple
seed
}
-
/////////////////////////////////////////////////////////////////////////////
- // Create a kdtree for each client.
+
/////////////////////////////////////////////////////////////////////////////
+ // Create a kdtree for each client.
//---------------------------------------------------------
// make our kdtree, given the resolution of image/channel
//---------------------------------------------------------
- kdtree.setAB(xres, yres, samplingrate);
- int numlevels = kdtree.init(xres, yres, samplingrate); // initialize
the tree
- kdtree.setTileCut(numlevels/2, 0, samplingrate);
-
- // set a mean number of tiles, i.e. cut at middle of tree
- kdtree.resetPseudoRandomSeed();
+ kdtree = new KDTree[num_clients];
+ for(i=0; i<num_clients; i++)
+ {
+ samples_done[i] = 0;
+ initpass[i] = false;
+ chunkTimeStamp[i] = 0.0;
+ kdtree[i].setAB(xres, yres, samplingrate);
+ int numlevels = kdtree[i].init(xres, yres, samplingrate); // initialize
the tree
+ kdtree[i].setTileCut(numlevels/2, 0, samplingrate);
- //--------------------------------------------------------------------
- // allocate the queues, based on samplinrate and number of processors.
- //--------------------------------------------------------------------
- if(context.numProcs<2) {
- throw IllegalValue<int>("numProcs must be > 1 for AFR, use -np 2 or
more", context.numProcs);
+ // set a mean number of tiles, i.e. cut at middle of tree
+ kdtree[i].resetPseudoRandomSeed();
}
-
- num_clients = context.numProcs-1;
-
- // note that max fragment size is hard coded to 32 in fragment.h
- // so not to exceed that limit.
- chunk_size = num_clients*256; // this is done so that
- // program scales well when #processors
increase
- int qSize = (int)(samplingrate*0.1);
- frametype = new FrameType[num_clients+1];
- numFragments = (int)ceil((float)chunk_size/(float)(num_clients));
+ chunk_size = 256; // this is a fixed number as of now
+ int qSize = (int)(samplingrate*0.1); // temporal queue size
temporalQ = new CQ<Sample>[num_clients];
- sampleQ[EVEN_FRAME] = new Sample[chunk_size];
- sampleQ[ODD_FRAME] = new Sample[chunk_size];
- samplesetQ[EVEN_FRAME] = new CQ<SampleSet>[num_clients];
- samplesetQ[ODD_FRAME] = new CQ<SampleSet>[num_clients];
- // Initialize
- for(i = 0; i<num_clients; i++)
- {
+ // Initialize
+ for(i = 0; i<num_clients; i++)
temporalQ[i].init(qSize+1);
- samplesetQ[EVEN_FRAME][i].init(chunk_size);
- samplesetQ[ODD_FRAME][i].init(chunk_size);
- frametype[i] = EVEN_FRAME;
- }
- frametype[num_clients] = EVEN_FRAME;
-
- //--------------------------------------------------------------------
- // tell load balancer to balance num_clients # of assignments
- // we intend to have one assignment per client. Unless some client
- // takes longer.
- //--------------------------------------------------------------------
- cout << "numFragments = " << numFragments << endl;
- context.loadBalancer->setupDisplayChannel(context, numFragments);
-
- // make fist set of fragments from uniform tiling
- allocateFragments(EVEN_FRAME);
-}
-
-// Called from setupDisplayChannel.
-// Called from masterThread.
-void AFImageTraverser::allocateFragments(const FrameType f) {
-
- int j;
- int x, y;
- Sample s;
- for(j=0; j<chunk_size; j++)
- {
- kdtree.getRandomSample(x, y, myRandomNumber[0]);
- // jitter if we need to here
- sampleQ[f][j].reset();
- sampleQ[f][j].init(x, y, chunkTimeStamp);
- //cout << "allocated sample: " << x << ", " << y << endl;
- }
}
void AFImageTraverser::renderCrossHair(const RenderContext& context, int
myID,
@@ -196,7 +136,7 @@
s->worldCoord[0], s->worldCoord[1], s->worldCoord[2],
s->c[0], s->c[1], s->c[2]);
- float t = (float)chunkTimeStamp;
+ float t = (float)chunkTimeStamp[context.proc];
Color color[5];
for(int i=0;i<size;i++) {
@@ -243,53 +183,55 @@
case 0:
ss.set(CENTER_SAMPLE, sx, sy, t, p.x(), p.y(), p.z(),
tempcol.r(), tempcol.g(), tempcol.b());
- image->set(sx, sy, color[i]);
+ image->set((int)sx, (int)sy, color[i]);
break;
case 1:
ss.set(LEFT_SAMPLE, sx-1, sy, t, p.x(), p.y(), p.z(),
tempcol.r(), tempcol.g(), tempcol.b());
- image->set(sx-1, sy, color[i]);
+ image->set((int)sx-1, (int)sy, color[i]);
break;
case 2:
ss.set(RIGHT_SAMPLE, sx+1, sy, t, p.x(), p.y(), p.z(),
tempcol.r(), tempcol.g(), tempcol.b());
- image->set(sx+1, sy, color[i]);
+ image->set((int)sx+1, (int)sy, color[i]);
break;
case 3:
ss.set(BOTTOM_SAMPLE, sx, sy-1, t, p.x(), p.y(), p.z(),
tempcol.r(), tempcol.g(), tempcol.b());
- image->set(sx, sy-1, color[i]);
+ image->set((int)sx, (int)sy-1, color[i]);
break;
case 4:
ss.set(TOP_SAMPLE, sx, sy+1, t, p.x(), p.y(), p.z(),
tempcol.r(), tempcol.g(), tempcol.b());
- image->set(sx, sy+1, color[i]);
+ image->set((int)sx, (int)sy+1, color[i]);
break;
};
}
//cout << "computing gradients" << endl;
ss.computeGradients(t);
- //cout << "inserting in Q, commented" << endl;
- samplesetQ[frametype[myID]][myID-1].qInsert(&ss);
- //cout << "DONE" << endl;
+
+ // add the sample to the corresponding kdtree
+ kdtree[context.proc].updateStatsAddSampleSet(&ss,
(float)chunkTimeStamp[context.proc], samplingrate);
+ samples_done[context.proc] += 5;
}
///////////////////////////////////////////////////////////////////////////////
// Render all of samples in a fragment of the chunk.
///////////////////////////////////////////////////////////////////////////////
-void AFImageTraverser::renderFragment(const RenderContext& context,
- int chunkstart, int chunkend, Image*
image,
+void AFImageTraverser::renderChunk(const RenderContext& context,
+ Image* image,
int xres, int yres)
{
- //cout << "inside renderFragment " << endl;
+ //cout << "inside renderChunk " << endl;
// renders the fragment by jittering it and stores result in temporalQ
int flags = RayPacket::HaveImageCoordinates | RayPacket::ConstantEye;
int myID = context.proc;
- int fsize = chunkend - chunkstart;
+ int fsize = chunk_size;
Color color[RayPacket::MaxSize];
+ Sample newSample[RayPacket::MaxSize];
/////////////////////////////////////////////////////////////////////////////
// Create ray packets.
for(int f=0;f<fsize;f+=RayPacket::MaxSize) {
@@ -304,15 +246,15 @@
// Copy samples from the sampleQ into the fragment.
for(int i=0;i<size;i++) {
- float cx, cy;
- int sind = chunkstart + f + i;
- cx = sampleQ[frametype[myID]][sind].viewCoord[0];
- cy = sampleQ[frametype[myID]][sind].viewCoord[1];
+ int cx, cy;
+ kdtree[myID].getRandomSample(cx, cy, myRandomNumber[myID]);
+ newSample[i].viewCoord[0] = cx;
+ newSample[i].viewCoord[1] = cy;
// normalized
double px, py;
- //cout << "raytracing: " << fe.x << ", " << fe.y << endl;
+ // cout << "raytracing: " << cx << ", " << cy << endl;
// we will jitter later, now just add 0.5 <TODO>
if(xres>yres) // let the smaller dimension be mapped to [-1,1]
{
@@ -325,11 +267,12 @@
py = (double)(-1.0 + 2.0*(double)(cy)/(double)xres);
}
+ samples_done[context.proc] ++;
// Specify the position and color pointer for the packet element.
rays.setPixel(i, 0, px, py, &color[i]);
}
-
///////////////////////////////////////////////////////////////////////////
+
//////////////////////////////////////////////////////////////////////////
// Trace the rays. The results will automatically go into the fragment
context.renderer->traceEyeRays(context, rays);
@@ -339,110 +282,55 @@
///////////////////////////////////////////////////////////////////////////
// okay now copy from fragment to temporalQ
for(int i=0;i<size;i++) {
-
- int sind = chunkstart + f + i;
RayPacket::Element& re = rays.get(i);
RGBColor tempcol = color[i].convertRGB();
- sampleQ[frametype[myID]][sind].c[0] = tempcol.r();
- sampleQ[frametype[myID]][sind].c[1] = tempcol.g();
- sampleQ[frametype[myID]][sind].c[2] = tempcol.b();
- sampleQ[frametype[myID]][sind].worldCoord[0] = re.hitPosition.x();
- sampleQ[frametype[myID]][sind].worldCoord[1] = re.hitPosition.y();
- sampleQ[frametype[myID]][sind].worldCoord[2] = re.hitPosition.z();
+ newSample[i].c[0] = tempcol.r();
+ newSample[i].c[1] = tempcol.g();
+ newSample[i].c[2] = tempcol.b();
+ newSample[i].worldCoord[0] = re.hitPosition.x();
+ newSample[i].worldCoord[1] = re.hitPosition.y();
+ newSample[i].worldCoord[2] = re.hitPosition.z();
+ // newSample[i].print();
/////////////////////////////////////////////////////////////////////////////
// Skip reconstruction and set the image pixel.
- image->set(sampleQ[frametype[myID]][sind].viewCoord[0],
sampleQ[frametype[myID]][sind].viewCoord[1], color[i]);
+ image->set((int)(newSample[i].viewCoord[0]),
(int)(newSample[i].viewCoord[1]), color[i]);
+ // add sample to the corresponding kdtree
+ kdtree[myID].updateStatsAddSample(&newSample[i],
(float)chunkTimeStamp[myID], samplingrate, 0.0, false);
+ // add this sample into the temporalQ
+ temporalQ[myID].qInsert(&newSample[i]);
}
}
}
///////////////////////////////////////////////////////////////////////////////
-// Manta ImageTraverser callback.
-///////////////////////////////////////////////////////////////////////////////
-void AFImageTraverser::renderImage( const RenderContext& context, Image*
image ) {
-
-// we do nothing here, AFRPipeline direcly calls master/client blocks
-}
-
-
-///////////////////////////////////////////////////////////////////////////////
// This method implements the master thread functionality.
///////////////////////////////////////////////////////////////////////////////
-void AFImageTraverser::masterThread(const RenderContext& context, Image*
image) {
+void AFImageTraverser::masterTask(const RenderContext& context, Image*
image) {
- // cout << "inside masterthread for frametype " << frametype[0] << endl;
// update kdtree based on previous results from the client threads
bool stereo;
int xres, yres;
image->getResolution(stereo, xres, yres);
- FrameType prevFrameType = (frametype[0]==EVEN_FRAME)? ODD_FRAME :
EVEN_FRAME;
-
- chunkTimeStamp =
(float)samples_done/(float)samplingrate;//Time::currentSeconds();
+ chunkTimeStamp[context.proc] =
(float)samples_done[context.proc]/(float)samplingrate;//Time::currentSeconds();
// return during intialization here
- if(!initpass)
+ if(!initpass[context.proc])
{
- if(samples_done >= xres*yres) initpass = true;
- samples_done += chunk_size;
- if(samples_done>chunk_size)
- for(int i=0; i<chunk_size; i++)
- {
- kdtree.updateStatsAddSample(&sampleQ[prevFrameType][i],
(float)chunkTimeStamp, samplingrate, 0.0, false);
- }
+ if(samples_done[context.proc] >= xres*yres) initpass[context.proc] =
true;
}
else
{
- //cout << "samples_done = " << samples_done << endl;
- //cout << "now calling adjust tiles, for now commented" << endl;
// adjust tiles based on current status
- adjustTiles((float)chunkTimeStamp);
- //cout << "now updaing kdtree" << endl;
- SampleSet *sampleset;
- int i;
- for(i=0; i<num_clients; i++)
- {
- while(!samplesetQ[prevFrameType][i].isEmpty())
- {
- //cout << "getting sampleset from Q" << endl;
- sampleset = samplesetQ[prevFrameType][i].seekLast();
- samplesetQ[prevFrameType][i].qDelete();
- kdtree.updateStatsAddSampleSet(sampleset, (float)chunkTimeStamp,
samplingrate);
- samples_done += 6;
- }
-
- }
- for(int i=0; i<chunk_size; i++)
- {
- kdtree.ageStats(&sampleQ[prevFrameType][i], (float)chunkTimeStamp,
samplingrate);
- }
- }
- //cout << "allocating fragments for next frame" << endl;
- // allocate samples for next chunk for all clients
- if(frametype[0]==EVEN_FRAME)
- {
- allocateFragments(ODD_FRAME);
- frametype[0] = ODD_FRAME;
- }
- else
- {
- allocateFragments(EVEN_FRAME);
- frametype[0] = EVEN_FRAME;
+ adjustTiles(context.proc, (float)chunkTimeStamp[context.proc]);
}
- image->setValid(true);
- if(frametype[context.proc]==EVEN_FRAME)
- frametype[context.proc] = ODD_FRAME;
- else
- frametype[context.proc] = EVEN_FRAME;
- //cout << "allocation done, now incrementing sample count" << endl;
- //cout << "masterThread done" << endl;
}
///////////////////////////////////////////////////////////////////////////////
// This method implements the master thread functionality.
///////////////////////////////////////////////////////////////////////////////
-void AFImageTraverser::clientThread(const RenderContext& context, Image*
image) {
+void AFImageTraverser::clientTask(const RenderContext& context, Image*
image) {
//cout << "inside clientThread for frametype " << frametype[context.proc]
<< endl;
bool stereo;
@@ -450,44 +338,26 @@
image->getResolution(stereo, xres, yres);
int myID = context.proc;
Sample s;
- //cout << "calling renderFragment for allotted fragment, myID = " << myID
<< endl;
- int chunkstart = (context.proc-1)*numFragments;
- int chunkend = (chunk_size<context.proc*numFragments)? chunk_size :
context.proc*numFragments;
- renderFragment(context, chunkstart, chunkend, image, xres, yres);
- //cout << "done RenderFragment" << endl;
+ // render the chunk
+ renderChunk(context, image, xres, yres);
- // let us not write temporal samples to image
-
- //cout << "now placing fragment in temporalQ" << endl;
- for(int i=chunkstart; i<chunkend; i++) {
- temporalQ[myID-1].qInsert(&sampleQ[frametype[myID]][i]);
- }
- //cout << "placement in temporalQ done" << endl;
- /* place the fragment in the temporalQ, take fragment_size number of
- * items from the temporalQ one by one, reproject them and complete
- * a crosshair, placing it in samplesetQ.
- */
- if(initpass) {
-
+ if(initpass[myID]) {
+ // initialization is done so we can reproject one chunk worth
int i;
Sample *sp;
//cout << "now making xhairs" << endl;
- for(i=0; i<(chunkend-chunkstart); i++) {
+ for(i=0; i<chunk_size; i++) {
- sp = temporalQ[myID-1].seekLast();
+ sp = temporalQ[myID].seekLast();
if(sp!=NULL) {
- temporalQ[myID-1].qDelete();
+ temporalQ[myID].qDelete();
Manta::Real px, py, pz;
px = sp->worldCoord[0];
py = sp->worldCoord[1];
pz = sp->worldCoord[2];
- /*
- * if the point is INF, no need to reproject as it will remain the
same
- *
- */
- //printf("projecting %f,%f,%f from %f,%f to .. ", px, py, pz,
- // sp->viewCoord[0], sp->viewCoord[1]);
+
+ //if the point is INF, no need to reproject as it will remain the
same
#ifdef __sgi
if(finite(px) && finite(py) && finite(pz))
#else
@@ -496,57 +366,47 @@
{
const Point p(px, py, pz);
Point rp;
- //Camera* camera =
context.rtrt_int->getCamera(context.channelIndex);
rp = context.camera->project(p);
- //rp = camera->project(p);
sp->viewCoord[0] = rp.x()*xres;
sp->viewCoord[1] = rp.y()*yres;
sp->viewCoord[2] = rp.z();
- //printf(".. %f,%f (%f,%f, %f)\n",
- // sp->viewCoord[0], sp->viewCoord[1], rp.x(), rp.y(),
rp.z());
}
if(sp->viewCoord[0]<xres && sp->viewCoord[0]>=0
&& sp->viewCoord[1]<yres && sp->viewCoord[1]>=0
&& sp->viewCoord[2]<=1.0)
renderCrossHair(context, myID, image, xres, yres, sp);
- //cout << "returned from renderCrossHair" << endl;
}
}
}
- if(frametype[context.proc]==EVEN_FRAME)
- frametype[context.proc] = ODD_FRAME;
- else
- frametype[context.proc] = EVEN_FRAME;
- //cout << "making xhairs done" << endl;
}
///////////////////////////////////////////////////////////////////////////////
// This method adjusts the kdtree-cut by either merging nodes along the cut
// or splitting nodes and adding their children to the cut.
///////////////////////////////////////////////////////////////////////////////
-void AFImageTraverser::adjustTiles(Timestamp currenttime)
+void AFImageTraverser::adjustTiles(int id, Timestamp currenttime)
{
float minError, maxError;
int count;
int required_tiles = 2048;
- if(kdtree.number_of_tiles()!=required_tiles)
+ if(kdtree[id].number_of_tiles()!=required_tiles)
{
do
{
- while(kdtree.number_of_tiles()>required_tiles)
+ while(kdtree[id].number_of_tiles()>required_tiles)
{
- kdtree.merge(kdtree.getminErrorParentTile(), currenttime,
samplingrate);
+ kdtree[id].merge(kdtree[id].getminErrorParentTile(), currenttime,
samplingrate);
}
- while(kdtree.number_of_tiles()<required_tiles)
+ while(kdtree[id].number_of_tiles()<required_tiles)
{
- kdtree.split(kdtree.getmaxErrorTile(), currenttime, samplingrate);
+ kdtree[id].split(kdtree[id].getmaxErrorTile(), currenttime,
samplingrate);
}
}
- while(kdtree.number_of_tiles()!=required_tiles);
+ while(kdtree[id].number_of_tiles()!=required_tiles);
}
- minError = kdtree.getminError();
- maxError = kdtree.getmaxError();
+ minError = kdtree[id].getminError();
+ maxError = kdtree[id].getmaxError();
//cout << "minError = " << minError << ", maxError = " << maxError <<
endl;
if(minError/maxError<MAX_MIN_RATIO)
{
@@ -555,14 +415,14 @@
do
{
count++;
- num_tiles_merged = kdtree.merge(kdtree.getminErrorParentTile(),
currenttime, samplingrate);
+ num_tiles_merged =
kdtree[id].merge(kdtree[id].getminErrorParentTile(), currenttime,
samplingrate);
for(i=0; i<num_tiles_merged && count<MAX_MERGE_SPLIT_LIMIT; i++)
{
count++;
- kdtree.split(kdtree.getmaxErrorTile(), currenttime, samplingrate);
+ kdtree[id].split(kdtree[id].getmaxErrorTile(), currenttime,
samplingrate);
}
- minError = kdtree.getminError();
- maxError = kdtree.getmaxError();
+ minError = kdtree[id].getminError();
+ maxError = kdtree[id].getmaxError();
}
while(minError/maxError<MAX_MIN_RATIO && count<MAX_MERGE_SPLIT_LIMIT);
}
Modified: branches/AFR/Engine/ImageTraversers/AFImageTraverser.h
==============================================================================
--- branches/AFR/Engine/ImageTraversers/AFImageTraverser.h (original)
+++ branches/AFR/Engine/ImageTraversers/AFImageTraverser.h Fri Aug 26
16:40:47 2005
@@ -26,21 +26,19 @@
virtual void setupBegin(SetupContext&, int
numChannels);
virtual void setupDisplayChannel(SetupContext&);
virtual void setupFrame(const RenderContext& context)
{ /*Undefined for AFRPipeline.*/ };
- virtual void renderImage(const RenderContext&
context, Image* image);
- void allocateFragments(const FrameType f);
+ virtual void renderImage(const RenderContext&
context, Image* image) { /*Undefined for AFRPipeline. */ };
- // Render fragments.
- void renderFragment(const RenderContext& context, int
chunkstart, int chunkend, Image* image, int xres, int yres);
+ void renderChunk(const RenderContext& context, Image*
image, int xres, int yres);
void renderCrossHair(const RenderContext& context,
int myID, Image *image, int xres, int yres, Sample *s);
// Master thread task.
- void masterThread(const RenderContext& context,
Image* image);
+ void masterTask(const RenderContext& context, Image*
image);
// Sampler/Renderer task.
- void clientThread(const RenderContext& context,
Image* image);
+ void clientTask(const RenderContext& context, Image*
image);
// Update kdtree-cut.
- void adjustTiles(Timestamp currenttime);
+ void adjustTiles(int id, Timestamp currenttime);
static ImageTraverser* create(const vector<string>&
args);
@@ -48,23 +46,15 @@
AFImageTraverser(const AFImageTraverser&);
AFImageTraverser& operator=(const AFImageTraverser&);
- // Image kd-tree.
- KDTree kdtree;
+ // Image kd-tree. per thread
+ KDTree *kdtree;
// number of fragments a chunk is divided into. It is
divided equally amongst all clients
int numFragments;
- //
+ // the reprojection queue per thread
CQ<Sample> *temporalQ;
- // Double buffered: Sample queue.
- // Samples are obtained from the kdtree and placed in
the queue. Later samples
- // are removed from the queue and added to fragments.
- Sample *sampleQ[2];
-
- // Double buffered ???
- CQ<SampleSet> *samplesetQ[2];
-
// Random number generator array??
MT_RNG *myRandomNumber;
@@ -72,13 +62,11 @@
int num_clients;
int chunk_size;
int samplingrate;
- unsigned int samples_done;
+ unsigned int *samples_done;
// ??????????????
- int *client_done_counter;
- FrameType *frametype;
- double chunkTimeStamp;
- bool initpass;
+ double *chunkTimeStamp;
+ bool *initpass;
};
};
Modified: branches/AFR/Engine/ImageTraversers/AFR/kdtree.cc
==============================================================================
--- branches/AFR/Engine/ImageTraversers/AFR/kdtree.cc (original)
+++ branches/AFR/Engine/ImageTraversers/AFR/kdtree.cc Fri Aug 26 16:40:47
2005
@@ -463,7 +463,7 @@
x = (int)newsampleset->viewX;
y = (int)newsampleset->viewY;
int index = Tile::leafMapping[x/2][y/2];
- tile[index].checkBounds(x,y);
+ if(!tile[index].checkBounds(x,y)) return;
int vtileindex;
while(index>0)
{
@@ -482,7 +482,7 @@
x = (int)newsample->viewCoord[0];
y = (int)newsample->viewCoord[1];
int index = Tile::leafMapping[x/2][y/2];
- tile[index].checkBounds(x,y);
+ if(!tile[index].checkBounds(x,y)) return;
int vtileindex;
while(index>0)
{
@@ -501,7 +501,7 @@
x = (int)newsample->viewCoord[0];
y = (int)newsample->viewCoord[1];
int index = Tile::leafMapping[x/2][y/2];
- tile[index].checkBounds(x,y);
+ if(!tile[index].checkBounds(x,y)) return;
int vtileindex;
while(index>0)
{
Modified: branches/AFR/Engine/ImageTraversers/AFR/sample.h
==============================================================================
--- branches/AFR/Engine/ImageTraversers/AFR/sample.h (original)
+++ branches/AFR/Engine/ImageTraversers/AFR/sample.h Fri Aug 26 16:40:47
2005
@@ -120,11 +120,11 @@
void print()
{
- /* cout << "worldCoord = " << worldCoord[0] << ", "
<< worldCoord[1] << ", " << worldCoord[2]
- << "; viewCoord = " << viewCoord[0]
<< ", " << viewCoord[1] << endl
- << "timestamp = " << t << endl
- << "; color = " << c[0] << ", " <<
c[1] << ", " << c[2] << endl
- << endl;*/
+ cout << "worldCoord = " << worldCoord[0] << ", " <<
worldCoord[1] << ", " << worldCoord[2]
+ << "; viewCoord = " << viewCoord[0] << ", " <<
viewCoord[1] << endl
+ << "timestamp = " << t << endl
+ << "; color = " << c[0] << ", " << c[1] << ",
" << c[2] << endl
+ << endl;
}
inline float getRGBDistance(FloatColor &fc)
Modified: branches/AFR/Engine/ImageTraversers/AFR/tiles.cc
==============================================================================
--- branches/AFR/Engine/ImageTraversers/AFR/tiles.cc (original)
+++ branches/AFR/Engine/ImageTraversers/AFR/tiles.cc Fri Aug 26 16:40:47
2005
@@ -425,9 +425,16 @@
//return (A*expf(-B*age));
}
-void Tile::checkBounds(int x, int y)
+bool Tile::checkBounds(int x, int y)
{
- assert(left<=x && x<right && bottom<=y && y<top);
+ if(!(left<=x && x<right && bottom<=y && y<top))
+ {
+ cout << "tile boundary exception"
+ << "( " << left << ", " << right << ", " << bottom << ",
" << top
+ << " ); " << x << ", " << y << endl;
+ return false;
+ }
+ return true;
}
Modified: branches/AFR/Engine/ImageTraversers/AFR/tiles.h
==============================================================================
--- branches/AFR/Engine/ImageTraversers/AFR/tiles.h (original)
+++ branches/AFR/Engine/ImageTraversers/AFR/tiles.h Fri Aug 26 16:40:47
2005
@@ -176,7 +176,7 @@
}
float getAverageAgeMeasure(Tile &roottile, Timestamp
currenttime, float gvisScale);
float getOcclusionMeasure(Tile *tree, int nTiles);
- void checkBounds(int x, int y);
+ bool checkBounds(int x, int y);
void display(TileDisplayMode displaymode, int nTiles, Tile *tree,
int sampling_rate, Timestamp currenttime,
float A, float B, float visScale);
- [MANTA] r507 - in branches/AFR/Engine: Control ImageTraversers ImageTraversers/AFR, abe, 08/26/2005
Archive powered by MHonArc 2.6.16.