46 std::cerr <<
"ERROR: DecimatorB::initialise: Decimation factor must be a power of 2 and at least 2 (was: " <<
m_decFactor <<
")" << std::endl;
52 std::cerr <<
"ERROR: DecimatorB::initialise: inLength must be a multiple of decimation factor (was: " <<
m_inputLength <<
", factor is " <<
m_decFactor <<
")" << std::endl;
63 m_b[0] = 0.029588223638661;
64 m_b[1] = 0.177529341831965;
65 m_b[2] = 0.443823354579912;
66 m_b[3] = 0.591764472773216;
67 m_b[4] = 0.443823354579912;
68 m_b[5] = 0.177529341831965;
69 m_b[6] = 0.029588223638661;
71 m_a[0] = 1.000000000000000;
72 m_a[1] = 0.000000000000000;
73 m_a[2] = 0.777695961855673;
74 m_a[3] = 0.000000000000000;
75 m_a[4] = 0.114199425062434;
76 m_a[5] = 0.000000000000000;
77 m_a[6] = 0.001750925956183;
79 for (
int factor =
m_decFactor; factor > 1; factor /= 2) {
80 m_o.push_back(vector<double>(6, 0.0));
93 vector<double> &o =
m_o[filteridx];
95 for (
int i = 0; i < length; i++) {
97 double input = src[i];
98 double output = input *
m_b[0] + o[0];
100 o[0] = input *
m_b[1] - output *
m_a[1] + o[1];
101 o[1] = input *
m_b[2] - output *
m_a[2] + o[2];
102 o[2] = input *
m_b[3] - output *
m_a[3] + o[3];
103 o[3] = input *
m_b[4] - output *
m_a[4] + o[4];
104 o[4] = input *
m_b[5] - output *
m_a[5] + o[5];
105 o[5] = input *
m_b[6] - output *
m_a[6];
void initialise(int inLength, int decFactor)
void process(const double *src, double *dst)
std::vector< std::vector< double > > m_o
static bool isPowerOfTwo(int x)
Return true if x is 2^n for some integer n >= 0.
DecimatorB(int inLength, int decFactor)
Construct a DecimatorB to operate on input blocks of length inLength, with decimation factor decFacto...
void doAntiAlias(const double *src, double *dst, int length, int filteridx)