# HG changeset patch # User Chris Cannam # Date 1417700580 0 # Node ID 921a88e8859dbdda587f802b9ae7a4d00c8675eb # Parent 3f46ce2d287453e4eb878e9488f40ffe8e440f3b Permit retrieving features diff -r 3f46ce2d2874 -r 921a88e8859d src/MatchPipeline.cpp --- a/src/MatchPipeline.cpp Thu Dec 04 13:35:23 2014 +0000 +++ b/src/MatchPipeline.cpp Thu Dec 04 13:43:00 2014 +0000 @@ -45,20 +45,40 @@ void MatchPipeline::feedFeatures(const vector &f1, const vector &f2) { + m_f1 = f1; + m_f2 = f2; + feedConditionedFeatures(m_fc1.process(f1), m_fc2.process(f2)); } void -MatchPipeline::feedConditionedFeatures(const vector &f1, const vector &f2) +MatchPipeline::feedConditionedFeatures(const vector &c1, const vector &c2) { - m_feeder.feed(f1, f2); + m_c1 = c1; + m_c2 = c2; + + m_feeder.feed(c1, c2); - if (aboveThreshold(f1)) m_lastFrameIn1 = m_frameNo; - if (aboveThreshold(f2)) m_lastFrameIn2 = m_frameNo; + if (aboveThreshold(c1)) m_lastFrameIn1 = m_frameNo; + if (aboveThreshold(c2)) m_lastFrameIn2 = m_frameNo; ++m_frameNo; } +void +MatchPipeline::extractFeatures(vector &f1, vector &f2) +{ + f1 = m_f1; + f2 = m_f2; +} + +void +MatchPipeline::extractConditionedFeatures(vector &c1, vector &c2) +{ + c1 = m_c1; + c2 = m_c2; +} + bool MatchPipeline::aboveThreshold(const vector &f) { diff -r 3f46ce2d2874 -r 921a88e8859d src/MatchPipeline.h --- a/src/MatchPipeline.h Thu Dec 04 13:35:23 2014 +0000 +++ b/src/MatchPipeline.h Thu Dec 04 13:43:00 2014 +0000 @@ -61,7 +61,7 @@ * the pipeline. */ void feedFeatures(const vector &f1, const vector &f2); - + /** * Feed in data at the third pipeline stage. The vectors represent * conditioned feature frames from two different sources. They @@ -71,6 +71,19 @@ void feedConditionedFeatures(const vector &f1, const vector &f2); /** + * If a frame was just fed in at the first or second pipeline + * stage, it can be retrieved from the second stage here. That is, + * if you provided frequency-domain audio, extractFeatures will + * give you back the FeatureExtractor's features. + */ + void extractFeatures(vector &f1, vector &f2); + + /** + * Retrieve the conditioned features from the third pipeline stage. + */ + void extractConditionedFeatures(vector &f1, vector &f2); + + /** * Indicate that both inputs have come to an end. */ void finish(); @@ -88,6 +101,10 @@ int m_lastFrameIn1; int m_lastFrameIn2; int m_frameNo; + vector m_f1; + vector m_f2; + vector m_c1; + vector m_c2; bool aboveThreshold(const vector &f); };