- Timestamp:
- 03/22/06 14:15:07 (19 years ago)
- Location:
- GTP/trunk/Lib/Vis/Preprocessing/src
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.cpp
r685 r713 301 301 302 302 float 303 GlRendererBuffer::GetPixelError( )303 GlRendererBuffer::GetPixelError(int &pvsSize) 304 304 { 305 305 float pErrorPixels = -1.0f; 306 306 307 307 glReadBuffer(GL_BACK); 308 308 … … 351 351 352 352 353 ViewCell *viewcell = mViewCellsManager->GetViewCell(mViewPoint); 354 353 ViewCell *viewcell = NULL; 354 355 PrVs prvs; 356 // mViewCellsManager->SetMaxFilterSize(1); 357 mViewCellsManager->GetPrVS(mViewPoint, prvs); 358 viewcell = prvs.mViewCell; 359 360 // ViewCell *viewcell = mViewCellsManager->GetViewCell(mViewPoint); 361 pvsSize = 0; 355 362 if (viewcell) { 356 363 SetupCamera(); … … 363 370 PvsData<Intersectable *>, 364 371 LtSample<Intersectable *> >::const_iterator it = viewcell->GetPvs().mEntries.begin(); 372 373 pvsSize = viewcell->GetPvs().mEntries.size(); 365 374 366 375 for (; it != viewcell->GetPvs().mEntries.end(); ++ it) { … … 436 445 glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); 437 446 } 447 448 if (viewcell) 449 mViewCellsManager->DeleteLocalMergeTree(viewcell); 438 450 439 451 return pErrorPixels; … … 487 499 RenderIntersectable(*oi); 488 500 489 ViewCell *viewcell = mViewCellsManager->GetViewCell(mViewPoint); 501 ViewCell *viewcell; 502 // viewcell = mViewCellsManager->GetViewCell(mViewPoint); 503 504 PrVs prvs; 505 // mViewCellsManager->SetMaxFilterSize(1); 506 mViewCellsManager->GetPrVS(mViewPoint, prvs); 507 viewcell = prvs.mViewCell; 490 508 491 509 QImage im1, im2; … … 587 605 glDisable(GL_CLIP_PLANE0); 588 606 607 if (viewcell) 608 mViewCellsManager->DeleteLocalMergeTree(viewcell); 609 589 610 return pErrorPixels; 590 611 } … … 615 636 { 616 637 for (int i=0; i < mPvsStatFrames; i++) { 617 mPvsErrorBuffer[i] = 1.0f;638 mPvsErrorBuffer[i].mError = 1.0f; 618 639 } 619 640 } … … 646 667 } 647 668 #endif 648 if (mPvsErrorBuffer[i] > 0.0f) { 649 mPvsErrorBuffer[i] = GetPixelError(); 650 cout<<"("<<i<<","<<mPvsErrorBuffer[i]<<")"; 669 if (mPvsErrorBuffer[i].mError > 0.0f) { 670 int pvsSize; 671 float error = GetPixelError(pvsSize); 672 mPvsErrorBuffer[i].mError = error; 673 mPvsErrorBuffer[i].mPvsSize = pvsSize; 674 675 cout<<"("<<i<<","<<mPvsErrorBuffer[i].mError<<")"; 651 676 // swapBuffers(); 652 677 } 653 678 654 err = mPvsErrorBuffer[i] ;679 err = mPvsErrorBuffer[i].mError; 655 680 656 681 if (err >= 0.0f) { … … 658 683 mPvsStat.maxError = err; 659 684 mPvsStat.sumError += err; 685 mPvsStat.sumPvsSize += mPvsErrorBuffer[i].mPvsSize; 686 660 687 if (err == 0.0f) 661 688 mPvsStat.errorFreeFrames++; … … 820 847 vl = new QVBoxLayout; 821 848 vbox->setLayout(vl); 822 849 850 QLabel *label = new QLabel("Granularity"); 851 vbox->layout()->addWidget(label); 852 823 853 QSlider *slider = new QSlider(Qt::Horizontal, vbox); 824 854 vl->addWidget(slider); 825 855 slider->show(); 826 slider->setRange(1, 5000);856 slider->setRange(1, 200); 827 857 slider->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); 828 slider->setValue( 500);858 slider->setValue(200); 829 859 830 860 connect(slider, SIGNAL(valueChanged(int)), SIGNAL(SetViewCellGranularity(int))); 861 862 label = new QLabel("Filter size"); 863 vbox->layout()->addWidget(label); 864 865 slider = new QSlider(Qt::Horizontal, vbox); 866 vbox->layout()->addWidget(slider); 867 slider->show(); 868 slider->setRange(1, 100); 869 slider->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); 870 slider->setValue(3); 871 872 connect(slider, SIGNAL(valueChanged(int)), SIGNAL(SetVisibilityFilterSize(int))); 831 873 832 874 … … 881 923 connect(slider, SIGNAL(valueChanged(int)), SIGNAL(SetTopDistance(int))); 882 924 925 926 927 883 928 cb = new QCheckBox("Top View", vbox); 884 929 vbox->layout()->addWidget(cb); … … 886 931 connect(cb, SIGNAL(toggled(bool)), SIGNAL(SetTopView(bool))); 887 932 888 933 setWindowTitle("Preprocessor Control Widget"); 889 934 adjustSize(); 890 935 } … … 910 955 connect(cw, SIGNAL(SetSceneCut(int)), this, SLOT(SetSceneCut(int))); 911 956 connect(cw, SIGNAL(SetTopDistance(int)), this, SLOT(SetTopDistance(int))); 957 958 //connect(cw, SIGNAL(SetViewCellGranularity(int)), this, SLOT(SetMaxFilterSize(int))); 959 // connect(cw, SIGNAL(SetVisibilityFilterSize(int)), this, SLOT(SetVisibilityFilterSize(int))); 960 //connect(cw, SIGNAL(SetVisibilityFilterSize(int)), this, SLOT(SetViewCellGranularity(int))); 961 912 962 connect(cw, SIGNAL(SetShowViewCells(bool)), this, SLOT(SetShowViewCells(bool))); 913 963 connect(cw, SIGNAL(SetTopView(bool)), this, SLOT(SetTopView(bool))); … … 921 971 GlRendererWidget::SetViewCellGranularity(int number) 922 972 { 923 mViewCellsManager->CollectViewCells(number); 973 if (mViewCellsManager) 974 mViewCellsManager->SetMaxFilterSize(number); 975 // mViewCellsManager->CollectViewCells(number); 976 updateGL(); 977 } 978 979 void 980 GlRendererWidget::SetVisibilityFilterSize(int number) 981 { 982 if (mViewCellsManager) 983 mViewCellsManager->SetMaxFilterSize(number); 924 984 updateGL(); 925 985 } -
GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.h
r608 r713 30 30 float maxError; 31 31 float sumError; 32 int sumPvsSize; 32 33 int frames; 33 34 int errorFreeFrames; … … 40 41 frames = 0; 41 42 errorFreeFrames = 0; 43 sumPvsSize = 0; 42 44 } 43 45 … … 45 47 float GetAvgError() { return sumError/frames; } 46 48 float GetErrorFreeFrames() { return errorFreeFrames/(float)frames; } 49 float GetAvgPvs() { return sumPvsSize/(float)frames; } 47 50 48 51 }; … … 161 164 162 165 float 163 GetPixelError( );166 GetPixelError(int &pvsSize); 164 167 165 168 int ComputePvs(ObjectContainer &objects, ObjectContainer &pvs) const; … … 168 171 169 172 int mPvsStatFrames; 170 vector<float> mPvsErrorBuffer; 173 struct PvsErrorEntry { 174 PvsErrorEntry() {} 175 float mError; 176 int mPvsSize; 177 }; 178 179 vector<PvsErrorEntry> mPvsErrorBuffer; 180 171 181 private: 172 182 … … 190 200 SetSceneCut(int); 191 201 SetTopDistance(int); 202 SetVisibilityFilterSize(int); 192 203 193 204 SetShowViewCells(bool); … … 195 206 SetCutViewCells(bool); 196 207 SetCutScene(bool); 208 197 209 198 210 }; … … 256 268 SetViewCellGranularity(int number); 257 269 258 void 259 SetSceneCut(int cut); 260 261 void 262 SetTopDistance(int dist); 263 270 void 271 SetVisibilityFilterSize(int number); 272 273 void 274 SetSceneCut(int cut); 275 276 void 277 SetTopDistance(int dist); 278 264 279 void SetShowViewCells(bool b) { 265 280 mRenderViewCells = b; -
GTP/trunk/Lib/Vis/Preprocessing/src/Makefile
r695 r713 1 1 ############################################################################# 2 2 # Makefile for building: preprocessor 3 # Generated by qmake (2.00a) (Qt 4.1.0) on: st 15. III 09:41:5820063 # Generated by qmake (2.00a) (Qt 4.1.0) on: po 20. III 17:50:07 2006 4 4 # Project: preprocessor.pro 5 5 # Template: app -
GTP/trunk/Lib/Vis/Preprocessing/src/Pvs.h
r705 r713 119 119 pvsReduction, 120 120 pvsEnlargement; 121 121 122 122 ComputeContinuousPvsDifference(pvs, 123 123 pvsReduction, 124 124 pvsEnlargement); 125 125 126 126 return pvsReduction + pvsEnlargement; 127 127 } … … 161 161 data->mSumPdf = -aSumPdf; 162 162 } 163 164 #if 0 163 165 float diff = bSumPdf - aSumPdf; 164 166 … … 168 170 pvsReduction += -diff; 169 171 } 172 #else 173 if (!data) 174 pvsEnlargement += 1.0f; 175 #endif 170 176 } 171 177 … … 182 188 bSumPdf = data->mSumPdf; 183 189 } 190 #if 0 184 191 float diff = bSumPdf - aSumPdf; 185 192 … … 189 196 pvsReduction += -diff; 190 197 } 198 199 #else 200 if (!data) 201 pvsReduction += 1.0f; 202 #endif 191 203 } 192 204 } -
GTP/trunk/Lib/Vis/Preprocessing/src/RssPreprocessor.cpp
r677 r713 446 446 "#AvgPvsRenderError\n" <<renderer->mPvsStat.GetAvgError()<<endl<< 447 447 "#MaxPvsRenderError\n" <<renderer->mPvsStat.GetMaxError()<<endl<< 448 "#ErrorFreeFrames\n" <<renderer->mPvsStat.GetErrorFreeFrames()<<endl; 448 "#ErrorFreeFrames\n" <<renderer->mPvsStat.GetErrorFreeFrames()<<endl<< 449 "#AvgRenderPvs\n" <<renderer->mPvsStat.GetAvgPvs()<<endl; 449 450 } 450 451 } … … 558 559 Debug<<"Valid viewcells before set validity: "<<mViewCellsManager->CountValidViewcells()<<endl; 559 560 // cull viewcells with PVS > median (0.5f) 560 mViewCellsManager->SetValidityPercentage(0, 0.5f);561 // mViewCellsManager->SetValidityPercentage(0, 0.5f); 561 562 Debug<<"Valid viewcells after set validity: "<<mViewCellsManager->CountValidViewcells()<<endl; 562 563 -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
r712 r713 615 615 neighborhood.pop_back(); 616 616 617 // cout << "vc idx: " << bestViewCellIdx << endl;617 // cout << "vc idx: " << bestViewCellIdx << endl; 618 618 if (!bestViewCell || !root) 619 619 cout << "warning!!" << endl; … … 627 627 628 628 629 struct SortableViewCellEntry { 630 631 SortableViewCellEntry() {} 632 SortableViewCellEntry(const float v, ViewCell *cell):mValue(v), mViewCell(cell) {} 633 634 float mValue; 635 ViewCell *mViewCell; 636 637 friend bool operator<(const SortableViewCellEntry &a, const SortableViewCellEntry &b) { 638 return a.mValue < b.mValue; 639 } 640 }; 641 642 ViewCell * 643 ViewCellsManager::ConstructLocalMergeTree2(ViewCell *currentViewCell, 644 const ViewCellContainer &viewCells) 645 { 646 647 vector<SortableViewCellEntry> neighborhood(viewCells.size()); 648 int i, j; 649 for (i = 0, j = 0; i < viewCells.size(); i++) { 650 if (viewCells[i] != currentViewCell) 651 neighborhood[j++] = SortableViewCellEntry( 652 EvalMergeCost(currentViewCell, viewCells[i]), 653 viewCells[i]); 654 } 655 neighborhood.resize(j); 656 657 sort(neighborhood.begin(), neighborhood.end()); 658 659 ViewCell *root = currentViewCell; 660 661 vector<SortableViewCellEntry>::const_iterator it, it_end = neighborhood.end(); 662 663 const int n = min(mMaxFilterSize, (int)neighborhood.size()); 664 //-- use priority queue to merge leaf pairs 665 666 //cout << "neighborhood: " << neighborhood.size() << endl; 667 for (int nMergedViewCells = 0; nMergedViewCells < n; ++ nMergedViewCells) 668 { 669 ViewCell *bestViewCell = neighborhood[nMergedViewCells].mViewCell; 670 //cout <<nMergedViewCells<<":"<<"homogenity=" <<neighborhood[nMergedViewCells].mValue<<endl; 671 // create new root of the hierarchy 672 root = MergeViewCells(root, bestViewCell); 673 // set negative cost so that this view cell gets deleted 674 root->SetMergeCost(-1.0f); 675 } 676 677 return root; 678 } 679 680 void 681 ViewCellsManager::DeleteLocalMergeTree(ViewCell *vc 682 ) const 683 { 684 if (!vc->IsLeaf() && vc->GetMergeCost() < 0.0f) { 685 ViewCellInterior *vci = (ViewCellInterior *) vc; 686 ViewCellContainer::const_iterator it, it_end = vci->mChildren.end(); 687 688 for (it = vci->mChildren.begin(); it != it_end; ++ it) 689 DeleteLocalMergeTree(*it); 690 vci->mChildren.clear(); 691 delete vci; 692 } 693 } 694 629 695 bool ViewCellsManager::CheckValidity(ViewCell *vc, 630 696 int minPvsSize, … … 672 738 ComputeBoxIntersections(box, viewCells); 673 739 674 ViewCell *root = ConstructLocalMergeTree (currentViewCell, viewCells);740 ViewCell *root = ConstructLocalMergeTree2(currentViewCell, viewCells); 675 741 676 742 prvs.mViewCell = root; -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.h
r710 r713 423 423 void EvalViewCellPartition(Preprocessor *preprocessor); 424 424 425 425 void SetMaxFilterSize(const int size) { 426 mMaxFilterSize = size; 427 } 428 429 /** deletes interior nodes from the tree which have negative merge cost set (local merge) */ 430 void 431 DeleteLocalMergeTree(ViewCell *vc 432 ) const; 433 426 434 protected: 427 435 … … 495 503 ViewCell *ConstructLocalMergeTree(ViewCell *currentViewCell, 496 504 const ViewCellContainer &viewCells); 505 506 /** Constructs local view cell merge hierarchy based solely on similarity with the 507 current viewcell 508 */ 509 ViewCell *ConstructLocalMergeTree2(ViewCell *currentViewCell, 510 const ViewCellContainer &viewCells); 511 497 512 498 513 /** Creates clip plane for visualization. -
GTP/trunk/Lib/Vis/Preprocessing/src/default.env
r685 r713 26 26 type rss 27 27 detectEmptyViewSpace true 28 pvsRenderErrorSamples 10000 29 quitOnFinish false 30 computeVisibility false 28 pvsRenderErrorSamples 5000 29 # pvsRenderErrorSamples 1000 30 quitOnFinish true 31 computeVisibility true 31 32 } 32 33 … … 75 76 76 77 RssPreprocessor { 77 samplesPerPass 10000078 samplesPerPass 500000 78 79 initialSamples 500000 79 vssSamples 500000080 vssSamplesPerPass 50000080 vssSamples 20000000 81 vssSamplesPerPass 1000000 81 82 useImportanceSampling true 82 83 … … 176 177 } 177 178 179 Filter { 180 maxSize 20 181 width 200.0 182 } 183 178 184 #number of active view cells 179 active 1024185 active 3000 180 186 maxStaticMemory 40 181 187 … … 185 191 #type kdTree 186 192 #type vspKdTree 187 type bspTree188 #type vspBspTree193 #type bspTree 194 type vspBspTree 189 195 #type sceneDependent 190 196 … … 235 241 236 242 Evaluation { 237 samplesPerPass 80000238 samples 1000 000243 samplesPerPass 500 244 samples 1000 239 245 statsPrefix ../scripts/viewCells 240 246 } … … 248 254 # filename ../scripts/viewcells_soda5-2.xml 249 255 # filename ../data/soda/soda5-viewcells.xml 250 filename ../scripts/viewcells_atlanta.xml 256 # filename ../scripts/viewcells_atlanta.xml 257 filename ../data/soda/soda5-viewcells2.xml 251 258 } 252 259 … … 348 355 minGlobalCostRatio 0.0000001 349 356 # minGlobalCostRatio 0.0001 350 maxViewCells 20000357 maxViewCells 3000 351 358 352 359
Note: See TracChangeset
for help on using the changeset viewer.