Simple C++ interface for 1D fast FIR filtering or Fast convolution.
Fast FIR filtering or convolution is very important when implementing FIR filters. Naive or slow FIR filtering can be extremely CPU intensive. So much so that a FIR filter with a few hundred taps can easily use 100% CPU usage on a desktop PC. Fast FIR filtering which uses the FFT ( Fast Fourier Transform ) can produce the same results with a fraction of the CPU usage and thousands of taps are trivial. Generally to be useful a FIR filter needs a few hundred taps depending on the application.
The FastFIR library contains a wrapper to KissFFT to implement Fast FIR filtering with an interface that makes it as easy to implement a Fast FIR filter as it does to implement a slow one.
Usage is a simple as
//create pointer QJFastFIRFilter *fastfir; //create fast FIR filter fastfir = new QJFastFIRFilter(this); //set the kernel of the filter, in this case a Low Pass filter at 800Hz fastfir->setKernel(QJFilterDesign::LowPassHanning(800,48000,1001)); //process data (data is QVector<kffsamp_t>, eg "QVector<kffsamp_t> data;") fastfir->Update(data);
If you already have Qt Creator with Qt5 or above getting started is as simple as downloading the library and running the demo application with Qt Creator; no other downloads needed. Alternatively classes for use with standard C++ without Qt are also included.
Filter designs included
The QJFilterDesign/JFilterDesign class contains the following filter designs for use with Fast FIR filtering
- LPF Low Pass Filter
- HPF High Pass Filter
- BPF Band Pass Filter
- BSF Band Stop Filter
Downloading the library
See the GitHub repository for the library and more information.