Files
AnyPS5/docs/dev/debt/libSceAudiodec.md
T
RickandClaude Opus 5.5 bb95e44e9c fix(libSceAudiodec): decode HE-AAC as the console does
ui_enable_heaac was ignored and FFmpeg applied Parametric Stereo, so an
HE-AAC v2 stream decoded to 48 kHz stereo whatever the flag: 2048
samples in 2 channels per frame, and ERROR_INVALID_PCM_SIZE for a PCM
buffer sized for the console's output. The console returns the 24 kHz
mono core with HE-AAC disabled, and SBR output at 48 kHz in one channel
with it enabled.

AAC access units now reach FFmpeg without their ADTS header, with an
AudioSpecificConfig built from the header or from the raw parameters.
With HE-AAC disabled it signals SBR as absent. With HE-AAC enabled SBR
stays implicit, and a mono stream that FFmpeg decodes to two channels
is reopened with SBR present and Parametric Stereo absent. The new test
decodes fdk-aac HE-AAC v2 and HE-AAC stereo streams, ADTS and raw, with
HE-AAC on and off; it aborts on main.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-13 17:41:48 +02:00

1.7 KiB

libSceAudiodec technical debt

Unknown function info

  • sceAudiodecDecode (libSceAudiodec) - a raw M4AAC stream carries no channel configuration, so the decoder tries the mono/stereo configuration and then configurations 3 to 7 within ui_max_channels until one decodes the first access unit, and keeps that one. No reference documents how the library picks the layout (shadPS4 maps the channel count straight to the configuration; SharpProspero only describes the maximum). With the stereo configuration a mono raw stream decodes as 2 channels, so 2 is reported, not 1
  • sceAudiodecDecode (libSceAudiodec) - the HE-AAC handling follows one console measurement of an HE-AAC v2 ADTS stream: SBR output at 48 kHz in one channel with ui_enable_heaac 1, the 24 kHz mono core with 0. Not measured: whether the console, like FFmpeg, decodes a stream without SBR data in its first access unit as AAC-LC with ui_enable_heaac 1, and what it reports in ui_sampling_freq and ui_heaac with ui_enable_heaac 0 (here the rate of the returned PCM and 0)

Functional

  • sceAudiodecDecode (libSceAudiodec) - an ADTS stream with channel configuration 0 (layout in a program config element) is still parsed by FFmpeg, so ui_enable_heaac 0 does not remove its SBR and a mono one with Parametric Stereo comes out as stereo.
  • libSceAudiodec throws for the 24-bit PCM word size (iBwPcm 0): its sample layout is unknown. ATRAC9 decoding is covered only by configuration and error tests, as no ATRAC9 encoder is available for a fixture.