changeset 29:cd0ffe6b1e68

Make distance scale a parameter as well
author Chris Cannam
date Fri, 31 Oct 2014 13:03:16 +0000
parents 2744c870d8c5
children 7784b0a0dd4d
files Matcher.cpp Matcher.h
diffstat 2 files changed, 8 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/Matcher.cpp	Fri Oct 31 11:41:42 2014 +0000
+++ b/Matcher.cpp	Fri Oct 31 13:03:16 2014 +0000
@@ -42,7 +42,6 @@
     externalFeatureSize = 0;
     featureSize = 0;
     blockSize = 0;
-    scale = 90;
 
     blockSize = lrint(params.blockTime / params.hopTime);
 #ifdef DEBUG_MATCHER
@@ -74,7 +73,6 @@
     freqMapSize = 0;
     featureSize = 0;
     blockSize = 0;
-    scale = 90;
 
     blockSize = lrint(params.blockTime / params.hopTime);
 #ifdef DEBUG_MATCHER
@@ -398,7 +396,7 @@
         int dMN = metric.calcDistanceScaled
             (frames[frameIndex],
              otherMatcher->frames[index % blockSize],
-             scale);
+             params.distanceScale);
         
         if (mx<0)
             mx = mn = dMN;
--- a/Matcher.h	Fri Oct 31 11:41:42 2014 +0000
+++ b/Matcher.h	Fri Oct 31 13:03:16 2014 +0000
@@ -62,6 +62,7 @@
             sampleRate(rate_),
             frameNorm(NormaliseFrameToSum1),
             distanceNorm(DistanceMetric::NormaliseDistanceToLogSum),
+            distanceScale(90.0),
             useSpectralDifference(true),
             useChromaFrequencyMap(false),
             hopTime(hopTime_),
@@ -81,6 +82,12 @@
         /** Type of distance metric normalisation */
         DistanceMetric::DistanceNormalisation distanceNorm;
 
+        /** Scaling factor for distance metric; must guarantee that the
+         *  final value fits in the data type used, that is, unsigned
+         *  char.
+         */
+        double distanceScale;
+
         /** Flag indicating whether or not the half-wave rectified
          *  spectral difference should be used in calculating the
          *  distance metric for pairs of audio frames, instead of the
@@ -141,12 +148,6 @@
     /** Configuration parameters */
     Parameters params;
 
-    /** Scaling factor for distance metric; must guarantee that the
-     *  final value fits in the data type used, that is, unsigned
-     *  char.
-     */
-    double scale;
-
     /** Width of the search band in FFT frames (see <code>blockTime</code>) */
     int blockSize;