Repository navigation
Export verified AWC music regions as optional cue sheets - #6780
kacper-serewis wants to merge 3 commits into
Conversation
…cord by record (ASSET-320) docs/rsc8_audio.md read the near-equal start/end counts on five cue names (196/197, 101/101, 54/54, 49/49, 20/19) as region pairs and labelled it a hypothesis, because the split was counted and not matched. pair_marker_regions() matches them: inside one 0xbd tag, a pair is a start whose next record of the same name is an end at the same or a later offset; every other record of such a name is an exception. Every scan summary gets a marker_regions block (per name hash: starts, ends, pairs, exceptions by kind, pair lengths; pairs per tag; overlaps between names; where each exception sits in its tag). Counts, sample offsets and 32-bit hashes only. Measured over all of audio.rpf (7,162 banks, 420,168 0xbd tags, 781,350 records): 841 region records in 22 tags, 420 start, 420 end, one third value; 418 pairs, 20 of 22 tags pair completely, 5 exceptions in two tags, none at an edge of its tag. The other three archives with ADAT banks have none. Tests build their records and banks by hand. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…-music-region-sheet
|
The cue-sheet path copies an entire marker tag before it checks the 16 MiB decoder limit. On Windows with CPython 3.14.7, a 33,554,448-byte tag allocated 33,555,929 additional traced bytes. The decoder then discarded the tag and returned no regions. The measurement starts after the bank is in memory. Run this script from the repository root with import runpy
import tracemalloc
t = runpy.run_path("tests/test_awc_markers.py")
import awc_opus
from rsc8_audio import MAX_MARKER_BYTES
for size in (MAX_MARKER_BYTES + 16, 2 * MAX_MARKER_BYTES + 16):
bank = t["music_bank"](7, 200, 0xfc, bytes(size))
tracemalloc.start()
rows = awc_opus.music_cue_regions(bank, {7: 100})
peak = tracemalloc.get_traced_memory()[1]
tracemalloc.stop()
print(size, peak, rows)At I also ran AI-assisted. |
shayderrr
left a comment
There was a problem hiding this comment.
Summary
tools/rsc8_audio.py adds pair_marker_regions() — matching consecutive same-name start/end marker records within one tag in stored order — plus a marker_regions block in scan summaries and docs tabulating 418 matched pairs in 22 tags. tools/awc_opus.py gains --cue-sheet, writing cue_regions.json beside Ogg files with the sibling audio file, hexadecimal cue-name hash, and [start_sample, end_sample) at 48 kHz, only for banks with a unique stream/descriptor, exported packets, and in-range endpoints. Tests cover pairing and export.
Why merge
Turns previously counted-but-unverified markers into validated, usable region metadata for streamed music without changing default exports.
Verdict: Approve
Summary
Why mergeTurns previously counted-but-unverified markers into validated, usable region metadata for streamed music without changing default exports. Verdict: Approve |
|
Tested cb1212b on Windows 11, Python 3.15.2, NVIDIA RTX 4060 Ti (driver 621.24; CPU-only checks, no game files, no GPU/llvm-mc/MSVC used): pass. Ran the test files this PR adds or changes, from a clean checkout of the PR head: AI-assisted (Claude Code). |
Item AWC-MUSIC-REGION-SHEET (claim).
Depends on: #5518
python -I tools/awc_opus.py <bank-or-directory> <output> --cue-sheetwrites a bank-local JSON sidecar with sibling Ogg filenames, cue-name hashes and exact half-open frame intervals at 48 kHz. Attribution requires a unique matching stream entry and descriptor channel, packets, and endpoints within both the declared and written playback length. Overlaps are preserved. #6007 counts endpoint contacts independently. The change on top of #5518 is cb1212b.Private whole-archive validation scanned 7,162 banks including 3,008 streamed-music banks. All 418 measured pairs mapped within the available packet frames and descriptor bounds, to 22 channels in 22 banks. This check read packets without decoding or writing retail audio. Public tests use synthetic data.
AI-assisted. Windows, CPU only. Passed the marker (9), Opus export (56), and RSC8 audio (48) tests, compileall and git diff --check. The marker CLI test covers optional output, overlapping regions, duplicate descriptor and stream IDs, missing packets, out-of-range endpoints, and refresh after a mapping disappears. The repository-wide newline test flags an existing write in tools/f64_omod_probe.py:268, identical on main.