feat(opus): add the CELT decoder system library #1829

Closed
kali113 wants to merge 17 commits from upstream-pr/1829 into main
kali113 commented 2026-10-08 20:45:34 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by kali113 on 2026-10-08T20:45:34Z.


What

Add six libSceOpusCeltDec lifecycle and decode exports backed by official libopus 1.6.1, pinned as a source submodule. The implementation decodes CELT-only raw packets to 48 kHz mono/stereo signed 16-bit interleaved PCM, validates decoder ownership and byte capacity, and copies PCM only after successful decoding. Unsupported modes and invalid calls throw; no console error codes are guessed.

The fork branch kali113:feat/opus-celt-dec has been rebuilt as one decoder-only commit (e3b8ae75) on main d70b8998. It contains none of #1265, #1913, #1986 or #1999. An old branch backup remains available locally. There are no shader or unrelated test changes in that candidate. GitHub retains the old commit/diff snapshot on this closed PR; review the cleaned branch comparison or linked candidate commit rather than this closed PR's historical Files changed tab.

The public ProsperoRadio caller at 2c4029c declares this interface; published decoder research describes the context pointer, caller allocation and byte counts. These sources establish the caller contract, not bit-exact console equivalence. Console state layout, context values and error behavior remain unverified and are recorded in TechnicalDebt.

This PR remains closed pending the runtime evidence requested in the closing review. The earlier description overstated readiness. ProsperoRadio normally opens the general libSceOpusDec decoder first; its production dispatch retries CELT only after a particular general-decoder error and a CELT packet. Main currently lacks the general decoder, proposed separately in #1823. No title log demonstrates reaching the CELT calls on current main, and this patch does not establish radio playback or a significant library-coverage increase. A reopened submission needs a real title's next-stop log on main.

Duplicate recheck: reviewed file lists for all 538 current open PRs, including the complete 1,203-file list of #1128. Only #1823 touches an Opus decoder module; it implements the separate general decoder, not these CELT exports. Its commits are not included here.

Tested

Candidate e3b8ae7511a17ea3c4f4d1e47e60f94ed3e887ae:

  • macOS arm64 / AppleClang / Release standalone build using the actual library CMake target: decoder regression and public-caller harness both pass three repetitions. Longest observed run: 0.80 s.
  • The decoder regression checks nonzero mono/stereo PCM against separately generated libopus reference output, consecutive packets and recreation, independent contexts, invalid lifecycle calls, insufficient capacity, output/state canaries, malformed duration headers, SILK rejection and a 120 ms packet. The reference uses the same codec implementation; it is not a console or independent-codec oracle.
  • AddressSanitizer and UndefinedBehaviorSanitizer: both standalone tests pass.
  • The external public-caller harness explicitly selects CELT and adapts sysmodule load/unload; unused general-decoder calls abort. It verifies caller compatibility, not the full application's production route.
  • Native Linux x86-64 and Windows x86-64: full default builds, all-library packaging, conventions/registration checks and three decoder-test repetitions per OS pass on this exact candidate (isolated validation). Longest decoder run: Linux 0.0026 s; Windows 0.0222 s. Six executions, zero failures or skips. These are relevant-test results, not a complete CTest-suite run. The fork workflow is on 7f1b5e3f and explicitly checks out candidate e3b8ae75; the workflow is not part of the contribution.
  • python3 tools/check_conventions.py --base d70b89989473ba1f6ae13e44e079e67f1f8a44b0 passes.
  • No physical PS5, commercial title or complete ProsperoRadio playback validation.

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 technical debt
  • Unimplemented paths throw; no silent stubs added
  • No notes, investigation .md files or images added to the repository
  • New third-party code is a submodule built from source
  • Generic decoder behavior; unsupported behavior throws
  • Depends on: #1823 reaching main before the proposed ProsperoRadio runtime demonstration can be attempted; no prerequisite commits included
  • AI-assisted: yes, OpenAI Codex
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4792585039 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1829). Originally posted by [kali113](https://github.com/kali113) on 2026-10-08T20:45:34Z. --- ### What Add six `libSceOpusCeltDec` lifecycle and decode exports backed by official [libopus 1.6.1](https://github.com/xiph/opus/tree/v1.6.1), pinned as a source submodule. The implementation decodes CELT-only raw packets to 48 kHz mono/stereo signed 16-bit interleaved PCM, validates decoder ownership and byte capacity, and copies PCM only after successful decoding. Unsupported modes and invalid calls throw; no console error codes are guessed. The fork branch `kali113:feat/opus-celt-dec` has been rebuilt as **one decoder-only commit** ([`e3b8ae75`](https://github.com/kali113/AnyPS5/commit/e3b8ae7511a17ea3c4f4d1e47e60f94ed3e887ae)) on `main` `d70b8998`. It contains none of #1265, #1913, #1986 or #1999. An old branch backup remains available locally. There are no shader or unrelated test changes in that candidate. **GitHub retains the old commit/diff snapshot on this closed PR**; review the [cleaned branch comparison](https://github.com/boykopovar/AnyPS5/compare/main...kali113:feat/opus-celt-dec) or linked candidate commit rather than this closed PR's historical Files changed tab. The public [ProsperoRadio caller at 2c4029c](https://github.com/blackbearreloaded/ProsperoRadio/blob/2c4029c3a8f43e9e1dfef98374d94d99b14d745d/src/opus_decoder.cpp) declares this interface; [published decoder research](https://github.com/blackbearreloaded/ps5-audio-decoding-research/blob/26be5a12f92b2cdc67f8a9e082fd69ae0e9a35a2/docs/DECODING.md#direct-opus-abi) describes the context pointer, caller allocation and byte counts. These sources establish the caller contract, not bit-exact console equivalence. Console state layout, context values and error behavior remain unverified and are recorded in TechnicalDebt. **This PR remains closed pending the runtime evidence requested in [the closing review](https://github.com/boykopovar/AnyPS5/pull/1829#issuecomment-6078233020).** The earlier description overstated readiness. ProsperoRadio normally opens the general `libSceOpusDec` decoder first; [its production dispatch](https://github.com/blackbearreloaded/ProsperoRadio/blob/2c4029c3a8f43e9e1dfef98374d94d99b14d745d/src/radio_service.cpp) retries CELT only after a particular general-decoder error and a CELT packet. Main currently lacks the general decoder, proposed separately in #1823. No title log demonstrates reaching the CELT calls on current main, and this patch does not establish radio playback or a significant library-coverage increase. A reopened submission needs a real title's next-stop log on main. Duplicate recheck: reviewed file lists for all 538 current open PRs, including the complete 1,203-file list of #1128. Only #1823 touches an Opus decoder module; it implements the separate general decoder, not these CELT exports. Its commits are not included here. ### Tested Candidate `e3b8ae7511a17ea3c4f4d1e47e60f94ed3e887ae`: - macOS arm64 / AppleClang / Release standalone build using the actual library CMake target: decoder regression and public-caller harness both pass three repetitions. Longest observed run: 0.80 s. - The decoder regression checks nonzero mono/stereo PCM against separately generated libopus reference output, consecutive packets and recreation, independent contexts, invalid lifecycle calls, insufficient capacity, output/state canaries, malformed duration headers, SILK rejection and a 120 ms packet. The reference uses the same codec implementation; it is not a console or independent-codec oracle. - AddressSanitizer and UndefinedBehaviorSanitizer: both standalone tests pass. - The external public-caller harness explicitly selects CELT and adapts sysmodule load/unload; unused general-decoder calls abort. It verifies caller compatibility, not the full application's production route. - Native Linux x86-64 and Windows x86-64: full default builds, all-library packaging, conventions/registration checks and three decoder-test repetitions per OS pass on this exact candidate ([isolated validation](https://github.com/kali113/AnyPS5/actions/runs/37930964906)). Longest decoder run: Linux 0.0026 s; Windows 0.0222 s. Six executions, zero failures or skips. These are relevant-test results, not a complete CTest-suite run. The fork workflow is on `7f1b5e3f` and explicitly checks out candidate `e3b8ae75`; the workflow is not part of the contribution. - `python3 tools/check_conventions.py --base d70b89989473ba1f6ae13e44e079e67f1f8a44b0` passes. - No physical PS5, commercial title or complete ProsperoRadio playback validation. ### 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 technical debt - [x] Unimplemented paths throw; no silent stubs added - [x] No notes, investigation `.md` files or images added to the repository - [x] New third-party code is a submodule built from source - [x] Generic decoder behavior; unsupported behavior throws - [x] Depends on: #1823 reaching main before the proposed ProsperoRadio runtime demonstration can be attempted; no prerequisite commits included - [x] AI-assisted: yes, OpenAI Codex
copilot-pull-request-reviewer[bot] commented 2026-10-08 21:19:00 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by copilot-pull-request-reviewer[bot] on 2026-10-08T21:19:00Z.

Review: COMMENTED


Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5462975954 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1829#pullrequestreview-5462975954). Originally posted by [copilot-pull-request-reviewer[bot]](https://github.com/apps/copilot-pull-request-reviewer) on 2026-10-08T21:19:00Z. **Review:** COMMENTED --- Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.
github-actions[bot] commented 2026-10-08 21:29:33 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-08T21:29:33Z.


Progress report (a8b032b → 6e6ee7e)

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

✅ 6 implemented
Library Name
libSceOpusCeltDec sceOpusCeltDecCreateEx
libSceOpusCeltDec sceOpusCeltDecDecode
libSceOpusCeltDec sceOpusCeltDecDestroy
libSceOpusCeltDec sceOpusCeltDecGetSize
libSceOpusCeltDec sceOpusCeltDecInitialize
libSceOpusCeltDec sceOpusCeltDecTerminate
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6069414446 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1829#issuecomment-6069414446). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-08T21:29:33Z. --- <!-- progress-report --> ### Progress report (a8b032b → 6e6ee7e) 📈 **System libraries**: 84.79% (+0.03%, +6 implemented functions) <details> <summary>✅ 6 implemented</summary> | Library | Name | | - | - | | libSceOpusCeltDec | `sceOpusCeltDecCreateEx` | | libSceOpusCeltDec | `sceOpusCeltDecDecode` | | libSceOpusCeltDec | `sceOpusCeltDecDestroy` | | libSceOpusCeltDec | `sceOpusCeltDecGetSize` | | libSceOpusCeltDec | `sceOpusCeltDecInitialize` | | libSceOpusCeltDec | `sceOpusCeltDecTerminate` | </details>
oneandonlydean commented 2026-10-09 09:29:53 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-09T09:29:53Z.


Closing: ProsperoRadio (PPSA99001) stops on the missing libSceOpusDec.prx on main, and no log shows a title stopping at the sceOpusCeltDec* calls. The branch also carries #1265, #1913, #1986 and #1999. Reopen with only the decoder in the branch when it's a title's next stop on main, with the log line.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6078233020 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1829#issuecomment-6078233020). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-09T09:29:53Z. --- Closing: ProsperoRadio (PPSA99001) stops on the missing `libSceOpusDec.prx` on main, and no log shows a title stopping at the `sceOpusCeltDec*` calls. The branch also carries #1265, #1913, #1986 and #1999. Reopen with only the decoder in the branch when it's a title's next stop on main, with the log line.

Pull request closed

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!1829
No description provided.