fir.h
1 /***************************************************************************
2  Copyright (C) 2002-2015 Kentaro Kitagawa
3  kitagawa@phys.s.u-tokyo.ac.jp
4 
5  This program is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Library General Public
7  License as published by the Free Software Foundation; either
8  version 2 of the License, or (at your option) any later version.
9 
10  You should have received a copy of the GNU Library General
11  Public License and a list of authors along with this program;
12  see the files COPYING and AUTHORS.
13 ***************************************************************************/
14 /*
15  Finite Impulse Response Filter
16 */
17 
18 
19 #ifndef FIR_H
20 #define FIR_H
21 
22 #include "support.h"
23 #include <vector>
24 #include <complex>
25 #include <fftw3.h>
26 
27 //! FIR (Finite Impulse Response) Digital Filter.
28 //! Accelerated by FFT.
29 class DECLSPEC_KAME FIR {
30 public:
31  //! makes coeff. for BPF. Window func. method.
32  //! \param taps odd num. a number of taps
33  //! \param bandwidth 0 to 1.0. the unit is sampling freq.
34  //! \param center 0.0 to 1.0. the unit is sampling freq.
35  FIR(int taps, double bandwidth, double center);
36  ~FIR();
37  void exec(const double *src, double *dst, int len);
38  int taps() const {return m_taps;}
39  double bandWidth() const {return m_bandWidth;}
40  double centerFreq() const {return m_centerFreq;}
41 private:
42  fftw_plan m_rdftplan, m_ridftplan;
43  double *m_pBufR;
44  fftw_complex *m_pBufC;
45  std::vector<double> m_firWnd;
46  int m_fftLen, m_tapLen;
47  const int m_taps;
48  const double m_bandWidth;
49  const double m_centerFreq;
50 };
51 
52 #endif //FIR_H

Generated for KAME4 by  doxygen 1.8.3