comparison src/MatchVampPlugin.cpp @ 143:6914a6a01ffc refactors

Transplant the distance metric parameter structure from silence_penalty branch (even though normalisation is currently the only thing in it)
author Chris Cannam
date Fri, 16 Jan 2015 10:18:00 +0000
parents cfba9aec7569
children d307803083e6 246de093f0f1
comparison
equal deleted inserted replaced
140:cfba9aec7569 143:6914a6a01ffc
61 m_params(defaultStepTime), 61 m_params(defaultStepTime),
62 m_defaultParams(defaultStepTime), 62 m_defaultParams(defaultStepTime),
63 m_feParams(inputSampleRate, m_blockSize), 63 m_feParams(inputSampleRate, m_blockSize),
64 m_defaultFeParams(inputSampleRate, m_blockSize), 64 m_defaultFeParams(inputSampleRate, m_blockSize),
65 m_fcParams(), 65 m_fcParams(),
66 m_defaultFcParams() 66 m_defaultFcParams(),
67 m_dParams(),
68 m_defaultDParams()
67 { 69 {
68 if (inputSampleRate < sampleRateMin) { 70 if (inputSampleRate < sampleRateMin) {
69 std::cerr << "MatchVampPlugin::MatchVampPlugin: input sample rate " 71 std::cerr << "MatchVampPlugin::MatchVampPlugin: input sample rate "
70 << inputSampleRate << " < min supported rate " 72 << inputSampleRate << " < min supported rate "
71 << sampleRateMin << ", plugin will refuse to initialise" 73 << sampleRateMin << ", plugin will refuse to initialise"
172 desc.identifier = "distnorm"; 174 desc.identifier = "distnorm";
173 desc.name = "Distance Normalisation"; 175 desc.name = "Distance Normalisation";
174 desc.description = "Type of normalisation to use for distance metric"; 176 desc.description = "Type of normalisation to use for distance metric";
175 desc.minValue = 0; 177 desc.minValue = 0;
176 desc.maxValue = 2; 178 desc.maxValue = 2;
177 desc.defaultValue = (int)m_defaultParams.distanceNorm; 179 desc.defaultValue = (int)m_defaultDParams.norm;
178 desc.isQuantized = true; 180 desc.isQuantized = true;
179 desc.quantizeStep = 1; 181 desc.quantizeStep = 1;
180 desc.valueNames.clear(); 182 desc.valueNames.clear();
181 desc.valueNames.push_back("None"); 183 desc.valueNames.push_back("None");
182 desc.valueNames.push_back("Sum of Frames"); 184 desc.valueNames.push_back("Sum of Frames");
264 if (name == "serialise") { 266 if (name == "serialise") {
265 return m_serialise ? 1.0 : 0.0; 267 return m_serialise ? 1.0 : 0.0;
266 } else if (name == "framenorm") { 268 } else if (name == "framenorm") {
267 return (int)m_fcParams.norm; 269 return (int)m_fcParams.norm;
268 } else if (name == "distnorm") { 270 } else if (name == "distnorm") {
269 return (int)m_params.distanceNorm; 271 return (int)m_dParams.norm;
270 } else if (name == "usespecdiff") { 272 } else if (name == "usespecdiff") {
271 return (int)m_fcParams.order; 273 return (int)m_fcParams.order;
272 } else if (name == "usechroma") { 274 } else if (name == "usechroma") {
273 return m_feParams.useChromaFrequencyMap ? 1.0 : 0.0; 275 return m_feParams.useChromaFrequencyMap ? 1.0 : 0.0;
274 } else if (name == "gradientlimit") { 276 } else if (name == "gradientlimit") {
292 if (name == "serialise") { 294 if (name == "serialise") {
293 m_serialise = (value > 0.5); 295 m_serialise = (value > 0.5);
294 } else if (name == "framenorm") { 296 } else if (name == "framenorm") {
295 m_fcParams.norm = (FeatureConditioner::Normalisation)(int(value + 0.1)); 297 m_fcParams.norm = (FeatureConditioner::Normalisation)(int(value + 0.1));
296 } else if (name == "distnorm") { 298 } else if (name == "distnorm") {
297 m_params.distanceNorm = (DistanceMetric::DistanceNormalisation)(int(value + 0.1)); 299 m_dParams.norm = (DistanceMetric::DistanceNormalisation)(int(value + 0.1));
298 } else if (name == "usespecdiff") { 300 } else if (name == "usespecdiff") {
299 m_fcParams.order = (FeatureConditioner::OutputOrder)(int(value + 0.1)); 301 m_fcParams.order = (FeatureConditioner::OutputOrder)(int(value + 0.1));
300 } else if (name == "usechroma") { 302 } else if (name == "usechroma") {
301 m_feParams.useChromaFrequencyMap = (value > 0.5); 303 m_feParams.useChromaFrequencyMap = (value > 0.5);
302 } else if (name == "gradientlimit") { 304 } else if (name == "gradientlimit") {
328 MatchVampPlugin::createMatchers() 330 MatchVampPlugin::createMatchers()
329 { 331 {
330 m_params.hopTime = m_stepTime; 332 m_params.hopTime = m_stepTime;
331 m_feParams.fftSize = m_blockSize; 333 m_feParams.fftSize = m_blockSize;
332 334
333 m_pipeline = new MatchPipeline(m_feParams, m_fcParams, m_params); 335 m_pipeline = new MatchPipeline(m_feParams, m_fcParams, m_dParams, m_params);
334 } 336 }
335 337
336 bool 338 bool
337 MatchVampPlugin::initialise(size_t channels, size_t stepSize, size_t blockSize) 339 MatchVampPlugin::initialise(size_t channels, size_t stepSize, size_t blockSize)
338 { 340 {