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.62k stars 248 forks source link

KFR Roadmap #196

Closed dancazarin closed 5 months ago

dancazarin commented 9 months ago

KFR Roadmap

🎯 KFR 6

Matrix transpose

Both inplace and out-of-place options will be supported as well as other matrix operations.

2D DFT https://github.com/kfrlib/kfr/issues/127 https://github.com/kfrlib/kfr/issues/81

Also DFT-based algorithms such as DCT will get 2D variants too.

Applying a function along axis of tensor<>

With full vectorization support.

More functions to support $N$-dim tensor<>

Separate state_holder for all DSP algorithms https://github.com/kfrlib/kfr/issues/78

With this change it will be possible to prefill state before performing actual filtering. No more need to keep constructed expressions just to keep the state itself.

More audio formats https://github.com/kfrlib/kfr/issues/126

πŸš€ Future versions

Elliptic filters https://github.com/kfrlib/kfr/issues/163

To extend the list of already supported Butterworth, Bessel and Chebyshev I/II filters.

RISC-V support

.npy format support

To be able to load and store KFR tensors to and from numpy's .npy format.

Prebuilt binaries using GitHub Actions

Built in Clang compiler (known to provide the best performance for heavy-vectorized code) but usable for both GCC and MSVC.

GCC and MSVC support for DFT https://github.com/kfrlib/kfr/issues/70

Capture subexpressions by value unless std::ref or std::cref is used

This will fix potential errors with temporary scalars and subexpressions captured by references.

This is a breaking change.

Multithreading https://github.com/kfrlib/kfr/issues/63

Multithread DFT and other algorithms.

xkzl commented 8 months ago

All of this would be fantastic features. Thank you for bringing a light over the remaining work. Especially about multithreaded DFT, 2D DFT, and elliptic filter.

Do you have any idea already about the timeline of this roadmap ? Is it about several months of work or a year maybe ?

dancazarin commented 8 months ago

KFR 6 is scheduled for the coming weeks with 2D DFT, improved DFT performance (up to 30-50% increase in speed depending on architecture and DFT size) and all other features listed here under KFR 6 section. Future versions section is what will be implemented in one of the next releases of KFR but after KFR 6. There is no exact schedule of these features yet and the priority depends on many factors (commercial requests etc).

xkzl commented 8 months ago

Sounds amazing, I definitely need to try this :-)

xkzl commented 7 months ago

@dancazarin Is there any plan to implement short time fourier transform and reverse ? It would be great to have such features. What do you think, were there some discussions about it already ?

dancazarin commented 7 months ago

KFR 5.2.0 has been released with DFT performance improvements and all latest fixes. KFR 6 is on the way.

As for STFT, it's basically a combination of DFT and window function, both are implemented in KFR. It's possible to make a class that encapsulates these operations and also performs splitting streamed data to chunks etc. Is it what you think about? Right now KFR focuses on algorithms that process data in memory buffers, not streams but it may be considered for future releases. Or your data is available all at once?

xkzl commented 7 months ago

Hi @dancazarin Thank you for the update ! My use case is twice. I can run offline analysis where I have all at once data, or online data that are a stream of data.(basically, one set per second.)

dancazarin commented 5 months ago

KFR6 preview has been released. Pull new changes from GitHub and switch to v6 branch to test new features. Multiarchitecture mode is now enabled by default and controlled by CMake flag KFR_ENABLE_MULTIARCH. Besides DFT the multiarchitecture mode now includes resampling, FIR filters, IIR filters and more. There is a possibility to override cpu detected at runtime.

In addition to 1D DFT a Multidimensional DFT (both complex and real) is available through dft_plan_md and dft_plan_md_real classes. The number of dimensions can be a runtime constant (use dynamic_shape as NDims value).

kfr::complex has been removed in favor of using std::complex everywhere. Graphics module is also removed in KFR6.

CMake config generation during install makes KFR usage as simple as adding find_package(KFR CONFIG REQUIRED) to CMakeLists.txt.

DFT and DSP source code moved to /src. simd, math, base modules are still header-only.

(Experimental) With KFR_WITH_CLANG CMake flag enabled it transparently downloads official build of latest Clang and configures cmake compilation to use clang instead of default compiler for Linux and Windows.

C API is supported in both Intel and ARM and supports error handling.

Accelerated matrix transposition with any number of dimensions.

Numerous small enhancements and bug fixes.

Examples, documentation and migration guide will be added later.

More features are ready to be released.

Expect force-pushes and API changes in v6 branch. For production code it's reasonable to wait for the official KFR6 release.

KFR5 will be supported in bug-fix mode until the next major release of KFR.