mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 23:25:53 +01:00
[PR #1072] tools/awc_opus: honor hdr24 block_samples budget, interleaved skip, and deficit continuation #1108
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#1108
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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 Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/1072
Author: @Elijah-J
Created: 11/24/2026
Status: 🔄 Open
Base:
main← Head:fix/awc-hdr24-chunk-budget-skip📝 Commits (3)
c6ba76dtools/awc_opus: honor hdr24 block_samples budget, interleaved skip, and deficit continuationd05a683tools/awc_opus: bound streamed metadata packet retentionc640232tools/awc_opus: honor empty chunk budgets in streamed music📊 Changes
3 files changed (+231 additions, -31 deletions)
View changed files
📝
docs/audio.md(+16 -5)📝
tests/test_awc_opus.py(+111 -0)📝
tools/awc_opus.py(+104 -26)📄 Description
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)🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.