annotate src/MatchPipeline.h @ 105:3f46ce2d2874 feature_conditioner

Start MatchPipeline
author Chris Cannam
date Thu, 04 Dec 2014 13:35:23 +0000
parents
children 921a88e8859d
rev   line source
Chris@105 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
Chris@105 2 /*
Chris@105 3 Vamp feature extraction plugin using the MATCH audio alignment
Chris@105 4 algorithm.
Chris@105 5
Chris@105 6 Centre for Digital Music, Queen Mary, University of London.
Chris@105 7 This file copyright 2007 Simon Dixon, Chris Cannam and QMUL.
Chris@105 8
Chris@105 9 This program is free software; you can redistribute it and/or
Chris@105 10 modify it under the terms of the GNU General Public License as
Chris@105 11 published by the Free Software Foundation; either version 2 of the
Chris@105 12 License, or (at your option) any later version. See the file
Chris@105 13 COPYING included with this distribution for more information.
Chris@105 14 */
Chris@105 15
Chris@105 16 #ifndef MATCH_PIPELINE_H
Chris@105 17 #define MATCH_PIPELINE_H
Chris@105 18
Chris@105 19 #include "Matcher.h"
Chris@105 20 #include "Finder.h"
Chris@105 21 #include "FeatureExtractor.h"
Chris@105 22 #include "FeatureConditioner.h"
Chris@105 23 #include "MatchFeatureFeeder.h"
Chris@105 24
Chris@105 25 class MatchPipeline
Chris@105 26 {
Chris@105 27 public:
Chris@105 28 /**
Chris@105 29 * Pipeline consisting of two Matchers, two FeatureConditioners,
Chris@105 30 * two FeatureExtractors, and a Finder. Features may be inserted
Chris@105 31 * at any point in the pipeline.
Chris@105 32 *
Chris@105 33 * The pipeline goes:
Chris@105 34 * Frequency-domain audio
Chris@105 35 * -> Features
Chris@105 36 * -> Conditioned features
Chris@105 37 * -> Matcher
Chris@105 38 */
Chris@105 39 MatchPipeline(FeatureExtractor::Parameters feParams,
Chris@105 40 FeatureConditioner::Parameters fcParams,
Chris@105 41 Matcher::Parameters matchParams);
Chris@105 42
Chris@105 43 ~MatchPipeline();
Chris@105 44
Chris@105 45 /**
Chris@105 46 * Feed in data at the first pipeline stage. The input arrays
Chris@105 47 * represent frames of audio from the two different sources. Each
Chris@105 48 * is provided as a single array of alternating real and imaginary
Chris@105 49 * components.
Chris@105 50 *
Chris@105 51 * Input arrays must have at least 2 * (feParams.fftSize/2 + 1)
Chris@105 52 * elements. The arrays will be passed to FeatureExtractor and
Chris@105 53 * then on into the rest of the pipeline.
Chris@105 54 */
Chris@105 55 void feedFrequencyDomainAudio(const float *arr1, const float *arr2);
Chris@105 56
Chris@105 57 /**
Chris@105 58 * Feed in data at the second pipeline stage. The vectors
Chris@105 59 * represent feature frames from two different sources. They will
Chris@105 60 * be passed in to FeatureConditioner and then on to the rest of
Chris@105 61 * the pipeline.
Chris@105 62 */
Chris@105 63 void feedFeatures(const vector<double> &f1, const vector<double> &f2);
Chris@105 64
Chris@105 65 /**
Chris@105 66 * Feed in data at the third pipeline stage. The vectors represent
Chris@105 67 * conditioned feature frames from two different sources. They
Chris@105 68 * will be passed to MatchFeatureFeeder for feeding to the two
Chris@105 69 * matchers.
Chris@105 70 */
Chris@105 71 void feedConditionedFeatures(const vector<double> &f1, const vector<double> &f2);
Chris@105 72
Chris@105 73 /**
Chris@105 74 * Indicate that both inputs have come to an end.
Chris@105 75 */
Chris@105 76 void finish();
Chris@105 77
Chris@105 78 Finder *getFinder();
Chris@105 79
Chris@105 80 private:
Chris@105 81 FeatureExtractor m_fe1;
Chris@105 82 FeatureExtractor m_fe2;
Chris@105 83 FeatureConditioner m_fc1;
Chris@105 84 FeatureConditioner m_fc2;
Chris@105 85 Matcher m_pm1;
Chris@105 86 Matcher m_pm2;
Chris@105 87 MatchFeatureFeeder m_feeder;
Chris@105 88 int m_lastFrameIn1;
Chris@105 89 int m_lastFrameIn2;
Chris@105 90 int m_frameNo;
Chris@105 91 bool aboveThreshold(const vector<double> &f);
Chris@105 92 };
Chris@105 93
Chris@105 94 #endif