aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/aacdec_fixed.c
Commit message (Collapse)AuthorAgeFilesLines
* aacdec: fully detemplate decoder coreLynne2024-04-231-102/+0
|
* aacdec: reuse TNS and LTP tables between fixed and float decodersLynne2024-04-231-50/+0
| | | | The fixed decoder derives the values from floats anyway.
* aacdec: move prediction to separate filesLynne2024-04-231-116/+0
|
* aacdec: split off channel coupling into a new fileLynne2024-04-231-112/+0
|
* aacdec: deduplicate table initizalizationLynne2024-04-231-2/+0
| | | | All tables now initialized by aac/aacdec_fixed|float
* aacdec: move spectrum decode and dequantization to a new fileLynne2024-04-231-130/+0
|
* aacdec: template LTP application separatelyLynne2024-04-231-4/+4
|
* avcodec/aacdec_template: Deduplicate common part of aac_decode_init()Andreas Rheinhardt2024-04-231-1/+0
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/aacdec_template: Deduplicate AVClass+AVOptionsAndreas Rheinhardt2024-04-231-2/+1
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/aacdec_template: Deduplicate aac_decode_close()Andreas Rheinhardt2024-04-231-1/+1
| | | | | | | This is possible now that both AAC decoders share the same context. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/aacdec: Use same AACDecContext for fixed and floatAndreas Rheinhardt2024-04-231-4/+4
| | | | | | | | | | | | | | | | | | Up until now, there was one AACDecContext for the fixed and one for the floating point decoder. These differed mostly in certain arrays which were int for the fixed-point and float for the floating point decoder; there were also differences in corresponding function pointers. Yet in order to deduplicate the enormous amount of currently duplicated code between the float and the fixed-point decoder, one needs common contexts. Given that int and float have the same size on all common systems, this commit replaces these arrays by unions of int arrays and of float arrays. The names of these arrays have been chosen to be compatible with AAC_RENAME(). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/aacsbr: Make ff_aac_sbr_* funcs accept ChannelElement*Andreas Rheinhardt2024-04-231-1/+0
| | | | | | | | | | | | | | | | | | | | | | Each ChannelElement contains exactly one SpectralBandReplication structure; the latter structure contains lots of buffers whose size depend upon USE_FIXED (i.e. AAC_FLOAT arrays). This complicates deduplicating the parts of the AAC decoder that are duplicated between the fixed-point and the floating point decoder. In order to fix this, the SpectralBandReplication structure will be moved from the part of ChannelElement visible to the common code. Therefore the ff_aac_sbr_* functions are ported to accept a ChannelElement*; they will then have to translate that to the corresponding SpectralBandReplication* themselves (which is possible, because there are floating-point and fixed-point versions of these functions). While just at it, also ensure that these functions are properly namespaced. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* aacdec: move aacdec_common to aac/aacdec_tabLynne2024-04-231-1/+1
| | | | | Start to clean up the decoder. Also renames a confusingly named file.
* avutil: remove deprecated FF_API_OLD_CHANNEL_LAYOUTJames Almer2024-03-071-1/+0
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/aactab: Deduplicate ltp_coef and tns_tmp2_map tablesAndreas Rheinhardt2024-03-041-0/+43
| | | | | | | This will allow to make aac_defines.h decoder-only. Reviewed-by: Lynne <dev@lynne.ee> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/lpc: Split inline functions into a header of their ownAndreas Rheinhardt2024-03-041-1/+0
| | | | | | | | | 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>
* avcodec/lpc: Don't use AAC defines directlyAndreas Rheinhardt2024-03-041-1/+1
| | | | | | | | 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>
* avcodec/aacdec: Rename AACContext to AACDecContextAndreas Rheinhardt2024-02-271-3/+3
| | | | | | | | | | It is decoder-only; furthermore, there is already an AACContext in use by libfdk-aacenc. Also make aacdec.h provide the typedef for AACContext; up until now, this has been done by sbr.h. Reviewed-by: Lynne <dev@lynne.ee> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avocdec/aac: Move decoder-only stuff to new header aacdec.hAndreas Rheinhardt2024-02-271-0/+1
| | | | | | | AACContext is not used by the encoder at all. Reviewed-by: Lynne <dev@lynne.ee> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/aacdectab: Deduplicate common decoder tablesAndreas Rheinhardt2023-10-311-2/+2
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* aacdec: convert to lavu/tx and support fixed-point 960-sample decodingLynne2022-11-061-2/+3
| | | | | | | | | | | 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%
* avcodec/codec_internal: Avoid deprecation warnings for channel_layoutsAndreas Rheinhardt2022-09-281-3/+1
| | | | | | | | | | | | | | | | | | AVCodec.channel_layouts is deprecated and Clang (unlike GCC) warns when setting this field in a codec definition. Fortunately, Clang (unlike GCC) allows to use FF_DISABLE_DEPRECATION_WARNINGS inside a definition (of an FFCodec), so that one can create simple macros to set AVCodec.channel_layouts that also suppress deprecation warnings for Clang. (Notice that some of the codec definitions were already inside FF_DISABLE/ENABLE_DEPRECATION_WARNINGS (that were not guarded by FF_API_OLD_CHANNEL_LAYOUT); these have been removed. Also notice that setting AVCodec.channel_layouts was not guarded by FF_API_OLD_CHANNEL_LAYOUT either, so testing disabling it it without removing all the codeblocks would not have worked.) Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/codec_internal: Add macro to set AVCodec.long_nameAndreas Rheinhardt2022-09-031-1/+1
| | | | | | | | It reduces typing: Before this patch, there were 105 codecs whose long_name-definition exceeded the 80 char line length limit. Now there are only nine of them. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/aacdec_fixed: add missing priv_classJames Almer2022-08-011-0/+1
| | | | | | This enables the same input options as the float decoder. Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec: Make init-threadsafety the defaultAndreas Rheinhardt2022-07-181-1/+1
| | | | | | | | | | | and remove FF_CODEC_CAP_INIT_THREADSAFE All our native codecs are already init-threadsafe (only wrappers for external libraries and hwaccels are typically not marked as init-threadsafe yet), so it is only natural for this to also be the default state. Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/codec_internal: Use union for FFCodec decode/encode callbacksAndreas Rheinhardt2022-04-051-1/+1
| | | | | | | | | | | This is possible, because every given FFCodec has to implement exactly one of these. Doing so decreases sizeof(FFCodec) and therefore decreases the size of the binary. Notice that in case of position-independent code the decrease is in .data.rel.ro, so that this translates to decreased memory consumption. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/codec_internal: Add FFCodec, hide internal part of AVCodecAndreas Rheinhardt2022-03-211-10/+10
| | | | | | | | | | | | | | | | Up until now, codec.h contains both public and private parts of AVCodec. This exposes the internals of AVCodec to users and leads them into the temptation of actually using them and forces us to forward-declare structures and types that users can't use at all. This commit changes this by adding a new structure FFCodec to codec_internal.h that extends AVCodec, i.e. contains the public AVCodec as first member; the private fields of AVCodec are moved to this structure, leaving codec.h clean. Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/internal: Move FF_CODEC_CAP_* to a new header codec_internal.hAndreas Rheinhardt2022-03-211-1/+1
| | | | | | | | | | Also move FF_CODEC_TAGS_END as well as struct AVCodecDefault. This reduces the amount of files that have to include internal.h (which comes with quite a lot of indirect inclusions), as e.g. most encoders don't need it. It is furthemore in preparation for moving the private part of AVCodec out of the public codec.h. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* aac: convert to new channel layout APIAnton Khirnov2022-03-151-0/+3
| | | | | | Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com> Signed-off-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec: Remove the FFT_FIXED_32 defineAndreas Rheinhardt2021-08-051-1/+0
| | | | | | | | 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>
* avcodec: Constify AVCodecsAndreas Rheinhardt2021-04-271-1/+1
| | | | | | | | | | Given that the AVCodec.next pointer has now been removed, most of the AVCodecs are not modified at all any more and can therefore be made const (as this patch does); the only exceptions are the very few codecs for external libraries that have a init_static_data callback. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/aacdec_fixed: Move fixed-point sinewin tables to its only userAndreas Rheinhardt2021-02-071-3/+3
| | | | | | | | | | | | | | | | | | | | | | 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 3719122065863f701026632f610175980d42b05a) 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>
* avcodec/aacdec, aactab: Move kbd tables to their only userAndreas Rheinhardt2020-12-081-0/+3
| | | | | | | | | | | | 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>
* avcodec/aacdec_fixed: Limit index in vector_pow43()Michael Niedermayer2020-10-181-2/+2
| | | | | | | | Fixes: out of array access Fixes: 26087/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AAC_FIXED_fuzzer-5724825462767616 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/aacdec_fixed: Add FF_CODEC_CAP_INIT_CLEANUPMichael Niedermayer2019-09-241-1/+1
| | | | | | | | Fixes: memleaks Fixes: 16788/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AAC_FIXED_fuzzer-5649873898045440 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/aacdec_fixed: Handle more extreem cases in noise_scale()Michael Niedermayer2019-06-041-4/+9
| | | | | | | | | Its unclear if these cases have any relevance in real files Fixes: shift exponent -2 is negative Fixes: 14489/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AAC_FIXED_fuzzer-5681941631729664 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/aacdec_fixed: ssign seems always -1 in noise_scale(), simplifyMichael Niedermayer2019-06-041-4/+4
|
* avcodec/aacdec_fixed: Fix undefined shift in noise_scale()Michael Niedermayer2019-04-251-1/+1
| | | | | | | Fixes: 13655/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AAC_FIXED_fuzzer-5120559430500352 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/aacdec_fixed: Provide context to av_log()Michael Niedermayer2019-01-011-2/+2
| | | | | Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/aacdec_fixed: Fix undefined integer overflow in ↵Michael Niedermayer2018-06-151-1/+1
| | | | | | | | | | apply_independent_coupling_fixed() Fixes: signed integer overflow: 1195517 * 2048 cannot be represented in type 'int' Fixes: 8636/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AAC_FIXED_fuzzer-4695836326887424 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/aacdec_fixed: use 64bit to avoid overflow in rounding in ↵Michael Niedermayer2018-05-271-1/+1
| | | | | | | | | | apply_dependent_coupling_fixed() Fixes: signed integer overflow: -2141499320 + -14469590 cannot be represented in type 'int' Fixes: 7351/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AAC_FIXED_fuzzer-6351214791884800 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/aacdec_fixed: Fix integer overflow in apply_independent_coupling_fixed()Michael Niedermayer2018-04-021-1/+1
| | | | | | | | I was not able to reproduce this, this fix is based on just the fuzzer log. Fixes: 4959/clusterfuzz-testcase-minimized-6035350934781952 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/aacdec_fixed: Fix undefined shiftMichael Niedermayer2017-11-131-1/+1
| | | | | | | | Fixes: runtime error: left shift of negative value -801112064 Fixes: 3492/clusterfuzz-testcase-minimized-5784775283441664 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* Merge commit 'b5f19f7478492307e4b4763aeac3180faf50e17f'James Almer2017-10-301-1/+1
| | | | | | | * commit 'b5f19f7478492307e4b4763aeac3180faf50e17f': aac: Split function to parse ADTS header data into public and private part Merged-by: James Almer <jamrial@gmail.com>
* avcodec/aacdec_fixed: Fix integer overflow in apply_dependent_coupling_fixed()Michael Niedermayer2017-10-301-1/+1
| | | | | | | | Fixes: runtime error: signed integer overflow: 623487 * 536870912 cannot be represented in type 'int' Fixes: 3594/clusterfuzz-testcase-minimized-4650622935629824 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/aacdec_fixed: Fix integer overflow in predict()Michael Niedermayer2017-10-301-2/+2
| | | | | | | | Fixes: runtime error: signed integer overflow: -2110708110 + -82837504 cannot be represented in type 'int' Fixes: 3547/clusterfuzz-testcase-minimized-6009386439802880 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/aacdec_fixed: fix invalid shift in predict()Michael Niedermayer2017-08-051-2/+6
| | | | | | | | Fixes: runtime error: shift exponent -2 is negative Fixes: 2818/clusterfuzz-testcase-minimized-5062943676825600 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/aacdec_fixed: fix: left shift of negative value -1Michael Niedermayer2017-07-241-1/+1
| | | | | | | Fixes: 2699/clusterfuzz-testcase-minimized-5631303862976512 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/aacdec_fixed: Check s for being too smallMichael Niedermayer2017-06-191-2/+3
| | | | | | | | Fixes: runtime error: shift exponent -8 is negative Fixes: 2286/clusterfuzz-testcase-minimized-5711764169687040 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/aacdec_fixed: Fix runtime error: left shift of negative value -1297616Michael Niedermayer2017-06-111-1/+1
| | | | | | | Fixes: 2195/clusterfuzz-testcase-minimized-4736721533009920 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>