annotate 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
rev   line source
cannam@0 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
cannam@0 2
cannam@0 3 /*
cannam@0 4 Vamp feature extraction plugin using the MATCH audio alignment
cannam@0 5 algorithm.
cannam@0 6
cannam@0 7 Centre for Digital Music, Queen Mary, University of London.
cannam@0 8 This file copyright 2007 Simon Dixon, Chris Cannam and QMUL.
cannam@0 9
cannam@0 10 This program is free software; you can redistribute it and/or
cannam@0 11 modify it under the terms of the GNU General Public License as
cannam@0 12 published by the Free Software Foundation; either version 2 of the
cannam@0 13 License, or (at your option) any later version. See the file
cannam@0 14 COPYING included with this distribution for more information.
cannam@0 15 */
cannam@0 16
cannam@0 17 #include "Finder.h"
cannam@0 18
Chris@30 19 #include "Path.h"
Chris@30 20
Chris@30 21 #include <algorithm>
Chris@92 22 #include <iomanip>
Chris@30 23
Chris@72 24 using namespace std;
cannam@0 25
Chris@140 26 //#define DEBUG_FINDER 1
Chris@140 27 //#define PERFORM_ERROR_CHECKS 1
Chris@140 28
Chris@72 29 Finder::Finder(Matcher *pm)
cannam@0 30 {
Chris@72 31 m_m = pm;
Chris@72 32 m_duration1 = -1;
Chris@72 33 m_duration2 = -1;
cannam@0 34 } // constructor
cannam@0 35
cannam@0 36 Finder::~Finder()
cannam@0 37 {
cannam@0 38 }
cannam@0 39
Chris@60 40 void
Chris@154 41 Finder::setMatcher(Matcher *pm)
Chris@154 42 {
Chris@155 43 cerr << "Finder::setMatcher: finder " << this << ", matcher " << pm << endl;
Chris@154 44 m_m = pm;
Chris@154 45 }
Chris@154 46
Chris@154 47 void
Chris@60 48 Finder::setDurations(int d1, int d2)
Chris@60 49 {
Chris@140 50 #ifdef DEBUG_FINDER
Chris@140 51 cerr << "*** setDurations: " << d1 << ", " << d2 << endl;
Chris@140 52 #endif
Chris@72 53 m_duration1 = d1;
Chris@72 54 m_duration2 = d2;
Chris@60 55 }
Chris@60 56
Chris@154 57 bool
Chris@182 58 Finder::getBestRowCost(int row, int &bestCol, pathcost_t &min)
Chris@154 59 {
Chris@172 60 if (!m_m->isRowAvailable(row)) return false;
Chris@154 61 pair<int, int> colRange = m_m->getColRange(row);
Chris@172 62 if (colRange.first >= colRange.second) return false;
Chris@154 63 for (int index = colRange.first; index < colRange.second; index++) {
Chris@182 64 pathcost_t tmp = m_m->getNormalisedPathCost(row, index);
Chris@154 65 if (index == colRange.first || tmp < min) {
Chris@154 66 min = tmp;
Chris@154 67 bestCol = index;
Chris@154 68 }
Chris@154 69 }
Chris@154 70 return true;
Chris@154 71 }
Chris@154 72
Chris@154 73 bool
Chris@182 74 Finder::getBestColCost(int col, int &bestRow, pathcost_t &min)
Chris@154 75 {
Chris@154 76 if (!m_m->isColAvailable(col)) return false;
Chris@154 77 pair<int, int> rowRange = m_m->getRowRange(col);
Chris@154 78 if (rowRange.first >= rowRange.second) return false;
Chris@154 79 for (int index = rowRange.first; index < rowRange.second; index++) {
Chris@182 80 pathcost_t tmp = m_m->getNormalisedPathCost(index, col);
Chris@154 81 if (index == rowRange.first || tmp < min) {
Chris@154 82 min = tmp;
Chris@154 83 bestRow = index;
Chris@154 84 }
Chris@154 85 }
Chris@154 86 return true;
Chris@154 87 }
Chris@154 88
Chris@147 89 void
Chris@147 90 Finder::getBestEdgeCost(int row, int col,
Chris@147 91 int &bestRow, int &bestCol,
Chris@182 92 pathcost_t &min)
cannam@0 93 {
Chris@147 94 min = m_m->getPathCost(row, col);
Chris@72 95
Chris@147 96 bestRow = row;
Chris@147 97 bestCol = col;
Chris@72 98
Chris@72 99 pair<int, int> rowRange = m_m->getRowRange(col);
Chris@72 100 if (rowRange.second > row+1) {
Chris@72 101 rowRange.second = row+1; // don't cheat by looking at future :)
Chris@72 102 }
Chris@72 103 for (int index = rowRange.first; index < rowRange.second; index++) {
Chris@182 104 pathcost_t tmp = m_m->getNormalisedPathCost(index, col);
cannam@0 105 if (tmp < min) {
cannam@0 106 min = tmp;
cannam@0 107 bestRow = index;
cannam@0 108 }
cannam@0 109 }
Chris@72 110
Chris@72 111 pair<int, int> colRange = m_m->getColRange(row);
Chris@72 112 if (colRange.second > col+1) {
Chris@72 113 colRange.second = col+1; // don't cheat by looking at future :)
Chris@72 114 }
Chris@72 115 for (int index = colRange.first; index < colRange.second; index++) {
Chris@182 116 pathcost_t tmp = m_m->getNormalisedPathCost(row, index);
cannam@0 117 if (tmp < min) {
cannam@0 118 min = tmp;
cannam@0 119 bestCol = index;
cannam@0 120 bestRow = row;
cannam@0 121 }
cannam@0 122 }
Chris@147 123 }
Chris@72 124
Chris@181 125 advance_t
Chris@171 126 Finder::getExpandDirection()
Chris@171 127 {
Chris@171 128 return getExpandDirection(m_m->getFrameCount() - 1,
Chris@171 129 m_m->getOtherFrameCount() - 1);
Chris@171 130 }
Chris@171 131
Chris@181 132 advance_t
Chris@147 133 Finder::getExpandDirection(int row, int col)
Chris@147 134 {
Chris@147 135 // To determine which direction to expand the search area in, we
Chris@147 136 // look at the path costs along the leading edges of the search
Chris@147 137 // area (the final row and column within the area). We find the
Chris@147 138 // lowest path cost within the final row, and the lowest within
Chris@147 139 // the final column, and we compare them. If the row is cheaper
Chris@147 140 // then we expand by adding another row next to it; if the column
Chris@147 141 // is cheaper then we expand by adding another column next to
Chris@147 142 // it. (The overall lowest path cost across the row and column
Chris@147 143 // represents the best alignment we have within the entire search
Chris@147 144 // area given the data available and the assumption that the piece
Chris@147 145 // is not ending yet.)
Chris@147 146
Chris@147 147 int bestRow = row;
Chris@147 148 int bestCol = col;
Chris@182 149 pathcost_t bestCost = -1;
Chris@147 150
Chris@155 151 // cerr << "Finder " << this << "::getExpandDirection: ";
Chris@155 152
Chris@147 153 getBestEdgeCost(row, col, bestRow, bestCol, bestCost);
Chris@147 154
Chris@147 155 // cerr << "at [" << row << "," << col << "] (cost " << m_m->getPathCost(row, col) << ") blocksize = " << m_m->getBlockSize() << " best is [" << bestRow << "," << bestCol << "] (cost " << bestCost << ")" << endl;
Chris@135 156
Chris@45 157 if (bestRow == row) {
Chris@45 158 if (bestCol == col) {
Chris@181 159 return AdvanceBoth;
Chris@45 160 } else {
Chris@181 161 return AdvanceThis;
Chris@45 162 }
Chris@45 163 } else if (bestCol == col) {
Chris@181 164 return AdvanceOther;
Chris@45 165 } else {
Chris@181 166 return AdvanceNone;
Chris@45 167 }
Chris@73 168 }
cannam@0 169
cannam@0 170 void
cannam@0 171 Finder::recalculatePathCostMatrix(int r1, int c1, int r2, int c2)
cannam@0 172 {
Chris@72 173 int prevRowStart = 0, prevRowStop = 0;
Chris@72 174
Chris@83 175 float diagonalWeight = m_m->getDiagonalWeight();
Chris@83 176
Chris@72 177 for (int r = r1; r <= r2; r++) {
Chris@72 178
Chris@72 179 pair<int, int> colRange = m_m->getColRange(r);
Chris@72 180
Chris@72 181 int rowStart = max(c1, colRange.first);
Chris@72 182 int rowStop = min(c2 + 1, colRange.second);
Chris@72 183
Chris@72 184 for (int c = rowStart; c < rowStop; c++) {
Chris@72 185
Chris@182 186 distance_t newStep = m_m->getDistance(r, c);
Chris@181 187 advance_t dir = AdvanceNone;
Chris@72 188
Chris@72 189 if (r > r1) { // not first row
Chris@182 190 pathcost_t min = -1;
Chris@72 191 if ((c > prevRowStart) && (c <= prevRowStop)) {
Chris@72 192 // diagonal from (r-1,c-1)
Chris@183 193 min = m_m->getPathCost(r-1, c-1) +
Chris@183 194 distance_t(newStep * diagonalWeight);
Chris@181 195 dir = AdvanceBoth;
Chris@72 196 }
Chris@72 197 if ((c >= prevRowStart) && (c < prevRowStop)) {
Chris@72 198 // vertical from (r-1,c)
Chris@182 199 pathcost_t cost = m_m->getPathCost(r-1, c) + newStep;
Chris@72 200 if ((min < 0) || (cost < min)) {
Chris@72 201 min = cost;
Chris@181 202 dir = AdvanceThis;
Chris@72 203 }
Chris@72 204 }
Chris@72 205 if (c > rowStart) {
Chris@72 206 // horizontal from (r,c-1)
Chris@182 207 pathcost_t cost = m_m->getPathCost(r, c-1) + newStep;
Chris@72 208 if ((min < 0) || (cost < min)) {
Chris@72 209 min = cost;
Chris@181 210 dir = AdvanceOther;
Chris@72 211 }
Chris@72 212 }
Chris@72 213
Chris@72 214 m_m->setPathCost(r, c, dir, min);
Chris@72 215
Chris@72 216 } else if (c > rowStart) { // first row
Chris@72 217 // horizontal from (r,c-1)
Chris@181 218 m_m->setPathCost(r, c, AdvanceOther,
Chris@182 219 m_m->getPathCost(r, c-1) + newStep);
Chris@72 220 }
Chris@72 221 }
Chris@72 222
Chris@72 223 prevRowStart = rowStart;
Chris@72 224 prevRowStop = rowStop;
cannam@0 225 }
Chris@72 226 }
Chris@30 227
Chris@82 228 #ifdef PERFORM_ERROR_CHECKS
Chris@81 229 Finder::ErrorPosition
Chris@81 230 Finder::checkPathCostMatrix()
Chris@81 231 {
Chris@81 232 ErrorPosition err;
Chris@81 233
Chris@81 234 int r1 = 0;
Chris@81 235 int c1 = 0;
Chris@81 236 int r2 = m_m->getFrameCount() - 1;
Chris@81 237 int c2 = m_m->getOtherFrameCount() - 1;
Chris@81 238
Chris@81 239 if (r2 < r1 || c2 < c1) {
Chris@81 240 return err;
Chris@81 241 }
Chris@81 242
Chris@81 243 int prevRowStart = 0, prevRowStop = 0;
Chris@81 244
Chris@83 245 float diagonalWeight = m_m->getDiagonalWeight();
Chris@83 246
Chris@81 247 for (int r = r1; r <= r2; r++) {
Chris@81 248
Chris@81 249 pair<int, int> colRange = m_m->getColRange(r);
Chris@81 250
Chris@81 251 int rowStart = max(c1, colRange.first);
Chris@81 252 int rowStop = min(c2 + 1, colRange.second);
Chris@81 253
Chris@81 254 for (int c = rowStart; c < rowStop; c++) {
Chris@81 255
Chris@182 256 distance_t newStep = m_m->getDistance(r, c);
Chris@183 257 pathcost_t updateTo = InvalidPathCost;
Chris@181 258 advance_t dir = AdvanceNone;
Chris@81 259
Chris@95 260 if (r > r1) { // not first row
Chris@182 261 pathcost_t min = -1;
Chris@81 262 if ((c > prevRowStart) && (c <= prevRowStop)) {
Chris@81 263 // diagonal from (r-1,c-1)
Chris@183 264 min = m_m->getPathCost(r-1, c-1) + distance_t(newStep * diagonalWeight);
Chris@81 265 err.prevCost = m_m->getPathCost(r-1, c-1);
Chris@183 266 err.distance = distance_t(newStep * diagonalWeight);
Chris@181 267 dir = AdvanceBoth;
Chris@81 268 }
Chris@81 269 if ((c >= prevRowStart) && (c < prevRowStop)) {
Chris@81 270 // vertical from (r-1,c)
Chris@182 271 pathcost_t cost = m_m->getPathCost(r-1, c) + newStep;
Chris@81 272 if ((min < 0) || (cost < min)) {
Chris@81 273 min = cost;
Chris@81 274 err.prevCost = m_m->getPathCost(r-1, c);
Chris@182 275 err.distance = newStep;
Chris@181 276 dir = AdvanceThis;
Chris@81 277 }
Chris@81 278 }
Chris@81 279 if (c > rowStart) {
Chris@81 280 // horizontal from (r,c-1)
Chris@182 281 pathcost_t cost = m_m->getPathCost(r, c-1) + newStep;
Chris@81 282 if ((min < 0) || (cost < min)) {
Chris@81 283 min = cost;
Chris@81 284 err.prevCost = m_m->getPathCost(r, c-1);
Chris@182 285 err.distance = newStep;
Chris@181 286 dir = AdvanceOther;
Chris@81 287 }
Chris@81 288 }
Chris@81 289
Chris@81 290 updateTo = min;
Chris@81 291
Chris@82 292 } else { // first row
Chris@82 293
Chris@82 294 if (c > rowStart) {
Chris@82 295 // horizontal from (r,c-1)
Chris@182 296 updateTo = m_m->getPathCost(r, c-1) + newStep;
Chris@83 297 err.prevCost = m_m->getPathCost(r, c-1);
Chris@182 298 err.distance = newStep;
Chris@181 299 dir = AdvanceOther;
Chris@82 300 }
Chris@81 301 }
Chris@81 302
Chris@181 303 if (dir != AdvanceNone) {
Chris@86 304 if (m_m->getAdvance(r, c) != dir) {
Chris@86 305 err.type = ErrorPosition::WrongAdvance;
Chris@86 306 err.r = r;
Chris@86 307 err.c = c;
Chris@86 308 err.costWas = m_m->getPathCost(r, c);
Chris@86 309 err.costShouldBe = updateTo;
Chris@86 310 err.advanceWas = m_m->getAdvance(r, c);
Chris@86 311 err.advanceShouldBe = dir;
Chris@86 312 return err;
Chris@86 313 }
Chris@84 314 if (m_m->getPathCost(r, c) != updateTo) {
Chris@84 315 err.type = ErrorPosition::WrongCost;
Chris@84 316 err.r = r;
Chris@84 317 err.c = c;
Chris@84 318 err.costWas = m_m->getPathCost(r, c);
Chris@84 319 err.costShouldBe = updateTo;
Chris@84 320 err.advanceWas = m_m->getAdvance(r, c);
Chris@84 321 err.advanceShouldBe = dir;
Chris@82 322 return err;
Chris@82 323 }
Chris@82 324 } else {
Chris@82 325 // AdvanceNone should occur only at r = r1, c = c1
Chris@82 326 if (r != r1 || c != c1) {
Chris@82 327 err.type = ErrorPosition::NoAdvance;
Chris@82 328 err.r = r;
Chris@82 329 err.c = c;
Chris@82 330 err.costWas = m_m->getPathCost(r, c);
Chris@82 331 err.costShouldBe = updateTo;
Chris@84 332 err.advanceWas = m_m->getAdvance(r, c);
Chris@84 333 err.advanceShouldBe = dir;
Chris@82 334 return err;
Chris@82 335 }
Chris@81 336 }
Chris@81 337 }
Chris@81 338
Chris@81 339 prevRowStart = rowStart;
Chris@81 340 prevRowStop = rowStop;
Chris@81 341 }
Chris@81 342
Chris@81 343 return err;
Chris@82 344 }
Chris@81 345
Chris@92 346 void
Chris@92 347 Finder::checkAndReport()
Chris@30 348 {
Chris@92 349 cerr << "Finder: Checking path-cost matrix..." << endl;
Chris@82 350 ErrorPosition err = checkPathCostMatrix();
Chris@92 351 if (err.type == ErrorPosition::NoError) {
Chris@92 352 cerr << "No errors found" << endl;
Chris@92 353 } else {
Chris@82 354 cerr << "\nWARNING: Checking path-cost matrix returned mismatch:" << endl;
Chris@92 355 cerr << "Type: " << err.type << ": ";
Chris@92 356 switch (err.type) {
Chris@92 357 case ErrorPosition::NoError: break;
Chris@92 358 case ErrorPosition::WrongCost: cerr << "WrongCost"; break;
Chris@92 359 case ErrorPosition::WrongAdvance: cerr << "WrongAdvance"; break;
Chris@92 360 case ErrorPosition::NoAdvance: cerr << "NoAdvance"; break;
Chris@92 361 }
Chris@92 362 cerr << endl;
Chris@84 363 cerr << "At row " << err.r << ", column " << err.c
Chris@84 364 << "\nShould be advancing "
Chris@84 365 << Matcher::advanceToString(err.advanceShouldBe)
Chris@84 366 << ", advance in matrix is "
Chris@84 367 << Matcher::advanceToString(err.advanceWas)
Chris@83 368 << "\nPrev cost " << err.prevCost
Chris@82 369 << " plus distance " << err.distance << " gives "
Chris@84 370 << err.costShouldBe << ", matrix contains " << err.costWas
Chris@83 371 << endl;
Chris@83 372 cerr << "Note: diagonal weight = " << m_m->getDiagonalWeight() << endl;
Chris@83 373 cerr << endl;
Chris@92 374
Chris@95 375 int w(4);
Chris@95 376 int ww(15);
Chris@92 377
Chris@92 378 cerr << "Distance matrix leading up to this point:" << endl;
Chris@95 379 cerr << setprecision(12) << setw(w) << "";
Chris@92 380 for (int i = -4; i <= 0; ++i) {
Chris@95 381 cerr << setw(ww) << i;
Chris@92 382 }
Chris@92 383 cerr << endl;
Chris@92 384 for (int j = -4; j <= 0; ++j) {
Chris@92 385 cerr << setw(w) << j;
Chris@92 386 for (int i = -4; i <= 0; ++i) {
Chris@95 387 cerr << setw(ww) << m_m->getDistance(err.r + j, err.c + i);
Chris@92 388 }
Chris@92 389 cerr << endl;
Chris@92 390 }
Chris@92 391 cerr << endl;
Chris@92 392
Chris@92 393 cerr << "Cost matrix leading up to this point:" << endl;
Chris@92 394 cerr << setw(w) << "";
Chris@92 395 for (int i = -4; i <= 0; ++i) {
Chris@95 396 cerr << setw(ww) << i;
Chris@92 397 }
Chris@92 398 cerr << endl;
Chris@92 399 for (int j = -4; j <= 0; ++j) {
Chris@92 400 cerr << setw(w) << j;
Chris@92 401 for (int i = -4; i <= 0; ++i) {
Chris@95 402 cerr << setw(ww) << m_m->getPathCost(err.r + j, err.c + i);
Chris@92 403 }
Chris@92 404 cerr << endl;
Chris@92 405 }
Chris@92 406 cerr << endl;
Chris@82 407 }
Chris@92 408 }
Chris@92 409 #endif
Chris@92 410
Chris@182 411 pathcost_t
Chris@163 412 Finder::getOverallCost()
Chris@163 413 {
Chris@163 414 int ex = m_m->getOtherFrameCount() - 1;
Chris@163 415 int ey = m_m->getFrameCount() - 1;
Chris@163 416
Chris@163 417 if (ex < 0 || ey < 0) {
Chris@163 418 return 0;
Chris@163 419 }
Chris@163 420
Chris@165 421 return m_m->getPathCost(ey, ex);
Chris@163 422 }
Chris@163 423
Chris@92 424 int
Chris@92 425 Finder::retrievePath(bool smooth, vector<int> &pathx, vector<int> &pathy)
Chris@92 426 {
Chris@92 427 pathx.clear();
Chris@92 428 pathy.clear();
Chris@92 429
Chris@92 430 #ifdef PERFORM_ERROR_CHECKS
Chris@92 431 checkAndReport();
Chris@82 432 #endif
Chris@82 433
Chris@72 434 int ex = m_m->getOtherFrameCount() - 1;
Chris@72 435 int ey = m_m->getFrameCount() - 1;
Chris@69 436
Chris@69 437 if (ex < 0 || ey < 0) {
Chris@69 438 return 0;
Chris@69 439 }
Chris@66 440
Chris@66 441 int x = ex;
Chris@66 442 int y = ey;
Chris@30 443
Chris@140 444 #ifdef DEBUG_FINDER
Chris@140 445 cerr << "*** retrievePath: smooth = " << smooth << endl;
Chris@140 446 cerr << "*** retrievePath: before: x = " << x << ", y = " << y << endl;
Chris@140 447 #endif
Chris@140 448
Chris@72 449 if (m_duration2 > 0 && m_duration2 < m_m->getOtherFrameCount()) {
Chris@72 450 x = m_duration2 - 1;
Chris@60 451 }
Chris@72 452 if (m_duration1 > 0 && m_duration1 < m_m->getFrameCount()) {
Chris@72 453 y = m_duration1 - 1;
Chris@60 454 }
Chris@60 455
Chris@72 456 if (!m_m->isAvailable(y, x)) {
Chris@66 457 // Path did not pass through the expected end point --
Chris@66 458 // probably means the pieces are substantially different in
Chris@66 459 // the later bits. Reset the expected end point to the end of
Chris@66 460 // both files including any trailing silence.
Chris@66 461 cerr << "NOTE: Path did not pass through expected end point, inputs are probably significantly different" << endl;
Chris@66 462 x = ex;
Chris@66 463 y = ey;
Chris@66 464 }
Chris@66 465
Chris@55 466 recalculatePathCostMatrix(0, 0, y, x);
Chris@55 467
Chris@140 468 #ifdef DEBUG_FINDER
Chris@140 469 cerr << "*** retrievePath: start: x = " << x << ", y = " << y << endl;
Chris@140 470 #endif
Chris@66 471
Chris@72 472 while (m_m->isAvailable(y, x) && (x > 0 || y > 0)) {
Chris@30 473
Chris@33 474 // cerr << "x = " << x << ", y = " << y;
Chris@33 475
Chris@30 476 pathx.push_back(x);
Chris@30 477 pathy.push_back(y);
Chris@30 478
Chris@72 479 switch (m_m->getAdvance(y, x)) {
Chris@181 480 case AdvanceThis:
Chris@70 481 // cerr << ", going down (dist = " << getDistance() << ")" << endl;
Chris@33 482 y--;
Chris@33 483 break;
Chris@181 484 case AdvanceOther:
Chris@70 485 // cerr << ", going left (dist = " << getDistance() << ")" << endl;
Chris@33 486 x--;
Chris@33 487 break;
Chris@181 488 case AdvanceBoth:
Chris@70 489 // cerr << ", going diag (dist = " << getDistance() << ")" << endl;
Chris@33 490 x--;
Chris@33 491 y--;
Chris@33 492 break;
Chris@181 493 case AdvanceNone: // this would indicate a bug, but we wouldn't want to hang
Chris@69 494 cerr << "WARNING: Neither matcher advanced in path backtrack at (" << x << "," << y << ")" << endl;
Chris@33 495 if (x > y) {
Chris@33 496 x--;
Chris@33 497 } else {
Chris@33 498 y--;
Chris@33 499 }
Chris@33 500 break;
Chris@30 501 }
Chris@30 502 }
Chris@30 503
Chris@72 504 if (x > 0 || y > 0) {
Chris@72 505 cerr << "WARNING: Ran out of available path at (" << y << "," << x
Chris@72 506 << ")!" << endl;
Chris@72 507 }
Chris@72 508
Chris@72 509 reverse(pathx.begin(), pathx.end());
Chris@72 510 reverse(pathy.begin(), pathy.end());
Chris@30 511
Chris@31 512 if (smooth) {
Chris@180 513 int smoothedLen = Path().smooth
Chris@180 514 (pathx, pathy, static_cast<int>(pathx.size()));
Chris@31 515 return smoothedLen;
Chris@31 516 } else {
Chris@180 517 return static_cast<int>(pathx.size());
Chris@31 518 }
Chris@30 519 }
Chris@30 520
Chris@30 521