Decimator.h
Go to the documentation of this file.
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 QM_DSP_DECIMATOR_H
16 #define QM_DSP_DECIMATOR_H
17 
24 class Decimator
25 {
26 public:
37  Decimator(int inLength, int decFactor);
38  virtual ~Decimator();
39 
46  void process( const double* src, double* dst );
47 
54  void process( const float* src, float* dst );
55 
56  int getFactor() const { return m_decFactor; }
57  static int getHighestSupportedFactor() { return 8; }
58 
59  void resetFilter();
60 
61 private:
62  void deInitialise();
63  void initialise( int inLength, int decFactor );
64  void doAntiAlias( const double* src, double* dst, int length );
65  void doAntiAlias( const float* src, double* dst, int length );
66 
70 
71  double Input;
72  double Output ;
73 
74  double o1,o2,o3,o4,o5,o6,o7;
75 
76  double a[ 9 ];
77  double b[ 9 ];
78 
79  double* decBuffer;
80 };
81 
82 #endif //
void process(const double *src, double *dst)
Process inLength samples (as supplied to constructor) from src and write inLength / decFactor samples...
Definition: Decimator.cpp:195
void resetFilter()
Definition: Decimator.cpp:148
double o6
Definition: Decimator.h:74
double o5
Definition: Decimator.h:74
int m_outputLength
Definition: Decimator.h:68
static int getHighestSupportedFactor()
Definition: Decimator.h:57
double o2
Definition: Decimator.h:74
virtual ~Decimator()
Definition: Decimator.cpp:33
double Input
Definition: Decimator.h:71
void deInitialise()
Definition: Decimator.cpp:143
double Output
Definition: Decimator.h:72
Decimator(int inLength, int decFactor)
Construct a Decimator to operate on input blocks of length inLength, with decimation factor decFactor...
Definition: Decimator.cpp:24
int m_decFactor
Definition: Decimator.h:69
double o1
Definition: Decimator.h:74
void doAntiAlias(const double *src, double *dst, int length)
Definition: Decimator.cpp:155
double a[9]
Definition: Decimator.h:76
double * decBuffer
Definition: Decimator.h:79
Decimator carries out a fast downsample by a power-of-two factor.
Definition: Decimator.h:24
double o7
Definition: Decimator.h:74
double o4
Definition: Decimator.h:74
int m_inputLength
Definition: Decimator.h:67
double o3
Definition: Decimator.h:74
double b[9]
Definition: Decimator.h:77
void initialise(int inLength, int decFactor)
Definition: Decimator.cpp:38
int getFactor() const
Definition: Decimator.h:56