Commit Graph

103795 Commits

Author SHA1 Message Date
Andreas Rheinhardt
6e26015a6b avformat/astenc: Simplify writing padding
Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-23 17:37:22 +02:00
Nicolas Gaullier
8a3f8afa4e avformat/mov: Set AVSTREAM_PARSE_HEADERS flag for H264
Signed-off-by: Nicolas Gaullier <nicolas.gaullier@cji.paris>
Signed-off-by: James Almer <jamrial@gmail.com>
2021-09-23 10:35:09 -03:00
Nicolas Gaullier
daf04868d8 avformat/demux: Use r_frame_rate in compute_frame_duration if codec_framerate is unknown
Signed-off-by: Nicolas Gaullier <nicolas.gaullier@cji.paris>
Signed-off-by: James Almer <jamrial@gmail.com>
2021-09-23 10:35:09 -03:00
Nicolas Gaullier
fad459b5a6 avcodec/h264_parser: Set AVCodecContext.framerate
Signed-off-by: Nicolas Gaullier <nicolas.gaullier@cji.paris>
Signed-off-by: James Almer <jamrial@gmail.com>
2021-09-23 10:35:08 -03:00
Marc-Antoine Arnaud
447cf53774 avformat/mxfdec: rename sub_descriptors as file_descriptors
Signed-off-by: Marton Balint <cus@passwd.hu>
2021-09-22 22:44:30 +02:00
James Almer
6edcdd2520 avcodec/cbs_h265: support general_profile_idc 11
And fix support for general_profile_idc 9 and 10.
Defined in ITU-T H.265 (V6).

Signed-off-by: James Almer <jamrial@gmail.com>
2021-09-22 16:31:35 -03:00
Michael Niedermayer
0b761e87c0 avformat/concatdec: Use FAIL() macro instead of direct return in concat_parse_script()
Fixes: memleak
Fixes: 38893/clusterfuzz-testcase-minimized-ffmpeg_dem_CONCAT_fuzzer-4785231933079552

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-09-22 18:53:53 +02:00
Limin Wang
a487635b85 avcodec/dynamic_hdr10_plus: check size before using it
Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2021-09-22 09:25:25 +08:00
Limin Wang
4c079636ab avcodec/dynamic_hdr10_plus: use AVERROR_INVALIDDATA instead of AVERROR(EINVAL)
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2021-09-22 09:25:25 +08:00
Limin Wang
45b850f9f5 avcodec/hevc_sei: check size before using it
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2021-09-22 09:25:25 +08:00
James Almer
9a7fe439d9 avcodec/libdav1d: let libdav1d choose optimal max frame delay
Signed-off-by: James Almer <jamrial@gmail.com>
2021-09-21 15:11:20 -03:00
Michael Niedermayer
85413a5ae6 avcodec/cbs_h265_syntax_template: Limit sps_num_palette_predictor_initializer_minus1 to 127
Fixes: index 128 out of bounds for type 'uint16_t [128]'
Fixes: 38651/clusterfuzz-testcase-minimized-ffmpeg_BSF_HEVC_METADATA_fuzzer-6296416058736640

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-09-21 19:20:56 +02:00
Andreas Rheinhardt
467c6a9146 avfilter/vf_geq: Simplify creating string
Also fixes a Wformat-truncation warning from GCC.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-21 17:57:35 +02:00
Andreas Rheinhardt
04a5ffa75f avfilter/vf_xfade: Remove always-false format check
This filter uses ff_set_common_formats_from_list().

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-21 17:57:32 +02:00
Andreas Rheinhardt
c87d7c8a81 avfilter/vf_vif: Remove always-false format check
This filter uses ff_set_common_formats_from_list().

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-21 17:57:30 +02:00
Andreas Rheinhardt
2a18ee752d avfilter/vf_threshold: Remove always-false format check
This filter uses ff_set_common_formats_from_list().

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-21 17:57:27 +02:00
Andreas Rheinhardt
d1a92cd06f avfilter/vf_ssim: Remove always-false format check
This filter uses ff_set_common_formats_from_list().

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-21 17:57:23 +02:00
Andreas Rheinhardt
63cc7077c1 avfilter/vf_psnr: Remove always-false format check
This filter uses ff_set_common_formats_from_list().

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-21 17:57:20 +02:00
Andreas Rheinhardt
b6de483cb4 avfilter/vf_premultiply: Remove always-false format check
These filters use ff_set_common_formats_from_list().

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-21 17:57:17 +02:00
Andreas Rheinhardt
71285daba9 avfilter/vf_midequalizer: Remove always-false format check
This filter uses ff_set_common_formats_from_list().

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-21 17:57:14 +02:00
Andreas Rheinhardt
0fc1abe031 avfilter/vf_maskedthreshold: Remove always-false format check
This filter uses ff_set_common_formats_from_list().

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-21 17:57:09 +02:00
Andreas Rheinhardt
e2cd1b3c06 avfilter/vf_maskedminmax: Remove always-false format check
These filters use ff_set_common_formats_from_list().

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-21 17:57:05 +02:00
Andreas Rheinhardt
406552155a avfilter/vf_maskedmerge: Remove always-false format check
This filter uses ff_set_common_formats_from_list().

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-21 17:57:02 +02:00
Andreas Rheinhardt
15778ccce6 avfilter/vf_maskedclamp: Remove always-false format check
This filter uses ff_set_common_formats_from_list().

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-21 17:56:58 +02:00
Andreas Rheinhardt
095d88d7ca avfilter/vf_libvmaf: Remove always-false format check
This filter uses ff_set_common_formats_from_list().

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-21 17:56:55 +02:00
Andreas Rheinhardt
14488c26bb avfilter/vf_identity: Remove always-false format check
These filters use ff_set_common_formats_from_list().

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-21 17:56:52 +02:00
Andreas Rheinhardt
0d3841b59b avfilter/vf_hysteresis: Remove always-false format check
This filter uses ff_set_common_formats_from_list().

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-21 17:56:49 +02:00
Andreas Rheinhardt
bd98d125c8 avfilter/vf_guided: Remove always-false format check
This filter uses ff_set_common_formats_from_list().

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-21 17:56:46 +02:00
Andreas Rheinhardt
caef1172ea avfilter/vf_displace: Remove always-false format check
This filter uses ff_set_common_formats_from_list().

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-21 17:56:43 +02:00
Andreas Rheinhardt
97454352cd avfilter/vf_convolve: Remove always-false format check
These filters use ff_set_common_formats_from_list().

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-21 17:56:40 +02:00
Andreas Rheinhardt
9cffffd795 avfilter/vf_bm3d: Remove always-false format check
This filter uses ff_set_common_formats_from_list().

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-21 17:56:37 +02:00
Andreas Rheinhardt
ef09bd65e2 avfilter/vf_blend: Remove always-false format check
This filter uses ff_set_common_formats_from_list().

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-21 17:56:33 +02:00
Andreas Rheinhardt
910215b4db avfilter/af_sidechaincompress: Remove always-false samplerate check
This filter uses ff_set_common_all_samplerates().
Also don't overwrite outlink->sample_rate in config_output;
it is harmless, because it is overwritten with the value it already
had, but it is an API violation.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-21 17:56:30 +02:00
Andreas Rheinhardt
e1487deb19 avfilter/af_amerge: Remove always-false samplerate check
This filter uses ff_set_common_all_samplerates().
Also don't overwrite outlink->sample_rate in config_output;
it is harmless, because it is overwritten with the value it already
had, but it is an API violation.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-21 17:56:25 +02:00
Andreas Rheinhardt
789de76e21 avfilter/af_agate: Remove always-false samplerate check
This filter uses ff_set_common_all_samplerates().
Also don't overwrite outlink->sample_rate in config_output;
it is harmless, because it is overwritten with the value it already
had, but it is an API violation.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-21 17:56:21 +02:00
Andreas Rheinhardt
7d99507838 avfilter/af_sidechaincompress: Honour query_formats API, fix segfault
Just like the sidechaingate filter, the sidechaincompress filter
overwrote the channel layout and channel count of its output in
its config_output callback to match the channel layout of its main
input instead of linking the main input and its output together
in its query_formats callback.

This is an API violation that can lead to segfaults, as in the
following filtergraph, where stereotools rightly expects stereo,
yet receives only mono:
[in]aformat=channel_layouts=mono,aformat=channel_layouts=stereo|mono[out];\
[out][in2]sidechaincompress,stereotools

Fix this by linking the channel layouts of the main input and the output
in query_formats and remove the code overwriting it in config_output.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-21 17:56:17 +02:00
Andreas Rheinhardt
80d32e0f7e avfilter/af_agate: Honour query_formats API, fix segfault
The sidechaingate filter wants its main input and its (only) output
to have the same channel layout and number of channels; yet it does
not link them in its query_formats callback. Instead it sets the
outlink to only accept the first offered choice for the main input's
channel layout and then sets both inputs to independently accept
any channel counts. The config_output callback then overwrote the
outlink's channel layout and channels properties with the main input's,
even though they may differ in case the first offered choice for
the main input's channel layout turns out not to be the final one.

Consider e.g. the following filtergraph:
[in]aformat=channel_layouts=mono,aformat=channel_layouts=stereo|mono[out];\
[out][in2]sidechaingate,stereotools
The two aformats ensure that the first offered channel layout (stereo)
will not be chosen for the input; yet it is the only offered channel
layout for the output of sidechaingate and will therefore be chosen
by the query_formats framework. Because the sidechaingate outputs
interleaved doubles which stereotools expects the output of
sidechaingate appears to be suitable as input for stereotools without
further conversions. Yet stereotools actually only receives a mono frame
and therefore overreads its input buffer which leads to segfaults;
it can also lead to heap corruption because there can be writes beyond
the end of the buffer, too.

Fix this by linking the channel layouts of the main input and the output
in query_formats and remove the code overwriting it in config_output.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-21 17:56:11 +02:00
Andreas Rheinhardt
9985ea7651 avfilter/af_afade: Remove redundant checks and assignments
The acrossfade filter uses the ff_set_common_* functions in its
query_formats(), so that the formats, the sample rates as well as
the channel layouts and counts of all links coincide.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-21 17:55:47 +02:00
James Almer
ed1a70469e ffmpeg_filter: don't try to autorotate frames with hwaccel pixel formats
The transpose, rotate, hflip, and vflip filters don't support them.
Fixes ticket #9432.

Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: James Almer <jamrial@gmail.com>
2021-09-21 10:41:16 -03:00
Martin Storsjö
cb8dc600d2 configure: arm: Don't add -march= to the compiler if no preference was passed
If no --cpu= option was passed to configure, we detect what the
compiler defaults to. This detected value was then fed back to the
rest of the configure logic, as if it was an explicit choice.

This breaks on Ubuntu 21.10 with GCC 11.1.

Since GCC 8, it's possible to add configure extra features via the
-march option, like e.g. -march=armv7-a+neon. If the -mfpu= option
is configured to default to 'auto', the fpu setting gets taken
from the -march option.

GCC 11.1 in Ubuntu seems to be configured to use -mfpu=auto. This
has the effect of breaking any compilation command that specifies
-march=armv7-a, because the driver implicitly also adds -mfloat-abi=hard,
and that combination results in this error:

    cc1: error: ‘-mfloat-abi=hard’: selected processor lacks an FPU

One can compile successfully by passing e.g. -march=armv7-a+fp.

Therefore, restructure configure. If no specific preference was set
(and the 'cpu' configure variable was set as the output of
probe_arm_arch), the value we tried to set via -march= was the same
value that we just tried to detect as the compiler default.

So instead, just try to detect what the compiler defaults to, with
to allow setting other configure settings (such as 'fast_unaligned'),
but don't try to spell out the compiler's default via the -march flag.

Signed-off-by: Martin Storsjö <martin@martin.st>
2021-09-21 14:04:28 +03:00
rcombs
c51bae03de doc/demuxers: fix typo in concatdec options 2021-09-21 00:19:19 -05:00
James Almer
d873b5fffc avcodec/libdav1d: pass auto threads value to libdav1d
libdav1d 1.0.0 will be the first version supporting Dav1dSettings.n_threads == 0.

Signed-off-by: James Almer <jamrial@gmail.com>
2021-09-20 22:30:35 -03:00
Paul B Mahol
59719a905c avfilter/avf_showspectrum: rewrite frequency log axis/bin scaling 2021-09-20 11:14:53 +02:00
Andreas Rheinhardt
60ada0f5fa 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>
2021-09-20 05:40:51 +02:00
Andreas Rheinhardt
5e01527330 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>
2021-09-20 05:09:59 +02:00
Andreas Rheinhardt
896c11687e 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>
2021-09-20 04:38:45 +02:00
Andreas Rheinhardt
9e11debb5d 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>
2021-09-20 04:38:25 +02:00
Andreas Rheinhardt
8bfd466c9e 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>
2021-09-20 04:38:12 +02:00
Andreas Rheinhardt
05ccfcb7b0 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>
2021-09-20 04:09:22 +02:00
Andreas Rheinhardt
d046e76515 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>
2021-09-20 04:08:54 +02:00