changeset 104:6636aca831c0 feature_conditioner

Feature size is not actually needed in Matcher
author Chris Cannam
date Thu, 04 Dec 2014 13:23:10 +0000
parents 593054bf6476
children 3f46ce2d2874
files src/MatchVampPlugin.cpp src/Matcher.cpp src/Matcher.h
diffstat 3 files changed, 8 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/src/MatchVampPlugin.cpp	Thu Dec 04 13:05:16 2014 +0000
+++ b/src/MatchVampPlugin.cpp	Thu Dec 04 13:23:10 2014 +0000
@@ -331,8 +331,8 @@
     m_fe2 = new FeatureExtractor(m_feParams);
     m_fc1 = new FeatureConditioner(m_fcParams);
     m_fc2 = new FeatureConditioner(m_fcParams);
-    m_pm1 = new Matcher(m_params, 0, m_fe1->getFeatureSize());
-    m_pm2 = new Matcher(m_params, m_pm1, m_fe2->getFeatureSize());
+    m_pm1 = new Matcher(m_params, 0);
+    m_pm2 = new Matcher(m_params, m_pm1);
     m_pm1->setOtherMatcher(m_pm2);
     m_feeder = new MatchFeatureFeeder(m_pm1, m_pm2);
 }
--- a/src/Matcher.cpp	Thu Dec 04 13:05:16 2014 +0000
+++ b/src/Matcher.cpp	Thu Dec 04 13:23:10 2014 +0000
@@ -25,13 +25,12 @@
 
 //#define DEBUG_MATCHER 1
 
-Matcher::Matcher(Parameters parameters, Matcher *p, int m_featureSize_) :
+Matcher::Matcher(Parameters parameters, Matcher *p) :
     m_params(parameters),
-    m_featureSize(m_featureSize_),
     m_metric(parameters.distanceNorm)
 {
 #ifdef DEBUG_MATCHER
-    cerr << "Matcher::Matcher(" << m_params.sampleRate << ", " << p << ", " << m_featureSize << ")" << endl;
+    cerr << "Matcher::Matcher(" << m_params.sampleRate << ", " << p << ")" << endl;
 #endif
 
     m_otherMatcher = p;	// the first matcher will need this to be set later
@@ -60,8 +59,7 @@
 {
     if (m_initialised) return;
 
-    m_frames = vector<vector<double> >
-        (m_blockSize, vector<double>(m_featureSize, -1.0));
+    m_frames = vector<vector<double> >(m_blockSize);
 
     m_distXSize = m_blockSize * 2;
 
--- a/src/Matcher.h	Thu Dec 04 13:05:16 2014 +0000
+++ b/src/Matcher.h	Thu Dec 04 13:23:10 2014 +0000
@@ -119,11 +119,8 @@
      *  this one is going to be matched.  Some information is shared
      *  between the two matchers (currently one possesses the distance
      *  matrix and optimal path matrix).
-     *  
-     *  @param featureSize Number of values in each of the feature
-     *  vectors that will be provided.
      */
-    Matcher(Parameters parameters, Matcher *p, int featureSize);
+    Matcher(Parameters parameters, Matcher *p);
 
     /** Destructor for Matcher.
      */
@@ -165,8 +162,8 @@
      *  updating the optimal path matrix using the dynamic time
      *  warping algorithm.
      *
-     *  The supplied feature must be of the size that was passed as
-     *  featureSize to the constructor.
+     *  The supplied features must always be of the same size (within
+     *  any pair of Matcher objects).
      */
     void consumeFeatureVector(std::vector<double> feature);
     
@@ -297,9 +294,6 @@
      */
     int m_runCount;
 
-    /** The number of values in a feature vector. */
-    int m_featureSize;
-
     /** A block of previously seen feature frames is stored in this
      *  structure for calculation of the distance matrix as the new
      *  frames are received.  One can think of the structure of the