Audio: opus-pure 0.2.4 decodes some SILK frames differently from libopus (upstream fix stephenberry/opus-pure#13) #2762
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory#2762
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?
@Concombre37 on GitHub · 2026-11-25 19:56 UTC · original
VIctory decodes the title's Opus packets for
xapu.dllwithopus-pure0.2.4 (crates/victory-hle/src/modules/apu.rs). The README says these results are "unverified against the title". I comparedopus-purewith libopus on synthetic streams and found one defect upstream.What is wrong. In
silk_lpc_inverse_pred_gain,opus-pureuses a stability limit of 16773043. libopus usesSILK_FIX_CONST(0.99975, 24), which is 16773022. When an LPC filter's coefficients fall between the two limits,opus-pureskips the bandwidth expansion that libopus applies. From that frame on, the SILK decode drifts from libopus. In the repro, the error reaches 520 LSB and lasts several frames.Scope. Only SILK and hybrid packets are affected, so low-bitrate speech-type streams. CELT packets agree with libopus to about 85 dB before and after the fix (float paths). I have not checked which modes the title's
xapustreams use, so the effect in game is unknown.What to do here. When a fixed
opus-pureis released, updateopus-purein the workspaceCargo.toml. No VIctory code changes are needed.Synthetic data only, no game data. AI-assisted (Claude Code).
@rezioliver-collab on GitHub · 2026-11-25 21:46 UTC · original
I reproduced the
opus-pure0.2.4 discrepancy on an Apple M1 against libopus 1.6.1. With the upstream fix (b21b020), everyf32sample written by VIctory’sapu::processmatched the reference bit for bit across the two packets: 640/640 at 16 kHz and 1,920/1,920 at 48 kHz. VIctory opens the decoder at 48 kHz. The 16 kHz run used the same function as a control.I decoded synthetic mono packets 33 and 34 in sequence with one decoder instance per run. Packet 33 matched on 0.2.4. The table shows packet 34 only, with zero-based indices from the start of that packet. The first mismatch and mismatch count were the same for
s16andf32.s16error (LSB)f32errorPacket 34 on its own with a fresh decoder matched even on 0.2.4 at both rates. Applying only the SILK fix to 0.2.4 gave the same output as the upstream PR head. I compared the float bytes written by
apu::processdirectly withopus_decode_float, and the integer samples separately withopus_decode. The results held with both the default libopus build and-ffp-contract=off. Synthetic packet pair · Upstream fix@Ingenioeren on GitHub · 2026-11-25 21:49 UTC · original
The published
opus-pure0.2.5 still has this discrepancy. It was published on November 23 and still hasA_LIMIT = 16773043. I tested the official crate from crates.io, checked its checksum, and used a temporary path override in a VIctory61bfc77checkout. Registry release · Upstream SILK fixOn Windows, VIctory's
apu::processproduced the same 1,920 float samples with both 0.2.4 and 0.2.5, processing the two synthetic mono packets through one 48 kHz decoder. Applying the upstream correction to 0.2.5 left the first packet unchanged and changed 922 of 960 samples in the second, starting at sample 34, with a peak absolute difference of 0.00866699. That matches the discrepancy reported above against libopus 1.6.1. Changing the limit alone produced the same output as the full patch for this two-packet case.So the dependency update for this issue needs a release containing the upstream fix. This comparison used the published and locally corrected Rust decoder on Windows.
AI-assisted. Synthetic packets from the upstream repro only.
@Marvisak on GitHub · 2026-11-26 00:44 UTC · original
Automated triage for the maintainers.
Accurate as to our side: the workspace
Cargo.tomlpinsopus-pure = "0.2.4"(0.2.4 inCargo.lock), used bycrates/victory-hle/src/modules/apu.rs. The defect itself is upstream (stephenberry/opus-pure#12, fix in #13), and as the comment above shows, 0.2.5 does not yet contain it. Nothing needs to change here until a release with the fix exists; then it is a version bump. Kept open to track that.Generated by Claude Code