History

vulkan: enable encoding of images if video_maintenance1 is enabled

Vulkan encoding was designed in a very... consolidated way. You had to know the exact codec and profile that the image was going to eventually be encoded as at... image creation time. Unfortunately, as good as our code is, glimpsing into the exact future isn't what its capable of. video_maintenance1 removed that requirement, which only then made encoding images practically possible.

Lynne committed 2 years ago

Commit 18d964f1 parent 46c13833 files · +67 −12Browse files

Showing the changes to libavcodec (1 of 3 files). Show all

Unified · Split

libavcodec/vulkan_decode.c+10−0
@@ -934,6 +934,10 @@ static int vulkan_decode_get_profile(AVCodecContext *avctx, AVBufferRef *frames_ · 933 unmodified lines
934 VK_IMAGE_USAGE_VIDEO_DECODE_DST_BIT_KHR |934 VK_IMAGE_USAGE_VIDEO_DECODE_DST_BIT_KHR |
935 VK_IMAGE_USAGE_TRANSFER_SRC_BIT |935 VK_IMAGE_USAGE_TRANSFER_SRC_BIT |
936 VK_IMAGE_USAGE_SAMPLED_BIT;936 VK_IMAGE_USAGE_SAMPLED_BIT;
937
938 if (ctx->s.extensions & (FF_VK_EXT_VIDEO_ENCODE_QUEUE |
939 FF_VK_EXT_VIDEO_MAINTENANCE_1))
940 fmt_info.imageUsage |= VK_IMAGE_USAGE_VIDEO_ENCODE_SRC_BIT_KHR;
937 }941 }
938 942
939 /* Get the format of the images necessary */943 /* Get the format of the images necessary */
@@ -1023,6 +1027,7 @@ int ff_vk_frame_params(AVCodecContext *avctx, AVBufferRef *hw_frames_ctx) · 83 unmodified lines
1023 AVVulkanFramesContext *hwfc = frames_ctx->hwctx;1027 AVVulkanFramesContext *hwfc = frames_ctx->hwctx;
1024 FFVulkanDecodeContext *dec = avctx->internal->hwaccel_priv_data;1028 FFVulkanDecodeContext *dec = avctx->internal->hwaccel_priv_data;
1025 FFVulkanDecodeProfileData *prof;1029 FFVulkanDecodeProfileData *prof;
1030 FFVulkanDecodeShared *ctx;
1026 1031
1027 frames_ctx->sw_format = AV_PIX_FMT_NONE;1032 frames_ctx->sw_format = AV_PIX_FMT_NONE;
1028 1033
@@ -1059,6 +1064,11 @@ int ff_vk_frame_params(AVCodecContext *avctx, AVBufferRef *hw_frames_ctx) · 30 unmodified lines
1059 if (!dec->dedicated_dpb)1064 if (!dec->dedicated_dpb)
1060 hwfc->usage |= VK_IMAGE_USAGE_VIDEO_DECODE_DPB_BIT_KHR;1065 hwfc->usage |= VK_IMAGE_USAGE_VIDEO_DECODE_DPB_BIT_KHR;
1061 1066
1067 ctx = dec->shared_ctx;
1068 if (ctx->s.extensions & (FF_VK_EXT_VIDEO_ENCODE_QUEUE |
1069 FF_VK_EXT_VIDEO_MAINTENANCE_1))
1070 hwfc->usage |= VK_IMAGE_USAGE_VIDEO_ENCODE_SRC_BIT_KHR;
1071
1062 return err;1072 return err;
1063}1073}
1064 1074

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t