Skip to content

feat(libSceAjm): implement M4AAC decoding - #3619

Closed
emirplus wants to merge 1 commit into
boykopovar:mainfrom
emirplus:feat/ajm-m4aac
Closed

emirplus wants to merge 1 commit into
boykopovar:mainfrom
emirplus:feat/ajm-m4aac

Conversation

@emirplus

Copy link
Copy Markdown
Contributor

What

Implement CODEC_M4AAC (codec 2) decoding in libSceAjm.native using the project's linked FFmpeg integration (AV_CODEC_ID_AAC).

  • Supports M4AAC_CONFIG_ADTS (1) with 7-byte ADTS header parsing, AAC-LC profile, frequency indices < 12, and mono (1), stereo (2), or 5.1 (6) channel configurations.
  • Supports M4AAC_CONFIG_RAW (2) access units by synthesizing 2-byte AudioSpecificConfig extradata at initialization.
  • Emulates Sony hardware 2-frame delay (M4AAC_DELAY_FRAMES = 2) unless M4AAC_ENABLE_NONDELAY_OUTPUT is passed in instance creation flags.
  • Reports dynamic bitrate and format in run job sidebands; applies gapless priming skips (skipSamples) and total sample limits ( otalSamples).
  • Handles buffer management, padding (AV_INPUT_BUFFER_PADDING_SIZE), and status signaling (AJM_RESULT_PARTIAL_INPUT, AJM_RESULT_NOT_ENOUGH_ROOM, AJM_RESULT_FATAL).
  • Updates TechnicalDebt.md documenting unimplemented HE-AAC profile without ENABLE_SBR_DECODE and multi-AU raw access buffers.
  • Adds regression and fixture tests in GuestAjm.cpp using a synthetic AAC-LC chirp bitstream validating delay, non-delay, bitrate, and channel isolation.

Note on title compatibility: Resolving this stub addresses the recorded crash signature from issue #3410, but full title compatibility (e.g. Ghost of Yotei, PPSA26344) has not been verified in a real game run.

Tested

MinGW-w64 GCC 15.2.0 (WinLibs), Windows 10, Release:

  • guest_ajm_tests (guest_ajm): Passed (0.16s).
  • python tools/check_conventions.py --base origin/main: Passed (0 violations).
  • git diff --check origin/main: Clean.

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

@github-actions

Copy link
Copy Markdown

Progress report (a11c8f7 → 70f022b)

📉 System libraries: 85.78% (-0.03%, -1 reverted functions)

⚠️ 1 went back to stubs
Library Name
libSceAjm.native sceAjmInstanceCreate

@blawesom

Copy link
Copy Markdown
Contributor

Cross-linking for the review: this implements the M4AAC decoder tracked in #3410, which has an independent Linux verification on that issue — full suite 522/522, guest_ajm stable across repeated runs, plus a negative control: with the extended test but main's Ajm.cpp, the test aborts at exactly INITIALIZE for a codec other than MP3, ATRAC9 and Opus not implemented, so the new paths are provably covered. The one Windows-only failure reported on the original issue (windows_exceptions) passes on Linux.

@oneandonlydean

Copy link
Copy Markdown
Collaborator

This is the commit from #3410 (screamm:feat/ajm-m4aac, a395684b) with the author and the commit message replaced. Please push that commit as it is, rebased onto main with its author kept, as #3410 asks.

@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Oct 12, 2026
@adriadam10

Copy link
Copy Markdown
Collaborator

Closing: this is the commit from #3410 (screamm:feat/ajm-m4aac, a395684b) with the author and message replaced (same three files, +545 lines), and the request above to push it as it is with its author kept wasn't addressed. #4934 also implements the M4AAC decoder and is still open, and this PR conflicts with main.

Feel free to reopen if the original commit is carried with its authorship preserved (e.g. Co-authored-by/original author) and rebased, and #4934 is accounted for.

@adriadam10 adriadam10 closed this Oct 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs needs rebase Conflicts with main, rebase needed prx

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants