feat(libSceOpusCeltDec): implement CELT-only Opus decoding #3626

Closed
fishingpvalues wants to merge 1 commit from upstream-pr/3626 into main
fishingpvalues commented 2026-10-11 14:25:32 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by fishingpvalues on 2026-10-11T14:25:32Z.


What

Implement libSceOpusCeltDec, the fallback decoder PPSA99001 loads when libSceOpusDec reports a retryable error for a CELT packet. It was stubbed with six not-implemented exports; this routes it to the vendored FFmpeg Opus decoder at 48 kHz for mono and stereo, mirroring libSceOpusDec's ABI (640-byte opaque state, byte-count return) with the CELT-only input contract: TOC configuration below 16, invalid code-3 frame counts, packets above 120 ms, non-48000 Hz rates and undersized PCM buffers throw std::runtime_error with an OpusCeltDec: prefix.

Tested

x86-64 Linux host, guest_opus_celt_dec regression test: every throwing path, 20/10/5/2.5 ms stereo and mono frames, code-2/code-3 multi-frame packets, PCM sentinel preservation on rejection, and decoder statefulness (two decoders with the same history produce identical PCM, a fresh decoder differs). PCM vectors are checked live against the same vendored FFmpeg build the prx links. guest_opus_dec (sibling) and the relinker tests pass. No console capture available, so PCM equivalence and error codes remain unverified against real hardware.

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 (NotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4819758698 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3626). Originally posted by [fishingpvalues](https://github.com/fishingpvalues) on 2026-10-11T14:25:32Z. --- ### What Implement `libSceOpusCeltDec`, the fallback decoder PPSA99001 loads when libSceOpusDec reports a retryable error for a CELT packet. It was stubbed with six not-implemented exports; this routes it to the vendored FFmpeg Opus decoder at 48 kHz for mono and stereo, mirroring libSceOpusDec's ABI (640-byte opaque state, byte-count return) with the CELT-only input contract: TOC configuration below 16, invalid code-3 frame counts, packets above 120 ms, non-48000 Hz rates and undersized PCM buffers throw `std::runtime_error` with an `OpusCeltDec:` prefix. ### Tested x86-64 Linux host, `guest_opus_celt_dec` regression test: every throwing path, 20/10/5/2.5 ms stereo and mono frames, code-2/code-3 multi-frame packets, PCM sentinel preservation on rejection, and decoder statefulness (two decoders with the same history produce identical PCM, a fresh decoder differs). PCM vectors are checked live against the same vendored FFmpeg build the prx links. `guest_opus_dec` (sibling) and the relinker tests pass. No console capture available, so PCM equivalence and error codes remain unverified against real hardware. ### 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](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed in [TechnicalDebt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/TechnicalDebt.md#silent-stubs) - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] AI-assisted: yes
github-actions[bot] commented 2026-10-11 14:26:43 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-11T14:26:43Z.


Progress report (a11c8f7 → a351e7f)

📈 System libraries: 85.99% (+0.18%, +6 implemented functions)

✅ 6 implemented
Library Name
libSceOpusCeltDec sceOpusCeltDecCreateEx
libSceOpusCeltDec sceOpusCeltDecDecode
libSceOpusCeltDec sceOpusCeltDecDestroy
libSceOpusCeltDec sceOpusCeltDecGetSize
libSceOpusCeltDec sceOpusCeltDecInitialize
libSceOpusCeltDec sceOpusCeltDecTerminate
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6110038318 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3626#issuecomment-6110038318). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-11T14:26:43Z. --- <!-- progress-report --> ### Progress report (a11c8f7 → a351e7f) 📈 **System libraries**: 85.99% (+0.18%, +6 implemented functions) <details> <summary>✅ 6 implemented</summary> | Library | Name | | - | - | | libSceOpusCeltDec | `sceOpusCeltDecCreateEx` | | libSceOpusCeltDec | `sceOpusCeltDecDecode` | | libSceOpusCeltDec | `sceOpusCeltDecDestroy` | | libSceOpusCeltDec | `sceOpusCeltDecGetSize` | | libSceOpusCeltDec | `sceOpusCeltDecInitialize` | | libSceOpusCeltDec | `sceOpusCeltDecTerminate` | </details>
blawesom commented 2026-10-11 15:20:00 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by blawesom on 2026-10-11T15:20:00Z.


Independent pre-review on Linux (full CI runs only happen on manual trigger, so recording one): CachyOS, kernel 7.2.9, GCC 16.2.1, Ninja, Release, BUILD_TESTING=ON.

  • Builds; tools/check_conventions.py --base origin/main passes.
  • Full suite: 832/832 passed (all tests including the Vulkan suites on AMD RX 9070 XT / RADV).
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6110519709 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3626#issuecomment-6110519709). Originally posted by [blawesom](https://github.com/blawesom) on 2026-10-11T15:20:00Z. --- Independent pre-review on **Linux** (full CI runs only happen on manual trigger, so recording one): CachyOS, kernel 7.2.9, GCC 16.2.1, Ninja, Release, `BUILD_TESTING=ON`. - Builds; `tools/check_conventions.py --base origin/main` passes. - Full suite: **832/832 passed** (all tests including the Vulkan suites on AMD RX 9070 XT / RADV).
github-actions[bot] commented 2026-10-11 16:32:08 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-11T16:32:08Z.


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
#3913 sceOpusCeltDecCreateEx
sceOpusCeltDecDecode
sceOpusCeltDecDestroy
sceOpusCeltDecGetSize
sceOpusCeltDecInitialize
sceOpusCeltDecTerminate
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6111189013 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3626#issuecomment-6111189013). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-11T16:32:08Z. --- <!-- 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 | |---|---|---|---| | #3913 | | `sceOpusCeltDecCreateEx`<br>`sceOpusCeltDecDecode`<br>`sceOpusCeltDecDestroy`<br>`sceOpusCeltDecGetSize`<br>`sceOpusCeltDecInitialize`<br>`sceOpusCeltDecTerminate` | |
oneandonlydean commented 2026-10-11 23:58:14 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-11T23:58:14Z.


Closing: no title reaches this decoder. As the TechnicalDebt line here says, PPSA99001 opens it only after a retryable libSceOpusDec error, which libSceOpusDec never returns. Reopen when a title calls it.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6115345561 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3626#issuecomment-6115345561). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-11T23:58:14Z. --- Closing: no title reaches this decoder. As the TechnicalDebt line here says, PPSA99001 opens it only after a retryable libSceOpusDec error, which libSceOpusDec never returns. Reopen when a title calls it.

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