comparison src/Finder.cpp @ 183:24ddab06aace re-minimise

Toward allowing types to be small again. Doesn't currently build
author Chris Cannam
date Thu, 19 Feb 2015 17:17:20 +0000
parents a67663dc698d
children 487261a22b18
comparison
equal deleted inserted replaced
182:a67663dc698d 183:24ddab06aace
188 188
189 if (r > r1) { // not first row 189 if (r > r1) { // not first row
190 pathcost_t min = -1; 190 pathcost_t min = -1;
191 if ((c > prevRowStart) && (c <= prevRowStop)) { 191 if ((c > prevRowStart) && (c <= prevRowStop)) {
192 // diagonal from (r-1,c-1) 192 // diagonal from (r-1,c-1)
193 min = m_m->getPathCost(r-1, c-1) + newStep * diagonalWeight; 193 min = m_m->getPathCost(r-1, c-1) +
194 distance_t(newStep * diagonalWeight);
194 dir = AdvanceBoth; 195 dir = AdvanceBoth;
195 } 196 }
196 if ((c >= prevRowStart) && (c < prevRowStop)) { 197 if ((c >= prevRowStart) && (c < prevRowStop)) {
197 // vertical from (r-1,c) 198 // vertical from (r-1,c)
198 pathcost_t cost = m_m->getPathCost(r-1, c) + newStep; 199 pathcost_t cost = m_m->getPathCost(r-1, c) + newStep;
251 int rowStop = min(c2 + 1, colRange.second); 252 int rowStop = min(c2 + 1, colRange.second);
252 253
253 for (int c = rowStart; c < rowStop; c++) { 254 for (int c = rowStart; c < rowStop; c++) {
254 255
255 distance_t newStep = m_m->getDistance(r, c); 256 distance_t newStep = m_m->getDistance(r, c);
256 pathcost_t updateTo = -1.0; 257 pathcost_t updateTo = InvalidPathCost;
257 advance_t dir = AdvanceNone; 258 advance_t dir = AdvanceNone;
258 259
259 if (r > r1) { // not first row 260 if (r > r1) { // not first row
260 pathcost_t min = -1; 261 pathcost_t min = -1;
261 if ((c > prevRowStart) && (c <= prevRowStop)) { 262 if ((c > prevRowStart) && (c <= prevRowStop)) {
262 // diagonal from (r-1,c-1) 263 // diagonal from (r-1,c-1)
263 min = m_m->getPathCost(r-1, c-1) + newStep * diagonalWeight; 264 min = m_m->getPathCost(r-1, c-1) + distance_t(newStep * diagonalWeight);
264 err.prevCost = m_m->getPathCost(r-1, c-1); 265 err.prevCost = m_m->getPathCost(r-1, c-1);
265 err.distance = newStep * diagonalWeight; 266 err.distance = distance_t(newStep * diagonalWeight);
266 dir = AdvanceBoth; 267 dir = AdvanceBoth;
267 } 268 }
268 if ((c >= prevRowStart) && (c < prevRowStop)) { 269 if ((c >= prevRowStart) && (c < prevRowStop)) {
269 // vertical from (r-1,c) 270 // vertical from (r-1,c)
270 pathcost_t cost = m_m->getPathCost(r-1, c) + newStep; 271 pathcost_t cost = m_m->getPathCost(r-1, c) + newStep;