summaryrefslogtreecommitdiff
path: root/libavcodec/mpegaudiodec_template.c
Commit message (Collapse)AuthorAge
* avcodec/codec_internal: Make FFCodec.decode use AVFrame*Andreas Rheinhardt2022-04-05
| | | | | | | | 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-16
| | | | | | | | 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>
* mpegaudio: convert to new channel layout APIAnton Khirnov2022-03-15
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/mpegaudiodec_template: Remove unused variableAndreas Rheinhardt2021-10-02
| | | | | | | Unused since 9ab0874ea8b6774c6f5470dba2b5b4615a610d0d. Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* lavu/mem: move the DECLARE_ALIGNED macro family to mem_internal on next+1 bumpAnton Khirnov2021-01-01
| | | | They are not properly namespaced and not intended for public use.
* avcodec/mpegaudio_tablegen: Make exponential LUT sharedAndreas Rheinhardt2020-12-08
| | | | | | | | | | | | | | | | Both the fixed as well as the floating point mpegaudio decoders use LUTs of type int8_t and uint32_t with 32K entries each; these tables are completely the same, yet they are not shared. This commit makes them shared. When both fixed as well as floating point decoders are enabled, this saves 160KiB from the bss segment for a normal build (translating into 160KiB less memory usage if both a shared as well as a floating point decoder have actually been used) and 160KiB from the binary for a build with hardcoded tables. It also means that the code to create said LUTs is no longer duplicated (for a normal build). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/mpegaudiodec: Hardcode tables to save spaceAndreas Rheinhardt2020-12-08
| | | | | | | | | | | | | | | | | | | The csa_tables (which always consist of 32 entries of four byte each, but the type depends upon whether the decoder is fixed or floating-point) are currently initialized once during decoder initialization; yet it turns out that this is actually no benefit: The code used to initialize these tables takes up 153 (fixed point) and 122 (floating point) bytes when compiled with GCC 9.3 with -O3 on x64, so it is better to just hardcode these tables. Essentially the same applies to the is_tables: They have a size of 128B each and the code to initialize them occupies 149 (fixed point) resp. 140 (floating point) bytes. So hardcode them, too. To make the origin of the tables clear, references to the code used to create them have been added. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/mpegaudiodec: Share fixed and floating point data and init codeAndreas Rheinhardt2020-12-08
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/mpegaudiodec_template: Apply shift during initAndreas Rheinhardt2020-12-08
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/mpegaudiodec: Make decoders init-threadsafeAndreas Rheinhardt2020-12-08
| | | | | | Simple now that ff_mpadsp_init() and ff_mpa_synth_init_* are thread-safe. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/mpegaudiodec: Combine tables used to initialize VLCsAndreas Rheinhardt2020-12-08
| | | | | | | | Up until now, there were several indiviual tables which were accessed via pointers to them; by combining the tables, one can avoid said pointers, saving space. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/mpegaudiodec: Reduce the size of tables used to initialize VLCsAndreas Rheinhardt2020-12-08
| | | | | | | | | | By switching from ff_init_vlc_sparse() to ff_init_vlc_from_lengths() one can replace tables of codes of type uint16_t by tables of symbols of type uint8_t; this saves about 1.3KB for both the fixed and floating point decoders (if enabled). Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/mpegaudiotab: Avoid unused entry in tableAndreas Rheinhardt2020-12-08
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/mpegaudiodec_template: Avoid VLC size tablesAndreas Rheinhardt2020-12-08
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/mpegaudiodec_template: Don't use unnecessarily many VLC bitsAndreas Rheinhardt2020-11-24
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/mpegaudiodsp: Make initializing synth windows thread-safeAndreas Rheinhardt2020-11-24
| | | | | | | | | | These arrays are used by the Musepack decoders, the MPEG audio decoders as well as qdm2 and up until now, these arrays might be initialized more than once, leading to potential data races as well as unnecessary initializations. Therefore this commit ensures that each array will only be initialized once. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/mpegaudiodec*: Cleanup generically on init failureAndreas Rheinhardt2020-09-19
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/mpegaudiodec_float: Avoid indirection with float dsp functionAndreas Rheinhardt2020-09-19
| | | | | | | | Do this by only keeping the only function pointer from the AVFloatDSPContext that is needed lateron. This also allows to remove the decoders' close function. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/mpegaudiodec_template: Check return value of subdecoderAndreas Rheinhardt2020-09-19
| | | | | | After all, allocating an AVFloatDSPContext might have failed. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/mpegaudiodec_template: Fix some whitespace issuesMichael Niedermayer2020-08-06
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/mpegaudiodec_template: Check CRCs for layer1 and layer2Michael Niedermayer2020-08-04
| | | | | | | | | | | This differs from the MPEG specification as the actual real world files do compute their CRC over variable areas and not the fixed ones listed in the specification. This is also the reason for the complexity of this code and the need to perform the CRC check for layer2 in the middle of layer2 decoding. Reviewed-by: Lynne <dev@lynne.ee> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/mpegaudiodec_template: disable CRC checking for layers 1 and 2James Almer2020-08-03
| | | | | | | | | | Layers 1 and 2 use lengths in bits which are not a multiple of 8, and our CRC works on a per-byte basis. Based on b48397e7b8 Reviewed-by: Lynne <dev@lynne.ee> Signed-off-by: James Almer <jamrial@gmail.com>
* Revert "mpegaudiodec_template: disable CRC checking for layers 1 and 2"James Almer2020-08-03
| | | | | | | | | | | This reverts commit b48397e7b84864f2d4c70361a4c4bed93e826753. The change did not disable crc checks for layer 1 & 2, it removed reading the CRC field. Fixes decoding some mp2 samples and FATE test failures. Signed-off-by: James Almer <jamrial@gmail.com>
* mpegaudiodec_template: disable CRC checking for layers 1 and 2Lynne2020-08-02
| | | | | Layers 1 and 2 use lengths in bits which are not a multiple of 8, and our CRC works on a per-byte basis.
* mpegaudiodec_template: add ability to check CRCLynne2020-05-26
| | | | | | A lot of files have CRC included. The CRC only covers 34 bytes at most from the frame but it should still be enough for some amount of error detection.
* avcodec: use avpriv_mpeg4audio_get_config2()James Almer2019-09-27
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* Fix all -Wformat warnings raised by DJGPPClément Bœsch2017-03-29
|
* Merge commit '255526998501f0040ae43fe4848c817a97fc578a'Clément Bœsch2017-03-24
|\ | | | | | | | | | | | | * commit '255526998501f0040ae43fe4848c817a97fc578a': mpegaudio: Do not print value of uninitialized variable Merged-by: Clément Bœsch <u@pkh.me>
| * mpegaudio: Do not print value of uninitialized variableDiego Biurrun2016-10-27
| | | | | | | | libavcodec/mpegaudiodec_template.c:885:97: warning: variable 'x' is uninitialized when used here [-Wuninitialized]
* | avcodec/mpegaudiodec_template: Fix 2 runtime error: signed integer overflowMichael Niedermayer2017-03-21
| | | | | | | | | | | | | | Fixes: 873/clusterfuzz-testcase-5714546230558720 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec/mpegaudiodec_template: Make l3_unscale() work with e=0Michael Niedermayer2017-03-14
| | | | | | | | | | | | | | | | Fixes undefined behavior Fixes: 830/clusterfuzz-testcase-6253175327686656 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec/mpegaudiodec_template: Check for negative eMichael Niedermayer2017-03-09
| | | | | | | | | | | | | | | | Fixes: undefined shift Fixes: 631/clusterfuzz-testcase-6725491035734016 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec/mpegaudiodec_template: Fix runtime error: signed integer overflow: ↵Michael Niedermayer2017-03-03
| | | | | | | | | | | | | | | | | | 2053224902 + 2053224902 cannot be represented in type 'int' Fixes: 696/clusterfuzz-testcase-5853632270434304 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec/mpegaudiodec_template: Correct return code on id3 tag discardingMichael Niedermayer2017-02-24
| | | | | | | | | | | | | | Fixes: 665/clusterfuzz-testcase-4863789881098240 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec/mpegaudiodec_template: Fix multiple runtime error: signed integer ↵Michael Niedermayer2017-02-22
| | | | | | | | | | | | | | | | | | overflow Fixes: 648/clusterfuzz-testcase-5337961317007360 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec/mpegaudiodec: Eliminate many undefined operationsMichael Niedermayer2017-02-20
| | | | | | | | | | | | | | | | Fixes: 625/clusterfuzz-testcase-4574924406521856 Fixes: 626/clusterfuzz-testcase-4738718621499392 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | mpegaudiodec_template: fix leaking fdsp for mp3on4floatAndreas Cadhalpun2017-02-17
| | | | | | | | | | Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
* | Merge commit '74b1bf632f125a795e66e5fd0a060b9c7c55b7a3'Hendrik Leppkes2016-06-26
|\| | | | | | | | | | | | | * commit '74b1bf632f125a795e66e5fd0a060b9c7c55b7a3': mp3: Make the extrasize explicit Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
| * mp3: Make the extrasize explicitLuca Barbato2016-05-22
| | | | | | | | | | | | | | | | | | Initialize the bit buffer with the correct size (amount of bits that will be read) instead of relying on the bitstream reader overreading the correct values. Signed-off-by: Luca Barbato <lu_zero@gentoo.org> Signed-off-by: Diego Biurrun <diego@biurrun.de>
* | Merge commit '41ed7ab45fc693f7d7fc35664c0233f4c32d69bb'Clément Bœsch2016-06-21
|\| | | | | | | | | | | | | * commit '41ed7ab45fc693f7d7fc35664c0233f4c32d69bb': cosmetics: Fix spelling mistakes Merged-by: Clément Bœsch <u@pkh.me>
| * cosmetics: Fix spelling mistakesVittorio Giovara2016-05-04
| | | | | | | | Signed-off-by: Diego Biurrun <diego@biurrun.de>
| * lavc: Add get_bitsz()Andreas Cadhalpun2016-01-11
| | | | | | | | | | | | get_bit variant supporting 0-bits reads. Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
* | fix some a/an typosLou Logan2016-03-28
| | | | | | | | Signed-off-by: Lou Logan <lou@lrcd.com>
* | get_bits: add get_bitsz for reading 0-25 bitsAndreas Cadhalpun2016-01-03
| | | | | | | | | | | | | | This can be used to simplify code in a couple of places. Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
* | Merge commit '955aec3c7c7be39b659197e1ec379a09f2b7c41c'Hendrik Leppkes2016-01-01
|\| | | | | | | | | | | | | * commit '955aec3c7c7be39b659197e1ec379a09f2b7c41c': mpegaudiodecheader: check the header in avpriv_mpegaudio_decode_header Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
| * mpegaudiodecheader: check the header in avpriv_mpegaudio_decode_headerAnton Khirnov2015-12-12
| | | | | | | | | | | | Almost all the places from which this function is called already check the header manually and in the two that don't (the mp3 muxer) the check should not cause any problems.
* | mips: rename mipsdspr1 to mipsdspVicente Olivert Riera2015-12-04
| | | | | | | | | | Signed-off-by: Vicente Olivert Riera <Vincent.Riera@imgtec.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec/mp3: fix skipping zeroswm42015-09-30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commits 43bc5cf9 and c5371f77 add code for skipping initial zeros in mp3 packets. This code forgot to report to the user that data was skipped at all. Since audio codecs allow partial packet decoding, the user application has to rely on the return value. It will remove the data reported as consumed by the decoder, and feed it to the decoder again. This resulted in the mp3 frame after the zero region to be decoded over and over again, until the zero region was finally skipped by the application. Fix this by including the amount of skipped bytes to the number of consumed bytes returned by the decode call. Fixes trac ticket #4890.
* | Merge commit '7c6eb0a1b7bf1aac7f033a7ec6d8cacc3b5c2615'Michael Niedermayer2015-07-27
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * commit '7c6eb0a1b7bf1aac7f033a7ec6d8cacc3b5c2615': lavc: AV-prefix all codec flags Conflicts: doc/examples/muxing.c ffmpeg.c ffmpeg_opt.c ffplay.c libavcodec/aacdec.c libavcodec/aacenc.c libavcodec/ac3dec.c libavcodec/ac3enc_float.c libavcodec/atrac1.c libavcodec/atrac3.c libavcodec/atrac3plusdec.c libavcodec/dcadec.c libavcodec/ffv1enc.c libavcodec/h264.c libavcodec/h264_loopfilter.c libavcodec/h264_mb.c libavcodec/imc.c libavcodec/libmp3lame.c libavcodec/libtheoraenc.c libavcodec/libtwolame.c libavcodec/libvpxenc.c libavcodec/libxavs.c libavcodec/libxvid.c libavcodec/mpeg12dec.c libavcodec/mpeg12enc.c libavcodec/mpegaudiodec_template.c libavcodec/mpegvideo.c libavcodec/mpegvideo_enc.c libavcodec/mpegvideo_motion.c libavcodec/nellymoserdec.c libavcodec/nellymoserenc.c libavcodec/nvenc.c libavcodec/on2avc.c libavcodec/options_table.h libavcodec/opus_celt.c libavcodec/pngenc.c libavcodec/ra288.c libavcodec/ratecontrol.c libavcodec/twinvq.c libavcodec/vc1_block.c libavcodec/vc1_loopfilter.c libavcodec/vc1_mc.c libavcodec/vc1dec.c libavcodec/vorbisdec.c libavcodec/vp3.c libavcodec/wma.c libavcodec/wmaprodec.c libavcodec/x86/hpeldsp_init.c libavcodec/x86/me_cmp_init.c Merged-by: Michael Niedermayer <michael@niedermayer.cc>
| * lavc: AV-prefix all codec flagsVittorio Giovara2015-07-27
| | | | | | | | | | | | Convert doxygen to multiline and express bitfields more simply. Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>