From patchwork Thu Nov 18 04:24:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wu Jianhua X-Patchwork-Id: 31473 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:d206:0:0:0:0:0 with SMTP id q6csp235041iob; Wed, 17 Nov 2021 20:26:37 -0800 (PST) X-Google-Smtp-Source: ABdhPJyUgGVluP1HEZkL1g5j580xGjYlVxo2ZV59ARcYaW8oKQp9Cw62hA+8OjiunR2pUIfoKxV4 X-Received: by 2002:a17:907:3e0c:: with SMTP id hp12mr28944373ejc.293.1637209597712; Wed, 17 Nov 2021 20:26:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1637209597; cv=none; d=google.com; s=arc-20160816; b=O8yNRfImtnrok/oplgJJKdAw4nyjhafimWXCnA50KhUfwO8/NgORDx9ovQpvZD6lEw /xpaOy+Lq+69/mlHwsuBN/+5IyKAglmHJdUKhZAE9q7hbLvxE4Eum/sXGHZke/7aLq+0 q4Sr4asmqA2nWNLcYZsOVP54mNx8hKNE3yXkn6cSs/PEjRjANYa+/nLBn56ydqvxT+fo AJ2zE5qzQxTDnDvOAj/9GEqwpLoCoQJGdwcCgf5FLv/FpzdXgw2J/dek/yBRt7eJ+hVk SN/K6D/uziETYZq3Ufu2xmVWz2+Z+SKLgeLdrDvCI3IwEnSQWjoFc50IZejicIEM+nTT YD8w== 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=Vreoi5RF9zqBOPz36MaJyH1R4NMx4r1dNyXdWWm5I6w=; b=a23nx6p8AI5W0Hmds9pZcn1AAD50zB/fy21fV8+FTDJAEGdSbIc7hz312aRzbeChlm zgAZOAo0MC86P8+dPbjULpZDVWtShXJVHi9RGkHxBB8+iPq/A/n2q9oSmqxwQ76N33Zj UOrz45ouocAypLXPt3UwQQbe6Qq8GjjR1Uf6UkJ4fzlmyiJHtRGh/04fxSqrLK6LrTze OV9DGcxZpP8nhOSyYfO8LCmbfOqlDluqfOcmRn431b840Ax8C7XFFqZYQfkwM/RCKe2T PGwcxcxOCijQLhPIVCiglWmLUXD5UuEGwdQXUECVN+qguaLbUx3bv0BfTa6Xh0jYKC4x Byzg== 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 bo2si3596559ejb.666.2021.11.17.20.26.37; Wed, 17 Nov 2021 20:26:37 -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 C9CA968A412; Thu, 18 Nov 2021 06:25:16 +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 13F4468AE68 for ; Thu, 18 Nov 2021 06:25:09 +0200 (EET) X-IronPort-AV: E=McAfee;i="6200,9189,10171"; a="233945287" X-IronPort-AV: E=Sophos;i="5.87,243,1631602800"; d="scan'208";a="233945287" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Nov 2021 20:25:04 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.87,243,1631602800"; d="scan'208";a="495212296" Received: from otc-skl-e5-server.sh.intel.com ([10.239.43.106]) by orsmga007.jf.intel.com with ESMTP; 17 Nov 2021 20:25:03 -0800 From: Wu Jianhua To: ffmpeg-devel@ffmpeg.org Date: Thu, 18 Nov 2021 12:24:49 +0800 Message-Id: <20211118042449.8038-10-jianhua.wu@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211118042449.8038-1-jianhua.wu@intel.com> References: <20211118042449.8038-1-jianhua.wu@intel.com> Subject: [FFmpeg-devel] [PATCH 10/10] avfilter/overlay_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: EOTFpVqu77lQ Signed-off-by: Wu Jianhua --- libavfilter/vf_overlay_vulkan.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/libavfilter/vf_overlay_vulkan.c b/libavfilter/vf_overlay_vulkan.c index 29eb11c89d..03197ae712 100644 --- a/libavfilter/vf_overlay_vulkan.c +++ b/libavfilter/vf_overlay_vulkan.c @@ -240,9 +240,13 @@ static int process_frames(AVFilterContext *avctx, AVFrame *out_f, AVVkFrame *main = (AVVkFrame *)main_f->data[0]; AVVkFrame *overlay = (AVVkFrame *)overlay_f->data[0]; - AVHWFramesContext *main_fc = (AVHWFramesContext*)main_f->hw_frames_ctx->data; + AVHWFramesContext *main_fc = (AVHWFramesContext*)main_f->hw_frames_ctx->data; AVHWFramesContext *overlay_fc = (AVHWFramesContext*)overlay_f->hw_frames_ctx->data; + const VkFormat *output_formats = av_vkfmt_from_pixfmt(s->vkctx.output_format); + const VkFormat *main_sw_formats = av_vkfmt_from_pixfmt(main_fc->sw_format); + const VkFormat *overlay_sw_formats = av_vkfmt_from_pixfmt(overlay_fc->sw_format); + /* Update descriptors and init the exec context */ ff_vk_start_exec_recording(avctx, s->exec); cmd_buf = ff_vk_get_exec_buf(avctx, s->exec); @@ -250,17 +254,17 @@ static int process_frames(AVFilterContext *avctx, AVFrame *out_f, for (int i = 0; i < planes; i++) { RET(ff_vk_create_imageview(avctx, s->exec, &s->main_images[i].imageView, main->img[i], - av_vkfmt_from_pixfmt(main_fc->sw_format)[i], + main_sw_formats[i], ff_comp_identity_map)); RET(ff_vk_create_imageview(avctx, s->exec, &s->overlay_images[i].imageView, overlay->img[i], - av_vkfmt_from_pixfmt(overlay_fc->sw_format)[i], + overlay_sw_formats[i], ff_comp_identity_map)); RET(ff_vk_create_imageview(avctx, 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->main_images[i].imageLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;