Closed astewart-xmos closed 2 years ago
When investigating polyphase decimators, I realized that I'm pretty sure the existing FIR filter functions are suitable for polyphase decimation. To do decimation, with a decimation factor of K
, when the n
th input sample is received, compute z = n mod K
, and if z == 0
, call xs3_filter_fir_s32()
, otherwise call xs3_filter_fir_s32_add_sample()
.
update:
int32_t poly_decimate(xs3_filter_fir_s32_t* filter, int32_t samples_in[K]){
for(int k = 0; k < (K-1); k++)
xs3_filter_fir_s32_add_sample(filter, samples_in[k]);
return xs3_filter_fir_s32(filter, samples_in[K-1]);
}
Similarly, polyphase interpolation by a factor K
can be performed as
void poly_interpolate(int32_t* output, xs3_filter_fir_s32_t* filter, int32_t sample){
output[0] = xs3_filter_fir_s32(filter, sample);
for(int k = 1; k < K; k++)
output[k] = xs3_filter_fir_s32(filter, 0);
}
Given that decimation/interpolation are already possible by combining operations already available, I don't see any urgent need to add additional functions explicitly for decimation/interpolation.
This issue can be reopened later if it's deemed necessary.
Implement polyphase FIR filters for decimation and interpolation.
These will be needed for updating lib_mic_array to take advantage of XS3