Formats: look up short XMA codes by their first eight bits #3671
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3671"
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:13:14Z.
XMA's variable-length codebooks now look up short codes from the first eight bits. Longer codes still use the existing sorted-table lookup. The seven prefix tables occupy 3.5 KiB total.
The existing table tests checked every code and its boundaries. I also decoded 288 generated stereo frames at all four sample rates and three transform modes, with varied quantization and scale factors. All 301,056 PCM samples, including the flush output, matched bit for bit. Across 17 alternating runs per case, median complete decode speed was 1.09–1.19x on the local Windows CPU.
The full formats library suite reported 46 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:16:46Z.
Windows CI passed at
deae705, including Clippy on both build configurations and the repository test job. The generated PCM comparison and the decoder timings in the description apply to this head.The current change is confined to XMA codebook lookup. 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 andrewpozdnakov7-jpg on 2026-11-28T05:20:28Z.
I combined #3672 with the tested #3671/#3666 stack in bb19576. The overlap was in test placement, so both regression tests are present. The branch keeps both exact PR heads.
All 301,056 generated PCM samples matched the earlier stack and the combined formats suite passed 51 tests, with five ignored. Strict formats Clippy and the asset policy passed. In 17 paired runs per case, the incremental decode medians from grouped bit reads were 1.00–1.05x after short-code lookup was already in place. Several timing ranges overlapped. The 1.05–1.12x result in #3672 uses main as its baseline.
The maintainer can use the branch to review the 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 Headache3318 on 2026-11-28T09:36:09Z.
Verified head
deae70520beaaf2541a4a54e355a4722e2e2b5b0(single commit on63bcca43) on Linux — native build, no cross needed.Environment: Arch Linux, kernel 7.3.5-arch1-1, rustc 1.98.1, AMD Ryzen 7 9850X3D (8 cores),
--lockedthroughout.Suite:
cargo test -p victory-formats --locked→ 46 passed / 0 failed / 5 ignored (3.49 s) at head, and identical 46/0/5 (3.47 s) at base63bcca43. Matches your report exactly.Equivalence, mechanically: I injected the identical scratch bench (uncommitted, reverted, worktrees removed) into both trees: 200,000 reps of a sweep over every code in all seven prefix tables, decoded through
read_code, with the(symbol, consumed bits, len)results folded into a checksum. All 9 alternating release-mode rounds produced the identical accumulatoracc=261928000000on head and base — every code across the whole code space selects the same symbol and consumes the same bits as thepartition_pointpath. That's the full-table-space version of your 301,056-sample PCM claim.The fast path is load-bearing under the existing tests: a one-token mutation inside
read()only —usize::from(prefix - 1)→usize::from(prefix)— turns exactly 4 tests red:xma::tables::tests::every_entry_decodes_at_its_code_and_across_its_block, plusxma::tests::noise_frames_decode_to_a_frame_of_samples,noise_frames_with_bit_counts_past_the_dataandnoise_packets_walk_and_decode(42 passed / 4 failed).git checkout --restores 46/0/5. So the prefix table is exercised end-to-end by the noise-frame decode tests, not just the tables boundary test.Lint:
cargo clippy -p victory-formats --locked --all-targets -- -D warningsclean at head.Your speed claim reproduces on Linux: 9 alternating rounds of the in-process sweep, head median 1.3283 s vs base median 1.5825 s = 1.19× — the top of your 1.09–1.19× window, as expected since this slice times
Vlc::readalone, with no IMDCT/unpacketizing to dilute it. Head rounds were tight (1.3258–1.3687 s, ≤1% spread outside one 1.37 outlier); base rounds 1.5807–1.6719 s.Host-dependent failures, identical on base (not regressions): of the 5 ignored tests, the two throughput benches pass (
bcpack::tests::bcpack_throughput,xma::tests::imdct_throughput), while three fail at identical line:col on head and base because they need external corpus env vars that aren't set on this host:bcpack::tests::reference_chunks(bcpack.rs:1592, wantsVICTORY_BCPACK_TABLES),xma::tests::walks_saved_streams(xma.rs:1758) andxma::tests::matches_a_reference_decoder(xma.rs:1803) — the latter two panic onenv::var(...).unwrap()→NotPresent.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.