[FFmpeg-devel] [PATCH v3 5/5] lavc: implement a Vulkan-based VC-2 encoder Implements a Vulkan based dirac encoder. Supports Haar and Legall wavelets and should work with all wavelet depths.

James Almer jamrial at gmail.com
Fri Apr 18 04:18:36 EEST 2025


On 4/17/2025 8:55 PM, IndecisiveTurtle wrote:
> From: IndecisiveTurtle <geoster3d at gmail.com>
> 
> Performance wise, encoding a 1080p 1-minute video is performed in about 2.5 minutes with the cpu encoder running on my Ryzen 5 4600H, while it takes about 30 seconds on my NVIDIA GTX 1650
> 
> Haar shader has a subgroup optimized variant that applies when configured wavelet depth allows it
> ---
>   configure                                    |   1 +
>   libavcodec/Makefile                          |   3 +
>   libavcodec/allcodecs.c                       |   1 +
>   libavcodec/vc2enc_vulkan.c                   | 959 +++++++++++++++++++
>   libavcodec/vulkan/vc2_dwt_haar.comp          |  82 ++
>   libavcodec/vulkan/vc2_dwt_haar_subgroup.comp |  75 ++
>   libavcodec/vulkan/vc2_dwt_hor_legall.comp    |  82 ++
>   libavcodec/vulkan/vc2_dwt_upload.comp        |  96 ++
>   libavcodec/vulkan/vc2_dwt_ver_legall.comp    |  78 ++
>   libavcodec/vulkan/vc2_encode.comp            | 169 ++++
>   libavcodec/vulkan/vc2_slice_sizes.comp       | 170 ++++
>   11 files changed, 1716 insertions(+)
>   create mode 100644 libavcodec/vc2enc_vulkan.c
>   create mode 100644 libavcodec/vulkan/vc2_dwt_haar.comp
>   create mode 100644 libavcodec/vulkan/vc2_dwt_haar_subgroup.comp
>   create mode 100644 libavcodec/vulkan/vc2_dwt_hor_legall.comp
>   create mode 100644 libavcodec/vulkan/vc2_dwt_upload.comp
>   create mode 100644 libavcodec/vulkan/vc2_dwt_ver_legall.comp
>   create mode 100644 libavcodec/vulkan/vc2_encode.comp
>   create mode 100644 libavcodec/vulkan/vc2_slice_sizes.comp

[...]

> diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
> index f10519617e..054b0d958b 100644
> --- a/libavcodec/allcodecs.c
> +++ b/libavcodec/allcodecs.c
> @@ -365,6 +365,7 @@ extern const FFCodec ff_vc1image_decoder;
>   extern const FFCodec ff_vc1_mmal_decoder;
>   extern const FFCodec ff_vc1_qsv_decoder;
>   extern const FFCodec ff_vc1_v4l2m2m_decoder;
> +extern const FFCodec ff_vc2_vulkan_encoder;

Should be under the software one.

>   extern const FFCodec ff_vc2_encoder;
>   extern const FFCodec ff_vcr1_decoder;
>   extern const FFCodec ff_vmdvideo_decoder;
> diff --git a/libavcodec/vc2enc_vulkan.c b/libavcodec/vc2enc_vulkan.c
> new file mode 100644
> index 0000000000..d90d65e36d
> --- /dev/null
> +++ b/libavcodec/vc2enc_vulkan.c

[...]

> +const FFCodec ff_vc2_vulkan_encoder = {
> +    .p.name         = "vc2_vulkan",
> +    CODEC_LONG_NAME("SMPTE VC-2"),
> +    .p.type         = AVMEDIA_TYPE_VIDEO,
> +    .p.id           = AV_CODEC_ID_DIRAC,
> +    .p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_HARDWARE,

This encoder is not DR1.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature.asc
Type: application/pgp-signature
Size: 495 bytes
Desc: OpenPGP digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20250417/e21fbf68/attachment.sig>


More information about the ffmpeg-devel mailing list