Commit Graph

107979 Commits

Author SHA1 Message Date
Andreas Rheinhardt 72c601e0f7 avutil/internal: Move avpriv-file API to a header of its own
It is not used by the large majority of files that include
lavu/internal.h.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-09-03 15:41:44 +02:00
Andreas Rheinhardt 04b7217872 avutil/dict: Move avpriv_dict_set_timestamp() to a header of its own
It is used almost nowhere, so it needn't be auto-included
almost everywhere.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-09-03 15:41:44 +02:00
Andreas Rheinhardt 26325cceb0 avutil/internal: Remove unused FF_SYMVER
They are unused since d63443b968.
Furthermore, they were always in the wrong header:
libavutil/internal.h is auto-included almost everywhere, but
FF_SYMVER would only ever be used at a few places, so a proper
header of its own would be appropriate for it.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-09-03 15:41:44 +02:00
Andreas Rheinhardt 5b0856d2b9 avutil/internal: Remove unused ff_rint64_clip()
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-09-03 15:41:44 +02:00
Andreas Rheinhardt 65f6851448 avcodec/frame_thread_encoder: Stop serializing unreferencing AVFrames
Currently, the frame-threaded decoding API still supports thread-unsafe
callbacks. If one uses a thread-unsafe get_buffer2() callback,
calls to av_frame_unref() by the decoder are serialized, because
it is presumed that the underlying deallocator is thread-unsafe.

The frame-threaded encoder seems to have been written with this
restriction in mind: It always serializes unreferencing its AVFrames,
although no documentation forces it to do so.

This commit schedules to change this behaviour as soon as thread-unsafe
callbacks are removed. For this reason, the FF_API_THREAD_SAFE_CALLBACKS
define is reused.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-09-03 15:41:19 +02:00
Andreas Rheinhardt 25ea90b733 avcodec/encode: Avoid unreferencing blank AVFrames
ff_thread_video_encode_frame() already returns blank frames.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-09-03 15:41:19 +02:00
Mohamed Khaled Mohamed 1a5cd79f51 avfilter: add bilateral_cuda filter
GSoC 2022

Signed-off-by: Mohamed Khaled <mohamed.elbassiony00@eng-st.cu.edu.eg>
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
2022-09-03 15:18:56 +02:00
Paul B Mahol d1513e7f9c avfilter: add 3D scope multimedia filter 2022-09-03 14:44:59 +02:00
Paul B Mahol 4beac58e90 avcodec/cfhd: fix escape handling for old codebook 2022-09-03 14:44:58 +02:00
Paul B Mahol 10ed73e933 avcodec/cfhddata: remove unused defines 2022-09-03 14:44:58 +02:00
Martin Storsjö e4ac156b7c libavcodec: Set hidden visibility on global symbols accessed from AArch64 assembly
The AArch64 assembly accesses those symbols directly, without
indirection via e.g. the GOT on ELF. In order for this not to
require text relocations, those symbols need to be resolved fully
at link time, i.e. those symbols can't be interposable.

Normally, so far, this is achieved when linking shared libraries
in two ways; we have a version script (libavcodec/libavcodec.v) which
marks all symbols that don't start with av* as local. Additionally,
we try to add -Wl,-Bsymbolic to the linker options if supported,
making sure that such symbol references are resolved fully at link
time, instead of making them interposable.

When the libavcodec static library is linked into another shared
library, there's no guarantee that it uses similar options (even though
that would be favourable), which would end up requiring text relocations
in the AArch64 assembly.

Explicitly mark the symbols that are accessed from AArch64 assembly
as hidden, so that they are resolved fully at link time even without
the version script and -Wl,-Bsymbolic.

Signed-off-by: Martin Storsjö <martin@martin.st>
2022-09-02 23:13:29 +03:00
Martin Storsjö 0dd8fe6f4b arm: Check the build time constants in av_clip_*intp2
This fixes building for arm targets with optimizations disabled.

Signed-off-by: Martin Storsjö <martin@martin.st>
2022-09-02 23:12:26 +03:00
Martin Storsjö 3f456dc245 arm: rv40dsp: Change stride parameters to ptrdiff_t
These were missed when h264_chroma_mc_func was changed in
e4a94d8b36.

Signed-off-by: Martin Storsjö <martin@martin.st>
2022-09-02 23:04:58 +03:00
Martin Storsjö 826cd5e098 arm: vc1sdp: Change stride parameters to ptrdiff_t
This was missed in db54426975.

Signed-off-by: Martin Storsjö <martin@martin.st>
2022-09-02 23:04:55 +03:00
Andreas Rheinhardt 7de9c0e9d7 avcodec/flac: Don't use bytestream API unnecessarily
It makes no sense here, as flac_parse_block_header()
is not even supposed to advance the caller's pointer.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-09-02 11:55:22 +02:00
Andreas Rheinhardt 5089884e3c avcodec/flac: Move decoder+parser stuff into a new header, flac_parse.h
(The FLAC parser currently ignores the streaminfo block;
therefore some of this is decoder-only. Given that the FLAC
parser should probably use the streaminfo block, this stuff
is moved to flac_parse.h.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-09-02 11:55:22 +02:00
Andreas Rheinhardt f118b2aa46 avcodec/flac: Remove pointless define
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-09-02 11:55:22 +02:00
Andreas Rheinhardt 6699ed38f3 avcodec/flac: Remove unused parameter from ff_flac_is_extradata_valid()
format is write-only.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-09-02 11:55:22 +02:00
Andreas Rheinhardt 17b1375965 avcodec/flac: Move ff_flac_get_max_frame_size() to flacenc.c
It is its only user.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-09-02 11:55:22 +02:00
Andreas Rheinhardt ff1f5b407d avcodec/flacdec: Don't infer max_framesize unnecessarily
This field is not really used by the decoder at all:
It is only output in some debug log message, but this debug
log message should better use the value read from the streaminfo
instead of a second-guessed value from the decoder.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-09-02 11:55:22 +02:00
Andreas Rheinhardt bddf1a6479 avcodec/flacdec: Shorten name
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-09-02 11:55:22 +02:00
Andreas Rheinhardt 6713554271 avcodec/flac: Remove unnecessary FLACSTREAMINFO define
Possible since 38f5a266ee.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-09-02 11:55:21 +02:00
Andreas Rheinhardt 500bbd584d avcodec/mpeg4video: Factor non-codec stuff out into a header of its own
This avoids including mpegvideo.h in mpeg4_unpack_bframes_bsf.c.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-09-02 11:55:21 +02:00
Andreas Rheinhardt c421000434 avformat/hevc: Reindent after the previous commit
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-09-02 11:42:20 +02:00
Andreas Rheinhardt 8b5d155301 avformat/hevc: Fix crash on allocation failure, avoid allocations
The HEVC code currently uses an array of arrays of NALUs; one such array
contains all the SPS NALUs, one all PPS NALUs etc. The array of arrays
is grown dynamically via av_reallocp_array(), but given that the latter
function automatically frees its buffer upon reallocation error,
it may only be used with PODs, which this case is not. Even worse:
While the pointer to the arrays is reset, the counter for the number
of arrays is not, leading to a segfault in hvcc_close().

Fix this by avoiding the allocations of the array of arrays altogether.
This is easily possible because their number is bounded (by five).
Furthermore, as a byproduct we can ensure that the code always
produces the recommended ordering of VPS-SPS-PPS-SEI (which was
not guaranteed before).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-09-02 11:40:45 +02:00
Michael Niedermayer b14104a637
avcodec/bink: disallow odd positioned scaled blocks
Fixes: out of array access
Fixes: 47911/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_BINK_fuzzer-6194020855971840

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-09-02 10:44:28 +02:00
Carl Eugen Hoyos ff6044b921 lavc/tiff: Support multi-component files without RowsPerStrip tag.
Fixes ticket #9514.
2022-09-01 20:27:17 +02:00
Andreas Rheinhardt 90aa2a88f9 fftools/ffmpeg_opt: Check creation of new program
Fixes Coverity issue #1512413.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-09-01 14:26:01 +02:00
Andreas Rheinhardt 601faaed92 fftools: Use report_error_then_exit_program() for allocation failures
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-09-01 14:26:00 +02:00
Andreas Rheinhardt e157b21a90 fftools/cmdutils: Add function to report error before exit
This is designed to improve and unify error handling for
allocation failures for the many (often small) allocations that we have
in the fftools. These typically either don't return an error message
or an error message that is not really helpful to the user
and can be replaced by a generic error message without loss of
information.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-09-01 14:21:56 +02:00
Paul B Mahol 319e8a49b5 avcodec/amr*bdec: return only number of consumed bytes 2022-08-31 23:10:41 +02:00
Michael Niedermayer 1f1a368169
avformat/asfdec_o: limit recursion depth in asf_read_unknown()
The threshold of 5 is arbitrary, both smaller and larger should work fine

Fixes: Stack overflow
Fixes: 50603/clusterfuzz-testcase-minimized-ffmpeg_dem_ASF_O_fuzzer-6049302564175872

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-08-31 18:03:55 +02:00
Carl Eugen Hoyos 4a054c3e97 lavc/ass: Add missing version.h include
Fixes lavc version output in ass, regression since f2da2e14
2022-08-31 16:25:31 +02:00
Carl Eugen Hoyos 7180416084 lavf/sdp: Add missing version.h include
Fixes lavf version output in SDP, regression since 4eb9232c
2022-08-31 16:24:22 +02:00
Anton Khirnov 4fce3bab64 fftools/ffmpeg: use a separate counter for encoded packet data size
update_video_stats() currently uses OutputStream.data_size to print the
total size of the encoded stream so far and the average bitrate.
However, that field is updated in the muxer thread, right before the
packet is sent to the muxer. Not only is this racy, but the numbers may
not match even if muxing was in the main thread due to bitstream
filters, filesize limiting, etc.

Introduce a new counter, data_size_enc, for total size of the packets
received from the encoder and use that in update_video_stats(). Rename
data_size to data_size_mux to indicate its semantics more clearly.

No synchronization is needed for data_size_mux, because it is only read
in the main thread in print_final_stats(), which runs after the muxer
threads are terminated.
2022-08-29 15:42:11 +02:00
Anton Khirnov 0dd7347963 fftools/ffmpeg: drop OutputStream.fps_mode
It is only used within new_video_stream(), so make it a local variable
there.
2022-08-29 15:42:11 +02:00
Anton Khirnov d0f767f81f fftools/ffmpeg: drop OutputStream.enc
It is either equal to OutputStream.enc_ctx->codec, or NULL when enc_ctx
is NULL. Replace the use of enc with enc_ctx->codec, or the equivalent
enc_ctx->codec_* fields where more convenient.
2022-08-29 15:42:11 +02:00
Anton Khirnov 4a4a206304 fftools/ffmpeg_filter: remove an always-true check
ost->enc is always non-NULL here, since
- this code is never called for streamcopy
- opening the output file will fail if an encoder cannot be found, so
  filters are never initialized
2022-08-29 15:42:11 +02:00
Anton Khirnov c97bb940c2 fftools/ffmpeg_filter: remove an always-false check
This code cannot be triggered, since after 90944ee3ab opening the
output file will abort if an encoder cannot be found and streamcopy was
not explicitly requested.
2022-08-29 15:42:11 +02:00
Anton Khirnov 7c8737548f fftools/ffmpeg: remove a stale extern declaration
Forgotten in 8cbf229c94
2022-08-29 15:42:11 +02:00
Anton Khirnov 8d26a21bf6 fftools/ffmpeg: stop accessing av_stream_get_parser() from the main thread
It races with the demuxing thread. Instead, send the information along
with the demuxed packets.

Ideally, the code should stop using the stream-internal parsing
completely, but that requires considerably more effort.

Fixes races, e.g. in:
- fate-h264-brokensps-2580
- fate-h264-extradata-reload
- fate-iv8-demux
- fate-m4v-cfr
- fate-m4v
2022-08-29 15:42:11 +02:00
Sebastian Beckmann 47b85c5a76 avcodec/videotoolboxenc: Add CBR option to H264 and HEVC encoder
Adds an option to use constant bitrate instead of average bitrate to the
videotoolbox encoders. This is enabled via -constant_bit_rate true.
macOS 13 is required for this option to work.

Signed-off-by: Sebastian Beckmann <beckmann.sebastian@outlook.de>
Signed-off-by: Rick Kern <kernrj@gmail.com>
2022-08-29 09:34:20 -04:00
Lynne f99d15cca0
arm/fft: disable NEON optimizations for 131072pt transforms
This has been broken since the start, and it was only discovered
when I started testing my replacement for the FFT.
Disable it, since there's no point in fixing slower code that's about
to be removed anyway.

The vfp version is not affected.
2022-08-29 07:13:43 +02:00
gavin zhang f5c5c04c14 lavc/qsvenc: enlarge the SPS buffer to retrieve larger header
Increase SPS header buffer to support larger header

Signed-off-by: gavin zhang <gavin.zhang@intel.com>
Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2022-08-29 09:37:49 +08:00
Haihao Xiang ea56f7d5e7 lavc/qsvenc: ignore video signal info buffer for VP9
The SDK doesn't support this type of buffer for vp9 encoding

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2022-08-29 09:37:49 +08:00
Michael Niedermayer c953baa084
avformat/mov: Check count sums in build_open_gop_key_points()
Fixes: ffmpeg.md
Fixes: Out of array access
Fixes: CVE-2022-2566

Found-by: Andy Nguyen <theflow@google.com>
Found-by: 3pvd <3pvd@google.com>
Reviewed-by: Andy Nguyen <theflow@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-08-28 22:06:45 +02:00
Michael Niedermayer ced0dc807e
doc/git-howto.texi: Document commit signing
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-08-28 22:06:45 +02:00
Michael Niedermayer 2316d5ec1a
libavcodec/8bps: Check that line lengths fit within the buffer
Fixes: Timeout
Fixes: undefined pointer arithmetic
Fixes: 50330/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_EIGHTBPS_fuzzer-5436287485607936

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-08-28 22:06:45 +02:00
Michael Niedermayer e264a4a76e
tools/target_dec_fuzzer: Adjust threshold for MVDV
Fixes: Timeout
Fixes: 50213/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MVDV_fuzzer-5228284098510848

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-08-28 22:06:45 +02:00
Michael Niedermayer 628fb97efb
avcodec/midivid: Perform lzss_uncompress() before ff_reget_buffer()
This would avoid regeting the frame on lzss errors

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-08-28 22:06:44 +02:00