Expand description
§kofft - High-performance DSP library for Rust
A comprehensive Digital Signal Processing (DSP) library featuring FFT, DCT, DST, Hartley, Wavelet, STFT, and more. Optimized for both embedded systems and desktop applications.
§Features
- 🚀 Zero-allocation stack-only APIs for MCU/embedded systems
- ⚡ SIMD acceleration (x86_64 AVX2 & SSE, AArch64 NEON, WebAssembly SIMD)
- 🔧 Multiple transform types: FFT, DCT, DST, Hartley, Wavelet, STFT, CZT, Goertzel
- 📊 Window functions: Hann, Hamming, Blackman, Kaiser
- 🔄 Batch and multi-channel processing
- 🌐 WebAssembly support
- 📱 Parallel processing (optional)
§Cargo Features
std(default): Enable standard library featuresparallel: Enable parallel processing with Rayonx86_64: Enable x86_64 AVX2/FMA optimizationssse: Enable SSE optimizations for x86_64 without AVX2aarch64: Enable AArch64 SIMD optimizationswasm: Enable WebAssembly SIMD optimizations
SIMD backends are also activated automatically when compiling with the
appropriate target-feature flags (e.g., -C target-feature=+avx2).
§Performance
- Stack-only APIs: No heap allocation, suitable for MCUs with limited RAM
- SIMD acceleration: 2-4x speedup on supported platforms
- Power-of-two sizes: Most efficient for FFT operations
- Memory usage: Stack usage scales with transform size
§Platform Support
| Platform | SIMD Support | Enable via |
|---|---|---|
| x86_64 | AVX2/FMA | x86_64 feature or -C target-feature=+avx2 |
| x86_64 (SSE) | SSE2 | sse feature or default sse2 target |
| AArch64 | NEON | aarch64 feature or -C target-feature=+neon |
| WebAssembly | SIMD128 | wasm feature or -C target-feature=+simd128 |
| Generic | Scalar | Default fallback |
Feature selection precedence: x86_64 (AVX2) → sse → scalar fallback. |
§Examples
Run the examples with:
cargo run --example basic_usage
cargo run --example stft_usage
cargo run --example ndfft_usage
cargo run --example embedded_example
cargo run --example benchmark§License
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or https://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or https://opensource.org/licenses/MIT)
at your option.
Re-exports§
pub use fft::FftPlanner;pub use num::Complex;pub use num::Complex32;pub use num::Complex64;pub use num::Float;
Modules§
- cepstrum
- Cepstrum analysis
- czt
- Chirp Z-Transform (CZT)
- dct
- Discrete Cosine Transform (DCT)
- dst
- Discrete Sine Transform (DST)
- fft
- Fast Fourier Transform (FFT) algorithms.
- goertzel
- Goertzel algorithm
- hartley
- Discrete Hartley Transform (DHT)
- hilbert
- Hilbert transform
- ndfft
- N-dimensional FFT operations
- num
- Real-input FFT helpers built on top of complex FFT routines for converting between real and complex domains.
- rfft
- Fast Fourier Transform (FFT) implementations
- stft
- Short-Time Fourier Transform (STFT)
- wavelet
- Wavelet transforms
- window
- Window functions for signal processing
- window_
more - Additional window functions
Functions§
- add
- Simple addition function for testing purposes