Mercurial > hg > match-vamp
changeset 117:aef4b62069ba adaptive_diagonals
Merge from refactors branch
author | Chris Cannam |
---|---|
date | Fri, 05 Dec 2014 11:02:15 +0000 |
parents | 1a422fa20b51 (current diff) eed5f9594268 (diff) |
children | 69b16c0bc903 |
files | src/MatchVampPlugin.cpp |
diffstat | 5 files changed, 29 insertions(+), 27 deletions(-) [+] |
line wrap: on
line diff
--- a/src/DistanceMetric.cpp Thu Dec 04 17:18:39 2014 +0000 +++ b/src/DistanceMetric.cpp Fri Dec 05 11:02:15 2014 +0000 @@ -32,10 +32,8 @@ assert(int(f2.size()) == featureSize); for (int i = 0; i < featureSize; i++) { - assert(f1[i] >= 0); - assert(f2[i] >= 0); d += fabs(f1[i] - f2[i]); - sum += f1[i] + f2[i]; + sum += fabs(f1[i]) + fabs(f2[i]); } if (sum == 0)
--- a/src/FeatureConditioner.cpp Thu Dec 04 17:18:39 2014 +0000 +++ b/src/FeatureConditioner.cpp Fri Dec 05 11:02:15 2014 +0000 @@ -37,7 +37,10 @@ vector<double> out(size, 0.0); double totalEnergy = 0; - if (m_params.order == OutputRectifiedDerivative) { + + switch (m_params.order) { + + case OutputRectifiedDerivative: for (int i = 0; i < size; i++) { totalEnergy += feature[i]; if (feature[i] > m_prev[i]) { @@ -46,11 +49,21 @@ out[i] = 0; } } - } else { + break; + + case OutputDerivative: for (int i = 0; i < size; i++) { + totalEnergy += feature[i]; + out[i] = feature[i] - m_prev[i]; + } + break; + + case OutputFeatures: + for (int i = 0; i < size; i++) { + totalEnergy += feature[i]; out[i] = feature[i]; - totalEnergy += out[i]; } + break; } if (m_ltAverage == 0) {
--- a/src/FeatureConditioner.h Thu Dec 04 17:18:39 2014 +0000 +++ b/src/FeatureConditioner.h Fri Dec 05 11:02:15 2014 +0000 @@ -48,9 +48,13 @@ OutputFeatures, /** Output the half-wave rectified difference between the - * previous and current features instead of the straight - * feature values. */ + * previous and current features instead of the straight + * feature values. */ OutputRectifiedDerivative, + + /** Output the difference between the previous and current + * features instead of the straight feature values. */ + OutputDerivative, }; struct Parameters { @@ -78,10 +82,10 @@ }; /** - * Construct a FeatureExtractor with the given parameters. + * Construct a FeatureConditioner with the given parameters. * - * Note that FeatureExtractor maintains internal frame-to-frame - * state: use one FeatureExtractor per audio source, and construct + * Note that FeatureConditioner maintains internal frame-to-frame + * state: use one FeatureConditioner per audio source, and construct * a new one for each new source. */ FeatureConditioner(Parameters parameters) : m_params(parameters) { }
--- a/src/MatchVampPlugin.cpp Thu Dec 04 17:18:39 2014 +0000 +++ b/src/MatchVampPlugin.cpp Fri Dec 05 11:02:15 2014 +0000 @@ -61,8 +61,8 @@ m_locked(false), m_smooth(true), m_frameNo(0), - m_params(inputSampleRate, defaultStepTime, m_blockSize), - m_defaultParams(inputSampleRate, defaultStepTime, m_blockSize), + m_params(defaultStepTime), + m_defaultParams(defaultStepTime), m_feParams(inputSampleRate, m_blockSize), m_defaultFeParams(inputSampleRate, m_blockSize), m_fcParams(), @@ -317,7 +317,6 @@ MatchVampPlugin::createMatchers() { m_params.hopTime = m_stepTime; - m_params.fftSize = m_blockSize; m_feParams.fftSize = m_blockSize; m_pipeline = new MatchPipeline(m_feParams, m_fcParams, m_params);
--- a/src/Matcher.h Thu Dec 04 17:18:39 2014 +0000 +++ b/src/Matcher.h Fri Dec 05 11:02:15 2014 +0000 @@ -54,19 +54,14 @@ struct Parameters { - Parameters(float rate_, double hopTime_, int fftSize_) : - sampleRate(rate_), + Parameters(double hopTime_) : distanceNorm(DistanceMetric::NormaliseDistanceToLogSum), hopTime(hopTime_), - fftSize(fftSize_), blockTime(10.0), maxRunCount(3), diagonalWeight(2.0) {} - /** Sample rate of audio */ - float sampleRate; - /** Type of distance metric normalisation */ DistanceMetric::DistanceNormalisation distanceNorm; @@ -76,13 +71,6 @@ */ double hopTime; - /** Size of an FFT frame in samples. Note that the data passed - * in to Matcher is already in the frequency domain, so this - * expresses the size of the frame that the caller will be - * providing. - */ - int fftSize; - /** The width of the search band (error margin) around the current * match position, measured in seconds. Strictly speaking the * width is measured backwards from the current point, since the