Changeset 744 for GTP/trunk/Lib/Vis/shared/EvalStats
- Timestamp:
- 04/10/06 21:09:43 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/shared/EvalStats/EvalStats.cpp
r737 r744 8 8 #include <iostream> 9 9 #include <fstream> 10 10 #include <math.h> 11 #include <algorithm> 11 12 12 13 using namespace std; … … 111 112 112 113 114 inline bool vlt(const RenderStats &c1, const RenderStats &c2) 115 { 116 return c1.mRenderCost > c2.mRenderCost; 117 } 118 119 120 // evaluate number of view cells needed for same rendercost 113 121 void EvalNumViewCells(ofstream &outstream, 114 122 const StatsContainer &firstStats, 115 123 const StatsContainer ¤tStats) 116 // vector<float> &ratios)117 124 { 118 125 … … 130 137 for (it = currentStats.begin(); it != it_end; ++ it, ++ i) 131 138 { 132 //if (i > 200) break;133 134 int j = 0;135 139 136 137 140 const float renderCost = (*it).mRenderCost; 138 141 … … 140 143 // don't stop until cursor is placed one element behind 141 144 // or end of vector is reached 142 // note: use stl for this 143 while ((j < n) && (renderCost <= firstStats[j].mRenderCost)) 144 { 145 //cout << "!!rendercost: " << renderCost << " " << firstStats[j].mRenderCost << endl; 146 ++ j; 147 } 145 StatsContainer::const_iterator equalCostIt = std::upper_bound(firstStats.begin(), firstStats.end(), *it, vlt); 146 147 int j = (int)(equalCostIt - firstStats.begin()); 148 148 149 149 float val; … … 154 154 val = (float)j; 155 155 } 156 else if (j == n)156 else if (j >= n) 157 157 { 158 158 val = (float)(j - 1); 159 159 } 160 else // interpolate linearly. NOTE: probably big error because of steep curve 161 { 160 else 161 // interpolate linearly. NOTE: probably big error because of steep curve 162 // => intepolate logarithmically 163 { 164 #if 1 165 const float rcu = log(firstStats[j - 1].mRenderCost); 166 const float rcl = log(firstStats[j].mRenderCost); 167 const float rc = log(renderCost); 168 #else 162 169 const float rcu = firstStats[j - 1].mRenderCost; 163 170 const float rcl = firstStats[j].mRenderCost; 164 171 const float rc = renderCost; 172 #endif 165 173 const float factor = (rcu - rcl != 0) ? 166 (rcu - renderCost) / (rcu - rcl) : 1; 167 174 (rcu - rc) / (rcu - rcl) : 1; 175 176 // view cells needed for same render cost 168 177 val = (float)j - 1 + factor; 169 178 } … … 171 180 // lower bound 172 181 //int j = max (0, i - 1); 173 cout << "i: " << i << " j: " << j << endl;182 //cout << "i: " << i << " j: " << j << endl; 174 183 float ratio = (i && val) ? (float)i / val : 1; 175 184 176 cout << "ratio: " << ratio << endl;185 //cout << "ratio: " << ratio << endl; 177 186 outstream << "#Pass\n" << i << endl; 178 187 outstream << "#RenderCost\n" << renderCost << endl; 179 188 outstream << "#ViewCellsRatio\n" << ratio << endl << endl; 180 181 //cout << "#Pass " << i ++ << endl;182 //cout << "#RenderCost " << renderCost << endl;183 //cout << "#ViewCellsRatio " << ratio << endl;184 189 } 185 190 } … … 263 268 for (int i = 0; i < n; ++ i) 264 269 { 265 cout << "rc: " << (*it)[i].mRenderCost << endl;270 //cout << "rc: " << (*it)[i].mRenderCost << endl; 266 271 ComputeStats(statsOut, firstStats[i], (*it)[i], i); 267 272 } 268 #if 0 269 const int vc = ComputeNoViewCells(firstStats, *it); 270 cout << "need " << vc << " view cells to reach rendercost of method " << i << " with " << n << " view cells" << endl; 271 #endif 273 274 // evaluate number of view cells needed for same rendercost 272 275 EvalNumViewCells(statsOut2, firstStats, (*it)); 273 276
Note: See TracChangeset
for help on using the changeset viewer.