aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/utils.c
Commit message (Collapse)AuthorAgeFilesLines
...
* avcodec/utils: make the src paramater for ff_thread_ref_frame constJames Almer2020-09-111-1/+1
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* fftools, libavcodec, libavfilter: Add const to some AVCodec *Andreas Rheinhardt2020-09-111-2/+2
| | | | | | | | The user has no business modifying the underlying AVCodec. Reviewed-by: Paul B Mahol <onemda@gmail.com> Reviewed-by: Nicolas George <george@nsup.org> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec: add FastAudio decoderPaul B Mahol2020-09-031-0/+2
|
* avcodec: add ADPCM IMA MOFLEX decoderPaul B Mahol2020-09-031-0/+2
|
* avcodec/utils: calculate frame number of HEVC if the framerate > 30FPSLimin Wang2020-08-161-1/+12
| | | | Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avcodec: move ff_alloc_a53_sei() to atsc_53James Almer2020-08-151-43/+0
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec: add adpcm_argo encoderZane van Iperen2020-08-071-0/+1
| | | | Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
* avcodec: add adpcm_ima_apm encoderZane van Iperen2020-07-211-0/+1
| | | | Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
* avcodec/utils: add ff_alloc_timecode_sei() for hevc timecode seiLimin Wang2020-06-281-0/+63
| | | | Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avcodec/encode: restructure the old encode APIJames Almer2020-06-181-2/+6
| | | | | | | Following the same logic as 061a0c14bb, this commit turns the old encode API into a wrapper for the new one. Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/encode: restructure the core encoding codeJames Almer2020-06-181-3/+7
| | | | | | | | | | | | | | | | This commit follows the same logic as 061a0c14bb, but for the encode API: The new public encoding API will no longer be a wrapper around the old deprecated one, and the internal API used by the encoders now consists of a single receive_packet() callback that pulls frames as required. amf encoders adapted by James Almer librav1e encoder adapted by James Almer nvidia encoders adapted by James Almer MediaFoundation encoders adapted by James Almer vaapi encoders adapted by Linjie Fu v4l2_m2m encoders adapted by Andriy Gelman Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec: add adpcm_ima_ssi encoderZane van Iperen2020-05-271-0/+1
| | | | | Signed-off-by: Zane van Iperen <zane@zanevaniperen.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec: move avcodec_flush_buffers from decode.c to utils.cJames Almer2020-05-241-0/+44
| | | | | | It's not a decoding exclusive function anymore. Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/decode: remove ff_decode_bsfs_uninit()James Almer2020-05-211-2/+2
| | | | | | It's been a wrapper for a simple av_bsf_free() call since c96904f525. Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/utils: simplify, remove duplicate codeLimin Wang2020-05-051-26/+3
| | | | | Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* lavc: Rename hwaccel.h to hwconfig.hMark Thompson2020-04-261-1/+1
| | | | | This already applied to decoders as well as hwaccels, and adding encoder support was going to make the name even more inaccurate.
* 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.