1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-01-19 05:49:09 +02:00

19 Commits

Author SHA1 Message Date
Lynne
eee5fa0808
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)
2024-06-02 18:34:45 +02:00
Lynne
0513c5cd25
aacdec_dsp: implement 768-point transform and windowing
Required for USAC
2024-06-02 18:34:44 +02:00
Lynne
39b8d84b53
aacdec: move from scalefactor ranged arrays to flat arrays
AAC uses an unconventional system to send scalefactors
(the volume+quantization value for each band).
Each window is split into either 1 or 8 blocks (long vs short),
and transformed separately from one another, with the coefficients
for each being also completely independent. The scalefactors
slightly increase from 64 (long) to 128 (short) to accomodate
better per-block-per-band volume for each window.

To reduce overhead, the codec signals scalefactor sizes in an obtuse way,
where each group's scalefactor types are sent via a variable length decoding,
with a range.
But our decoder was written in a way where those ranges were carried through
the entire decoder, and to actually read them you had to use the range.

Instead of having a dedicated array with a range for each scalefactor,
just let the decoder directly index each scalefactor.

This also switches the form of quantized scalefactors to the format
the spec uses, where for intensity stereo and regular, scalefactors
are stored in a scalefactor - 100 form, rather than as-is.

USAC gets rid of the complex scalefactor handling. This commit permits
for code sharing between both.
2024-06-02 18:34:43 +02:00
Andreas Rheinhardt
f5d2dc7b4b avcodec/aac/aacdec_(fixed|float): Set AACDecDSP, AACDecProc directly
This is more in line with how we initialize DSP functions
and avoids tables of function pointers as well as relocations
for these.

Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-05-07 00:02:57 +02:00
Andreas Rheinhardt
8762aa4d62 avcodec/aac/aacdec: Move init functions to aacdec_fixed/float
This allows to merge it with AACDecDSP.init and remove the latter
(it is called only once anyway); it also allows to make
the fixed/float AACDecDSP and AACDecProc implementations internal
to aacdec_fixed/float.c (which also fixes a violation of our
naming conventions). And it some linker errors when either decoder
is disabled.

Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-05-07 00:01:39 +02:00
Lynne
551ce16b59
aacdec: move aacdec.h into libavcodec/aac 2024-04-23 08:31:40 +02:00
Lynne
2f90d83981
aacdec: move fixed/float DSP initialization to templated init functions 2024-04-23 08:31:38 +02:00
Lynne
49e7be1e37
aacdec: move prediction to separate files 2024-04-23 08:31:37 +02:00
Lynne
41c04bec0a
aacdec: move fixed-point clipping to a separate function 2024-04-23 08:31:36 +02:00
Lynne
87a93a5670
aacdec: split off channel coupling into a new file 2024-04-23 08:31:36 +02:00
Lynne
41ae2b03a5
aacdec: move spectrum decode and dequantization to a new file 2024-04-23 08:31:35 +02:00
Lynne
eef9100a8e
aacdec: template LTP windowing separately
The function is called only internally in DSP, so we do not
need to expose it.

apply_ltp on MIPS uses this function, but due to the function
being just a glue function with no real optimizations,
duplicate it there.
2024-04-23 08:31:35 +02:00
Lynne
091d85217d
aacdec: template windowing and transforms separately 2024-04-23 08:31:34 +02:00
Lynne
a309aa4127
aacdec: duplicate table initialization
Preparation to move all table init and support windowing functions.
2024-04-23 08:31:34 +02:00
Lynne
e9fc7661da
aacdec: template LTP application separately 2024-04-23 08:31:33 +02:00
Lynne
db5128ef70
aacdec: template TNS application separately 2024-04-23 08:31:33 +02:00
Lynne
ad16349f9b
aacdec: template intensity stereo application separately 2024-04-23 08:31:33 +02:00
Lynne
9f3fa77e0d
aacdec: template mid/side stereo application separately 2024-04-23 08:31:32 +02:00
Lynne
a6295586f5
aacdec: template scalefactor dequantization separately 2024-04-23 08:31:32 +02:00