summaryrefslogtreecommitdiff
path: root/libavcodec/aacsbr_template.c
Commit message (Collapse)AuthorAge
* avcodec/aacdec: print a log message when treating mono HE-AAC as stereoJames Almer2022-07-30
| | | | | | | Since this behavior is intentional, use the VERBOSE level instead of WARNING as it's nothing the user should worry about. Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/vlc: Use structure instead of VLC_TYPE array as VLC elementAndreas Rheinhardt2022-06-17
| | | | | | | | | | | | | | | | | | In C, qualifiers for arrays are broken: const VLC_TYPE (*foo)[2] is a pointer to an array of two const VLC_TYPE elements and unfortunately this is not compatible with a pointer to a const array of two VLC_TYPE, because the latter does not exist as array types are never qualified (the qualifier applies to the base type instead). This is the reason why get_vlc2() doesn't accept a const VLC table despite not modifying the table at all, as there is no automatic conversion from VLC_TYPE (*)[2] to const VLC_TYPE (*)[2]. Fix this by using a structure VLCElem for the VLC table. This also has the advantage of making it clear which element is which. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* all: Replace if (ARCH_FOO) checks by #if ARCH_FOOAndreas Rheinhardt2022-06-15
| | | | | | | | | | | | | | | | | | This is more spec-compliant because it does not rely on dead-code elimination by the compiler. Especially MSVC has problems with this, as can be seen in https://ffmpeg.org/pipermail/ffmpeg-devel/2022-May/296373.html or https://ffmpeg.org/pipermail/ffmpeg-devel/2022-May/297022.html This commit does not eliminate every instance where we rely on dead code elimination: It only tackles branching to the initialization of arch-specific dsp code, not e.g. all uses of CONFIG_ and HAVE_ checks. But maybe it is already enough to compile FFmpeg with MSVC with whole-programm-optimizations enabled (if one does not disable too many components). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/aacps: Factor out code shared by float and fixed point decoderAndreas Rheinhardt2020-12-31
| | | | | | | Saves about 7KiB. Reviewed-by: Lynne <dev@lynne.ee> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/aacsbr_template: Remove pointless runtime initializationAndreas Rheinhardt2020-12-31
| | | | | | | | | | | | | | | | | The sbr_qmf_window_us array is basically symmetric around its middle element and therefore the latter half is currently initialized from the first half at runtime. Yet because the first half is initialized, the array can't be placed in .bss at all, so that one gains nothing from not already initializing the whole array statically. Therefore this commit does exactly this. (There are two exceptions to the symmetry: Elements 384 and 512 are the negations of their mirror element; for the fixed-point decoder, Q31(-x) does not equal -Q31(x). In order to keep the array exactly the same, the latter form has been used for these two elements.) Reviewed-by: Lynne <dev@lynne.ee> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* lavc/aacsbr: fix make checkheaders warningJun Zhao2018-06-10
| | | | | | | move the the function aacsbr_tableinit definition from header file to .c file to fix make checkheaders warning. Signed-off-by: Jun Zhao <mypopydev@gmail.com>
* Merge commit 'ba30b74686f0cb6c9dd465ac4820059c48bf9d08'James Almer2017-09-27
| | | | | | | | | * commit 'ba30b74686f0cb6c9dd465ac4820059c48bf9d08': aac: Validate the sbr sample rate before using the value See cf5f4c5169639349262aa221ae485a0de188afb1 Merged-by: James Almer <jamrial@gmail.com>
* avcodec/aacsbr_template: Do not change bs_num_env before its checkedMichael Niedermayer2017-05-13
| | | | | | | | Fixes: 1489/clusterfuzz-testcase-minimized-5075102901207040 Fixes: out of array access Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/aacsbr_template: Do not leave bs_num_env invalidMichael Niedermayer2017-05-06
| | | | | | | | Fixes out of array read Fixes: 1349/clusterfuzz-testcase-minimized-5370707196248064 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* aacsbr: Turnoff in the event of over read.Alex Converse2017-03-21
| | | | | | | | | | Aliased compressed AAC bytes are almost certainly not meaningful SBR data. In the wild this causes harsh artifacts switching HE-AAC streams that don't have SBR headers aligned with segment boundaries. Turning off SBR falls back to a default set of upsampling parameters that can function as a sort of error concealment. This is consistent with how the decoder handles other sorts of errors.
* Merge commit '42c4c2d2a6dc48adb0e901ef5617acfba0a3a18e'Clément Bœsch2017-03-19
| | | | | | | * commit '42c4c2d2a6dc48adb0e901ef5617acfba0a3a18e': aac: Drop broken cruft Merged-by: Clément Bœsch <u@pkh.me>
* aacsbr: Associate SBR data with AAC elements on initAlex Converse2017-02-13
| | | | | | Quiets some log spam on pure upsampling mode. Fixes ticket 5163.
* aacsbr: reduce element type mismatch warning severityRostislav Pehlivanov2016-06-08
| | | | | | | | | | | | All HE-AAC samples with an LFE channel make this warning get spammed on every frame. Turning off SBR for LFE channels makes sense (since it has much less coefficients than normal channels do), so this error print is of no value in this case. It makes sense to keep the error in other cases, hence why it's still around, degraded to warning severity since the decoder will still attempt to decode without SBR. Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
* avcodec/aacsbr_template: Add Check to read_sbr_envelope()Michael Niedermayer2015-12-12
| | | | | | | The limit is a conservative guess, the spec does not seem to specify a limit Reviewed-by: Andreas Cadhalpun <andreas.cadhalpun@googlemail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/aacsbr: Split the env_facs tableMichael Niedermayer2015-12-12
| | | | | | | This also removes a #ifdef and special case for the fixed point case Reviewed-by: Andreas Cadhalpun <andreas.cadhalpun@googlemail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* sbr_qmf_analysis: sanitize input for 32-bit imdctAndreas Cadhalpun2015-12-11
| | | | | | | | | | | | | If the input contains too many too large values, the imdct can overflow. Even if it didn't, the output would be larger than the valid range of 29 bits. Note that this is a very delicate limit: Allowing values up to 1<<25 does not prevent input larger than 1<<29 from arriving at sbr_sum_square, while limiting values to 1<<23 breaks the fate-aac-fixed-al_sbr_hq_cm_48_5.1 test. Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
* aacsbr: ensure strictly monotone time bordersAndreas Cadhalpun2015-12-11
| | | | | | This fixes a division by zero in the aac_fixed decoder. Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
* aacsbr: don't call sbr_dequant twice without intermediate read_sbr_dataAndreas Cadhalpun2015-11-20
| | | | | | | | Doing that doesn't make sense, because the only purpose of sbr_dequant is to process the data from read_sbr_data. Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
* avcodec/aacsbr_template: Check values read in read_sbr_noise()Michael Niedermayer2015-11-19
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/aacsbr: Split pre dequantization noise factors tableMichael Niedermayer2015-11-19
| | | | | | | This allows removing a special case for the fixed point decoder and will make error checks simpler Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/aacsbr: Use FLOAT_0Michael Niedermayer2015-11-08
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/aacsbr_template: replace qsort with AV_QSORTGanesh Ajjanagadde2015-11-04
| | | | | | | | | | | | | | When sbr->reset is set in encode_frame, a bunch of qsort calls might get made. Thus, there is the potential of calling qsort whenever the spectral contents change. AV_QSORT is substantially faster due to the inlining of the comparison callback. Thus, the increase in performance should be worth the increase in binary size. Tested with FATE. Reviewed-by: Rostislav Pehlivanov <atomnuker@gmail.com> Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
* avcodec: Implementation of AAC_fixed_decoder (PS-module)Djordje Pesut2015-07-22
| | | | | | | Add fixed point implementation. Signed-off-by: Nedeljko Babic <nedeljko.babic@imgtec.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec: Implementation of AAC_fixed_decoder (SBR-module)Djordje Pesut2015-07-20
| | | | | | | Add fixed poind code. Signed-off-by: Nedeljko Babic <nedeljko.babic@imgtec.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec: Template creation for AAC decoder (SBR-module)Djordje Pesut2015-07-20
Move the existing code to a new template file. Signed-off-by: Nedeljko Babic <nedeljko.babic@imgtec.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>