Commit Graph

108881 Commits

Author SHA1 Message Date
Andreas Rheinhardt
cdd50223a6 avformat/argo_cvg: Mark overrides as const
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-28 09:08:00 +02:00
Martin Storsjö
cb803a0072 swscale: aarch64: Fix yuv2rgb with negative strides
Treat the 32 bit stride registers as signed.

Alternatively, we could make the stride arguments ptrdiff_t instead
of int, and changing all of the assembly to operate on these
registers with their full 64 bit width, but that's a much larger
and more intrusive change (and risks missing some operation, which
would clamp the intermediates to 32 bit still).

Fixes: https://trac.ffmpeg.org/ticket/9985

Signed-off-by: Martin Storsjö <martin@martin.st>
2022-10-27 21:49:26 +03:00
Martin Storsjö
2eb601e865 configure: Remove a leftover comment about MSVC C99 support
Support for building with older versions of MSVC (with the
c99wrap/c99conv frontend) was removed in
ce943dd6ac.

Signed-off-by: Martin Storsjö <martin@martin.st>
2022-10-27 21:49:26 +03:00
Andreas Rheinhardt
22fc0375e8 configure: Remove unnecessary mpeg[12]video_enc->h263dsp dependencies
This effectively reverts 9b78abae19.
The underlying issue has been fixed properly in commit
cff480e49d.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-27 19:39:07 +02:00
Andreas Rheinhardt
938c62b368 avcodec/mpegvideo: Don't initialize H264Chroma ctx unnecessarily
It is only used by the decoders' lowres code, so only initialize
it for decoders.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-27 19:37:44 +02:00
Andreas Rheinhardt
e59e14eee1 avcodec/speedhq: Remove unused ff_rl_speedhq
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-27 15:44:38 +02:00
Andreas Rheinhardt
4190019ff4 avcodec/speedhqenc: Don't initialize unused parts of RLTable
ff_rl_init() initializes RLTable.(max_level|max_run|index_run);
max_run is unused by the SpeedHQ encoder (as well as MPEG-1/2).
Furthermore, it initializes these things twice (for two passes),
but the second half of this is never used.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-27 15:44:38 +02:00
Andreas Rheinhardt
92b81a7c99 avcodec/mpeg12data: Remove ff_rl_mpeg1
No longer used anywhere.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-27 15:44:38 +02:00
Andreas Rheinhardt
a89b9d155b avcodec/mpeg12enc: Don't initialize unused parts of RLTable
ff_rl_init() initializes RLTable.(max_level|max_run|index_run);
max_run is unused by the MPEG-1/2 encoders (as well as SpeedHQ).
Furthermore, it initializes these things twice (for two passes),
but the second half of this is never used.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-27 15:44:38 +02:00
Andreas Rheinhardt
0486f0f5d2 avcodec/rl: Add analogue for ff_rl_init() without RLTable
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-27 15:44:38 +02:00
Andreas Rheinhardt
65beba7889 avcodec/speedhqdec: Use ff_rl_speedhq.table_(run|level) directly
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-27 15:44:38 +02:00
Andreas Rheinhardt
a12abf59a9 avcodec/mpeg12: Use ff_rl_mpeg1.table_(run|level) directly
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-27 15:44:38 +02:00
Andreas Rheinhardt
6bb0760a91 avcodec/mpeg12data: Remove unused ff_rl_mpeg2
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-27 15:44:38 +02:00
Andreas Rheinhardt
4a8fe21ab4 avcodec/mpeg12: Pass parameters explicitly in ff_init_2d_vlc_rl()
This allows to exploit that ff_rl_mpeg1 and ff_rl_mpeg2
only differ in their VLC table.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-27 15:44:38 +02:00
Andreas Rheinhardt
06fafbe01e avcodec/mpeg12enc: Don't initialize ff_rl_mpeg2 unnecessarily
ff_rl_mpeg1 and ff_rl_mpeg2 differ only in RLTable.table_vlc,
which ff_rl_init() does not use to initialize RLTable.max_level,
RLTable.max_run and RLTable.index_run. This implies
that these tables agree for ff_rl_mpeg1 and ff_rl_mpeg2;
hence one can just use one of them and avoid calling ff_rl_init()
ff_rl_mpeg2 alltogether.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-27 15:44:38 +02:00
Andreas Rheinhardt
178dcbb96f avcodec/mpeg12enc: Pass tables explicitly in ff_mpeg1_init_uni_ac_vlc
This will allow to remove ff_rl_mpeg2 soon and remove
all uses of RLTable in MPEG-1/2/SpeedHQ later.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-27 15:44:38 +02:00
Andreas Rheinhardt
18412c76e6 avcodec/speedhqenc: Avoid unnecessary indirection
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-27 15:44:38 +02:00
Andreas Rheinhardt
19ede649a0 avcodec/mpeg12enc: Avoid unnecessary indirection
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-27 15:44:38 +02:00
Andreas Rheinhardt
11dfa4d159 avcodec/mpeg12: Avoid indirection when accessing rl_vlc tables
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-27 15:44:36 +02:00
Andreas Rheinhardt
9aa7397db1 avformat/mux: Constify validate_codec_tag()
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-27 15:32:37 +02:00
Andreas Rheinhardt
5da8b522c8 avformat/mux: Don't call ff_toupper4() unnecessarily
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-27 15:32:37 +02:00
Andreas Rheinhardt
495d738b1b avcodec/mpeg12dec: Remove redundant function call
Redundant since dcb29d37d4.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-27 15:32:37 +02:00
Martin Storsjö
4bc79769f9 libavcodec: Fix a comment typo
Signed-off-by: Martin Storsjö <martin@martin.st>
2022-10-27 13:17:07 +03:00
Paul B Mahol
00b03331a0 avfilter/vf_threshold: fix handling of zero threshold 2022-10-27 10:23:24 +02:00
Paul B Mahol
0e5e3b37c0 avfilter/vf_[color/chroma]key: lower lower limit for similarity option 2022-10-27 10:23:09 +02:00
James Almer
4c35bb53f9 avcodec/ac3_parser: improve false positive detection when parsing sync frames
A two byte sync word is not enough to ensure we got a real syncframe, nor are
all the range checks we do in the first seven bytes. Do therefore an integrity
check for the sync frame in order to prevent the parser from filling avctx with
bogus information.

Signed-off-by: James Almer <jamrial@gmail.com>
2022-10-26 10:18:33 -03:00
James Almer
ffb6918783 avcodec/aac_ac3_parser: reindent after previous commit
Signed-off-by: James Almer <jamrial@gmail.com>
2022-10-26 10:18:33 -03:00
James Almer
57117c0ef6 avcodec/aac_ac3_parser: don't try to sync when the parser is configured to handle complete frames
Should speed up parsing when the frames come from non raw containers.

Signed-off-by: James Almer <jamrial@gmail.com>
2022-10-26 10:18:33 -03:00
James Almer
b5abf6fdfc avcodec/aac_ac3_parser: don't fill stream info in the sync function
Have it only find frame boundaries. The stream props will then be filled once
we have an assembled frame.

Signed-off-by: James Almer <jamrial@gmail.com>
2022-10-26 10:18:33 -03:00
James Almer
676e7d7f9b avcodec/adts_parser: allow passing a pre allocated AACADTSHeaderInfo to avpriv_adts_header_parse()
Code freeing the struct on failure is kept for backwards compatibility, but
should be removed in the next major bump, and the existing lavf user adapted.

Signed-off-by: James Almer <jamrial@gmail.com>
2022-10-26 10:18:24 -03:00
James Almer
72db6a4f5f avcodec/ac3dec: split off code discarding garbage at the beginning of a packet
Signed-off-by: James Almer <jamrial@gmail.com>
2022-10-26 09:16:21 -03:00
Peter Ross
31162eb949 avcodec/mss2: calculate draw region and revise split position
for videos with wmv9 rectangles, the region drawn by ff_mss12_decode_rect
may be less than the entire video area. the wmv9 rectangles are used to
calculate the ff_mss12_decode_rect draw region.

Fixes tickets #3255 and #4043
2022-10-26 20:35:18 +11:00
Peter Ross
639b7af493 avcodec/vp3data: rectify comment 2022-10-26 20:30:25 +11:00
Peter Ross
58bd7d97a4 avcodec/jpegtables: remove duplicate luma and chroma quantization tables
Duplicates of the standard JPEG quantization tables were found in the
AGM, MSS34(dsp), NUV and VP31 codecs. This patch elimates those duplicates,
placing a single copy in jpegquanttables.c.
2022-10-26 20:30:25 +11:00
J. Dekker
9bed814e1d lavc/aarch64: add hevc horizontal qpel/uni/bi
checkasm --benchmark on Ampere Altra (Neoverse N1):

put_hevc_qpel_bi_h4_8_c: 170.7
put_hevc_qpel_bi_h4_8_neon: 64.5
put_hevc_qpel_bi_h6_8_c: 373.7
put_hevc_qpel_bi_h6_8_neon: 130.2
put_hevc_qpel_bi_h8_8_c: 662.0
put_hevc_qpel_bi_h8_8_neon: 138.5
put_hevc_qpel_bi_h12_8_c: 1529.5
put_hevc_qpel_bi_h12_8_neon: 422.0
put_hevc_qpel_bi_h16_8_c: 2735.5
put_hevc_qpel_bi_h16_8_neon: 560.5
put_hevc_qpel_bi_h24_8_c: 6015.7
put_hevc_qpel_bi_h24_8_neon: 1636.0
put_hevc_qpel_bi_h32_8_c: 10779.0
put_hevc_qpel_bi_h32_8_neon: 2204.5
put_hevc_qpel_bi_h48_8_c: 24375.0
put_hevc_qpel_bi_h48_8_neon: 4984.0
put_hevc_qpel_bi_h64_8_c: 42768.0
put_hevc_qpel_bi_h64_8_neon: 8795.7
put_hevc_qpel_h4_8_c: 149.0
put_hevc_qpel_h4_8_neon: 55.7
put_hevc_qpel_h6_8_c: 321.2
put_hevc_qpel_h6_8_neon: 106.0
put_hevc_qpel_h8_8_c: 578.7
put_hevc_qpel_h8_8_neon: 133.2
put_hevc_qpel_h12_8_c: 1279.0
put_hevc_qpel_h12_8_neon: 391.7
put_hevc_qpel_h16_8_c: 2286.2
put_hevc_qpel_h16_8_neon: 519.7
put_hevc_qpel_h24_8_c: 5100.7
put_hevc_qpel_h24_8_neon: 1546.2
put_hevc_qpel_h32_8_c: 9022.0
put_hevc_qpel_h32_8_neon: 2060.2
put_hevc_qpel_h48_8_c: 20293.5
put_hevc_qpel_h48_8_neon: 4656.7
put_hevc_qpel_h64_8_c: 36037.0
put_hevc_qpel_h64_8_neon: 8262.7
put_hevc_qpel_uni_h4_8_c: 162.2
put_hevc_qpel_uni_h4_8_neon: 61.7
put_hevc_qpel_uni_h6_8_c: 355.2
put_hevc_qpel_uni_h6_8_neon: 114.2
put_hevc_qpel_uni_h8_8_c: 651.0
put_hevc_qpel_uni_h8_8_neon: 135.7
put_hevc_qpel_uni_h12_8_c: 1412.5
put_hevc_qpel_uni_h12_8_neon: 402.7
put_hevc_qpel_uni_h16_8_c: 2551.0
put_hevc_qpel_uni_h16_8_neon: 533.5
put_hevc_qpel_uni_h24_8_c: 5782.2
put_hevc_qpel_uni_h24_8_neon: 1578.7
put_hevc_qpel_uni_h32_8_c: 10586.5
put_hevc_qpel_uni_h32_8_neon: 2102.2
put_hevc_qpel_uni_h48_8_c: 23812.0
put_hevc_qpel_uni_h48_8_neon: 4739.5
put_hevc_qpel_uni_h64_8_c: 42958.7
put_hevc_qpel_uni_h64_8_neon: 8366.5

Signed-off-by: J. Dekker <jdek@itanimul.li>
2022-10-25 14:56:38 +02:00
Andreas Rheinhardt
894191e7e1 avcodec/svq1enc: Workaround GCC bug 102513
GCC 11 has a bug: When it creates clones of recursive functions
(to inline some parameters), it clones a recursive function
eight times by default, even when this exceeds the recursion
depth. This happens with encode_block() in libavcodec/svq1enc.c
where a parameter level is always in the range 0..5;
but GCC 11 also creates functions corresponding to level UINT_MAX
and UINT_MAX - 1 (on -O3; -O2 is fine).

Using such levels would produce undefined behaviour and because
of this GCC emits bogus -Warray-bounds warnings for these clones.

Since commit d08b2900a9, certain
symbols that are accessed like ff_svq1_inter_multistage_vlc[level]
are declared with hidden visibility, which allows compilers
to bake the offset implied by level into the instructions
if level is a compile-time constant as it is in the clones.
Yet this leads to insane offsets for level == UINT_MAX which
can be incompatible with the supported offset ranges of relocations.
This happens in the small code model (the default code model for
AArch64).

This commit therefore works around this bug by disabling cloning
recursive functions for GCC 10 and 11. GCC 10 is affected by the
underlying bug (see
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102513), so the workaround
also targets it, although it only produces three versions of
encode_block(), so it does not seem to trigger the actual issue here.

The issue has been mitigated in GCC 12.1 (it no longer creates clones
for impossible values; see also commit
1cb7fd317c), so the workaround
does not target it.

Reported-by: J. Dekker <jdek@itanimul.li>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Signed-off-by: J. Dekker <jdek@itanimul.li>
2022-10-25 14:55:51 +02:00
Anton Khirnov
7aa5ea237f fftools/ffmpeg_demux: stop modifying OptionsContext
It should be input-only to this code.
2022-10-25 11:13:03 +02:00
Anton Khirnov
0d821edb40 fftools/ffmpeg_mux_init: stop modifying OptionsContext.*_disable
The current code will override the *_disable fields (set by -vn/-an
options) when creating output streams for unlabeled complex filtergraph
outputs, in order to disable automatic mapping for the corresponding
media type.

However, this will apply not only to automatic mappings, but to manual
ones as well, which should not happen. Avoid this by adding local
variables that are used only for automatic mappings.
2022-10-25 11:12:22 +02:00
Anton Khirnov
69da53ade9 fftools/ffmpeg_mux_init: move code creating streams into a new function
Makes it easy to see where all the streams are created. Will also be
useful in the following commit.
2022-10-25 11:12:05 +02:00
Anton Khirnov
006df0b6fe fftools/ffmpeg_mux_init: stop modifying some OptionsContext fields
Specifically recording_time and stop_time - use local variables instead.
OptionsContext should be input-only to this code. Will allow making it
const in future commits.
2022-10-25 11:11:35 +02:00
Anton Khirnov
ccab823559 fftools/ffmpeg_mux_init: constify metadata specifier arguments 2022-10-25 11:04:42 +02:00
Anton Khirnov
aa0ce91f57 fftools/ffmpeg_mux_init: avoid modifying OptionsContext.chapters_input_file
Use a local variable instead. This will allow making OptionsContext
const in future commits.
2022-10-25 11:04:42 +02:00
Anton Khirnov
5ccc151bf2 fftools/ffmpeg: factor out copying metadata/chapters from of_open()
This code shares variables like OptionsContext.metadata_*_manual, so it
makes sense to group it together.
2022-10-25 11:04:42 +02:00
Anton Khirnov
21ef1f2cec fftools/ffmpeg_demux: log when the demuxer thread terminates
Similar to what is done for muxing, may be useful for debugging.
2022-10-25 11:04:42 +02:00
Anton Khirnov
5c1a096d02 fftools/ffmpeg: move nb_streams_warn from InputFile to Demuxer
It is private to the demuxer and do not need to be visible outside of
it.
2022-10-25 11:04:42 +02:00
Anton Khirnov
d8f7ce38da fftools/ffmpeg_demux: do not log to the demuxer context
Only the demuxer itself is supposed to do that.
2022-10-25 11:04:42 +02:00
Anton Khirnov
541104f3a3 fftools/ffmpeg: move duration/time_base from InputFile to Demuxer
They are private to the demuxer and do not need to be visible outside of
it.
2022-10-25 11:04:42 +02:00
Anton Khirnov
5bc1f177d3 fftools/ffmpeg: move threading fields from InputFile to Demuxer
They are private to the demuxer and do not need to be visible outside of
it.
2022-10-25 11:04:42 +02:00
Anton Khirnov
c20977c4e0 fftools/ffmpeg: drop free_input_threads()
Stop demuxer threads in ifile_close() instead. Simplifies the demuxer
API.
2022-10-25 11:04:42 +02:00
Anton Khirnov
295848bacb fftools/ffmpeg: move closing the input file into a separate function
For now this is just closing the format context and freeing InputFile,
but will contain more in the future.
2022-10-25 11:04:42 +02:00