[FFmpeg-devel] [PATCH v3 10/10] ffv1enc: add a Vulkan encoder

Lynne dev at lynne.ee
Sun Nov 17 02:19:38 EET 2024


On 11/15/24 05:50, Lynne wrote:
> 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.
> ---
>   configure                              |    1 +
>   libavcodec/Makefile                    |    1 +
>   libavcodec/allcodecs.c                 |    1 +
>   libavcodec/ffv1enc.c                   |    2 +-
>   libavcodec/ffv1enc_vulkan.c            | 1598 ++++++++++++++++++++++++
>   libavcodec/vulkan/Makefile             |    8 +
>   libavcodec/vulkan/common.comp          |  182 +++
>   libavcodec/vulkan/ffv1_common.comp     |   75 ++
>   libavcodec/vulkan/ffv1_enc.comp        |   67 +
>   libavcodec/vulkan/ffv1_enc_ac.comp     |   83 ++
>   libavcodec/vulkan/ffv1_enc_common.comp |  101 ++
>   libavcodec/vulkan/ffv1_enc_rct.comp    |   85 ++
>   libavcodec/vulkan/ffv1_enc_rgb.comp    |   83 ++
>   libavcodec/vulkan/ffv1_enc_setup.comp  |  153 +++
>   libavcodec/vulkan/ffv1_enc_vlc.comp    |  112 ++
>   libavcodec/vulkan/ffv1_reset.comp      |   55 +
>   libavcodec/vulkan/ffv1_vlc.comp        |  122 ++
>   libavcodec/vulkan/rangecoder.comp      |  190 +++
>   18 files changed, 2918 insertions(+), 1 deletion(-)
>   create mode 100644 libavcodec/ffv1enc_vulkan.c
>   create mode 100644 libavcodec/vulkan/common.comp
>   create mode 100644 libavcodec/vulkan/ffv1_common.comp
>   create mode 100644 libavcodec/vulkan/ffv1_enc.comp
>   create mode 100644 libavcodec/vulkan/ffv1_enc_ac.comp
>   create mode 100644 libavcodec/vulkan/ffv1_enc_common.comp
>   create mode 100644 libavcodec/vulkan/ffv1_enc_rct.comp
>   create mode 100644 libavcodec/vulkan/ffv1_enc_rgb.comp
>   create mode 100644 libavcodec/vulkan/ffv1_enc_setup.comp
>   create mode 100644 libavcodec/vulkan/ffv1_enc_vlc.comp
>   create mode 100644 libavcodec/vulkan/ffv1_reset.comp
>   create mode 100644 libavcodec/vulkan/ffv1_vlc.comp
>   create mode 100644 libavcodec/vulkan/rangecoder.comp


I'll push the patchset tomorrow if there are no more comments to fix.

We should definitely add FATE tests for such implementations.


More information about the ffmpeg-devel mailing list