tools/awc_opus: honor hdr24 block_samples budget, interleaved skip, and deficit continuation #1072
No reviewers
No assignees
Labels
No labels
bug
dependencies
documentation
enhancement
missing claim
needs rebase
needs-triage
question
ready-for-agent
submodules
No project
No milestone
Dependencies
No dependencies set
Notifications
1 participant
Due date
No due date set.
Reference
leonida/mandy!1072
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/awc-hdr24-chunk-budget-skip"
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?
Pull request successfully merged and closed
Claimed in the coordination issue as: AWC-HDR24-BUDGET (posted after the draft was opened)
What and why
Streamed music (
0x48) chunks carry a 24-byte per-channel header with(subblocks, skip_samples, block_samples)at+4..+16. The sampled stereo banks use interleaved counts (2× per-channel 48 kHz frames), while the exporter also accepts a per-channel skip that verifies an exact packet overlap.Previously
music_channels()only checkedskipas a per-channel frame count and ignoredblock_samples(+12), which rejected multi-stem/multi-block streamed music banks that:block_samples / packet_channels,skip_samplesin interleaved stereo units (2 * frames), orblock_samplesbudget so the deficit carries into the next chunk'sskip_samples.Changes:
tools/awc_opus.py: read(count, skip, block_samples)fromhdr24+4..+16; trim trailing subblock padding packets pastblock_samples // pch; match interleaved (skip // pch) and per-channel (skip) repeated prefixes; handle exact-boundary deficit continuation when a preceding block stopped short of itsblock_samplesbudget while continuing to fail closed on partial/corrupt skips or oddblock_samples.docs/audio.md: document+8(skip_samples),+12(block_samples), and the conditions for carry-over recovery under### Streamed music (0x48).tests/test_awc_opus.py: add synthetic unit tests covering block-budget padding trimming, interleaved stereo skip deduplication, short-block deficit continuation, and partial-boundary fail-closed rejection.Tested
Synthetic unit tests on macOS:
python3 -I tests/test_awc_opus.py -v— 64/64 OKpython3 -I tests/test_awc_manifest.py -v— 23/23 OKpython3 -I tests/test_text_write_line_endings.py -v— 3/3 OKpython3 -m compileall -q make_game.py tools tests— exit 0A separate read-only Xbox Series 1.0.2.1 check recovered four banks (11 stems) rejected by the previous overlap-only extractor. FFmpeg decoded every stem to its descriptor length after Ogg end trimming. Three carry-over transitions exercised a zero net skip. Positive net skip was tested synthetically.
GPUs tested: n/a
AI-assisted: yes
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (n/a — audio tool/docs only)I addressed the three review notes in
c640232: empty budgeted chunks now update skip state, metadata-only scans avoid copying packet payloads, and budget trimming stops once the target is reached. All 93 focused tests passed, and FFmpeg again matched the declared lengths of all 11 sampled stems. The current CI and No Game Data runs are waiting for maintainer approval. CI · No Game DataRed/green: tests/test_awc_opus.py 6 failed on main, 67 passed with the PR.
Targeted batch of 30 PRs (their tests, the tests importing the changed modules, the docs tests, the translator suite) on main a997a3c: no new failure, Windows 11 / Python.
AI-assisted (Claude Code, Claude Opus 5.5)