DSP: convolve reverb streams on the host #240
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/240"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from Marvisak/VIctory. Originally posted by Quat3rnion on 2026-11-24T01:43:09Z.
What
DSP convolution streams returned silence because the impulse-response layout
was unknown. The Xbox docs describe it: frequency-domain complex pairs split
into filter blocks of
blockFrameCountpairs, with an optional per-channelstereo IR. This adds a portable partitioned FFT convolver that decodes that
layout and wires it into
XDspSubmitCommand, so reverb returns are wet. FFTand IFFT streams still return silence; their buffers are spectra, not audio.
The console does not store the Nyquist bin, so it is reconstructed by
conjugate symmetry. A unity impulse therefore comes back within about 0.2
percent instead of exactly, and the convolver allocates block scratch per
call; both are noted in the code.
An AI tool wrote part of this change.
Tested
cargo test --workspacewith PR #112's Linux build fix applied locally (not part of this PR): 171 passed, 0 failed, 3 ignored. The convolution tests compare against direct time-domain convolution and exercise the API end to end.cargo check --target x86_64-pc-windows-gnu --workspace --testspasses. The Windows-only tests were not run; there is no Windows host here.Checklist
cargo fmton the changed files; workspace tests and Windows cross-check pass as described.cargo xtask policypasses (151 files ok). No game files or data from them were added.Imported from Marvisak/VIctory. Originally posted by jeremygold02 on 2026-11-24T05:05:09Z.
Thanks @Quat3rnion for the host-side DSP convolution path. I tested the open PR at head
9f77a9a27d620ee5f88384f7f98c517f2d38741fwith:Result: 6 passed, 0 failed, 0 ignored. The tests cover FFT round-tripping, impulse response copying, block convolution against a direct reference, stereo channel separation, gain ramps/reset, and malformed layout/buffer rejection. This validates the synthetic convolution math and buffer handling; it does not measure behavior with a live title audio stream or real host audio device.
Code: dsp_convolve.rs, dsp.rs.
Imported from Marvisak/VIctory. Originally posted by mercuryVM on 2026-11-24T13:24:13Z.
Review: APPROVED
Tested
2d1036don Windows 11, RTX 5070, MSVC:cargo test -p victory-hle94 passed, including the convolver tests (a unity impulse within tolerance, the stereo IR layout).The partitioned FFT convolver and the documented IR layout (blocks of
blockFrameCountcomplex pairs, Nyquist rebuilt by conjugate symmetry) look right, and FFT/IFFT streams correctly stay silent. Clippy adds five new warnings in the new code, which suggest leftovers:dsp_convolve.rs:encode_irandresetare never used. If they're test helpers, put them under#[cfg(test)]; otherwise drop them.needless_range_loopwarnings (thebinandframeloops at lines 246/256).f32 -> f32cast.dsp.rs:179: anunsafeblock without aSAFETY:comment.AI-assisted (Claude Code).
Imported from Marvisak/VIctory. Originally posted by Yaekai on 2026-11-24T16:28:27Z.
Independent test & review on Windows 11 (Rust 1.98.1) at head
723f4a2:cargo test -p victory-hle --lib: 101 passed, 0 failed.1.0.2.1,--console series-s): audio runs cleanly with no panics or crashes.cargo clippy -p victory-hle -- -D warnings): fails with 5 lints indsp_convolve.rsbefore merge:dead_code:method reset is never useddead_code:function encode_ir is never usedundocumented_unsafe_blocks:unsafe block missing a safety commentneedless_range_loop:the loop variable frame is used to index spectrumneedless_range_loop:the loop variable bin is only used to index spectrumImported from Marvisak/VIctory. Originally posted by MamaLeVrai on 2026-11-24T17:41:40Z.
Correction to my earlier comment: the CI run of this PR did run and fails on clippy. For reference, what
cargo clippy -p victory-hle --all-targets --locked -- -D warningsreports on this PR merged ontomainatffe310e:dsp_convolve.rs:173: methodresetis never used (dead code)dsp_convolve.rs:246: functionencode_iris never used (dead code)dsp.rs:179: unsafe block missing a safety commentdsp_convolve.rs:203and:256:needless_range_loop(the loop variables only indexspectrum)dsp_convolve.rs:328: castingf32tof32is unnecessary (test build)The tests pass. AI-assisted (Claude Code); no game data.
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T00:26:49Z.
Automated triage for the maintainers.
Needs work. CI fails on clippy in
crates/victory-hle/src/modules/dsp_convolve.rs(needless_range_looparound line 256,unnecessary_castat line 328, and others).Beyond that, this changes emulation behaviour without stated evidence: the impulse-response layout
Convolver::newdecodes (complex pairs in blocks offrames, the Nyquist bin dropped, one run per channel with option bit 8) is asserted, while main's module doc indsp.rssays the layout is unknown. The new checks invalid()also change the activation call's return values, and the tests use the PR's ownencode_ir, so they only check that the code agrees with itself. Please cite public documentation for the layout or show it against the title's own data, and reword the comment that uses an identifier copied from the console SDK headers.CI: failing (clippy).
Generated by Claude Code
Imported from Marvisak/VIctory. Originally posted by kais7654 on 2026-11-25T14:44:25Z.
The check job fails on clippy -D warnings: five warnings in the new
code, no test failure. Rebased onto main 940d32f's layout with the
fixes and opened a PR: the needless_range_loop pair,
resetandencode_irmarked cfg(test) (their only callers are tests), the IRslice's SAFETY note moved against its unsafe block, and a doubled cast.
Your convolution tests all pass on a Windows host (victory-hle: 150/0),
so the change itself is sound — the head was one clippy pass away.
AI-assisted (Mistral Vibe).
Imported from Marvisak/VIctory. Originally posted by kilolimaVI on 2026-11-26T21:46:31Z.
FYI: #2483 carries this PR's commit plus the clippy fixes CI needs, and it merges cleanly onto current main with its DSP tests passing and clippy clean (details on #2483).
AI-assisted (Claude).
Imported from Marvisak/VIctory. Originally posted by Quat3rnion on 2026-11-27T02:46:02Z.
Superseded by #2483, which carries this PR's convolution commit with the clippy fixes CI needs and is verified on Windows. Thanks @kais7654 for picking it up.
Pull request closed