# HG changeset patch # User Chris Cannam # Date 1414760596 0 # Node ID cd0ffe6b1e6806583dc08c2b1dfda67e3f4a7a48 # Parent 2744c870d8c5ffd50fa4397319999fa1e689b518 Make distance scale a parameter as well diff -r 2744c870d8c5 -r cd0ffe6b1e68 Matcher.cpp --- 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; diff -r 2744c870d8c5 -r cd0ffe6b1e68 Matcher.h --- 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 blockTime) */ int blockSize;