feat(opus): implement 48 kHz libSceOpusDec #1823

Merged
Mouhand-Kaddo merged 1 commit from upstream-pr/1823 into main 2026-10-09 21:12:03 +00:00
Mouhand-Kaddo commented 2026-10-08 20:35:17 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Mouhand-Kaddo on 2026-10-08T20:35:17Z.


What

Add the six libSceOpusDec exports required by ProsperoRadio in #1578. Reuse FFmpeg for persistent 48 kHz mono/stereo decoders with interleaved signed-16 PCM. Decode returns bytes and checks byte capacity before consuming a packet.

The ABI and 640-byte opaque state size follow public PS5 decoder research. Other sample rates, packet loss concealment and unsupported lifecycle/error paths throw. Firmware error codes and exact PCM equivalence remain unverified and are recorded in TechnicalDebt.

Tested

Linux x86-64. guest_opus_dec passes real consecutive packets, byte counts, amplitude, mono output, decoder persistence, independent contexts, capacity canaries and lifecycle checks. Standalone ASan/UBSan passes. Existing AJM, JPEG and PNG decoder tests also pass.

A local consumer compiled for FreeBSD against ps5-payload-sdk v0.43 headers passes through the patched NID exports. It checks 32-bit contexts, PCM byte counts and output guards. SDK tooling is outside the repository. No PS5 or Windows execution was performed.

The released ProsperoRadio 01.000.010 binary previously stopped at missing libSceOpusDec.prx. With this module it reaches the next missing library, libSceOpusCeltDec.prx. All six OpusDec imports resolve. This does not make the title run.

Independent code review passes both standards and spec, with no actionable findings.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except permitted namespace endings
  • Unsupported paths throw and known gaps are listed in TechnicalDebt
  • No investigation notes, images or SDK tooling added to the repository
  • Reuses existing bundled dependencies
  • Behaviour applies to any caller of the supported API subset
  • Depends on: none
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4792483106 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1823). Originally posted by [Mouhand-Kaddo](https://github.com/Mouhand-Kaddo) on 2026-10-08T20:35:17Z. --- ### What Add the six `libSceOpusDec` exports required by ProsperoRadio in #1578. Reuse FFmpeg for persistent 48 kHz mono/stereo decoders with interleaved signed-16 PCM. Decode returns bytes and checks byte capacity before consuming a packet. The ABI and 640-byte opaque state size follow [public PS5 decoder research](https://github.com/blackbearreloaded/ps5-hardware-audio-decoding/blob/26be5a12f92b2cdc67f8a9e082fd69ae0e9a35a2/docs/DECODING.md#direct-opus-abi). Other sample rates, packet loss concealment and unsupported lifecycle/error paths throw. Firmware error codes and exact PCM equivalence remain unverified and are recorded in TechnicalDebt. ### Tested Linux x86-64. `guest_opus_dec` passes real consecutive packets, byte counts, amplitude, mono output, decoder persistence, independent contexts, capacity canaries and lifecycle checks. Standalone ASan/UBSan passes. Existing AJM, JPEG and PNG decoder tests also pass. A local consumer compiled for FreeBSD against ps5-payload-sdk v0.43 headers passes through the patched NID exports. It checks 32-bit contexts, PCM byte counts and output guards. SDK tooling is outside the repository. No PS5 or Windows execution was performed. The released ProsperoRadio 01.000.010 binary previously stopped at missing `libSceOpusDec.prx`. With this module it reaches the next missing library, `libSceOpusCeltDec.prx`. All six OpusDec imports resolve. This does not make the title run. Independent code review passes both standards and spec, with no actionable findings. ### Checklist - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except permitted namespace endings - [x] Unsupported paths throw and known gaps are listed in TechnicalDebt - [x] No investigation notes, images or SDK tooling added to the repository - [x] Reuses existing bundled dependencies - [x] Behaviour applies to any caller of the supported API subset - [x] Depends on: none - [x] AI-assisted: yes
github-actions[bot] commented 2026-10-08 20:42:43 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-08T20:42:43Z.


Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
#1924 docs/dev/TechnicalDebt.md L244
#2072 docs/dev/TechnicalDebt.md L244
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6068680841 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1823#issuecomment-6068680841). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-08T20:42:43Z. --- <!-- pr-overlap --> Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in **Depends on**. | Pull request | Conflicting files (lines on `main`) | Same exports | Same new files | |---|---|---|---| | #1924 | `docs/dev/TechnicalDebt.md` [L244](https://github.com/boykopovar/AnyPS5/blob/d70b89989473ba1f6ae13e44e079e67f1f8a44b0/docs/dev/TechnicalDebt.md#L244) | | | | #2072 | `docs/dev/TechnicalDebt.md` [L244](https://github.com/boykopovar/AnyPS5/blob/d70b89989473ba1f6ae13e44e079e67f1f8a44b0/docs/dev/TechnicalDebt.md#L244) | | |
popcoder565 commented 2026-10-09 15:44:58 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by popcoder565 on 2026-10-09T15:44:58Z.


Native Windows run, since no Windows results were posted. Setup: Windows 10 (19045), MinGW-w64 GCC 15.2.0 (WinLibs r7), Release. Head bb3ac21c, merged onto main d70b8998 in one build with 38 other PRs that had no Windows run. The current head 4c7e8232 is a rebase with the same Opus files.

  • This PR's test passes: guest_opus_dec. It didn't report skipping a case.
  • Full ctest in that build: 519 of 519. That needed local fixes to three other PRs in the batch that don't build or pass on Windows: #1611, #1796 and #1824 (reported there).

No title was run.

🤖 Addressed by Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6084248210 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1823#issuecomment-6084248210). Originally posted by [popcoder565](https://github.com/popcoder565) on 2026-10-09T15:44:58Z. --- Native Windows run, since no Windows results were posted. Setup: Windows 10 (19045), MinGW-w64 GCC 15.2.0 (WinLibs r7), Release. Head `bb3ac21c`, merged onto `main` d70b8998 in one build with 38 other PRs that had no Windows run. The current head `4c7e8232` is a rebase with the same Opus files. - This PR's test passes: `guest_opus_dec`. It didn't report skipping a case. - Full ctest in that build: 519 of 519. That needed local fixes to three other PRs in the batch that don't build or pass on Windows: #1611, #1796 and #1824 (reported there). No title was run. _🤖 Addressed by [Claude Code](https://claude.com/claude-code)_
adriadam10 commented 2026-10-09 21:12:00 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-09T21:12:00Z.


Checked against the cited DECODING.md (signatures, 640-byte state, byte capacity rounded down to even): matches. Local build + ctest on top of main: guest_opus_dec passes (518/518). Decoded the test packets with libopus independently: 960 samples each, peaks 938/1041/1035/1035, consistent with the test bounds. Unverified parameters throw and are recorded in TechnicalDebt. Windows result from @popcoder565 noted. Merging once CI is green.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6089338344 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1823#issuecomment-6089338344). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-09T21:12:00Z. --- Checked against the cited DECODING.md (signatures, 640-byte state, byte capacity rounded down to even): matches. Local build + ctest on top of main: `guest_opus_dec` passes (518/518). Decoded the test packets with libopus independently: 960 samples each, peaks 938/1041/1035/1035, consistent with the test bounds. Unverified parameters throw and are recorded in TechnicalDebt. Windows result from @popcoder565 noted. Merging once CI is green.
github-actions[bot] commented 2026-10-09 21:15:20 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-09T21:15:20Z.


Progress report (d70b899 → 4c7e823)

📈 System libraries: 84.72% (+0.03%, +6 implemented functions)

✅ 6 implemented
Library Name
libSceOpusDec sceOpusDecCreateEx
libSceOpusDec sceOpusDecDecode
libSceOpusDec sceOpusDecDestroy
libSceOpusDec sceOpusDecGetSize
libSceOpusDec sceOpusDecInitialize
libSceOpusDec sceOpusDecTerminate
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6089383730 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1823#issuecomment-6089383730). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-09T21:15:20Z. --- <!-- progress-report --> ### Progress report (d70b899 → 4c7e823) 📈 **System libraries**: 84.72% (+0.03%, +6 implemented functions) <details> <summary>✅ 6 implemented</summary> | Library | Name | | - | - | | libSceOpusDec | `sceOpusDecCreateEx` | | libSceOpusDec | `sceOpusDecDecode` | | libSceOpusDec | `sceOpusDecDestroy` | | libSceOpusDec | `sceOpusDecGetSize` | | libSceOpusDec | `sceOpusDecInitialize` | | libSceOpusDec | `sceOpusDecTerminate` | </details>
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!1823
No description provided.