From patchwork Tue Dec 7 09:41:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wu Jianhua X-Patchwork-Id: 32104 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:cd86:0:0:0:0:0 with SMTP id d128csp6014977iog; Tue, 7 Dec 2021 01:46:25 -0800 (PST) X-Google-Smtp-Source: ABdhPJzyAFNBFK9m1kZFC+VJyy/GGWiKIywgdwRZFimbOMj89WIJ6uTEbYuh7yWxJvPKAkAygfnG X-Received: by 2002:a05:6402:2079:: with SMTP id bd25mr7723347edb.116.1638870385188; Tue, 07 Dec 2021 01:46:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1638870385; cv=none; d=google.com; s=arc-20160816; b=IctUsazPkioTjsnFYHg4fT5qhdC/Afvyxo7JwXDyiLv807jmUaB++woF8/wZExAu0J Hq013i9qkLT9244Z9srN0/EK8u/kTbTA7AhzF7mG3abuoOzbs1lAuHf1YvZf5ylGjnFX IxfcylNFjLj40EqCQLTBYfMgYc1ZhVQge+5IahNjrGedmbsEPrt3MM8vgPk24q99Z9Rk vkFp5Bq7W52wWmayuEXPRnwznBuQT1A44p2DxKKASmVfmb3a8lfeR3udDv+FT5X1oSGq 42K917z8OtJ8EffNsZdpn8rGYA4iq/nSgpwfJsrvxfTkGA2MWcc1J4DUUJDEYuUztOTa 8NJA== 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:delivered-to; bh=oBSh9i4vc2H1BMruL/0WY0BG/txLYbf3DhQNy7pmp+I=; b=fZdP5wMFEPSUhnEzYse0fCsJM10igzLjZ4gtoEsbzVWSHMy9wXyf7CQyJ/f0KR0zwm Y1NQFQqMQrEJjZ/PKULWhhy4N7UJxFzZdItrv8JT4iP+UM8mw6a25+9rybi7e3CQmxIK voczhGKfrz3iPsQEckQbC91B55XtoS5lv9J35QXXZU923icZgf1JLktr7YkXQSPRp6Qs OYqAdNVM7jkzaOBbWudLyDO9DG26ywttkr+eSE7c09WH4FX6IaGDSFSPMOGN5V1DDdr2 CLo8fYo3YZ1ZpNMR68wIe80dC98T0lL+WhlLLG/kgtizgxfiS28I3Z2fxVH5StOi8KEN HUTw== ARC-Authentication-Results: i=1; mx.google.com; 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 c11si24871808edw.601.2021.12.07.01.46.24; Tue, 07 Dec 2021 01:46:25 -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; 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 B8E2468AE71; Tue, 7 Dec 2021 11:46:03 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 5120168AD8B for ; Tue, 7 Dec 2021 11:45:56 +0200 (EET) X-IronPort-AV: E=McAfee;i="6200,9189,10190"; a="236279429" X-IronPort-AV: E=Sophos;i="5.87,293,1631602800"; d="scan'208";a="236279429" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Dec 2021 01:45:53 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.87,293,1631602800"; d="scan'208";a="657630459" Received: from chenwenbin-z390-aorus-ultra.sh.intel.com ([10.239.35.110]) by fmsmga001.fm.intel.com with ESMTP; 07 Dec 2021 01:45:52 -0800 From: Wu Jianhua To: ffmpeg-devel@ffmpeg.org Date: Tue, 7 Dec 2021 17:41:39 +0800 Message-Id: <20211207094140.2151055-3-jianhua.wu@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211207094140.2151055-1-jianhua.wu@intel.com> References: <20211207094140.2151055-1-jianhua.wu@intel.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 3/4] avfilter/gblur_vulkan: fix incorrect sematic 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: YFDBnvX9hmZ5 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, } ); }