aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/ac3dec.c
Commit message (Collapse)AuthorAgeFilesLines
* avcodec/ac3_parser: handle more header bits in ff_ac3_parse_header()James Almer2025-06-081-68/+20
| | | | | | Based on a patch by nyanmisaka. Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/ac3dec: Deduplicate tablesAndreas Rheinhardt2025-06-021-40/+4
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/ac3{dec,enc}: Deduplicate gain levels tableAndreas Rheinhardt2025-06-021-24/+12
| | | | | | (I don't know why the encoder only uses eight of the nine values.) Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/ac3dec: Deduplicate mantissas and their init codeAndreas Rheinhardt2025-06-021-69/+23
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/ac3dec: Hardcode tables to save spaceAndreas Rheinhardt2025-06-021-14/+2
| | | | | | | | | | | | | | The code to initialize the ungrouped bap mantissa tables (bap 3 or 5) takes more bytes of .text than the tables itself; they have therefore been hardcoded. For GCC (14, -O3, albeit in an av_cold function), the initialization code takes 99B each for the fixed and floating point decoders (the code is currently duplicated), whereas the hardcoded tables only take 96B. For Clang 19 it were 374B each (I don't now what Clang was doing there). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/ac3dec: Read spx flags at once, not one bit at a timeAndreas Rheinhardt2025-04-021-4/+6
| | | | | | | | | Doing so gets rid of a stupid GCC -Wstringop-overflow= warning (GCC somehow believes that fbw_channels can be 7 with the old form of the code, so that channel_uses_spx[7] would be written to, but now it no longer believes so). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/ac3dec: add a flush callback for the ac3 and eac3 decodersJames Almer2025-02-121-0/+10
| | | | | | Fixes ticket #10732 Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/ac3dec: only export matrix encoding and downmix info side data when ↵James Almer2025-01-191-5/+8
| | | | | | | | | | necessary Don't export a matrix encoding side data when there's none signaled. And if downmixing was handled by the decoder itself, then the downmix info does not apply to the frame. Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/ac3dec: don't override existing downmix coefficient with default onesJames Almer2025-01-191-2/+4
| | | | | | | | With this, if the eac3 dependent frame doesn't have coded downmix values when parsed by ff_eac3_parse_header(), it will inherit the coded ones from the core ac3 frame instead of ignoring them. Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/ac3dec: set preferred_stereo_downmix using the relevant coded valueJames Almer2024-12-311-0/+14
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/ac3dec: set ltrt_center_mix and ltrt_surround_mix using the relevant ↵James Almer2024-12-311-2/+2
| | | | | | coded values Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/ac3dec: fix downmix logic for eac3James Almer2024-11-251-1/+1
| | | | | | | | | Ensure downmixed is only set once during init, as it used to be. Fixes a regression since acbb2777e28c. Fixes ticket #11321 Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/aac_ac3_parser: Untangle AAC and AC3 parsing error codesAndreas Rheinhardt2024-05-201-10/+8
| | | | | | | | | Also remove the (unused) AAC_AC3_PARSE_ERROR_CHANNEL_CFG while at it; furthermore, fix the documentation of ff_ac3_parse_header() and (ff|avpriv)_adts_header_parse(). Reviewed-by: Andrew Sayers <ffmpeg-devel@pileofstuff.org> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avutil/common: Don't auto-include mem.hAndreas Rheinhardt2024-03-311-0/+1
| | | | | | | | | | | There are lots of files that don't need it: The number of object files that actually need it went down from 2011 to 884 here. Keep it for external users in order to not cause breakages. Also improve the other headers a bit while just at it. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* Revert "avcodec: Rename ff_kbd_window_init() as it will be needed from ↵Andreas Rheinhardt2024-03-071-1/+1
| | | | | | | | | | | | | | | | | | outside libavcodec" This reverts commits fd5aa93a37b3fa21195c6d7b22ef655124020e09 and cf00f60bab1f79213c274a6cd4357b32bd5c0101 ("avcodec/kbdwin: Support arbitrary sized windows"). The change in question has only been made for libavradio. in anticipation of merging it into the main tree. This has not happened, so this commit reverts the changes to kbdwin that are not used for anything else. In particular, these functions are no longer exported (as avpriv functions); notice that the fixed-point function has been exported despite having never been used outside of lavc. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avutil: remove deprecated FF_API_OLD_CHANNEL_LAYOUTJames Almer2024-03-071-8/+0
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/defs: Add AV_PROFILE_* defines, deprecate FF_PROFILE_* definesAndreas Rheinhardt2023-09-071-1/+1
| | | | | | | | | These defines are also used in other contexts than just AVCodecContext ones, e.g. in libavformat. Furthermore, given that these defines are public, the AV-prefix is the right one, so deprecate (and not just move) the FF-macros. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec: Rename ff_kbd_window_init() as it will be needed from outside ↵Michael Niedermayer2023-07-221-1/+1
| | | | | | libavcodec Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/eac3dec: add detection of Atmos spatial extension profileMarth642023-03-021-0/+1
| | | | Signed-off-by: Marth64 <marth64@proxyid.net>
* lavc/ac3dec: fail when the sample rate is unsetAnton Khirnov2023-01-101-0/+5
|
* ac3: convert to lavu/txLynne2022-11-061-9/+13
|
* avcodec/ac3dec: split off code discarding garbage at the beginning of a packetJames Almer2022-10-261-13/+2
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/ac3dsp: Remove unused parameterAndreas Rheinhardt2022-09-291-1/+1
| | | | | | Forgotten in fd98594a8831ce037a495b6d7e090bd8f81e83a1. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/fmtconvert: Remove unused AVCodecContext parameterAndreas Rheinhardt2022-09-211-1/+1
| | | | | | | Unused since d74a8cb7e42f703be5796eeb485f06af710ae8ca. Reviewed-by: Rémi Denis-Courmont <remi@remlab.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/ac3dec: add downmix support for mono and stereo for eac3 7.1Paul B Mahol2022-09-211-23/+32
|
* avcodec/internal: Move ff_side_data_update_matrix_encoding to decode.hAndreas Rheinhardt2022-08-271-1/+0
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/internal: Move ff_get_buffer() to decode.hAndreas Rheinhardt2022-08-271-0/+1
| | | | | | | | | Only used by decoders (encoders have ff_encode_alloc_frame()). Also clean up the other headers a bit while removing now redundant internal.h inclusions. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/ac3: Move non-(de|en)coder-only parts out of ac3.hAndreas Rheinhardt2022-05-151-0/+1
| | | | | | | | | | Move AC3HeaderInfo into ac3_parser_internal.h and the rest into a new header ac3defs.h. This also breaks an include cycle of ac3.h and ac3tab.h (the latter now only needs ac3defs.h). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/codec_internal: Make FFCodec.decode use AVFrame*Andreas Rheinhardt2022-04-051-2/+1
| | | | | | | | This increases type-safety by avoiding conversions from/through void*. It also avoids the boilerplate "AVFrame *frame = data;" line for non-subtitle decoders. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* configure: Use a separate config_components.h header for $ALL_COMPONENTSMartin Storsjö2022-03-161-0/+2
| | | | | | | | This avoids unnecessary rebuilds of most source files if only the list of enabled components has changed, but not the other properties of the build, set in config.h. Signed-off-by: Martin Storsjö <martin@martin.st>
* ac3: convert to new channel layout APIVittorio Giovara2022-03-151-20/+37
| | | | | | 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/ac3tab: Unavpriv ac3_channel_layout_tabAndreas Rheinhardt2022-01-041-2/+2
| | | | | | | | | | | | | | | | | It is small (16 B) and therefore the overhead of exporting it more than outweighs the size savings from not having duplicated symbols: When the symbol is no longer avpriv, one saves twice the size of the string containing the symbols name (2x30 byte), two entries in .dynsym (24 bytes each on x64), one entry in the importing libraries .got and .rela.dyn (8 + 24 bytes on x64) and two entries for the symbol version (2 bytes each) and one hash value in the exporting library (4 bytes). (The exact numbers are of course different for other platforms (e.g. when using dlls), but given that the strings saved alone more than outweigh the array size it can be presumed that this is beneficial for all platforms.) Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/ac3dec: Make decoders init-threadsafeAndreas Rheinhardt2021-01-091-1/+4
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/ac3dec: Check operations that can failAndreas Rheinhardt2021-01-091-4/+7
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/ac3: Explicitly return to discard large amounts of nonsense bytesMichael Niedermayer2019-02-071-0/+2
| | | | | | | | | | | Changes 19sec to 10ms (12559) runtime, 17sec to 177ms (12570) Fixes: Timeout Fixes: 12559/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AC3_fuzzer-5666516266123264 Fixes: 12561/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AC3_FIXED_fuzzer-5682923041193984 Fixes: 12570/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_EAC3_fuzzer-5194734308425728 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/ac3dec: Optimize frame start searchMichael Niedermayer2019-01-161-6/+14
| | | | | | | | | | | | | Fixes: Timeout Fixes: 11619/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AC3_FIXED_fuzzer-5632398021099520 Fixes: 11620/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AC3_fuzzer-5711996515778560 Fixes: 11658/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_EAC3_fuzzer-5701006524940288 Before: Executed clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AC3_FIXED_fuzzer-5632398021099520 in 20338 ms After: Executed clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AC3_FIXED_fuzzer-5632398021099520 in 11825 ms Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* libavcodec/ac3dec.c: Avoid unspecific -1 error codeMichael Niedermayer2019-01-011-1/+1
| | | | | Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/ac3dec: always skip junk bytes before sync bytesPaul B Mahol2018-11-301-3/+17
| | | | Fixes #7278.
* avcodec/ac3dec: Fix shift signedness in mask creationMichael Niedermayer2018-09-221-2/+2
| | | | | | | | Fixes: 9924/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_EAC3_fuzzer-5473421772193792 Fixes: left shift of 1 by 63 places cannot be represented in type 'long long' Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/eac3dec: Check that channel_map does not contain more than ↵Michael Niedermayer2018-09-221-23/+4
| | | | | | EAC3_MAX_CHANNELS Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/ac3dec: Check channel_map indexMichael Niedermayer2018-07-041-0/+7
| | | | | | | | Fixes: out of array read Fixes: 8924/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_EAC3_fuzzer-5851861780267008 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/ac3dec: Check that the number of channels with dependant streams is ↵Michael Niedermayer2018-05-271-0/+5
| | | | | | | | | | | valid Fixes: left shift of 1 by 63 places cannot be represented in type 'long long' Fixes: out of array access Fixes: 7284/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AC3_fuzzer-5767914968842240 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/ac3dec: Fix null pointer dereference in ac3_decode_frame()Michael Niedermayer2018-05-271-1/+3
| | | | | | | | Fixes: index 8 out of bounds for type 'uint8_t *[8]' Fixes: 7273/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_EAC3_fuzzer-6296497667702784 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/ac3dec: Use frame_size if superframe_size is 0Michael Niedermayer2018-05-261-0/+3
| | | | | | | | | | Fixes: Infinite loop Fixes: 7669/clusterfuzz-testcase-ffmpeg_AV_CODEC_ID_AC3_FIXED_fuzzer-4689042185650176 Fixes: 7670/clusterfuzz-testcase-ffmpeg_AV_CODEC_ID_AC3_fuzzer-4706306762997760 Fixes: 7672/clusterfuzz-testcase-ffmpeg_AV_CODEC_ID_EAC3_fuzzer-4702108499574784 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/ac3: fix out of array access introduced previouslyPaul B Mahol2018-03-301-5/+5
| | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* avcodec/eac3: add support for dependent streamPaul B Mahol2018-03-291-34/+145
| | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* Merge commit '50a1c66cf6ab7eb683daaa9e2da3869fa3a54609'James Almer2017-10-271-3/+3
|\ | | | | | | | | | | | | | | | | | | | | * commit '50a1c66cf6ab7eb683daaa9e2da3869fa3a54609': ac3_parser: add a public function for parsing the data required by the demuxer avpriv_ac3_parse_header() is left in place but without the GetBitContext parameter, as the mov muxer requires a lot more fields than just bitstream_id and frame_size from the AC3HeaderInfo struct. Merged-by: James Almer <jamrial@gmail.com>
| * ac3_parser: add a public function for parsing the data required by the demuxerAnton Khirnov2017-04-121-2/+2
| | | | | | | | | | | | Make the current semi-public avpriv_ac3_parse_header() private to lavc. Signed-off-by: Diego Biurrun <diego@biurrun.de>
* | avcodec/ac3dec: Fix: runtime error: index -1 out of bounds for type ↵Michael Niedermayer2017-05-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | 'INTFLOAT [2]' It seems dual mono with a LFE channel is not forbidden Fixes: 1570/clusterfuzz-testcase-minimized-6455337349545984 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec/ac3dec: Keep track of band structureMichael Niedermayer2017-05-131-12/+15
| | | | | | | | | | | | | | | | | | It is needed in some corner cases that seem not to be forbidden Fixes: out of array index Fixes: 1538/clusterfuzz-testcase-minimized-4696904925446144 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>