# HG changeset patch # User Chris Cannam # Date 1422553089 0 # Node ID cf1282d1f9402da50d52397650645edc47c52a5c # Parent dda5410ac9f0a8f0e95ad07dcb8527b682a49267 Add overall cost output to plugin. Looks suspiciously unaffected by tuning frequency. diff -r dda5410ac9f0 -r cf1282d1f940 src/FeatureExtractor.cpp --- 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) { diff -r dda5410ac9f0 -r cf1282d1f940 src/Finder.cpp --- 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 &pathx, vector &pathy) { diff -r dda5410ac9f0 -r cf1282d1f940 src/Finder.h --- 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 &pathx, std::vector &pathy); + /** + * Get the path cost for the overall path to the end of both + * sources. + */ + double getOverallCost(); + protected: #ifdef PERFORM_ERROR_CHECKS struct ErrorPosition { diff -r dda5410ac9f0 -r cf1282d1f940 src/MatchVampPlugin.cpp --- 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 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; diff -r dda5410ac9f0 -r cf1282d1f940 src/MatchVampPlugin.h --- 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;