Commit Graph

16 Commits

Author SHA1 Message Date
Andreas Rheinhardt 9de66fd449
avcodec/aacdec_template: Deduplicate common part of aac_decode_init()
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-04-23 08:31:30 +02:00
Andreas Rheinhardt fc3c2ea8dc
avcodec/aacdec: PredictorState array out of SingleChannelElement
sizeof(PredictorState) is different for the floating-point and
the fixed-point AAC decoders; this is an obstacle for deduplicating
code between these decoders. So don't include this array in
SingleChannelElement, instead add a union of pointers to the
fixed-point PredictorState and the floating-point PredictorState.
The actual arrays are part of the extended ChannelElement
to be allocated by ff_aac_sbr_ctx_alloc_init(); it also
sets the pointers.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-04-23 08:31:28 +02:00
Andreas Rheinhardt aaf26cffba avcodec/lpc: Split inline functions into a header of their own
And move compute_ref_coefs() to its only user: lpc.c
There is no overlap between the users of compute_lpc_coefs()
and lpc proper.

Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-04 02:11:38 +01:00
Andreas Rheinhardt 08aa791d20 avcodec/lpc: Don't use AAC defines directly
It leads to defines for the AAC decoder being included
outside of the AAC decoder.

Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-04 02:11:19 +01:00
Andreas Rheinhardt 7252e4f8ee avcodec/aac_defines: Remove unused AAC_RENAME_32
Unused since fbe6a51b11.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-01-30 20:43:48 +01:00
Lynne 469cd8d7fa
aacdec: convert to lavu/tx and support fixed-point 960-sample decoding
This patch replaces the transform used in AAC with lavu/tx and removes
the limitation on only being able to decode 960-sample files
with the float decoder.
This commit also removes a whole bunch of unnecessary and slow
lifting steps the decoder did to compensate for the poor accuracy
of the old integer transformation code.

Overall float decoder speedup on Zen 3 for 64kbps: 32%
2022-11-06 14:39:33 +01:00
Andreas Rheinhardt 211619ad7f avcodec: Remove the FFT_FIXED_32 define
Since the removal of the 16-bit FFT said define is unnecessary as
FFT_FIXED_32 is always !FFT_FLOAT. But one wouldn't believe it when
looking at the code.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-08-05 19:46:33 +02:00
Andreas Rheinhardt 698a4b22d0 avcodec/aacdec_fixed: Move fixed-point sinewin tables to its only user
The fixed-point AAC decoder is the only user of the fixed-point sinewin
tables from sinewin; and it only uses a few of them (about 10% when
counting by size). This means that guarding initializing these tables by
an AVOnce (as done in 3719122065) is
unnecessary for them. Furthermore the array of pointers to the
individual arrays is also unneeded.

Therefore this commit moves these tables directly into aacdec_fixed.c;
this is done by ridding the original sinewin.h and sinewin_tablegen.h
headers completely of any fixed-point code at the cost of a bit of
duplicated code (the alternative is an ugly ifdef-mess).

This saves about 58KB from the binary when using hardcoded tables (as
these tables are hardcoded in this scenario); when not using hardcoded
tables, most of these savings only affect the .bss segment, but the rest
(< 1KB) contains relocations (i.e. savings in .data.rel.ro).

Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-02-07 10:28:29 +01:00
Andreas Rheinhardt fc5d22abe4 avcodec/aacdec, aactab: Move kbd tables to their only user
The floating point kbd tables for 120 and 960 samples are only used by
the floating point decoder whereas the fixed point kbd tables for 128
and 1024 samples are only used by the fixed point AAC decoder. So move
these tables to their only users. This ensures that they are not
accidentally used somewhere else without ensuring that initializing
these tables stays thread-safe (as it is now because the only place from
where they are initialized is guarded by an AVOnce).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-12-08 17:51:48 +01:00
Michael Niedermayer 0ef8f03133 avcodec/aacdec_template: Fix undefined integer overflow in apply_tns()
Fixes: runtime error: signed integer overflow: -2147483648 - 1202286525 cannot be represented in type 'int'
Fixes: 2071/clusterfuzz-testcase-minimized-6036414271586304

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-07-16 01:07:27 +02:00
Michael Niedermayer 872bac8159 avcodec/aac_defines: Add missing () to AAC_HALF_SUM() macro
Fixes: runtime error: shift exponent 1073741848 is too large for 32-bit type 'INTFLOAT' (aka 'int')
Fixes: 1880/clusterfuzz-testcase-minimized-4900645322620928

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-05-28 21:20:28 +02:00
Michael Niedermayer c3547dcbc3 avcodec/aac_defines: Fix: runtime error: left shift of negative value -2
Fixes: 1716/clusterfuzz-testcase-minimized-4691012196761600

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-05-21 02:56:47 +02:00
Marton Balint 67bef4cffa avcodec/aactab: do not use floats for constants
This may improve the precision of the fixed point encoder/decoder for some
compilers and architectures.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Marton Balint <cus@passwd.hu>
2016-03-15 00:47:38 +01:00
Ganesh Ajjanagadde 5472de5ca8 avcodec/aac_defines: replace #define by typedef
See e.g https://stackoverflow.com/questions/1666353/are-typedef-and-define-the-same-in-c
for rationale.

Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
2015-11-24 20:36:40 -05:00
Djordje Pesut 5fd81cf6f0 avcodec: Implementation of AAC_fixed_decoder (PS-module)
Add fixed point implementation.

Signed-off-by: Nedeljko Babic <nedeljko.babic@imgtec.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-07-22 21:51:28 +02:00
Djordje Pesut f85bc147fb avcodec: Implementation of AAC_fixed_decoder (SBR-module)
Add fixed poind code.

Signed-off-by: Nedeljko Babic <nedeljko.babic@imgtec.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-07-20 17:20:16 +02:00