Mercurial > hg > match-vamp
changeset 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 | 13774b008b6a |
files | src/FeatureExtractor.cpp src/Finder.cpp src/Finder.h src/MatchVampPlugin.cpp src/MatchVampPlugin.h |
diffstat | 5 files changed, 44 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/FeatureExtractor.cpp Thu Jan 29 17:22:02 2015 +0000 +++ b/src/FeatureExtractor.cpp Thu Jan 29 17:38:09 2015 +0000 @@ -75,6 +75,8 @@ int crossoverBin = (int)(2 / (pow(2, 1/12.0) - 1)); int crossoverMidi = lrint(log(crossoverBin * binWidth / refFreq)/ log(2.0) * 12 + 69); + + cerr << "FeatureExtractor::makeStandardFrequencyMap: refFreq = " << refFreq << endl; int i = 0; while (i <= crossoverBin) {
--- a/src/Finder.cpp Thu Jan 29 17:22:02 2015 +0000 +++ b/src/Finder.cpp Thu Jan 29 17:38:09 2015 +0000 @@ -335,6 +335,19 @@ } #endif +double +Finder::getOverallCost() +{ + int ex = m_m->getOtherFrameCount() - 1; + int ey = m_m->getFrameCount() - 1; + + if (ex < 0 || ey < 0) { + return 0; + } + + return m_m->getNormalisedPathCost(ey, ex); +} + int Finder::retrievePath(bool smooth, vector<int> &pathx, vector<int> &pathy) {
--- a/src/Finder.h Thu Jan 29 17:22:02 2015 +0000 +++ b/src/Finder.h Thu Jan 29 17:38:09 2015 +0000 @@ -65,6 +65,12 @@ */ int retrievePath(bool smooth, std::vector<int> &pathx, std::vector<int> &pathy); + /** + * Get the path cost for the overall path to the end of both + * sources. + */ + double getOverallCost(); + protected: #ifdef PERFORM_ERROR_CHECKS struct ErrorPosition {
--- a/src/MatchVampPlugin.cpp Thu Jan 29 17:22:02 2015 +0000 +++ b/src/MatchVampPlugin.cpp Thu Jan 29 17:38:09 2015 +0000 @@ -401,8 +401,11 @@ m_params.hopTime = m_stepTime; m_feParams.fftSize = m_blockSize; + cerr << "creating pipeline with m_secondReferenceFrequency = " + << m_secondReferenceFrequency << endl; m_pipeline = new MatchPipeline(m_feParams, m_fcParams, m_dParams, m_params, m_secondReferenceFrequency); + cerr << "done" << endl; } bool @@ -569,6 +572,19 @@ m_cbFeaturesOutNo = list.size(); list.push_back(desc); + desc.identifier = "overall_cost"; + desc.name = "Overall Cost"; + desc.description = "Normalised overall path cost for the cheapest path"; + desc.unit = ""; + desc.hasFixedBinCount = true; + desc.binCount = 1; + desc.hasKnownExtents = false; + desc.isQuantized = false; + desc.sampleType = OutputDescriptor::FixedSampleRate; + desc.sampleRate = 1; + m_overallCostOutNo = list.size(); + list.push_back(desc); + return list; } @@ -648,6 +664,12 @@ std::vector<int> pathy; int len = finder->retrievePath(m_smooth, pathx, pathy); + double cost = finder->getOverallCost(); + Feature costFeature; + costFeature.hasTimestamp = false; + costFeature.values.push_back((float)cost); + returnFeatures[m_overallCostOutNo].push_back(costFeature); + int prevx = 0; int prevy = 0;
--- a/src/MatchVampPlugin.h Thu Jan 29 17:22:02 2015 +0000 +++ b/src/MatchVampPlugin.h Thu Jan 29 17:38:09 2015 +0000 @@ -101,6 +101,7 @@ mutable int m_bFeaturesOutNo; mutable int m_caFeaturesOutNo; mutable int m_cbFeaturesOutNo; + mutable int m_overallCostOutNo; #ifdef _WIN32 static HANDLE m_serialisingMutex;