From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id DF63C4103D for ; Sat, 7 Oct 2023 15:04:14 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 4EF9668CA62; Sat, 7 Oct 2023 18:04:12 +0300 (EEST) Received: from w4.tutanota.de (w4.tutanota.de [81.3.6.165]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 5CCB968CA16 for ; Sat, 7 Oct 2023 18:04:05 +0300 (EEST) Received: from tutadb.w10.tutanota.de (unknown [192.168.1.10]) by w4.tutanota.de (Postfix) with ESMTP id 030001060165 for ; Sat, 7 Oct 2023 15:04:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1696691044; s=s1; d=lynne.ee; h=From:From:To:To:Subject:Subject:Content-Description:Content-ID:Content-Type:Content-Type:Content-Transfer-Encoding:Cc:Date:Date:In-Reply-To:In-Reply-To:MIME-Version:MIME-Version:Message-ID:Message-ID:Reply-To:References:References:Sender; bh=bJwYmJ+/va+H3xMsAYvCX+BJa3oY2FvZWZlcSWl2AMI=; b=1JDRNp7HZXgxO0wIOIRgoMPC2WxDGdQgMKwi0sG4djDCTsvaSAJNPF5DLaEvgL3Q JnRaPe/AOhcmVBkFV73TMlyteYxG2loDLmZqaEyucnOox9N4TZJhFZwU1oSBJ+w/lhR 52nusRqsnIbVYCxDvGyHTtN0VNw1v8MFyONKK4IaAYEpxWeIxJs93SA8EAuCPVfoqHL auk+915PvSUEtX72NJ1AiKnMYBoE7vCaH/4Woeo8BkQooWHBkjNrTMgaVBuTasBs9t6 kHKvyjk2LH7lHmyhcUA+urPONu8Ny5rO69dt1pVdRKmU4kkySyJn6LyooPz9o7MhQ0N JJFYCW7DgQ== Date: Sat, 7 Oct 2023 17:04:04 +0200 (CEST) From: Lynne To: FFmpeg development discussions and patches Message-ID: In-Reply-To: References: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_756474_1804014032.1696691045007" Subject: [FFmpeg-devel] [PATCH 2/3] nlmeans_vulkan: reduce dispatches by parallelizing the planes 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: ------=_Part_756474_1804014032.1696691045007 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Patch attached. ------=_Part_756474_1804014032.1696691045007 Content-Type: text/x-diff; charset=us-ascii; name=0002-nlmeans_vulkan-reduce-dispatches-by-parallelizing-th.patch Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=0002-nlmeans_vulkan-reduce-dispatches-by-parallelizing-th.patch >From 863a9977192abf00d131d7b0ed88569210fe0d0c Mon Sep 17 00:00:00 2001 From: Lynne Date: Sat, 16 Sep 2023 01:04:18 +0200 Subject: [PATCH 2/3] nlmeans_vulkan: reduce dispatches by parallelizing the planes --- libavfilter/vf_nlmeans_vulkan.c | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/libavfilter/vf_nlmeans_vulkan.c b/libavfilter/vf_nlmeans_vulkan.c index 5b623eb7a6..9741dd67ac 100644 --- a/libavfilter/vf_nlmeans_vulkan.c +++ b/libavfilter/vf_nlmeans_vulkan.c @@ -538,28 +538,29 @@ static av_cold int init_denoise_pipeline(FFVulkanContext *vkctx, FFVkExecPool *e GLSLC(0, { ); GLSLC(1, ivec2 size; ); GLSLC(1, const ivec2 pos = ivec2(gl_GlobalInvocationID.xy); ); + GLSLC(1, const uint plane = uint(gl_WorkGroupID.z); ); GLSLC(0, ); GLSLC(1, float w_sum; ); GLSLC(1, float sum; ); GLSLC(1, vec4 src; ); GLSLC(1, vec4 r; ); GLSLC(0, ); - - for (int i = 0; i < planes; i++) { - GLSLF(1, src = texture(input_img[%i], pos); ,i); - for (int c = 0; c < desc->nb_components; c++) { - if (desc->comp[c].plane == i) { - int off = desc->comp[c].offset / (FFALIGN(desc->comp[c].depth, 8)/8); - GLSLF(1, w_sum = weights_%i[pos.y*ws_stride[%i] + pos.x]; ,c, c); - GLSLF(1, sum = sums_%i[pos.y*ws_stride[%i] + pos.x]; ,c, c); - GLSLF(1, r[%i] = (sum + src[%i]*255) / (1.0 + w_sum) / 255; ,off, off); - GLSLC(0, ); - } - } - GLSLF(1, imageStore(output_img[%i], pos, r); ,i); - GLSLC(0, ); + GLSLC(1, size = imageSize(output_img[plane]); ); + GLSLC(1, if (!IS_WITHIN(pos, size)) ); + GLSLC(2, return; ); + GLSLC(0, ); + GLSLC(1, src = texture(input_img[plane], pos); ); + GLSLC(0, ); + for (int c = 0; c < desc->nb_components; c++) { + int off = desc->comp[c].offset / (FFALIGN(desc->comp[c].depth, 8)/8); + GLSLF(1, if (plane == %i) { ,desc->comp[c].plane); + GLSLF(2, w_sum = weights_%i[pos.y*ws_stride[%i] + pos.x]; ,c, c); + GLSLF(2, sum = sums_%i[pos.y*ws_stride[%i] + pos.x]; ,c, c); + GLSLF(2, r[%i] = (sum + src[%i]*255) / (1.0 + w_sum) / 255; ,off, off); + GLSLC(1, } ); + GLSLC(0, ); } - + GLSLC(1, imageStore(output_img[plane], pos, r); ); GLSLC(0, } ); RET(spv->compile_shader(spv, vkctx, shd, &spv_data, &spv_len, "main", &spv_opaque)); @@ -716,7 +717,7 @@ static int denoise_pass(NLMeansVulkanContext *s, FFVkExecContext *exec, vk->CmdDispatch(exec->buf, FFALIGN(vkctx->output_width, s->pl_denoise.wg_size[0])/s->pl_denoise.wg_size[0], FFALIGN(vkctx->output_height, s->pl_denoise.wg_size[1])/s->pl_denoise.wg_size[1], - 1); + av_pix_fmt_count_planes(s->vkctx.output_format)); return 0; } -- 2.42.0 ------=_Part_756474_1804014032.1696691045007 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". ------=_Part_756474_1804014032.1696691045007--