feat(libSceAjm.native): implement sceAjmBatchJobDecodeSplit #1541

Closed
emaurel wants to merge 1 commit from upstream-pr/1541 into main
emaurel commented 2026-10-08 11:46:59 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by emaurel on 2026-10-08T11:46:59Z.


What

sceAjmBatchJobDecodeSplit was a stub that threw. It now builds the same run job as sceAjmBatchJobDecode: the SIDEBAND_STREAM flag, with the result and stream sideband. The difference is that it takes lists of input and output buffers, the way sceAjmBatchJobRun is sceAjmBatchJobRunSplit over a single buffer each. The engine already joins multiple inputs (JoinInputs) and spreads output over multiple buffers (PcmOutputs), so no decoder change is needed.

On PS4 the decode helpers were inline functions in the SDK headers, so shadPS4 has RunSplit but no DecodeSplit. The flag and sideband size are therefore inferred from the Decode/Run pairing in this library, and that is recorded in TechnicalDebt.

Tested

  • Windows 10 22H2 (19045), WinLibs GCC 15.2.0 UCRT r7, Release, -DBUILD_TESTING=ON
  • Linux, Ubuntu 24.04 (WSL2), GCC 13.3, Release
  • New TestDecodeSplit in guest_ajm: the 6-frame MP3_MONO stream is decoded on two instances.
    • One instance uses sceAjmBatchJobDecode.
    • The other uses sceAjmBatchJobDecodeSplit, with each frame's input split into two buffers 37 bytes in (mid-frame) and the output split into two buffers of 500 and 652 samples.
    • For every frame, the split decode must report the same input consumed, output written and total samples, and produce byte-identical PCM.
  • guest_ajm passed 5 of 5 runs on both systems. On Windows it also passed on main before the change.
  • Each of these makes the test fail: keeping the stub, passing flag 0 instead of SIDEBAND_STREAM, dropping the second input buffer, and dropping the second output buffer.
  • Full suite on Windows: 442 of 443 pass. The one failure is agc_driver_dcc_keys_first_write, the intermittent NVIDIA failure of #1434 (addressed by the open #1441). Its binary loads only libc and libSceAgcDriver, which this PR does not change.
  • python3 tools/check_conventions.py --base upstream/main passes.
  • No title or homebrew was tested.

Checklist

  • Based on current main; no other open PR implements the same functions (#1468 also edits libSceAjm.native/Export.cpp, renaming the WVorbis stubs only)
  • 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

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4786275808 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1541). Originally posted by [emaurel](https://github.com/emaurel) on 2026-10-08T11:46:59Z. --- ### What `sceAjmBatchJobDecodeSplit` was a stub that threw. It now builds the same run job as `sceAjmBatchJobDecode`: the `SIDEBAND_STREAM` flag, with the result and stream sideband. The difference is that it takes lists of input and output buffers, the way `sceAjmBatchJobRun` is `sceAjmBatchJobRunSplit` over a single buffer each. The engine already joins multiple inputs (`JoinInputs`) and spreads output over multiple buffers (`PcmOutputs`), so no decoder change is needed. On PS4 the decode helpers were inline functions in the SDK headers, so [shadPS4](https://github.com/shadps4-emu/shadPS4) has `RunSplit` but no `DecodeSplit`. The flag and sideband size are therefore inferred from the `Decode`/`Run` pairing in this library, and that is recorded in TechnicalDebt. ### Tested - **Windows 10 22H2 (19045)**, WinLibs GCC 15.2.0 UCRT r7, Release, `-DBUILD_TESTING=ON` - **Linux, Ubuntu 24.04 (WSL2)**, GCC 13.3, Release - New `TestDecodeSplit` in `guest_ajm`: the 6-frame `MP3_MONO` stream is decoded on two instances. - One instance uses `sceAjmBatchJobDecode`. - The other uses `sceAjmBatchJobDecodeSplit`, with each frame's input split into two buffers 37 bytes in (mid-frame) and the output split into two buffers of 500 and 652 samples. - For every frame, the split decode must report the same input consumed, output written and total samples, and produce byte-identical PCM. - `guest_ajm` passed 5 of 5 runs on both systems. On Windows it also passed on `main` before the change. - Each of these makes the test fail: keeping the stub, passing flag 0 instead of `SIDEBAND_STREAM`, dropping the second input buffer, and dropping the second output buffer. - Full suite on Windows: 442 of 443 pass. The one failure is `agc_driver_dcc_keys_first_write`, the intermittent NVIDIA failure of #1434 (addressed by the open #1441). Its binary loads only libc and libSceAgcDriver, which this PR does not change. - `python3 tools/check_conventions.py --base upstream/main` passes. - No title or homebrew was tested. ### Checklist - [x] Based on current `main`; no other open PR implements the same functions (#1468 also edits `libSceAjm.native/Export.cpp`, renaming the WVorbis stubs only) - [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 🤖 Generated with [Claude Code](https://claude.com/claude-code)
github-actions[bot] commented 2026-10-08 11:47:26 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-08T11:47:26Z.


Progress report (33a9199 → cbaff8a)

📈 System libraries: 85.45% (+0.03%, +1 implemented functions)

✅ 1 implemented
Library Name
libSceAjm.native sceAjmBatchJobDecodeSplit
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6059176948 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1541#issuecomment-6059176948). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-08T11:47:26Z. --- <!-- progress-report --> ### Progress report (33a9199 → cbaff8a) 📈 **System libraries**: 85.45% (+0.03%, +1 implemented functions) <details> <summary>✅ 1 implemented</summary> | Library | Name | | - | - | | libSceAjm.native | `sceAjmBatchJobDecodeSplit` | </details>
github-actions[bot] commented 2026-10-08 17:07:08 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-08T17:07: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
#1693 docs/dev/TechnicalDebt.md L171
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6065059973 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1541#issuecomment-6065059973). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-08T17:07: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 | |---|---|---|---| | #1693 | `docs/dev/TechnicalDebt.md` [L171](https://github.com/boykopovar/AnyPS5/blob/ae91d9780b3fe8dc71481841904fced01923c24b/docs/dev/TechnicalDebt.md#L171) | | |
oneandonlydean commented 2026-10-09 08:54:34 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-09T08:54:34Z.


Closing: same as #867, no title is shown reaching sceAjmBatchJobDecodeSplit on main. Please reopen with the title ID and the log line if you find one.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6077702632 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1541#issuecomment-6077702632). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-09T08:54:34Z. --- Closing: same as #867, no title is shown reaching `sceAjmBatchJobDecodeSplit` on main. Please reopen with the title ID and the log line if you find one.

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