changeset 41:9aec2304b9f6 refactors

Fix to resizing logic. Regression test passes.
author Chris Cannam
date Thu, 13 Nov 2014 13:19:53 +0000
parents 15a7fdc02c58
children 8dd16749c3c3
files Makefile.linux src/Matcher.cpp src/Matcher.h
diffstat 3 files changed, 8 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile.linux	Thu Nov 13 12:57:04 2014 +0000
+++ b/Makefile.linux	Thu Nov 13 13:19:53 2014 +0000
@@ -1,5 +1,7 @@
 
 CXXFLAGS	+= -fPIC -ffast-math -O3 -Wall -Werror
+#CXXFLAGS	+= -fPIC -g -Wall -Werror
+
 LDFLAGS		+= -shared -Wl,-Bstatic -lvamp-sdk -Wl,-Bdynamic -Wl,-Bsymbolic -Wl,-z,defs -lpthread -Wl,--version-script=vamp-plugin.map
 
 include Makefile.inc
--- a/src/Matcher.cpp	Thu Nov 13 12:57:04 2014 +0000
+++ b/src/Matcher.cpp	Thu Nov 13 13:19:53 2014 +0000
@@ -91,7 +91,7 @@
         (blockSize, vector<double>(featureSize, 0));
 
     distXSize = blockSize * 2;
-    expand();
+    size();
 
     frameCount = 0;
     runCount = 0;
@@ -100,12 +100,12 @@
 }
 
 void
-Matcher::expand()
+Matcher::size()
 {
     int distSize = (params.maxRunCount + 1) * blockSize;
     bestPathCost.resize(distXSize, vector<int>(distSize, 0));
     distance.resize(distXSize, vector<unsigned char>(distSize, 0));
-    distYSizes.resize(blockSize, distSize);
+    distYSizes.resize(distXSize, distSize);
     first.resize(distXSize, 0);
     last.resize(distXSize, 0);
 }
@@ -140,7 +140,8 @@
     int frameIndex = frameCount % blockSize;
 
     if (frameCount >= distXSize) {
-        expand();
+        distXSize *= 2;
+        size();
     }
 
     if (firstPM && (frameCount >= blockSize)) {
--- a/src/Matcher.h	Thu Nov 13 12:57:04 2014 +0000
+++ b/src/Matcher.h	Thu Nov 13 13:19:53 2014 +0000
@@ -207,7 +207,7 @@
     void init();
 
     /** The distXSize value has changed: resize internal buffers. */
-    void expand();
+    void size();
 
     /** Process a frequency-domain frame of audio data using the
      *  built-in FeatureExtractor, then calculating the distance to