1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-26 19:01:44 +02:00
Commit Graph

1555 Commits

Author SHA1 Message Date
Zane van Iperen
b1189c1571 avcodec: add adpcm_ima_ssi encoder
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-05-27 22:13:39 +02:00
James Almer
c7c8f141eb avcodec: move avcodec_flush_buffers from decode.c to utils.c
It's not a decoding exclusive function anymore.

Signed-off-by: James Almer <jamrial@gmail.com>
2020-05-24 12:05:40 -03:00
James Almer
d3bedba97f avcodec/decode: remove ff_decode_bsfs_uninit()
It's been a wrapper for a simple av_bsf_free() call since c96904f525.

Signed-off-by: James Almer <jamrial@gmail.com>
2020-05-21 12:32:15 -03:00
Limin Wang
79e3c4dd74 avcodec/utils: simplify, remove duplicate code
Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2020-05-05 08:20:45 +08:00
Mark Thompson
2594f6a362 lavc: Rename hwaccel.h to hwconfig.h
This already applied to decoders as well as hwaccels, and adding encoder
support was going to make the name even more inaccurate.
2020-04-26 18:38:25 +01:00
Anton Khirnov
9d6785d426 lavc: do not implicitly share the frame pool between threads
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.
2020-04-10 15:47:30 +02:00
Nicolas Gaullier
42271f8e18 avcodec/utils: Fix ff_add_cpb_side_data() add twice
Makes it behave similarly to av_stream_add_side_data().

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2020-03-20 09:16:05 +01:00
Paul B Mahol
c6bbdba9cd avcodec: add derf dpcm decoder 2020-03-17 16:05:15 +01:00
James Almer
c666689491 avcodec: add an AVCodecContext field to signal types of packet, frame, and 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>
2020-02-22 23:19:07 -03:00
Paul B Mahol
dfb0b9370d avcodec: fix pcm zork decoder
Fixes #1939
2020-02-16 12:54:57 +01:00
leozhang
81d25e5bfc avcodec/utils: remove extra brackets
Signed-off-by: leozhang <leozhang@qiyi.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-02-01 19:04:50 +01:00
Limin Wang
8a62d88b0e avcodec/utils: replace avctx->internal with avci for better readability
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-01-10 17:52:14 +01:00
Carl Eugen Hoyos
96fab29e96 Silence "string-plus-int" warning shown by clang.
libswscale/utils.c:89:42: warning: adding 'unsigned long' to a string does not append to the string [-Wstring-plus-int]
2020-01-06 22:38:56 +01:00
Zhao Zhili
f78dc66089 avcodec/utils: remove access of AV_SAMPLE_FMT_NB
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-12-31 12:37:47 +01:00
Linjie Fu
7aef2f59b5 lavc/utils.c: fix code indentations
Introduced since 4b4a02b8.

Signed-off-by: Linjie Fu <linjie.fu@intel.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-12-12 19:25:33 +01:00
Michael Niedermayer
f011572e66 avcodec/utils: Check block_align
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>
2019-11-01 14:43:16 +01:00
Michael Niedermayer
75fefb1fb7 avcodec/utils: Check sample_rate before opening the decoder
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>
2019-09-30 22:44:43 +02:00
Michael Niedermayer
95e5396919 avcodec/utils: Optimize ff_color_frame() using memcpy()
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>
2019-09-24 17:53:39 +02:00
Michael Niedermayer
340ab13504 avcodec/utils: Use av_memcpy_backptr() in ff_color_frame()
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>
2019-09-24 17:53:39 +02:00
Michael Niedermayer
83f2555e5f avcodec/utils: Check channels fully earlier
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-09-20 23:26:34 +02:00
Michael Niedermayer
61b055bed0 libavcodec/utils: Free threads on init failure
Fixes: Multiple memleaks
Fixes: ffmpeg-memory-leak

Found-by: Francis Provencher <francis@protekresearchlab.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-09-16 00:04:18 +02:00
Michael Niedermayer
923d5c489f avcodec/utils: fix leak of subtitle_header on error path
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>
2019-07-25 00:06:10 +02:00
Michael Niedermayer
8df6884832 avcodec/utils: Check close before calling it
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>
2019-07-21 12:39:42 +02:00
James Zern
b1febda061 avcodec/utils, avcodec_open2: close codec on failure
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>
2019-07-10 12:54:57 +02:00
Michael Niedermayer
d33414d2ad avcodec/utils: Check bits_per_coded_sample
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>
2019-06-26 21:41:53 +02:00
Paul B Mahol
a367a932d3 avcodec/utils: remove commented out obsolete code 2019-03-03 18:43:22 +01:00
Paul B Mahol
3601eb0474 avcodec: add g732_1 parser 2018-12-23 15:30:13 +01:00
Martin Vignali
e53901ba5e avcodec/utils : add ff_int_from_list_or_default func
to check valid value, or return default_value
2018-12-04 15:17:21 +01:00
Martin Vignali
a87ca4bbca avcodec/utils : add YUVA444P12 and YUVA422P12 to pixfmt who need height padding in avcodec_align_dimensions2 2018-12-02 12:55:11 +01:00
Cameron Cawley
22238d0b94 avcodec: Implement Archimedes VIDC encoder/decoder
Signed-off-by: Cameron Cawley <ccawley2011@gmail.com>
2018-10-26 13:39:25 +02:00
James Almer
94fe138de0 avcodec/decode: flush the internal bsfs instead of constantly reinitalizing them
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>
2018-08-16 23:43:12 -03:00
Marton Balint
5982078e8d avcodec/utils: report insane channel count errors
More than 64 is not *that* insane, so let's report the error at least.

Signed-off-by: Marton Balint <cus@passwd.hu>
2018-07-13 22:24:33 +02:00
Rostislav Pehlivanov
755e618399 lavc: implement an ATRAC9 decoder
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>
2018-07-03 20:15:01 +01:00
Michael Niedermayer
544324827e avcodec/utils: Enforce minimum width also for VP5/6
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>
2018-04-13 21:46:42 +02:00
Josh de Kock
7e8eba2d87 lavc: add new API for iterating codecs and codec parsers
Based on an unfinished patch by atomnuker.
2018-02-06 18:50:27 +00:00
Muhammad Faiz
caa4bd7a9f avcodec/me_cmp: remove ff_me_cmp_init_static()
Precalculate and constify ff_square_tab.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Muhammad Faiz <mfcc64@gmail.com>
2018-02-05 22:42:59 +07:00
Michael Niedermayer
860d991fcd avcodec/utils: Avoid hardcoding duplicated types in sizeof()
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-01-12 22:57:01 +01:00
James Almer
9ed4ebc530 avcodec/util: use a mutex instead of atomics in avcodec_register()
Reviewed-by: wm4 <nfxjfg@googlemail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2018-01-05 13:18:34 -03:00
wm4
4ed66517c6 lavc: remove complex debug code around avcodec init locking
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.
2017-12-26 02:50:00 +01:00
wm4
86a13bf2ff lavc, lavf: move avformat static mutex from avcodec to avformat
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.
2017-12-26 02:50:00 +01:00
wm4
a04c2c707d lavc: replace and deprecate the lock manager
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).
2017-12-26 02:50:00 +01:00
Hendrik Leppkes
fd542b6f20 Revert "libavcodec/utils.c: simplify avcodec locking with atomics"
This reverts commit 590136e78d.

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.
2017-12-11 21:16:06 +01:00
Mark Thompson
3536a3efb9 lavc: Deprecate av_hwaccel_next() and av_register_hwaccel() 2017-11-26 21:36:31 +00:00
Mark Thompson
24cc0a53e9 lavc: Add codec metadata to indicate hardware support 2017-11-26 21:35:49 +00:00
Rostislav Pehlivanov
590136e78d libavcodec/utils.c: simplify avcodec locking with atomics
Also makes it more robust than using volatiles.

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
2017-11-26 02:17:23 +00:00
Rostislav Pehlivanov
3154f4417a lavc/utils.c: use C11 atomics for entangled thread handling
Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
2017-11-26 02:17:23 +00:00
James Almer
c4131a0613 avcodec: deprecate getters and setters for AVCodecContext and AVCodec fields
The fields can be accessed directly, so these are not needed anymore.

Signed-off-by: James Almer <jamrial@gmail.com>
2017-11-15 01:14:22 -03:00
Aleksandr Slobodeniuk
85af60df89 avcodec: fix wrong duration of packets (dvd, bluray)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-11-11 14:15:15 +01:00
James Almer
eb5f846339 avcodec: drop deprecated vismv option
Deprecated in 08/2014.

Signed-off-by: James Almer <jamrial@gmail.com>
2017-10-23 16:52:24 -03:00
James Almer
d2484639bc Merge commit '48bb0da050329e5111b00a12dfc154b7e78fb3a3'
* commit '48bb0da050329e5111b00a12dfc154b7e78fb3a3':
  lavc: Drop deprecated way of setting audio delay on encode

Merged-by: James Almer <jamrial@gmail.com>
2017-10-23 16:38:04 -03:00