Commit Graph

100542 Commits

Author SHA1 Message Date
Paul B Mahol
072835898d avfilter/af_earwax: fix check that was left in previous commit
Makes output exact with smaller number of samples per frame than taps.
2020-12-10 23:43:49 +01:00
Andreas Rheinhardt
e0e9c94c2b avformat/hashenc: Reuse hash_free() for framehash muxers
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-12-10 20:28:07 +01:00
Hendrik Leppkes
494f868e93 avcodec: set AV_CODEC_CAP_CHANNEL_CONF on decoders which set their own channels
The decoders in this set either have a fixed channel count, or read it
from the bitstream, and thus do not require the channel count as
external information.

Fixes various regressions since
81503ac58a, which requires a valid channel
count for decoders which do not set this capability.

Signed-off-by: Hendrik Leppkes <h.leppkes@gmail.com>
2020-12-10 13:28:35 +01:00
Jun Zhao
412c3b37a4 tests/audiomatch: add free to make static analysis tools happy
Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2020-12-10 19:38:32 +08:00
Zhao Zhili
345d04e870 avformat/mov: remove an always true condition 2020-12-10 19:38:00 +08:00
Anton Khirnov
19ce064239 smvjpegdec: merge into mjpegdec
SMVJPEG stores frames as slices of a big JPEG image. The decoder is
implemented as a wrapper that instantiates a full internal MJPEG
decoder, then forwards the decoded frames with offset data pointers.
This is unnecessarily complex and fragile, not supporting useful decoder
capabilities like direct rendering.

Re-implement the decoder inside the MJPEG decoder, which is accomplished
by returning each decoded frame multiple times, setting cropping
information appropriately on each instance.

One peculiar aspect of the previous design is that since
- the smvjpeg decoder returns one frame per input packet
- there are multiple frames in each packets (the aformentioned slices)
the demuxer needs to return each packet multiple times.
This is now also eliminated - the demuxer now returns each packet
exactly once, with the duration set to the number of frames it decodes
to.

This also removes one of the last remaining internal uses of the old
video decoding API.
2020-12-10 10:07:09 +01:00
Anton Khirnov
e9a2a87773 mjpegdec: convert to receive_frame()
This will be useful in the following commit.
2020-12-10 10:03:58 +01:00
Anton Khirnov
36237ac4ee tests: stop using -vsync drop
It depends on the muxer generating the timestamps, which is deprecated
and scheduled for removal on next bump.

A bunch of tests change timestamps, because of ffmpeg.c is not
generating them correctly. This should be fixed later.
2020-12-10 09:53:52 +01:00
Anton Khirnov
50b49f833a ffmpeg: stop accessing deprecated stream-embedded codec context 2020-12-10 09:53:35 +01:00
Anton Khirnov
1c0885334d lavf/mux: rewrite guessing the packet duration
Factor out the code into a separate muxing-specific function.
Stop accessing the deprecated AVStream-embedded codec context, use the
average framerate (if specified) instead.
2020-12-10 09:50:18 +01:00
Anton Khirnov
fe7f0d366f tests: drop api-codec-param test
It fundamentally depends on deprecated lavf internals.
2020-12-10 09:46:30 +01:00
Anton Khirnov
fcf7ef0a81 lavd/caca: do not access deprecated codec context
Use the stream timebase instead.
2020-12-10 09:45:19 +01:00
Anton Khirnov
5471b8944c codec_desc: add SMVJPEG flags
Same flags as MJPEG, as it's essentially the same codec.
2020-12-10 09:45:04 +01:00
Anton Khirnov
63c2e500d2 img2dec: export avg_frame_rate 2020-12-10 09:44:40 +01:00
Nuo Mi
d4751d8c63 avcodec/hevcdec: dynamic allocate sList and HEVClcList
following comandline will crash the ffmpeg
ffmpeg -threads 17 -thread_type slice -i WPP_A_ericsson_MAIN_2.bit out.yuv -y

the HEVCContext->sList size is MAX_NB_THREADS(16), any > 16 thread number will crash the application

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2020-12-10 09:44:11 +01:00
Andreas Rheinhardt
6a94afbd5b avcodec/snow: Use ff_thread_once() in ff_snow_common_init()
ff_snow_common_init() currently initializes static data every time it is
invoked; given that both the Snow encoder and decoder have the
FF_CODEC_CAP_INIT_THREADSAFE flag set, this can lead to data races (and
therefore undefined behaviour) even though all threads write the same
values. This commit fixes this by using ff_thread_once() for the
initializations.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-12-10 01:36:16 +01:00
Andreas Rheinhardt
bdfe51b44f avcodec/idcinvideo: Mark decoder as init-threadsafe
Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-12-10 01:34:55 +01:00
Andreas Rheinhardt
41519b29fa avcodec/cinepak: Mark decoder as init-threadsafe
Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-12-10 01:34:08 +01:00
Andreas Rheinhardt
f79927990d avcodec/cinepakenc: Mark encoder as init-threadsafe
Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-12-10 01:15:03 +01:00
Michael Niedermayer
7b88dd8f0c avformat/matroskadec: Sanity check codec_id/track type
Fixes: memleak
Fixes: 27766/clusterfuzz-testcase-minimized-ffmpeg_dem_MATROSKA_fuzzer-5198300814508032

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-12-09 21:41:15 +01:00
Michael Niedermayer
0677bdb1f5 avformat/rpl: Check the number of streams
Fixes: out of memory access
Fixes: 27787/clusterfuzz-testcase-minimized-ffmpeg_dem_RPL_fuzzer-4743666463408128.fuzz

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>
2020-12-09 21:41:15 +01:00
Michael Niedermayer
b1bced5433 avformat/vividas: Check sample_rate
Fixes: Assertion c > 0 failed at libavutil/mathematics.c
Fixes: 27001/clusterfuzz-testcase-minimized-ffmpeg_dem_VIVIDAS_fuzzer-5726041328582656
Fixes: 27453/clusterfuzz-testcase-minimized-ffmpeg_dem_VIVIDAS_fuzzer-5716060384526336

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-12-09 21:41:15 +01:00
Michael Niedermayer
b29d351f97 avformat/vividas: Make len signed
Fixes: out of array access
Fixes: 27424/clusterfuzz-testcase-minimized-ffmpeg_dem_VIVIDAS_fuzzer-5682070692823040

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-12-09 21:41:15 +01:00
James Almer
0e62efad7c avcodec/vaapi_av1: fill the remaining VAFilmGrainStructAV1 fields
Signed-off-by: James Almer <jamrial@gmail.com>
2020-12-09 14:42:20 -03:00
Mark Reid
8d19b3c4a5 avcodec/exr: preserve half-float NaN bits and add fate test
Handles NaNs more like the official implementation handles them, preserving
the original bits.
2020-12-09 12:31:09 +01:00
Gyan Doshi
7777e5119a avfilter/cropdetect: add option for initial skip
The cropdetect filter, at present, skips the first two frames. This
behaviour is hardcoded.

New option 'skip' allows users to change this. Convenient for when
input is a single image or a trimmed video stream.

Default is kept at 2 to preserve current behaviour.
2020-12-09 12:52:09 +05:30
Gyan Doshi
b9b719fedc avcodec/mpegvideo_enc: check for SpeedHQ encoder
Avoids build failure when mpegvideo_enc is built but SpeedHQ encoder
isn't.
2020-12-09 12:50:05 +05:30
Philip Langdale
40135829b6 avcodec/libaom: Support monochrome encoding with libaom >= 2.0.1
Monochrome encoding with libaom was buggy for a long time, but this was
finally sorted out in libaom 2.0.1 (2.0.0 is almost there but was still
buggy in realtime mode).

We'll keep support for libaom 1.x around until the LTS distros that
include it are EOL (which is still a long time from now).

Fixes: https://trac.ffmpeg.org/ticket/7599
2020-12-08 15:31:39 -08:00
Andreas Rheinhardt
0dac317ba3 avformat/framecrcenc: Make side-data checksums endian-independent
Do this by converting big-endian side data to little endian for
checksumming.

Reviewed-by: Andriy Gelman <andriy.gelman@gmail.com>
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-12-08 18:54:20 +01:00
Andreas Rheinhardt
b8fe417c19 avformat/framecrcenc: Don't read after the end of side-data
Nothing guarantees that the size of side data containing a palette
is actually divisible by four (although it should be); but for
big-endian systems, an algorithm is used that presupposed this.
So switch to an algorithm that does not overread: It processes
four bytes at a time, but only if all of them are contained in
the side data.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-12-08 18:54:20 +01:00
Andreas Rheinhardt
fa4532a1f7 avcodec/wmadec: Apply VLC offset during init
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-12-08 17:51:48 +01:00
Andreas Rheinhardt
e5b416dadd avcodec/wmadec: Reduce the size of tables used to initialize VLC
By switching from ff_init_vlc_sparse() to ff_init_vlc_from_lengths() one
can replace a table of codes of type uint16_t by a table of symbols of
type uint8_t, saving space.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-12-08 17:51:48 +01:00
Andreas Rheinhardt
14be39e44a avcodec/ivi: Make initializing VLCs thread-safe
This automatically makes indeo4/5 init-threadsafe.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-12-08 17:51:48 +01:00
Andreas Rheinhardt
ee4c129c11 avcodec/dsddec: Inline constant
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-12-08 17:51:48 +01:00
Andreas Rheinhardt
4f5bd6177d avcodec/dsd: Make initializing DSD tables thread-safe
This automatically makes the DSD formats as well as DST and WavPack
init-threadsafe.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-12-08 17:51:48 +01:00
Andreas Rheinhardt
fd5d66af74 avcodec/wavpack: Fix leak on init failure
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-12-08 17:51:48 +01:00
Andreas Rheinhardt
480761c82f avcodec/h261enc: Remove unused function parameter
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-12-08 17:51:48 +01:00
Andreas Rheinhardt
f0f28626c0 avcodec/asvdec: Reindentation
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-12-08 17:51:48 +01:00
Andreas Rheinhardt
103e8edd5e avcodec/asvdec: Make decoders init-threadsafe
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-12-08 17:51:48 +01:00
Andreas Rheinhardt
3e11a7866d avcodec/sinewin: Fix wrong number of elements of array declaration
There are actually only 14 elements in each ff_sine_windows array.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-12-08 17:51:48 +01:00
Andreas Rheinhardt
7184b81169 avcodec/aactab: Make AAC encoder and decoders actually init-threadsafe
Commit 1a29804558 guarded several
initializations of static data in the AAC decoders with an AVOnce and
set the FF_CODEC_CAP_INIT_THREADSAFE flag, believing the former to be
sufficient for the latter. It wasn't, because several of these static
tables are shared with other components, so that there might be data
races if they are initialized from multiple threads. This affected
initializing the ff_sine_* tables as well as initializing the
ff_aac_pow*sf_tab tables (shared between both decoders and encoder) as
well as ff_aac_kbd_* tables (shared between encoder and floating point
decoder).

Commit 3d62e7a30f set the
FF_CODEC_CAP_INIT_THREADSAFE flag for the AAC encoder. More explicitly,
this commit used the same AVOnce to guard initializing ff_aac_pow*sf_tab
in the encoder and to guard initializing the static data of each
decoder; the ensuing catastrophe was "fixed" in commit
ec0719264c by using a single AVOnce
for each codec again. But the codec cap has not been removed and
therefore the encoder claimed to be init-threadsafe, but wasn't, because
of the same tables as above.

The ff_sine_* tables as well as ff_aac_pow*sf_tab tables have already
been fixed; this commit deals with the ff_aac_kbd_* tables, making the
encoder as well as the floating-point decoder init-threadsafe (the
fixed-point decoder is it already).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-12-08 17:51:48 +01:00
Andreas Rheinhardt
86b8c25455 avcodec/aac: Share common init code of float decoder and encoder
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-12-08 17:51:48 +01:00
Andreas Rheinhardt
fc5d22abe4 avcodec/aacdec, aactab: Move kbd tables to their only user
The floating point kbd tables for 120 and 960 samples are only used by
the floating point decoder whereas the fixed point kbd tables for 128
and 1024 samples are only used by the fixed point AAC decoder. So move
these tables to their only users. This ensures that they are not
accidentally used somewhere else without ensuring that initializing
these tables stays thread-safe (as it is now because the only place from
where they are initialized is guarded by an AVOnce).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-12-08 17:51:48 +01:00
Andreas Rheinhardt
8c9404b8d2 avcodec/aactab: Remove declaration of inexistent array
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-12-08 17:51:48 +01:00
Andreas Rheinhardt
665a3dbd36 avcodec/nellymoserenc: Make encoder init-threadsafe
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-12-08 17:51:48 +01:00
Andreas Rheinhardt
0a56bfa71f avcodec/nellymoserenc: Cleanup generically on init failure
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-12-08 17:51:48 +01:00
Andreas Rheinhardt
35f61eb350 avcodec/nellymoserdec: Make decoder init-threadsafe
Easy now that initializing the ff_sine_* tables is thread-safe.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-12-08 17:51:48 +01:00
Andreas Rheinhardt
285db1d53b avcodec/atrac3plus: Make decoders init-threadsafe
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-12-08 17:51:48 +01:00
Andreas Rheinhardt
7fd8658347 avcodec/atrac1: Mark decoder as init-threadsafe
Possible because ff_init_ff_sine_windows() is now threadsafe.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-12-08 17:51:47 +01:00
Andreas Rheinhardt
3719122065 avcodec/sinewin_tablegen: Make initializing ff_sine_windows thread-safe
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-12-08 17:51:47 +01:00