Opus: 6.1 Vorbis mapping is 5 streams / 2 coupled, not 4 / 3 #501
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/506"
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 ivall/xcl. Originally posted by DavidM1911 on 2026-11-24T01:04:43Z.
Part of #327 (item 2).
vorbis_mapping(7)returned(4, 3, [0,4,1,2,3,5,6])— 4 streams with 3 coupled pairs. The RFC 7845 Vorbis order for 6.1 is 5 streams, 2 coupled (two coupled pairs + center/LFE/surround uncoupled), matching libopus;build_opus_headtherefore emitted anOpusHeadmultistream header that decoders would split into the wrong stream count for 6.1 audio.What is in it
crates/xcl/src/hle/opus.rs:vorbis_mapping(7)→(5, 2, &[0,4,1,2,3,5,6]); the existingopus_head_roundtriptest now also asserts the 7- and 8-channel stream/coupled counts.Tested
x86_64-pc-windows-msvc:cargo test -p xcl --lib opus_head_roundtrip: 1 passedcargo test --workspace -- --test-threads=4: 676 passed, 0 failed, 41 ignoredscripts/smoke.ps1 -Seconds 60,cargo build --release -p xcl:main
a6f5f7a(same baseline as the sibling PRs; upstream/main is now2997c9a, docs-only on top):this PR's head
c8a3852:Frames are lower than the usual ~1500 on this title (86% of main, above the 80% bar); presents held 60 FPS in the last windows and there were no removals or crashes.
Not tested
AI use
Imported from ivall/xcl. Originally posted by shdann on 2026-11-24T01:12:21Z.
Review: COMMENTED
The new 6.1 entry differs from the reference libopus encoder. Its seven-channel mapping-family-1 table uses four streams, three coupled streams, and the same channel map already used on main. A header that declares five streams describes a different packet layout and can break decoding of reference 6.1 packets. Please keep the original counts and check with a seven-channel packet from the reference encoder. https://github.com/xiph/opus/blob/main/src/opus_multistream_encoder.c . Static review with OpenAI Codex (GPT-6.2 Sol).
Imported from ivall/xcl. Originally posted by lordon1a on 2026-11-24T04:07:14Z.
The 6.1 entry on
mainalready matches libopus:vorbis_mappings[8]in xiph/opussrc/opus_multistream_encoder.chas{4, 3, {0, 4, 1, 2, 3, 5, 6}}, /* 7: 6.1 surround */. With (5, 2), a 7-channel multistream packet from a libopus encoder (4 streams) would be split as 5 and rejected or misdecoded on the default-header path (Decoder::newwithout anOpusHead). Details and the source lines are in https://github.com/ivall/xcl/issues/327#issuecomment-7121722096. I'd suggest not merging this as it stands.Written with Claude Code (Claude Opus 5.5).
Imported from ivall/xcl. Originally posted by MesshM on 2026-11-24T04:08:03Z.
Test run and review of
c8a3852f877e1eb0bd3a2e63cbcfda43c5ca96f7on AMD RDNA4. I merged it onto currentmainf4ce27clocally (clean merge) and tested that tree.Tested
stable-x86_64-pc-windows-msvc, debugcargo build --workspace+cargo test --workspace -- --test-threads=4on the merge: 701 passed, 0 failed, 41 ignored, exit code 0;opus_head_roundtrip_mono_stereo_surroundpasses (with the new values).Review: I think the current value is the right one, and this changes it to a wrong one. The description says 5 streams / 2 coupled for 6.1 "matching libopus". libopus's own table (
src/opus_multistream_encoder.c,vorbis_mappings[8], currentxiph/opusmaster) has for 7 channels{4, 3, {0, 4, 1, 2, 3, 5, 6}}(commented "6.1 surround"): 4 streams, 3 coupled, the mappingmainalready has. With that layout the third coupled stream carries channels 4–5 (centre and rear centre) and LFE is the one uncoupled stream; with 5/2 and the same mapping array the decoder would read centre, rear centre and LFE as three uncoupled streams.RFC 7845 lets the encoder choose the counts for family 1, so what matters is what the title's packets were encoded with: the
OpusHeadXCL builds has to declare the stream / coupled counts of the actual packets, or the multistream decoder splits each packet wrongly. If a 6.1 sample from a title showed 5 / 2 packets, that would be a reason to change it, but then the change would be "follow the source", not "match libopus", and libopus-encoded 6.1 would break. Without such a sample I would leavevorbis_mapping(7)as it is.Not tested: no 6.1 Opus stream from a title (I have no game data), so I could not decode either variant; release build.
Run and review by Claude Code (Claude Opus 5.5) on this machine; the libopus table was read from its repository.
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-24T08:54:58Z.
Closing — the reviewers are right and the issue's premise was wrong. libopus
vorbis_mappings[8]insrc/opus_multistream_encoder.cuses{4, 3, {0,4,1,2,3,5,6}}for 7 channels (6.1), which is whatmainalready has. My (5,2) entry would have described a different packet layout and broken decoding of reference 6.1 streams. Thanks @shdann and @lordon1a for checking against the source. The remaining #327 items (framing ambiguity, MFT guards) stand on their own in #926.upstream-sync referenced this pull request2026-11-24 11:05:44 +00:00
upstream-sync referenced this pull request2026-11-24 21:07:02 +00:00
upstream-sync referenced this pull request2026-11-25 12:04:57 +00:00
Pull request closed