README.md (6493B)
1 # KFR - Fast, modern C++ DSP framework 2 3 <p align="center"> 4 <img width="300" height="auto" src="img/KFR1.png"> 5 </p> 6 7  8  9 10  11  12 13 https://www.kfrlib.com 14 15 KFR is an open source C++ DSP framework that contains high performance building blocks for DSP, audio, scientific and other applications. It is distributed under dual GPLv2/v3 and [commercial license](https://kfrlib.com/purchase). 16 17 ## KFR6 18 19 New features, performance improvements, easier setup. 20 21 :arrow_right: [What's new in KFR6](docs/docs/whatsnew6.md) 22 23 :arrow_right: [Upgrade from a previous version](docs/docs/upgrade6.md) 24 25 ## Our other projects 26 27 <div align="center"> 28 29 [**🟣 Brisk**](https://github.com/brisklib/brisk) is a cross-platform C++20 GUI framework featuring MVVM architecture, reactive capabilities, and scalable, accelerated GPU rendering. *(GPL/Commercial)* 30 31 [**🟢 CxxDox**](https://github.com/kfrlib/cxxdox) — C++ documentation generator. *(MIT)* 32 33 </div> 34 35 ## KFR Installation 36 37 Compiler support: 38 39  40  41  42  43 44 KFR has no external dependencies except for a C++17-compatible standard C++ library. CMake is used as the build system. 45 46 Clang is highly recommended and proven to provide the best performance for KFR. You can use Clang as a drop-in replacement for both GCC on Linux and MSVC on Windows. On macOS, Clang is the default compiler and included in the official Xcode toolchain. 47 48 _Note_: Building the DFT module currently requires Clang due to internal compiler errors and a lack of optimization in GCC and MSVC. 49 50 :arrow_right: See [Installation](docs/docs/installation.md) docs for more details 51 52 ## Features 53 54 :star2: — new in KFR6 55 56 ### FFT/DFT 57 * Optimized DFT implementation for any size (non-power of two sizes are supported) 58 * DFT performance is on par with the most performant implementation currently available [See Benchmarks](#benchmark-results) 59 * Real forward and inverse DFT 60 * :star2: Multidimensional complex and real DFT 61 * Discrete Cosine Transform type II (and its inverse, also called DCT type III) 62 * Convolution using FFT 63 * Convolution filter 64 65 :arrow_right: See also [How to apply FFT](docs/docs/dft.md) with KFR 66 67 ### DSP 68 69 * IIR filter design 70 * Butterworth 71 * Chebyshev type I and II 72 * Bessel 73 * Lowpass, highpass, bandpass and bandstop filters 74 * Conversion of arbitrary filter from {Z, P, K} to SOS format (suitable for biquad function and filter) 75 * Biquad filter [See Benchmarks](#benchmark-results) 76 * Simple biquad filter design 77 * FIR filter design using window method 78 * Loudness measurement according to EBU R128 79 * Window functions: Triangular, Bartlett, Cosine, Hann, Bartlett-Hann, Hamming, Bohman, Blackman, Blackman-Harris, Kaiser, Flattop, Gaussian, Lanczos, Rectangular 80 * Sample rate conversion with configurable quality and linear phase 81 * Oscillators, fast incremental sine/cosine generation, Goertzel algorithm, fractional delay 82 83 ### Base 84 85 * Tensors (multidimensional arrays) 86 * :star2: .npy support (reading/writing) 87 * :star2: Matrix transpose 88 * Statistical functions 89 * Random number generation 90 * Template expressions (See examples) 91 * Ring (Circular) buffer 92 * :star2: Windows arm64 support 93 * :star2: Emscripten (wasm/wasm64) support 94 95 ### Math 96 97 * Mathematical functions such as `sin`, `log` and `cosh` built on top of SIMD primitives 98 * Most of the standard library functions are re-implemented to support vector of any length and data type 99 100 ### SIMD 101 102 * `vec<T, N>` class and related functions that abstracts cpu-specific intrinsics 103 * All code in the library is optimized for Intel, AMD (SSE2, SSE3, SSE4.x, AVX and AVX2 and AVX512) and ARM, AArch64 (NEON) processors 104 * All data types are supported including complex numbers 105 * All vector lengths are also supported. `vec<float,1>`, `vec<unsigned,3>`, `vec<complex<float>, 11>` all are valid vector types in KFR 106 * Sorting 107 108 ### IO 109 110 * Audio file reading/writing 111 * WAV 112 * FLAC 113 * MP3 114 115 ### Multiarchitecture 116 117 The multiarchitecture mode enables building algorithms for multiple architectures with runtime dispatch to detect the CPU of the target machine and select the best code path 118 119 * :star2: Multiarchitecture for DFT, resampling, FIR and IIR filters. 120 121 ### C API 122 123 C API is available and includes a subset of KFR features including FFT and filter processing. 124 125 * :star2: Support for non x86 systems. 126 127 ## Benchmark results 128 129 ### DFT 130 131 Powers of 2, from 16 to 16777216 (*Higher is better*) 132 133  134 135 Prime numbers from 17 to 127 (*Higher is better*) 136 137  138 139 Small numbers from 18 to 119 (*Higher is better*) 140 141  142 143 Random sizes from 120 to 30720000 (*Higher is better*) 144 145  146 147 See [fft benchmark](https://github.com/kfrlib/fft-benchmark) for details about benchmarking process. 148 149 150 ### Biquad 151 152 (*Higher is better*) 153 154  155 156 ## Documentation 157 158 KFR 6 (latest) 159 https://www.kfrlib.com/docs/latest/ 160 161 KFR 5 162 https://www.kfrlib.com/docs/v5/ 163 164 Built with 165 * [cxxdox - generates markdown docs from C++](https://github.com/kfrlib/cxxdox) 166 * [mkdocs - static documentation generator](https://www.mkdocs.org/) 167 * [mkdocs-material - material theme for mkdocs](https://squidfunk.github.io/mkdocs-material/) 168 169 ## Branches 170 171 `dev` - current development version. Pull requests should go to `dev`. 172 173 `main` - current stable version passing all compiler/architecture tests. 174 175 `v5` - previous version of KFR (no new features, fixes only) 176 177 ## License 178 179 KFR is dual-licensed, available under both commercial and open-source GPL 2+ license. 180 181 If you want to use KFR in a commercial product or a closed-source project, you need to [purchase a Commercial License](https://kfrlib.com/purchase-license).