From patchwork Fri Nov 19 13:52:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wu Jianhua X-Patchwork-Id: 31496 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:d206:0:0:0:0:0 with SMTP id q6csp2414165iob; Fri, 19 Nov 2021 05:54:10 -0800 (PST) X-Google-Smtp-Source: ABdhPJwiKf4Jm0e/EicJERJz7xMhyaAHlp8Nxh/VclRmqn9wOUV0D6PisYqgP1pbTNW6vb9zyziy X-Received: by 2002:a17:907:250f:: with SMTP id y15mr8091829ejl.0.1637330050350; Fri, 19 Nov 2021 05:54:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1637330050; cv=none; d=google.com; s=arc-20160816; b=ts0LMLDUJiTIJQ9EdKScu32GYFvdp6fez01ogEeuXAMPprw5x6D6eCRRc94Up8vUnu WRwViUa9PXIiR5X90ckR4lmG4DrRlZRHU89Evl6MIoRfTnzIoLir65D+8i9dm1Bhv56k 9ndlL7pyHBw9IBhzJG5h0RUL8Cw44YS6oMJDN9C3rsQFsYh3m6HARI9+h5yB5YzHiQ7P INtIiNpE1fa6tj5zFCcbzEVo4Huy49jraMzUKH37ceF5CcUonnP/G+VCozTmGzPNCOze msn5yJoQtOf6kMhlNtuc85HNqKfo+3VEhupUrIyr5kgt9QMTzwA7ICZzcEGapOV3rSTZ dm/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:delivered-to; bh=lzuDL1THCJlHJn7Qvck0HFLIAPsb2Z7nf/0t/4CsiN8=; b=Acz5Mpch9E1d4SDOvaBGIH7csdzCPqa/jlZXrPKHRQufwj8/bIDKkLK82LKT5vJqzg ZW+R6ypfv4/4wFBXY47bF546Pmx+R7DgxDGlkygKrxIuBXmR3IDBC4ts1h7GwjhDcyOC RZ0G8B4mytvrSAPqtwGegiYS4yIw+DSJ/4z7mYjNi5hQIVIuJiq1WPGUr8J8NPGkM8uA 2nIYq0rcEnxBErc8ofsUNWw7tbB7YdPzKbyE/7j343H+DF6HpSUjEYVfG5cIK/Fa5cib G1bt5FsGQyL5nO1rMq8SOFF1Ze/N0Bqh2iL1u5pS7RTGZiJRnuNZYMuGgciE5Ul8vh71 A3ZQ== 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 sc20si11087546ejc.61.2021.11.19.05.54.09; Fri, 19 Nov 2021 05:54:10 -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 F332768A72F; Fri, 19 Nov 2021 15:53:12 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 67A2C68A905 for ; Fri, 19 Nov 2021 15:53:05 +0200 (EET) X-IronPort-AV: E=McAfee;i="6200,9189,10172"; a="231896464" X-IronPort-AV: E=Sophos;i="5.87,247,1631602800"; d="scan'208";a="231896464" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Nov 2021 05:53:00 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.87,247,1631602800"; d="scan'208";a="507905993" Received: from otc-skl-e5-server.sh.intel.com ([10.239.43.106]) by orsmga008.jf.intel.com with ESMTP; 19 Nov 2021 05:52:59 -0800 From: Wu Jianhua To: ffmpeg-devel@ffmpeg.org Date: Fri, 19 Nov 2021 21:52:43 +0800 Message-Id: <20211119135248.14518-6-jianhua.wu@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211119135248.14518-1-jianhua.wu@intel.com> References: <20211119135248.14518-1-jianhua.wu@intel.com> Subject: [FFmpeg-devel] [PATCH 06/11] avfilter/avgblur_vulkan: call av_vkfmt_from_pixfmt only one time 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 MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: q5nF6STTkS4s Signed-off-by: Wu Jianhua --- libavfilter/vf_avgblur_vulkan.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/libavfilter/vf_avgblur_vulkan.c b/libavfilter/vf_avgblur_vulkan.c index c733670764..f053cfb13c 100644 --- a/libavfilter/vf_avgblur_vulkan.c +++ b/libavfilter/vf_avgblur_vulkan.c @@ -212,6 +212,10 @@ static int process_frames(AVFilterContext *avctx, AVFrame *out_f, AVFrame *tmp_f AVVkFrame *in = (AVVkFrame *)in_f->data[0]; AVVkFrame *tmp = (AVVkFrame *)tmp_f->data[0]; AVVkFrame *out = (AVVkFrame *)out_f->data[0]; + + const VkFormat *input_formats = av_vkfmt_from_pixfmt(s->vkctx.input_format); + const VkFormat *output_formats = av_vkfmt_from_pixfmt(s->vkctx.output_format); + int planes = av_pix_fmt_count_planes(s->vkctx.output_format); /* Update descriptors and init the exec context */ @@ -221,17 +225,17 @@ static int process_frames(AVFilterContext *avctx, AVFrame *out_f, AVFrame *tmp_f for (int i = 0; i < planes; i++) { RET(ff_vk_create_imageview(vkctx, s->exec, &s->input_images[i].imageView, in->img[i], - av_vkfmt_from_pixfmt(s->vkctx.input_format)[i], + input_formats[i], ff_comp_identity_map)); RET(ff_vk_create_imageview(vkctx, s->exec, &s->tmp_images[i].imageView, tmp->img[i], - av_vkfmt_from_pixfmt(s->vkctx.output_format)[i], + output_formats[i], ff_comp_identity_map)); RET(ff_vk_create_imageview(vkctx, s->exec, &s->output_images[i].imageView, out->img[i], - av_vkfmt_from_pixfmt(s->vkctx.output_format)[i], + output_formats[i], ff_comp_identity_map)); s->input_images[i].imageLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;