Text archives Help
- From: abhinav@sci.utah.edu
- To: manta@sci.utah.edu
- Subject: [MANTA] r521 - in branches/AFR/Engine/ImageTraversers: . AFR
- Date: Tue, 30 Aug 2005 22:43:04 -0600 (MDT)
Author: abhinav
Date: Tue Aug 30 22:43:04 2005
New Revision: 521
Modified:
branches/AFR/Engine/ImageTraversers/AFImageTraverser.cc
branches/AFR/Engine/ImageTraversers/AFR/kdtree.cc
branches/AFR/Engine/ImageTraversers/AFR/kdtree.h
Log:
corrected bug where it wont work without coarse updates
Modified: branches/AFR/Engine/ImageTraversers/AFImageTraverser.cc
==============================================================================
--- branches/AFR/Engine/ImageTraversers/AFImageTraverser.cc (original)
+++ branches/AFR/Engine/ImageTraversers/AFImageTraverser.cc Tue Aug 30
22:43:04 2005
@@ -582,7 +582,7 @@
for(i=0;i<size;i++) {
int cx, cy;
int tindex = kdtree[myID].getRandomSample(cx, cy,
myRandomNumber[myID]);
- // cout << "f+i = " << f+i << endl;
+ // cout << "f+i = " << f+i << endl;
newSample[myID][f+i].viewCoord[0] = cx;
newSample[myID][f+i].viewCoord[1] = cy;
newSample[myID][f+i].tileindex = tindex;
@@ -594,13 +594,13 @@
// we will jitter later, now just add 0.5 <TODO>
if(xres>yres) // let the smaller dimension be mapped to [-1,1]
{
- px = (double)(-1.0 + 2.0*(double)(cx)/(double)yres);
- py = (double)(-1.0 + 2.0*(double)(cy)/(double)yres);
+ px = (double)(-1.0 +
2.0*(double)newSample[myID][f+i].viewCoord[0]/(double)yres);
+ py = (double)(-1.0 +
2.0*(double)newSample[myID][f+i].viewCoord[1]/(double)yres);
}
else
{
- px = (double)(-1.0 + 2.0*(double)(cx)/(double)xres);
- py = (double)(-1.0 + 2.0*(double)(cy)/(double)xres);
+ px = (double)(-1.0 +
2.0*(double)newSample[myID][f+i].viewCoord[0]/(double)xres);
+ py = (double)(-1.0 +
2.0*(double)newSample[myID][f+i].viewCoord[1]/(double)xres);
}
// samples_done[context.proc] ++;
@@ -712,11 +712,10 @@
//cout << "now making xhairs" << endl;
int fsize = temporalQ[myID].getN()-qSize;
- for(i=0; i<fsize; i++)
- temporalQ[myID].qDelete();
+ for(i=0; i<fsize; i++)
+ temporalQ[myID].qDelete();
//cout << "fsize = " << fsize << endl;
- if(fsize>=0)
for(i=0; i<chunk_size; i++) {
sp = temporalQ[myID].seekLast();
@@ -782,7 +781,7 @@
{
while(kdtree[id].number_of_tiles()>required_tiles)
{
- kdtree[id].merge(kdtree[id].getminErrorParentTile(), currenttime);
+ kdtree[id].merge(kdtree[id].getminErrorParentTile(), currenttime,
samplingrate);
}
while(kdtree[id].number_of_tiles()<required_tiles)
{
@@ -802,7 +801,7 @@
do
{
count++;
- num_tiles_merged =
kdtree[id].merge(kdtree[id].getminErrorParentTile(), currenttime);
+ 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++;
Modified: branches/AFR/Engine/ImageTraversers/AFR/kdtree.cc
==============================================================================
--- branches/AFR/Engine/ImageTraversers/AFR/kdtree.cc (original)
+++ branches/AFR/Engine/ImageTraversers/AFR/kdtree.cc Tue Aug 30 22:43:04
2005
@@ -9,7 +9,7 @@
#include <Engine/ImageTraversers/AFR/kdtree.h>
#include <assert.h>
#define ONLY_NODE_UPDATE
-#define COARSE_UPDATES
+//#define COARSE_UPDATES
using namespace Manta;
using namespace Manta::Afr;
KDTree::KDTree()
@@ -109,13 +109,13 @@
}
// merge all tiles at the cut i.e. take the cut a level up
-bool KDTree::mergeCut(Timestamp currenttime)
+bool KDTree::mergeCut(Timestamp currenttime, unsigned int samplingrate)
{
int index = tile[0].getNextTile();
// traverse the cut
while(index!=0)
{
- if (merge(index, currenttime)) // merge
+ if (merge(index, currenttime, samplingrate)) // merge
index = tile[index/2].getNextTile(); // get the next
tile on updated cut
else
index = tile[index].getNextTile();
@@ -254,7 +254,7 @@
// merge a tile, what this does is that
// it sets the parent of the tile to be merged as a valid tile
// dissolving the entire subtree of the parent
-int KDTree::merge(int index, Timestamp currenttime)
+int KDTree::merge(int index, Timestamp currenttime, unsigned int
samplingrate)
{
//<TODO> adding updating to tile stats and min/max variances
// this may not be necessary for merges, if we maintain an updated
thing
@@ -285,6 +285,7 @@
tile[index/2].recomputeStats(tile);
#endif
#endif
+ tile[index/2].updateCommon(currenttime, tile, numTiles, samplingrate);
tile[index].setTimeLastDerivativeSet(currenttime);
// increment valid tile counter
numTiles++;
@@ -514,12 +515,11 @@
int index = Tile::leafMapping[x/2][y/2];
if(!tile[index].checkBounds(x,y)) return;
tile[index].updateStatsAddSampleSet(newsampleset, currenttime, A, B,
tile, numTiles, samplingrate);
-#else
+#endif
tile[newsampleset->tileindex].updateStatsAddSampleSet(newsampleset,
currenttime, A, B, tile, numTiles, samplingrate);
tile[newsampleset->tileindex/2].updateStatsAddSampleSet(newsampleset,
currenttime, A, B, tile, numTiles, samplingrate);
updateMinMax(newsampleset->tileindex);
#endif
-#endif
}
void KDTree::updateStatsAddSample(Sample *newsample, Timestamp currenttime,
@@ -554,11 +554,10 @@
if(!tile[index].checkBounds(x,y)) return;
tile[index].updateStatsAddSample(newsample, currenttime, A, B, tile,
numTiles, tgrad, occ, samplingrate);
-#else
+#endif
tile[newsample->tileindex].updateStatsAddSample(newsample,
currenttime, A, B, tile, numTiles, tgrad, occ, samplingrate);
tile[newsample->tileindex/2].updateStatsAddSample(newsample,
currenttime, A, B, tile, numTiles, tgrad, occ, samplingrate);
updateMinMax(newsample->tileindex);
-#endif
#endif
}
Modified: branches/AFR/Engine/ImageTraversers/AFR/kdtree.h
==============================================================================
--- branches/AFR/Engine/ImageTraversers/AFR/kdtree.h (original)
+++ branches/AFR/Engine/ImageTraversers/AFR/kdtree.h Tue Aug 30 22:43:04
2005
@@ -51,9 +51,9 @@
bool isLeftChild(int index); // is the tile labeled index left
child of its parent
bool isRightChild(int index); // is the tile labeled index right
child of its parent
bool split(int index, Timestamp currenttime, unsigned int
samplingrate); // split the tile labeled index to its children
- int merge(int index, Timestamp currenttime); // merge the tile
labeled index and all its siblings to the parent tile
+ int merge(int index, Timestamp currenttime, unsigned int
samplingrate); // merge the tile labeled index and all its siblings to the
parent tile
bool splitCut(Timestamp currenttime, unsigned int samplingrate); //
split all tiles; move the cut a level down
- bool mergeCut(Timestamp currenttime); // merge all tiles; move the
cut a level up
+ bool mergeCut(Timestamp currenttime, unsigned int samplingrate); //
merge all tiles; move the cut a level up
int getmaxErrorTile(); // get the max var tile
int getminErrorParentTile(); // get the min var tile
inline double getmaxError() { return tile[1].maxError(); } //
get the maximum variance value
- [MANTA] r521 - in branches/AFR/Engine/ImageTraversers: . AFR, abhinav, 08/30/2005
Archive powered by MHonArc 2.6.16.