MythTV  0.27pre
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Groups Pages
FIRFilter.h
Go to the documentation of this file.
1 
2 
3 
4 
5 
6 
7 
8 
9 
10 
11 
12 
13 //
14 // Last changed : $Date$
15 // File revision : $Revision$
16 //
17 // $Id$
18 //
20 //
21 // License :
22 //
23 // SoundTouch audio processing library
24 // Copyright (c) Olli Parviainen
25 //
26 // This library is free software; you can redistribute it and/or
27 // modify it under the terms of the GNU Lesser General Public
28 // License as published by the Free Software Foundation; either
29 // version 2.1 of the License, or (at your option) any later version.
30 //
31 // This library is distributed in the hope that it will be useful,
32 // but WITHOUT ANY WARRANTY; without even the implied warranty of
33 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
34 // Lesser General Public License for more details.
35 //
36 // You should have received a copy of the GNU Lesser General Public
37 // License along with this library; if not, write to the Free Software
38 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
39 //
41 
42 #ifndef FIRFilter_H
43 #define FIRFilter_H
44 
45 #include "STTypes.h"
46 
47 class FIRFilter
48 {
49 protected:
50  // Number of FIR filter taps
52  // Number of FIR filter taps divided by 8
54 
55  // Result divider factor in 2^k format
57 
58  // Result divider value.
60 
61  // Memory for filter coefficients
63 
66  uint numSamples) const;
69  uint numSamples) const;
70 
71 public:
72  FIRFilter();
73  virtual ~FIRFilter();
74 
77  void * operator new(size_t s);
78 
79  static FIRFilter *newInstance();
80 
88  uint numSamples,
89  uint numChannels) const;
90 
91  uint getLength() const;
92 
93  virtual void setCoefficients(const soundtouch::SAMPLETYPE *coeffs,
94  uint newLength,
95  uint uResultDivFactor);
96 };
97 
98 
99 // Optional subclasses that implement CPU-specific optimizations:
100 
101 #ifdef ALLOW_SSE2
102 
103  class FIRFilterSSE2 : public FIRFilter
104  {
105  protected:
108 
109  virtual uint evaluateFilterStereo(float *dest, const float *src, uint numSamples) const;
110  public:
111  FIRFilterSSE2();
112  ~FIRFilterSSE2();
113 
114  virtual void setCoefficients(const float *coeffs, uint newLength, uint uResultDivFactor);
115  };
116 
117 #endif // ALLOW_SSE2
118 
119 #ifdef ALLOW_MMX
120 
122  class FIRFilterMMX : public FIRFilter
123  {
124  protected:
127 
128  virtual uint evaluateFilterStereo(short *dest, const short *src, uint numSamples) const;
129  public:
130  FIRFilterMMX();
131  ~FIRFilterMMX();
132 
133  virtual void setCoefficients(const short *coeffs, uint newLength, uint uResultDivFactor);
134  };
135 
136 #endif // ALLOW_MMX
137 
138 #endif // FIRFilter_H