Changeset 2100 for GTP/trunk/Lib/Vis/Preprocessing
- Timestamp:
- 02/07/07 17:43:56 (17 years ago)
- Location:
- GTP/trunk/Lib/Vis/Preprocessing
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/EvalStats/EvalStats.vcproj
r1926 r2100 205 205 <Tool 206 206 Name="VCCLCompilerTool" 207 PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE" 208 RuntimeLibrary="0" 209 UsePrecompiledHeader="3" 210 WarningLevel="3" 211 Detect64BitPortabilityProblems="TRUE" 212 DebugInformationFormat="3"/> 213 <Tool 214 Name="VCCustomBuildTool"/> 215 <Tool 216 Name="VCLinkerTool" 217 OutputFile="$(OutDir)/EvalStats.exe" 218 LinkIncremental="1" 219 GenerateDebugInformation="TRUE" 220 SubSystem="1" 221 OptimizeReferences="2" 222 EnableCOMDATFolding="2" 207 Optimization="3" 208 GlobalOptimizations="TRUE" 209 InlineFunctionExpansion="2" 210 EnableIntrinsicFunctions="TRUE" 211 FavorSizeOrSpeed="1" 212 OmitFramePointers="TRUE" 213 EnableFiberSafeOptimizations="TRUE" 214 OptimizeForProcessor="3" 215 OptimizeForWindowsApplication="TRUE" 216 PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE" 217 RuntimeLibrary="0" 218 UsePrecompiledHeader="3" 219 WarningLevel="3" 220 Detect64BitPortabilityProblems="TRUE" 221 DebugInformationFormat="3"/> 222 <Tool 223 Name="VCCustomBuildTool"/> 224 <Tool 225 Name="VCLinkerTool" 226 OutputFile="$(OutDir)/EvalStats.exe" 227 LinkIncremental="1" 228 GenerateDebugInformation="TRUE" 229 SubSystem="1" 230 OptimizeReferences="2" 231 EnableCOMDATFolding="2" 232 OptimizeForWindows98="1" 223 233 TargetMachine="1"/> 224 234 <Tool -
GTP/trunk/Lib/Vis/Preprocessing/src/OspTree.cpp
r2017 r2100 392 392 // This is important during the subdivision 393 393 394 //MailablePvsData::NewMail();394 //MailablePvsData::NewMail(); 395 395 UpdateViewCellsPvs(front, *frontData.mRays); 396 396 UpdateViewCellsPvs(back, *backData.mRays); -
GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.vcproj
r2092 r2100 206 206 <Configuration 207 207 Name="Release Internal|Win32" 208 OutputDirectory=" $(ConfigurationName)"209 IntermediateDirectory=" $(ConfigurationName)"208 OutputDirectory="Release" 209 IntermediateDirectory="Release" 210 210 ConfigurationType="4" 211 211 CharacterSet="2"> … … 419 419 </File> 420 420 <File 421 RelativePath=".\DefaultPvs.h"> 422 </File> 423 <File 421 424 RelativePath="..\src\dual_depth.cg"> 422 425 </File> … … 482 485 </File> 483 486 <File 487 RelativePath=".\HashPvs.h"> 488 </File> 489 <File 484 490 RelativePath=".\HierarchyManager.cpp"> 485 491 </File> … … 750 756 <File 751 757 RelativePath="..\src\Pvs.h"> 758 </File> 759 <File 760 RelativePath=".\PvsBase.h"> 752 761 </File> 753 762 <File -
GTP/trunk/Lib/Vis/Preprocessing/src/Pvs.h
r2077 r2100 106 106 } 107 107 108 /////////////// /////////////108 /////////////// 109 109 // Mailing stuff 110 110 … … 172 172 { 173 173 template<typename T, typename S> 174 friend class PvsIterator;174 friend class PvsIterator; 175 175 176 176 public: 177 177 178 178 Pvs(): mSamples(0), mEntries(), mLastSorted(0), mQueriesSinceSort(0) {} 179 179 180 180 /** creates pvs and initializes it with the given entries. 181 181 Assumes that entries are sorted- 182 182 */ 183 183 Pvs(const vector<PvsEntry<T, S> > &samples); … … 186 186 /** Compresses PVS lossless or lossy. 187 187 */ 188 int Compress() {return 0;} 189 int GetSize() const {return (int)mEntries.size();} 190 bool Empty() const {return mEntries.empty();} 191 192 void Reserve(const int n) { mEntries.reserve(n); } 188 int Compress() 189 { 190 return 0; 191 } 192 193 int GetSize() const 194 { 195 return (int)mEntries.size(); 196 } 197 198 bool Empty() const 199 { 200 return mEntries.empty(); 201 } 202 203 void Reserve(const int n) 204 { 205 mEntries.reserve(n); 206 } 193 207 194 208 /** Normalize the visibility of entries in order to get 195 209 comparable results. 196 210 */ 197 211 void NormalizeMaximum(); 198 212 199 213 /** Merges pvs of a into this pvs. 200 214 Warning: very slow! 201 215 */ 202 216 void MergeInPlace(const Pvs<T, S> &a); 203 217 204 218 /** Difference of pvs to pvs b. 205 219 @returns number of different entries. 206 220 */ 207 221 int Diff(const Pvs<T, S> &b); … … 209 223 /** Finds sample in PVS. 210 224 @param checkDirty if dirty part of the pvs should be checked for entry 211 225 (warning: linear runtime in dirty part) 212 226 @returns iterator on the sample if found, else the place where 213 227 it would be added in the sorted vector. 214 228 */ 215 229 bool Find(T sample, … … 239 253 void Sort(); 240 254 241 /** Sort pvs entries assume that the pvs contains unique entries 242 */ 243 void SimpleSort(); 244 245 /** Adds sample to PVS. Assumes that the pvs is sorted 246 @returns contribution of sample (0 or 1) 247 */ 248 //float AddSamples(const vector<PvsEntry<T, S> > &samples); 255 /** Sort pvs entries assume that the pvs contains unique entries 256 */ 257 void SimpleSort(); 249 258 250 259 /** Adds sample to PVS. … … 269 278 270 279 /** Removes sample from PVS if reference count is zero. 271 280 @param visibleSamples number of references to be removed 272 281 */ 273 282 bool RemoveSample(T sample, const float pdf); … … 293 302 294 303 static void Merge(Pvs<T, S> &mergedPvs, const Pvs<T, S> &a, const Pvs<T, S> &b); 304 305 int GetSamples() const 306 { 307 return mSamples; 308 } 309 310 bool IsDirty() const 311 { 312 return mLastSorted < mEntries.size(); 313 } 314 315 bool RequiresResort() const 316 { 317 // the last part should not be more than log of the sorted part. this 318 // way we can achieve logarithmic behaviour for insertion and find 319 const int n = mEntries.size(); 320 const int dirtySize = n - mLastSorted; 321 322 #define LOG2E 1.442695040f 323 324 const float logN = log((float)max(1, n))/LOG2E; 325 const float logS = log((float)max(1, mLastSorted))/LOG2E; 326 const float logD = log((float)max(1, dirtySize))/LOG2E; 327 328 if (8*(n + 2*dirtySize*logD) < 329 mQueriesSinceSort*((mLastSorted*logS + dirtySize*dirtySize/2)/n - logN)) 330 { 331 // cout<<"Q="<<mQueriesSinceSort<<" N="<<n<<" D="<<dirtySize<<endl; 332 return true; 333 } 334 335 return false; 336 } 337 338 bool RequiresResortLog() const 339 { 340 // the last part should not be more than log of the sorted part. this 341 // way we can achieve logarithmic behaviour for insertion and find 342 const int dirtySize = (int)mEntries.size() - mLastSorted; 343 return dirtySize > 4 * (int)(log((double)mEntries.size()) / log(2.0)); 344 } 345 346 347 int GetLastSorted() const 348 { 349 return mLastSorted; 350 } 351 352 typename PvsIterator<T, S> GetIterator() const; 353 354 protected: 295 355 296 356 static void Merge(Pvs<T, S> &mergedPvs, … … 302 362 const int bSamples); 303 363 304 int GetSamples() const305 {306 return mSamples;307 }308 309 310 bool IsDirty() const311 {312 return mLastSorted < mEntries.size();313 }314 315 bool RequiresResort() const316 {317 // the last part should not be more than log of the sorted part. this318 // way we can achieve logarithmic behaviour for insertion and find319 const int n = mEntries.size();320 const int dirtySize = n - mLastSorted;321 322 #define LOG2E 1.442695040f323 324 const float logN = log((float)max(1, n))/LOG2E;325 const float logS = log((float)max(1, mLastSorted))/LOG2E;326 const float logD = log((float)max(1, dirtySize))/LOG2E;327 328 if (8*(n + 2*dirtySize*logD) <329 mQueriesSinceSort*((mLastSorted*logS + dirtySize*dirtySize/2)/n - logN)) {330 // cout<<"Q="<<mQueriesSinceSort<<" N="<<n<<" D="<<dirtySize<<endl;331 return true;332 }333 return false;334 }335 336 bool RequiresResortLog() const337 {338 // the last part should not be more than log of the sorted part. this339 // way we can achieve logarithmic behaviour for insertion and find340 const int dirtySize = (int)mEntries.size() - mLastSorted;341 return dirtySize > 4*(int)(log((double)mEntries.size()) / log(2.0));342 }343 344 345 int GetLastSorted() const346 {347 return mLastSorted;348 }349 350 typename PvsIterator<T, S> GetIterator() const;351 352 protected:353 354 364 /// vector of PVS entries 355 365 vector<PvsEntry<T, S> > mEntries; 356 366 357 367 /// Number of samples used to create the PVS 358 368 int mSamples; 359 369 360 370 /// Last sorted entry in the pvs (important for find and merge) 361 371 int mLastSorted; 362 372 363 373 int mQueriesSinceSort; 364 374 }; 365 375 … … 379 389 { 380 390 std::vector<PvsEntry<T, S> >::iterator it = mEntries.begin() + mLastSorted; 381 //std::vector<PvsEntry<T, S> >::const_iterator it = mEntries.begin() + mLastSorted;382 391 std::vector<PvsEntry<T, S> >::iterator it_end = mEntries.end(); 383 392 … … 385 394 std::vector<PvsEntry<T, S> >::iterator newEnd = unique(it, it_end); 386 395 sort(it, newEnd); 387 //sort(mEntries.begin(), mEntries.end());388 396 389 397 // now merge sorted ranges … … 452 460 const float diff = bSumPdf - aSumPdf; 453 461 454 if (diff > 0.0f) { 462 if (diff > 0.0f) 463 { 455 464 pvsEnlargement += diff; 456 } else { 465 } 466 else 467 { 457 468 pvsReduction += -diff; 458 469 } 459 470 #else 460 471 if (!entryFound) 472 { 461 473 pvsEnlargement += 1.0f; 474 } 462 475 #endif 463 476 } … … 467 480 float aSumPdf = (*it).mData.mSumPdf; 468 481 float bSumPdf = 0.0f; 469 if (aSumPdf < 0.0f) {470 482 if (aSumPdf < 0.0f) 483 { 471 484 // this entry was already accounted for! 472 485 // just revert it back 473 486 (*it).mData.mSumPdf = -aSumPdf; 474 } else { 487 } 488 else 489 { 475 490 vector<PvsEntry<T, S> >::iterator oit; 476 491 … … 592 607 mergedPvs.mEntries.push_back(*bit); 593 608 } 594 595 //bObjOld = bObj;596 609 } 597 610 … … 669 682 } 670 683 671 /*672 template <typename T, typename S>673 bool Pvs<T, S>::Find(T sample,674 typename vector<PvsEntry<T, S> >::iterator &it,675 const bool checkDirty)676 {677 PvsEntry<T, S> dummy(sample, PvsData());678 mQueriesSinceSort++;679 680 // only check clean part681 vector<PvsEntry<T, S> >::iterator sorted_end = mEntries.begin() + mLastSorted;682 683 // binary search684 it = lower_bound(mEntries.begin(), sorted_end, dummy);685 686 if ((it != mEntries.end()) && ((*it).mObject == sample))687 return true;688 689 // sample not found yet => search further in the unsorted part690 if (checkDirty)691 {692 for (it = sorted_end; (it != mEntries.end()) && ((*it).mObject != sample); ++ it);693 694 if (it != mEntries.end())695 return true;696 }697 698 return false;699 }700 */701 684 702 685 template <typename T, typename S> -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCell.cpp
r2071 r2100 1162 1162 1163 1163 1164 inline int AddedPvsSize( ObjectPvspvs1, const ObjectPvs &pvs2)1164 inline int AddedPvsSize(const ObjectPvs &pvs1, const ObjectPvs &pvs2) 1165 1165 { 1166 1166 ObjectPvs interPvs; … … 2267 2267 2268 2268 int entriesInPvs = rootEntries; 2269 const int entryStorage = sizeof(PvsData) + sizeof(int); // one entry into the pvs 2269 // one entry into the pvs 2270 const int entryStorage = sizeof(PvsData) + sizeof(int); 2270 2271 2271 2272 storageFunction.push_back(rootEntries); … … 2319 2320 } 2320 2321 } 2321 2322 2322 2323 2323 -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
r2096 r2100 27 27 #include "PerfTimer.h" 28 28 29 #include "HashPvs.h" 30 29 31 30 32 … … 1543 1545 1544 1546 castSamples += samplesPerPass; 1547 HashPvs<int> dummy; 1545 1548 1546 1549 Real timeDiff = TimeDiff(startTime, GetTime());
Note: See TracChangeset
for help on using the changeset viewer.