1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-08-04 22:03:09 +02:00
Commit Graph

118999 Commits

Author SHA1 Message Date
94beaf4872 avcodec/videotoolboxenc: Add AYUV as a candidate pix_fmt for HEVC alpha
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2025-03-17 20:10:55 +08:00
5b9356f18e swscale/swscale_unscaled: avoid nv12 <-> nv21 bug
This is not handled by the planar copy wrapper, so exclude it.
2025-03-17 11:40:05 +01:00
8ab40ca984 swscale: fix gray -> grayf32 SIGFPE
swscale internals don't distinguish between 16-bit and higher bit depth
output formats internally when it comes to the choice of intermediate
representation.

Clamping this value both prevents a SIGFPE and also aligns the check
with reality.
2025-03-17 11:40:05 +01:00
9e857e1f8a ffbuild: read library linker objects from a file
The linker command can exceed the maximum argument limit on MinGW,
especially for libavcodec.

The objects list is now stored in a file and passed to the linker.
2025-03-17 15:45:53 +05:30
6bad55eb17 ffv1: add a Vulkan-based decoder
This patch adds a fully-featured level 3 and 4 decoder for FFv1,
supporting Golomb and all Range coding variants, all pixel formats,
and all features, except for the newly added floating-point formats.

On a 6000 Ada, for 3840x2160 bgr0 content at 50Mbps (standard desktop
recording), it is able to do 400fps.
An Alder Lake with 24 threads can barely do 100fps.
2025-03-17 08:51:23 +01:00
caff29dbb1 FFHWAccel: add buffer_ref argument to start_frame
This commit adds a reference to the buffer as an argument to
start_frame, and adapts all existing code.

This allows for asynchronous hardware accelerators to skip
copying packet data by referencing it.
2025-03-17 08:51:23 +01:00
23eb499b28 ffv1dec: add support for hwaccels
This commit adds support for hardware accelerated decoding to
the decoder.
The previous commits already refactored the decoder, this commit
simply adds calls to hooks to decode.
2025-03-17 08:49:16 +01:00
53ff9005b5 vulkan: add support for AV_PIX_FMT_GBRAP32 2025-03-17 08:49:15 +01:00
4de023f953 vulkan: add ff_vk_exec_add_dep_wait_sem()
This adds a function which adds a regular timeline semaphore
as a wait-only dependency.
2025-03-17 08:49:15 +01:00
f2a0bdd6b1 vulkan: unify handling of BGR and simplify ffv1_rct 2025-03-17 08:49:15 +01:00
dd7cc557af ffv1enc_vulkan: clip micro_version to 3 for level 4
This unbreaks level 4 encoding.
2025-03-17 08:49:14 +01:00
b2ebe9884e ffv1enc_vulkan: refactor code to support sharing with decoder
The shaders were written to support sharing, but needed slight
tweaking.
2025-03-17 08:49:14 +01:00
d3d2e254eb av1dec: update hwaccel decode_params on AV1_OBU_SEQUENCE_HEADER
Previously, the callback was only called on init. This makes it
get called on every frame.

We should switch to VK_KHR_video_maintenance2 and provide all params
upfront, but almost nothing supports it yet.
2025-03-17 08:49:14 +01:00
82864c2111 vulkan_hevc: use VK_KHR_video_maintenance2 if available 2025-03-17 08:49:13 +01:00
53f156bccc vulkan_h264: use VK_KHR_video_maintenance2 if available
This avoids having to copy and update the entire SPS/PPS stack.
2025-03-17 08:49:13 +01:00
9a78ebc11a vulkan_av1: use VK_KHR_video_maintenance2 if available 2025-03-17 08:49:12 +01:00
31176b16ac vulkan_decode: use VK_KHR_video_maintenance2 if available 2025-03-17 08:49:12 +01:00
67eb01b458 hwcontext_vulkan: enable VK_KHR_video_maintenance2
Enables some fixes for the video specifications, and a new feature.
2025-03-17 08:49:12 +01:00
e15e85b869 vulkan_decode: adjust number of async contexts created
This caps the number of contexts we create based on thread count.
This saves VRAM and filters out cases where more async is of lesser
benefit.
2025-03-17 08:49:11 +01:00
4495802bdb vulkan_decode: support multiple image views
Enables non-monochrome video decoding using all our existing functions
in the context of an SDR decoder.
2025-03-17 08:49:11 +01:00
491b65e343 vulkan_decode: support software-defined decoders 2025-03-17 08:49:11 +01:00
bbb06f1ffc vulkan: workaround BGR storage image undefined behaviour 2025-03-17 08:49:10 +01:00
3c09aadcf4 hwcontext_vulkan: allow using concurrent access images with more than 5 queues
This limit was not bumped when the queue family rewrite happened.

Fixes validation issues on nvidia.
2025-03-17 08:49:10 +01:00
6c9affb3e6 hwcontext_vulkan: fix downloads; use the common host map function to map frame data
This commit uses the recently exported code for host mapping images back
where it was exported from.

The function also had broken download code for image downloading since its
recent refactor.
2025-03-17 08:49:09 +01:00
a5b90caacd vulkan: copy host-mapping buffer code from hwcontext
This is useful elsewhere.
2025-03-17 08:49:09 +01:00
ed6ee32846 vulkan: add ff_vk_create_imageview 2025-03-17 08:49:09 +01:00
7046e65e37 vulkan: rename ff_vk_set_descriptor_image to ff_vk_shader_update_img 2025-03-17 08:49:08 +01:00
49af9746e8 pixfmt: add AV_PIX_FMT_GBRAP32
This commit adds a 32-bit *integer* planar RGBA format.
Vulkan FFv1 decoding is best performed on separate planes, rather than
packed RGBA (i.e. RGBA128), hence this is useful as an intermediate format.
2025-03-17 08:49:04 +01:00
a1c6ca1683 doc/filters: Shift CUDA-based filters to own section. 2025-03-17 12:38:51 +05:30
5ad86d5fbc avcodec: Mark init and close functions as av_cold
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-17 04:33:11 +01:00
81ca85a087 configure: allow mixed declarations and code for Objective-C
Mixing declarations and code is quite common in Objective-C (as can be
seen by the number of warnings we have for this in Objective-C files)
and forcing to not do it usually results in worse code, with unnecessary
widely scoped variables, which in turn makes variable shadowing and
accidentally using the wrong variable more common and harder to notice.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2025-03-17 10:59:26 +08:00
163e5fd84d configure: fix passing Objective-C flags
Passing Objective-C flags from configure to the Makefiles was broken, as
configure incorrectly used the OBJCCFLAGS instead of OBJCFLAGS variable
which was then later overwritten in the common.mak:

  OBJCCFLAGS  = $(CPPFLAGS) $(CFLAGS) $(OBJCFLAGS)

The fix for this is simple, analogous to how it is handled for CFLAGS,
use OBJCFLAGS here so that the flags are properly included in the
aforementioned OBJCCFLAGS definition.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2025-03-17 10:57:29 +08:00
3ad00ebf2c avcodec/mpeg12dec: Don't assert on thread_count
Nothing in this decoder would break if the generic code were to be
changed to allow slice "threading" with only one thread.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-17 03:46:00 +01:00
2742de0e4a avcodec/mpeg12dec: Use saturated addition when combining error_count
Fixes undefined integer overflows. The overflows could always
happen, yet before 4d8b706b1d
it was not undefined because the code implicitly used atomic
types, for which signed integer overflow is defined.

Reported-by: Kacper Michajlow <kasper93@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-17 03:46:00 +01:00
60f49f4d92 avcodec/qdm2: Use explicit overread checks instead of implicit ones
If there were not enough data, checksum_size would be read
as zero (due to the implicit checks of the bytestream2 API)
and run into a "data block size invalid" error. Erroring out
earlier via "not enough extradata" is better.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-17 03:26:07 +01:00
be7642b198 avcodec/qdm2, vorbisdec: Use compile-time const max_depth in get_vlc2
It makes no sense to try to be exact with max depth
in get_vlc2(): It will mean that the compiler emits code
for all three stages of parsing and runtime checks for
whether max_depth is big enough to parse the next stage
when a not yet complete code has been encountered.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-17 03:26:07 +01:00
c228ae2b40 avcodec/cfhd: Use smaller scope where appropriate
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-17 03:26:07 +01:00
32fba0bce5 avcodec/cfhd: Move GetBitContext from context to stack
Its lifetime is extremely limited.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-17 03:26:07 +01:00
8a2e84dc96 avcodec/hqx: Simplify deriving AC table index
It can be simply encoded in the quant coefficients itself
as they are so small.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-17 03:26:07 +01:00
2f4f96f1ac avcodec/hqx: Combine checks
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-17 03:26:07 +01:00
02b5aee879 avcodec/hqx: Don't zero in small chunks, don't zero twice
Up until now, decode_block() zeroed every block (of 128 bytes)
before decoding a block; yet this is suboptimal for all modes,
because all modes need to reset all the blocks they use anyway
and so it should be done in one go for all blocks.

For the alpha modes (where blocks need not be coded) all blocks
are zeroed initially anyway, because decode_block() might not
be doing it, so zeroing there again for the coded blocks is
a waste.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-17 03:26:07 +01:00
7d70fb3530 avcodec/hqx: Combine memsets
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-17 03:26:07 +01:00
997b33f64c avcodec/hqxvlc: Make dc9, dc10 VLC tables static
It allows to share them between frame threads.
dc11 can unfortunately not be made static without increasing
LOCALBUF_ELEMS in vlc.c.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-17 03:26:07 +01:00
004367a0a3 avcodec/hqx: Cache pointer to used dc table
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-17 03:26:07 +01:00
5dd83ecfb2 avcodec/hqxvlc: Make cbp_vlc static
This is trivial as well as beneficial because frame threads
now use the same table, saving cache/memory.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-17 03:26:07 +01:00
c9d87f4a85 avcodec/hqx: Include hqxvlc directly
This avoids having to expose HQXContext in a header
and allows to make several symbols static.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-17 03:26:07 +01:00
09411fef3d avcodec/hqxvlc: Include implicit +1 run in RL VLC tables
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-17 03:26:07 +01:00
abffd9313d avcodec/hqxvlc: Avoid hardcoded RL VLC table
hqxvlc.c contains sort-of run-length VLCs in hardcoded form;
they amount to 26688 elements, taking 104KiB. These tables contain
many duplicated entries (they are partially created via a RPT_1024
macro). There are actually only 3039 different codes in all tables
combined, making this very wasteful.

This commit changes this by extracting the underlying entries
and creating a (static) RL-VLC. This only costs 3*3039 bytes
of .rodata. The resulting table needs only 15630 entries,
because our VLC init code uses smaller subtables when possible
(for an incomplete code, the negative of the length stored in
the VLC code is the number of bits the subtable uses; the hardcoded
tables uses a worst-case per table value).

Using GET_RL_VLC also gets rid of an unnecessary reload in case
a code is too long to be parsed in the first stage.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-17 03:26:07 +01:00
49d15dfc35 avcodec/rl: Avoid temporary stack VLC array during RL VLC init
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-17 03:26:07 +01:00
3869862b00 avcodec/mpeg12: Avoid temporary stack VLC array during RL VLC init
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-17 03:26:07 +01:00