DSP Memory Region: Difference between revisions
m clarify buffer ids |
No edit summary |
||
(14 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
'' | ''Note that everything below may vary depending on the exact DSP firmware used and different variants have slightly different behaviours.'' | ||
The DSP communicates with the application through two shared memory areas 0x8000 bytes long each (at 0x1FF50000 and 0x1FF70000 respectively). The DSP alternates between the use of these two areas (much like a double-buffer). Each area has 15 structures within it. The location of these structures can be obtained by [[DSP:ReadPipe|reading channel 2 of the DSP pipe]]. A list of structures in the order the DSP addresses are read from the pipe follows: | The DSP communicates with the application through two shared memory areas 0x8000 bytes long each (at 0x1FF50000 and 0x1FF70000 respectively). The DSP alternates between the use of these two areas (much like a double-buffer). Each area has 15 structures within it. The location of these structures can be obtained by [[DSP:ReadPipe|reading channel 2 of the DSP pipe]]. A list of structures in the order the DSP addresses are read from the pipe follows: | ||
Line 42: | Line 38: | ||
== Frame Count == | == Frame Count == | ||
The frame count of the first region must be even and the frame count of the second region must be odd. | |||
The frame with the higher count is the "current region". | |||
The DSP firmware only responds if the first frame count is 4. | |||
== Input Config == | == Input Config == | ||
Line 123: | Line 125: | ||
| 180 | | 180 | ||
| u16 | | u16 | ||
| | | Format | ||
|- | |- | ||
| 182 | | 182 | ||
Line 136: | Line 138: | ||
| u16 | | u16 | ||
| Buffer Id of embedded buffer | | Buffer Id of embedded buffer | ||
|} | |||
There is a 2 sample delay in this preprocessing stage, likely due to the interpolation step. | |||
=== Format === | |||
This is a u16. | |||
{| class="wikitable" | |||
|- | |||
| Bits | |||
| Desciption | |||
|- | |||
| 0-1 | |||
| Number of channels: 0,1,3 = mono; 2 = stereo | |||
|- | |||
| 2-3 | |||
| Buffer codec: [[BCWAV#Encoding|0:PCM8; 1:PCM16; 2:ADPCM]] | |||
|- | |||
| 5 | |||
| Fade | |||
|} | |} | ||
Line 213: | Line 236: | ||
| 2 | | 2 | ||
| s1.15 | | s1.15 | ||
| a1 | | a1 (negated) | ||
|} | |||
=== Biquad Filter === | |||
This is a [[wikipedia:Digital_biquad_filter|biquadratic filter]]. | |||
{| class="wikitable" | |||
|- | |||
| Offset | |||
| Type | |||
| Description | |||
|- | |||
| 0 | |||
| s2.14 | |||
| a2 (negated) | |||
|- | |||
| 2 | |||
| s2.14 | |||
| a1 (negated) | |||
|- | |||
| 4 | |||
| s2.14 | |||
| b2 | |||
|- | |||
| 6 | |||
| s2.14 | |||
| b1 | |||
|- | |||
| 8 | |||
| s2.14 | |||
| b0 | |||
|} | |} | ||
Line 282: | Line 336: | ||
== DSP status == | == DSP status == | ||
Read only. | Read only. A 32 byte long structure. | ||
{| class="wikitable" | |||
|- | |||
| Offset | |||
| Type | |||
| Description | |||
|- | |||
| 0 | |||
| u16 | |||
| ? | |||
|- | |||
| 2 | |||
| u16 | |||
| Number of dropped frames | |||
|- | |||
| 4 | |||
| 28 bytes | |||
| ? | |||
|} | |||
== Output samples == | == Output samples == | ||
Read only. This structure is | Read only. This structure is 640 bytes long. Output is stereo (the 3DS has two speakers). | ||
{| class="wikitable" | {| class="wikitable" | ||
Line 296: | Line 369: | ||
| 0 | | 0 | ||
| s16[160] | | s16[160] | ||
| Samples | | Left-channel Samples | ||
|- | |||
| 320 | |||
| s16[160] | |||
| Right-channel Samples | |||
|} | |} | ||
This structure has separate arrays for the left and right channels. | |||
== Intermediate mix samples == | == Intermediate mix samples == | ||
Line 303: | Line 382: | ||
Read/Write. | Read/Write. | ||
PCM32. Also serves an aux function, allowing the ARM11 to apply custom effects to audio. | PCM32. Also serves an aux function, allowing the ARM11 to apply custom effects to audio. Internal format of the DSP firmware is quadraphonic audio. | ||
This structure is 5120 bytes long. | This structure is 5120 bytes long. | ||
Line 314: | Line 393: | ||
|- | |- | ||
| 0 | | 0 | ||
| | | IntermediateSample[160] | ||
| Samples | | Samples | ||
|} | |||
In contrast to the final output samples, this structure has the left/right channels interleaved. | |||
=== Intermediate sample === | |||
A quadraphonic sample. | |||
{| class="wikitable" | |||
|- | |||
| Offset | |||
| Type | |||
| Description | |||
|- | |||
| 0 | |||
| s32 | |||
| Left Channel A | |||
|- | |||
| 4 | |||
| s32 | |||
| Right Channel A | |||
|- | |||
| 8 | |||
| s32 | |||
| Left Channel B | |||
|- | |||
| 12 | |||
| s32 | |||
| Right Channel B | |||
|} | |} | ||
Line 321: | Line 429: | ||
A precomputed response curve lookup table for the compressor. | A precomputed response curve lookup table for the compressor. | ||
[[Category:DSP]] |