comparison src/MatchVampPlugin.cpp @ 163:cf1282d1f940 refactors

Add overall cost output to plugin. Looks suspiciously unaffected by tuning frequency.
author Chris Cannam
date Thu, 29 Jan 2015 17:38:09 +0000
parents dda5410ac9f0
children 31602361fb65
comparison
equal deleted inserted replaced
162:dda5410ac9f0 163:cf1282d1f940
399 MatchVampPlugin::createMatchers() 399 MatchVampPlugin::createMatchers()
400 { 400 {
401 m_params.hopTime = m_stepTime; 401 m_params.hopTime = m_stepTime;
402 m_feParams.fftSize = m_blockSize; 402 m_feParams.fftSize = m_blockSize;
403 403
404 cerr << "creating pipeline with m_secondReferenceFrequency = "
405 << m_secondReferenceFrequency << endl;
404 m_pipeline = new MatchPipeline(m_feParams, m_fcParams, m_dParams, m_params, 406 m_pipeline = new MatchPipeline(m_feParams, m_fcParams, m_dParams, m_params,
405 m_secondReferenceFrequency); 407 m_secondReferenceFrequency);
408 cerr << "done" << endl;
406 } 409 }
407 410
408 bool 411 bool
409 MatchVampPlugin::initialise(size_t channels, size_t stepSize, size_t blockSize) 412 MatchVampPlugin::initialise(size_t channels, size_t stepSize, size_t blockSize)
410 { 413 {
567 desc.sampleType = OutputDescriptor::FixedSampleRate; 570 desc.sampleType = OutputDescriptor::FixedSampleRate;
568 desc.sampleRate = outRate; 571 desc.sampleRate = outRate;
569 m_cbFeaturesOutNo = list.size(); 572 m_cbFeaturesOutNo = list.size();
570 list.push_back(desc); 573 list.push_back(desc);
571 574
575 desc.identifier = "overall_cost";
576 desc.name = "Overall Cost";
577 desc.description = "Normalised overall path cost for the cheapest path";
578 desc.unit = "";
579 desc.hasFixedBinCount = true;
580 desc.binCount = 1;
581 desc.hasKnownExtents = false;
582 desc.isQuantized = false;
583 desc.sampleType = OutputDescriptor::FixedSampleRate;
584 desc.sampleRate = 1;
585 m_overallCostOutNo = list.size();
586 list.push_back(desc);
587
572 return list; 588 return list;
573 } 589 }
574 590
575 MatchVampPlugin::FeatureSet 591 MatchVampPlugin::FeatureSet
576 MatchVampPlugin::process(const float *const *inputBuffers, 592 MatchVampPlugin::process(const float *const *inputBuffers,
646 Finder *finder = m_pipeline->getFinder(); 662 Finder *finder = m_pipeline->getFinder();
647 std::vector<int> pathx; 663 std::vector<int> pathx;
648 std::vector<int> pathy; 664 std::vector<int> pathy;
649 int len = finder->retrievePath(m_smooth, pathx, pathy); 665 int len = finder->retrievePath(m_smooth, pathx, pathy);
650 666
667 double cost = finder->getOverallCost();
668 Feature costFeature;
669 costFeature.hasTimestamp = false;
670 costFeature.values.push_back((float)cost);
671 returnFeatures[m_overallCostOutNo].push_back(costFeature);
672
651 int prevx = 0; 673 int prevx = 0;
652 int prevy = 0; 674 int prevy = 0;
653 675
654 for (int i = 0; i < len; ++i) { 676 for (int i = 0; i < len; ++i) {
655 677