Changeset 2353 for GTP/trunk/Lib/Vis/Preprocessing
- Timestamp:
- 05/08/07 13:04:43 (18 years ago)
- Location:
- GTP/trunk/Lib/Vis/Preprocessing
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/EvalStats/EvalStats.vcproj
r2280 r2353 106 106 </Configuration> 107 107 <Configuration 108 Name="mlrt|Win32"109 OutputDirectory="$(ConfigurationName)"110 IntermediateDirectory="$(ConfigurationName)"111 ConfigurationType="1"112 CharacterSet="2">113 <Tool114 Name="VCCLCompilerTool"115 PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"116 RuntimeLibrary="0"117 UsePrecompiledHeader="3"118 WarningLevel="3"119 Detect64BitPortabilityProblems="TRUE"120 DebugInformationFormat="3"/>121 <Tool122 Name="VCCustomBuildTool"/>123 <Tool124 Name="VCLinkerTool"125 OutputFile="$(OutDir)/EvalStats.exe"126 LinkIncremental="1"127 GenerateDebugInformation="TRUE"128 SubSystem="1"129 OptimizeReferences="2"130 EnableCOMDATFolding="2"131 TargetMachine="1"/>132 <Tool133 Name="VCMIDLTool"/>134 <Tool135 Name="VCPostBuildEventTool"/>136 <Tool137 Name="VCPreBuildEventTool"/>138 <Tool139 Name="VCPreLinkEventTool"/>140 <Tool141 Name="VCResourceCompilerTool"/>142 <Tool143 Name="VCWebServiceProxyGeneratorTool"/>144 <Tool145 Name="VCXMLDataGeneratorTool"/>146 <Tool147 Name="VCWebDeploymentTool"/>148 <Tool149 Name="VCManagedWrapperGeneratorTool"/>150 <Tool151 Name="VCAuxiliaryManagedWrapperGeneratorTool"/>152 </Configuration>153 <Configuration154 Name="Release_Internal|Win32"155 OutputDirectory="$(ConfigurationName)"156 IntermediateDirectory="$(ConfigurationName)"157 ConfigurationType="1"158 CharacterSet="2">159 <Tool160 Name="VCCLCompilerTool"161 PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"162 RuntimeLibrary="0"163 UsePrecompiledHeader="3"164 WarningLevel="3"165 Detect64BitPortabilityProblems="TRUE"166 DebugInformationFormat="3"/>167 <Tool168 Name="VCCustomBuildTool"/>169 <Tool170 Name="VCLinkerTool"171 OutputFile="$(OutDir)/EvalStats.exe"172 LinkIncremental="1"173 GenerateDebugInformation="TRUE"174 SubSystem="1"175 OptimizeReferences="2"176 EnableCOMDATFolding="2"177 TargetMachine="1"/>178 <Tool179 Name="VCMIDLTool"/>180 <Tool181 Name="VCPostBuildEventTool"/>182 <Tool183 Name="VCPreBuildEventTool"/>184 <Tool185 Name="VCPreLinkEventTool"/>186 <Tool187 Name="VCResourceCompilerTool"/>188 <Tool189 Name="VCWebServiceProxyGeneratorTool"/>190 <Tool191 Name="VCXMLDataGeneratorTool"/>192 <Tool193 Name="VCWebDeploymentTool"/>194 <Tool195 Name="VCManagedWrapperGeneratorTool"/>196 <Tool197 Name="VCAuxiliaryManagedWrapperGeneratorTool"/>198 </Configuration>199 <Configuration200 108 Name="Release Internal|Win32" 201 OutputDirectory=" ..\bin\Release"202 IntermediateDirectory=" ..\obj\Release"109 OutputDirectory="Release" 110 IntermediateDirectory="Release" 203 111 ConfigurationType="1" 204 112 CharacterSet="2"> … … 226 134 OutputFile="$(OutDir)/EvalStats.exe" 227 135 LinkIncremental="1" 228 GenerateDebugInformation=" TRUE"136 GenerateDebugInformation="FALSE" 229 137 SubSystem="1" 230 138 OptimizeReferences="2" … … 255 163 <Configuration 256 164 Name="Release_qt|Win32" 257 OutputDirectory=" $(ConfigurationName)"258 IntermediateDirectory=" $(ConfigurationName)"165 OutputDirectory="Release" 166 IntermediateDirectory="Release" 259 167 ConfigurationType="1" 260 168 CharacterSet="2"> … … 274 182 LinkIncremental="1" 275 183 GenerateDebugInformation="TRUE" 184 SubSystem="1" 185 OptimizeReferences="2" 186 EnableCOMDATFolding="2" 187 TargetMachine="1"/> 188 <Tool 189 Name="VCMIDLTool"/> 190 <Tool 191 Name="VCPostBuildEventTool"/> 192 <Tool 193 Name="VCPreBuildEventTool"/> 194 <Tool 195 Name="VCPreLinkEventTool"/> 196 <Tool 197 Name="VCResourceCompilerTool"/> 198 <Tool 199 Name="VCWebServiceProxyGeneratorTool"/> 200 <Tool 201 Name="VCXMLDataGeneratorTool"/> 202 <Tool 203 Name="VCWebDeploymentTool"/> 204 <Tool 205 Name="VCManagedWrapperGeneratorTool"/> 206 <Tool 207 Name="VCAuxiliaryManagedWrapperGeneratorTool"/> 208 </Configuration> 209 <Configuration 210 Name="Release_noqt|Win32" 211 OutputDirectory="Release" 212 IntermediateDirectory="Release" 213 ConfigurationType="1" 214 CharacterSet="2"> 215 <Tool 216 Name="VCCLCompilerTool" 217 PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE" 218 RuntimeLibrary="0" 219 UsePrecompiledHeader="3" 220 WarningLevel="3" 221 Detect64BitPortabilityProblems="TRUE" 222 DebugInformationFormat="3"/> 223 <Tool 224 Name="VCCustomBuildTool"/> 225 <Tool 226 Name="VCLinkerTool" 227 OutputFile="Release/EvalStats.exe" 228 LinkIncremental="1" 229 GenerateDebugInformation="FALSE" 276 230 SubSystem="1" 277 231 OptimizeReferences="2" … … 325 279 </FileConfiguration> 326 280 <FileConfiguration 327 Name="mlrt|Win32">328 <Tool329 Name="VCCLCompilerTool"330 UsePrecompiledHeader="1"/>331 </FileConfiguration>332 <FileConfiguration333 Name="Release_Internal|Win32">334 <Tool335 Name="VCCLCompilerTool"336 UsePrecompiledHeader="1"/>337 </FileConfiguration>338 <FileConfiguration339 281 Name="Release Internal|Win32"> 340 282 <Tool … … 344 286 <FileConfiguration 345 287 Name="Release_qt|Win32"> 288 <Tool 289 Name="VCCLCompilerTool" 290 UsePrecompiledHeader="1"/> 291 </FileConfiguration> 292 <FileConfiguration 293 Name="Release_noqt|Win32"> 346 294 <Tool 347 295 Name="VCCLCompilerTool" -
GTP/trunk/Lib/Vis/Preprocessing/src/HierarchyManager.cpp
r2342 r2353 285 285 286 286 // split was not reevaluated before => do it now 287 if (splitCandidate->IsDirty()) 287 // matt: for new evaluation method, we cannot be sure if the candidate is dirty, 288 // so ALWAYS reevaluate 289 if (1 || splitCandidate->IsDirty()) 288 290 { 289 291 splitCandidate->EvalCandidate(); … … 2509 2511 } 2510 2512 2511 #ifdef USE_SSE 2513 2512 2514 int HierarchyManager::CastLineSegment(RayPacket &packet) 2513 2515 { … … 2515 2517 } 2516 2518 2517 #endif 2518 2519 } 2519 2520 } -
GTP/trunk/Lib/Vis/Preprocessing/src/HierarchyManager.h
r2347 r2353 318 318 const bool useMailboxing = true); 319 319 320 #ifdef USE_SSE321 320 int CastLineSegment(RayPacket &packet); 322 #endif323 321 324 322 -
GTP/trunk/Lib/Vis/Preprocessing/src/Mutation.cpp
r2210 r2353 49 49 // cout<<mRays[i].mMutations<<" "; 50 50 // cout<<endl; 51 cerr<<"Mu attion update..."<<endl;51 cerr<<"Mutation update..."<<endl; 52 52 cerr<<"rays = "<<mRays.size()<<endl; 53 53 if ((int)mRays.size()) { -
GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.vcproj
r2342 r2353 80 80 UsePrecompiledHeader="0" 81 81 BrowseInformation="1" 82 WarningLevel="2"83 Detect64BitPortabilityProblems="TRUE"84 DebugInformationFormat="3"/>85 <Tool86 Name="VCCustomBuildTool"/>87 <Tool88 Name="VCLibrarianTool"/>89 <Tool90 Name="VCMIDLTool"/>91 <Tool92 Name="VCPostBuildEventTool"/>93 <Tool94 Name="VCPreBuildEventTool"/>95 <Tool96 Name="VCPreLinkEventTool"/>97 <Tool98 Name="VCResourceCompilerTool"/>99 <Tool100 Name="VCWebServiceProxyGeneratorTool"/>101 <Tool102 Name="VCXMLDataGeneratorTool"/>103 <Tool104 Name="VCManagedWrapperGeneratorTool"/>105 <Tool106 Name="VCAuxiliaryManagedWrapperGeneratorTool"/>107 </Configuration>108 <Configuration109 Name="Release_Internal|Win32"110 OutputDirectory="$(ConfigurationName)"111 IntermediateDirectory="$(ConfigurationName)"112 ConfigurationType="4"113 CharacterSet="2">114 <Tool115 Name="VCCLCompilerTool"116 Optimization="0"117 InlineFunctionExpansion="0"118 FavorSizeOrSpeed="0"119 OptimizeForWindowsApplication="TRUE"120 AdditionalIncludeDirectories="..\include;"$(QTDIR)\include\QtCore";"$(QTDIR)\include\QtGui";"$(QTDIR)\include";"$(QTDIR)\include\QtOpenGl";..\src;"$(CG_INC_PATH)";..\..\..\..\..\..\NonGTP\Devil\include;..\..\..\..\..\..\NonGTP\Zlib\include;..\..\..\..\..\..\NonGTP\Xerces;"$(BOOST_INCLUDE)";..\..\Preprocessing\MultiLevelRayTracing"121 PreprocessorDefinitions="WIN32;NDEBUG;_LIB"122 ExceptionHandling="TRUE"123 RuntimeLibrary="2"124 DisableLanguageExtensions="FALSE"125 ForceConformanceInForLoopScope="FALSE"126 RuntimeTypeInfo="TRUE"127 UsePrecompiledHeader="0"128 82 WarningLevel="2" 129 83 Detect64BitPortabilityProblems="TRUE" … … 270 224 </Configuration> 271 225 <Configuration 272 Name="Release_ Qt|Win32"226 Name="Release_qt|Win32" 273 227 OutputDirectory="..\lib\Release" 274 228 IntermediateDirectory="..\obj\Release" … … 627 581 <FileConfiguration 628 582 Name="Release|Win32"> 629 <Tool630 Name="VCCustomBuildTool"631 Description=""632 CommandLine=""633 Outputs=""/>634 </FileConfiguration>635 <FileConfiguration636 Name="Release_Internal|Win32">637 583 <Tool 638 584 Name="VCCustomBuildTool" … … 658 604 </FileConfiguration> 659 605 <FileConfiguration 660 Name="Release_ Qt|Win32">606 Name="Release_qt|Win32"> 661 607 <Tool 662 608 Name="VCCustomBuildTool" … … 679 625 <FileConfiguration 680 626 Name="Release|Win32"> 681 <Tool682 Name="VCCustomBuildTool"683 Description=""684 CommandLine=""685 Outputs=""/>686 </FileConfiguration>687 <FileConfiguration688 Name="Release_Internal|Win32">689 627 <Tool 690 628 Name="VCCustomBuildTool" … … 710 648 </FileConfiguration> 711 649 <FileConfiguration 712 Name="Release_ Qt|Win32">650 Name="Release_qt|Win32"> 713 651 <Tool 714 652 Name="VCCustomBuildTool" -
GTP/trunk/Lib/Vis/Preprocessing/src/SamplingStrategy.cpp
r2227 r2353 496 496 } 497 497 498 // add contributions of the sample to the strategies 498 499 #if TEST_PACKETS 500 501 // add contributions of the sample to the strategies 502 void MixtureDistribution::ComputeContributions(VssRayContainer &vssRays) 503 { 504 int i; 505 506 mPreprocessor.mViewCellsManager->ComputeSampleContributions(vssRays, true, false); 507 508 VssRayContainer::iterator it = vssRays.begin(); 509 510 for (i=0; i < mDistributions.size(); i++) { 511 mDistributions[i]->mContribution = 0; 512 mDistributions[i]->mRays = 0; 513 } 514 515 for(; it != vssRays.end(); ++ it) 516 { 517 VssRay *ray = *it; 518 519 for (i = 0; i < mDistributions.size() - 1; ++ i) 520 { 521 if (mDistributions[i]->mType == ray->mDistribution) 522 break; 523 } 524 525 float contribution = 526 mPreprocessor.mViewCellsManager->ComputeSampleContribution(*ray, true, false); 527 528 mDistributions[i]->mContribution += contribution; 529 mDistributions[i]->mRays ++; 530 531 mDistributions[i]->mTotalContribution += contribution; 532 mDistributions[i]->mTotalRays ++; 533 } 534 535 UpdateRatios(); 536 537 538 const float vcTime = viewCellCastTimer.TotalTime(); 539 const float pvsTime = pvsTimer.TotalTime(); 540 const float haltonTime = haltonTimer.TotalTime(); 541 542 cout << "view cell cast time: " << vcTime << " s" << endl; 543 cout << "pvs time: " << pvsTime << " s" << endl; 544 cout << "halton time: "<< haltonTime << " s" << endl; 545 546 Debug << "view cell cast time: " << vcTime << " s" << endl; 547 Debug << "pvs time: " << pvsTime << " s" << endl; 548 Debug << "halton time: "<< haltonTime << " s" << endl; 549 } 550 551 552 #else 553 554 // add contributions of the sample to the strategies 499 555 void 500 556 MixtureDistribution::ComputeContributions(VssRayContainer &vssRays) 501 557 { 502 int i; 503 504 VssRayContainer::iterator it = vssRays.begin(); 505 506 for (i=0; i < mDistributions.size(); i++) { 507 mDistributions[i]->mContribution = 0; 508 mDistributions[i]->mRays = 0; 509 } 510 511 for(; it != vssRays.end(); ++it) { 512 VssRay *ray = *it; 513 for (i=0; i < mDistributions.size()-1; i++) { 514 if (mDistributions[i]->mType == ray->mDistribution) 515 break; 516 } 517 518 float contribution = 519 mPreprocessor.mViewCellsManager->ComputeSampleContribution(*ray, 520 true, 521 false); 522 523 mDistributions[i]->mContribution += contribution; 524 mDistributions[i]->mRays ++; 525 526 mDistributions[i]->mTotalContribution += contribution; 527 mDistributions[i]->mTotalRays ++; 528 } 529 530 #if 0 531 pvsTimer.Entry(); 532 // resort pvss 533 mPreprocessor.mViewCellsManager->SortViewCellPvs(); 534 pvsTimer.Exit(); 558 int i; 559 560 VssRayContainer::iterator it = vssRays.begin(); 561 562 for (i=0; i < mDistributions.size(); i++) { 563 mDistributions[i]->mContribution = 0; 564 mDistributions[i]->mRays = 0; 565 } 566 567 for(; it != vssRays.end(); ++it) { 568 VssRay *ray = *it; 569 for (i=0; i < mDistributions.size()-1; i++) { 570 if (mDistributions[i]->mType == ray->mDistribution) 571 break; 572 } 573 574 float contribution = 575 mPreprocessor.mViewCellsManager->ComputeSampleContribution(*ray, 576 true, 577 false); 578 579 mDistributions[i]->mContribution += contribution; 580 mDistributions[i]->mRays ++; 581 582 mDistributions[i]->mTotalContribution += contribution; 583 mDistributions[i]->mTotalRays ++; 584 } 585 586 UpdateRatios(); 587 588 589 if (1) 590 { 591 const float vcTime = viewCellCastTimer.TotalTime(); 592 const float pvsTime = pvsTimer.TotalTime(); 593 const float haltonTime = haltonTimer.TotalTime(); 594 595 cout << "view cell cast time: " << vcTime << " s" << endl; 596 cout << "pvs time: " << pvsTime << " s" << endl; 597 cout << "halton time: "<< haltonTime << " s" << endl; 598 599 Debug << "view cell cast time: " << vcTime << " s" << endl; 600 Debug << "pvs time: " << pvsTime << " s" << endl; 601 Debug << "halton time: "<< haltonTime << " s" << endl; 602 } 603 } 604 535 605 #endif 536 606 537 538 UpdateRatios();539 540 #if 1541 const float vcTime = viewCellCastTimer.TotalTime();542 const float pvsTime = pvsTimer.TotalTime();543 const float haltonTime = haltonTimer.TotalTime();544 545 cout << "view cell cast time: " << vcTime << " s" << endl;546 cout << "pvs time: " << pvsTime << " s" << endl;547 cout << "halton time: "<< haltonTime << " s" << endl;548 // cout<<"obj time:"<<objTimer.TotalTime()<<" s"<<endl;549 550 Debug << "view cell cast time: " << vcTime << " s" << endl;551 Debug << "pvs time: " << pvsTime << " s" << endl;552 Debug << "halton time: "<< haltonTime << " s" << endl;553 #endif554 }555 607 556 608 void -
GTP/trunk/Lib/Vis/Preprocessing/src/TestPreprocessor.vcproj
r2347 r2353 212 212 OptimizeForProcessor="1" 213 213 OptimizeForWindowsApplication="TRUE" 214 AdditionalIncludeDirectories="..\include;..\..\..\..\..\..\NonGTP\Boost;..\src;..\..\..\..\..\..\NonGTP\Devil\include;..\..\..\..\..\..\NonGTP\Zlib\include;..\..\..\..\..\..\NonGTP\Xerces ;"$(QTDIR)\include\QtOpenGl";"$(QTDIR)\include\Qt";"$(QTDIR)\include\QtCore";"$(QTDIR)\include""214 AdditionalIncludeDirectories="..\include;..\..\..\..\..\..\NonGTP\Boost;..\src;..\..\..\..\..\..\NonGTP\Devil\include;..\..\..\..\..\..\NonGTP\Zlib\include;..\..\..\..\..\..\NonGTP\Xerces" 215 215 PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;GTP_INTERNAL;NO_QT;USE_SSE" 216 216 RuntimeLibrary="2" … … 226 226 Name="VCLinkerTool" 227 227 AdditionalDependencies="xerces-c_2.lib glew32.lib zdll.lib zziplib.lib devil.lib glut32.lib OpenGL32.Lib glu32.lib Preprocessor.lib RTScene.lib RTWorld.lib" 228 OutputFile="../bin/release/Preprocessor 2.exe"228 OutputFile="../bin/release/Preprocessor.exe" 229 229 LinkIncremental="1" 230 230 AdditionalLibraryDirectories="..\src\GL;..\lib\release;..\..\Preprocessing\lib\release;..\..\..\..\..\..\NonGTP\Boost\lib;..\..\..\..\..\..\NonGTP\Xerces\xercesc\lib;..\..\..\..\..\..\NonGTP\Zlib\lib;..\..\..\..\..\..\NonGTP\Devil\lib;..\MultiLevelRayTracing\RTScene\Release;..\MultiLevelRayTracing\RTWorld\Release" … … 258 258 </Configuration> 259 259 <Configuration 260 Name="Release_ Qt|Win32"260 Name="Release_qt|Win32" 261 261 OutputDirectory="..\bin\Release" 262 262 IntermediateDirectory="..\obj\Release" -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
r2351 r2353 6652 6652 stream << "</ViewCells>" << endl; 6653 6653 6654 6654 6655 ////////////////////// 6655 6656 //-- export the view space hierarchy … … 6808 6809 } 6809 6810 6810 6811 #if 16812 6811 6813 6812 void VspOspViewCellsManager::EvalViewCellPartition() … … 6898 6897 Debug << "statistics computed in " << timeDiff * 1e-3 << " secs" << endl; 6899 6898 6900 #if 06901 //////////////6902 // filtered stats6903 6904 sprintf(suffix, "-%09d-eval-filter.log", castSamples);6905 const string filename2 = string(statsPrefix) + string(suffix);6906 6907 startTime = GetTime();6908 6909 cout << "compute new statistics for filtered pvs ... " << endl;6910 6911 ofstream ofstr2(filename2.c_str());6912 mHierarchyManager->EvaluateSubdivision2(ofstr2, splitsStepSize, true);6913 6914 timeDiff = TimeDiff(startTime, GetTime());6915 cout << "finished in " << timeDiff * 1e-3 << " secs" << endl;6916 cout << "*************************************" << endl;6917 Debug << "filtered statistics computed in " << timeDiff * 1e-3 << " secs" << endl;6918 #endif6919 6920 // only for debugging purpose6921 if (0)6922 {6923 ViewCellContainer viewCells;6924 mViewCellsTree->CollectLeaves(mViewCellsTree->GetRoot(), viewCells);6925 6926 ViewCellContainer::const_iterator vit, vit_end = viewCells.end();6927 int pvsSize = 0;6928 6929 for (vit = viewCells.begin(); vit != vit_end; ++ vit)6930 {6931 pvsSize += (*vit)->GetPvs().GetSize();6932 }6933 6934 cout << "debug entries: " << pvsSize << ", memcost: "6935 << (float)pvsSize * ObjectPvs::GetEntrySize() << endl;6936 }6937 6899 ++ pass; 6938 6900 } … … 6959 6921 6960 6922 //for (int pass = histoStepSize; pass <= numLeaves; pass += histoStepSize) 6961 if (1) 6962 { 6963 string filename; 6964 6965 cout << "computing histogram for " << pass << " view cells" << endl; 6966 6967 ////////////////////////////////////////// 6968 //-- evaluate histogram for pvs size 6969 6970 cout << "computing pvs histogram for " << pass << " view cells" << endl; 6971 6972 sprintf(str, "-%09d-histo-pvs2.log", pass); 6973 filename = string(statsPrefix) + string(str); 6974 6975 EvalViewCellHistogramForPvsSize(filename, pass); 6976 } 6977 } 6978 } 6979 6980 #endif 6923 6924 string filename; 6925 6926 cout << "computing histogram for " << pass << " view cells" << endl; 6927 6928 ///////////////////////////// 6929 //-- evaluate histogram for pvs size 6930 6931 cout << "computing pvs histogram for " << pass << " view cells" << endl; 6932 6933 sprintf(str, "-%09d-histo-pvs2.log", pass); 6934 filename = string(statsPrefix) + string(str); 6935 6936 EvalViewCellHistogramForPvsSize(filename, pass); 6937 } 6938 } 6939 6981 6940 6982 6941 void VspOspViewCellsManager::FinalizeViewCells(const bool createMesh) … … 6993 6952 6994 6953 #if TEST_PACKETS 6995 #ifdef USE_SSE 6996 6997 float ViewCellsManager::ComputeSampleContributions(const VssRayContainer &rays, 6998 const bool addContributions, 6999 const bool storeViewCells, 7000 const bool useHitObjects) 7001 { 6954 6955 float VspOspViewCellsManager::ComputeSampleContributions(const VssRayContainer &rays, 6956 const bool addContributions, 6957 const bool storeViewCells, 6958 const bool useHitObjects) 6959 { 6960 if (!ViewCellsConstructed()) 6961 return 0; 6962 7002 6963 float sum = 0.0f; 7003 7004 6964 VssRayContainer::const_iterator it, it_end = rays.end(); 7005 6965 7006 6966 VssRayContainer tmpRays; 7007 RayPacket packet;7008 6967 7009 6968 for (it = rays.begin(); it != it_end; ++ it) 7010 6969 { 7011 if (!ViewCellsConstructed()) 7012 { 7013 // view cells not yet constructed 7014 // just take the lenghts of the rays as contributions 7015 if ((*it)->mTerminationObject) 6970 sum += ComputeSampleContribution(*(*it), addContributions, storeViewCells, useHitObjects); 6971 6972 tmpRays.push_back(new VssRay(*(*it))); 6973 6974 if (tmpRays.size() == 4) 6975 { 6976 // cast packets of 4 rays 6977 RayPacket packet(tmpRays); 6978 mHierarchyManager->CastLineSegment(packet); 6979 6980 for (int i = 0; i < 4; ++ i) 7016 6981 { 7017 sum += (*it)->Length(); 6982 ComputeSampleContribution(*tmpRays[i], addContributions, true, useHitObjects); 6983 6984 ////////// 6985 // compare results 6986 6987 cout << "ray " << i << ": " << (int)tmpRays[i]->mViewCells.size() << " " << (int)packet.mViewCells[i].size() << endl; 7018 6988 } 7019 } 7020 else 7021 { 7022 sum += ComputeSampleContribution(*(*it), addContributions, storeViewCells, useHitObjects); 7023 7024 tmpRays.push_back(new VssRay(*it)); 6989 7025 6990 7026 if (tmpRays.size() == 4) 7027 { 7028 // cast packets of 4 rays 7029 RayPacket packet(tmpRays); 7030 mHierarchyManager->CastLineSegment(packet); 7031 7032 for (int i = 0; i < 4; ++ i) 7033 { 7034 ComputeSampleContribution(tmpRays[i], addContributions, true, useHitObjects); 7035 } 7036 7037 // compare results 7038 ////////// 7039 7040 CLEAR_CONTAINER(tmpRays); 7041 } 7042 } 7043 } 6991 6992 CLEAR_CONTAINER(tmpRays); 6993 } 6994 } 6995 cout << "=================\nhere6"<<endl; 6996 CLEAR_CONTAINER(tmpRays); 7044 6997 7045 6998 cout << "view cell cast time: " << viewCellCastTimer.TotalTime() << " s" << endl; … … 7053 7006 7054 7007 #endif 7055 #endif 7056 7057 } 7008 7009 7010 } -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.h
r2332 r2353 1225 1225 }; 1226 1226 1227 #define TEST_EVALUATION 0 1228 1229 /** 1230 Manages different higher order operations on the view cells. 1227 1228 1229 /** Manages different higher order operations on the view cells. 1231 1230 */ 1232 1231 class VspOspViewCellsManager: public ViewCellsManager … … 1301 1300 1302 1301 #if TEST_PACKETS 1303 #ifdef USE_SSE 1304 1305 float ViewCellsManager::ComputeSampleContributions(const VssRayContainer &rays, 1306 const bool addContributions, 1307 const bool storeViewCells, 1308 const bool useHitObjects); 1309 1302 1303 float ComputeSampleContributions(const VssRayContainer &rays, 1304 const bool addContributions, 1305 const bool storeViewCells, 1306 const bool useHitObjects = false); 1310 1307 #endif 1311 #endif1312 1308 1313 1309 protected: … … 1315 1311 VspOspViewCellsManager(ViewCellsTree *vcTree, HierarchyManager *hm); 1316 1312 1317 #if 1//TEST_EVALUATION1318 1313 virtual void EvalViewCellPartition(); 1319 #endif1320 1314 1321 1315 /** Exports view cell geometry. … … 1349 1343 static HierarchyManager *CreateHierarchyManager(const string &name); 1350 1344 1351 //void ExportStats(const string &mergeStats);1352 1353 1345 /** collect objects intersecting a given spatial box 1354 1346 */ -
GTP/trunk/Lib/Vis/Preprocessing/src/VspTree.cpp
r2351 r2353 1623 1623 1624 1624 const float oldRenderCost = penaltyOld * pOverall; 1625 const float newRenderCost = sc.mCorrectedFrontRenderCost * pFront + 1626 sc.mCorrectedBackRenderCost * pBack; 1625 const float newRenderCost = sc.mCorrectedFrontRenderCost * pFront + sc.mCorrectedBackRenderCost * pBack; 1627 1626 1628 1627 … … 1634 1633 1635 1634 #if GTP_DEBUG 1636 Debug << "old: " << normalizedOldRenderCost << " new: " << newRenderCost / viewSpaceVol << " corr: " << tData.mCorrectedRenderCost << " ratio: " << oldRenderCostRatio << endl; 1635 Debug << "old: " << normalizedOldRenderCost << " new: " << newRenderCost / viewSpaceVol 1636 << " corr: " << tData.mCorrectedRenderCost << " ratio: " << oldRenderCostRatio << endl; 1637 1637 #endif 1638 1638 … … 2425 2425 tStack.push(LineTraversalData(farChild, extp, maxt)); //TODO 2426 2426 2427 // new exit point for near child 2427 2428 extp = origin + dir * tdist; 2428 2429 maxt = tdist; … … 2453 2454 break; 2454 2455 2456 // set new entry point for far child 2455 2457 entp = extp; 2456 2458 mint = maxt; … … 2469 2471 2470 2472 2473 int VspTree::TraverseRayPacket(RayPacket &rp, const bool useMailboxing) 2474 { 2471 2475 #ifdef USE_SSE 2472 int VspTree::TraverseRayPacket(RayPacket &rp,2473 const bool useMailboxing)2474 {2475 2476 int hits = 0; 2476 2477 … … 2479 2480 float zero = 0.0f; 2480 2481 2481 __m128 one4 = _mm_load_ps(&one); 2482 __m128 zero4 = _mm_load_ps(&zero); 2483 2484 __m128 *entp4; 2485 __m128 *extp4; 2486 2487 union { float mask[4]; __m128 mask4; }; 2482 __m128 one4 = _mm_load1_ps(&one); 2483 __m128 zero4 = _mm_load1_ps(&zero); 2484 2485 union { __m128 mask4; float mask[4];}; 2486 union { __m128 mask4_2; float mask_2[4];}; 2487 2488 2488 mask4 = one4; 2489 2489 2490 __m128 entpX4 = rp.mOriginX4; 2491 __m128 entpY4 = rp.mOriginY4; 2492 __m128 entpZ4 = rp.mOriginZ4; 2493 2494 __m128 extpX4 = rp.mTerminationX4; 2495 __m128 extpY4 = rp.mTerminationY4; 2496 __m128 extpZ4 = rp.mTerminationZ4; 2490 __declspec(align(16)) __m128 entp4[] = {rp.mOriginX4, rp.mOriginY4, rp.mOriginZ4}; 2491 __declspec(align(16)) __m128 extp4[] = {rp.mTerminationX4, rp.mTerminationY4, rp.mTerminationZ4}; 2497 2492 2498 2493 __m128 *origin = &rp.mOriginX4; … … 2511 2506 __m128 minT4 = zero4; 2512 2507 2513 stack<PacketTraversalData *> tStack; 2514 2508 PacketTraversalStack tStack(1000); 2515 2509 2516 2510 VspNode *node = mRoot; … … 2527 2521 { 2528 2522 VspInterior *in = static_cast<VspInterior *>(node); 2529 2530 entp4 = &entpX4; 2531 extp4 = &extpX4; 2532 2523 2533 2524 position = in->GetPosition(); 2534 2525 axis = in->GetAxis(); 2535 2526 2536 position4 = _mm_load _ps(&position);2527 position4 = _mm_load1_ps(&position); 2537 2528 2538 2529 // are the entry points all in near leaf? … … 2540 2531 { 2541 2532 // are the exit points all in near leaf? 2542 if (_mm_movemask_ps(_mm_and_ps(_mm_cmp gt_ps(extp4[axis], position4), mask4)))2533 if (_mm_movemask_ps(_mm_and_ps(_mm_cmple_ps(extp4[axis], position4), mask4))) 2543 2534 { 2544 2535 node = in->GetBack(); … … 2555 2546 else 2556 2547 { 2557 if (_mm_movemask_ps(_mm_and_ps(_mm_cmpgt_ps(position4, extp4[axis]), mask4))) 2548 if (_mm_movemask_ps(_mm_and_ps(_mm_cmple_ps(position4, entp4[axis]), mask4)) && 2549 _mm_movemask_ps(_mm_and_ps(_mm_cmple_ps(position4, extp4[axis]), mask4))) 2558 2550 { 2559 2551 node = in->GetFront(); … … 2573 2565 const __m128 tDist4 = _mm_mul_ps(_mm_sub_ps(position4, origin[axis]), termination[axis]); 2574 2566 2567 mask4 = _mm_and_ps(_mm_cmplt_ps(tDist4, minT4), mask4); 2568 mask4_2 = _mm_and_ps(_mm_cmpgt_ps(tDist4, minT4), mask4); 2569 2575 2570 // push far child for further processing 2576 tStack. push(new PacketTraversalData(farChild, extpX4, extpY4, extpZ4, maxT4, mask4));2571 tStack.Push(PacketTraversalData(farChild, extp4[0], extp4[1], extp4[2], maxT4, mask4_2)); 2577 2572 2578 2573 // compute new exit point 2579 extp X4= _mm_add_ps(_mm_mul_ps(dirX4, tDist4), rp.mOriginX4);2580 extp Y4= _mm_add_ps(_mm_mul_ps(dirY4, tDist4), rp.mOriginY4);2581 extp Z4= _mm_add_ps(_mm_mul_ps(dirZ4, tDist4), rp.mOriginZ4);2574 extp4[0] = _mm_add_ps(_mm_mul_ps(dirX4, tDist4), rp.mOriginX4); 2575 extp4[1] = _mm_add_ps(_mm_mul_ps(dirY4, tDist4), rp.mOriginY4); 2576 extp4[2] = _mm_add_ps(_mm_mul_ps(dirZ4, tDist4), rp.mOriginZ4); 2582 2577 2583 2578 maxT4 = tDist4; 2584 2585 mask4 = _mm_cmplt_ps( maxT4, minT4);2586 2579 } 2587 2580 else … … 2602 2595 for (int i = 0; i < 4; ++i) 2603 2596 { 2597 // push view cells for all valid rays 2604 2598 if (mask[i]) 2605 2599 rp.mViewCells[i].push_back(viewCell); … … 2610 2604 2611 2605 // get the next node from the stack 2612 if (tStack. empty())2606 if (tStack.Empty()) 2613 2607 break; 2614 2615 entpX4 = extpX4; 2616 entpY4 = extpY4; 2617 entpZ4 = extpZ4; 2608 2609 // use memcopy? 2610 entp4[0] = extp4[0]; 2611 entp4[1] = extp4[1]; 2612 entp4[2] = extp4[2]; 2618 2613 2619 2614 minT4 = maxT4; 2615 2616 const PacketTraversalData &s = tStack.Top(); 2617 node = s.mNode; 2620 2618 2621 PacketTraversalData *s = tStack.top(); 2622 node = s->mNode; 2619 extp4[0] = s.mExitPointX4; 2620 extp4[1] = s.mExitPointY4; 2621 extp4[2] = s.mExitPointZ4; 2622 2623 maxT4 = s.mMaxT4; 2624 mask4 = s.mMask4; 2623 2625 2624 extpX4 = s->mExitPointX4; 2625 extpY4 = s->mExitPointY4; 2626 extpZ4 = s->mExitPointZ4; 2627 2628 maxT4 = s->mMaxT4; 2629 2630 mask4 = s->mMask4; 2631 2632 tStack.pop(); 2633 delete s; 2634 } 2635 } 2636 2626 tStack.Pop(); 2627 } 2628 } 2629 2637 2630 return hits; 2638 2631 2639 /* 2640 const int offs[4] = {(rp.dx[0] >= 0) ? 1 : 0, (rp.dy[0] >= 0)? 1 : 0, (rp.dz[0] >= 0)? 1 : 0, 0}; 2641 2642 while (!node->IsLeaf()) 2643 { 2644 PacketTraversalData *tData = tStack.top(); 2645 tStack.pop(); 2646 2647 node = tData->node; 2648 VspInterior *interior = static_cast<VspInterior *>(node); 2649 tn4 = tData->tn4; 2650 tf4 = tData->tf4; 2651 mask = tData->mask4; 2652 2653 position = interior->GetPosition(); 2654 const __m128 position4 = _mm_load_ps(&pos); 2655 2656 const int axis = interior->GetAxis(); 2657 const __m128 d4 = _mm_mul_ps(_mm_sub_ps(splitPos, origin[axis]), termination[axis]); 2658 2659 VspNode* ln = offs[axis] ? interior->GetFront() : interior->GetBack(); 2660 2661 if (!_mm_movemask_ps(_mm_and_ps(_mm_cmpgt_ps(d4, tn4), mask))) 2662 { 2663 node = ln; 2664 continue; 2665 } 2666 2667 node = offs[axis]^1 ? interior->GetFront() : interior->GetBack();// + (offs[aidx]^1); 2668 2669 if (_mm_movemask_ps( _mm_and_ps( _mm_cmplt_ps(d4, tf4), mask))) 2670 { 2671 const __m128 mask2 = _mm_cmpgt_ps(d4, tn4); 2672 const __m128 mask3 = _mm_cmplt_ps(d4, tf4); 2673 2674 2675 tData->tf4 = tf4 = _mm_or_ps(_mm_and_ps(mask3, d4), _mm_andnot_ps( mask3, tf4)); 2676 tData->node = (VspNode *)ln; 2677 tData->mask4 = mask; 2678 tData->tn4 = _mm_or_ps( _mm_and_ps( mask2, d4 ), _mm_andnot_ps( mask2, tn4 ) ); 2679 mask = _mm_cmplt_ps( tn4, tf4 ); 2680 } 2681 }*/ 2682 } 2632 #else 2633 2634 return 0; 2683 2635 #endif 2636 } 2684 2637 2685 2638 -
GTP/trunk/Lib/Vis/Preprocessing/src/VspTree.h
r2347 r2353 1128 1128 int CompressObjects(VspLeaf *leaf); 1129 1129 1130 int TraverseRayPacket(RayPacket &rp, const bool useMailboxing); 1130 1131 1131 1132 #ifdef USE_SSE 1132 1133 struct PacketTraversalData 1133 1134 { 1135 PacketTraversalData () {} 1136 1137 PacketTraversalData (VspNode *n, 1138 const __m128 &px, const __m128 &py, const __m128 &pz, 1139 const __m128 &maxt, 1140 const __m128 &mask): 1141 mNode(n), 1142 mExitPointX4(px), mExitPointY4(py), mExitPointZ4(pz), 1143 mMaxT4(maxt), 1144 mMask4(mask) 1145 {} 1146 1134 1147 VspNode *mNode; 1135 1148 1136 union { float mExitPointX[4]; __m128 mExitPointX4; }; 1137 union { float mExitPointY[4]; __m128 mExitPointY4; }; 1138 union { float mExitPointZ[4]; __m128 mExitPointZ4; }; 1139 1140 union { float mMaxT[4]; __m128 mMaxT4; }; 1141 union { float mMask[4]; __m128 mMask4; }; 1142 1143 PacketTraversalData () {} 1144 PacketTraversalData (VspNode *n, 1145 const __m128 &px, const __m128 &py, const __m128 &pz, 1146 const __m128 &maxt, 1147 const __m128 &mask): 1148 mNode(n), 1149 mExitPointX4(px), mExitPointY4(py), mExitPointZ4(pz), 1150 mMaxT4(maxt), 1151 mMask4(mask) 1152 {} 1149 union { __m128 mExitPointX4; float mExitPointX[4]; }; 1150 union { __m128 mExitPointY4; float mExitPointY[4]; }; 1151 union { __m128 mExitPointZ4; float mExitPointZ[4]; }; 1152 1153 union { __m128 mMaxT4; float mMaxT[4]; }; 1154 union { __m128 mMask4; float mMask[4]; }; 1153 1155 }; 1154 1156 1155 1157 1156 int TraverseRayPacket(RayPacket &rp, const bool useMailboxing); 1158 struct __declspec(align(16)) PacketTraversalStack 1159 { 1160 // for performance 1161 friend class VspTree; 1162 1163 public: 1164 PacketTraversalStack(const int depth): 1165 mStackPtr(0), 1166 //mDepth(depth) 1167 mDepth(1000) 1168 { 1169 //mData = new PacketTraversalData[mDepth]; 1170 } 1171 1172 ~PacketTraversalStack() 1173 { 1174 //delete [] mData; 1175 } 1176 1177 //PacketTraversalStack() {} 1178 1179 void Pop() {-- mStackPtr;} 1180 const PacketTraversalData &Top() const { return mData[mStackPtr - 1];} 1181 1182 void Push(const PacketTraversalData &tData) 1183 { 1184 // note: faster with direct assignments 1185 mData[mStackPtr ++] = tData; 1186 //if (mStackPtr == mDepth) std::cerr << "this can never happen!!" << std::endl; 1187 } 1188 1189 bool Empty() const {return mStackPtr <= 0;} 1190 1191 protected: 1192 1193 // static array to avoid using operator new 1194 //PacketTraversalData *mData; 1195 PacketTraversalData mData[1000]; 1196 1197 int mStackPtr; 1198 int mDepth; 1199 1200 }; 1157 1201 1158 1202 #endif -
GTP/trunk/Lib/Vis/Preprocessing/src/VssRay.h
r2342 r2353 22 22 #define VSS_STORE_VIEWCELLS 1 23 23 24 #ifdef USE_SSE25 26 struct RayPacket27 {28 union { float mOriginX[4]; __m128 mOriginX4; };29 union { float mOriginY[4]; __m128 mOriginY4; };30 union { float mOriginZ[4]; __m128 mOriginZ4; };31 32 union { float mTerminationX[4]; __m128 mTerminationX4; };33 union { float mTerminationY[4]; __m128 mTerminationY4; };34 union { float mTerminationZ[4]; __m128 mTerminationZ4; };35 36 ViewCellContainer mViewCells[4];37 };38 39 40 #endif41 24 42 25 … … 345 328 void PrintStatistics(std::ostream &s); 346 329 int SelectRays(const int number, VssRayContainer &selected, const bool copy=false) const; 347 int 348 GetContributingRays(VssRayContainer &selected, 349 const int minPass 350 ) const; 351 352 }; 353 354 /* 355 struct VssRayDistribution { 356 VssRayDistribution() { mContribution = -1.0f; } 357 SimpleRayContainer mRays; 358 vector<VssRayContainer> mVssRays; 359 float mContribution; 360 float mTime; 361 }; 362 363 struct VssRayDistributionMixture { 364 VssRayDistributionMixture() {} 365 366 vector<VssRayDistribution> distributions; 367 }; 368 */ 369 370 }; 371 372 #endif 330 int GetContributingRays(VssRayContainer &selected, const int minPass) const; 331 332 }; 333 334 335 struct RayPacket 336 { 337 RayPacket(const VssRayContainer &rays) 338 { 339 for (int i = 0; i < 4; ++ i) 340 mOriginX[i] = rays[i]->mOrigin[0]; 341 342 for (int i = 0; i < 4; ++ i) 343 mOriginY[i] = rays[i]->mOrigin[1]; 344 345 for (int i = 0; i < 4; ++ i) 346 mOriginZ[i] = rays[i]->mOrigin[2]; 347 } 348 #ifdef USE_SSE 349 union { float mOriginX[4]; __m128 mOriginX4; }; 350 union { float mOriginY[4]; __m128 mOriginY4; }; 351 union { float mOriginZ[4]; __m128 mOriginZ4; }; 352 353 union { float mTerminationX[4]; __m128 mTerminationX4; }; 354 union { float mTerminationY[4]; __m128 mTerminationY4; }; 355 union { float mTerminationZ[4]; __m128 mTerminationZ4; }; 356 #else 357 float mOriginX[4]; 358 float mOriginY[4]; 359 float mOriginZ[4]; 360 361 float mTerminationX[4]; 362 float mTerminationY[4]; 363 float mTerminationZ[4]; 364 #endif 365 ViewCellContainer mViewCells[4]; 366 }; 367 368 369 }; 370 371 #endif -
GTP/trunk/Lib/Vis/Preprocessing/src/main.cpp
r2176 r2353 184 184 } 185 185 #endif 186 186 187 187 Environment::GetSingleton()->Parse(argc, argv, USE_EXE_PATH); 188 188 MeshKdTree::ParseEnvironment();
Note: See TracChangeset
for help on using the changeset viewer.