From patchwork Thu Dec 9 09:36:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wu Jianhua X-Patchwork-Id: 32215 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:cd86:0:0:0:0:0 with SMTP id d128csp106290iog; Thu, 9 Dec 2021 01:37:42 -0800 (PST) X-Google-Smtp-Source: ABdhPJzdaMXdy1UixtLowq1DJeE6+G9hOhx9RCRNUjRP7zHiVS6+nW1R3t7y35QXYKXrsuY8bG1D X-Received: by 2002:a17:906:52cf:: with SMTP id w15mr14503870ejn.122.1639042662381; Thu, 09 Dec 2021 01:37:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1639042662; cv=none; d=google.com; s=arc-20160816; b=No+Z6rwEVUCg3f5AQPn3aYZFXBs5eW4Nnijc7qOnQouZGweUUQfd3UVT7TNvnSoV/a 0k0lFPU7QKelvrQErWBsHWmy3uC/XQf/mfm7NJrPil+X7lKVFDoV6IRm2PPgPiFY/6BP Btt5c/ciEDy8YnOHBU7CGSSH+ANuj0hP1nVwhMwpFrylI+0Itd7VrOQwwcfHcAEeLbCN hhagDk63naxNoemA7Hvfn8Jrg4czJ8oFH7F2PXUwTg4lXuMGa/HMHWz0cr8KGLdYtUZd 7xlDdIG3+lw0UjiDTw5o44969i4qAEULBXg4hIgAnf+4QCDNHoZkO8Bc92UCZVESC+je m/Jg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature:delivered-to; bh=oBSh9i4vc2H1BMruL/0WY0BG/txLYbf3DhQNy7pmp+I=; b=oJxdyenlO7RqtBzgqOMeFCyR14U3m1Xtlq7SH0IrdIVYlqqx5sowTJzhtODokpbie0 b/mJz7tgy5zXlts7QEGtKa11FRxTOxgP2EIcQQlN0nb8B6TSuJsynxfJm6lemFfhsYHX ONnqnVM4GIdUamMBkkHwwhA+/q6mARbQJ73Vmr9qxSNQiq3yCHVAvJPZOOObGpKO7hS8 6A3ietkaExq/p800V++Pqtg2jV7Mt2iz/sHPOpJlzJ82oZy3KSr6WHJAaCXuUcbwCo5R hka9kpDPLcvMUKzZOuKixN2tlx0QvgU7cUfsoNwVm4gO6dFrg/1lsvExdgY+TJjPvTwh RO/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@intel.com header.s=Intel header.b=TKK3ref6; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id e26si9869520edr.306.2021.12.09.01.37.42; Thu, 09 Dec 2021 01:37:42 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@intel.com header.s=Intel header.b=TKK3ref6; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 1553568AEE4; Thu, 9 Dec 2021 11:37:15 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 2195768AE6F for ; Thu, 9 Dec 2021 11:37:07 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1639042633; x=1670578633; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=lhPtuWWJJkPhR18CqV+1nhgz7M1f5hdgOqIjrKzuI/A=; b=TKK3ref6t66DoEdIOdsF4oR/eNgtxyrGTFeRt7tseLJvn2ql/xrNHSzo HTA6pU1vQbjwtBjbYXJMtg8m9gNIB+KDfTFWJaTXiTfK+iBN3vTIi5rrJ FdFTNheLjbe+9HUg8ep0eH/5+Qp6w18EbswuP2yebU4QiUpUKu/fFzP2p g0dqZV4AO4OZtln4HyHat4YZGsd9brPAZ1tsRs3FEwfmhsKzk79PJDBlw KE7kJ899dlxPiMQkCdK7sg6j8ViHK9HCbTQ2np0BV/Hxh5LYzHH5tJnZp H0PM+A/QoYL0EoscJsb/mXGk4iU219V/ID95oRloEwrOQAlexMOkrvZY9 A==; X-IronPort-AV: E=McAfee;i="6200,9189,10192"; a="237864454" X-IronPort-AV: E=Sophos;i="5.88,192,1635231600"; d="scan'208";a="237864454" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Dec 2021 01:37:05 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,192,1635231600"; d="scan'208";a="462064123" Received: from chenwenbin-z390-aorus-ultra.sh.intel.com ([10.239.35.110]) by orsmga003.jf.intel.com with ESMTP; 09 Dec 2021 01:37:04 -0800 From: Wu Jianhua To: ffmpeg-devel@ffmpeg.org Date: Thu, 9 Dec 2021 17:36:53 +0800 Message-Id: <20211209093654.3149267-3-jianhua.wu@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211209093654.3149267-1-jianhua.wu@intel.com> References: <20211209093654.3149267-1-jianhua.wu@intel.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2 3/4] avfilter/gblur_vulkan: fix incorrect semantics X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Wu Jianhua Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: pCegApEPnB0L 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 --- libavfilter/vf_gblur_vulkan.c | 60 +++++++++++++++++------------------ 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/libavfilter/vf_gblur_vulkan.c b/libavfilter/vf_gblur_vulkan.c index a2e33d1c90..2dbbbd0965 100644 --- a/libavfilter/vf_gblur_vulkan.c +++ b/libavfilter/vf_gblur_vulkan.c @@ -50,31 +50,31 @@ typedef struct GBlurVulkanContext { } GBlurVulkanContext; static const char gblur_horizontal[] = { - C(0, void gblur(const ivec2 pos, const int index) ) - C(0, { ) - C(1, vec4 sum = texture(input_image[index], pos) * kernel[0]; ) - C(0, ) - C(1, for(int i = 1; i < kernel.length(); i++) { ) - C(2, sum += texture(input_image[index], pos + vec2(i, 0.0)) * kernel[i]; ) - C(2, sum += texture(input_image[index], pos - vec2(i, 0.0)) * kernel[i]; ) - C(1, } ) - C(0, ) - C(1, imageStore(output_image[index], pos, sum); ) - C(0, } ) + C(0, void gblur(const ivec2 pos, const int index) ) + C(0, { ) + C(1, vec4 sum = texture(input_images[index], pos) * kernel[0]; ) + C(0, ) + C(1, for (int i = 1; i < kernel.length(); i++) { ) + C(2, sum += texture(input_images[index], pos + vec2(i, 0.0)) * kernel[i]; ) + C(2, sum += texture(input_images[index], pos - vec2(i, 0.0)) * kernel[i]; ) + C(1, } ) + C(0, ) + C(1, imageStore(output_images[index], pos, sum); ) + C(0, } ) }; static const char gblur_vertical[] = { - C(0, void gblur(const ivec2 pos, const int index) ) - C(0, { ) - C(1, vec4 sum = texture(input_image[index], pos) * kernel[0]; ) - C(0, ) - C(1, for(int i = 1; i < kernel.length(); i++) { ) - C(2, sum += texture(input_image[index], pos + vec2(0.0, i)) * kernel[i]; ) - C(2, sum += texture(input_image[index], pos - vec2(0.0, i)) * kernel[i]; ) - C(1, } ) - C(0, ) - C(1, imageStore(output_image[index], pos, sum); ) - C(0, } ) + C(0, void gblur(const ivec2 pos, const int index) ) + C(0, { ) + C(1, vec4 sum = texture(input_images[index], pos) * kernel[0]; ) + C(0, ) + C(1, for (int i = 1; i < kernel.length(); i++) { ) + C(2, sum += texture(input_images[index], pos + vec2(0.0, i)) * kernel[i]; ) + C(2, sum += texture(input_images[index], pos - vec2(0.0, i)) * kernel[i]; ) + C(1, } ) + C(0, ) + C(1, imageStore(output_images[index], pos, sum); ) + C(0, } ) }; static inline float gaussian(float sigma, float x) @@ -133,14 +133,14 @@ static av_cold int init_filter(AVFilterContext *ctx, AVFrame *in) FFVulkanDescriptorSetBinding image_descs[] = { { - .name = "input_image", + .name = "input_images", .type = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, .dimensions = 2, .elems = planes, .stages = VK_SHADER_STAGE_COMPUTE_BIT, }, { - .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", @@ -202,13 +202,13 @@ static av_cold int init_filter(AVFilterContext *ctx, AVFrame *in) 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); + GLSLF(1, size = imageSize(output_images[%i]); ,i); GLSLC(1, if (IS_WITHIN(pos, size)) { ); if (s->planes & (1 << i)) { GLSLF(2, gblur(pos, %i); ,i); } else { - GLSLF(2, vec4 res = texture(input_image[%i], pos); ,i); - GLSLF(2, imageStore(output_image[%i], pos, res); ,i); + GLSLF(2, vec4 res = texture(input_images[%i], pos); ,i); + GLSLF(2, imageStore(output_images[%i], pos, res); ,i); } GLSLC(1, } ); } @@ -261,13 +261,13 @@ static av_cold int init_filter(AVFilterContext *ctx, AVFrame *in) 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); + GLSLF(1, size = imageSize(output_images[%i]); ,i); GLSLC(1, if (IS_WITHIN(pos, size)) { ); if (s->planes & (1 << i)) { GLSLF(2, gblur(pos, %i); ,i); } else { - GLSLF(2, vec4 res = texture(input_image[%i], pos); ,i); - GLSLF(2, imageStore(output_image[%i], pos, res); ,i); + GLSLF(2, vec4 res = texture(input_images[%i], pos); ,i); + GLSLF(2, imageStore(output_images[%i], pos, res); ,i); } GLSLC(1, } ); }