Formats: speed up XMA PCM rounding #3656
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3656"
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 andrewpozdnakov7-jpg on 2026-11-28T03:25:40Z.
Change
Convert decoded XMA samples to i16 by scaling in f64, adding a half with the sample's sign and casting. The wider addition keeps f32 values immediately next to a tie on the correct side. The cast truncates and saturates, giving the existing ties-away-from-zero rounding and clipping.
Verification
AI-assisted with OpenAI Codex.
Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-28T03:31:45Z.
Verified
32fd04874e340acf25b595ad54710dbca4ef77dcon Windows CI. Both Clippy stages and the workspace test stage passed.The conversion probe matched the old result on 6,426,282 inputs. In a local negative control, adding the signed half in f32 rounded sample
0x377fffffto 1 instead of 0. The committed regression catches that and passes with the f64 operation.The 288-frame stereo fixtures match all 301,056 PCM samples each. The dense fixture gave a 1.83–1.89× median decode speedup on this Windows CPU. The integration with #3631 also matched the dense PCM output exactly.
Please retain the Git author on cherry-pick or rebase, or add
Co-authored-by: andrewpozdnakov7-jpg <[email protected]>if folding the change into another commit.AI-assisted with OpenAI Codex.
Imported from Marvisak/VIctory. Originally posted by cloph-dsp on 2026-11-28T10:27:17Z.
Independent local verification (Windows, Rust 1.100.0/MSVC, no game data):
32fd04874e340acf25b595ad54710dbca4ef77dc, base/parent63bcca43c6a00a758510398fa43096ce7e4f7df0.cargo test --locked -p victory-formats --lib -- xma::tests::pcm_rounds_ties_away_from_zero_and_saturates --exact --test-threads=1 --quiet→ 1 passed, 0 failed, 51 filtered, exit 0.git grep -Ffor the test name on the base returned no match (test is new on this PR);git diff --check 63bcca4 HEADclean (1 file, +26/-1).CARGO_TARGET_DIR(never shared) withCARGO_BUILD_JOBS=2.AI-assisted (Hy4 flash).
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.