ffmpeg.git
11 months 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

11 months 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

11 months 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.

11 months 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>
11 months 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>
11 months 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>
11 months 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>

11 months 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

11 months 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

11 months 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>
11 months 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>
11 months 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>
11 months 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

11 months 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

11 months 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.

11 months 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

11 months 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

11 months 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

11 months 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

11 months 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)

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

11 months 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>
11 months agoavfilter: add monochrome video filter
Paul B Mahol [Mon, 8 Feb 2021 10:11:46 +0000 (11:11 +0100)]
avfilter: add monochrome video filter

11 months 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.

11 months 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>
11 months 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>
11 months 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

11 months 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

11 months 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

11 months 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

11 months 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>
11 months 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>
11 months 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>
11 months 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>
11 months agoavfilter/vf_lagfun: use macro
Paul B Mahol [Wed, 10 Feb 2021 23:40:04 +0000 (00:40 +0100)]
avfilter/vf_lagfun: use macro

11 months 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

11 months 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

11 months 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>
11 months 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>
11 months 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>
11 months 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>
11 months 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>
11 months 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>
11 months 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>
11 months 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.

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

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

11 months 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

11 months 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>
11 months 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>
11 months 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>
11 months 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>
11 months agoavformat/mov: Check for duplicate st3d
Michael Niedermayer [Sun, 31 Jan 2021 15:28:08 +0000 (16:28 +0100)]
avformat/mov: Check for duplicate st3d

Fixes: memleak
Fixes: 29585/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-6594188688490496

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
11 months agoavformat/mvdec: Check for EOF in read_index()
Michael Niedermayer [Sun, 31 Jan 2021 15:19:42 +0000 (16:19 +0100)]
avformat/mvdec: Check for EOF in read_index()

Fixes: Timeout
Fixes: 29550/clusterfuzz-testcase-minimized-ffmpeg_dem_MV_fuzzer-5094307193290752

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
11 months agoavcodec/jpeglsdec: Fix k=16 in ls_get_code_regular()
Michael Niedermayer [Sat, 30 Jan 2021 18:37:52 +0000 (19:37 +0100)]
avcodec/jpeglsdec: Fix k=16 in ls_get_code_regular()

Fixes: Timeout
Fixes: left shift of 33046 by 16 places cannot be represented in type 'int'
Fixes: 29258/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MJPEG_fuzzer-4889231489105920
Fixes: 29515/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MJPEG_fuzzer-6161940391002112

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
11 months agoavformat/id3v2: Check the return from avio_get_str()
Michael Niedermayer [Sun, 31 Jan 2021 15:14:03 +0000 (16:14 +0100)]
avformat/id3v2: Check the return from avio_get_str()

Fixes: out of array access
Fixes: 29446/clusterfuzz-testcase-minimized-ffmpeg_dem_AAC_fuzzer-5096222622875648

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
11 months agoavutil/mathematics: Fix undefined negation in av_compare_ts()
Michael Niedermayer [Sun, 31 Jan 2021 14:51:40 +0000 (15:51 +0100)]
avutil/mathematics: Fix undefined negation in av_compare_ts()

Fixes: negation of -9223372036854775808 cannot be represented in type 'int64_t' (aka 'long'); cast to an unsigned type to negate this value to itself
Fixes: 29437/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-4748510022991872

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
11 months agolibavutil/common: Add FFABS64U()
Michael Niedermayer [Sun, 31 Jan 2021 14:51:10 +0000 (15:51 +0100)]
libavutil/common: Add FFABS64U()

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
11 months agoavcodec/hevc_sei: Check payload size in decode_nal_sei_message()
Michael Niedermayer [Sun, 31 Jan 2021 13:59:27 +0000 (14:59 +0100)]
avcodec/hevc_sei: Check payload size in decode_nal_sei_message()

Fixes: out of array access
Fixes: 29392/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HEVC_fuzzer-4821602850177024.fuzz

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
11 months agolibavutil/eval: Remove CONFIG_TRAPV special handling
Michael Niedermayer [Sun, 31 Jan 2021 15:22:53 +0000 (16:22 +0100)]
libavutil/eval: Remove CONFIG_TRAPV special handling

Fixes: division by zero
Fixes: 29555/clusterfuzz-testcase-minimized-ffmpeg_dem_VIVO_fuzzer-5149951447400448

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
11 months agoavfilter/vf_datascope: add commands support
Paul B Mahol [Wed, 10 Feb 2021 10:25:25 +0000 (11:25 +0100)]
avfilter/vf_datascope: add commands support

11 months agoavcodec/libaomenc: add support for setting arbitrary libaom options
Bohan Li [Tue, 9 Feb 2021 04:04:41 +0000 (20:04 -0800)]
avcodec/libaomenc: add support for setting arbitrary libaom options

A new key & value API lets us gain access to newly added parameters
without adding explicit support for them in our wrapper. Add an
option utilizing this functionality in a similar manner to other
encoder libraries' wrappers.

Signed-off-by: Bohan Li <bohanli@google.com>
11 months agoavformat/fitsenc: write DATAMIN/DATAMAX to encoded output
Paul B Mahol [Mon, 8 Feb 2021 17:46:36 +0000 (18:46 +0100)]
avformat/fitsenc: write DATAMIN/DATAMAX to encoded output

There is no point in doing normalization when such files are decoded.

Update fate test with new results.

11 months agoavcodec/fitsdec: properly initialize header->data_max
Paul B Mahol [Mon, 8 Feb 2021 16:45:57 +0000 (17:45 +0100)]
avcodec/fitsdec: properly initialize header->data_max

11 months agoavfilter/af_arnndn: make model opening errors more verbose
Paul B Mahol [Tue, 9 Feb 2021 22:07:56 +0000 (23:07 +0100)]
avfilter/af_arnndn: make model opening errors more verbose

Also return proper error code.

11 months agoavformat/mov: factor size out of probe code
Michael Niedermayer [Sat, 6 Feb 2021 17:22:54 +0000 (18:22 +0100)]
avformat/mov: factor size out of probe code

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
11 months agoavformat/wtvdec: Check len in parse_chunks() to avoid overflow
Michael Niedermayer [Mon, 8 Feb 2021 13:29:01 +0000 (14:29 +0100)]
avformat/wtvdec: Check len in parse_chunks() to avoid overflow

Fixes: signed integer overflow: 2147483647 + 7 cannot be represented in type 'int'
Fixes: 30084/clusterfuzz-testcase-minimized-ffmpeg_dem_WTV_fuzzer-6192261941559296

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>
11 months agoavformat/wtvdec: Check for EOF before potentially reseting the eof state
Michael Niedermayer [Fri, 11 Dec 2020 23:41:17 +0000 (00:41 +0100)]
avformat/wtvdec: Check for EOF before potentially reseting the eof state

Fixes: infinite loop
Fixes: 28042/clusterfuzz-testcase-minimized-ffmpeg_dem_WTV_fuzzer-6311288967528448

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
11 months agoavformat/asfdec_f: Add an additional check for the extradata size
Michael Niedermayer [Sun, 7 Feb 2021 20:50:03 +0000 (21:50 +0100)]
avformat/asfdec_f: Add an additional check for the extradata size

Fixes: OOM
Fixes: 30066/clusterfuzz-testcase-minimized-ffmpeg_dem_ASF_fuzzer-6182309126602752

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>
11 months agoavformat/3dostr: Check sample_rate
Michael Niedermayer [Mon, 8 Feb 2021 13:29:02 +0000 (14:29 +0100)]
avformat/3dostr: Check sample_rate

Fixes: signed integer overflow: -1268324762623155200 * 8 cannot be represented in type 'long'
Fixes: 30123/clusterfuzz-testcase-minimized-ffmpeg_dem_THREEDOSTR_fuzzer-6710765123928064

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>
11 months agoavfilter/vf_curves: add commands support
Paul B Mahol [Tue, 9 Feb 2021 17:08:16 +0000 (18:08 +0100)]
avfilter/vf_curves: add commands support

11 months agoavcodec: add cri parser
Paul B Mahol [Fri, 5 Feb 2021 19:10:49 +0000 (20:10 +0100)]
avcodec: add cri parser

11 months agoavcodec/argo: fix linesize for RLE? in PAL8 mode
Paul B Mahol [Tue, 9 Feb 2021 13:17:41 +0000 (14:17 +0100)]
avcodec/argo: fix linesize for RLE? in PAL8 mode

11 months agoavfilter/vf_framepack: add >8 format support
Paul B Mahol [Tue, 9 Feb 2021 11:25:48 +0000 (12:25 +0100)]
avfilter/vf_framepack: add >8 format support

11 months agoavfilter/vf_swaprect: add support for commands
Paul B Mahol [Tue, 9 Feb 2021 10:38:37 +0000 (11:38 +0100)]
avfilter/vf_swaprect: add support for commands

11 months agoavfilter/vf_maskfun: add support for commands
Paul B Mahol [Tue, 9 Feb 2021 10:23:19 +0000 (11:23 +0100)]
avfilter/vf_maskfun: add support for commands

11 months agoavfilter/vf_zscale: switch verbose log to trace
Paul B Mahol [Tue, 9 Feb 2021 09:35:36 +0000 (10:35 +0100)]
avfilter/vf_zscale: switch verbose log to trace

Not needed in verbose mode.

11 months agoavfilter/vf_lut: add support for commands
Paul B Mahol [Mon, 8 Feb 2021 15:31:21 +0000 (16:31 +0100)]
avfilter/vf_lut: add support for commands

While here remove excessive log and uninit() call in negate_init().

11 months agoavfilter/vf_deband: add support for commands
Paul B Mahol [Mon, 8 Feb 2021 15:08:25 +0000 (16:08 +0100)]
avfilter/vf_deband: add support for commands

11 months agoavfilter/vf_deband: avoid doubles
Paul B Mahol [Mon, 8 Feb 2021 14:58:42 +0000 (15:58 +0100)]
avfilter/vf_deband: avoid doubles

11 months agoavcodec/g722enc: Validate parameters before using them
Andreas Rheinhardt [Fri, 5 Feb 2021 11:23:49 +0000 (12:23 +0100)]
avcodec/g722enc: Validate parameters before using them

In case trellis is outside of 0..23, an invalid shift and/or a signed
integer overflow happens; furthermore, it can lead to the request to
allocate nonsense amounts of memory. So validate first.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
11 months agoavfilter/vf_thumbnail: add support for rest of packed rgb formats
Paul B Mahol [Mon, 8 Feb 2021 11:58:12 +0000 (12:58 +0100)]
avfilter/vf_thumbnail: add support for rest of packed rgb formats

11 months agoavfilter/vf_thumbnail: add support for YUV and GBRP formats
Paul B Mahol [Sat, 6 Feb 2021 20:59:50 +0000 (21:59 +0100)]
avfilter/vf_thumbnail: add support for YUV and GBRP formats

11 months agovf_pp: remove unnecessary free
Anton Khirnov [Tue, 26 Jan 2021 16:25:54 +0000 (17:25 +0100)]
vf_pp: remove unnecessary free

ff_qp_table_extract() frees the table on failure.

Found-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
11 months agomjpegdec: stop setting the QP table
Anton Khirnov [Tue, 26 Jan 2021 16:13:59 +0000 (17:13 +0100)]
mjpegdec: stop setting the QP table

MJPEG does not have a single quantiser scale, so this does not fit into
the intended API use.

This removes the last use of the long-deprecated QP table API.

11 months agoavfilter/vf_lut3d: lut3d, haldclut: add support for commands
Paul B Mahol [Sun, 7 Feb 2021 23:53:53 +0000 (00:53 +0100)]
avfilter/vf_lut3d: lut3d, haldclut: add support for commands

11 months agoavfilter/vf_lut2: add support for commands
Paul B Mahol [Sun, 7 Feb 2021 21:39:25 +0000 (22:39 +0100)]
avfilter/vf_lut2: add support for commands

11 months agoavfilter/vf_extractplanes: add float formats support
Paul B Mahol [Sun, 7 Feb 2021 20:41:04 +0000 (21:41 +0100)]
avfilter/vf_extractplanes: add float formats support

11 months agoavformat/libsrt: fix race condition with libsrt_network_wait_fd and epoll
Marton Balint [Sat, 30 Jan 2021 23:45:33 +0000 (00:45 +0100)]
avformat/libsrt: fix race condition with libsrt_network_wait_fd and epoll

The way SRT's async / epoll-based IO works is that the event status is stored
in the epoll containers. That is, if an event occurs on an SRT socket, and that
SRT socket isn't part of any epoll container, then that event is lost. If we
later add that socket to an epoll container, we still won't receive the event
even if it wasn't serviced.

Therefore we create the epoll and put the fd into it right after the connection
is established.

See http://lists.ffmpeg.org/pipermail/ffmpeg-devel/2021-January/275334.html

Signed-off-by: Marton Balint <cus@passwd.hu>
11 months agoavformat/libsrt: fix or simplify some function return values
Marton Balint [Sat, 30 Jan 2021 23:25:14 +0000 (00:25 +0100)]
avformat/libsrt: fix or simplify some function return values

Sometimes there was a confusion between srt_*() function return values and
libavformat-style return values.

Signed-off-by: Marton Balint <cus@passwd.hu>
11 months agoavformat/libsrt: close listen fd immediately after accept
Marton Balint [Sat, 30 Jan 2021 22:57:34 +0000 (23:57 +0100)]
avformat/libsrt: close listen fd immediately after accept

There is no reason to keep it open.

Signed-off-by: Marton Balint <cus@passwd.hu>
11 months agoavfilter: add colorize filter
Paul B Mahol [Thu, 4 Feb 2021 14:06:35 +0000 (15:06 +0100)]
avfilter: add colorize filter

11 months agoavcodec/ac3enc: Share options and defaults
Andreas Rheinhardt [Thu, 3 Dec 2020 04:32:18 +0000 (05:32 +0100)]
avcodec/ac3enc: Share options and defaults

Both AC-3 encoder share the same options, yet they are nevertheless
duplicated in the binary; and the options applying to the EAC-3 encoder
are a proper subset of the options for the AC-3 encoders, so that it can
use the same options as the former by putting the options specific to
AC-3 at the front. This commit implements this.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
11 months agoavcodec/Makefile: Remove dependency for nonexistent files
Andreas Rheinhardt [Thu, 28 Jan 2021 13:55:50 +0000 (14:55 +0100)]
avcodec/Makefile: Remove dependency for nonexistent files

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
11 months agoavcodec/aacdec_fixed: Move fixed-point sinewin tables to its only user
Andreas Rheinhardt [Wed, 30 Dec 2020 00:46:34 +0000 (01:46 +0100)]
avcodec/aacdec_fixed: Move fixed-point sinewin tables to its only user

The fixed-point AAC decoder is the only user of the fixed-point sinewin
tables from sinewin; and it only uses a few of them (about 10% when
counting by size). This means that guarding initializing these tables by
an AVOnce (as done in 3719122065863f701026632f610175980d42b05a) is
unnecessary for them. Furthermore the array of pointers to the
individual arrays is also unneeded.

Therefore this commit moves these tables directly into aacdec_fixed.c;
this is done by ridding the original sinewin.h and sinewin_tablegen.h
headers completely of any fixed-point code at the cost of a bit of
duplicated code (the alternative is an ugly ifdef-mess).

This saves about 58KB from the binary when using hardcoded tables (as
these tables are hardcoded in this scenario); when not using hardcoded
tables, most of these savings only affect the .bss segment, but the rest
(< 1KB) contains relocations (i.e. savings in .data.rel.ro).

Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
11 months agoffbuild/common: Make deletion of templates possible
Andreas Rheinhardt [Wed, 27 Jan 2021 23:04:53 +0000 (00:04 +0100)]
ffbuild/common: Make deletion of templates possible

If a target to be built includes a template file, the target's .d file
includes the template file as a prerequisite; if the code were changed so
that the template file no longer exists, one would get an error from
make that it has no rule for the template file target. Therefore add a
dummy rule for template files to make deleting them possible.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
11 months agodoc/general_contents: add few more entries
Paul B Mahol [Sat, 6 Feb 2021 22:38:14 +0000 (23:38 +0100)]
doc/general_contents: add few more entries

Also extend description of some entries.

11 months agoavdevice/xcbgrab: don't assume xserver endianness
Andriy Gelman [Sun, 31 Jan 2021 19:41:47 +0000 (14:41 -0500)]
avdevice/xcbgrab: don't assume xserver endianness

xserver defines the endianness of the grabbed images. Use this information
to set the correct pixel format.

This also fixes format selection in configuration depth=32/bpp=32 with
xserver on a little endian machine. Before the patch, the big endian
layout 0RGB was always selected which is incorrect because BGR0 should
be used. RGB24 was also incorrectly assumed (but this format was removed
in xserver 1.20).

The big-endian settings can be tested using docker+qemu from a little-endian
machine:

$ docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
$ docker run --rm -it -v /tmp:/tmp powerpc64/debian /bin/bash

In docker container
$ apt-get update
$ apt-get install xvfb
$ apt-get install x11-apps

To test AV_PIX_FMT_0RGB32
$ Xvfb :2 -screen 0 720x480x24 &
$ export DISPLAY=:2
$ xclock -geometry 720x480 -bg green #test different colors

On your host machine grab the frames using the following
command. View output to check that colors are rendered correctly
$ ./ffmpeg -y -f x11grab -i :2.0 -codec:v mpeg2video out.mp4

Other pixel formats can be tested by modifying how Xvfb is started in the docker
container:

AV_PIX_FMT_RGB565
$ Xvfb :2 -screen 0 720x480x16

AV_PIX_FMT_RGB555
$ Xvfb :2 -screen 0 720x480x15

AV_PIX_FMT_BGR24 / AV_PIX_FMT_RGB24
This is difficult to test because bpp=24 support was removed in xserver 1.20
https://lists.x.org/archives/xorg-devel/2018-February/056175.html?hmsr=joyk.com&utm_source=joyk.com&utm_medium=referral
However, I was able to run previous version of Xvfb (with some
modifications to force 24bpp) to check that images are rendered correctly.

Reviewed-by: Carl Eugen Hoyos <ceffmpeg@gmail.com>
Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
11 months agoavfilter/vf_deblock: add support for commands
Paul B Mahol [Sat, 6 Feb 2021 14:21:56 +0000 (15:21 +0100)]
avfilter/vf_deblock: add support for commands

11 months agoavfilter/vf_lut3d: lut1d: add support for commands
Paul B Mahol [Sat, 6 Feb 2021 11:45:39 +0000 (12:45 +0100)]
avfilter/vf_lut3d: lut1d: add support for commands