feat(dsp): non-uniform partitioned convolution — IR cap 2 s → 10 s#49
Merged
Conversation
Uniform 256-sample partitions made per-block cost linear in IR length, forcing the 2 s cap that rejects hall/church reverb IRs. Split at 8192 taps: head keeps 256-sample partitions (latency unchanged), tail uses 4096-sample partitions with the FFT + delay-line MAC spread across the 16 sub-blocks of each tail cycle, so no callback pays for the whole line. Head length = two tail blocks buys exactly one cycle of slack — no worker thread, deterministic RT path (audiodg-safe). Measured per 256-frame stereo call: 2 s IR 54 us (was ~1 ms), 10 s IR 165 us; worst-case sub-block 492 us vs the 2.67 ms 96 kHz budget. Closes #41
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #41.
What
Two-stage Gardner partitioning in the convolution engine:
BLOCK(256 frames).HEAD_LEN = 2 × TAIL_BLOCKis load-bearing: a completed tail block finishes one full 16-sub-block cycle before its earliest output is due, so the tail FFT + frequency-delay-line MAC are spread across the cycle's sub-blocks — no CPU spike, no worker thread, deterministic allocation-free RT path (audiodg-safe).MAX_IR_SECONDS2.0 → 10.0. Short IRs (≤ 8192 taps) allocate no tail state and behave byte-for-byte as before.Public API, IPC protocol, APO IR-blob format and latency are unchanged.
Measured (release, per 256-frame stereo call)
Memory note: FDL + kernel ≈ 32 B/tap/ch each (10 s stereo @96 kHz ≈ 90 MB); a
realfftfollow-up can halve it.Tests
benches/chain.rs: convolution bench at 0.1 s / 2 s / 10 s.worst_case_block_time_fits_rt_budget).Verified on
make checkgreen (fmt, clippy -D warnings, full workspace suite).