globally remove all trailing whitespace from ardour code base.
[ardour.git] / libs / qm-dsp / dsp / rateconversion / Decimator.h
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*-  vi:set ts=8 sts=4 sw=4: */
2 /*
3     QM DSP Library
4
5     Centre for Digital Music, Queen Mary, University of London.
6     This file 2005-2006 Christian Landone.
7
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.
13 */
14
15 #ifndef DECIMATOR_H
16 #define DECIMATOR_H
17
18 class Decimator
19 {
20 public:
21     void process( const double* src, double* dst );
22     void process( const float* src, float* dst );
23
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.
29      *
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.
33      */
34     Decimator( unsigned int inLength, unsigned int decFactor );
35     virtual ~Decimator();
36
37     int getFactor() const { return m_decFactor; }
38     static int getHighestSupportedFactor() { return 8; }
39
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 );
46
47     unsigned int m_inputLength;
48     unsigned int m_outputLength;
49     unsigned int m_decFactor;
50
51     double Input;
52     double Output ;
53
54     double o1,o2,o3,o4,o5,o6,o7;
55
56     double a[ 9 ];
57     double b[ 9 ];
58         
59     double* decBuffer;
60 };
61
62 #endif //