feat(libSceOpusSilkEnc): implement sceOpusSilkEncCancel #27585

Open
sschandra2006 wants to merge 1 commit from upstream-pr/27585 into main
sschandra2006 commented 2026-11-26 18:42:26 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by sschandra2006 on 2026-11-26T18:42:26Z.


What

Implement sceOpusSilkEncCancel in libSceOpusSilkEnc, bringing the library to 100% export completion (15/15 exports implemented). As identified in firmware disassembly and console measurements, sceOpusSilkEncCancel validates non-null state before reading the 32-bit AJM context word at state +0xF0 and forwarding the cancellation request to sceAjmiBatchCancel(context, batchId).

Tested

Unit tests in GuestOpusSilkEnc.cpp:

  • Null state verification returns 0x81770001
  • Unreadable state throws and preserves errno
  • Blank/live state without initialized AJM context returns SCE_AJM_ERROR_INVALID_CONTEXT (0x80930002)
  • State with valid initialized AJM context verifies batch cancellation dispatch (SCE_AJM_ERROR_INVALID_BATCH for unknown batch)
  • Conventions check via python tools/check_conventions.py --base upstream/main passed cleanly
  • Debt fold check via python tools/debt_fold.py --check passed cleanly
  • Full collision check via python tools/pr_overlap.py --branch feat/libscesilkenc-cancel confirmed zero overlap across all 2,432 open PRs

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 and the licence notice of code adapted from upstream (see AGENTS.md)
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • 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
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes

Summary by CodeRabbit

  • New Features
    • Opus encoder batch cancellation requests are now handled by the batch service instead of returning an unimplemented result.
  • Bug Fixes
    • Cancellation now reports invalid encoder contexts and batches with the corresponding error results.
  • Documentation
    • Updated Opus encoder documentation to describe cancellation behavior and its possible outcomes.
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5515447399 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/27585). Originally posted by [sschandra2006](https://github.com/sschandra2006) on 2026-11-26T18:42:26Z. --- ### What Implement `sceOpusSilkEncCancel` in `libSceOpusSilkEnc`, bringing the library to 100% export completion (15/15 exports implemented). As identified in firmware disassembly and console measurements, `sceOpusSilkEncCancel` validates non-null state before reading the 32-bit AJM context word at state +0xF0 and forwarding the cancellation request to `sceAjmiBatchCancel(context, batchId)`. ### Tested Unit tests in `GuestOpusSilkEnc.cpp`: - Null state verification returns `0x81770001` - Unreadable state throws and preserves `errno` - Blank/live state without initialized AJM context returns `SCE_AJM_ERROR_INVALID_CONTEXT` (0x80930002) - State with valid initialized AJM context verifies batch cancellation dispatch (`SCE_AJM_ERROR_INVALID_BATCH` for unknown batch) - Conventions check via `python tools/check_conventions.py --base upstream/main` passed cleanly - Debt fold check via `python tools/debt_fold.py --check` passed cleanly - Full collision check via `python tools/pr_overlap.py --branch feat/libscesilkenc-cancel` confirmed zero overlap across all 2,432 open PRs ### 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) and the licence notice of code adapted from upstream (see AGENTS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [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] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **New Features** * Opus encoder batch cancellation requests are now handled by the batch service instead of returning an unimplemented result. * **Bug Fixes** * Cancellation now reports invalid encoder contexts and batches with the corresponding error results. * **Documentation** * Updated Opus encoder documentation to describe cancellation behavior and its possible outcomes. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
MarcZX10 commented 2026-11-26 18:53:51 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-26T18:53:51Z.

Review: APPROVED


Reviewed — looks good

The implementation follows the described context lookup and AJMI batch cancel dispatch; no blocking defect was found in the changed code read.

What I ran

Reviewed head 5358865c1f29e569f00280aaa05ed700362af87b using repo_read.py to inspect prepared artifacts and pinned repository files. No tests or builds were run.

Results

Check Result Note
Diff and changed code passed Four changed files read
Tests and build not run No local execution performed

Findings

Blocking

None.

Non-blocking

None.

Not verified

No tests or build were run. Console behavior and the description’s reported firmware observations were not independently verified. All four files listed as reviewed in manifest.json were read: core/libs/prx/libSceOpusSilkEnc/CMakeLists.txt, core/libs/prx/libSceOpusSilkEnc/Export.cpp, core/libs/tests/GuestOpusSilkEnc.cpp, and docs/dev/debt/changes/feat-opus-encoder-ctl.md. No files were excluded by the manifest.

To get this to a good state

Nothing is required.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6079206022 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/27585#pullrequestreview-6079206022). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-26T18:53:51Z. **Review:** APPROVED --- # Reviewed — looks good The implementation follows the described context lookup and AJMI batch cancel dispatch; no blocking defect was found in the changed code read. ## What I ran Reviewed head `5358865c1f29e569f00280aaa05ed700362af87b` using `repo_read.py` to inspect prepared artifacts and pinned repository files. No tests or builds were run. ## Results | Check | Result | Note | |---|---|---| | Diff and changed code | passed | Four changed files read | | Tests and build | not run | No local execution performed | ## Findings ### Blocking None. ### Non-blocking None. ## Not verified No tests or build were run. Console behavior and the description’s reported firmware observations were not independently verified. All four files listed as reviewed in `manifest.json` were read: `core/libs/prx/libSceOpusSilkEnc/CMakeLists.txt`, `core/libs/prx/libSceOpusSilkEnc/Export.cpp`, `core/libs/tests/GuestOpusSilkEnc.cpp`, and `docs/dev/debt/changes/feat-opus-encoder-ctl.md`. No files were excluded by the manifest. ## To get this to a good state Nothing is required.
ligmaSec commented 2026-12-03 12:33:32 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T12:33:32Z.

Review: COMMENTED


Compiled and ran the exact GuestOpusSilkEnc fixture on Linux with the branch’s source, the bundled Opus library, and the existing AJMI and libc libraries. The cancellation checks passed.

AI-assisted: yes.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6169892128 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/27585#pullrequestreview-6169892128). Originally posted by [ligmaSec](https://github.com/ligmaSec) on 2026-12-03T12:33:32Z. **Review:** COMMENTED --- Compiled and ran the exact `GuestOpusSilkEnc` fixture on Linux with the branch’s source, the bundled Opus library, and the existing AJMI and libc libraries. The cancellation checks passed. AI-assisted: yes.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/27585:upstream-pr/27585'
git switch 'upstream-pr/27585'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/27585'
git switch 'upstream-pr/27585'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/27585'
git switch 'upstream-pr/27585'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/27585'
git switch 'main'
git merge --squash 'upstream-pr/27585'
git switch 'main'
git merge --ff-only 'upstream-pr/27585'
git switch 'main'
git merge 'upstream-pr/27585'
git push origin 'main'
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!27585
No description provided.