annotate src/MatchFeeder.h @ 67:a3efb15e7faf refactors

Merge from branch refactors_no_float
author Chris Cannam
date Tue, 18 Nov 2014 10:33:03 +0000
parents a540137d393b
children
rev   line source
cannam@0 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
cannam@0 2 /*
cannam@0 3 Vamp feature extraction plugin using the MATCH audio alignment
cannam@0 4 algorithm.
cannam@0 5
cannam@0 6 Centre for Digital Music, Queen Mary, University of London.
cannam@0 7 This file copyright 2007 Simon Dixon, Chris Cannam and QMUL.
cannam@0 8
cannam@0 9 This program is free software; you can redistribute it and/or
cannam@0 10 modify it under the terms of the GNU General Public License as
cannam@0 11 published by the Free Software Foundation; either version 2 of the
cannam@0 12 License, or (at your option) any later version. See the file
cannam@0 13 COPYING included with this distribution for more information.
cannam@0 14 */
cannam@0 15
cannam@0 16 #ifndef _MATCH_FEEDER_H_
cannam@0 17 #define _MATCH_FEEDER_H_
cannam@0 18
cannam@0 19 #include "Matcher.h"
cannam@0 20 #include "Finder.h"
cannam@0 21
cannam@0 22 #include <queue>
Chris@14 23 #include <vector>
cannam@0 24
cannam@0 25 class MatchFeeder
cannam@0 26 {
cannam@0 27 public:
cannam@0 28 MatchFeeder(Matcher *m1, Matcher *m2);
cannam@0 29 ~MatchFeeder();
cannam@0 30
Chris@14 31 /**
Chris@14 32 * Feed the two supplied channels of frequency-domain input data
Chris@14 33 * to feeders 1 and 2 respectively, as appropriate (depending on
Chris@14 34 * their advance status).
Chris@14 35 */
cannam@0 36 void feed(const float *const *input);
cannam@0 37
Chris@63 38 /**
Chris@63 39 * Indicate that the input has come to an end.
Chris@63 40 */
Chris@63 41 void finish();
Chris@63 42
Chris@14 43 struct Features {
Chris@14 44 std::vector<std::vector<double> > f1;
Chris@14 45 std::vector<std::vector<double> > f2;
Chris@14 46 };
Chris@14 47
Chris@14 48 /**
Chris@14 49 * Feed the two supplied channels of frequency-domain input data
Chris@24 50 * to matchers 1 and 2 respectively, as appropriate (depending on
Chris@14 51 * their advance status) and return any new feature vectors
Chris@14 52 * calculated by the two feeders.
Chris@14 53 */
Chris@14 54 Features feedAndGetFeatures(const float *const *input);
Chris@63 55
Chris@63 56 /**
Chris@63 57 * Indicate that the input has come to an end, and return any
Chris@63 58 * remaining features.
Chris@63 59 */
Chris@63 60 Features finishAndGetFeatures();
Chris@60 61
cannam@0 62 Finder *getFinder() { return finder; }
cannam@0 63
cannam@0 64 protected:
Chris@14 65 void prepare(const float *const *input);
Chris@14 66 Features feedBlock();
Chris@14 67 std::vector<double> feed1();
Chris@14 68 std::vector<double> feed2();
cannam@0 69
cannam@0 70 Finder *finder;
cannam@0 71 Matcher *pm1;
cannam@0 72 Matcher *pm2;
cannam@0 73
cannam@0 74 size_t fftSize;
cannam@0 75 double *reBuffer;
cannam@0 76 double *imBuffer;
cannam@0 77
cannam@0 78 std::queue<float *> q1;
cannam@0 79 std::queue<float *> q2;
Chris@60 80
Chris@60 81 int n;
Chris@60 82 int lastIn1;
Chris@60 83 int lastIn2;
cannam@0 84 };
cannam@0 85
cannam@0 86 #endif