Changeset 600 for trunk/VUT/GtpVisibilityPreprocessor/src/ViewCell.cpp
- Timestamp:
- 02/06/06 19:09:53 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/GtpVisibilityPreprocessor/src/ViewCell.cpp
r590 r600 22 22 bool operator() (T v1, T v2) const 23 23 { 24 return (v1->Get TimeStamp() < v2->GetTimeStamp());24 return (v1->GetMergeCost() < v2->GetMergeCost()); 25 25 } 26 26 }; … … 107 107 mValid(true), 108 108 mParent(NULL), 109 m TimeStamp(0),109 mMergeCost(0), 110 110 mIsActive(false) 111 111 { … … 119 119 mValid(true), 120 120 mParent(NULL), 121 m TimeStamp(0),121 mMergeCost(0), 122 122 mIsActive(false) 123 123 { … … 230 230 231 231 232 void ViewCell::Set TimeStamp(const int timeStamp)233 { 234 m TimeStamp = timeStamp;235 } 236 237 238 int ViewCell::GetTimeStamp() const239 { 240 return m TimeStamp;232 void ViewCell::SetMergeCost(const float mergeCost) 233 { 234 mMergeCost = mergeCost; 235 } 236 237 238 float ViewCell::GetMergeCost() const 239 { 240 return mMergeCost; 241 241 } 242 242 … … 445 445 float variance = 0; 446 446 int totalPvs = 0; 447 float total Cost = 0;447 float totalRenderCost = 0; 448 448 449 449 //-- compute statistics values of initial view cells 450 mViewCellsManager->EvaluateRenderStatistics(total Cost,450 mViewCellsManager->EvaluateRenderStatistics(totalRenderCost, 451 451 mExpectedCost, 452 452 mDeviation, … … 471 471 Debug << "deviation: " << mDeviation << endl; 472 472 Debug << "avg render cost: " << mAvgRenderCost << endl; 473 Debug << "expected cost: " << mExpectedCost << endl;473 Debug << "expected cost: " << mExpectedCost << endl; 474 474 475 475 … … 498 498 499 499 // frequency stats are updated 500 const int statsOut = 1 00;500 const int statsOut = 1; 501 501 502 502 // passes are needed for statistics, because we don't want to record … … 521 521 522 522 //-- use priority queue to merge leaf pairs 523 524 while (!mMergeQueue.empty())// && (realNumActiveViewCells > mMergeMinViewCells)) 523 // HACK 524 //const float maxAvgCost = 350; 525 while (!mMergeQueue.empty())//NumActiveViewCells > mMergeMinViewCells)) 525 526 { 526 527 //-- reset merge queue if the ratio of current expected cost / real expected cost … … 588 589 { 589 590 ViewCell::NewMail(); 590 591 592 //-- update statistical values 591 593 -- realNumActiveViewCells; 592 594 ++ mergeStats.merged; 593 595 ++ mergedPerPass; 594 596 595 596 //-- update statistical values 597 const float renderCostIncr = mc.GetRenderCost(); 598 const float mergeCostIncr = mc.GetMergeCost(); 599 600 totalRenderCost += renderCostIncr; 601 mDeviation += mc.GetDeviationIncr(); 602 603 604 // merge the view cells of leaf1 and leaf2 605 int pvsDiff; 606 ViewCellInterior *mergedVc = 607 MergeViewCells(mc.mLeftViewCell, mc.mRightViewCell, pvsDiff); 608 597 609 598 610 // total render cost and deviation has changed … … 600 612 // cost heuristics, but cannot recompute costs on each increase of the 601 613 // expected cost 602 603 totalCost += mc.GetRenderCost();604 mDeviation += mc.GetDeviationIncr();605 606 realExpectedCost = totalCost / (float)realNumActiveViewCells;607 608 const float currentMergeCost = mc.GetMergeCost();609 610 // merge the view cells of leaf1 and leaf2611 int pvsDiff;612 ViewCellInterior *mergedVc =613 MergeViewCells(mc.mLeftViewCell, mc.mRightViewCell, pvsDiff);614 615 614 totalPvs += pvsDiff; 616 617 // set timestamp 618 mergedVc->SetTimeStamp(mergeStats.merged); 619 615 realExpectedCost = totalRenderCost / (float)realNumActiveViewCells; 620 616 realAvgRenderCost = (float)totalPvs / (float)realNumActiveViewCells; 617 618 // set merge cost to this node 619 mergedVc->SetMergeCost(totalRenderCost); 620 621 621 #if VC_HISTORY 622 622 if (mc.mLeftViewCell->IsSibling(mc.mRightViewCell)) … … 632 632 << "#Merged\n" << mergeStats.merged << endl 633 633 << "#Viewcells\n" << realNumActiveViewCells << endl 634 << "#CurrentCost\n" << currentMergeCost << endl 635 << "#RelativeCost\n" << currentMergeCost / mOverallCost << endl 636 << "#CurrentPvs\n" << mc.GetLeftViewCell()->GetPvs().GetSize() << endl 637 << "#MergedSiblings\n" << mergeStats.siblings << endl 638 << "#AvgTreeDist\n" << mergeStats.AvgTreeDist() << endl 639 << "#UsedExpectedCost\n" << mExpectedCost << endl 640 << "#RealExpectedCost\n" << realExpectedCost << endl 641 << "#RealAvgRenderCost\n" << realAvgRenderCost << endl 642 << "#AvgRenderCost\n" << mAvgRenderCost << endl 643 << "#expectedCostRatio\n" << mExpectedCost / realExpectedCost << endl 644 << "#Deviation\n" << mDeviation / (float)realNumActiveViewCells << endl 645 << "#TotalDeviation\n" << mDeviation<< endl; 634 << "#RenderCostIncrease\n" << renderCostIncr << endl 635 << "#TotalRenderCost\n" << totalRenderCost << endl 636 << "#CurrentPvs\n" << mergedVc->GetPvs().GetSize() << endl 637 << "#ExpectedCost\n" << realExpectedCost << endl 638 << "#AvgRenderCost\n" << realAvgRenderCost << endl 639 << "#Deviation\n" << mDeviation << endl 640 << "#TotalPvs\n" << totalPvs << endl 641 << "#PvsSizeDecrease\n" << -pvsDiff << endl; 646 642 } 647 643 } … … 682 678 }*/ 683 679 ViewCellInterior *root = mViewCellsManager->MergeViewCells(activeViewCells); 684 685 root->SetTimeStamp(mergeStats.merged + 1); 680 root->SetMergeCost(totalRenderCost); 686 681 mRoot = root; 687 682 } … … 692 687 } 693 688 689 690 while (!mMergeQueue.empty()) 691 { 692 mMergeQueue.pop(); 693 } 694 695 694 696 // TODO delete because makes no sense here 695 697 mergeStats.expectedRenderCost = realExpectedCost;
Note: See TracChangeset
for help on using the changeset viewer.