Expand description
§embedded-dsp
A #![no_std] Rust digital signal processing library for microcontrollers, embedded systems, and real-time signal processing applications.
Algorithm modules are Cargo-feature gated (all enabled by the full feature, which is
in default). types and math are always available. See the crate’s [features]
table for the per-module flags.
§Overview
embedded-dsp provides zero-allocation digital signal processing algorithms:
- Basic Math: Elementwise addition, subtraction, multiplication, dot product, scale, shift, clip, logic ops.
- Complex Math: Complex vector addition, multiplication, magnitude, magnitude squared, conjugate, dot product.
- Fast Math: Trigonometric (sin, cos, atan2), square root, division, log, exp.
- Fixed-Point (Q16.16): Saturating Q16.16 arithmetic and scanline interpolation (
fixed-pointfeature). - LUT trigonometry: Compile-time 256-entry sin/cos tables (
lutfeature). - Statistics: Mean, variance, standard deviation, RMS, power, min/max, entropy, Kullback-Leibler, LogSumExp.
- Support: Vector copy, fill, type conversions (Q7, Q15, Q31, F32), sort, barycenter, weighted sum.
- Matrix: Matrix addition, subtraction, multiplication, scale, transpose, Gauss-Jordan inverse.
- Filtering: FIR, Biquad IIR Direct Form I and transposed DF-II (f32/q15/q31), LMS / leaky LMS / NLMS, Convolution, Correlation, single-pole recursive filters (f32/q15), Q15 DC blocker, O(1) recursive moving average, and a double-sampled State Variable Filter (simultaneous LP/HP/BP/notch/peak, sweepable cutoff/resonance).
- Filter Design: Biquad Lowpass, Highpass, Bandpass, Notch, Peaking EQ, Allpass, Butterworth, Chebyshev, and arbitrary-response (frequency-sampling) design.
- Filter Analysis: Frequency response (DTFT) evaluation for FIR/biquad filters, FIR group delay, and pole-based IIR stability checks.
- Resampling & Multi-rate: CIC Decimator & Interpolator, linear fractional resampler.
- Kalman Filtering: 1D/2D helpers, const-generic linear
KalmanFilter<N, M>, and trait-basedExtendedKalmanFilter(EKF). - Const Generics: Compile-time fixed-size
FirFilter<N>,FirFilterQ15<N>,BiquadCascade<N>,BiquadCascadeQ15, andMatrix<R, C>. - Transform: In-place Complex FFT (CFFT), packed Real FFT / inverse (
rfft_q15/irfft_q15), DCT-IV, Bit reversal, Fixed-point FFT (Q15/Q31), Haar transform, Hartley transform, and a generalized wavelet transform (Daubechies-4). - Companding: µ-law and A-law curves plus ITU-T G.711
u8encode/decode. - Audio: Goertzel single-frequency detector (f32/q15), peak/RMS envelope followers (f32/q15), Mel filterbank, and MFCC feature extraction.
- Spectral Analysis & PSD: Welch’s method power spectral density estimation (averaged periodograms), single-segment periodograms in linear and dB scale.
- Spatial & 2D Signal Processing: 2D DCT/IDCT, 2D Convolution, 2D Non-linear Filtering (Min/Max/Median), Sobel edge detection, 2D Histogram, MSE, PSNR.
- Controller: PID motor controller, Clarke/Park (f32 and q15).
- Interpolation: Linear, Bilinear, Cubic spline interpolation.
- Quaternion: Norm, normalization, product, conjugate, inverse, rotation matrix conversion, and
nalgebrainterop (nalgebrafeature). - Window: Hanning, Hamming, Blackman, Blackman-Harris, Bartlett, Welch, Flat-top generators (f32), plus Q15 Hanning/Hamming/Blackman/Bartlett.
- Distance: Euclidean, Cosine, Chebyshev, Manhattan, Minkowski, Jaccard, Hamming, Canberra, Bray-Curtis.
Re-exports§
pub use audio::*;pub use basic_math::*;pub use beamforming::*;pub use companding::*;pub use complex_math::*;pub use const_generics::*;pub use controller::*;pub use cordic::*;pub use distance::*;pub use dynamics::*;pub use fast_math::*;pub use filter_analysis::*;pub use filter_design::*;pub use filtering::*;pub use fixed_point::*;pub use interpolation::*;pub use kalman::*;pub use lut::*;pub use matrix::*;pub use nalgebra_interop::*;pub use pipeline::*;pub use pll::*;pub use psd::*;pub use quaternion::*;pub use resampling::*;pub use spatial::*;pub use statistics::*;pub use svf::*;pub use support::*;pub use transform::*;pub use window::*;pub use intrinsics::*;pub use math::*;pub use types::*;
Modules§
- audio
- Audio analysis: the Goertzel single-frequency detector, peak/RMS envelope followers,
a Mel filterbank, and MFCC feature extraction. These are DSP front-ends (e.g. for a
keyword-spotting pipeline); classifiers and neural nets live in
embedded-nn. - basic_
math - Basic math operations (absolute value, addition, subtraction, multiplication, dot product, negation, offset, scale, shift, clip, logic ops).
- beamforming
- Acoustic Array Processing, Delay-and-Sum Beamforming, and GCC-PHAT TDoA Direction-of-Arrival Estimation.
- companding
- Audio companding: the non-linear µ-law and “A”-law compression curves used by the ITU-T G.711 telephony standard to compress a wide-dynamic-range linear audio sample down to a lower bit depth with minimal perceptual loss (Steven W. Smith, “The Scientist and Engineer’s Guide to DSP”, Ch. 22, Eq. 22-1 / 22-2).
- complex_
math - const_
generics - Const generic safe wrappers for compile-time sized FIR filters, Biquads, and Matrices.
- controller
- Controller functions (PID motor control, Clarke transform, Park transform, Inverse Clarke, Inverse Park).
- cordic
- CORDIC (Coordinate Rotation Digital Computer) pure-integer arithmetic engine.
- distance
- Distance metrics between vectors (Euclidean, Cosine, Chebyshev, Manhattan, Minkowski, Jaccard, Hamming, Canberra, Bray-Curtis).
- dynamics
- Dynamics Range Control: Compressor, Limiter, Expander, and Noise Gate.
- fast_
math - Fast math functions (sin, cos, sin_cos, sqrt, vsqrt, divide, log, exp, atan2).
- filter_
analysis - Frequency-response, group-delay, and pole-based stability analysis for filters
produced by
crate::filter_designor hand-written FIR/biquad coefficients. - filter_
design - Filter design routines for calculating biquad IIR coefficients (Low-pass, High-pass, Band-pass, Notch, Peaking, All-pass, Butterworth).
- filtering
- Digital filtering functions (FIR, Biquad IIR Direct Form I & II, LMS Adaptive Filter, Convolution, Correlation).
- fixed_
point - Q16.16 fixed-point math.
- interpolation
- Interpolation functions (Linear, Bilinear, Spline).
- intrinsics
- SIMD and DSP hardware acceleration intrinsics hooks.
- kalman
- Kalman filtering and state estimation algorithms for zero-allocation embedded applications.
- lut
- Lookup-table trigonometry.
- math
- Unified math abstraction providing floating-point mathematical operations using
libminno_stdenvironments orstdmath when available. - matrix
- Matrix operations (addition, subtraction, multiplication, scale, transpose, inverse, complex matrix multiplication).
- nalgebra_
interop - Conversions between the
[w, x, y, z]quaternion representation used bycrate::quaternionandnalgebra’sQuaternion/UnitQuaternion. - pipeline
- Zero-allocation composable DSP pipeline and streaming abstraction.
- pll
- Phase-Locked Loops (PLL) and carrier recovery for power electronics, motor resolvers, and SDR.
- psd
- Power Spectral Density (PSD) estimation using Welch’s Method (Averaged Overlapped Periodogram) and Bartlett/standard periodograms.
- quaternion
- Quaternion math functions (norm, normalize, product, conjugate, inverse, rotation matrix conversion).
- resampling
- Multi-rate digital signal processing routines: Cascaded Integrator-Comb (CIC) decimation/interpolation and linear fractional resampling.
- spatial
- 2D Spatial and Image Processing routines (2D DCT/IDCT, 2D Convolution, 2D Nonlinear Filters, Sobel Edge Detection, 2D Histogram, MSE/PSNR).
- statistics
- Statistics functions (mean, variance, standard deviation, RMS, power, min, max, absmax, absmin, entropy, Kullback-Leibler, LogSumExp).
- support
- Support functions (copy, fill, format conversions q7/q15/q31/f32, sort, barycenter, weighted sum).
- svf
- State Variable Filter with simultaneous lowpass, highpass, bandpass, notch, and peak outputs.
- transform
- Fast Fourier Transform (FFT), Real FFT (RFFT), Discrete Cosine Transform (DCT-IV), and Bit Reversal functions.
- types
- Data types, status codes, complex structures, and fixed-point helper types.
- window
- Window functions (Hanning, Hamming, Blackman, Blackman-Harris, Bartlett, Welch, Flat-top window generators).