v2.0.0
Loading...
Searching...
No Matches
firfilter.h
Go to the documentation of this file.
1//=============================================================================================================
26
27#ifndef FIRFILTER_DSP_H
28#define FIRFILTER_DSP_H
29
30//=============================================================================================================
31// INCLUDES
32//=============================================================================================================
33
34#include "dsp_global.h"
35#include "filterkernel.h"
36
37//=============================================================================================================
38// EIGEN INCLUDES
39//=============================================================================================================
40
41#include <Eigen/Core>
42
43#include <vector>
44
45//=============================================================================================================
46// DEFINE NAMESPACE UTILSLIB
47//=============================================================================================================
48
49namespace UTILSLIB
50{
51
52//=============================================================================================================
65{
66public:
67 //=========================================================================================================
72 {
73 LowPass = 0,
77 };
78
79 //=========================================================================================================
84 {
85 Cosine = 0,
87 };
88
89 //=========================================================================================================
109 static FilterKernel design(int iOrder,
110 FilterType type,
111 double dCutoffLow,
112 double dCutoffHigh,
113 double dSFreq,
114 double dTransition = 5.0,
115 DesignMethod method = Cosine);
116
117 //=========================================================================================================
130 static Eigen::RowVectorXd apply(const Eigen::RowVectorXd& vecData,
131 FilterKernel& kernel);
132
133 //=========================================================================================================
145 static Eigen::RowVectorXd applyZeroPhase(const Eigen::RowVectorXd& vecData,
146 FilterKernel& kernel);
147
148 //=========================================================================================================
158 static Eigen::MatrixXd applyZeroPhaseMatrix(const Eigen::MatrixXd& matData,
159 FilterKernel& kernel,
160 const Eigen::RowVectorXi& vecPicks = Eigen::RowVectorXi());
161
162 //=========================================================================================================
174 static Eigen::RowVectorXd designMne(double dSFreq, double dLFreq, double dHFreq);
175
176 //=========================================================================================================
189 static Eigen::MatrixXd filterData(const Eigen::MatrixXd& matData, double dSFreq, double dLFreq, double dHFreq);
190
192 enum class FirWindow
193 {
194 Hann,
196 };
197
198 //=========================================================================================================
209 static Eigen::RowVectorXd firwin2(int nTaps, const std::vector<double>& freq, const std::vector<double>& gain,
210 FirWindow window = FirWindow::Hann);
211
212 //=========================================================================================================
226 static Eigen::MatrixXd filterDataZeroDouble(const Eigen::MatrixXd& matData, double dSFreq, double dLFreq, double dHFreq,
227 FirWindow window = FirWindow::Hann);
228
229private:
231 static Eigen::MatrixXd overlapAddZeroPhase(const Eigen::MatrixXd& matData, const Eigen::RowVectorXd& h, Eigen::Index nEdge);
232};
233
234} // namespace UTILSLIB
235
236#endif // FIRFILTER_DSP_H
Export/import macros and namespace declaration for the DSP library.
#define DSPSHARED_EXPORT
Definition dsp_global.h:50
Linear-phase FIR filter kernel with overlap-add FFT convolution back-end.
Shared utilities (I/O helpers, spectral analysis, layout management, warp algorithms).
The FilterKernel class provides methods to create/design a FIR filter kernel.
Discoverable façade over the FilterKernel FIR-filter engine.
Definition firfilter.h:65
FilterType
FIR filter type — mirrors IirFilter::FilterType for a uniform API.
Definition firfilter.h:72
DesignMethod
FIR design method — wraps FilterKernel's iDesignMethod integer codes.
Definition firfilter.h:84