Multi-Stage Half-band Resampler (msresamp2)
API Keywords: msresamp2 dyadic half-band resample two multi-stage filterbank
The msresamp2 object implements a multi-stage half-band resampler use for efficient interpolation and decimation.
Below is a code example demonstrating the msresamp2 interface.
#include <liquid/liquid.h>
int main() {
// options
int type = LIQUID_RESAMP_DECIM;
unsigned int num_stages = 4; // decimate by 2^4=16
float fc = 0.1f; // signal cut-off frequency
float f0 = 0.0f; // (ignored)
float As = 60.0f; // stop-band attenuation
// create multi-stage arbitrary resampler object
msresamp2_crcf q = msresamp2_crcf_create(type, num_stages, fc, f0, As);
msresamp2_crcf_print(q);
float complex x[16]; // input buffer
float complex y; // output sample
// ... initialize input ...
// execute resampler
msresamp2_crcf_execute(q, x, &y);
// ... repeat as necessary ...
// clean up allocated objects
msresamp2_crcf_destroy(q);
}
Figure [fig-filter-msresamp2]. msresamp2_crcf (multi-stage half-band resampler) interpolator demonstration with a stop-band suppression \(A_s=60\) dB at the rate \(r = 8\) .
[ref:fig-filter-msresamp2] gives a graphical depiction in both the time and frequency domains of the multi-stage half-band resampler acting as an interpolator.