diff options
author | Víctor Manuel Jáquez Leal <vjaquez@igalia.com> | 2024-09-23 12:56:29 +0200 |
---|---|---|
committer | Lynne <dev@lynne.ee> | 2024-09-23 13:42:34 +0200 |
commit | 2bcc124e1a49e27b6a42b1d0ab1cac23568c3ca2 (patch) | |
tree | 7b972229cc3b259c77b1826ed898ad9cd9dd03f4 /libavcodec/vulkan_encode_h265.c | |
parent | 39c640e1d6319f4dcc5f17d2d987db736bbc94af (diff) | |
download | ffmpeg-2bcc124e1a49e27b6a42b1d0ab1cac23568c3ca2.tar.gz |
vulkan_encode: set the quality level in session parameters
While running this command
./ffmpeg_g -loglevel debug -hwaccel vulkan -init_hw_device vulkan=vk:0,debug=1 -hwaccel_output_format vulkan -i input.y4m -vf 'format=nv12,hwupload' -c:v h264_vulkan -quality 2 output.mp4 -y
It hit this validation error:
Validation Error: [ VUID-vkCmdEncodeVideoKHR-None-08318 ] Object 0: handle =
0x8f000000008f, type = VK_OBJECT_TYPE_VIDEO_SESSION_KHR; Object 1: handle =
0xfd00000000fd, type = VK_OBJECT_TYPE_VIDEO_SESSION_PARAMETERS_KHR;
| MessageID = 0x5dc3dd39
| vkCmdEncodeVideoKHR(): The currently configured encode quality level (2) for
VkVideoSessionKHR 0x8f000000008f[] does not match the encode quality level (0)
VkVideoSessionParametersKHR 0xfd00000000fd[] was created with. The Vulkan spec
states: The bound video session parameters object must have been created with
the currently set video encode quality level for the bound video session at the
time the command is executed on the
device (https://www.khronos.org/registry/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-vkCmdEncodeVideoKHR-None-08318)
This patch adds a new function helper for creating session parameters, which
also sets the quality level and it's called by the H.264 and H.265 Vulkan
encoders.
Diffstat (limited to 'libavcodec/vulkan_encode_h265.c')
-rw-r--r-- | libavcodec/vulkan_encode_h265.c | 19 |
1 files changed, 1 insertions, 18 deletions
diff --git a/libavcodec/vulkan_encode_h265.c b/libavcodec/vulkan_encode_h265.c index 3cb7a3b7df..54bf071d78 100644 --- a/libavcodec/vulkan_encode_h265.c +++ b/libavcodec/vulkan_encode_h265.c @@ -1155,7 +1155,6 @@ static av_cold int base_unit_to_vk(AVCodecContext *avctx, static int create_session_params(AVCodecContext *avctx) { int err; - VkResult ret; VulkanEncodeH265Context *enc = avctx->priv_data; FFVulkanEncodeContext *ctx = &enc->common; FFVulkanContext *s = &ctx->s; @@ -1165,7 +1164,6 @@ static int create_session_params(AVCodecContext *avctx) VkVideoEncodeH265SessionParametersAddInfoKHR h265_params_info; VkVideoEncodeH265SessionParametersCreateInfoKHR h265_params; - VkVideoSessionParametersCreateInfoKHR session_params_create; /* Convert it to Vulkan */ err = base_unit_to_vk(avctx, &vk_units); @@ -1197,23 +1195,8 @@ static int create_session_params(AVCodecContext *avctx) .maxStdVPSCount = 1, .pParametersAddInfo = &h265_params_info, }; - session_params_create = (VkVideoSessionParametersCreateInfoKHR) { - .sType = VK_STRUCTURE_TYPE_VIDEO_SESSION_PARAMETERS_CREATE_INFO_KHR, - .pNext = &h265_params, - .videoSession = ctx->common.session, - .videoSessionParametersTemplate = NULL, - }; - - /* Create session parameters */ - ret = vk->CreateVideoSessionParametersKHR(s->hwctx->act_dev, &session_params_create, - s->hwctx->alloc, &ctx->session_params); - if (ret != VK_SUCCESS) { - av_log(avctx, AV_LOG_ERROR, "Unable to create Vulkan video session parameters: %s!\n", - ff_vk_ret2str(ret)); - return AVERROR_EXTERNAL; - } - return 0; + return ff_vulkan_encode_create_session_params(avctx, ctx, &h265_params); } static int parse_feedback_units(AVCodecContext *avctx, |