From patchwork Fri Nov 19 13:52:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wu Jianhua X-Patchwork-Id: 31494 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:d206:0:0:0:0:0 with SMTP id q6csp2414514iob; Fri, 19 Nov 2021 05:54:30 -0800 (PST) X-Google-Smtp-Source: ABdhPJztdysqs9jbISZ8StZrM2z8oNjdZ72jjycvBSGKSQPGj6idmR+qje74hgubAXYkC+u08ue6 X-Received: by 2002:a17:906:4791:: with SMTP id cw17mr8050847ejc.493.1637330069950; Fri, 19 Nov 2021 05:54:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1637330069; cv=none; d=google.com; s=arc-20160816; b=XHpfpY0zPWAQAm4RIwb7wD1Yzl90U6TTLEUWWDKiWWFEF9em58aL5p4a8qwMox87De bGVAvokkjS4MP5kTcBQhBkIHNpn5XXlhdEQ/l8jZ0CVDiazEj/pY9/n99kmS7h8B17wB yIAiOsplB5xGFVbwebPSl56Cp9Wz77NqnbYUSlsV5rWmryiW3LXvbrbvywGIHPnpjmI/ Bq/Jj8zGOM13a1j7xMDPhrAH1YmeXT7pEVnXewpWoTuNSfTSS22CSwT0ahpNZHKNZibP 00X9sO+pF0ay4xkbkvUuIbRDHgr9rq3Rkmg+4zpl3dpdxOIVBnR7sZsG6q0rriEd0KKF Uq3A== 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=QxhCmYpl/w6zcs0+HWDbgN9OlDHBRHND/ZEvvqE5XP4=; b=QOqmPEFSV1RAmlbxQw9yyCCbxjeRMLlI0eaeTlzmUHOwH1hDgnyl8TcYENiCxA918K ZI5TrwMNCrF5OVNP5cnt7UA1UZCbP3Ksh1UQ0xKlbdkV3BOt1++DqfynEh4CGTLjyGS+ aAA+gsLzAOgfS7pNt22GNBnXKeHkv5F4fckpoHAK89M7fTIUcGj8+3Q0Zhq0+KWg80/c LzMlNSt7fMPDc3CrO1sFOzifI6Au6P2XsYiBg85YcsbmR9jDILWaIPIrIG1L5BqO49sg /HaOZQR/cRMgalUV8RjJLpgOrJjxX5UqA1EGZGEpEi7NC1kJrYYC0HvrLvn/n9fmHbGV 7bFQ== 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 n6si5856317edd.256.2021.11.19.05.54.29; Fri, 19 Nov 2021 05:54:29 -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 9B66A68A985; Fri, 19 Nov 2021 15:53:15 +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 5A90F68A905 for ; Fri, 19 Nov 2021 15:53:11 +0200 (EET) X-IronPort-AV: E=McAfee;i="6200,9189,10172"; a="231896476" X-IronPort-AV: E=Sophos;i="5.87,247,1631602800"; d="scan'208";a="231896476" 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:04 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.87,247,1631602800"; d="scan'208";a="507906030" Received: from otc-skl-e5-server.sh.intel.com ([10.239.43.106]) by orsmga008.jf.intel.com with ESMTP; 19 Nov 2021 05:53:03 -0800 From: Wu Jianhua To: ffmpeg-devel@ffmpeg.org Date: Fri, 19 Nov 2021 21:52:47 +0800 Message-Id: <20211119135248.14518-10-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 10/11] 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: S9FCI7gggubQ 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 705e92e268..13dde25b22 100644 --- a/libavfilter/vf_overlay_vulkan.c +++ b/libavfilter/vf_overlay_vulkan.c @@ -242,9 +242,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(vkctx, s->exec); cmd_buf = ff_vk_get_exec_buf(s->exec); @@ -252,17 +256,17 @@ static int process_frames(AVFilterContext *avctx, AVFrame *out_f, for (int i = 0; i < planes; i++) { RET(ff_vk_create_imageview(vkctx, 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(vkctx, 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(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->main_images[i].imageLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;