Formats: share XMA scale-factor band tables by sample rate #3666
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3666"
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-28T04:40:38Z.
XMA decoders now share four immutable scale-factor band layouts, one for each normalized sample rate. The original band calculation runs once per rate on demand. Decoder creation, cloning and per-stream state use a reference to that layout.
I compared every band-table entry against the old layout for 12 rates, including the boundaries, and checked the same tables from eight concurrently opening decoders. All 301,056 PCM samples from generated stereo frames matched, across all four rates and three transform modes.
On 64-bit Windows the decoder dropped from 14,304 to 11,480 bytes. Across 17 paired runs of 5,000 constructor calls, the warm-cache median was 0.300 µs, down from 1.738 µs. The formats suite reported 47 passed and five ignored. Strict formats Clippy and the asset policy passed.
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 andrewpozdnakov7-jpg on 2026-11-28T04:43:40Z.
Windows CI passed at
7a37479. The formats tests, Clippy and policy results in the description apply to the same head.I found a related layout cache in #3383. That branch builds all four tables at the first decoder. This PR is the standalone per-rate option and initializes each table when a decoder first needs that rate. In 21 paired fresh-process 48 kHz probes on the same machine, the first constructor's median was 61.4 µs for #3383 and 31.2 µs here. Both designs share the tables after initialization. The next step is a maintainer decision on which version to land.
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 andrewpozdnakov7-jpg on 2026-11-28T05:15:16Z.
I combined #3671 with the tested #3666/#3383 stack in 646e7ab. The branch keeps both exact PR heads. The merge applied cleanly.
The combined decoder matched all 301,056 PCM samples from the previous combined branch, across four sample rates and three transform modes with varied quantization and scale factors. Over 17 alternating runs per case on the local Windows CPU, complete decode medians were 1.14–1.17x the previous stack. The formats suite passed 50 tests, with five ignored. Strict formats Clippy and the asset policy passed.
The maintainer can use the combined branch to review the two changes together.
Please retain the Git authors 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:18Z.
Independent local verification (Windows, Rust 1.100.0/MSVC, no game data):
7a374796597fb5cd4d7afb813a2c4a37b522c958, base/parent63bcca43c6a00a758510398fa43096ce7e4f7df0.cargo test --locked -p victory-formats --lib -- xma::tests::decoders_share_the_layout_for_their_normalized_sample_rate --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, +74/-32).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.