feat(libSceAjm.native): implement sceAjmBatchJobSetResampleParametersEx #1554

Closed
emaurel wants to merge 1 commit from upstream-pr/1554 into main
emaurel commented 2026-10-08 12:13:25 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by emaurel on 2026-10-08T12:13:25Z.


What

sceAjmBatchJobSetResampleParametersEx was a stub that threw. It now queues the same set job as sceAjmBatchJobSetResampleParameters, with a second parameter, the ramp:

  • The resampler starts at ratio_start, and ratio_change_per_sample is added to the ratio after each output sample, until the next set call. The ratio keeps the meaning of the existing implementation: decoded samples per output sample.
  • sceAjmBatchJobSetResampleParameters now also clears any ramp.
  • sceAjmBatchJobGetResampleInfo reports the current, ramped ratio.
  • A non-positive or non-finite ratio_start, or a non-finite change, returns SCE_AJM_ERROR_INVALID_PARAMETER without queueing a job, like the existing call.
  • A ramp that reaches a ratio that is not positive throws, because the console's behaviour there is unknown.
  • The flags argument is ignored, as for sceAjmBatchJobSetResampleParameters.

No reference implements this function, so the ramp semantics are inferred from the existing ratio and 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 TestResampleRamp in guest_ajm, on the MP3_MONO stream:
    • A ramp of 0 at ratio 0.5 produces the same PCM as sceAjmBatchJobSetResampleParameters(0.5).
    • Ratio 1 with a change of 2: output sample k lands exactly on decoded sample k² (1 + 3 + … + (2k − 1) = k²). Every output must equal the unresampled decode at k², the output length must be exactly the number of such k that fit, and the reported ratio at the end must be 1 + 2 × that count.
    • sceAjmBatchJobSetResampleParameters(2.0) after a ramp gives the plain decimated output, and reports ratio 2.
    • Invalid start and change values are refused without queueing a job.
    • A ramp from 1 with a change of −1 is refused when the batch starts.
  • 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, changing the ratio before advancing the position, not clearing the ramp in the plain call, dropping the change parameter, removing the positive-ratio check, and not resampling a ramp that starts at ratio 1.
  • Full suite on Windows: 443 of 445 pass. The two failures are agc_driver_dcc_keys_first_write and agc_driver_srgb8_color_target, the intermittent NVIDIA failures of #1434 (addressed by the open #1441). Their binaries load 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 (#1541 and #1549 also edit these files and merge cleanly with this branch)
  • 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:4786603334 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1554). Originally posted by [emaurel](https://github.com/emaurel) on 2026-10-08T12:13:25Z. --- ### What `sceAjmBatchJobSetResampleParametersEx` was a stub that threw. It now queues the same set job as `sceAjmBatchJobSetResampleParameters`, with a second parameter, the ramp: - The resampler starts at `ratio_start`, and `ratio_change_per_sample` is added to the ratio after each output sample, until the next set call. The ratio keeps the meaning of the existing implementation: decoded samples per output sample. - `sceAjmBatchJobSetResampleParameters` now also clears any ramp. - `sceAjmBatchJobGetResampleInfo` reports the current, ramped ratio. - A non-positive or non-finite `ratio_start`, or a non-finite change, returns `SCE_AJM_ERROR_INVALID_PARAMETER` without queueing a job, like the existing call. - A ramp that reaches a ratio that is not positive throws, because the console's behaviour there is unknown. - The flags argument is ignored, as for `sceAjmBatchJobSetResampleParameters`. No reference implements this function, so the ramp semantics are inferred from the existing ratio and 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 `TestResampleRamp` in `guest_ajm`, on the `MP3_MONO` stream: - A ramp of 0 at ratio 0.5 produces the same PCM as `sceAjmBatchJobSetResampleParameters(0.5)`. - Ratio 1 with a change of 2: output sample *k* lands exactly on decoded sample *k*² (1 + 3 + … + (2k − 1) = k²). Every output must equal the unresampled decode at *k*², the output length must be exactly the number of such *k* that fit, and the reported ratio at the end must be 1 + 2 × that count. - `sceAjmBatchJobSetResampleParameters(2.0)` after a ramp gives the plain decimated output, and reports ratio 2. - Invalid start and change values are refused without queueing a job. - A ramp from 1 with a change of −1 is refused when the batch starts. - `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, changing the ratio before advancing the position, not clearing the ramp in the plain call, dropping the change parameter, removing the positive-ratio check, and not resampling a ramp that starts at ratio 1. - Full suite on Windows: 443 of 445 pass. The two failures are `agc_driver_dcc_keys_first_write` and `agc_driver_srgb8_color_target`, the intermittent NVIDIA failures of #1434 (addressed by the open #1441). Their binaries load 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 (#1541 and #1549 also edit these files and merge cleanly with this branch) - [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 12:13:49 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-08T12:13:49Z.


Progress report (1081602 → 1359ea5)

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

✅ 1 implemented
Library Name
libSceAjm.native sceAjmBatchJobSetResampleParametersEx
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6059603183 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1554#issuecomment-6059603183). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-08T12:13:49Z. --- <!-- progress-report --> ### Progress report (1081602 → 1359ea5) 📈 **System libraries**: 84.77% (+0.03%, +1 implemented functions) <details> <summary>✅ 1 implemented</summary> | Library | Name | | - | - | | libSceAjm.native | `sceAjmBatchJobSetResampleParametersEx` | </details>
github-actions[bot] commented 2026-10-08 15:38:41 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-08T15:38:41Z.


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
#1583 docs/dev/TechnicalDebt.md L234
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6063498121 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1554#issuecomment-6063498121). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-08T15:38:41Z. --- <!-- 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 | |---|---|---|---| | #1583 | `docs/dev/TechnicalDebt.md` [L234](https://github.com/boykopovar/AnyPS5/blob/ce64d8eb3603078b597a60a37496328de63df72a/docs/dev/TechnicalDebt.md#L234) | | |
oneandonlydean commented 2026-10-09 08:54:37 +00:00 (Migrated from github.com)

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


Closing: same as #1045, no title is shown reaching sceAjmBatchJobSetResampleParametersEx on main, and no reference gives the ramp's behaviour. Please reopen with the title ID and the log line if you find one.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6077703381 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1554#issuecomment-6077703381). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-09T08:54:37Z. --- Closing: same as #1045, no title is shown reaching `sceAjmBatchJobSetResampleParametersEx` on main, and no reference gives the ramp's behaviour. 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!1554
No description provided.