📄 convfilter.hpp
字号:
// convfilter.hpp A convolution filter class, this is an abstract base class
// (c) Copyright 1995, Everett F. Carter Jr.
// Permission is granted by the author to use
// this software for any application provided this
// copyright notice is preserved.
// rcsid: @(#)convfilter.hpp 1.6 16:35:51 5/16/95 EFC
#ifndef CONV_FILTER_HPP_
#define CONV_FILTER_HPP_ 1.6
/* filters the desired input according to
y[t] = alpha * x[t..t-nx-1] - beta * y[t-1..t-ny]
where * is a convolution, if the filter is a FIR filter
then beta is zero
*/
#include <math.h>
#include <complex.h>
#include <dfilter.hpp>
class ConvolutionFilter : public DigitalFilter
{
protected:
float *alpha, *x;
int nx, nm1;
float *beta, *y;
int ny, mm1;
void free_x_space();
void free_y_space();
void allocate_x_space(const int wx);
void allocate_y_space(const int wy);
void shift(float*, const int);
float convolve();
ConvolutionFilter() : nx(0), alpha(NULL), x(NULL),
ny(0), beta(NULL), y(NULL) {}
public:
virtual ~ConvolutionFilter() { free_x_space(); free_y_space(); }
// The transfer function for calculation of filter characteristics
virtual complex h(const float w, const int inv = 1);
// print the coefficients
ostream& coefs(ostream& os) const;
};
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -