1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-11-29 05:57:37 +02:00
Commit Graph

14 Commits

Author SHA1 Message Date
Lynne
bb87d19cd9 ffv1enc_vulkan: disable autodetection of async_depth
The issue is that this could consume gigabytes of VRAM at higher
resolutions for not that much of a speedup.
Automatic detection was not a good idea as we can't know how much
VRAM is actually free.
Just remove it.
2025-02-27 19:08:42 +01:00
Lynne
542a567d50 ffv1enc_vulkan: support default range coder tables
This adds support for default range coder tables, rather than
only custom ones. Its two lines, as the same code can be used
for both thanks to ffv1enc.c setting f->state_transition properly.
2025-02-21 03:19:19 +01:00
James Almer
19045957af avcodec/ffv1enc_vulkan: add missing arguent to ff_ffv1_common_init()
Missed in 3d3ce9647f.

Found-by: kasper93
Signed-off-by: James Almer <jamrial@gmail.com>
2025-02-06 17:03:25 -03:00
Lynne
e7b474783c ffv1enc_vulkan: allow setting the number of slices via -slices
Falls back to the exact same code the software encoder uses.
2025-01-03 14:53:41 +09:00
Lynne
2e06b84e27 vulkan: do not reinvent a queue context struct
We recently introduced a public field which was a superset
of the queue context we used to have.

Switch to using it entirely.

This also allows us to get rid of the NIH function which was
valid only for video queues.
2024-12-23 04:25:09 +09:00
Michael Niedermayer
559d435fa3 avcodec/ffv1enc: Add enum for qtable
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-12-04 04:23:48 +01:00
Lynne
d4966f0a74 ffv1enc_vulkan: limit parallelism based on VRAM, fallback to host memory 2024-11-26 14:14:16 +01:00
Lynne
5effac3b02 ffv1enc: expose ff_ffv1_encode_buffer_size
The function is quite important to ensure that the output
is always going to be sufficient, and it can change version to
version, so exposing it makes sense.
2024-11-26 14:14:15 +01:00
Lynne
d8f301cdf2 ffv1enc_vulkan: switch to receive_packet
This allows the encoder to fully saturate all queues the GPU
has, giving a good 10% in certain cases and resolutions.

This also improves error resilience if an allocation fails,
and properly cleans up after itself if it does.
2024-11-26 14:14:15 +01:00
Lynne
4fefc6e80c ffv1enc_vulkan: remove arbitrary limitation of the number of slices 2024-11-26 14:14:15 +01:00
Lynne
7c52dda55f hwcontext_vulkan: add support for AV_PIX_FMT_GBRP12/14/16 2024-11-26 14:14:12 +01:00
Lynne
eb536d97a0 ffv1enc_vulkan: support buffers larger than 4GiB
Unlike the software FFv1 encoder, none of our buffers are allocated by
FFmpeg, which supports at most 4GiB large allocations.

For really large sizes, the maximum size of the buffer can exceed 4GiB,
which the software encoder optimistically tries to allocate as 4GiB
in the hopes that the encoder will compress to under that amount.

We can just let Vulkan allocate us a larger buffer, and switch to
64-bit offsets.
2024-11-20 05:23:05 +01:00
Lynne
66093c5b94 ffv1enc_vulkan: restrict number of execution contexts to 1
This only leads to wasting memory in a single-threaded operation.
Limit this to 1 for now and leave a comment.
2024-11-18 20:04:24 +01:00
Lynne
ed2391d341 ffv1enc: add a Vulkan encoder
This commit implements a standard, compliant, version 3 and version 4
FFv1 encoder, entirely in Vulkan. The encoder is written in standard
GLSL and requires a Vulkan 1.3 supporting GPU with the BDA extension.

The encoder can use any amount of slices, but nominally, should use
32x32 slices (1024 in total) to maximize parallelism.

All features are supported, as well as all pixel formats.
This includes:
 - Rice
 - Range coding with a custom quantization table
 - PCM encoding

CRC calculation is also massively parallelized on the GPU.

Encoding of unaligned dimensions on subsampled data requires
version 4, or requires oversizing the image to 64-pixel alignment
and cropping out the padding via container flags.

Performance-wise, this makes 1080p real-time screen capture possible
at 60fps on even modest GPUs.
2024-11-18 07:54:22 +01:00