kfrlib / kfr

Fast, modern C++ DSP framework, FFT, Sample Rate Conversion, FIR/IIR/Biquad Filters (SSE, AVX, AVX-512, ARM NEON)
https://www.kfrlib.com
GNU General Public License v2.0
1.66k stars 253 forks source link

linker error for convolve_filter #188

Closed clnorris closed 1 year ago

clnorris commented 1 year ago

I'm working on an app that is needing fixed point DSP. Comparing with CMSIS-DSP, this would be q31_t, so in kfr I am trying to use int32_t with the kfr templates. I am building with aarch64-xilinx-linux-clang++

I declare my coefficients like this:

univector<int32_t, NUM_TAPS> firCoeffs = { <snip> };

And my filter like this:

convolve_filter<int32_t>* _pFilter = new convolve_filter<q31_t>(firCoeffs, BLOCK_SIZE);

During link, I get this error:

[build] aarch64-xilinx-linux-ld.lld: error: undefined symbol: kfr::neon64::convolve_filter<int>::convolve_filter(kfr::univector<int const, 0ul> const&, unsigned long)

I was able to build ok if I use filter_fir instead of convolve_filter. It also builds ok if I use convolve_filter.

This leads to a usage question, does convolve_filter support fixed width types, or does it have to be a float? Need help to determine if this is a bug or an incompatible usage.

dancazarin commented 1 year ago

Unfortunately, KFR doesn't support fixed-point math. Hardware FPU or, better, a floating point SIMD is required for it to work. On the other hand, KFR supports integer math and some algorithms may be emulated using integer operations but there are no pre-made algorithms that work with fixed-point data.