- Timestamp:
- 03/01/06 18:30:23 (19 years ago)
- Location:
- GTP/trunk/Lib/Vis
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/scripts/egsr_test_script
r667 r668 3 3 4 4 #SCENE=soda5 5 SCENE=soda6 #SCENE=atlanta5 #SCENE=soda 6 SCENE=atlanta 7 7 #SCENE=vienna 8 8 … … 22 22 METHOD=vspbsp 23 23 24 $PROGRAM $ENVIRONMENT \ 25 -view_cells_type=vspBspTree \ 26 -view_cells_evaluation_stats_prefix=$LOG_PREFIX-$METHOD \ 27 -view_cells_merge_stats=$LOG_PREFIX-$METHOD-mergeStats.log \ 28 -vsp_bsp_subdivision_stats=$LOG_PREFIX-$METHOD-subdivisionStats.log \ 29 -view_cells_post_process_merge=true \ 24 echo "$SCENE $METHOD" 25 26 27 $PROGRAM $ENVIRONMENT \ 28 -view_cells_type=vspBspTree \ 29 -view_cells_evaluation_stats_prefix=$LOG_PREFIX-$METHOD \ 30 -view_cells_merge_stats=$LOG_PREFIX-$METHOD-mergeStats.log \ 31 -vsp_bsp_subdivision_stats=$LOG_PREFIX-$METHOD-subdivisionStats.log \ 32 -view_cells_post_process_merge=true \ 33 -view_cells_filename=$LOG_PREFIX-$METHOD-viewCells.x3d 34 35 mv debug.log $LOG_PREFIX-$METHOD-debug.log 36 37 38 39 ################################################################ 40 # vspbsptree (only subdivision) # 41 ################################################################ 42 43 # 44 # only view space subdivision, no merge 45 # 46 47 48 METHOD=onlysubdiv 49 50 echo "$SCENE $METHOD" 51 52 $PROGRAM $ENVIRONMENT \ 53 -view_cells_type=vspBspTree \ 54 -view_cells_evaluation_stats_prefix=$LOG_PREFIX-$METHOD \ 55 -view_cells_merge_stats=$LOG_PREFIX-$METHOD-mergeStats.log \ 56 -vsp_bsp_subdivision_stats=$LOG_PREFIX-$METHOD-subdivisionStats.log \ 57 -view_cells_post_process_merge=false \ 30 58 -view_cells_filename=$LOG_PREFIX-$METHOD-viewCells.x3d 31 59 … … 44 72 METHOD=bsp 45 73 74 echo "$SCENE $METHOD" 75 46 76 $PROGRAM $ENVIRONMENT \ 47 77 -view_cells_type=bspTree \ … … 65 95 66 96 METHOD=nirenstein 97 98 echo "$SCENE $METHOD" 67 99 68 100 $PROGRAM $ENVIRONMENT \ … … 98 130 METHOD=kd 99 131 132 echo "$SCENE $METHOD" 133 100 134 $PROGRAM $ENVIRONMENT \ 101 135 -view_cells_type=vspBspTree \ … … 126 160 METHOD=octree 127 161 162 echo "$SCENE $METHOD" 163 128 164 $PROGRAM $ENVIRONMENT \ 129 165 -view_cells_type=vspBspTree \ … … 145 181 146 182 147 148 183 # 149 184 # for internal testing only … … 153 188 154 189 ################################################################ 155 # vspbsptree (only subdivision) #156 ################################################################157 158 #159 # only view space subdivision, no merge160 #161 162 163 METHOD=onlysubdiv164 165 $PROGRAM $ENVIRONMENT \166 -view_cells_type=vspBspTree \167 -view_cells_evaluation_stats_prefix=$LOG_PREFIX-$METHOD \168 -view_cells_merge_stats=$LOG_PREFIX-$METHOD-mergeStats.log \169 -vsp_bsp_subdivision_stats=$LOG_PREFIX-$METHOD-subdivisionStats.log \170 -view_cells_post_process_merge=false \171 -view_cells_filename=$LOG_PREFIX-$METHOD-viewCells.x3d172 173 mv debug.log $LOG_PREFIX-$METHOD-debug.log174 175 176 177 ################################################################178 190 # vspbsptree - few samples # 179 191 ################################################################ … … 184 196 185 197 METHOD=vsp-many-samples 198 199 echo "$SCENE $METHOD" 186 200 187 201 $PROGRAM $ENVIRONMENT \ … … 208 222 METHOD=vsp-good-merge 209 223 224 echo "$SCENE $METHOD" 225 210 226 $PROGRAM $ENVIRONMENT \ 211 227 -view_cells_type=vspBspTree \ … … 231 247 232 248 METHOD=vsp-many-samples 249 250 echo "$SCENE $METHOD" 233 251 234 252 $PROGRAM $ENVIRONMENT \ … … 255 273 METHOD=vsp-many-samples-no-split-queue 256 274 275 echo "$SCENE $METHOD" 276 257 277 $PROGRAM $ENVIRONMENT \ 258 278 -view_cells_type=vspBspTree \ -
GTP/trunk/Lib/Vis/shared/EvalStats/EvalStats.cpp
r667 r668 15 15 difference in percent of the weighted render cost. 16 16 */ 17 bool extractRenderCost(ifstream &file, vector<float> &renderCosts) 17 18 19 struct RenderStats 20 { 21 float mRenderCost; 22 float mAvgRenderCost; 23 }; 24 25 26 typedef vector<RenderStats> StatsContainer; 27 28 29 enum {NO_TAG, RENDER_COST, AVG_RENDER_COST}; 30 31 32 bool extractRenderStats(ifstream &file, StatsContainer &renderStats) 18 33 { 19 34 if (!file.is_open()) … … 21 36 22 37 string buf; 23 bool isRenderCost = false;24 38 39 int currentTag = NO_TAG; 40 25 41 while (!(getline(file, buf)).eof()) 26 42 { 43 //cout << "buf: " << buf << endl; 44 27 45 if (buf[0] == '#') 28 46 { … … 31 49 sscanf(buf.c_str(), "#%s", entry); 32 50 33 if (strcmp(entry, "TotalRenderCost") == 0) 34 isRenderCost = true; 51 // new entry 52 if (strcmp(entry, "Pass") == 0) 53 { 54 //cout << "\nnew render stat " << endl; 55 renderStats.push_back(RenderStats()); 56 } 57 else if (strcmp(entry, "TotalRenderCost") == 0) 58 { 59 currentTag = RENDER_COST; 60 } 61 else if (strcmp(entry, "AvgRenderCost") == 0) 62 { 63 currentTag = AVG_RENDER_COST; 64 } 35 65 } 36 else if (isRenderCost)66 else 37 67 { 38 float rc;39 sscanf(buf.c_str(), "%f", & rc);68 float val; 69 sscanf(buf.c_str(), "%f", &val); 40 70 41 renderCosts.push_back(rc); 42 isRenderCost = false; 71 switch (currentTag) 72 { 73 case RENDER_COST: 74 //cout << "render cost: " << val << endl; 75 renderStats.back().mRenderCost = val; 76 break; 77 case AVG_RENDER_COST: 78 //cout << "avg render cost: " << val << endl; 79 renderStats.back().mAvgRenderCost = val; 80 break; 81 default: 82 break; 83 } 84 85 currentTag = NO_TAG; 43 86 } 44 87 } … … 47 90 } 48 91 92 93 94 void ComputeStats(ofstream &statsOut, 95 const RenderStats &firstStats, 96 const RenderStats ¤tStats, 97 const int index) 98 { 99 float denom = currentStats.mRenderCost ? currentStats.mRenderCost : 0.000001f; 100 float costRatio = firstStats.mRenderCost / denom; 101 102 denom = firstStats.mAvgRenderCost ? firstStats.mAvgRenderCost : 0.000001f; 103 float avgCostRatio = firstStats.mAvgRenderCost / denom; 104 105 statsOut << "#ViewCells\n" << index + 1 << endl 106 << "#TotalRenderCostGain\n" << 100.0f - costRatio * 100.0f << endl 107 << "#AvgRenderCostGain\n" << 100.0f - avgCostRatio * 100.0f << endl << endl; 108 } 109 110 111 49 112 int _tmain(int argc, _TCHAR* argv[]) 50 113 { 51 vector<float> renderCosts1; 52 vector<float> renderCosts2; 114 vector<StatsContainer> renderStats; 53 115 54 if (argc < 4)116 if (argc < 3) 55 117 { 56 cerr << "arguments missing " << endl;118 cerr << "arguments missing. Usage: input1 input2 ... intputn" << endl; 57 119 exit(1); 58 120 } 59 121 122 vector<string> outFilenames; 60 123 61 // read two files and the output file 124 // read input files from command line 125 for (int i = 1; i < argc; ++ i) 126 { 127 StatsContainer currentStats; 128 129 ifstream file(argv[i]); 62 130 63 // read file 1 64 ifstream file1(argv[1]); 131 // extract the render cost 132 cout << "extracting render cost of file " << argv[i] << endl; 133 cout.flush(); 65 134 66 // extract the render cost 67 cout << "extracting render cost of file " << argv[1] << endl; 68 cout.flush(); 69 extractRenderCost(file1, renderCosts1); 135 extractRenderStats(file, currentStats); 136 renderStats.push_back(currentStats); 70 137 71 // read file 2 72 ifstream file2(argv[2]); 73 cout << "extracting render cost of file " << argv[2] << endl; 74 cout.flush(); 75 extractRenderCost(file2, renderCosts2); 138 // create output file name 139 string fn = argv[i]; 140 141 string::size_type pos = fn.find(".log", 0); 142 fn.erase(pos, 4); 143 //sscanf(argv[i], "%s.log", fn); 144 string outFilename = string(fn) + string("-ratio.log"); 76 145 77 78 cout << "writing output to file " << argv[3] << endl; 79 80 ofstream statsOut(argv[3]); 146 outFilenames.push_back(outFilename); 147 } 81 148 82 149 //statsOut << "rc1 size: " << (int)renderCosts1.size() << " " << (int)renderCosts2.size() << endl << endl; 83 int n = min((int)renderCosts1.size(), (int)renderCosts2.size()); 150 vector<StatsContainer>::const_iterator it = renderStats.begin(), it_end = renderStats.end(); 151 vector<string>::const_iterator sit, sit_end = outFilenames.end(); 152 153 sit = outFilenames.begin(); 84 154 85 if (argc > 4) 155 // compare all values with this vector 156 StatsContainer &firstStats = renderStats[0]; 157 158 // don't compare with itself 159 ++ it; 160 ++ sit; 161 162 for (it; it != it_end; ++ it) 86 163 { 87 char *endptr = NULL; 88 89 int limit = strtol(argv[4], &endptr, 10); 90 91 n = min(n, limit); 92 } 164 cout << "writing output to file " << *sit << endl; 93 165 94 for (int i = 0; i < n; ++ i) 95 { 96 float costRatio = renderCosts2[i] != 0 ? 97 renderCosts1[i] / renderCosts2[i] : renderCosts1[i] / 0.0000001f; 166 ofstream statsOut((*sit).c_str()); 167 ++ sit; 98 168 99 statsOut << "#ViewCells\n" << i + 1 << endl 100 << "#RenderCostRatio\n" << costRatio * 100.0f << endl; 169 cout << "size here" << (*it).size() << endl; 170 // compute size of output vector 171 const int n = min((int)firstStats.size(), (int)(*it).size()); 172 173 for (int i = 0; i < n; ++ i) 174 { 175 ComputeStats(statsOut, firstStats[i], (*it)[i], i); 176 } 177 cout << "here2 " << n << endl; 178 statsOut.close(); 101 179 } 102 180 -
GTP/trunk/Lib/Vis/shared/scripts/GtpVisibility.sln
r643 r668 17 17 ProjectSection(ProjectDependencies) = postProject 18 18 {101A7691-74F3-48B4-96A3-CF35578F5900} = {101A7691-74F3-48B4-96A3-CF35578F5900} 19 EndProjectSection 20 EndProject 21 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "EvalStats", "..\EvalStats\EvalStats.vcproj", "{935D1BDD-41B0-49F1-A86C-EB49B94DDB20}" 22 ProjectSection(ProjectDependencies) = postProject 19 23 EndProjectSection 20 24 EndProject … … 41 45 {80DECC17-BDDD-4412-8CF8-F7C1C17A7436}.Release.ActiveCfg = Release|Win32 42 46 {80DECC17-BDDD-4412-8CF8-F7C1C17A7436}.Release.Build.0 = Release|Win32 47 {935D1BDD-41B0-49F1-A86C-EB49B94DDB20}.Debug.ActiveCfg = Debug|Win32 48 {935D1BDD-41B0-49F1-A86C-EB49B94DDB20}.Debug.Build.0 = Debug|Win32 49 {935D1BDD-41B0-49F1-A86C-EB49B94DDB20}.Release.ActiveCfg = Release|Win32 50 {935D1BDD-41B0-49F1-A86C-EB49B94DDB20}.Release.Build.0 = Release|Win32 43 51 EndGlobalSection 44 52 GlobalSection(ExtensibilityGlobals) = postSolution
Note: See TracChangeset
for help on using the changeset viewer.