Changeset 737
- Timestamp:
- 04/09/06 13:38:39 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/shared/EvalStats/EvalStats.cpp
r736 r737 114 114 const StatsContainer &firstStats, 115 115 const StatsContainer ¤tStats) 116 // vector<float> &ratios) 117 { 118 //const int n = min((int)firstStats.size(), (int)currentStats.size()); 119 const int n = (int)firstStats.size(); 116 // vector<float> &ratios) 117 { 118 119 const int n = min((int)firstStats.size(), (int)currentStats.size()); 120 //const int n = (int)firstStats.size(); 120 121 121 122 StatsContainer::const_iterator it, it_end = currentStats.end(); … … 123 124 int i = 0; 124 125 125 // currentStats would be the other (necessarily worse?) method 126 // firstStats would be our method127 // compare render cost of current view cell with render cost128 // of other view cells.126 // currentStats would be the other (necessarily worse?) method, firstStats would be our method 127 // loop through view cells of currentStats 128 // Compare render cost with render cost of other view cell 129 // compute ratio of view cells 129 130 for (it = currentStats.begin(); it != it_end; ++ it, ++ i) 130 131 { 132 //if (i > 200) break; 133 131 134 int j = 0; 135 132 136 133 137 const float renderCost = (*it).mRenderCost; … … 136 140 // don't stop until cursor is placed one element behind 137 141 // or end of vector is reached 138 while ((j < n) && (renderCost > (int)firstStats[j ++].mRenderCost)); 139 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 } 148 149 float val; 150 151 // soecial cases 152 if (j == 0) 153 { 154 val = (float)j; 155 } 156 else if (j == n) 157 { 158 val = (float)(j - 1); 159 } 160 else // interpolate linearly. NOTE: probably big error because of steep curve 161 { 162 const float rcu = firstStats[j - 1].mRenderCost; 163 const float rcl = firstStats[j].mRenderCost; 164 165 const float factor = (rcu - rcl != 0) ? 166 (rcu - renderCost) / (rcu - rcl) : 1; 167 168 val = (float)j - 1 + factor; 169 } 170 140 171 // lower bound 141 172 //int j = max (0, i - 1); 142 float ratio = (float)i / (float)j; 143 173 cout << "i: " << i << " j: " << j << endl; 174 float ratio = (i && val) ? (float)i / val : 1; 175 176 cout << "ratio: " << ratio << endl; 144 177 outstream << "#Pass\n" << i << endl; 145 178 outstream << "#RenderCost\n" << renderCost << endl; … … 230 263 for (int i = 0; i < n; ++ i) 231 264 { 265 cout << "rc: " << (*it)[i].mRenderCost << endl; 232 266 ComputeStats(statsOut, firstStats[i], (*it)[i], i); 233 267 }
Note: See TracChangeset
for help on using the changeset viewer.