aacdec: add a decoder for AAC USAC (xHE-AAC)

This commit adds a decoder for the frequency-domain part of USAC.

What works:
 - Mono
 - Stereo (no prediction)
 - Stereo (mid/side coding)
 - Stereo (complex prediction)

What's left:
 - SBR
 - Speech coding

Known issues:
 - Desync with certain sequences
 - Preroll crossover missing (shouldn't matter, bitrate adaptation only)
This commit is contained in:
Lynne
2024-05-16 11:36:12 +02:00
parent 23b45d7e20
commit eee5fa0808
13 changed files with 2510 additions and 76 deletions

View File

@@ -1998,6 +1998,11 @@ const uint8_t ff_tns_max_bands_128[] = {
};
// @}
const uint8_t ff_usac_noise_fill_start_offset[2][2] = {
{ 160, 20 },
{ 120, 15 },
};
const DECLARE_ALIGNED(32, float, ff_aac_eld_window_512)[1920] = {
0.00338834, 0.00567745, 0.00847677, 0.01172641,
0.01532555, 0.01917664, 0.02318809, 0.02729259,
@@ -3895,3 +3900,40 @@ DECLARE_ALIGNED(16, const float, ff_aac_deemph_weights)[16] = {
0,
USAC_EMPH_COEFF,
};
const int ff_aac_usac_samplerate[32] = {
96000, 88200, 64000, 48000, 44100, 32000, 24000, 22050,
16000, 12000, 11025, 8000, 7350, -1, -1, 57600,
51200, 40000, 38400, 34150, 28800, 25600, 20000, 19200,
17075, 14400, 12800, 9600, -1, -1, -1, -1,
};
/* Window type (only long+eight, start/stop/stopstart), sine+sine, kbd+kbd, sine+kbd, kbd+sine */
const float ff_aac_usac_mdst_filt_cur[4 /* Window */][4 /* Shape */][7] =
{
{ { 0.000000, 0.000000, 0.500000, 0.000000, -0.500000, 0.000000, 0.000000 },
{ 0.091497, 0.000000, 0.581427, 0.000000, -0.581427, 0.000000, -0.091497 },
{ 0.045748, 0.057238, 0.540714, 0.000000, -0.540714, -0.057238, -0.045748 },
{ 0.045748, -0.057238, 0.540714, 0.000000, -0.540714, 0.057238, -0.045748 } },
{ { 0.102658, 0.103791, 0.567149, 0.000000, -0.567149, -0.103791, -0.102658 },
{ 0.150512, 0.047969, 0.608574, 0.000000, -0.608574, -0.047969, -0.150512 },
{ 0.104763, 0.105207, 0.567861, 0.000000, -0.567861, -0.105207, -0.104763 },
{ 0.148406, 0.046553, 0.607863, 0.000000, -0.607863, -0.046553, -0.148406 } },
{ { 0.102658, -0.103791, 0.567149, 0.000000, -0.567149, 0.103791, -0.102658 },
{ 0.150512, -0.047969, 0.608574, 0.000000, -0.608574, 0.047969, -0.150512 },
{ 0.148406, -0.046553, 0.607863, 0.000000, -0.607863, 0.046553, -0.148406 },
{ 0.104763, -0.105207, 0.567861, 0.000000, -0.567861, 0.105207, -0.104763 } },
{ { 0.205316, 0.000000, 0.634298, 0.000000, -0.634298, 0.000000, -0.205316 },
{ 0.209526, 0.000000, 0.635722, 0.000000, -0.635722, 0.000000, -0.209526 },
{ 0.207421, 0.001416, 0.635010, 0.000000, -0.635010, -0.001416, -0.207421 },
{ 0.207421, -0.001416, 0.635010, 0.000000, -0.635010, 0.001416, -0.207421 } }
};
/* Window type (everything/longstop+stopstart), sine or kbd */
const float ff_aac_usac_mdst_filt_prev[2 /* Window */][2 /* sine/kbd */][7] =
{
{ { 0.000000, 0.106103, 0.250000, 0.318310, 0.250000, 0.106103, 0.000000 },
{ 0.059509, 0.123714, 0.186579, 0.213077, 0.186579, 0.123714, 0.059509 } },
{ { 0.038498, 0.039212, 0.039645, 0.039790, 0.039645, 0.039212, 0.038498 },
{ 0.026142, 0.026413, 0.026577, 0.026631, 0.026577, 0.026413, 0.026142 } }
};