summaryrefslogtreecommitdiff
path: root/libavcodec/flacdec.c
Commit message (Collapse)AuthorAgeFilesLines
* avcodec/flacdec: Fix signed integre overflowMichael Niedermayer2023-05-061-1/+1
| | | | | | | | Fixes: signed integer overflow: 3011809745540902265 + 6323452730883571725 cannot be represented in type 'long' Fixes: 45982/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FLAC_fuzzer-6687553022722048 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* libavcodec/flacdec: Implement decoding of 32 bit-per-sample PCMMartijn van Beurden2022-12-261-22/+196
| | | | Add decoding of FLAC files coding for 32 bit-per-sample PCM to libavcodec.
* avcodec/flac: smallest frame is 10 bytesPaul B Mahol2022-09-051-1/+1
| | | | Fixes #9270
* 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/flac: Move decoder+parser stuff into a new header, flac_parse.hAndreas Rheinhardt2022-09-021-0/+1
| | | | | | | | | (The FLAC parser currently ignores the streaminfo block; therefore some of this is decoder-only. Given that the FLAC parser should probably use the streaminfo block, this stuff is moved to flac_parse.h.) Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/flac: Remove unused parameter from ff_flac_is_extradata_valid()Andreas Rheinhardt2022-09-021-2/+1
| | | | | | format is write-only. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/flacdec: Don't infer max_framesize unnecessarilyAndreas Rheinhardt2022-09-021-6/+0
| | | | | | | | | This field is not really used by the decoder at all: It is only output in some debug log message, but this debug log message should better use the value read from the streaminfo instead of a second-guessed value from the decoder. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/flacdec: Shorten nameAndreas Rheinhardt2022-09-021-40/+40
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/flacdsp: Remove unused function parameterAndreas Rheinhardt2022-08-051-3/+3
| | | | | | Forgotten in e609cfd697f8eed7325591f767585041719807d1. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec: Make init-threadsafety the defaultAndreas Rheinhardt2022-07-181-1/+0
| | | | | | | | | | | 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>
* lavc/flacdec: Increase residual limit from INT_MAX to UINT_MAXMartijn van Beurden2022-04-301-1/+1
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* 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: 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>
* avcodec/codec_internal: Add FFCodec, hide internal part of AVCodecAndreas Rheinhardt2022-03-211-8/+8
| | | | | | | | | | | | | | | | 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>
* flac: convert to new channel layout APIAnton Khirnov2022-03-151-5/+4
| | | | | | 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/thread: Don't use ThreadFrame when unnecessaryAndreas Rheinhardt2022-02-091-2/+1
| | | | | | | | | | | | | | | | | | | | | | | The majority of frame-threaded decoders (mainly the intra-only) need exactly one part of ThreadFrame: The AVFrame. They don't need the owners nor the progress, yet they had to use it because ff_thread_(get|release)_buffer() requires it. This commit changes this and makes these functions work with ordinary AVFrames; the decoders that need the extra fields for progress use ff_thread_(get|release)_ext_buffer() which work exactly as ff_thread_(get|release)_buffer() used to do. This also avoids some unnecessary allocations of progress AVBuffers, namely for H.264 and HEVC film grain frames: These frames are not used for synchronization and therefore don't need a ThreadFrame. Also move the ThreadFrame structure as well as ff_thread_ref_frame() to threadframe.h, the header for frame-threaded decoders with inter-frame dependencies. Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/flacdec: Mark decoder as init-threadsafeAndreas Rheinhardt2021-05-021-0/+1
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.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/flacdec: Avoid undefined shift in error caseMichael Niedermayer2021-03-131-1/+1
| | | | | | | | Fixes: flac_1040988 Reported-by: Thomas Guilbert <tguilbert@google.com> Reviewed-by: Thomas Guilbert <tguilbert@google.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec: Set AV_CODEC_CAP_CHANNEL_CONF in more decodersMichael Niedermayer2020-11-281-1/+3
| | | | | | Suggested-by: Paul B Mahol <onemda@gmail.com> See: [FFmpeg-devel] [PATCH 1/3] avcodec/fastaudio: Check channels Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/flacdec: use designated initializers for AVClassPaul B Mahol2020-08-281-4/+4
|
* pthread_frame: merge the functionality for normal decoder init and ↵Anton Khirnov2020-04-101-14/+0
| | | | | | | | | | | | | | | | init_thread_copy The current design, where - proper init is called for the first per-thread context - first thread's private data is copied into private data for all the other threads - a "fixup" function is called for all the other threads to e.g. allocate dynamically allocated data is very fragile and hard to follow, so it is abandoned. Instead, the same init function is used to init each per-thread context. Where necessary, AVCodecInternal.is_copy can be used to differentiate between the first thread and the other ones (e.g. for decoding the extradata just once).
* avcodec/flacdec: Fix overflow in multiplication in decode_subframe_fixed()Michael Niedermayer2017-12-281-1/+1
| | | | | | | | Fixes: signed integer overflow: 2 * 1629495328 cannot be represented in type 'int' Fixes: 4716/clusterfuzz-testcase-minimized-5835915940331520 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/flacdec: avoid undefined shiftMichael Niedermayer2017-12-281-1/+1
| | | | | | | | Fixes: shift exponent 32 is too large for 32-bit type 'unsigned int' Fixes: 4688/clusterfuzz-testcase-minimized-6572210748653568 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 '0f5ad12ba2b538cb329c507ecc914e06bfa70194'James Almer2017-11-071-6/+9
|\ | | | | | | | | | | | | * commit '0f5ad12ba2b538cb329c507ecc914e06bfa70194': flac: Use a local cache for decode_residual() Merged-by: James Almer <jamrial@gmail.com>
| * flac: Use a local cache for decode_residual()Luca Barbato2017-07-091-6/+9
| | | | | | | | | | | | About an additional 4% speedup. Signed-off-by: Diego Biurrun <diego@biurrun.de>
* | Merge commit '15f1cc09a406cf6296818d475a256902235eefc4'James Almer2017-11-071-8/+9
|\ \ | |/ | | | | | | | | | | * commit '15f1cc09a406cf6296818d475a256902235eefc4': flac: Postpone unlikely condition checks Merged-by: James Almer <jamrial@gmail.com>
| * flac: Postpone unlikely condition checksLuca Barbato2017-07-091-8/+9
| | | | | | | | | | | | About 2% speedup on gcc-6.3. Signed-off-by: Diego Biurrun <diego@biurrun.de>
| * flac: Convert to the new bitstream readerAlexandra Hájková2017-07-091-29/+29
| | | | | | | | Signed-off-by: Diego Biurrun <diego@biurrun.de>
| * golomb: Convert to the new bitstream readerDiego Biurrun2017-01-311-1/+1
| |
* | avcodec/flacdec: Return error code instead of 0 for failuresMichael Niedermayer2017-05-091-2/+2
| | | | | | | | | | | | | | | | Fixes: infinite loop Fixes: 1418/clusterfuzz-testcase-minimized-5934472438480896 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec/flacdec: reduce limit for golomb so that the max value does not overflowMichael Niedermayer2017-02-211-1/+2
| | | | | | | | | | | | | | | | Fixes: runtime error: left shift of 32 by 26 places cannot be represented in type 'int' Fixes: 628/clusterfuzz-testcase-6187747641393152 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec/flac: Fix several integer overflowsMichael Niedermayer2017-02-191-2/+2
| | | | | | | | | | | | Fixes: 686513-media Found-by: Matt Wolenetz <wolenetz@google.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec/flacdec: Check for invalid vlcsMichael Niedermayer2017-02-041-1/+7
| | | | | | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec/flacdec: Fix undefined shift in decode_subframe()Michael Niedermayer2016-12-041-1/+1
| | | | | | | | | | | | | | | | Fixes undefined behavior Fixes: 639961-media Found-by: Matt Wolenetz <wolenetz@google.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec/flac: forward errors from ff_flac_parse_streaminfo()Michael Niedermayer2016-12-031-2/+6
| | | | | | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec/flacdec: Fix signed integer overflow in decode_subframe_fixed()Michael Niedermayer2016-12-031-1/+2
| | | | | | | | | | | | | | | | Fixes undefined behavior Fixes: 640912-media Found-by: Matt Wolenetz <wolenetz@google.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec: use AV_OPT_TYPE_BOOL in a bunch of placesClément Bœsch2015-12-041-1/+1
| |
* | avcodec: use HAVE_THREADS header guards to silence -Wunused-functionGanesh Ajjanagadde2015-10-041-0/+2
| | | | | | | | | | | | | | | | | | | | When compiled with --disable-pthreads, e.g http://fate.ffmpeg.org/report.cgi?time=20150917015044&slot=alpha-debian-qemu-gcc-4.7, a bunch of -Wunused-functions are reported due to missing header guards around threading related functions. This patch should silence such warnings. Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
* | Merge commit 'def97856de6021965db86c25a732d78689bd6bb0'Michael Niedermayer2015-07-271-1/+1
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * commit 'def97856de6021965db86c25a732d78689bd6bb0': lavc: AV-prefix all codec capabilities Conflicts: cmdutils.c ffmpeg.c ffplay.c libavcodec/8svx.c libavcodec/aacenc.c libavcodec/ac3dec.c libavcodec/adpcm.c libavcodec/alac.c libavcodec/atrac3plusdec.c libavcodec/bink.c libavcodec/dnxhddec.c libavcodec/dvdec.c libavcodec/dvenc.c libavcodec/ffv1dec.c libavcodec/ffv1enc.c libavcodec/fic.c libavcodec/flacdec.c libavcodec/flacenc.c libavcodec/flvdec.c libavcodec/fraps.c libavcodec/frwu.c libavcodec/gifdec.c libavcodec/h261dec.c libavcodec/hevc.c libavcodec/iff.c libavcodec/imc.c libavcodec/libopenjpegdec.c libavcodec/libvo-aacenc.c libavcodec/libvorbisenc.c libavcodec/libvpxdec.c libavcodec/libvpxenc.c libavcodec/libx264.c libavcodec/mjpegbdec.c libavcodec/mjpegdec.c libavcodec/mpegaudiodec_float.c libavcodec/msmpeg4dec.c libavcodec/mxpegdec.c libavcodec/nvenc_h264.c libavcodec/nvenc_hevc.c libavcodec/pngdec.c libavcodec/qpeg.c libavcodec/ra288.c libavcodec/rv10.c libavcodec/s302m.c libavcodec/sp5xdec.c libavcodec/takdec.c libavcodec/tiff.c libavcodec/tta.c libavcodec/utils.c libavcodec/v210dec.c libavcodec/vp6.c libavcodec/vp9.c libavcodec/wavpack.c libavcodec/yop.c Merged-by: Michael Niedermayer <michael@niedermayer.cc>
| * lavc: AV-prefix all codec capabilitiesVittorio Giovara2015-07-271-1/+1
| | | | | | | | | | | | Express bitfields more simply. Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
* | avcodec/flacdec: Attempt to auto-detect old buggy flacMichael Niedermayer2015-05-171-0/+29
| | | | | | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | lavc/flac: Fix encoding and decoding with high lpc.Carl Eugen Hoyos2015-05-171-1/+23
| | | | | | | | | | | | Based on an analysis by trac user lvqcl. Fixes ticket #4421, reported by Chase Walker.
* | lavc/flacdec: Sanitize FLACSTREAMINFO usage.Carl Eugen Hoyos2015-05-171-37/+46
| |
* | avcodec/flacdec: fix off by 1 errorMichael Niedermayer2014-11-261-1/+1
| | | | | | | | | | | | | | Fixes assertion failure Fixes: signal_sigsegv_324b284_1980_dilvie___the_dragonfly.flac Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | avcodec/flacdec: Call ff_flacdsp_init() unconditionallyMichael Niedermayer2014-11-261-1/+1
| | | | | | | | | | | | | | Fixes out of array access Fixes: signal_sigsegv_324b135_3398_cov_246853371_short.flac Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | x86/flacdsp: add SSE2 and AVX decorrelate functionsJames Almer2014-11-131-3/+3
| | | | | | | | Two to four times faster depending on instruction set, block size and channel count.
* | Merge commit 'acc897e6b15776ed438b88ffe330ec48f6b50e48'Michael Niedermayer2014-11-061-1/+1
|\ \ | |/ | | | | | | | | | | * commit 'acc897e6b15776ed438b88ffe330ec48f6b50e48': lavc: make avpriv_flac_is_extradata_valid() private on the next bump Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * lavc: make avpriv_flac_is_extradata_valid() private on the next bumpAnton Khirnov2014-11-061-1/+1
| |