Mercurial > hg > tipic
annotate src/FeatureDownsample.h @ 60:1ea2aed23d4a tip
Fix version
author | Chris Cannam |
---|---|
date | Thu, 13 Feb 2020 13:37:36 +0000 |
parents | 9eab1b374344 |
children |
rev | line source |
---|---|
Chris@35 | 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ |
Chris@35 | 2 |
Chris@42 | 3 /* |
Chris@42 | 4 Tipic |
Chris@42 | 5 |
Chris@42 | 6 Centre for Digital Music, Queen Mary, University of London. |
Chris@42 | 7 |
Chris@42 | 8 This program is free software; you can redistribute it and/or |
Chris@42 | 9 modify it under the terms of the GNU General Public License as |
Chris@42 | 10 published by the Free Software Foundation; either version 2 of the |
Chris@42 | 11 License, or (at your option) any later version. See the file |
Chris@42 | 12 COPYING included with this distribution for more information. |
Chris@42 | 13 */ |
Chris@42 | 14 |
Chris@35 | 15 #ifndef FEATURE_DOWNSAMPLE_H |
Chris@35 | 16 #define FEATURE_DOWNSAMPLE_H |
Chris@35 | 17 |
Chris@35 | 18 #include <vector> |
Chris@35 | 19 |
Chris@35 | 20 #include "Types.h" |
Chris@35 | 21 |
Chris@57 | 22 /** |
Chris@57 | 23 * Downsample a feature by a factor in time. |
Chris@57 | 24 * |
Chris@57 | 25 * This class retains internal history, so a single instance per |
Chris@57 | 26 * channel or feature type is required. It is also not thread-safe. |
Chris@57 | 27 */ |
Chris@35 | 28 class Filter; |
Chris@35 | 29 |
Chris@35 | 30 class FeatureDownsample |
Chris@35 | 31 { |
Chris@35 | 32 public: |
Chris@35 | 33 struct Parameters { |
Chris@35 | 34 int featureSize; |
Chris@35 | 35 int downsampleFactor; |
Chris@35 | 36 int windowLength; |
Chris@37 | 37 int normP; // 0 = no normalisation, 1 = L^1, 2 = L^2 |
Chris@37 | 38 double normThresh; |
Chris@35 | 39 Parameters() : |
Chris@35 | 40 featureSize(1), |
Chris@35 | 41 downsampleFactor(10), |
Chris@37 | 42 windowLength(41), |
Chris@37 | 43 normP(2), |
Chris@37 | 44 normThresh(1e-6) |
Chris@35 | 45 { } |
Chris@35 | 46 }; |
Chris@35 | 47 |
Chris@35 | 48 FeatureDownsample(Parameters params); |
Chris@35 | 49 ~FeatureDownsample(); |
Chris@35 | 50 |
Chris@35 | 51 void reset(); |
Chris@35 | 52 RealBlock process(const RealBlock &in); |
Chris@36 | 53 RealBlock getRemainingOutput(); |
Chris@35 | 54 |
Chris@35 | 55 private: |
Chris@35 | 56 Parameters m_params; |
Chris@35 | 57 std::vector<Filter *> m_filters; |
Chris@36 | 58 int m_toDrop; |
Chris@35 | 59 int m_toNext; |
Chris@36 | 60 int m_inCount; |
Chris@36 | 61 int m_outCount; |
Chris@35 | 62 }; |
Chris@35 | 63 |
Chris@35 | 64 #endif |