diff options
author | Lynne <dev@lynne.ee> | 2024-09-22 13:52:35 +0200 |
---|---|---|
committer | Lynne <dev@lynne.ee> | 2024-09-23 13:42:34 +0200 |
commit | 39c640e1d6319f4dcc5f17d2d987db736bbc94af (patch) | |
tree | a334f906db47f48f2368eba0227e885bdf35be37 /libavfilter/vf_nlmeans_vulkan.c | |
parent | bc36fe6f1fc5244d5fc85c3b763015f58d50b358 (diff) | |
download | ffmpeg-39c640e1d6319f4dcc5f17d2d987db736bbc94af.tar.gz |
nlmeans_vulkan: split up descriptor sets, rename buffer offset vars
Diffstat (limited to 'libavfilter/vf_nlmeans_vulkan.c')
-rw-r--r-- | libavfilter/vf_nlmeans_vulkan.c | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/libavfilter/vf_nlmeans_vulkan.c b/libavfilter/vf_nlmeans_vulkan.c index f0a7353d5c..fc9b522c80 100644 --- a/libavfilter/vf_nlmeans_vulkan.c +++ b/libavfilter/vf_nlmeans_vulkan.c @@ -457,6 +457,10 @@ static av_cold int init_denoise_pipeline(FFVulkanContext *vkctx, FFVkExecPool *e .elems = planes, .stages = VK_SHADER_STAGE_COMPUTE_BIT, }, + }; + RET(ff_vk_pipeline_descriptor_set_add(vkctx, pl, shd, desc_set, 2, 0, 0)); + + desc_set = (FFVulkanDescriptorSetBinding []) { { .name = "weights_buffer_0", .type = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, @@ -514,7 +518,8 @@ static av_cold int init_denoise_pipeline(FFVulkanContext *vkctx, FFVkExecPool *e .buf_content = "float sums_3[];", }, }; - RET(ff_vk_pipeline_descriptor_set_add(vkctx, pl, shd, desc_set, 2 + 2*desc->nb_components, 0, 0)); + + RET(ff_vk_pipeline_descriptor_set_add(vkctx, pl, shd, desc_set, 2*desc->nb_components, 0, 0)); GLSLC(0, void main() ); GLSLC(0, { ); @@ -753,8 +758,8 @@ static int nlmeans_vulkan_filter_frame(AVFilterLink *link, AVFrame *in) /* Weights/sums */ AVBufferRef *ws_buf = NULL; FFVkBuffer *ws_vk; - VkDeviceSize weights_addr[4]; - VkDeviceSize sums_addr[4]; + VkDeviceSize weights_offs[4]; + VkDeviceSize sums_offs[4]; uint32_t ws_stride[4]; size_t ws_size[4]; size_t ws_total_size = 0; @@ -812,11 +817,11 @@ static int nlmeans_vulkan_filter_frame(AVFilterLink *link, AVFrame *in) return err; ws_vk = (FFVkBuffer *)ws_buf->data; - weights_addr[0] = 0; - sums_addr[0] = ws_total_size; + weights_offs[0] = 0; + sums_offs[0] = ws_total_size; for (int i = 1; i < desc->nb_components; i++) { - weights_addr[i] = weights_addr[i - 1] + ws_size[i - 1]; - sums_addr[i] = sums_addr[i - 1] + ws_size[i - 1]; + weights_offs[i] = weights_offs[i - 1] + ws_size[i - 1]; + sums_offs[i] = sums_offs[i - 1] + ws_size[i - 1]; } /* Output frame */ @@ -933,10 +938,10 @@ static int nlmeans_vulkan_filter_frame(AVFilterLink *link, AVFrame *in) s->sampler); for (int i = 0; i < desc->nb_components; i++) { RET(ff_vk_set_descriptor_buffer(&s->vkctx, &s->pl_weights, exec, 0, 1 + i*2 + 0, 0, - ws_vk, weights_addr[i], ws_size[i], + ws_vk, weights_offs[i], ws_size[i], VK_FORMAT_UNDEFINED)); RET(ff_vk_set_descriptor_buffer(&s->vkctx, &s->pl_weights, exec, 0, 1 + i*2 + 1, 0, - ws_vk, sums_addr[i], ws_size[i], + ws_vk, sums_offs[i], ws_size[i], VK_FORMAT_UNDEFINED)); } @@ -947,11 +952,11 @@ static int nlmeans_vulkan_filter_frame(AVFilterLink *link, AVFrame *in) ff_vk_update_descriptor_img_array(vkctx, &s->pl_denoise, exec, out, out_views, 0, 1, VK_IMAGE_LAYOUT_GENERAL, s->sampler); for (int i = 0; i < desc->nb_components; i++) { - RET(ff_vk_set_descriptor_buffer(&s->vkctx, &s->pl_denoise, exec, 0, 2 + i*2 + 0, 0, - ws_vk, weights_addr[i], ws_size[i], + RET(ff_vk_set_descriptor_buffer(&s->vkctx, &s->pl_denoise, exec, 1, i*2 + 0, 0, + ws_vk, weights_offs[i], ws_size[i], VK_FORMAT_UNDEFINED)); - RET(ff_vk_set_descriptor_buffer(&s->vkctx, &s->pl_denoise, exec, 0, 2 + i*2 + 1, 0, - ws_vk, sums_addr[i], ws_size[i], + RET(ff_vk_set_descriptor_buffer(&s->vkctx, &s->pl_denoise, exec, 1, i*2 + 1, 0, + ws_vk, sums_offs[i], ws_size[i], VK_FORMAT_UNDEFINED)); } |