aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/utils.c
Commit message (Collapse)AuthorAgeFilesLines
...
* lavc: do not implicitly share the frame pool between threadsAnton Khirnov2020-04-101-11/+2
| | | | | | | | | | | | | Currently the frame pool used by the default get_buffer2() implementation is a single struct, allocated when opening the decoder. A pointer to it is simply copied to each frame thread and we assume that no thread attempts to modify it at an unexpected time. This is rather fragile and potentially dangerous. With this commit, the frame pool is made refcounted, with the reference being propagated across threads along with other context variables. The frame pool is now also immutable - when the stream parameters change we drop the old reference and create a new one.
* avcodec/utils: Fix ff_add_cpb_side_data() add twiceNicolas Gaullier2020-03-201-0/+5
| | | | | | Makes it behave similarly to av_stream_add_side_data(). Signed-off-by: Anton Khirnov <anton@khirnov.net>
* avcodec: add derf dpcm decoderPaul B Mahol2020-03-171-0/+1
|
* avcodec: add an AVCodecContext field to signal types of packet, frame, and ↵James Almer2020-02-221-0/+3
| | | | | | | | coded stream side data to export Add an initial mvs flag to is, analog to the export_mvs flags2 one. Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec: fix pcm zork decoderPaul B Mahol2020-02-161-1/+0
| | | | Fixes #1939
* avcodec/utils: remove extra bracketsleozhang2020-02-011-2/+2
| | | | | Signed-off-by: leozhang <leozhang@qiyi.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/utils: replace avctx->internal with avci for better readabilityLimin Wang2020-01-101-30/+33
| | | | | Signed-off-by: Limin Wang <lance.lmwang@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* Silence "string-plus-int" warning shown by clang.Carl Eugen Hoyos2020-01-061-1/+1
| | | | libswscale/utils.c:89:42: warning: adding 'unsigned long' to a string does not append to the string [-Wstring-plus-int]
* avcodec/utils: remove access of AV_SAMPLE_FMT_NBZhao Zhili2019-12-311-2/+2
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* lavc/utils.c: fix code indentationsLinjie Fu2019-12-121-6/+6
| | | | | | | Introduced since 4b4a02b8. Signed-off-by: Linjie Fu <linjie.fu@intel.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/utils: Check block_alignMichael Niedermayer2019-11-011-0/+5
| | | | | | | | | | | Fixes: out of array access Fixes: 18432/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WMAV2_fuzzer-5675574936207360 Fixes: 18326/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WMAV2_fuzzer-5071752362721280 Fixes: 18384/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WMAV1_fuzzer-5769439500304384 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/utils: Check sample_rate before opening the decoderMichael Niedermayer2019-09-301-0/+5
| | | | | | | | | | | | | Fixes: signed integer overflow: 2 * -1306460384 cannot be represented in type 'int' Fixes: 17685/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AAC_fuzzer-5747390337777664 Fixes: 17688/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_INTERPLAY_ACM_fuzzer-5739287210885120 Fixes: 17699/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_INTERPLAY_ACM_fuzzer-5678394531905536 Fixes: 17738/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TAK_fuzzer-5763415733174272 Fixes: 17746/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_BINKAUDIO_RDFT_fuzzer-5703008159006720 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: James Almer <jamrial@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/utils: Optimize ff_color_frame() using memcpy()Michael Niedermayer2019-09-241-6/+12
| | | | | | | | | | 4650975 -> 4493240 dezicycles This optimizes lines 2 and later. Line 1 still uses av_memcpy_backptr() This change originally fixed ossfuzz 10790 but this is now fixed by other optimizations already Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/utils: Use av_memcpy_backptr() in ff_color_frame()Michael Niedermayer2019-09-241-3/+3
| | | | | | | | | Fixes: Timeout (191sec -> 53sec) Fixes: 16908/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_H264_fuzzer-5711207859748864 Fixes: 10709/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_H264_fuzzer-5630617975259136 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/utils: Check channels fully earlierMichael Niedermayer2019-09-201-2/+2
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* libavcodec/utils: Free threads on init failureMichael Niedermayer2019-09-161-0/+3
| | | | | | | | Fixes: Multiple memleaks Fixes: ffmpeg-memory-leak Found-by: Francis Provencher <francis@protekresearchlab.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/utils: fix leak of subtitle_header on error pathMichael Niedermayer2019-07-251-0/+1
| | | | | | | | | | Fixes: memleak Fixes: 15528/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_STL_fuzzer-5735993371525120 Fixes: 15792/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SAMI_fuzzer-5737754232619008 Fixes: 16008/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SSA_fuzzer-5650582821404672 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/utils: Check close before calling itMichael Niedermayer2019-07-211-1/+1
| | | | | | | | | Fixes: NULL pointer dereference Fixes: 15733/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_IDF_fuzzer-5658616977162240 Reviewed-by: Paul B Mahol <onemda@gmail.com> Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/utils, avcodec_open2: close codec on failureJames Zern2019-07-101-1/+4
| | | | | | | | | | | after a successful init if the function fails for another reason close the codec without requiring FF_CODEC_CAP_INIT_CLEANUP which is meant to cover init failures themselves. fixes a memory leak in those cases. BUG=oss-fuzz:15529 Signed-off-by: James Zern <jzern@google.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/utils: Check bits_per_coded_sampleMichael Niedermayer2019-06-261-0/+4
| | | | | | | | | | | This avoids the need for each decoder separately having to handle this case Fixes: shift exponent -100663046 is negative Fixes: out of array access Fixes: 15270/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_IFF_ILBM_fuzzer-5727829913763840 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/utils: remove commented out obsolete codePaul B Mahol2019-03-031-2/+0
|
* avcodec: add g732_1 parserPaul B Mahol2018-12-231-2/+0
|
* avcodec/utils : add ff_int_from_list_or_default funcMartin Vignali2018-12-041-0/+19
| | | | to check valid value, or return default_value
* avcodec/utils : add YUVA444P12 and YUVA422P12 to pixfmt who need height ↵Martin Vignali2018-12-021-0/+4
| | | | padding in avcodec_align_dimensions2
* avcodec: Implement Archimedes VIDC encoder/decoderCameron Cawley2018-10-261-0/+1
| | | | Signed-off-by: Cameron Cawley <ccawley2011@gmail.com>
* avcodec/decode: flush the internal bsfs instead of constantly reinitalizing themJames Almer2018-08-161-0/+7
| | | | | | | Initialize the bsfs once when opening the codec and uninitialize them once when closing it, instead of at every codec flush/seek. Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/utils: report insane channel count errorsMarton Balint2018-07-131-0/+1
| | | | | | More than 64 is not *that* insane, so let's report the error at least. Signed-off-by: Marton Balint <cus@passwd.hu>
* lavc: implement an ATRAC9 decoderRostislav Pehlivanov2018-07-031-0/+1
| | | | | | | | | | | | | | | | | | | | This commit implements a full ATRAC9 decoder, a simple low-delay codec developed by Sony and used in most PSVita games, some PS3 games and some PS4 games. Its similar to AAC in that it uses Huffman coded scalefactors but instead of vector quantization it just Huffman codes the spectral coefficients (in a way similar to how Opus splits band energy coding into coarse and fine precision). It opts to write rather large Huffman codes by packing several small coefficients into one Huffman coded symbol, though I don't believe this increases efficiency at all. Band extension implements SBC in a simple way, first it mirrors the lower spectrum onto the higher frequencies and then it uses one of 5 filters to shape it. Noise substitution is implemented via 2 of them. Unlike previous ATRAC codecs, there's no QMF, this is a standard MDCT codec. Based off of the reverse engineering work of Alex Barney. Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
* avcodec/utils: Enforce minimum width also for VP5/6Michael Niedermayer2018-04-131-1/+4
| | | | | | | | | Fixes: out of array access Fixes: poc_0411 Found-by: GwanYeong Kim <gy741.kim@gmail.com> Tested-by: GwanYeong Kim <gy741.kim@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* lavc: add new API for iterating codecs and codec parsersJosh de Kock2018-02-061-99/+0
| | | | Based on an unfinished patch by atomnuker.
* avcodec/me_cmp: remove ff_me_cmp_init_static()Muhammad Faiz2018-02-051-13/+0
| | | | | | | Precalculate and constify ff_square_tab. Reviewed-by: James Almer <jamrial@gmail.com> Signed-off-by: Muhammad Faiz <mfcc64@gmail.com>
* avcodec/utils: Avoid hardcoding duplicated types in sizeof()Michael Niedermayer2018-01-121-2/+2
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/util: use a mutex instead of atomics in avcodec_register()James Almer2018-01-051-3/+9
| | | | | Reviewed-by: wm4 <nfxjfg@googlemail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* lavc: remove complex debug code around avcodec init lockingwm42017-12-261-41/+14
| | | | | | | | | | | | | | | | | | | | | This is just a lot of complicated and confusing code that had no purpose anymore. Also, the functions return values were checked only sometimes. Locking shouldn't fail anyway, so remove the return values. Barely any other pthread lock calls check the return value (including more important code that is more likely to fail horribly if locking fails). It could be argued that it might be helpful in some debugging situations, or when the user built FFmpeg without thread support against all good advice. But there are dummy atomics too, so the atomic check won't help with ensuring correctness absolutely. You gain very little. Also, for debugging, you can just raise the ASSERT_LEVEL, and then libavutil/thread.h will redefine the locking functions to explicitly check the return values.
* lavc, lavf: move avformat static mutex from avcodec to avformatwm42017-12-261-11/+0
| | | | | | | | It's completely absurd that libavcodec would care about libavformat locking, but it was there because the lock manager was in libavcodec. This is more stright forward. Changes ABI, but we don't require ABI compatibility currently.
* lavc: replace and deprecate the lock managerwm42017-12-261-97/+10
| | | | | | | Use static mutexes instead of requiring a lock manager. The behavior should be roughly the same before and after this change for API users which did not set the lock manager at all (except that a minor memory leak disappears).
* Revert "libavcodec/utils.c: simplify avcodec locking with atomics"Hendrik Leppkes2017-12-111-6/+6
| | | | | | | | | | This reverts commit 590136e78da3d091ea99ab5432543d47a559a461. Atomics are not required for this variable, because it is protected through the lock manager, and the use of atomics here is not compatible with the c11 emulation wrappersi. Fixes FATE on MSVC, among other setups which use the compat wrappers.
* lavc: Deprecate av_hwaccel_next() and av_register_hwaccel()Mark Thompson2017-11-261-11/+5
|
* lavc: Add codec metadata to indicate hardware supportMark Thompson2017-11-261-0/+12
|
* libavcodec/utils.c: simplify avcodec locking with atomicsRostislav Pehlivanov2017-11-261-6/+6
| | | | | | Also makes it more robust than using volatiles. Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
* lavc/utils.c: use C11 atomics for entangled thread handlingRostislav Pehlivanov2017-11-261-4/+5
| | | | Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
* avcodec: deprecate getters and setters for AVCodecContext and AVCodec fieldsJames Almer2017-11-151-0/+2
| | | | | | The fields can be accessed directly, so these are not needed anymore. Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec: fix wrong duration of packets (dvd, bluray)Aleksandr Slobodeniuk2017-11-111-4/+4
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec: drop deprecated vismv optionJames Almer2017-10-231-6/+0
| | | | | | Deprecated in 08/2014. Signed-off-by: James Almer <jamrial@gmail.com>
* Merge commit '48bb0da050329e5111b00a12dfc154b7e78fb3a3'James Almer2017-10-231-5/+0
|\ | | | | | | | | | | | | * commit '48bb0da050329e5111b00a12dfc154b7e78fb3a3': lavc: Drop deprecated way of setting audio delay on encode Merged-by: James Almer <jamrial@gmail.com>
| * lavc: Drop deprecated way of setting audio delay on encodeVittorio Giovara2017-03-231-5/+0
| | | | | | | | Deprecated in 08/2014.
* | Merge commit 'b3739599bda740ac12d3dde31a331b744df99123'James Almer2017-10-231-7/+0
|\| | | | | | | | | | | | | * commit 'b3739599bda740ac12d3dde31a331b744df99123': lavc: Drop deprecated emu edge functionality Merged-by: James Almer <jamrial@gmail.com>
| * lavc: Drop deprecated emu edge functionalityVittorio Giovara2017-03-231-7/+0
| | | | | | | | Deprecated in 01/2014.
* | Merge commit '6dca24cd1d570b806b5a3fdaef9d3c8608942a81'James Almer2017-10-211-10/+0
|\| | | | | | | | | | | | | * commit '6dca24cd1d570b806b5a3fdaef9d3c8608942a81': lavc: Drop deprecated way of setting codec dimensions Merged-by: James Almer <jamrial@gmail.com>
| * lavc: Drop deprecated way of setting codec dimensionsVittorio Giovara2017-03-231-7/+0
| | | | | | | | Deprecated in 10/2013.