formats: accelerate XMA variable-length code lookup #294

Closed
github-bot wants to merge 1 commit from github-bot/gh-294 into main AGit
Owner

@⁠lgtlgt0015-code on GitHub · 2026-12-03 06:10 UTC · original
lgtlgt0015-code:codex/xma-prefix-code-lookup → main · +215 −4 · 1 files · 1 commits · closed without merging

What changed

The XMA decoder currently performs a five-byte lookahead and binary-searches a full codebook for every variable-length symbol. Use a nine-bit prefix table to resolve unambiguous symbols after reading at most two bytes. Ambiguous prefixes use the existing 32-bit lookahead and search only the matching subrange. The codebook and decoder interfaces are unchanged.

Validation

  • Windows x64, Rust 1.98.1, victory-formats test binary: 54 passed, 8 ignored.
  • Compared symbol and bit consumption with the original lookup at every codebook and prefix boundary, at all eight bit alignments. The second regression checks zero padding at the end of the buffer.
  • Decoded the same 64 generated stereo frames on the base and branch. All 65,536 PCM samples matched byte for byte.

Ryzen 7 5700X on Windows. Optimized rustc --test -C opt-level=3 builds in base/branch/branch/base order. Each reported run uses the median of seven measurements of 5,120 frames. The table reports the median of the two runs per version.

48 kHz stereo XMA input Base Branch Throughput
Dense coefficients (128 vector groups/channel) 33,754 frames/s 39,888 frames/s +18.2%
Sparse coefficients (8 vector groups/channel) 43,454 frames/s 45,235 frames/s +4.1%
cargo test -p victory-formats --release --locked xma_synthetic_decode_throughput -- --ignored --nocapture --test-threads=1

The measurements cover Decoder::decode with generated audio frames. In-game performance on Wine and Linux remains unmeasured.

AI-assisted with Codex.

**@⁠lgtlgt0015-code** on GitHub · 2026-12-03 06:10 UTC · [original](https://github.com/lobomfz/VIctory-xmem/pull/294) `lgtlgt0015-code:codex/xma-prefix-code-lookup` → `main` · +215 −4 · 1 files · 1 commits · closed without merging ## What changed The XMA decoder currently performs a five-byte lookahead and binary-searches a full codebook for every variable-length symbol. Use a nine-bit prefix table to resolve unambiguous symbols after reading at most two bytes. Ambiguous prefixes use the existing 32-bit lookahead and search only the matching subrange. The codebook and decoder interfaces are unchanged. ## Validation - Windows x64, Rust 1.98.1, `victory-formats` test binary: 54 passed, 8 ignored. - Compared symbol and bit consumption with the original lookup at every codebook and prefix boundary, at all eight bit alignments. The second regression checks zero padding at the end of the buffer. - Decoded the same 64 generated stereo frames on the base and branch. All 65,536 PCM samples matched byte for byte. Ryzen 7 5700X on Windows. Optimized `rustc --test -C opt-level=3` builds in base/branch/branch/base order. Each reported run uses the median of seven measurements of 5,120 frames. The table reports the median of the two runs per version. | 48 kHz stereo XMA input | Base | Branch | Throughput | | --- | ---: | ---: | ---: | | Dense coefficients (128 vector groups/channel) | 33,754 frames/s | 39,888 frames/s | +18.2% | | Sparse coefficients (8 vector groups/channel) | 43,454 frames/s | 45,235 frames/s | +4.1% | ```sh cargo test -p victory-formats --release --locked xma_synthetic_decode_throughput -- --ignored --nocapture --test-threads=1 ``` The measurements cover `Decoder::decode` with generated audio frames. In-game performance on Wine and Linux remains unmeasured. AI-assisted with Codex.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-03 06:11:13 +00:00
github-bot closed this pull request 2026-12-03 06:27:24 +00:00
Author
Owner

@⁠goldfishdev on GitHub · 2026-12-03 06:26 UTC · original

Test on Linux and come back.

**@⁠goldfishdev** on GitHub · 2026-12-03 06:26 UTC · [original](https://github.com/lobomfz/VIctory-xmem/pull/294#issuecomment-7369840234) Test on Linux and come back.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.