How C++14 and C++17 help to write faster (and better) code. Real world examples
29 August 2016
Writing high performance code is always a difficult task. Pure algorithms are not always a good fit for real-world architectures.
Once having begun to speed up all these pure algorithms, we quickly find that some implementation is pretty fast on one architecture, but terribly slow on another while the second implementation outperforms the first one in some contexts losing speed in all the rest.
Numerous big and small optimizations for each of the supported architectures can quickly bloat our code and waste our time.
Example: FIR filter in C++
14 August 2016
The following example shows how to apply an FIR filter to audio data using the KFR framework.
#include <kfr/all.hpp> using namespace kfr; int main(int argc, char** argv) { // static array (like std::array) to hold the taps univector<double, 15> taps; // create the window function // the tap count is passed to window_hann // window_hann does not calculate the window immediately // it creates an expression that represents a Hann window expression_handle<double> hann = to_handle(window_hann<double>(taps.
Biquad filters in C++ using KFR
25 July 2016
Digital biquad filters and biquad design functions have been part of the KFR framework since its first version.
The biquad algorithm uses Transposed Direct Form II, which reduces quantization errors in floating-point calculations.