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
934934 VK_IMAGE_USAGE_VIDEO_DECODE_DST_BIT_KHR |
935935 VK_IMAGE_USAGE_TRANSFER_SRC_BIT |
936936 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;
937941 }
938942
939943 /* 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
10231027 AVVulkanFramesContext *hwfc = frames_ctx->hwctx;
10241028 FFVulkanDecodeContext *dec = avctx->internal->hwaccel_priv_data;
10251029 FFVulkanDecodeProfileData *prof;
1030+ FFVulkanDecodeShared *ctx;
10261031
10271032 frames_ctx->sw_format = AV_PIX_FMT_NONE;
10281033
@@ -1059,6 +1064,11 @@ int ff_vk_frame_params(AVCodecContext *avctx, AVBufferRef *hw_frames_ctx) · 30 unmodified lines
10591064 if (!dec->dedicated_dpb)
10601065 hwfc->usage |= VK_IMAGE_USAGE_VIDEO_DECODE_DPB_BIT_KHR;
10611066
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+
10621072 return err;
10631073 }
10641074

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