[FFmpeg-devel] [PATCH v2 4/4] avfilter/flip_vulkan: fix incorrect semantics

Wu Jianhua jianhua.wu at intel.com
Thu Dec 9 11:36:54 EET 2021


The input and output are arrays of images, so it's better to use the plural
to align them to the variable name of VkDescriptorImageInfo.

Signed-off-by: Wu Jianhua <jianhua.wu at intel.com>
---
 libavfilter/vf_flip_vulkan.c | 32 ++++++++++++++++----------------
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/libavfilter/vf_flip_vulkan.c b/libavfilter/vf_flip_vulkan.c
index 0223786ef1..6a6709e79b 100644
--- a/libavfilter/vf_flip_vulkan.c
+++ b/libavfilter/vf_flip_vulkan.c
@@ -52,7 +52,7 @@ static av_cold int init_filter(AVFilterContext *ctx, AVFrame *in, enum FlipType
 
     FFVulkanDescriptorSetBinding image_descs[] = {
         {
-            .name       = "input_image",
+            .name       = "input_images",
             .type       = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER,
             .dimensions = 2,
             .elems      = planes,
@@ -60,7 +60,7 @@ static av_cold int init_filter(AVFilterContext *ctx, AVFrame *in, enum FlipType
             .updater    = s->input_images,
         },
         {
-            .name       = "output_image",
+            .name       = "output_images",
             .type       = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE,
             .mem_layout = ff_vk_shader_rep_fmt(s->vkctx.output_format),
             .mem_quali  = "writeonly",
@@ -89,33 +89,33 @@ static av_cold int init_filter(AVFilterContext *ctx, AVFrame *in, enum FlipType
         ff_vk_set_compute_shader_sizes(shd, (int [3]){ CGS, 1, 1 });
         RET(ff_vk_add_descriptor_set(vkctx, s->pl, shd, image_descs, FF_ARRAY_ELEMS(image_descs), 0));
 
-        GLSLC(0, void main()                                                                    );
-        GLSLC(0, {                                                                              );
-        GLSLC(1,     ivec2 size;                                                                );
-        GLSLC(1,     const ivec2 pos = ivec2(gl_GlobalInvocationID.xy);                         );
+        GLSLC(0, void main()                                                                     );
+        GLSLC(0, {                                                                               );
+        GLSLC(1,     ivec2 size;                                                                 );
+        GLSLC(1,     const ivec2 pos = ivec2(gl_GlobalInvocationID.xy);                          );
         for (int i = 0; i < planes; i++) {
-            GLSLC(0,                                                                            );
-            GLSLF(1, size = imageSize(output_image[%i]);                                      ,i);
-            GLSLC(1, if (IS_WITHIN(pos, size)) {                                                );
+            GLSLC(0,                                                                             );
+            GLSLF(1, size = imageSize(output_images[%i]);                                      ,i);
+            GLSLC(1, if (IS_WITHIN(pos, size)) {                                                 );
             switch (type)
             {
             case FLIP_HORIZONTAL:
-                GLSLF(2, vec4 res = texture(input_image[%i], ivec2(size.x - pos.x, pos.y));   ,i);
+                GLSLF(2, vec4 res = texture(input_images[%i], ivec2(size.x - pos.x, pos.y));   ,i);
                 break;
             case FLIP_VERTICAL:
-                GLSLF(2, vec4 res = texture(input_image[%i], ivec2(pos.x, size.y - pos.y));   ,i);
+                GLSLF(2, vec4 res = texture(input_images[%i], ivec2(pos.x, size.y - pos.y));   ,i);
                 break;
             case FLIP_BOTH:
-                GLSLF(2, vec4 res = texture(input_image[%i], ivec2(size.xy - pos.xy));,         i);
+                GLSLF(2, vec4 res = texture(input_images[%i], ivec2(size.xy - pos.xy));,        i);
                 break;
             default:
-                GLSLF(2, vec4 res = texture(input_image[%i], pos);                            ,i);
+                GLSLF(2, vec4 res = texture(input_images[%i], pos);                            ,i);
                 break;
             }
-            GLSLF(2,     imageStore(output_image[%i], pos, res);                              ,i);
-            GLSLC(1, }                                                                          );
+            GLSLF(2,     imageStore(output_images[%i], pos, res);                              ,i);
+            GLSLC(1, }                                                                           );
         }
-        GLSLC(0, }                                                                              );
+        GLSLC(0, }                                                                               );
 
         RET(ff_vk_compile_shader(vkctx, shd, "main"));
         RET(ff_vk_init_pipeline_layout(vkctx, s->pl));
-- 
2.25.1



More information about the ffmpeg-devel mailing list