]> git.sesse.net Git - ffmpeg/log
ffmpeg
3 years agotests/fate-run.sh: Don't overlook errors from md5 tests
Andreas Rheinhardt [Fri, 4 Dec 2020 22:42:55 +0000 (23:42 +0100)]
tests/fate-run.sh: Don't overlook errors from md5 tests

The md5 test up until now ignored errors from ffmpeg (the cli) and just
md5'ed whatever ffmpeg has output; while testing scenarios in which
ffmpeg fails has its merits, errors should not be overlooked by default;
doing so also reduces the effectiveness of sanitizers as errors from
them are ignored. This has happened with a memleak in the AV1 decoder.

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agofate/mxf: Fix d10-user-comments test
Andreas Rheinhardt [Fri, 4 Dec 2020 22:11:00 +0000 (23:11 +0100)]
fate/mxf: Fix d10-user-comments test

The mxf_d10 muxer is very picky regarding the input it accepts:
The only video accepted is MPEG-2 with absolutely constant bitrate,
i.e. all packets need to have exactly the same size; and only a few
bitrates are accepted.

The sample file used did not abide by this: Writing the first packet
(a video packet) errors out and afterwards an audio packet from the
muxing queue has been written. That's all besides metadata (which this
test is about). The FFmpeg cli returned an error, but said error has
been ignored by the md5 test.

This commit changes the test to actually send a compliant stream to the
muxer, so that it does not error out; furthermore, the test is changed
to explicitly check the metadata instead of it only being implicitly
included in the md5 checksum. The compliant stream is created by our
encoder at runtime.

Finally, the test now also covers writing user-specified
product/company/version identification.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavformat/mxfenc: Fix typo
Andreas Rheinhardt [Mon, 15 Feb 2021 15:58:44 +0000 (16:58 +0100)]
avformat/mxfenc: Fix typo

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavformat/mxfenc: Use user-specified version even when bitexact
Andreas Rheinhardt [Mon, 15 Feb 2021 15:54:59 +0000 (16:54 +0100)]
avformat/mxfenc: Use user-specified version even when bitexact

Doing so is still bitexact.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavformat/mxfenc: Never set codec_ul UID to NULL
Andreas Rheinhardt [Fri, 28 Feb 2020 03:48:22 +0000 (04:48 +0100)]
avformat/mxfenc: Never set codec_ul UID to NULL

mxf distinguishes codec profiles by different UIDs and therefore needs
to check that the input is actually compatible with mxf (i.e. if there
is a defined UID for it). If not, then sometimes the UID would be set to
NULL and writing the (video) packet would fail. Yet the following audio
packet would trigger writing the header (which has been postponed because
the UID is not known at the start) and if the UID is NULL, this can lead
to segfaults. This commit therefore stops setting the UID to NULL if the
input is incompatible with mxf (it has initially been set to a generic
value in mxf_write_header()).

Fixes #7993.

Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavfilter/vif: Include avfilter.h
Andreas Rheinhardt [Tue, 16 Feb 2021 21:26:56 +0000 (22:26 +0100)]
avfilter/vif: Include avfilter.h

Fixes checkheaders.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/frame_thread_encoder: Use more natural types
Andreas Rheinhardt [Sun, 7 Feb 2021 19:35:09 +0000 (20:35 +0100)]
avcodec/frame_thread_encoder: Use more natural types

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/frame_thread_encoder: Reduce amount of code guarded by mutex
Andreas Rheinhardt [Sun, 7 Feb 2021 18:59:11 +0000 (19:59 +0100)]
avcodec/frame_thread_encoder: Reduce amount of code guarded by mutex

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/frame_thread_encoder: Avoid FIFO
Andreas Rheinhardt [Sun, 7 Feb 2021 14:08:13 +0000 (15:08 +0100)]
avcodec/frame_thread_encoder: Avoid FIFO

It can be replaced by a simple counter.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/frame_thread_encoder: Avoid allocations of AVFrames
Andreas Rheinhardt [Sun, 7 Feb 2021 13:30:28 +0000 (14:30 +0100)]
avcodec/frame_thread_encoder: Avoid allocations of AVFrames

Up until now, when using frame threaded encoding, an AVFrame would be
allocated for every frame to be encoded. These AVFrames would reach the
worker threads via a FIFO of tasks, a structure which contained the
AVFrame as well as an index into an array which gives the place where
the worker thread shall put the returned packet; in addition to that,
said structure also contained several unused fields.

This commit changes this: The AVFrames are now allocated during init in
the array that is up until now only used to return the packets. The
contents to be encoded are put into the AVFrame in the same array
element that is also used to return the packets.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/frame_thread_encoder: Avoid creating reference to frame
Andreas Rheinhardt [Sun, 7 Feb 2021 12:46:11 +0000 (13:46 +0100)]
avcodec/frame_thread_encoder: Avoid creating reference to frame

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/frame_thread_encoder: Avoid allocations of AVPackets, fix deadlock
Andreas Rheinhardt [Sun, 7 Feb 2021 12:36:52 +0000 (13:36 +0100)]
avcodec/frame_thread_encoder: Avoid allocations of AVPackets, fix deadlock

Up until now, when doing frame thread encoding, each worker thread
tried to allocate an AVPacket for every AVFrame to be encoded; said
packets would then be handed back to the main thread, where the content
of said packet is copied into the packet actually destined for output;
the temporary AVPacket is then freed.

Besides being wasteful this also has another problem: There is a risk of
deadlock, namely if no AVPacket can be allocated at all. The user
doesn't get an error at all in this case and the worker threads will
simply try to allocate a packet again and again. If the user has
supplied enough frames, the user's thread will block until a task has
been completed, which just doesn't happen if no packet can ever be
allocated.

This patch instead modifies the code to allocate the packets during
init; they are then reused again and again.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/frame_thread_encoder: Fix segfault on allocation error
Andreas Rheinhardt [Sun, 7 Feb 2021 09:58:25 +0000 (10:58 +0100)]
avcodec/frame_thread_encoder: Fix segfault on allocation error

Fixes a segfault from av_fifo_size(NULL) that happens in
ff_frame_thread_encoder_free if the fifo couldn't be allocted;
furthermore the mutexes and conditions that are destroyed in
ff_frame_thread_encoder_free are not even initialized at this point,
so don't call said function.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/frame_thread_encoder: Improve type safety
Andreas Rheinhardt [Sun, 7 Feb 2021 09:48:17 +0000 (10:48 +0100)]
avcodec/frame_thread_encoder: Improve type safety

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavfilter/x86/vf_gblur: add postscale SIMD
Paul B Mahol [Sat, 13 Feb 2021 11:09:47 +0000 (12:09 +0100)]
avfilter/x86/vf_gblur: add postscale SIMD

3 years agoavfilter/vf_gblur: factor out postscale function
Paul B Mahol [Sat, 13 Feb 2021 10:15:22 +0000 (11:15 +0100)]
avfilter/vf_gblur: factor out postscale function

3 years agotools/target_dec_fuzzer: Adjust threshold for wavpack
Michael Niedermayer [Wed, 20 Jan 2021 23:32:51 +0000 (00:32 +0100)]
tools/target_dec_fuzzer: Adjust threshold for wavpack

Fixes: Timeout (long -> 4sec)
Fixes: 29064/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WAVPACK_fuzzer-5104450901508096
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agotools/target_dec_fuzzer: Adjust threshold for MSA1
Michael Niedermayer [Wed, 20 Jan 2021 22:50:54 +0000 (23:50 +0100)]
tools/target_dec_fuzzer: Adjust threshold for  MSA1

Fixes: Timeout (too long to wait -> 1ms)
Fixes: 29048/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MSA1_fuzzer-5733703473037312
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agotools/target_dec_fuzzer: adjust threshold for cook
Michael Niedermayer [Sat, 23 Jan 2021 18:42:23 +0000 (19:42 +0100)]
tools/target_dec_fuzzer: adjust threshold for cook

Fixes: Timeout (long -> 3ms)
Fixes: 29134/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_COOK_fuzzer-5192822695264256
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agotools/target_dec_fuzzer: Adjust threshold for theora
Michael Niedermayer [Fri, 29 Jan 2021 23:46:26 +0000 (00:46 +0100)]
tools/target_dec_fuzzer: Adjust threshold for theora

Fixes: Timeout
Fixes: 29226/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_THEORA_fuzzer-6195092572471296
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agotools/target_dec_fuzzer: Update maxpixels_per_frame for low thresholds
Michael Niedermayer [Mon, 1 Feb 2021 20:08:57 +0000 (21:08 +0100)]
tools/target_dec_fuzzer: Update maxpixels_per_frame for low thresholds

Fixes: Timeout
Fixes: 29990/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MSS2_fuzzer-5469155073589248
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agotools/target_dec_fuzzer: count all video decoding failures in the new API
Michael Niedermayer [Tue, 2 Feb 2021 18:10:26 +0000 (19:10 +0100)]
tools/target_dec_fuzzer: count all video decoding failures in the new API

The next commit depends on this

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavformat/rmdec: Check codec_length without overflow
Michael Niedermayer [Mon, 15 Feb 2021 19:52:17 +0000 (20:52 +0100)]
avformat/rmdec: Check codec_length without overflow

Fixes: signed integer overflow: 2147483647 + 64 cannot be represented in type 'int'
Fixes: 30333/clusterfuzz-testcase-minimized-ffmpeg_dem_RM_fuzzer-5175286983426048
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavformat/mov: Check element count in mov_metadata_hmmt()
Michael Niedermayer [Mon, 15 Feb 2021 19:41:31 +0000 (20:41 +0100)]
avformat/mov: Check element count in mov_metadata_hmmt()

Fixes: Timeout
Fixes: 30325/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-6048395703746560
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavcodec/vp8: Move end check into MB loop in vp78_decode_mv_mb_modes()
Michael Niedermayer [Mon, 15 Feb 2021 16:13:34 +0000 (17:13 +0100)]
avcodec/vp8: Move end check into MB loop in vp78_decode_mv_mb_modes()

Fixes: Timeout (long -> 5sec)
Fixes: 30269/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VP7_fuzzer-5430325004075008
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Peter Ross <pross@xvid.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavfilter/buffersrc: simplify av_buffersrc_add_frame_flags()
James Almer [Sun, 7 Feb 2021 14:29:58 +0000 (11:29 -0300)]
avfilter/buffersrc: simplify av_buffersrc_add_frame_flags()

Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavfilter: add vif filter
Ashish Singh [Sat, 29 Jul 2017 08:46:29 +0000 (14:16 +0530)]
avfilter: add vif filter

This is Visual Information Fidelity (VIF) filter and one of the component
filters of VMAF. It outputs the average VIF score over all frames.

Signed-off-by: Ashish Singh <ashk43712@gmail.com>
3 years agoavcodec/exr: export any unknown header string variable to metadata
Paul B Mahol [Tue, 16 Feb 2021 13:37:26 +0000 (14:37 +0100)]
avcodec/exr: export any unknown header string variable to metadata

And properly skip preview type in header.

3 years agoavcodec/exr: refactor GetByteContext usage
Paul B Mahol [Tue, 16 Feb 2021 12:50:53 +0000 (13:50 +0100)]
avcodec/exr: refactor GetByteContext usage

3 years agoavcodec/exr: correctly calculate display window
Paul B Mahol [Tue, 16 Feb 2021 12:42:36 +0000 (13:42 +0100)]
avcodec/exr: correctly calculate display window

3 years agoavcodec/exr: add multipart support
Paul B Mahol [Tue, 16 Feb 2021 01:52:42 +0000 (02:52 +0100)]
avcodec/exr: add multipart support

3 years agofate/matroska: Add test for remuxing file with spherical metadata
Andreas Rheinhardt [Fri, 1 May 2020 04:48:43 +0000 (06:48 +0200)]
fate/matroska: Add test for remuxing file with spherical metadata

Also, test modifying colorspace properties and the default_mode
passthrough which is used here to create a file that has no default
track at all.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agofate/matroska: Add test for zero-length Block
Andreas Rheinhardt [Sat, 25 Apr 2020 01:18:03 +0000 (03:18 +0200)]
fate/matroska: Add test for zero-length Block

It furthermore tests the demuxer's handling of chained SeekHeads,
level 1-elements after the Clusters and the muxer's capability of
writing huge TrackNumbers as well as expanding the Cues' length field
by one byte if necessary to fill the reserved space. It also tests
propagation of metadata.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/setts_bsf: add sample rate for expressions
Paul B Mahol [Mon, 15 Feb 2021 19:51:21 +0000 (20:51 +0100)]
avcodec/setts_bsf: add sample rate for expressions

3 years agoavcodec/exr: unbreak parsing sample aspect ratio
Paul B Mahol [Mon, 15 Feb 2021 16:37:25 +0000 (17:37 +0100)]
avcodec/exr: unbreak parsing sample aspect ratio

3 years agoavcodec/exr: read fps from metadata too
Paul B Mahol [Mon, 15 Feb 2021 16:26:13 +0000 (17:26 +0100)]
avcodec/exr: read fps from metadata too

3 years agoavformat/utils: Add av_assert1 to preclude NULL + len, len != 0
Andreas Rheinhardt [Sun, 14 Feb 2021 22:55:39 +0000 (23:55 +0100)]
avformat/utils: Add av_assert1 to preclude NULL + len, len != 0

Such a scenario is undefined behaviour and would also indicate a bug
in our code.

Suggested-by: James Almer <jamrial@gmail.com>
Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agolavf/img2dec: Autodetect pfm images.
Carl Eugen Hoyos [Sun, 14 Feb 2021 23:34:01 +0000 (00:34 +0100)]
lavf/img2dec: Autodetect pfm images.

3 years agolavfi/vflip: Support Bayer vertical flip.
Carl Eugen Hoyos [Sat, 5 Sep 2020 19:14:01 +0000 (21:14 +0200)]
lavfi/vflip: Support Bayer vertical flip.

Fixes ticket #8819.

3 years agolavc/pnm: Allow decoding gray float pfm images.
Carl Eugen Hoyos [Thu, 11 Feb 2021 22:37:06 +0000 (23:37 +0100)]
lavc/pnm: Allow decoding gray float pfm images.

3 years agoavformat/utils: Fix undefined NULL + 0
Andreas Rheinhardt [Sun, 14 Feb 2021 21:24:46 +0000 (22:24 +0100)]
avformat/utils: Fix undefined NULL + 0

This is undefined behaviour in C, so use data = len ? data + len : data
instead of data += len. GCC optimizes the branch away in this case;
Clang unfortunately doesn't.

Fixes ticket #8592.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavdevice/avdevice: Deprecate AVDevice Capabilities API
Andreas Rheinhardt [Sun, 24 Jan 2021 18:38:42 +0000 (19:38 +0100)]
avdevice/avdevice: Deprecate AVDevice Capabilities API

It has been added in 6db42a2b6b22e6f1928fafcf3faa67ed78201004,
yet since then none of the necessary create/free_device_capabilities
functions has been implemented, making this API completely useless.

Because of this one can already simplify
avdevice_capabilities_free/create and can already remove the function
pointers at the next major bump; given that the documentation explicitly
states that av_device_capabilities is not to be used by a user, it's
options can already be removed (save for the sentinel).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agotools/target_dec_fuzzer: Adjust threshold for VMNC
Michael Niedermayer [Tue, 2 Feb 2021 22:45:21 +0000 (23:45 +0100)]
tools/target_dec_fuzzer: Adjust threshold for VMNC

Fixes: Timeout
Fixes: 30055/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VMNC_fuzzer-4739482576355328
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavcodec/fmvc: avoid copying uninitialized data
Michael Niedermayer [Tue, 2 Feb 2021 21:29:25 +0000 (22:29 +0100)]
avcodec/fmvc: avoid copying uninitialized data

Fixes: Timeout
Fixes: 30049/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FMVC_fuzzer-5986909455253504
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavcodec/fits: Check gcount and pcount being non negative
Michael Niedermayer [Tue, 2 Feb 2021 18:28:15 +0000 (19:28 +0100)]
avcodec/fits: Check gcount and pcount being non negative

Fixes: signed integer overflow: 9223372036854775807 - -30069403896 cannot be represented in type 'long'
Fixes: 30046/clusterfuzz-testcase-minimized-ffmpeg_dem_FITS_fuzzer-5807144773484544
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agotools/target_dec_fuzzer: Adjust the threshold of vc1image
Michael Niedermayer [Tue, 2 Feb 2021 18:11:43 +0000 (19:11 +0100)]
tools/target_dec_fuzzer: Adjust the threshold of vc1image

Fixes: Timeout
Fixes: 30025/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VC1IMAGE_fuzzer-5965511357759488
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavformat/nutdec: Check timebase count against main header length
Michael Niedermayer [Fri, 18 Dec 2020 23:00:40 +0000 (00:00 +0100)]
avformat/nutdec: Check timebase count against main header length

Fixes: Timeout (long -> 3ms)
Fixes: 28514/clusterfuzz-testcase-minimized-ffmpeg_dem_NUT_fuzzer-6078669009321984
Fixes: 30095/clusterfuzz-testcase-minimized-ffmpeg_dem_NUT_fuzzer-5074433016463360
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavformat/mov: sanity check STSD entries
Michael Niedermayer [Sat, 6 Feb 2021 20:54:31 +0000 (21:54 +0100)]
avformat/mov: sanity check STSD entries

The choosen value is arbitrary. I am not sure if this is a good idea
but i dont immedeately see an alternative better way, it seems either
an arbitrary limit or OOM

Fixes: OOM
Fixes: 27492/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-6194970578649088
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavcodec/apedec: export bits_per_raw_sample
Paul B Mahol [Sun, 14 Feb 2021 17:54:59 +0000 (18:54 +0100)]
avcodec/apedec: export bits_per_raw_sample

Fixes #4717

3 years agoavcodec/pngenc: remove monowhite from apng formats
Paul B Mahol [Sun, 14 Feb 2021 16:20:03 +0000 (17:20 +0100)]
avcodec/pngenc: remove monowhite from apng formats

Monowhite pixel format is not supported, and it does not make sense
to add support for it.

Fixes #7989

3 years agoavcodec/mediacodecdec: do not abort when H264/HEVC extradata extraction fails
sfan5 [Fri, 12 Feb 2021 22:47:46 +0000 (23:47 +0100)]
avcodec/mediacodecdec: do not abort when H264/HEVC extradata extraction fails

Although rare, extradata can be present but empty and extraction will fail.
However Android also supports passing codec-specific data inline and
will likely play such a stream anyway. So there's no reason to abort
initialization before we know for sure.

3 years agoavformat/mux: return a pointer to the packet in ff_interleaved_peek()
James Almer [Mon, 8 Feb 2021 22:04:05 +0000 (19:04 -0300)]
avformat/mux: return a pointer to the packet in ff_interleaved_peek()

And make it const, so the caller doesn't attempt to change it.
ff_get_muxer_ts_offset() should be used to get the muxer timestamp offset.

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavformat/mux: add ff_get_muxer_ts_offset()
James Almer [Mon, 8 Feb 2021 21:30:47 +0000 (18:30 -0300)]
avformat/mux: add ff_get_muxer_ts_offset()

Will be useful in the next patch

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavformat/utils: force lowres to 0 in avformat_find_stream_info()
James Almer [Sat, 6 Feb 2021 16:32:24 +0000 (13:32 -0300)]
avformat/utils: force lowres to 0 in avformat_find_stream_info()

Instead of applying it and then restoring the original codecpar dimensions.

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavfilter/vf_convolution: add 16-column operation for filter_column()
Paul B Mahol [Tue, 3 Dec 2019 07:52:05 +0000 (15:52 +0800)]
avfilter/vf_convolution: add 16-column operation for filter_column()

Based on patch by Xu Jun <xujunzz@sjtu.edu.cn>

3 years agoavcodec/pngdec: fix possible race condition with APNG decoding
Paul B Mahol [Thu, 11 Feb 2021 21:56:41 +0000 (22:56 +0100)]
avcodec/pngdec: fix possible race condition with APNG decoding

Fixes #9017

3 years agoavfilter/vf_datascope: pixscope: add commands support
Paul B Mahol [Sat, 13 Feb 2021 11:32:59 +0000 (12:32 +0100)]
avfilter/vf_datascope: pixscope: add commands support

3 years agoavformat/electronicarts: Clear partial_packet on error
Michael Niedermayer [Thu, 11 Feb 2021 21:40:21 +0000 (22:40 +0100)]
avformat/electronicarts: Clear partial_packet on error

Fixes: Infinite loop
Fixes: 30165/clusterfuzz-testcase-minimized-ffmpeg_dem_EA_fuzzer-6224642371092480
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>
3 years agoavformat/r3d: Check samples before computing duration
Michael Niedermayer [Wed, 10 Feb 2021 22:21:53 +0000 (23:21 +0100)]
avformat/r3d: Check samples before computing duration

Fixes: signed integer overflow: -4611686024827895807 + -4611686016279904256 cannot be represented in type 'long'
Fixes: 30161/clusterfuzz-testcase-minimized-ffmpeg_dem_R3D_fuzzer-5694406713802752
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>
3 years agoavcodec/pnm_parser: Check av_image_get_buffer_size() for failure
Michael Niedermayer [Wed, 10 Feb 2021 21:28:20 +0000 (22:28 +0100)]
avcodec/pnm_parser: Check av_image_get_buffer_size() for failure

Fixes: out of array access
Fixes: 30135/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PBM_fuzzer-4997145650397184
Fixes: 30208/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PGMYUV_fuzzer-5605891665690624.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>
3 years agoavfilter/vf_psnr: remove precision limits for metadata values
Paul B Mahol [Fri, 12 Feb 2021 22:16:50 +0000 (23:16 +0100)]
avfilter/vf_psnr: remove precision limits for metadata values

3 years agoavfilter/vf_ssim: remove precision limits for metadata values
Paul B Mahol [Fri, 12 Feb 2021 22:15:08 +0000 (23:15 +0100)]
avfilter/vf_ssim: remove precision limits for metadata values

3 years agoavfilter/af_amix: rename sum option to normalize
Paul B Mahol [Fri, 12 Feb 2021 21:58:13 +0000 (22:58 +0100)]
avfilter/af_amix: rename sum option to normalize

It makes more sense to still use provided weights.

3 years agoavfilter/vf_ssim: add timeline support
Paul B Mahol [Fri, 12 Feb 2021 20:19:27 +0000 (21:19 +0100)]
avfilter/vf_ssim: add timeline support

3 years agoavfilter/vf_psnr: add timeline support
Paul B Mahol [Fri, 12 Feb 2021 20:18:23 +0000 (21:18 +0100)]
avfilter/vf_psnr: add timeline support

3 years agoavfilter/vf_gblur: add float format support
Paul B Mahol [Fri, 12 Feb 2021 20:07:29 +0000 (21:07 +0100)]
avfilter/vf_gblur: add float format support

3 years agoavcodec/dpx: add support for other single component 8bit files
Paul B Mahol [Thu, 11 Feb 2021 17:09:35 +0000 (18:09 +0100)]
avcodec/dpx: add support for other single component 8bit files

3 years agoavcodec/dpx: add float support for single components and rgb(a)
Paul B Mahol [Thu, 11 Feb 2021 17:07:30 +0000 (18:07 +0100)]
avcodec/dpx: add float support for single components and rgb(a)

3 years agoavcodec: add setts bitstream filter
Paul B Mahol [Tue, 9 Feb 2021 12:26:16 +0000 (13:26 +0100)]
avcodec: add setts bitstream filter

3 years agoavcodec/hevcdec: fix a return error value
James Almer [Fri, 12 Feb 2021 13:36:59 +0000 (10:36 -0300)]
avcodec/hevcdec: fix a return error value

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavfilter: add monochrome video filter
Paul B Mahol [Mon, 8 Feb 2021 10:11:46 +0000 (11:11 +0100)]
avfilter: add monochrome video filter

3 years agoavfilter/vf_zscale: add support for setting scaling filter parameters
Jan Ekström [Tue, 9 Feb 2021 20:59:08 +0000 (22:59 +0200)]
avfilter/vf_zscale: add support for setting scaling filter parameters

param_a/b are utilized for this.

3 years agoavcodec/hevcdec: add some missing allocation checks
James Almer [Thu, 11 Feb 2021 04:11:29 +0000 (01:11 -0300)]
avcodec/hevcdec: add some missing allocation checks

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavcodec/hevcdec: check that the local context list was allocated before dereferencing it
James Almer [Wed, 10 Feb 2021 17:26:59 +0000 (14:26 -0300)]
avcodec/hevcdec: check that the local context list was allocated before dereferencing it

Since the decoder is not flagged as init cleanup capable, hevc_decode_free()
is being called manually if the hevc_decode_extradata() call fails at the end
of hevc_decode_init().
In a frame threading scenario, however, if AVCodec->init() returns an error,
ff_frame_thread_free() will be called regardless of the above flag being set
or not, resulting in hevc_decode_free() being called a second time for the
same context.

Workaround this by ensuring pointers are not dereferenced if they are NULL,
and set the decoder as init cleanup capable while at it.

Fixes ticket #9099.

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavfilter/vf_pseudocolor: do not leave alpha uninitialized
Paul B Mahol [Thu, 11 Feb 2021 13:33:40 +0000 (14:33 +0100)]
avfilter/vf_pseudocolor: do not leave alpha uninitialized

3 years agoavfilter/vf_pseudocolor: add two more presets
Paul B Mahol [Thu, 11 Feb 2021 13:20:48 +0000 (14:20 +0100)]
avfilter/vf_pseudocolor: add two more presets

3 years agoavfilter/vf_pseudocolor: add opacity option
Paul B Mahol [Thu, 11 Feb 2021 12:34:15 +0000 (13:34 +0100)]
avfilter/vf_pseudocolor: add opacity option

3 years agoavfilter/af_adeclick: add more descriptive options names
Paul B Mahol [Thu, 11 Feb 2021 10:32:46 +0000 (11:32 +0100)]
avfilter/af_adeclick: add more descriptive options names

3 years agoavutil/common: Move everything inside inclusion guards
Andreas Rheinhardt [Thu, 4 Feb 2021 13:57:30 +0000 (14:57 +0100)]
avutil/common: Move everything inside inclusion guards

libavutil/common.h is a public header that provides generic math
functions whereas libavutil/intmath.h is a private header that contains
plattform-specific optimized versions of said math functions. common.h
includes intmath.h (when building the FFmpeg libraries) so that the
optimized versions are used for them.

This interdependency sometimes causes trouble: intmath.h once contained
an inlined ff_sqrt function that relied upon av_log2_16bit. In case there
was no optimized logarithm available on this plattform, intmath.h needed
to include common.h to get the generic implementation and this has been
done after the optimized versions (if any) have been provided so that
common.h used the optimized versions; it also needed to be done before
ff_sqrt. Yet when intmath.h was included from common.h and if an ordinary
inclusion guard was used by common.h, the #include "common.h" in intmath.h
was a no-op and therefore av_log2_16bit was still unknown at the end of
intmath.h (and also in ff_sqrt) if no optimized version was available.

Before a955b5965825631986ba854d007d4e934e466c7d this was solved by
duplicating the #ifndef av_log2_16bit check after the inclusion of
common.h in intmath.h; said commit instead moved these checks to the
end of common.h, outside the inclusion guards and made common.h include
itself to get these unguarded defines. This is still the current
state of affairs.

Yet this is unnecessary since 9734b8ba56d05e970c353dfd5baafa43fdb08024
as said commit removed ff_sqrt as well as the #include "common.h" from
intmath.h. Therefore this commit moves everything inside the inclusion
guards and makes common.h not include itself.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/mpegvideo_motion: Remove unnecessary headers
Andreas Rheinhardt [Thu, 4 Feb 2021 12:43:37 +0000 (13:43 +0100)]
avcodec/mpegvideo_motion: Remove unnecessary headers

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/mpegvideo_motion: Reindentation
Andreas Rheinhardt [Thu, 4 Feb 2021 11:18:39 +0000 (12:18 +0100)]
avcodec/mpegvideo_motion: Reindentation

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/mpegvideo_motion: Improve check to remove dead code
Andreas Rheinhardt [Thu, 4 Feb 2021 07:56:54 +0000 (08:56 +0100)]
avcodec/mpegvideo_motion: Improve check to remove dead code

Several compile-time checks can be improved because mcsel is not used
for MPEG-1/2 (it is only used for MPEG-4) and because MPEG-1/2 is the
only user of ff_mpv_motion that uses MV_TYPE_16X8 and MV_TYPE_DMV.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavfilter/vf_lagfun: use macro
Paul B Mahol [Wed, 10 Feb 2021 23:40:04 +0000 (00:40 +0100)]
avfilter/vf_lagfun: use macro

3 years agoavfilter/vf_lagfun: add timeline support
Paul B Mahol [Wed, 10 Feb 2021 23:30:07 +0000 (00:30 +0100)]
avfilter/vf_lagfun: add timeline support

3 years agoavfilter/vf_lagfun: increase filter precision
Paul B Mahol [Wed, 10 Feb 2021 23:24:50 +0000 (00:24 +0100)]
avfilter/vf_lagfun: increase filter precision

3 years agoavformat/wavdec: Consider AV_INPUT_BUFFER_PADDING_SIZE in set_spdif()
Michael Niedermayer [Mon, 23 Nov 2020 23:22:39 +0000 (00:22 +0100)]
avformat/wavdec: Consider AV_INPUT_BUFFER_PADDING_SIZE in set_spdif()

The buffer is read by using the bit reader
Fixes: out of array read
Fixes: 27539/clusterfuzz-testcase-minimized-ffmpeg_dem_WAV_fuzzer-5650565572591616
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavformat/rmdec: Check remaining space in debug av_log() loop
Michael Niedermayer [Fri, 30 Oct 2020 21:04:37 +0000 (22:04 +0100)]
avformat/rmdec: Check remaining space in debug av_log() loop

Fixes: Timeout (long -> 2 ms)
Fixes: 26709/clusterfuzz-testcase-minimized-ffmpeg_dem_IVR_fuzzer-5665833403285504
Fixes: 27522/clusterfuzz-testcase-minimized-ffmpeg_dem_IVR_fuzzer-6321071221112832
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavformat/flvdec: Treat high ts byte as unsigned
Michael Niedermayer [Mon, 23 Nov 2020 20:42:23 +0000 (21:42 +0100)]
avformat/flvdec: Treat high ts byte as unsigned

Fixes: left shift of 255 by 24 places cannot be represented in type 'int'
Fixes: 27516/clusterfuzz-testcase-minimized-ffmpeg_dem_KUX_fuzzer-5152854660349952
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavformat/mov: Ignore tags with invalid size during probing
Michael Niedermayer [Sat, 6 Feb 2021 17:22:58 +0000 (18:22 +0100)]
avformat/mov: Ignore tags with invalid size during probing

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavformat/mov: Factor offset advancement out in probing
Michael Niedermayer [Sat, 6 Feb 2021 17:22:57 +0000 (18:22 +0100)]
avformat/mov: Factor offset advancement out in probing

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavformat/mov: simplify size code in probing a bit
Michael Niedermayer [Sat, 6 Feb 2021 17:22:56 +0000 (18:22 +0100)]
avformat/mov: simplify size code in probing a bit

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavformat/mov: Support size = 1 and size = 0 special cases in probing
Michael Niedermayer [Sat, 6 Feb 2021 17:22:55 +0000 (18:22 +0100)]
avformat/mov: Support size = 1 and size = 0 special cases in probing

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavformat/movenc: remove unnecessary HDR metadata log messages
Jan Ekström [Tue, 9 Feb 2021 23:15:42 +0000 (01:15 +0200)]
avformat/movenc: remove unnecessary HDR metadata log messages

These made sense before 3ebf449766d4b69a7774c4990fb24fe71c848a3e
when the creation of these boxes was specifically requested by the
user, but now they have become unnecessary as they are just like
many other boxes: If the input has the information required, they
are written, otherwise they are not.

They were moved to verbose verbosity level (which happens to be
the last level still relatively usable), and now appear either once
(normal MP4 muxing), or thrice (with the faststart flag set) in
any normal MP4 usage, without giving much useful information. Thus,
remove them in their current form.

3 years agoavfilter: add exposure video filter
Paul B Mahol [Sun, 7 Feb 2021 17:42:12 +0000 (18:42 +0100)]
avfilter: add exposure video filter

3 years agoavfilter: add aexciter audio filter
Paul B Mahol [Sat, 6 Feb 2021 16:31:00 +0000 (17:31 +0100)]
avfilter: add aexciter audio filter

3 years agoavfilter/af_arnndn: skip array extra entries by looking for new line
Paul B Mahol [Wed, 10 Feb 2021 13:08:23 +0000 (14:08 +0100)]
avfilter/af_arnndn: skip array extra entries by looking for new line

3 years agoavformat/samidec: Sanity check pts
Michael Niedermayer [Sun, 31 Jan 2021 16:00:38 +0000 (17:00 +0100)]
avformat/samidec: Sanity check pts

Fixes: signed integer overflow: 0 - -9223372036854775808 cannot be represented in type 'long'
Fixes: 29743/clusterfuzz-testcase-minimized-ffmpeg_dem_SAMI_fuzzer-5499256859394048
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavcodec/jpeg2000dec: Check atom_size in jp2_find_codestream()
Michael Niedermayer [Sun, 31 Jan 2021 15:54:06 +0000 (16:54 +0100)]
avcodec/jpeg2000dec: Check atom_size in jp2_find_codestream()

Fixes: Infinite loop
Fixes: 29722/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_JPEG2000_fuzzer-6412228041506816
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavcodec/mobiclip: Bound planar prediction value
Michael Niedermayer [Sat, 31 Oct 2020 12:38:47 +0000 (13:38 +0100)]
avcodec/mobiclip: Bound planar prediction value

Fixes: signed integer overflow: 2 * 1073741952 cannot be represented in type 'int'
Fixes: 26765/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MOBICLIP_fuzzer-6594926936326144
Fixes: 29663/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MOBICLIP_fuzzer-5169789012148224
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavformat/avidec: Use 64bit in get_duration()
Michael Niedermayer [Sun, 31 Jan 2021 15:30:59 +0000 (16:30 +0100)]
avformat/avidec: Use 64bit in get_duration()

Fixes: signed integer overflow: 2147483424 + 8224 cannot be represented in type 'int'
Fixes: 29619/clusterfuzz-testcase-minimized-ffmpeg_dem_AVI_fuzzer-5191424373030912
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>