1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-21 10:55:51 +02:00
Commit Graph

112277 Commits

Author SHA1 Message Date
Zhao Zhili
1c61aa1a02 avcodec/jni: make global variables static
Reviewed-by: Matthieu Bouron <matthieu.bouron@gmail.com>
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-09-19 00:41:08 +08:00
Zhao Zhili
eb96dda5ed avdevice/android_camera: fix missing include for usleep
Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-09-19 00:39:47 +08:00
Anton Khirnov
5d58a35f98 fftools/ffmpeg: deprecate the -top option
It is badly named (should have been -top_field_first, or at least -tff),
underdocumented and underspecified, and (most importantly) entirely
redundant with the setfield filter.
2023-09-18 17:16:06 +02:00
Anton Khirnov
43a0004b5c fftools/ffmpeg_enc: apply -top to individual encoded frames
Fixes #9339.
2023-09-18 17:15:53 +02:00
Anton Khirnov
74b643a51e fftools/ffmpeg_enc: refactor setting encoding field_order
Merge three blocks with slightly inconsistent checks into one, treating
encoder input as interlaced when either:
* at least one of ilme/ildct flags is set
* the first frame in the stream is marked as interlaced
* the user specified the -top option

Stop modifying the frame passed to enc_open().
2023-09-18 17:15:53 +02:00
Anton Khirnov
85e075587d lavf: deprecate AVFMT_FLAG_SHORTEST
It was added in cb114ed464 with the comment
"This will allow fixing several bugs with the -shortest option".

Since
* there is no explanation of what these bugs are
* libavformat is not the place to work around ffmpeg CLI bugs
* there is no indication that this feature is actually in use
deprecate it without replacement.
2023-09-18 17:10:59 +02:00
Leo Izen
9b454fdaef
avformat/libssh: avoid deprecated functions
Avoid using the deprecated functions ssh_try_publickey_from_file among
others in favor of symbols introduced in libssh 0.6.0 (Jan 2014) and
update configure to require this version.

Signed-off-by: Leo Izen <leo.izen@gmail.com>
2023-09-18 08:43:24 -04:00
Andreas Rheinhardt
da1d56776c avcodec/pthread_frame: Constify src pointees
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-18 12:36:03 +02:00
Andreas Rheinhardt
1046cfe347 avcodec/pthread_frame: Remove FF_API_SLICE_OFFSET
Since 432adca5fe no decoder
looks at the slice_count and slice_offset fields at all,
so there is no reason to synchronize them between the worker
and the user thread.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-18 12:35:54 +02:00
Andreas Rheinhardt
0e6fdebd0d avcodec/vp3: Simplify shuffling frames, fix crash on alloc error
When decoding non-keyframes, the decoding process expects
there to be two reference frames, the last one and the golden
one. The existence of the golden one is checked and in case
it is there, it is presumed that the last one exists as well.

This assumption is wrong in case of memory allocation failure,
namely in case the call to ff_thread_ref_frame() that sets
the last frame fails.

Fix this by actually performing a shuffle without creating
new references. This can't fail and has the advantage of
fewer implicit allocations.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-18 02:55:14 +02:00
Andreas Rheinhardt
3614f7e1cc avcodec/vp3: Fix undefined pointer arithmetic
When decoding a keyframe, last_frame and golden_frame are
not used at all and (at least when starting decoding)
are not set at all. But due to code sharing pointer arithmetic
on the NULL data-pointers of these frames has nevertheless
been performed. This is undefined behaviour and causes e.g.
"runtime error: applying non-zero offset 173440 to null pointer"
from UBSan in the vp31, vp4, theora-coeff-level64 and theora-offset
FATE-tests.

Fix this by reusing the current frame for unavailable frames.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-18 02:55:14 +02:00
Andreas Rheinhardt
f9b6e3e48d avcodec/pthread_frame: Only set PerThreadContext* when frame-threading
Otherwise the thread_ctx pointer might be NULL or point to
a SliceThreadContext.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-18 02:55:14 +02:00
Andreas Rheinhardt
1982113467 avcodec/threadframe: Move ff_thread_can_start_frame() to thread.h
It does not use ThreadFrames at all, so thread.h is the correct place.
bcb0faeaba was wrong.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-18 02:55:13 +02:00
Andreas Rheinhardt
bca2651a32 avcodec/pthread_frame: Fix doxygen comments
The '<' in ///< says that the comment pertains to the previous item
on the same line as the ///<.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-18 02:55:13 +02:00
Andreas Rheinhardt
aa8e3f0342 avcodec/pthread_frame: Remove unused enum values
No longer used since the removal of FF_API_THREAD_SAFE_CALLBACKS
in e0786a8eeb.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-18 02:55:13 +02:00
Andreas Rheinhardt
7b2ed4d54a avcodec/thread: Remove outdated documentation
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-18 02:55:13 +02:00
Paul B Mahol
5acc3c4cff avcodec/vmixdec: improve quality factors 2023-09-17 12:55:56 +02:00
Paul B Mahol
9e1ea3caba avformat: add CRI USM demuxer 2023-09-17 11:17:55 +02:00
Paul B Mahol
f7dc5d76e0 avcodec/lagarith: use VLC for prob code length 2023-09-17 11:17:20 +02:00
Paul B Mahol
1ac2769009 avcodec/adx_parser: make packet split work if nb_channels is set 2023-09-17 11:11:24 +02:00
Paul B Mahol
c5effe7d3d avfilter/x86/af_afir: add FMA3 SIMD 2023-09-17 11:11:24 +02:00
Michael Niedermayer
5f810435c2
avformat/hls: reduce default max reload to 3
The 1000 did result in the appearance of a never ending reload loop

The RFC mandates that "If the client reloads a Playlist file and finds that it has not
changed, then it MUST wait for a period of one-half the target
duration before retrying." and if it has changed
"the client MUST wait for at least the target duration before attempting to reload the
Playlist file again"

Trying to reload 3 times seems a better default than 1000 given these
durations

Issue found by: Сергей Колесников
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-09-16 20:47:32 +02:00
Michael Niedermayer
80f6e0378b
avformat/format: Stop reading data at EOF during probing
Issue found by: Сергей Колесников
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-09-16 20:47:32 +02:00
Andreas Rheinhardt
b5c07a368b avcodec/vp3: Don't truncate ptrdiff_t
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-16 14:55:25 +02:00
Andreas Rheinhardt
11a9aab6c1 avcodec/vp3: Use range-based loop variables
Motivated by:
    #if CONFIG_VP4_DECODER
        int j;
    #endif

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-16 14:54:58 +02:00
Andreas Rheinhardt
5022be4e75 avcodec/vp3: Add const where appropriate
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-16 14:54:58 +02:00
Andreas Rheinhardt
9c9458115e avcodec/vp3: Move work after ff_thread_finish_setup
all_fragments is not synced between threads; resetting it can wait.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-16 14:54:58 +02:00
Andreas Rheinhardt
4dae62f708 avcodec/dnxhddec: Use VLC symbol table to avoid lookup
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-16 14:54:17 +02:00
James Almer
156f53e987 avcodec/evc_ps: make the sps parameter in ref_pic_list_struct const
It's not changed.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-09-15 16:33:13 -03:00
Lynne
9310ffc809
vulkan_decode: don't call get_proc_addr on every frame's destruction
The issue is that we cannot rely on any context existing when we free
frames. The Vulkan functions are loaded in each context separately,
so until now, we've just been loading them on every frame's destruction.

Rather than do this, just save the function pointers we need in each
frame. The function pointers are guaranteed to not change and exist.
2023-09-15 17:35:22 +02:00
Lynne
552a5fa496
vulkan_hevc: switch from a buffer pool to a malloc and simplify
Simpler and more robust now that contexts are not shared between threads.
2023-09-15 17:35:19 +02:00
Michael Niedermayer
4565747056
avcodec/evc_ps: Check ref_pic_num and sps_max_dec_pic_buffering_minus1
Fixes: out of array write

Found-by: dongsookim@korea.ac.kr
Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-09-15 17:13:54 +02:00
Jun Zhao
5c635b7d8c lavc/videotoolboxenc: Get the encoder supported properties
Get the encoder supported properties list, it will be used for
feature support checks.

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2023-09-15 21:08:21 +08:00
Jun Zhao
213cba9696 lavc/videotoolboxenc: Dump the encoder
Dump the encoder, it's will help debug some case

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2023-09-15 21:07:46 +08:00
Andreas Rheinhardt
27562bf022 avcodec/x86/mpegvideoenc_template: Disable dead code
Since bfb28b5ce8 the permutation
type FF_IDCT_PERM_SIMPLE is ARCH_X86_32-only. So use this
knowledge to disable code for it when not on ARCH_X86_32.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-15 13:08:55 +02:00
Andreas Rheinhardt
fa77cb258b avcodec/h264dec: Fix data race when updating decode_error_flags
When using multi-threaded decoding, every decoding thread
has its own DBP consisting of H264Pictures and each of these
points to its own AVFrames. They are synced during
update_thread_context via av_frame_ref() and therefore
the threads actually decoding (as well as all the others)
must not modify any field that is copied by av_frame_ref()
after ff_thread_finish_setup().

Yet this is exactly what happens when an error occurs
during decoding and the AVFrame's decode_error_flags are updated.
Given that these errors only become apparent during decoding,
this can't be set before ff_thread_finish_setup() without
defeating the point of frame-threading; in practice,
this meant that the decoder did not set these flags correctly
in case frame-threading was in use. (This means that e.g.
the ffmpeg cli tool fails to output its "corrupt decoded frame"
message in a nondeterministic fashion.)

This commit fixes this by adding a new H264Picture field
that is actually propagated across threads; the field
is an AVBufferRef* whose data is an atomic_int; it is
atomic in order to allow multiple threads to update it
concurrently and not to provide synchronization
between the threads setting the field and the thread
ultimately returning the AVFrame.

This unfortunately has the overhead of one allocation
per H264Picture (both the original one as well as
creating a reference to an existing one), even in case
of no errors. In order to mitigate this, an AVBufferPool
has been used and only if frame-threading is actually
in use. This expense will be removed as soon as
a proper API for refcounted objects (not based upon
AVBuffer) is in place.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-15 13:08:37 +02:00
Andreas Rheinhardt
d2bc039501 avcodec/error_resilience: Make applying decode_error_flags optional
Add a pointer parameter that if supplied will be used to return
the updated decode_error_flags. This will allow to fix several
races when using frame-threading; these resulted from AVFrame
that the earlier code updated concurrently being used as source
in an av_frame_ref() call in the decoder's update_thread_context.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-15 13:08:37 +02:00
Zhao Zhili
4f4dc0a1a2 avfilter/dnn_backend_openvino: fix wild pointer on error path
When ov_model_const_input_by_name/ov_model_const_output_by_name
failed, input_port/output_port can be wild pointer.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-09-15 13:02:15 +08:00
Zhao Zhili
791b88fcb4 avfilter/dnn_backend_openvino: fix input_port/output_port leaks 2023-09-15 13:02:15 +08:00
Zhao Zhili
37123100d2 avfilter/dnn_backend_openvino: fix leak of ov_shape_t 2023-09-15 13:02:15 +08:00
Zhao Zhili
d2c5c3b7ef avfilter/dnn_backend_openvino: fix leak or ov_core_t on error path 2023-09-15 13:02:15 +08:00
Zhao Zhili
e0880ef8cb avfilter/dnn_backend_openvino: fix use uninitialized values
Error handling was broken since neither `ret` nor `task` has being
initialized on error path.
2023-09-15 13:02:15 +08:00
Zhao Zhili
7cb6329296 avfilter/dnn_backend_openvino: reduce indentation in free_model_ov
No functional changes except ensures model isn't null.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-09-15 13:02:15 +08:00
Zhao Zhili
5369548f2e avfilter/dnn_backend_openvino: fix multiple memleaks
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-09-15 13:02:15 +08:00
Zhao Zhili
3e24a27765 avfilter/dnn_filter_common: fix memleak
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-09-15 13:02:15 +08:00
Andreas Rheinhardt
c1b6235d41 avcodec/vulkan_decode: Factor creating session params out, fix leak
All Vulkan HWAccels share the same boilerplate code for creating
session params and this includes a common bug: In case actually
creating the video session parameters fails, the buffer destined
to hold them leaks; in case of HEVC this is also true if
get_data_set_buf() fails.

This commit factors this code out and fixes the leak.

Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-15 02:38:22 +02:00
Andreas Rheinhardt
dfac782b13 avutil/hwcontext_vulkan: Cosmetics
The alignment in vulkan_unmap_from_drm() (formerly the clone
of vulkan_frame_free()) is nicer than the in vulkan_frame_free(),
let's preserve it.

Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-15 02:38:14 +02:00
Andreas Rheinhardt
677635cd04 avutil/hwcontext_vulkan: Deduplicate code
Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-15 02:38:05 +02:00
Andreas Rheinhardt
47b1c0d0db avutil/hwcontext_vulkan: Improve type-safety
The AVBuffer API uses uint8_t as base type for buffers
and therefore its free callbacks need to abide by this.
Therefore vulkan_frame_free() used an inappropriate signature
which caused casts whenever this function has been called
manually.

This commit changes this by making vulkan_frame_free()
use the proper type and a vulkan_frame_free_cb() that
is used as free callback for the AVBuffer API.

Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-15 02:37:56 +02:00
Andreas Rheinhardt
a6bd2ee759 avutil/hwcontext_vulkan: Remove redundant resetting
vulkan_free_internal() already resets the AVVkFrame.internal
pointer.

Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-15 02:37:36 +02:00