This repository contains a minimal C/C++ library for computing polyphase FIR filters.
First, determine your memory requirements:
const auto persistent_bytes = persistent_bytes_required (n_channels, n_taps, interpolation_factor, max_block_size, alignment);
const auto scratch_bytes = scratch_bytes_required (n_taps, interpolation_factor, max_block_size, alignment);Next, you can create a "state" object:
auto* state = init (n_channels,
n_taps,
interpolation_factor,
max_block_size,
allocate_bytes (persistent_bytes, alignment),
alignment);And load in our filter coefficients:
load_coeffs (state, coeffs, n_taps);Now we're ready to do our processing! We can do polyphase interpolation:
process_interpolate (state,
input_buffer,
output_buffer,
n_channels,
n_samples,
scratch_data,
use_avx);Or decimation:
process_decimate (state,
input_buffer,
output_buffer,
n_channels,
n_samples,
scratch_data,
use_avx);This code is licensed under the BSD 3-clause license. Enjoy!