v2.0.0
Loading...
Searching...
No Matches
iirfilter.h
Go to the documentation of this file.
1//=============================================================================================================
31
32#ifndef IIRFILTER_DSP_H
33#define IIRFILTER_DSP_H
34
35//=============================================================================================================
36// INCLUDES
37//=============================================================================================================
38
39#include "dsp_global.h"
40
41//=============================================================================================================
42// EIGEN INCLUDES
43//=============================================================================================================
44
45#include <Eigen/Core>
46
47//=============================================================================================================
48// QT INCLUDES
49//=============================================================================================================
50
51#include <QVector>
52
53//=============================================================================================================
54// DEFINE NAMESPACE UTILSLIB
55//=============================================================================================================
56
57namespace UTILSLIB
58{
59
60//=============================================================================================================
71{
72 double b0 = 1.0;
73 double b1 = 0.0;
74 double b2 = 0.0;
75 double a1 = 0.0;
76 double a2 = 0.0;
77};
78
79//=============================================================================================================
100{
101public:
102 //=========================================================================================================
112
113 //=========================================================================================================
125 static QVector<IirBiquad> designButterworth(int iOrder,
126 FilterType type,
127 double dCutoffLow,
128 double dCutoffHigh,
129 double dSFreq);
130
131 //=========================================================================================================
140 static Eigen::RowVectorXd applySos(const Eigen::RowVectorXd& vecData,
141 const QVector<IirBiquad>& sos);
142
143 //=========================================================================================================
153 static Eigen::RowVectorXd applyZeroPhase(const Eigen::RowVectorXd& vecData,
154 const QVector<IirBiquad>& sos);
155
156 //=========================================================================================================
165 static Eigen::MatrixXd applyZeroPhaseMatrix(const Eigen::MatrixXd& matData,
166 const QVector<IirBiquad>& sos);
167
168private:
169 //=========================================================================================================
177 static QVector<std::complex<double>> butterworthPrototypePoles(int n);
178
179 //=========================================================================================================
189 static IirBiquad poleToDigitalBiquad(std::complex<double> pole,
190 double dC,
191 double dGain);
192
193 //=========================================================================================================
204 static IirBiquad realPoleToDigitalSection(double dPoleReal,
205 double dC,
206 double dGain);
207};
208
209} // namespace UTILSLIB
210
211#endif // IIRFILTER_DSP_H
Export/import macros and namespace declaration for the DSP library.
#define DSPSHARED_EXPORT
Definition dsp_global.h:50
Shared utilities (I/O helpers, spectral analysis, layout management, warp algorithms).
Coefficients of one second-order IIR section (biquad).
Definition iirfilter.h:71
Butterworth IIR filter design and application using second-order sections.
Definition iirfilter.h:100
FilterType
Filter type selector.
Definition iirfilter.h:106