fix(ajm): accept Opus mapping family 255 for a mono stream #5075

Merged
SandstromPL merged 1 commit from upstream-pr/5075 into main 2026-10-14 06:38:44 +00:00
SandstromPL commented 2026-10-13 10:50:43 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by SandstromPL on 2026-10-13T10:50:43Z.


What

@poonasor found this on NHL 27's (PPSA34063) integration branch (#4275, stop 13) and accepted it for a mono stream in poonasor/AnyPS5@3b35621bb. This carries that change onto the mapping-family code from #3831.

The title initializes a mono 48 kHz Opus decoder with 1, 48000, 255. On that branch, which predates #3831, it stopped with ... nonzero third parameter word; with the change it went on to the later stops in that table. #3831 reads the third word as the mapping family and refuses anything above 1, so main refuses the same call with sceAjmBatchJobInitialize (Opus mapping family other than 0 or 1) not implemented.

Family 255 is now accepted for one channel and decoded as a single mono stream, the same as family 0. RFC 7845 section 5.1.1 defines a family-255 stream's layout through the stream count, coupled stream count and channel mapping in its own header, and AJM's 12-byte initialize parameters carry none of them. So family 255 with more channels still throws, and the debt entry records the mono reading as assumed.

Tested

Ubuntu 24.04, GCC 13.3, full build (Release):

  • guest_ajm gains TestOpusMonoFamily255:

    • A 1, 48000, 0 and a 1, 48000, 255 instance decode the same three Opus packets. They must give identical PCM, the expected consumed and written sizes and decoded-sample totals, and the test tone's peak.
    • 2, 48000, 255 and 1, 48000, 2 must still be refused.

    On main it aborts with the error above. It passes here, 5 runs out of 5. Two mutants fail it: one accepts every family for mono, the other accepts 255 for every channel count.

  • Built at cac4e9688; the AJM sources, the test and the debt file are identical on current main.

  • NHL 27 was not rerun. Nothing past start-up has been run on main, and earlier stops in #4275 are still open there (for example stop 12, #4563).

  • tools/check_conventions.py from main passes with this title and body.

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 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
  • Unblocks: PPSA34063 #4275 (stop 13, seen on the integration branch; not yet reached on main)
  • GPUs tested: n/a
  • AI-assisted: yes (Claude Code); I reviewed and tested every line

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4842098324 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5075). Originally posted by [SandstromPL](https://github.com/SandstromPL) on 2026-10-13T10:50:43Z. --- ### What @poonasor found this on NHL 27's (PPSA34063) integration branch (#4275, stop 13) and accepted it for a mono stream in [poonasor/AnyPS5@3b35621bb](https://github.com/poonasor/AnyPS5/commit/3b35621bbe). This carries that change onto the mapping-family code from #3831. The title initializes a mono 48 kHz Opus decoder with `1, 48000, 255`. On that branch, which predates #3831, it stopped with `... nonzero third parameter word`; with the change it went on to the later stops in that table. #3831 reads the third word as the mapping family and refuses anything above 1, so main refuses the same call with `sceAjmBatchJobInitialize (Opus mapping family other than 0 or 1) not implemented`. Family 255 is now accepted for one channel and decoded as a single mono stream, the same as family 0. [RFC 7845 section 5.1.1](https://datatracker.ietf.org/doc/html/rfc7845#section-5.1.1) defines a family-255 stream's layout through the stream count, coupled stream count and channel mapping in its own header, and AJM's 12-byte initialize parameters carry none of them. So family 255 with more channels still throws, and the debt entry records the mono reading as assumed. ### Tested Ubuntu 24.04, GCC 13.3, full build (Release): - `guest_ajm` gains `TestOpusMonoFamily255`: - A `1, 48000, 0` and a `1, 48000, 255` instance decode the same three Opus packets. They must give identical PCM, the expected consumed and written sizes and decoded-sample totals, and the test tone's peak. - `2, 48000, 255` and `1, 48000, 2` must still be refused. On main it aborts with the error above. It passes here, 5 runs out of 5. Two mutants fail it: one accepts every family for mono, the other accepts 255 for every channel count. - Built at `cac4e9688`; the AJM sources, the test and the debt file are identical on current `main`. - NHL 27 was not rerun. Nothing past start-up has been run on main, and earlier stops in #4275 are still open there (for example stop 12, #4563). - `tools/check_conventions.py` from main passes with this title and body. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [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 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] Unblocks: PPSA34063 #4275 (stop 13, seen on the integration branch; not yet reached on main) - [x] GPUs tested: n/a - [x] AI-assisted: yes (Claude Code); I reviewed and tested every line 🤖 Generated with [Claude Code](https://claude.com/claude-code)
github-actions[bot] commented 2026-10-14 03:43:43 +00:00 (Migrated from github.com)

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


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
#5647 docs/dev/debt/libSceAjm.native.md L9-10
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6160393176 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5075#issuecomment-6160393176). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-14T03:43:43Z. --- <!-- 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 | |---|---|---|---| | #5647 | `docs/dev/debt/libSceAjm.native.md` [L9-10](https://github.com/boykopovar/AnyPS5/blob/f87799aa3aebb4be9d27a1d04741218f0d622479/docs/dev/debt/libSceAjm.native.md#L9-L10) | | |
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!5075
No description provided.