v2.0.0
Loading...
Searching...
No Matches
iirfilter.h
Go to the documentation of this file.
1//=============================================================================================================
38
39#ifndef IIRFILTER_DSP_H
40#define IIRFILTER_DSP_H
41
42//=============================================================================================================
43// INCLUDES
44//=============================================================================================================
45
46#include "dsp_global.h"
47
48//=============================================================================================================
49// EIGEN INCLUDES
50//=============================================================================================================
51
52#include <Eigen/Core>
53
54//=============================================================================================================
55// QT INCLUDES
56//=============================================================================================================
57
58#include <QVector>
59
60//=============================================================================================================
61// DEFINE NAMESPACE UTILSLIB
62//=============================================================================================================
63
64namespace UTILSLIB
65{
66
67//=============================================================================================================
78{
79 double b0 = 1.0;
80 double b1 = 0.0;
81 double b2 = 0.0;
82 double a1 = 0.0;
83 double a2 = 0.0;
84};
85
86//=============================================================================================================
107{
108public:
109 //=========================================================================================================
119
120 //=========================================================================================================
132 static QVector<IirBiquad> designButterworth(int iOrder,
133 FilterType type,
134 double dCutoffLow,
135 double dCutoffHigh,
136 double dSFreq);
137
138 //=========================================================================================================
147 static Eigen::RowVectorXd applySos(const Eigen::RowVectorXd& vecData,
148 const QVector<IirBiquad>& sos);
149
150 //=========================================================================================================
160 static Eigen::RowVectorXd applyZeroPhase(const Eigen::RowVectorXd& vecData,
161 const QVector<IirBiquad>& sos);
162
163 //=========================================================================================================
172 static Eigen::MatrixXd applyZeroPhaseMatrix(const Eigen::MatrixXd& matData,
173 const QVector<IirBiquad>& sos);
174
175private:
176 //=========================================================================================================
184 static QVector<std::complex<double>> butterworthPrototypePoles(int n);
185
186 //=========================================================================================================
196 static IirBiquad poleToDigitalBiquad(std::complex<double> pole,
197 double dC,
198 double dGain);
199
200 //=========================================================================================================
211 static IirBiquad realPoleToDigitalSection(double dPoleReal,
212 double dC,
213 double dGain);
214};
215
216} // namespace UTILSLIB
217
218#endif // IIRFILTER_DSP_H
dsp library export/import macros.
#define DSPSHARED_EXPORT
Definition dsp_global.h:56
Shared utilities (I/O helpers, spectral analysis, layout management, warp algorithms).
Coefficients of one second-order IIR section (biquad).
Definition iirfilter.h:78
Butterworth IIR filter design and application using second-order sections.
Definition iirfilter.h:107
FilterType
Filter type selector.
Definition iirfilter.h:113