changeset 31:1ff9ae1dcb50

Make smoothing optional (internally, not exposed as a parameter)
author Chris Cannam
date Fri, 31 Oct 2014 15:54:15 +0000
parents 7784b0a0dd4d
children 37c0b59fd514
files Finder.cpp Finder.h MatchVampPlugin.cpp
diffstat 3 files changed, 11 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/Finder.cpp	Fri Oct 31 15:42:40 2014 +0000
+++ b/Finder.cpp	Fri Oct 31 15:54:15 2014 +0000
@@ -247,7 +247,7 @@
 } // recalculatePathCostMatrix()
 
 int
-Finder::retrievePath(vector<int> &pathx, vector<int> &pathy)
+Finder::retrievePath(bool smooth, vector<int> &pathx, vector<int> &pathy)
 {
     int x = pm2->getFrameCount() - 1;
     int y = pm1->getFrameCount() - 1;
@@ -273,9 +273,12 @@
     std::reverse(pathx.begin(), pathx.end());
     std::reverse(pathy.begin(), pathy.end());
 
-    int smoothedLen = Path().smooth(pathx, pathy, pathx.size());
-
-    return smoothedLen;
+    if (smooth) {
+        int smoothedLen = Path().smooth(pathx, pathy, pathx.size());
+        return smoothedLen;
+    } else {
+        return pathx.size();
+    }
 }
 
 
--- a/Finder.h	Fri Oct 31 15:42:40 2014 +0000
+++ b/Finder.h	Fri Oct 31 15:54:15 2014 +0000
@@ -93,8 +93,10 @@
      * pathy. Return value is the length of the returned path: only
      * this many elements from pathx and pathy are valid (any
      * subsequent ones may be spurious).
+     *
+     * @param smooth whether to smooth the path before returning it
      */
-    int retrievePath(std::vector<int> &pathx, std::vector<int> &pathy);
+    int retrievePath(bool smooth, std::vector<int> &pathx, std::vector<int> &pathy);
     
 }; // class Finder
 
--- a/MatchVampPlugin.cpp	Fri Oct 31 15:42:40 2014 +0000
+++ b/MatchVampPlugin.cpp	Fri Oct 31 15:54:15 2014 +0000
@@ -487,7 +487,7 @@
     Finder *finder = feeder->getFinder();
     std::vector<int> pathx;
     std::vector<int> pathy;
-    int len = finder->retrievePath(pathx, pathy);
+    int len = finder->retrievePath(true, pathx, pathy);
     
     FeatureSet returnFeatures;