fix(ajm): convert planar 16-bit MP3 output from FFmpeg #237

Merged
adriadam10 merged 1 commit from upstream-pr/237 into main 2026-10-02 07:34:45 +00:00
adriadam10 commented 2026-10-01 17:41:00 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-01T17:41:00Z.


What

AJM MP3 decoding (#153) throws on Linux: AJM MP3: FFmpeg sample format 6 is not converted.

avcodec_find_decoder(AV_CODEC_ID_MP3) returns the first registered MP3 decoder. The Linux FFmpeg package from ffmpeg-core only contains the fixed-point mp3 decoder (checked with nm on libavcodec.a and the package's build log), whose frames are AV_SAMPLE_FMT_S16P; RunMp3 only accepts AV_SAMPLE_FMT_FLTP, which is what the float mp3float decoder returns (probably present in the Windows package, where this was tested). RunMp3 now converts S16P frames as well, to the same S16 / S32 / float outputs.

Tested

Linux (CachyOS, GCC): new guest_ajm test, linked against libSceAjm.native: a 6-frame mono 48 kHz MP3 fixture (1 kHz sine, generated with FFmpeg) is decoded through sceAjmBatchJobDecode / sceAjmBatchStart, checking the sideband result, bytes consumed and written, total decoded samples and the tone's amplitude. Without the fix the test aborts with the exception above; with it, it passes. Full suite passes. Windows only through CI. No title tested.

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:4707338165 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/237). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-01T17:41:00Z. --- ### What AJM MP3 decoding (#153) throws on Linux: `AJM MP3: FFmpeg sample format 6 is not converted`. `avcodec_find_decoder(AV_CODEC_ID_MP3)` returns the first registered MP3 decoder. The Linux FFmpeg package from `ffmpeg-core` only contains the fixed-point `mp3` decoder (checked with `nm` on `libavcodec.a` and the package's build log), whose frames are `AV_SAMPLE_FMT_S16P`; `RunMp3` only accepts `AV_SAMPLE_FMT_FLTP`, which is what the float `mp3float` decoder returns (probably present in the Windows package, where this was tested). `RunMp3` now converts S16P frames as well, to the same S16 / S32 / float outputs. ### Tested Linux (CachyOS, GCC): new `guest_ajm` test, linked against `libSceAjm.native`: a 6-frame mono 48 kHz MP3 fixture (1 kHz sine, generated with FFmpeg) is decoded through `sceAjmBatchJobDecode` / `sceAjmBatchStart`, checking the sideband result, bytes consumed and written, total decoded samples and the tone's amplitude. Without the fix the test aborts with the exception above; with it, it passes. Full suite passes. Windows only through CI. No title tested. ### 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 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
adriadam10 commented 2026-10-02 07:20:58 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-02T07:20:58Z.


No longer stacked on #228 (which now only drops the duplicated stubs): rebased on main, the guest_ajm test is now registered in libSceAjm.native and links against it.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:5947288990 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/237#issuecomment-5947288990). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-02T07:20:58Z. --- No longer stacked on #228 (which now only drops the duplicated stubs): rebased on `main`, the `guest_ajm` test is now registered in `libSceAjm.native` and links against it.
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!237
No description provided.