ffmpeg.git
3 months agoavcodec/mpeg12enc: Reindentation
Andreas Rheinhardt [Tue, 24 Nov 2020 13:43:46 +0000 (14:43 +0100)]
avcodec/mpeg12enc: Reindentation

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 months agoavcodec/mpeg12enc: Use ff_thread_once() for static initializations
Andreas Rheinhardt [Tue, 24 Nov 2020 13:39:47 +0000 (14:39 +0100)]
avcodec/mpeg12enc: Use ff_thread_once() for static initializations

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 months agoavcodec/mpeg12enc: Always initialize MPEG-2 intra VLC table lengths
Andreas Rheinhardt [Tue, 24 Nov 2020 12:29:29 +0000 (13:29 +0100)]
avcodec/mpeg12enc: Always initialize MPEG-2 intra VLC table lengths

The MPEG-1/2 encoders initialize several tables once during the first
time one of the encoders is initialized; the table for MPEG-2 intra VLC
lengths is only initialized if it is used for this encoder instance.
This implies that if the first MPEG-1/2 encoder to be initialized does
not use it, it will never be initialized even if a later encoder
instance makes use of them. Fix this by initializing this table
unconditionally.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 months agoavfilter/vf_readeia608: add support for slice threads
Paul B Mahol [Tue, 24 Nov 2020 21:14:14 +0000 (22:14 +0100)]
avfilter/vf_readeia608: add support for slice threads

3 months agoavfilter/vf_readeia608: add support for commands
Paul B Mahol [Tue, 24 Nov 2020 19:52:22 +0000 (20:52 +0100)]
avfilter/vf_readeia608: add support for commands

3 months agoavfilter/vf_xfade: ensure metadata is copied to transition frames
Musee Ullah [Mon, 23 Nov 2020 19:52:01 +0000 (13:52 -0600)]
avfilter/vf_xfade: ensure metadata is copied to transition frames

I was having an issue where, using a filter chain of xfade -> ass, the
colors on the subtitles were incorrect only on the frames where xfade
was being used. This resolves that issue for me.

Signed-off-by: Musee Ullah <lae@lae.is>
3 months agoavfilter/af_biquads: make sure that biquad filter still works
Paul B Mahol [Tue, 24 Nov 2020 13:24:18 +0000 (14:24 +0100)]
avfilter/af_biquads: make sure that biquad filter still works

3 months agoavfilter/af_biquads: do not abort filtering on bogus options
Paul B Mahol [Tue, 24 Nov 2020 10:49:19 +0000 (11:49 +0100)]
avfilter/af_biquads: do not abort filtering on bogus options

Instead, continue returning unfiltered input.

3 months agoavcodec/mlpdec: Avoid code duplication when initializing VLCs
Andreas Rheinhardt [Fri, 20 Nov 2020 23:24:33 +0000 (00:24 +0100)]
avcodec/mlpdec: Avoid code duplication when initializing VLCs

Reviewed-by: Jai Luthra <me@jailuthra.in>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 months agoavcodec/mlpdec: Make decoders init-threadsafe
Andreas Rheinhardt [Fri, 20 Nov 2020 23:15:49 +0000 (00:15 +0100)]
avcodec/mlpdec: Make decoders init-threadsafe

Reviewed-by: Jai Luthra <me@jailuthra.in>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 months agoavcodec/mlp: Make initializing CRCs thread-safe
Andreas Rheinhardt [Fri, 20 Nov 2020 23:11:18 +0000 (00:11 +0100)]
avcodec/mlp: Make initializing CRCs thread-safe

Reviewed-by: Jai Luthra <me@jailuthra.in>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 months agoavcodec/mpegaudiodec_template: Don't use unnecessarily many VLC bits
Andreas Rheinhardt [Tue, 17 Nov 2020 13:29:58 +0000 (14:29 +0100)]
avcodec/mpegaudiodec_template: Don't use unnecessarily many VLC bits

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 months agoavcodec/mv30: Don't check for errors for complete VLCs
Andreas Rheinhardt [Mon, 16 Nov 2020 13:50:49 +0000 (14:50 +0100)]
avcodec/mv30: Don't check for errors for complete VLCs

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 months agoavcodec/imm4: Don't use too big VLC table
Andreas Rheinhardt [Mon, 16 Nov 2020 12:27:22 +0000 (13:27 +0100)]
avcodec/imm4: Don't use too big VLC table

Using more bits than the longest code has makes no sense.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 months agoavcodec/aac*: Make initializing ff_aac_pow*sf_tab thread-safe
Andreas Rheinhardt [Thu, 19 Nov 2020 15:54:45 +0000 (16:54 +0100)]
avcodec/aac*: Make initializing ff_aac_pow*sf_tab thread-safe

This table is currently initialized up to three times: Once by the
encoder and twice by the decoders (once by the fixed and once by the
floating-point decoder); each of these initializations is guarded by an
AVOnce, yet the fact that there are three of them implies that there
might be data races (the fact that each entry is only written to once
(to its final value) when initializing means that this is safe in
practice, yet it is still undefined behaviour). Fix this by only
initializing the table from one place that is guarded by a single AVOnce.
This also avoids unnecessary duplications of the init code.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 months agoavcodec/aactab: Fix conflicting types for ff_aac_codebook*
Andreas Rheinhardt [Thu, 19 Nov 2020 15:50:44 +0000 (16:50 +0100)]
avcodec/aactab: Fix conflicting types for ff_aac_codebook*

The header missed that these are arrays of const pointers (to const
data).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 months agoavcodec/qdmc: Don't check for errors for complete VLCs
Andreas Rheinhardt [Sun, 8 Nov 2020 09:15:31 +0000 (10:15 +0100)]
avcodec/qdmc: Don't check for errors for complete VLCs

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 months agoavcodec/hqx: Don't check for errors for complete VLCs
Andreas Rheinhardt [Sat, 7 Nov 2020 09:33:30 +0000 (10:33 +0100)]
avcodec/hqx: Don't check for errors for complete VLCs

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 months agoavcodec/hqx: Inline constants
Andreas Rheinhardt [Sat, 7 Nov 2020 09:31:59 +0000 (10:31 +0100)]
avcodec/hqx: Inline constants

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 months agoavcodec/intrax8: Make ff_intrax8_common_init() thread-safe
Andreas Rheinhardt [Mon, 16 Nov 2020 21:00:34 +0000 (22:00 +0100)]
avcodec/intrax8: Make ff_intrax8_common_init() thread-safe

In particular, don't reinitialize VLCs every time an IntraX8Context is
initialized.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 months agoavcodec/intrax8: Replace always-false check by assert
Andreas Rheinhardt [Fri, 6 Nov 2020 12:15:24 +0000 (13:15 +0100)]
avcodec/intrax8: Replace always-false check by assert

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 months agoavcodec/atrac9tab: Add missing static to internal table
Andreas Rheinhardt [Mon, 9 Nov 2020 13:59:13 +0000 (14:59 +0100)]
avcodec/atrac9tab: Add missing static to internal table

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 months agoavcodec/atrac9dec: Replace av_free() by av_freep() in close function
Andreas Rheinhardt [Thu, 5 Nov 2020 02:51:50 +0000 (03:51 +0100)]
avcodec/atrac9dec: Replace av_free() by av_freep() in close function

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 months agoavcodec/atrac9dec: Don't use unnecessarily large VLC tables
Andreas Rheinhardt [Wed, 4 Nov 2020 04:38:31 +0000 (05:38 +0100)]
avcodec/atrac9dec: Don't use unnecessarily large VLC tables

Using more bits for a VLC than the longest code has has no advantage.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 months agoavcodec/atrac9dec: Use least max_depth in calls to get_vlc2()
Andreas Rheinhardt [Wed, 4 Nov 2020 04:33:33 +0000 (05:33 +0100)]
avcodec/atrac9dec: Use least max_depth in calls to get_vlc2()

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 months agoavcodec/atrac9dec: Don't confuse max_depth of VLC with max codelength
Andreas Rheinhardt [Wed, 4 Nov 2020 04:20:10 +0000 (05:20 +0100)]
avcodec/atrac9dec: Don't confuse max_depth of VLC with max codelength

The whole point of VLCs with their tables is to read more than one bit
at a time; therefore max_depth, the number of times one has to
(maximally) read further bits is given by ceil(max_code_length / table_bits)
which in the case of ATRAC9's coefficient VLCs gives an upper bound of
two. Instead the maximum length of a code of the given VLC has been used
(which is not even a compile-time constant). Use two instead.

Furthermore, given that this was the only usage of the field containing
the maximum of all the code lengths of a given VLC the field has been
removed from its containing struct.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 months agoavcodec/truemotion2: Mark decoder as init-threadsafe
Andreas Rheinhardt [Tue, 17 Nov 2020 10:22:09 +0000 (11:22 +0100)]
avcodec/truemotion2: Mark decoder as init-threadsafe

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 months agoavcodec/g2meet: Use least max_depth in get_vlc2()
Andreas Rheinhardt [Sun, 1 Nov 2020 01:17:43 +0000 (02:17 +0100)]
avcodec/g2meet: Use least max_depth in get_vlc2()

The longest AC codes of the standard JPEG tables are 16 bits long; for
the DC tables, the maximum is 11, so using max_depth of two is
sufficient.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 months agoavcodec/sheervideo: Add av_cold to build_vlc()
Andreas Rheinhardt [Sun, 1 Nov 2020 00:14:36 +0000 (01:14 +0100)]
avcodec/sheervideo: Add av_cold to build_vlc()

It is an init function even when called from decode_frame().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 months agoavcodec/mss4: Mark decoder as init-threadsafe
Andreas Rheinhardt [Fri, 20 Nov 2020 02:53:42 +0000 (03:53 +0100)]
avcodec/mss4: Mark decoder as init-threadsafe

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 months agoavcodec/rv40vlc2: Make VLC smaller
Andreas Rheinhardt [Sat, 31 Oct 2020 19:32:25 +0000 (20:32 +0100)]
avcodec/rv40vlc2: Make VLC smaller

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 months agoavcodec/qdm2: Remove outdated comment
Andreas Rheinhardt [Tue, 17 Nov 2020 12:31:44 +0000 (13:31 +0100)]
avcodec/qdm2: Remove outdated comment

Forgotten in f054e309c58894450a5d18cce9799ef58aab9f14.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 months agoavcodec/mpegaudiodsp: Make initializing synth windows thread-safe
Andreas Rheinhardt [Sun, 15 Nov 2020 19:56:22 +0000 (20:56 +0100)]
avcodec/mpegaudiodsp: Make initializing synth windows thread-safe

These arrays are used by the Musepack decoders, the MPEG audio decoders
as well as qdm2 and up until now, these arrays might be initialized more
than once, leading to potential data races as well as unnecessary
initializations. Therefore this commit ensures that each array will only
be initialized once.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 months agoavcodec/mpegaudiodsp: Make ff_mpadsp_init() thread-safe
Andreas Rheinhardt [Sun, 15 Nov 2020 15:01:49 +0000 (16:01 +0100)]
avcodec/mpegaudiodsp: Make ff_mpadsp_init() thread-safe

The only thing missing for this is to make ff_mpadsp_init_x86()
thread-safe; it currently isn't because a static table is initialized
every time ff_mpadsp_init() is called (when ARCH_X86 is true). Solve
this by initializing this table only once, namely together with the
ordinary not-arch specific tables. This also allows to reuse their AVOnce.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 months agoavcodec/fft_template, fft_init_table: Make ff_fft_init() thread-safe
Andreas Rheinhardt [Wed, 18 Nov 2020 20:38:45 +0000 (21:38 +0100)]
avcodec/fft_template, fft_init_table: Make ff_fft_init() thread-safe

Commit 1af615683e4a1a858407afbaa2fd686842da7e49 put initializing
the ff_fft_offsets_lut (which is typically used if FFT_FIXED_32)
behind an ff_thread_once() to make ff_fft_init() thread-safe; yet
there is a second place where said table may be initialized which
is not guarded by this AVOnce: ff_fft_init_mips(). MIPS uses this LUT
even for ordinary floating point FFTs, so that ff_fft_init() is not
thread-safe (on MIPS) for both 32bit fixed-point as well as
floating-point FFTs; e.g. ff_mdct_init() inherits this flaw and
therefore initializing e.g. the AAC decoders is not thread-safe (on
MIPS) despite them having FF_CODEC_CAP_INIT_CLEANUP set.

This commit fixes this by moving the AVOnce to fft_init_table.c and
using it to guard all initializations of ff_fft_offsets_lut.

(It is not that bad in practice, because every entry of
ff_fft_offsets_lut is never read during initialization and is only once
ever written to (namely to its final value); but even these are
conflicting actions which are (by definition) data races and lead to
undefined behaviour.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 months agoavcodec/mpegaudiodsp: Combine initializing float and int tables
Andreas Rheinhardt [Sun, 15 Nov 2020 14:53:34 +0000 (15:53 +0100)]
avcodec/mpegaudiodsp: Combine initializing float and int tables

This avoids code duplication in the functions used to initialize them
and allows to remove an AVOnce.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 months agoavcodec/motionpixels: Make decoder init-threadsafe
Andreas Rheinhardt [Tue, 17 Nov 2020 09:50:01 +0000 (10:50 +0100)]
avcodec/motionpixels: Make decoder init-threadsafe

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 months agoavcodec/motionpixels: Use symbols table
Andreas Rheinhardt [Thu, 29 Oct 2020 09:56:32 +0000 (10:56 +0100)]
avcodec/motionpixels: Use symbols table

If allows us to directly store the deltas in the VLC table and therefore
avoids a level of indirection.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 months agoavcodec/motionpixels: Don't check for errors for complete VLC
Andreas Rheinhardt [Thu, 29 Oct 2020 09:25:09 +0000 (10:25 +0100)]
avcodec/motionpixels: Don't check for errors for complete VLC

The algorithm used here always creates a complete VLC, so it is
unnecessary to check this again.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 months agoavcodec/motionpixels: Be more strict when parsing Huffman trees
Andreas Rheinhardt [Thu, 29 Oct 2020 09:41:01 +0000 (10:41 +0100)]
avcodec/motionpixels: Be more strict when parsing Huffman trees

This ensures that the number of leafs in the Huffman tree equals the
number it is supposed to be and therefore ensures that the VLC tree is
complete, allowing us to remove checks.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 months agoavcodec/motionpixels: Only create VLC iff it is going to be used
Andreas Rheinhardt [Thu, 29 Oct 2020 08:46:34 +0000 (09:46 +0100)]
avcodec/motionpixels: Only create VLC iff it is going to be used

If the Huffman tree consists of only one entry (which has length zero),
no tree is used at all for parsing as the VLC API currently can't handle
this. So it makes no sense to create a VLC in this case.

Commit 41b7389cade702383e59343561776f83bb26e17f added a check for
whether creating the VLC should be skipped, but it also skipped decoding
the packet and it used the wrong check: It checked max_codes_bits,
the maximum length of a code; but this value is only updated iff there is
more than one Huffman entry. So if there is only one Huffman entry, and
there was a previous frame with more than one entry, then a VLC was
created unnecessarily; yet if there was no previous frame with more than
one entry, then this frame will be skipped which is probably
spec-incompliant. I have no sample for the latter.

This commit improves the check to create a VLC iff it is going to be
used.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 months agoavcodec/mimic: Mark decoder as init-threadsafe
Andreas Rheinhardt [Sun, 15 Nov 2020 12:41:41 +0000 (13:41 +0100)]
avcodec/mimic: Mark decoder as init-threadsafe

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 months agoavcodec/mimic: Cleanup generically upon init failure
Andreas Rheinhardt [Sun, 15 Nov 2020 12:34:57 +0000 (13:34 +0100)]
avcodec/mimic: Cleanup generically upon init failure

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 months agoavcodec/rv10: Make initializing static RV10 VLCs thread-safe
Andreas Rheinhardt [Tue, 17 Nov 2020 09:09:34 +0000 (10:09 +0100)]
avcodec/rv10: Make initializing static RV10 VLCs thread-safe

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 months agoavcodec/smacker: Mark decoders as init-threadsafe
Andreas Rheinhardt [Sun, 15 Nov 2020 09:27:04 +0000 (10:27 +0100)]
avcodec/smacker: Mark decoders as init-threadsafe

Both Smacker audio and video decoders don't use/modify any global state.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 months agoavcodec/tscc2: Mark tscc2 decoder as init-threadsafe
Andreas Rheinhardt [Sun, 15 Nov 2020 08:53:00 +0000 (09:53 +0100)]
avcodec/tscc2: Mark tscc2 decoder as init-threadsafe

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 months agoavfilter/af_adenorm: add timeline and slice threading support
Paul B Mahol [Tue, 24 Nov 2020 10:27:14 +0000 (11:27 +0100)]
avfilter/af_adenorm: add timeline and slice threading support

3 months agoavfilter/af_asubboost: add timeline and slice threading support
Paul B Mahol [Tue, 24 Nov 2020 09:00:34 +0000 (10:00 +0100)]
avfilter/af_asubboost: add timeline and slice threading support

3 months agoavcodec: add SpeedHQ encoder
Jean-Baptiste Kempf [Mon, 9 Nov 2020 11:25:02 +0000 (12:25 +0100)]
avcodec: add SpeedHQ encoder

3 months agoavformat/av1: add support for passing through MP4/Matroska av1c
Jan Ekström [Mon, 23 Nov 2020 16:00:44 +0000 (18:00 +0200)]
avformat/av1: add support for passing through MP4/Matroska av1c

3 months agoavcodec/av1{dec,parser}: move to ff_cbs_read_extradata_from_codec
Jan Ekström [Mon, 23 Nov 2020 15:36:20 +0000 (17:36 +0200)]
avcodec/av1{dec,parser}: move to ff_cbs_read_extradata_from_codec

This lets us re-utilize the extradata-related checks in the CBS
to add support for passing the AV1CodecConfigurationRecord
as extradata as-is without further filtering.

3 months agoavcodec/cbs_av1: add support for standard MP4/Matroska extradata
Jan Ekström [Mon, 23 Nov 2020 17:37:38 +0000 (19:37 +0200)]
avcodec/cbs_av1: add support for standard MP4/Matroska extradata

This way API clients can just pass the AV1CodecConfigurationRecord
as extradata as-is without further filtering.

3 months agocbs: Add function to read extradata from an AVCodecContext
Mark Thompson [Mon, 23 Nov 2020 17:53:57 +0000 (17:53 +0000)]
cbs: Add function to read extradata from an AVCodecContext

This is useful in decoders and parsers, matching the way that bitstream
filters read extradata from AVCodecParameters.

3 months agoavdevice/decklink_dec: fix warning for unused variable
Limin Wang [Thu, 19 Nov 2020 14:35:02 +0000 (22:35 +0800)]
avdevice/decklink_dec: fix warning for unused variable

Reviewed-by: Marton Balint <cus@passwd.hu>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
3 months agoavdevice/decklink: add AV_OPT_FLAG_DEPRECATED flag for list_devices
Limin Wang [Sun, 22 Nov 2020 13:34:16 +0000 (21:34 +0800)]
avdevice/decklink: add AV_OPT_FLAG_DEPRECATED flag for list_devices

Reviewed-by: Marton Balint <cus@passwd.hu>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
3 months agoavdevice/decklink: use boolean for list_devices option
Limin Wang [Thu, 19 Nov 2020 13:57:52 +0000 (21:57 +0800)]
avdevice/decklink: use boolean for list_devices option

For the document(indevs.texi and outdevs.texi) used it as boolean.

Reviewed-by: Marton Balint <cus@passwd.hu>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
3 months agoavfilter/af_aiir: add support for arbitrary order lattice-ladder filter format
Paul B Mahol [Sun, 22 Nov 2020 20:57:39 +0000 (21:57 +0100)]
avfilter/af_aiir: add support for arbitrary order lattice-ladder filter format

3 months agoavcodec/exr: skip bottom clearing loop when its outside the image
Michael Niedermayer [Sat, 24 Oct 2020 22:23:12 +0000 (00:23 +0200)]
avcodec/exr: skip bottom clearing loop when its outside the image

Fixes: signed integer overflow: 1633771809 * 32960 cannot be represented in type 'int'
Fixes: 26532/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_EXR_fuzzer-5613925708857344

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 months agoavcodec/exr: Check ymin vs. h
Michael Niedermayer [Sat, 24 Oct 2020 20:21:48 +0000 (22:21 +0200)]
avcodec/exr: Check ymin vs. h

Fixes: out of array access
Fixes: 26532/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_EXR_fuzzer-5613925708857344
Fixes: 27443/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_EXR_fuzzer-5631239813595136

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 months agoavformat/avs: Use 64bit for the avio_tell() output
Michael Niedermayer [Sat, 24 Oct 2020 22:23:10 +0000 (00:23 +0200)]
avformat/avs: Use 64bit for the avio_tell() output

Fixes: signed integer overflow: 9223372036854775807 - -1 cannot be represented in type 'long'
Fixes: 26549/clusterfuzz-testcase-minimized-ffmpeg_dem_AVS_fuzzer-4844306424397824

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 months agoavformat/moflex: Check pkt_size
Michael Niedermayer [Sat, 24 Oct 2020 22:23:07 +0000 (00:23 +0200)]
avformat/moflex: Check pkt_size

Fixes: Timeout (>20sec -> 1ms)
Fixes: 26527/clusterfuzz-testcase-minimized-ffmpeg_dem_MOFLEX_fuzzer-6308307310215168

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 months agoavfilter/af_biquads: remove not needed code
Paul B Mahol [Sun, 22 Nov 2020 13:16:52 +0000 (14:16 +0100)]
avfilter/af_biquads: remove not needed code

3 months agoavformat/movenc: allow Apple Lossless inside mp4
Leo Izen [Fri, 20 Nov 2020 16:38:31 +0000 (11:38 -0500)]
avformat/movenc: allow Apple Lossless inside mp4

The 'alac' identifier has been registered to ISO and thus towards
ISOBMFF at the MP4 registration authority. The existing non-MOV
mux mode matches the official ALAC-in-MP4 specification.

3 months agoavfilter/af_afreqshift: add timeline and slice threading support
Paul B Mahol [Sun, 22 Nov 2020 09:44:49 +0000 (10:44 +0100)]
avfilter/af_afreqshift: add timeline and slice threading support

3 months agoavcodec/atrac3: increase max block align size
Paul B Mahol [Sat, 21 Nov 2020 21:09:17 +0000 (22:09 +0100)]
avcodec/atrac3: increase max block align size

Fixes decoding of lossy part of advanced lossless atrac3.
Regression since f09151fff9c754fbc1d2560adf18b14957f8b181

3 months agoavcodec/mobiclip: Check mv against INT_MAX
Michael Niedermayer [Sat, 14 Nov 2020 21:27:00 +0000 (22:27 +0100)]
avcodec/mobiclip: Check mv against INT_MAX

Fixes: signed integer overflow: 2147483647 + 1 cannot be represented in type 'int'
Fixes: 27369/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MOBICLIP_fuzzer-5083469356728320

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 months agoavformat/wavdec: More complete size check in find_guid()
Michael Niedermayer [Sat, 14 Nov 2020 21:13:52 +0000 (22:13 +0100)]
avformat/wavdec: More complete size check in find_guid()

Fixes: signed integer overflow: 9223372036854775807 + 8 cannot be represented in type 'long'
Fixes: 27341/clusterfuzz-testcase-minimized-ffmpeg_dem_W64_fuzzer-5442833206738944

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 months agoavcodec/mv30: Use unsigned in idct_1d()
Michael Niedermayer [Sat, 14 Nov 2020 20:10:18 +0000 (21:10 +0100)]
avcodec/mv30: Use unsigned in idct_1d()

Fixes: signed integer overflow: 2110302399 + 39074947 cannot be represented in type 'int'
Fixes: 27330/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MV30_fuzzer-5664923153334272

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 months agoavformat/iff: Check size before skip
Michael Niedermayer [Sat, 14 Nov 2020 19:59:01 +0000 (20:59 +0100)]
avformat/iff: Check size before skip

Fixes: Infinite loop
Fixes: 27292/clusterfuzz-testcase-minimized-ffmpeg_dem_IFF_fuzzer-5731168991051776

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 months agoavformat/rmdec: Check for EOF in index packet reading
Michael Niedermayer [Fri, 13 Nov 2020 22:30:47 +0000 (23:30 +0100)]
avformat/rmdec: Check for EOF in index packet reading

Fixes: Timeout(>10sec -> 1ms)
Fixes: 27284/clusterfuzz-testcase-minimized-ffmpeg_dem_RM_fuzzer-6304211110985728

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 months agoavcodec/cuviddec: fix missing context push/pop
leozhang [Fri, 20 Nov 2020 03:23:43 +0000 (11:23 +0800)]
avcodec/cuviddec: fix missing context push/pop

Test command like below:
cuda-memcheck ./ffmpeg -hwaccel cuvid -c:v h264_cuvid -i input_file -c:v h264_nvenc -f null -

Signed-off-by: leozhang <nowerzt@gmail.com>
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
3 months agoavformat/rtsp: don't forget to call ff_network_close() on error
Andriy Gelman [Mon, 12 Oct 2020 20:36:09 +0000 (16:36 -0400)]
avformat/rtsp: don't forget to call ff_network_close() on error

In sdp_read_header() some ff_network_close() calls were missed.

Also in rtp_read_header() update comment to explain why a single
call to ff_network_close() is enough to cover all cases even if
sdp_read_header() returns an error.

Reviewed-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
3 months agoavformat/rtsp: set return variable in error path
Andriy Gelman [Mon, 12 Oct 2020 20:36:08 +0000 (16:36 -0400)]
avformat/rtsp: set return variable in error path

In this error path ret still stores the number of bytes read in
ffurl_read().

Reviewed-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
3 months agoavformat/rtspdec: cosmetics
Andriy Gelman [Mon, 12 Oct 2020 20:36:07 +0000 (16:36 -0400)]
avformat/rtspdec: cosmetics

Make error check style consistent with rest of function.

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
3 months agoavformat/rtspdec: fix mem leaks in connect mode if init fails
Andriy Gelman [Mon, 12 Oct 2020 20:36:06 +0000 (16:36 -0400)]
avformat/rtspdec: fix mem leaks in connect mode if init fails

Fixes #6334

Reviewed-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
3 months agoavformat/rtspdec: fix mem leaks in listen mode if init fails
Andriy Gelman [Mon, 12 Oct 2020 20:36:05 +0000 (16:36 -0400)]
avformat/rtspdec: fix mem leaks in listen mode if init fails

Reviewed-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
3 months agoavformat/rtspdec: add network init to listen mode
Andriy Gelman [Mon, 12 Oct 2020 20:36:04 +0000 (16:36 -0400)]
avformat/rtspdec: add network init to listen mode

As per the docs network initialization is required before ff_url_join().
Furthermore, because the ff_network_init() was skipped, this makes
one additional call to ff_network_close() if the stream exits without
errors.

The was forgotten in the origin commit of the listen mode:
a8ad6ffafe89e3a83f343f69249338e8245816f7

Reviewed-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
3 months agoavdevice/decklink_dec: map the raw_format instead of hardcode
Limin Wang [Thu, 19 Nov 2020 04:16:47 +0000 (12:16 +0800)]
avdevice/decklink_dec: map the raw_format instead of hardcode

The patch will change the numerical values for the string constants so bump
micro version.

Reviewed-by: Marton Balint <cus@passwd.hu>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
3 months agotools/target_bsf_fuzzer: set bitstream filter options
James Almer [Sun, 15 Nov 2020 01:14:24 +0000 (22:14 -0300)]
tools/target_bsf_fuzzer: set bitstream filter options

Should increase coverage with some bitstream filters

Signed-off-by: James Almer <jamrial@gmail.com>
3 months agotools/target_bsf_fuzzer: Call av_bsf_flush() in a fuzzer choosen pattern
James Almer [Sun, 15 Nov 2020 01:11:17 +0000 (22:11 -0300)]
tools/target_bsf_fuzzer: Call av_bsf_flush() in a fuzzer choosen pattern

This should increase coverage.

Based on a commit by Michael Niedermayer

Signed-off-by: James Almer <jamrial@gmail.com>
3 months agotools/target_dec_fuzzer: Call avcodec_flush_buffers() in a fuzzer choosen pattern
Michael Niedermayer [Sun, 15 Nov 2020 00:41:19 +0000 (21:41 -0300)]
tools/target_dec_fuzzer: Call avcodec_flush_buffers() in a fuzzer choosen pattern

This should increase coverage

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
3 months agotools/target_dem_fuzzer: use avio_context_free() to free the fuzzer's AVIOContext
James Almer [Sat, 14 Nov 2020 20:19:04 +0000 (17:19 -0300)]
tools/target_dem_fuzzer: use avio_context_free() to free the fuzzer's AVIOContext

The doxy for avio_alloc_context() states it must be used for this.

Signed-off-by: James Almer <jamrial@gmail.com>
3 months agolavfi/src_movie: switch to new decoding API
Anton Khirnov [Mon, 2 Nov 2020 11:26:18 +0000 (12:26 +0100)]
lavfi/src_movie: switch to new decoding API

3 months agodoc/examples/transcoding: switch to the new encoding API
Anton Khirnov [Thu, 29 Oct 2020 15:00:23 +0000 (16:00 +0100)]
doc/examples/transcoding: switch to the new encoding API

3 months agodoc/examples/transcoding: stop constantly allocating AVFrames
Anton Khirnov [Thu, 29 Oct 2020 15:00:23 +0000 (16:00 +0100)]
doc/examples/transcoding: stop constantly allocating AVFrames

Allocate just one and reuse it.

3 months agolavu: add missing stddef.h includes for size_t.
Anton Khirnov [Mon, 24 Feb 2020 12:18:57 +0000 (13:18 +0100)]
lavu: add missing stddef.h includes for size_t.

3 months agolavfi/lavfutils: switch to the new decoding API
Anton Khirnov [Sat, 18 Apr 2020 13:53:18 +0000 (15:53 +0200)]
lavfi/lavfutils: switch to the new decoding API

3 months agotools/enum_options: fix build and add to Makefile
Anton Khirnov [Sun, 12 Apr 2020 07:01:55 +0000 (09:01 +0200)]
tools/enum_options: fix build and add to Makefile

3 months agoavformat/matroskadec: only use the track duration if it exists
Steve Lhomme [Sun, 15 Nov 2020 09:00:35 +0000 (10:00 +0100)]
avformat/matroskadec: only use the track duration if it exists

No need to multiplying/dividing when we know it's zero.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
3 months agoavformat/matroskadec: adjust the cluster time to the track timebase
Steve Lhomme [Sun, 15 Nov 2020 08:59:48 +0000 (09:59 +0100)]
avformat/matroskadec: adjust the cluster time to the track timebase

The Block timestamp read in matroska_parse_block() is in track timebase and is
passed on as such to the AVPacket which uses this timebase.

In the normal case the Cluster and Track timebases are the same because the
track->time_scale is 1.0. But when it is not the case, the values in Cluster
timebase need to be transformed in Track timebase so they can be added
together.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
3 months agoavformat/matroskadec: add a warning when the track TimestampScale won't be used
Steve Lhomme [Sun, 15 Nov 2020 08:59:47 +0000 (09:59 +0100)]
avformat/matroskadec: add a warning when the track TimestampScale won't be used

Signed-off-by: Anton Khirnov <anton@khirnov.net>
3 months agoavfilter/vf_lut3d: fix sanitizef INF handling
Mark Reid [Mon, 9 Nov 2020 01:12:29 +0000 (17:12 -0800)]
avfilter/vf_lut3d: fix sanitizef INF handling

Signed-off-by: Anton Khirnov <anton@khirnov.net>
3 months agoavcodec/exr: use lookuptable for alpha if there is no trc_func
Mark Reid [Mon, 9 Nov 2020 03:37:23 +0000 (19:37 -0800)]
avcodec/exr: use lookuptable for alpha if there is no trc_func

Signed-off-by: Anton Khirnov <anton@khirnov.net>
3 months agohttp: Check for AVERROR_EOF in the check for premature end
Martin Storsjö [Thu, 12 Nov 2020 22:06:30 +0000 (00:06 +0200)]
http: Check for AVERROR_EOF in the check for premature end

When the check was added (in 3668701f9600, in 2015), some IO
functions returned 0 on EOF (in particular, the TCP protocol
did, but the TLS protocol returned AVERROR_EOF). Since
0e1f771d2200d in 2017, the TCP protocol also returns AVERROR_EOF
instead of 0, making the check for premature end never have the
intended effect.

Signed-off-by: Martin Storsjö <martin@martin.st>
3 months agoavformat/mpegts: make sure mpegts_read_header always stops at the first pmt
Marton Balint [Sat, 14 Nov 2020 23:31:11 +0000 (00:31 +0100)]
avformat/mpegts: make sure mpegts_read_header always stops at the first pmt

mpegts_read_header stops parsing the file at the first PMT. However the check
that ensured this was wrong because streams can also be added before the first
PMT is received (e.g. EIT).

So let's make sure we are in the header reading phase by checking if ts->pkt is
unset instead of checking if the number of streams found so far is 0.

Signed-off-by: Marton Balint <cus@passwd.hu>
3 months agoavformat/dvenc: check the format before vst and ast[i] are initialized
Limin Wang [Thu, 27 Aug 2020 15:40:02 +0000 (23:40 +0800)]
avformat/dvenc: check the format before vst and ast[i] are initialized

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
3 months agoavformat/dvenc: s->streams[i] -> st
Limin Wang [Thu, 27 Aug 2020 15:32:48 +0000 (23:32 +0800)]
avformat/dvenc: s->streams[i] -> st

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
3 months agoavfilter/vf_fade: config_props -> config_input
Limin Wang [Fri, 30 Oct 2020 13:45:28 +0000 (21:45 +0800)]
avfilter/vf_fade: config_props -> config_input

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
3 months agoavfilter/vf_fade: simplify code to use pts timebase for time check
Limin Wang [Fri, 30 Oct 2020 13:37:51 +0000 (21:37 +0800)]
avfilter/vf_fade: simplify code to use pts timebase for time check

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
3 months agoavfilter/vf_xfade: add squeeze transitions
Paul B Mahol [Thu, 19 Nov 2020 13:50:02 +0000 (14:50 +0100)]
avfilter/vf_xfade: add squeeze transitions