SVG of thorsten's editor track/bus list icons
[ardour2.git] / libs / qm-dsp / dsp / rateconversion / Decimator.h
blob081c267e20c07438a016527da4231814ebc77926
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
2 /*
3 QM DSP Library
5 Centre for Digital Music, Queen Mary, University of London.
6 This file 2005-2006 Christian Landone.
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License as
10 published by the Free Software Foundation; either version 2 of the
11 License, or (at your option) any later version. See the file
12 COPYING included with this distribution for more information.
15 #ifndef DECIMATOR_H
16 #define DECIMATOR_H
18 class Decimator
20 public:
21 void process( const double* src, double* dst );
22 void process( const float* src, float* dst );
24 /**
25 * Construct a Decimator to operate on input blocks of length
26 * inLength, with decimation factor decFactor. inLength should be
27 * a multiple of decFactor. Output blocks will be of length
28 * inLength / decFactor.
30 * decFactor must be a power of two. The highest supported factor
31 * is obtained through getHighestSupportedFactor(); for higher
32 * factors, you will need to chain more than one decimator.
34 Decimator( unsigned int inLength, unsigned int decFactor );
35 virtual ~Decimator();
37 int getFactor() const { return m_decFactor; }
38 static int getHighestSupportedFactor() { return 8; }
40 private:
41 void resetFilter();
42 void deInitialise();
43 void initialise( unsigned int inLength, unsigned int decFactor );
44 void doAntiAlias( const double* src, double* dst, unsigned int length );
45 void doAntiAlias( const float* src, double* dst, unsigned int length );
47 unsigned int m_inputLength;
48 unsigned int m_outputLength;
49 unsigned int m_decFactor;
51 double Input;
52 double Output ;
54 double o1,o2,o3,o4,o5,o6,o7;
56 double a[ 9 ];
57 double b[ 9 ];
59 double* decBuffer;
62 #endif //