Difference between revisions of "DSP AAC Decoder"

From 3dbrew
Jump to navigation Jump to search
Line 1: Line 1:
 
''Note that everything below may vary depending on the exact DSP firmware used and different variants have slightly different behaviours.''
 
''Note that everything below may vary depending on the exact DSP firmware used and different variants have slightly different behaviours.''
 
+
''Also note that some things about the AAC firmware still need to be properly tested and/or reverse engineered.''
  
 
=Summary=
 
=Summary=
Line 52: Line 52:
 
|-
 
|-
 
| SaveState
 
| SaveState
 +
| 4
 +
|}
 +
 +
=Request/Response Data=
 +
The 24-byte "request/response data" chunk can take on one of the formats listed below, depending on what sort of message it's found in.
 +
 +
'''AAC Decode command response'''
 +
 +
Size : 24 bytes
 +
{| class="wikitable" border="1"
 +
|-
 +
!  Offset in bytes
 +
! Type
 +
!  Description
 +
|-
 +
| 0x0
 +
| enum SampleRate
 +
| Sample rate of the decoded AAC stream (Note: This is an enum, NOT a numerical value for the sample rate)
 +
|-
 +
| 0x4
 +
| u32
 +
| Channel count (?)
 +
|-
 +
| 0x8
 +
| u32
 +
| Size
 +
|-
 +
| 0xC
 +
| u32
 +
| Unknown?
 +
|-
 +
| 0x10
 +
| u32
 +
| Unknown?
 +
|-
 +
| 0x14
 +
| u32
 +
| Number of decoded samples (?)
 +
|-
 +
|}
 +
 +
=Sample rate enum=
 +
'''enum SampleRate : u32'''
 +
{| class="wikitable" border="1"
 +
|-
 +
!  Enum
 +
!  Value
 +
|-
 +
| 48000Hz (48KHz)
 +
| 0
 +
|-
 +
| 44100Hz (44.1KHz)
 +
| 1
 +
|-
 +
| 32000Hz (32KHz)
 +
| 2
 +
|-
 +
| 24000Hz (24KHz)
 
| 3
 
| 3
 +
|-
 +
| 22050Hz (22.05KHz)
 +
| 4
 +
|-
 +
| 16000Hz (16KHz)
 +
| 5
 +
|-
 +
| 12000Hz (12KHz)
 +
| 6
 +
|-
 +
| 11025Hz (11.025KHz)
 +
| 7
 +
|-
 +
| 8000Hz (8KHz)
 +
| 8
 +
|-
 
|}
 
|}

Revision as of 21:36, 28 September 2024

Note that everything below may vary depending on the exact DSP firmware used and different variants have slightly different behaviours. Also note that some things about the AAC firmware still need to be properly tested and/or reverse engineered.

Summary

Some versions of the DSP firmware contain a decoder for the AAC audio codec. Such firmware may be dumped from specific games, like Pokemon X/Y or Rhythm Heaven Megamix. Interfacing with the AAC decoder (sending requests/receiving responses) happens via the DSP binary pipe (pipe 3)

Message Format

Below is the message format used for communicating with the AAC decoder. The same format is both when making requests and for responses, though the "request/response data" field changes appropriately.

Size : 0x20 bytes

Offset in bytes Type Description
0x0 u16 Mode (Seems to be 0 = None, 1 = Decode AAC, 2 = Encode AAC)
0x2 DecoderCommand Command to be handled by the decoder (See information on DecoderCommand structure below)
0x4 u32 Result Code
0x8 Request/Response data A 24-byte chunk of data containing information about the request/response. See below for more info.

enum DecoderCommand : u16

Enum Value
Initialize (Initialize AAC decoder) 0
DecodeEncode (Decode or encode an AAC stream) 1
Shutdown 2
LoadState 3
SaveState 4

Request/Response Data

The 24-byte "request/response data" chunk can take on one of the formats listed below, depending on what sort of message it's found in.

AAC Decode command response

Size : 24 bytes

Offset in bytes Type Description
0x0 enum SampleRate Sample rate of the decoded AAC stream (Note: This is an enum, NOT a numerical value for the sample rate)
0x4 u32 Channel count (?)
0x8 u32 Size
0xC u32 Unknown?
0x10 u32 Unknown?
0x14 u32 Number of decoded samples (?)

Sample rate enum

enum SampleRate : u32

Enum Value
48000Hz (48KHz) 0
44100Hz (44.1KHz) 1
32000Hz (32KHz) 2
24000Hz (24KHz) 3
22050Hz (22.05KHz) 4
16000Hz (16KHz) 5
12000Hz (12KHz) 6
11025Hz (11.025KHz) 7
8000Hz (8KHz) 8