1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-18 03:19:31 +02:00
Commit Graph

112147 Commits

Author SHA1 Message Date
Fei Wang
3be81e3b44 lavc/vaapi_encode: Add VAAPI AV1 encoder
Signed-off-by: Fei Wang <fei.w.wang@intel.com>
Acked-by: Neal Gompa <ngompa13@gmail.com>
2023-09-22 13:15:00 +08:00
Fei Wang
254c5a8134 lavc/vaapi_encode: Separate reference frame into previous/future list
To support more reference frames from different directions.

Signed-off-by: Fei Wang <fei.w.wang@intel.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
2023-09-22 13:15:00 +08:00
Fei Wang
11b81838ae lavc/vaapi_encode: Extract set output pkt property function
Signed-off-by: Fei Wang <fei.w.wang@intel.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
2023-09-22 13:15:00 +08:00
Fei Wang
4a4400709c lavc/vaapi_encode: Init pic at the beginning of API
Signed-off-by: Fei Wang <fei.w.wang@intel.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
2023-09-22 13:15:00 +08:00
Fei Wang
695477a1c7 avcodec/cbs_av1: Allow specifying obu size byte length
Signed-off-by: Fei Wang <fei.w.wang@intel.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
2023-09-22 13:15:00 +08:00
Mark Thompson
abe16daea1 cbs: Make tracing more general
Turn tracing into callbacks for each syntax element, with default
callbacks to match current trace_headers behaviour for debug.  Move
the construction of bit strings into the trace callback, which
simplifies all of the read and write functions.

Signed-off-by: Fei Wang <fei.w.wang@intel.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
2023-09-22 13:15:00 +08:00
Fei Wang
6c3a5d625f avcodec/cbs_av1: Add tx mode enum values
Signed-off-by: Fei Wang <fei.w.wang@intel.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
2023-09-22 13:15:00 +08:00
James Almer
95b5c81729 avcodec/extract_extradata: use size_t as parameter type in val_in_array()
It only gets passed the return value of FF_ARRAY_ELEMS(), which is a size_t.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-09-21 22:04:22 -03:00
Paul B Mahol
365529178d avformat/cafdec: improve probing 2023-09-21 22:41:10 +02:00
Paul B Mahol
ea06317190 avcodec/osq: do not return immediately on fatal error 2023-09-21 20:32:41 +02:00
Damiano Galassi
33b2646d61 lavf/movenc: enable dvh1 FourCC
This is required to pass through Dolby Vision metadata to x265.
Profiles 5 and 8 require the "dvh1" fourCC:
https://professional.dolby.com/siteassets/content-creation/dolby-vision-for-content-creators/dolby-vision-streams-within-the-http-live-streaming-format-v2.0-13-november-2018.pdf#unique_10
https://professional.dolby.com/siteassets/content-creation/dolby-vision-for-content-creators/dolbyvisioninmpegdashspecification_v2_0_public_20190107.pdf#unique_13
https://professional.dolby.com/siteassets/content-creation/dolby-vision-for-content-creators/dolby_vision_bitstreams_within_the_iso_base_media_file_format_dec2017.pdf

See also https://github.com/HandBrake/HandBrake/pull/4838 for more
details.

Fixes: https://trac.ffmpeg.org/ticket/10257
2023-09-20 21:19:45 +01:00
Zhao Zhili
3951c1899e avfilter/vf_smartblur: pass old context to sws_getCachedContext
Otherwise it make no sense to use sws_getCachedContext.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-09-20 23:24:55 +08:00
Nuo Mi
9ef20920ab
avcodec/cbs_h266_syntax_template: Check num_output_layers_in_ols
from the specification:
For each OLS, there shall be at least one layer that is an output layer. In other words, for any value of i in the range of 0
to TotalNumOlss − 1, inclusive, the value of NumOutputLayersInOls[ i ] shall be greater than or equal to 1

Fixes: index 257 out of bounds for type 'uint8_t [257]'
Fixes: 61160/clusterfuzz-testcase-minimized-ffmpeg_BSF_VVC_METADATA_fuzzer-6709397181825024

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-09-19 21:28:40 +02:00
James Almer
13d22dc454
avcodec/dcadec: Do not explode EAGAIN
Fixes: out of array access
Fixes: 62164/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DCA_fuzzer-6041088751960064

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-09-19 21:28:40 +02:00
Michael Niedermayer
42b20c93ae
avcodec/decode: EAGAIN is not fully supported in decode_simple_internal()
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-09-19 20:24:46 +02:00
Andreas Rheinhardt
63eb630915 avcodec/libvpxdec: Remove redundant unreferencing of AVFrame
The AVFrame of a decoder with the ordinary decode callback
is generically unreferenced on error.

Reviewed-by: James Zern <jzern@google.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-19 18:11:46 +02:00
James Almer
ac64800edd avcodec/extract_extradata: filter what Metadata OBUs are included in AV1 extradata
Only those that are relevant for the entire coded stream should be included.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-09-19 13:00:08 -03:00
James Almer
abc346de73 configure: rework parsing --cpu arguments to support all features unless blacklisted
Keeping an ever growing list of CPUs just to pass -march to the compiler and
enable fast_cmov is a waste of time. Every CPU we know has limitations is
already handled here, so just fallback to enabling everything when a passed in
argument is not one of those.

This will enable optimizations for CPU architectures released in the past 7 or
so years with supported GCC and clang compilers when used as argument in
configure, instead of silently ignoring them.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-09-19 12:47:38 -03:00
Paul B Mahol
fa20f5cd9e avcodec/vlc: add correct upper limit for recursive function 2023-09-18 20:11:48 +02:00
Zhao Zhili
ba9cd06c76 avutil/avutil: make AV_TIME_BASE_Q available in C++
ISO C++ forbids compound-literals. It's not available with MSVC.
This is a known issue from 10 years ago, and that's why there is a
av_get_time_base_q().

Since we have no plan to remove AV_TIME_BASE_Q, just make it
available in C++.

There are multiple choices:
1. Use C++11 syntax: AVRational{1, AV_TIME_BASE}

Users may still use C++98 to write new code. So no.

2. Use av_get_time_base_q().

It's for this purpose. But it's not compile time constants as
AV_TIME_BASE_Q in C.

So I choose av_make_q() as Anton's suggestion.

https://libav-devel.libav.narkive.com/ZQCWfTun/patch-0-2-fix-avutil-h-usage-from-c
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-09-19 00:52:21 +08:00
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