ffmpeg.git
2 hours agoavfilter/avf_showspectrum: rewrite frequency log axis/bin scaling master
Paul B Mahol [Sun, 19 Sep 2021 20:27:07 +0000 (22:27 +0200)]
avfilter/avf_showspectrum: rewrite frequency log axis/bin scaling

7 hours agoavcodec/elbg: Keep buffers to avoid allocations and frees
Andreas Rheinhardt [Thu, 16 Sep 2021 00:46:48 +0000 (02:46 +0200)]
avcodec/elbg: Keep buffers to avoid allocations and frees

Up until now, each call to avpriv_elbg_do() would result
in at least six allocations. And this function is called a lot:
A typical FATE run results in 52213653 calls to av_malloc; of these,
34974671 originate from av_malloc_array and from these 34783679
originate from avpriv_elbg_do; the msvideo1 encoder tests are behind
most of these.

This commit changes this by keeping the buffers and only reallocating
them when needed. E.g. for the encoding part of fate-vsynth1-msvideo1
total heap usage went down from 11,407,939 allocs and frees with
468,106,207 bytes allocated to 3,149 allocs and frees with 13,181,847
bytes allocated. The time for one encode2-call went down by 69%.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
8 hours agoavcodec/elbg: Move arguments to the context early if possible
Andreas Rheinhardt [Wed, 15 Sep 2021 23:55:25 +0000 (01:55 +0200)]
avcodec/elbg: Move arguments to the context early if possible

This affects all the arguments that don't change during a call
to avpriv_elbg_do(); doing so makes it easily recognizable which
arguments change upon recursive calls.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
8 hours agoavcodec/elbg: Add persistent ELBGContext
Andreas Rheinhardt [Wed, 15 Sep 2021 22:36:30 +0000 (00:36 +0200)]
avcodec/elbg: Add persistent ELBGContext

It will be used in future commits to avoid having to allocate and free
all the buffers used.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
8 hours agoavcodec/elbg: Rename elbg_data to ELBGContext
Andreas Rheinhardt [Wed, 15 Sep 2021 21:10:41 +0000 (23:10 +0200)]
avcodec/elbg: Rename elbg_data to ELBGContext

It is in line with our naming conventions for types.
Also change numCB to num_cb for the same reason.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
8 hours agoavfilter/vf_elbg: Rename ELBGContext->ELBGFilterContext
Andreas Rheinhardt [Wed, 15 Sep 2021 21:02:07 +0000 (23:02 +0200)]
avfilter/vf_elbg: Rename ELBGContext->ELBGFilterContext

The former name will be used for a context for avpriv_do_elbg().

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
9 hours agoavcodec/elbg: Merge avpriv_init_elbg() into avpriv_do_elbg()
Andreas Rheinhardt [Wed, 15 Sep 2021 20:38:28 +0000 (22:38 +0200)]
avcodec/elbg: Merge avpriv_init_elbg() into avpriv_do_elbg()

These functions are always called directly after another with
the exact same arguments. This avoids exporting a symbol;
it also avoids having to perform two calls for every caller.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
9 hours agoavcodec/elbg: Move avpriv_init_elbg() down
Andreas Rheinhardt [Wed, 15 Sep 2021 20:34:34 +0000 (22:34 +0200)]
avcodec/elbg: Move avpriv_init_elbg() down

It will avoid a forward declaration later.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
11 hours agofftools/ffmpeg_opt: Add missing AV_OPT_SEARCH_FAKE_OBJ
Andreas Rheinhardt [Wed, 15 Sep 2021 13:25:54 +0000 (15:25 +0200)]
fftools/ffmpeg_opt: Add missing AV_OPT_SEARCH_FAKE_OBJ

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
12 hours agoavutil/mem: Deprecate av_mallocz_array()
Andreas Rheinhardt [Tue, 14 Sep 2021 21:32:37 +0000 (23:32 +0200)]
avutil/mem: Deprecate av_mallocz_array()

It does the same as av_calloc(), so one of them should be removed.
Given that av_calloc() has the shorter name, it is retained.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
12 hours agoReplace all occurences of av_mallocz_array() by av_calloc()
Andreas Rheinhardt [Tue, 14 Sep 2021 19:31:53 +0000 (21:31 +0200)]
Replace all occurences of av_mallocz_array() by av_calloc()

They do the same.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
12 hours agoavcodec/opus_silk: Remove wrong size information in function declaration
Andreas Rheinhardt [Mon, 13 Sep 2021 12:38:50 +0000 (14:38 +0200)]
avcodec/opus_silk: Remove wrong size information in function declaration

silk_lsp2poly()'s declaration contained arrays with array sizes;
yet these array sizes exceeded the number of actually accessed array
elements (which is related to another parameter) and this leads to
-Wstringop-overflow= warnings from GCC 11, because the arrays provided
by callers are only large enough for the actually used elements.

So replace the incorrect array sizes with comments containing
the correct array sizes. Given that these sizes are not compile-time
constants, they can only be communicated via a comment.

Reported by Paul B Mahol.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
12 hours agoavcodec/avcodec, options_table: Deprecate sub_text_format
Andreas Rheinhardt [Mon, 13 Sep 2021 11:52:46 +0000 (13:52 +0200)]
avcodec/avcodec, options_table: Deprecate sub_text_format

Unused since 1f63665ca567fbc49fa80166d468a822c2999efa.

Found-by: Soft Works <softworkz@hotmail.com>
Reviewed-by: Soft Works <softworkz@hotmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
13 hours agoavfilter/vf_subtitles, fftools/ffmpeg: Don't set sub_text_format
Andreas Rheinhardt [Mon, 13 Sep 2021 11:16:39 +0000 (13:16 +0200)]
avfilter/vf_subtitles, fftools/ffmpeg: Don't set sub_text_format

Unnecessary since 1f63665ca567fbc49fa80166d468a822c2999efa, because
the value the option is set to coincides with the default value.

Found-by: Soft Works <softworkz@hotmail.com>
Reviewed-by: Soft Works <softworkz@hotmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
13 hours agoavutil/opt: Simplify av_opt_set_dict2()
Andreas Rheinhardt [Mon, 13 Sep 2021 11:35:36 +0000 (13:35 +0200)]
avutil/opt: Simplify av_opt_set_dict2()

Make it clearer that the ordinary exit always returns 0.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
13 hours agoavutil/opt: Also warn for deprecated named constants
Andreas Rheinhardt [Mon, 13 Sep 2021 09:58:41 +0000 (11:58 +0200)]
avutil/opt: Also warn for deprecated named constants

Intended for the "truncated" AVCodecContext flag.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
13 hours agoRevert "fate: Add test for ticket 6024, truncated decoding mode"
Anton Khirnov [Mon, 8 Mar 2021 10:26:33 +0000 (11:26 +0100)]
Revert "fate: Add test for ticket 6024, truncated decoding mode"

This reverts commit 47cd8effea343e71c4010929ed3fb10dd3dca4b1.
AV_CODEC_FLAG_TRUNCATED is now deprecated.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
13 hours agofftools/cmdutils: Don't report AV_CODEC_CAP_TRUNCATED
Andreas Rheinhardt [Sun, 12 Sep 2021 16:04:06 +0000 (18:04 +0200)]
fftools/cmdutils: Don't report AV_CODEC_CAP_TRUNCATED

It is deprecated.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
13 hours agoavcodec/(h263|mpeg4?video)_parser: Make *_find_frame_end() static
Andreas Rheinhardt [Sun, 12 Sep 2021 17:51:36 +0000 (19:51 +0200)]
avcodec/(h263|mpeg4?video)_parser: Make *_find_frame_end() static

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
13 hours agolavc: deprecate AV_CODEC_(FLAG|CAP)_TRUNCATED
Anton Khirnov [Mon, 8 Mar 2021 10:26:32 +0000 (11:26 +0100)]
lavc: deprecate AV_CODEC_(FLAG|CAP)_TRUNCATED

It is supported only by a few decoders (h263, h263p, mpeg(1|2|)video
and mpeg4) and is entirely redundant with parsers. Furthermore, using
it leads to missing frames, as flushing the decoder at the end does not
work properly.

Co-authored-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
13 hours agoavcodec/mpegvideo: Move startcodes to mpeg12.h
Andreas Rheinhardt [Sun, 12 Sep 2021 17:02:18 +0000 (19:02 +0200)]
avcodec/mpegvideo: Move startcodes to mpeg12.h

And remove the MPEG-4-specific SLICE_START_CODE, which duplicates
SLICE_STARTCODE.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
13 hours agoswscale/swscale: Disable x86-specific code for other arches
Andreas Rheinhardt [Sat, 18 Sep 2021 03:33:25 +0000 (05:33 +0200)]
swscale/swscale: Disable x86-specific code for other arches

SSE2 is x86 specific, yet due to the call to av_get_cpu_flags()
compilers were unable to optimize the checks (and the call) away
on other arches.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
13 hours agoswscale/swscale: Fix races when using unaligned strides/data
Andreas Rheinhardt [Sat, 18 Sep 2021 03:11:57 +0000 (05:11 +0200)]
swscale/swscale: Fix races when using unaligned strides/data

In this case the current code tries to warn once; to do so, it uses
ordinary static ints to store whether the warning has already been
emitted. This is both a data race (and therefore undefined behaviour)
as well as a race condition, because it is really possible for multiple
threads to be the one thread to emit the warning. This is actually
common since the introduction of the new multithreaded scaling API.

This commit fixes this by using atomic integers for the state;
furthermore, these are not static anymore, but rather contained
in the user-facing SwsContext (i.e. the parent SwsContext in case
of slice-threading).

Given that these atomic variables are not intended for synchronization
at all (but only for atomicity, i.e. only to output the warning once),
the atomic operations use memory_order_relaxed.

This affected the nv12, nv21, yuv420, yuv420p10, yuv422, yuv422p10 and
yuv444 filter-overlay FATE-tests.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
13 hours agolibswscale/options: Add parent_log_context_offset to AVClass
Andreas Rheinhardt [Sat, 18 Sep 2021 02:46:45 +0000 (04:46 +0200)]
libswscale/options: Add parent_log_context_offset to AVClass

This allows to associate log messages from slice contexts to
the user-visible SwsContext.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
13 hours agofate/demux, gapless, image: Add missing ffprobe dependencies
Andreas Rheinhardt [Sat, 18 Sep 2021 23:18:24 +0000 (01:18 +0200)]
fate/demux, gapless, image: Add missing ffprobe dependencies

And remove the unnecessary ffmpeg dependencies while at it.

Reviewed-by: Soft Works <softworkz@hotmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
14 hours agoavcodec/snowdec: Maintain avmv buffer
Michael Niedermayer [Sat, 14 Aug 2021 14:45:02 +0000 (16:45 +0200)]
avcodec/snowdec: Maintain avmv buffer

This avoids reallocating per frame

Fixes: Assertion failure
Fixes: 36359/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SNOW_fuzzer-6733238591684608
Fixes: 38623/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SNOW_fuzzer-6098656512573440

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
17 hours agoavcodec/siren: Check index for catergory5
Michael Niedermayer [Fri, 17 Sep 2021 19:51:06 +0000 (21:51 +0200)]
avcodec/siren: Check index for catergory5

Fixes: out of array access
Fixes: 38603/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MSNSIREN_fuzzer-5741847809490944.fuzz

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>
17 hours agoavformat/dhav: do not use zero fps
Michael Niedermayer [Fri, 17 Sep 2021 19:28:00 +0000 (21:28 +0200)]
avformat/dhav: do not use zero fps

Fixes: assertion failure
Fixes: 38332/clusterfuzz-testcase-minimized-ffmpeg_dem_DHAV_fuzzer-4522405595316224

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>
17 hours agotools/target_dec_fuzzer: Adjust VC1 threshold
Michael Niedermayer [Fri, 17 Sep 2021 19:22:10 +0000 (21:22 +0200)]
tools/target_dec_fuzzer: Adjust VC1 threshold

Fixes: Timeout
Fixes: 38215/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VC1_fuzzer-6375595299176448

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
23 hours agoavfilter/avf_avectorscope: fix zoom 0 mode with nonlinear scale
Paul B Mahol [Sun, 19 Sep 2021 11:47:59 +0000 (13:47 +0200)]
avfilter/avf_avectorscope: fix zoom 0 mode with nonlinear scale

23 hours agoavfilter/avf_avectorscope: add support for commands
Paul B Mahol [Sun, 19 Sep 2021 11:32:10 +0000 (13:32 +0200)]
avfilter/avf_avectorscope: add support for commands

24 hours agoavfilter/avf_avectorscope: add slice threading for fade function
Paul B Mahol [Sun, 19 Sep 2021 11:12:58 +0000 (13:12 +0200)]
avfilter/avf_avectorscope: add slice threading for fade function

24 hours agoavfilter/avf_avectorscope: add ultra fast path when slow fading is disabled
Paul B Mahol [Sun, 19 Sep 2021 10:31:14 +0000 (12:31 +0200)]
avfilter/avf_avectorscope: add ultra fast path when slow fading is disabled

32 hours agoavfilter/vf_hflip: Don't call av_pix_fmt_desc_get() twice
Andreas Rheinhardt [Sat, 11 Sep 2021 13:07:49 +0000 (15:07 +0200)]
avfilter/vf_hflip: Don't call av_pix_fmt_desc_get() twice

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
32 hours agoavfilter/vf_zscale: Use init instead of init_dict
Andreas Rheinhardt [Mon, 13 Sep 2021 16:22:30 +0000 (18:22 +0200)]
avfilter/vf_zscale: Use init instead of init_dict

The AVDictionary was unused.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
32 hours agoavfilter/vf_spp: Add dummy element to array to avoid shift
Andreas Rheinhardt [Mon, 13 Sep 2021 16:04:57 +0000 (18:04 +0200)]
avfilter/vf_spp: Add dummy element to array to avoid shift

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
32 hours agoavfilter/vf_spp: Use preinit instead of init_dict
Andreas Rheinhardt [Mon, 13 Sep 2021 14:54:58 +0000 (16:54 +0200)]
avfilter/vf_spp: Use preinit instead of init_dict

By using preinit, the AVDCT already exists directly after
allocating the filter, so that the filter's AVClass's child_next
becomes usable for setting options with the AV_OPT_SEARCH_CHILDREN
search flag. This means that it is no longer necessary to use
the init_dict callback for this filter.

Furthermore, the earlier code did not abide by the documentation
of the init_dict callback at all: Instead of only returning the
options that have not been recognized it always returned all options
on any av_opt_set() error and errored out in this case, even if it
is just an unrecognized option. This behaviour has been inherited by
avfilter_init_dict(), contradicting its documentation. This is also
fixed in this commit.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
32 hours agoavfilter/af_aresample: Use preinit instead of init_dict
Andreas Rheinhardt [Mon, 13 Sep 2021 14:54:58 +0000 (16:54 +0200)]
avfilter/af_aresample: Use preinit instead of init_dict

By using preinit, the SwrContext already exists directly after
allocating the filter, so that the filter's AVClass's child_next
becomes usable for setting options with the AV_OPT_SEARCH_CHILDREN
search flag. This means that it is no longer necessary to use
the init_dict callback for this filter.

Furthermore, the earlier code did not abide by the documentation
of the init_dict callback at all: Instead of only returning the
options that have not been recognized it always returned all options
on any av_opt_set() error and errored out in this case; yet if
the error was just caused by an unrecognized option, it should not
error out at all and instead return said option.

This behaviour has been inherited by avfilter_init_dict(),
contradicting its documentation. This is also fixed by this commit.

Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
32 hours agoavformat/rtsp: Use av_dict_set_int()
Andreas Rheinhardt [Mon, 13 Sep 2021 18:38:03 +0000 (20:38 +0200)]
avformat/rtsp: Use av_dict_set_int()

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
32 hours agoavfilter/vf_readeia608: Use av_dict_set_int()
Andreas Rheinhardt [Mon, 13 Sep 2021 18:48:15 +0000 (20:48 +0200)]
avfilter/vf_readeia608: Use av_dict_set_int()

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
32 hours agoavfilter/vf_scale: Deduplicate AVClasses
Andreas Rheinhardt [Mon, 13 Sep 2021 21:02:37 +0000 (23:02 +0200)]
avfilter/vf_scale: Deduplicate AVClasses

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
32 hours agoavfilter/vsrc_testsrc: Deduplicate AVClasses
Andreas Rheinhardt [Fri, 10 Sep 2021 21:03:54 +0000 (23:03 +0200)]
avfilter/vsrc_testsrc: Deduplicate AVClasses

Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
32 hours agoavfilter/vf_weave: Deduplicate AVClasses
Andreas Rheinhardt [Fri, 10 Sep 2021 21:01:19 +0000 (23:01 +0200)]
avfilter/vf_weave: Deduplicate AVClasses

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
32 hours agoavfilter/vf_stack: Deduplicate AVClasses
Andreas Rheinhardt [Fri, 10 Sep 2021 21:00:37 +0000 (23:00 +0200)]
avfilter/vf_stack: Deduplicate AVClasses

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
32 hours agoavfilter/vf_premultiply: Deduplicate AVClasses
Andreas Rheinhardt [Fri, 10 Sep 2021 20:59:18 +0000 (22:59 +0200)]
avfilter/vf_premultiply: Deduplicate AVClasses

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
32 hours agoavfilter/vf_neighbor: Deduplicate AVClasses
Andreas Rheinhardt [Fri, 10 Sep 2021 20:58:21 +0000 (22:58 +0200)]
avfilter/vf_neighbor: Deduplicate AVClasses

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
32 hours agoavfilter/vf_maskedminmax: Deduplicate AVClasses
Andreas Rheinhardt [Fri, 10 Sep 2021 20:53:01 +0000 (22:53 +0200)]
avfilter/vf_maskedminmax: Deduplicate AVClasses

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
32 hours agoavfilter/vf_lut: Remove empty init function
Andreas Rheinhardt [Fri, 10 Sep 2021 20:50:57 +0000 (22:50 +0200)]
avfilter/vf_lut: Remove empty init function

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
32 hours agoavfilter/vf_lut: Deduplicate AVClasses
Andreas Rheinhardt [Fri, 10 Sep 2021 20:44:14 +0000 (22:44 +0200)]
avfilter/vf_lut: Deduplicate AVClasses

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
32 hours agoavfilter/vf_format: Deduplicate AVClasses
Andreas Rheinhardt [Fri, 10 Sep 2021 20:40:20 +0000 (22:40 +0200)]
avfilter/vf_format: Deduplicate AVClasses

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
33 hours agoavfilter/vf_blend: Don't redefine options name
Andreas Rheinhardt [Fri, 10 Sep 2021 20:37:11 +0000 (22:37 +0200)]
avfilter/vf_blend: Don't redefine options name

Use AVFILTER_DEFINE_CLASS_EXT instead.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
33 hours agoavfilter/src_movie: Deduplicate AVClasses
Andreas Rheinhardt [Fri, 10 Sep 2021 20:36:18 +0000 (22:36 +0200)]
avfilter/src_movie: Deduplicate AVClasses

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
33 hours agoavfilter/split: Deduplicate AVClasses
Andreas Rheinhardt [Fri, 10 Sep 2021 20:35:42 +0000 (22:35 +0200)]
avfilter/split: Deduplicate AVClasses

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
33 hours agoavfilter/f_zmq: Deduplicate AVClasses
Andreas Rheinhardt [Fri, 10 Sep 2021 20:33:16 +0000 (22:33 +0200)]
avfilter/f_zmq: Deduplicate AVClasses

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
33 hours agoavfilter/f_streamselect: Deduplicate AVClasses
Andreas Rheinhardt [Fri, 10 Sep 2021 20:31:11 +0000 (22:31 +0200)]
avfilter/f_streamselect: Deduplicate AVClasses

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
33 hours agoavfilter/f_sendcmd: Deduplicate AVClasses
Andreas Rheinhardt [Fri, 10 Sep 2021 20:29:00 +0000 (22:29 +0200)]
avfilter/f_sendcmd: Deduplicate AVClasses

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
33 hours agoavfilter/f_realtime: Deduplicate AVClasses
Andreas Rheinhardt [Fri, 10 Sep 2021 20:27:36 +0000 (22:27 +0200)]
avfilter/f_realtime: Deduplicate AVClasses

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
33 hours agoavfilter/f_perms: Deduplicate AVClasses
Andreas Rheinhardt [Fri, 10 Sep 2021 20:18:12 +0000 (22:18 +0200)]
avfilter/f_perms: Deduplicate AVClasses

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
33 hours agoavfilter/f_graphmonitor: Deduplicate AVClasses
Andreas Rheinhardt [Fri, 10 Sep 2021 20:16:18 +0000 (22:16 +0200)]
avfilter/f_graphmonitor: Deduplicate AVClasses

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
33 hours agoavfilter/f_drawgraph: Deduplicate AVClasses
Andreas Rheinhardt [Fri, 10 Sep 2021 19:27:40 +0000 (21:27 +0200)]
avfilter/f_drawgraph: Deduplicate AVClasses

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
33 hours agoavfilter/f_cue: Deduplicate AVClasses
Andreas Rheinhardt [Fri, 10 Sep 2021 19:20:12 +0000 (21:20 +0200)]
avfilter/f_cue: Deduplicate AVClasses

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
33 hours agoavfilter/af_sidechaincompress: Deduplicate AVClasses
Andreas Rheinhardt [Fri, 10 Sep 2021 19:13:46 +0000 (21:13 +0200)]
avfilter/af_sidechaincompress: Deduplicate AVClasses

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
33 hours agoavfilter/af_biquads: Deduplicate AVClasses
Andreas Rheinhardt [Fri, 10 Sep 2021 18:52:54 +0000 (20:52 +0200)]
avfilter/af_biquads: Deduplicate AVClasses

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
33 hours agoavfilter/af_asupercut: Deduplicate AVClasses
Andreas Rheinhardt [Fri, 10 Sep 2021 18:47:59 +0000 (20:47 +0200)]
avfilter/af_asupercut: Deduplicate AVClasses

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
33 hours agoavfilter/vf_convolution: Deduplicate AVClasses
Andreas Rheinhardt [Sat, 11 Sep 2021 20:08:42 +0000 (22:08 +0200)]
avfilter/vf_convolution: Deduplicate AVClasses

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
33 hours agoavfilter/vf_convolution: Fix standalone build of kirsch, scharr filters
Andreas Rheinhardt [Sat, 11 Sep 2021 19:47:13 +0000 (21:47 +0200)]
avfilter/vf_convolution: Fix standalone build of kirsch, scharr filters

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
33 hours agoavfilter/af_agate: Deduplicate AVClasses
Andreas Rheinhardt [Fri, 10 Sep 2021 18:45:36 +0000 (20:45 +0200)]
avfilter/af_agate: Deduplicate AVClasses

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
38 hours agoavformat/demux: Use av_opt_set_int() where appropriate
Andreas Rheinhardt [Fri, 17 Sep 2021 15:17:18 +0000 (17:17 +0200)]
avformat/demux: Use av_opt_set_int() where appropriate

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
38 hours agoavutil/buffer: Avoid allocation of AVBuffer when using buffer pool
Andreas Rheinhardt [Tue, 14 Sep 2021 09:29:23 +0000 (11:29 +0200)]
avutil/buffer: Avoid allocation of AVBuffer when using buffer pool

Do this by putting an AVBuffer structure into BufferPoolEntry and
reuse it for all subsequent uses of said BufferPoolEntry.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
38 hours agoavfilter/vf_zscale: Don't make assumptions about zimg's range enums
Andreas Rheinhardt [Fri, 17 Sep 2021 19:29:58 +0000 (21:29 +0200)]
avfilter/vf_zscale: Don't make assumptions about zimg's range enums

zimg's color range enum values are off-by-one compared to ours;
therefore the code just adds one when converting from theirs to ours.
Yet this is not how one should deal with enums; use a switch instead.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
39 hours agoavformat/libsrt: remove url_get_file_handle implementation
Zhao Zhili [Mon, 9 Aug 2021 07:19:11 +0000 (15:19 +0800)]
avformat/libsrt: remove url_get_file_handle implementation

SRTSOCKET is an abstraction designed by libsrt, it's not guaranteed
to be a real file descriptor. Even if it is, it should not be
operated directly outside of libsrt.

Signed-off-by: Marton Balint <cus@passwd.hu>
39 hours agoavformat/libsrt: log streamid in listener mode
Zhao Zhili [Thu, 10 Jun 2021 03:58:43 +0000 (11:58 +0800)]
avformat/libsrt: log streamid in listener mode

It's useful for test client which pass streamid to ffmpeg/ffplay.
For example, use ffmpeg to test streamid support in VLC:
./ffmpeg -v info -re -i foo.mp4 -c copy -f mpegts -mode listener srt://127.0.0.1:9000
./vlc srt://127.0.0.1:9000?streamid=foobar

Signed-off-by: Marton Balint <cus@passwd.hu>
40 hours agoavformat/mpegts: fixes overflow when parsing the PMT
Nicolas Jorge Dato [Wed, 15 Sep 2021 12:58:11 +0000 (09:58 -0300)]
avformat/mpegts: fixes overflow when parsing the PMT

When a possible overflow was detected, there was a break to exit the while
loop. However, it should have already substracted 2 bytes from
program_info_length (descriptor ID + length).

Fixes ticket #9422.

Signed-off-by: Marton Balint <cus@passwd.hu>
2 days agolibavfilter/x86/vf_gblur: correct the order of loop step
Wu Jianhua [Thu, 16 Sep 2021 07:34:08 +0000 (15:34 +0800)]
libavfilter/x86/vf_gblur: correct the order of loop step

The problem was caused by if the width of the processed block
minus 1 is a multiple of the aligned number the instruction
jle .bscale_scalar would skip the Optimized Loop Step, which
will lead to an incorrect sampling when specifying steps more
than 1. Move the Optimized Loop Step after .bscale_scalar to
ensure the loop step is enabled.

Signed-off-by: Wu Jianhua <jianhua.wu@intel.com>
2 days agolibavfilter/x86/vf_gblur: fixed the fate-test failed on MacOS
Wu Jianhua [Thu, 16 Sep 2021 07:34:07 +0000 (15:34 +0800)]
libavfilter/x86/vf_gblur: fixed the fate-test failed on MacOS

Signed-off-by: Wu Jianhua <jianhua.wu@intel.com>
2 days agoavfilter/vf_zscale: fix output color_range discrepancy
Pavel Koshevoy [Fri, 17 Sep 2021 02:09:13 +0000 (20:09 -0600)]
avfilter/vf_zscale: fix output color_range discrepancy

This filter chain was supposed to convert from narrow range
to full range yuv444p, but didn't:

buffer=width=1280:height=720:pix_fmt=yuv444p:frame_rate=25/1:\
time_base=1/25:sar=1/1,zscale=min=709:rin=limited:pin=709:\
tin=709:t=linear,format=gbrpf32le,zscale=tin=linear:p=709:m=709:\
r=full:t=709,format=pix_fmts=yuv444p,buffersink

2 days agoavcodec/mpeg12dec: Do not put mpeg_f_code into an invalid state on error return
Michael Niedermayer [Tue, 31 Aug 2021 18:15:09 +0000 (20:15 +0200)]
avcodec/mpeg12dec: Do not put mpeg_f_code into an invalid state on error return

Fixes: invalid shift
Fixes: 37018/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MPEG2VIDEO_fuzzer-5290280902328320

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 days agoavcodec/mpegvideo_enc: Limit bitrate tolerance to the representable
Michael Niedermayer [Sun, 30 May 2021 16:38:23 +0000 (18:38 +0200)]
avcodec/mpegvideo_enc: Limit bitrate tolerance to the representable

Fixes: error: 1.66789e+11 is outside the range of representable values of type 'int'
Fixes: Ticket8201

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 days agoavcodec/wmaprodec: Check that the EOF frame was allocated before decoding into it
Michael Niedermayer [Thu, 16 Sep 2021 22:21:25 +0000 (00:21 +0200)]
avcodec/wmaprodec: Check that the EOF frame was allocated before decoding into it

Fixes: NULL pointer dereference
Fixes: 38125/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_XMA1_fuzzer-5151909422432256

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>
2 days agoavutil/buffer: constify some function parameters
James Almer [Fri, 17 Sep 2021 03:06:45 +0000 (00:06 -0300)]
avutil/buffer: constify some function parameters

Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2 days agoavfilter/vf_coreimage: Simplify query_formats
Andreas Rheinhardt [Sun, 15 Aug 2021 05:43:21 +0000 (07:43 +0200)]
avfilter/vf_coreimage: Simplify query_formats

Using ff_set_common_formats_from_list() avoids using different functions
depending upon how many inputs the filter has.

Reviewed-by: Thilo Borgmann <thilo.borgmann@mail.de>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2 days agoavfilter/avfilter: Actually error out on init error
Andreas Rheinhardt [Wed, 15 Sep 2021 03:13:11 +0000 (05:13 +0200)]
avfilter/avfilter: Actually error out on init error

Currently an error from init could be overwritten by successfully
setting the enable expression.

Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2 days agolibavdevice/avfoundation.m: fix potential unreleased lock issue
Chengfeng Ye [Thu, 26 Aug 2021 14:40:46 +0000 (07:40 -0700)]
libavdevice/avfoundation.m: fix potential unreleased lock issue

The problem here is that the lock ctx->frame_lock will become
an unreleased lock if the program returns at patched lines.

link: https://trac.ffmpeg.org/ticket/9386\#ticket
Signed-off-by: Chengfeng Ye <cyeaa@connect.ust.hk>
2 days agolibavdevice/avfoundation.m: fix protential unreleased lock issue
Chengfeng Ye [Thu, 26 Aug 2021 14:40:24 +0000 (07:40 -0700)]
libavdevice/avfoundation.m: fix protential unreleased lock issue

The problem here is that the lock ctx->frame_lock will
become an unreleased lock if the program returns at
line 697, line 735 and line744.

link: https://trac.ffmpeg.org/ticket/9385\#ticket
Signed-off-by: Chengfeng Ye <cyeaa@connect.ust.hk>
2 days agoavcodec/elbg: Remove avoidable buffer
Andreas Rheinhardt [Thu, 16 Sep 2021 23:35:48 +0000 (01:35 +0200)]
avcodec/elbg: Remove avoidable buffer

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2 days agoavformat/utils: Use st for AVStream variable in avpriv_set_pts_info
Andreas Rheinhardt [Thu, 9 Sep 2021 15:08:49 +0000 (17:08 +0200)]
avformat/utils: Use st for AVStream variable in avpriv_set_pts_info

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2 days agoavformat/demux: Don't free inexistent ID3v2 metadata
Andreas Rheinhardt [Wed, 8 Sep 2021 20:35:43 +0000 (22:35 +0200)]
avformat/demux: Don't free inexistent ID3v2 metadata

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2 days agoavformat/utils: Move demuxing code out into a new file
Andreas Rheinhardt [Fri, 27 Aug 2021 07:24:10 +0000 (09:24 +0200)]
avformat/utils: Move demuxing code out into a new file

libavformat/utils.c has over 4800 lines and is supposed to contain
"various utility functions for use within FFmpeg". In reality it
contains all that and the whole demuxing core of libavformat.
This is especially bad, because said file includes the FFMPEG_VERSION
(the git commit sha) so that it is rebuilt whenever the commit HEAD
points to changes. Therefore this commit makes it smaller by moving
the demuxing code out to a new file, demux.c (in analogy to mux.c
for the muxing code).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2 days agoavformat/utils: Move seeking code out into a new file
Andreas Rheinhardt [Thu, 26 Aug 2021 21:41:01 +0000 (23:41 +0200)]
avformat/utils: Move seeking code out into a new file

libavformat/utils.c has over 5500 lines and is supposed to contain
"various utility functions for use within FFmpeg". In reality it
contains all that and the whole demuxing+seeking core of libavformat.
This is especially bad, because said file includes the FFMPEG_VERSION
(the git commit sha) so that it is rebuilt whenever the commit HEAD
points to changes. Therefore this commit starts making it smaller
by factoring the seeking code out.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2 days agoavformat/utils: Reindentation
Andreas Rheinhardt [Thu, 26 Aug 2021 14:41:50 +0000 (16:41 +0200)]
avformat/utils: Reindentation

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
3 days agoavformat: Avoid allocation for AVStreamInternal
Andreas Rheinhardt [Tue, 24 Aug 2021 17:41:16 +0000 (19:41 +0200)]
avformat: Avoid allocation for AVStreamInternal

Do this by allocating AVStream together with the data that is
currently in AVStreamInternal; or rather: Put AVStream at the
beginning of a new structure called FFStream (which encompasses
more than just the internal fields and is a proper context in its own
right, hence the name) and remove AVStreamInternal altogether.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
3 days agoavformat/mux, utils: Use dedicated pointer for AVStreamInternal
Andreas Rheinhardt [Tue, 24 Aug 2021 17:07:51 +0000 (19:07 +0200)]
avformat/mux, utils: Use dedicated pointer for AVStreamInternal

This gets rid of ugly "->internal" and is in preparation for removing
AVStreamInternal altogether.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
3 days agoavformat: Avoid allocation for AVFormatInternal
Andreas Rheinhardt [Tue, 24 Aug 2021 12:58:07 +0000 (14:58 +0200)]
avformat: Avoid allocation for AVFormatInternal

Do this by allocating AVFormatContext together with the data that is
currently in AVFormatInternal; or rather: Put AVFormatContext at the
beginning of a new structure called FFFormatContext (which encompasses
more than just the internal fields and is a proper context in its own
right, hence the name) and remove AVFormatInternal altogether.

The biggest simplifications occured in avformat_alloc_context(), where
one can now simply call avformat_free_context() in case of errors.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
3 days agoavformat/mux, mxfenc, utils: Use dedicated pointer for AVFormatInternal
Andreas Rheinhardt [Tue, 24 Aug 2021 11:37:28 +0000 (13:37 +0200)]
avformat/mux, mxfenc, utils: Use dedicated pointer for AVFormatInternal

This gets rid of ugly "->internal" and is in preparation for removing
AVFormatInternal altogether.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
3 days agoavformat/asfenc, mux, utils: Use smaller scope for variables
Andreas Rheinhardt [Tue, 24 Aug 2021 15:47:04 +0000 (17:47 +0200)]
avformat/asfenc, mux, utils: Use smaller scope for variables

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
3 days agoavformat/mp3dec: Simplify checking for no-metadata
Andreas Rheinhardt [Thu, 9 Sep 2021 10:54:30 +0000 (12:54 +0200)]
avformat/mp3dec: Simplify checking for no-metadata

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
3 days agoavformat/mp3dec: Avoid calling avio_tell() multiple times
Andreas Rheinhardt [Thu, 9 Sep 2021 10:50:42 +0000 (12:50 +0200)]
avformat/mp3dec: Avoid calling avio_tell() multiple times

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
3 days agodoc/decoders: mention that some libdav1d options are deprecated
James Almer [Thu, 16 Sep 2021 23:43:26 +0000 (20:43 -0300)]
doc/decoders: mention that some libdav1d options are deprecated

Signed-off-by: James Almer <jamrial@gmail.com>
3 days agoavformat/mvdec: Don't signal success on parse_audio_var() error
James Almer [Thu, 16 Sep 2021 19:34:03 +0000 (16:34 -0300)]
avformat/mvdec: Don't signal success on parse_audio_var() error

Propagate the error it returned instead.

Signed-off-by: James Almer <jamrial@gmail.com>
3 days agoavcodec/apedec: Fix integer overflow in intermediate
Michael Niedermayer [Wed, 15 Sep 2021 20:00:47 +0000 (22:00 +0200)]
avcodec/apedec: Fix integer overflow in intermediate

Fixes: signed integer overflow: 559334865 * 4 cannot be represented in type 'int'
Fixes: 37929/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_APE_fuzzer-6751932295806976

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>