Formats: read complete XMA bit windows in one step #3672
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3672"
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-28T05:18:28Z.
XMA's frame bit reader takes a complete five-byte window directly when available. Near the end of a frame it uses the existing zero-padded read. A bit-by-bit test checks all 65 offsets of a generated buffer, including windows that cross the last byte and the offset at the end.
Across 288 generated stereo frames at four sample rates and three transform modes, all 301,056 PCM samples matched, including the flush output. In 17 alternating runs per case on the local Windows CPU, the complete decode medians were 1.05–1.12x the baseline.
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 this change into another commit.AI-assisted with OpenAI Codex.
Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-28T05:21:13Z.
Windows CI passed at
f88e0e4, including Clippy on both build configurations and the repository test job. The 65 bit-offset checks and the generated PCM comparison in the description apply to this head.I also combined this with the short-code lookup. In that stack the extra speedup was smaller, with complete decode medians of 1.00–1.05x. Several timing ranges overlapped. The next step is maintainer review.
Please retain the Git author on cherry-pick or rebase, or add
Co-authored-by: andrewpozdnakov7-jpg <[email protected]>if folding this change into another commit.AI-assisted with OpenAI Codex.
Imported from Marvisak/VIctory. Originally posted by Headache3318 on 2026-11-28T05:29:28Z.
Independent Linux verification of this head (correctness only — the speed numbers below are the author's, not reproduced).
Tree: head
f88e0e4dc5caf62d05f9baa503b8bdf87d28d487, base63bcca43c6a00a758510398fa43096ce7e4f7df0, single commit, onlycrates/victory-formats/src/xma.rs.Environment: Arch Linux x86_64, rustc 1.98.1 (48a229cea 2026-09-01),
cargo test --locked -p victory-formats(native Linux, no wine, no GPU).Results
ok. 47 passed; 0 failed; 5 ignored—xma::tests::frame_bit_window_matches_bit_by_bit_reading ... ok63bcca4:ok. 46 passed; 0 failed; 5 ignored— the delta is exactly the one new equivalence test, and nothing on base fails on this host, so nothing is hidden behind it.Is the new test load-bearing for the fast path? I checked rather than assumed. Mutated only the fast-path return to a wrong shift (
v << (24 + pos % 8)→v << (25 + pos % 8)), fallback untouched: the test panics withbit offset 0. Restoring the one token makes it green again. So the equivalence test genuinely exercises the five-byte window (offsets that take it) and would catch a wrong fast path, while offsets near the buffer end go through the padded fallback it also covers.Perf claim: on this host the suite's total time is 0.30 s both at head and base (three alternating release runs each), too coarse to confirm the 1.05–1.12× decode medians; treating those as your Windows measurements, not reproduced here. The correctness evidence does not depend on them.
Nothing blocking from the Linux side. AI-assisted (Hermes Agent).
Imported from Marvisak/VIctory. Originally posted by cloph-dsp on 2026-11-28T10:43:08Z.
Independent local verification (Windows, Rust 1.100.0/MSVC, no game data):
f88e0e4dc5caf62d05f9baa503b8bdf87d28d487, base/parent63bcca43c6a00a758510398fa43096ce7e4f7df0.cargo test --locked -p victory-formats --lib -- xma::tests::frame_bit_window_matches_bit_by_bit_reading --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, +21/-1).CARGO_TARGET_DIR(never shared) withCARGO_BUILD_JOBS=2.AI-assisted (Hy4 flash).
Imported from Marvisak/VIctory. Originally posted by Headache3318 on 2026-11-28T11:04:30Z.
@cloph-dsp thanks — Windows and Linux now agree at
f88e0e4: your one-test replay + our Linux run (full crate: 47/0/5 at head, 46/0/5 at base, delta exactly the new equivalence test) leave no divergence. Also on the Linux side we proved the test load-bearing: corrupting only the fast-path shift (v << (24 + pos % 8)→v << (25 + …)) makes it panic atbit offset 0, and restoring the token turns it green. Two hosts, two platforms, one verdict: LGTM. (AI-assisted, Hermes Agent)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.