dsp-process
Small no_std traits for static DSP composition. State, layout, and loop shape
remain explicit; no allocation or dynamic dispatch is required.
Processing shapes
| Shape | Representation | Use |
|---|---|---|
| one config, one state | Split<C, S> |
ordinary stateful filter |
| one config, many states | Split<C, S>::lanes() |
shared coefficients |
| many configs, one state | direct SplitProcess calls |
prediction/correction phases |
| many config/state pairs | tuples, arrays, Minor, Major |
static pipelines |
SplitProcess<X, Y, S> is the primitive: &self is immutable configuration;
&mut S is caller-owned state. Different configurations may therefore operate
on the same state:
use SplitProcess;
;
;
;
let mut state = State;
Predict.process;
assert_eq!;
This is useful when processing has distinct phases but one state, such as a Kalman transition and observation. Tuple composition instead gives each stage its own state.
Owned processors
Split<C, S> binds one configuration to one state and implements Process:
use ;
let mut offset = stateless;
assert_eq!;
One configuration can drive several independent states:
use ;
let mut lanes = stateless.;
assert_eq!;
Composition
Tuples and arrays form serial pipelines. Parallel forms branches. Minor and
Major select loop nesting and scratch placement.
use ;
let mut pipeline = .minor;
assert_eq!;
Adapters (Chunk, ChunkIn, ChunkOut, Interpolator, Decimator, Map)
change rate or call shape without hiding state.
Layout
Layout-sensitive processing uses typed views. FrameMajor and LaneMajor
make the physical interpretation part of the type; sample newtypes do not.
use ;
let mut lanes = stateless.;
let input = from_flat;
let mut output = ;
let output = from_flat;
lanes.process_view;
Use Split::per_frame() to apply a chunk processor to each frame of a
frame-major view.
Implementing a stage
- Implement
SplitProcesswhen configuration and state are distinct. - Implement
Processwhen one value naturally owns both. - Implement
SplitInplaceorInplacefor a real in-place specialization. - Override
block()only to improve the loop or memory traffic.
Runtime fields hold values; const generics encode shape; wrappers encode composition and layout.