From patchwork Thu Sep 30 08:50:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wu Jianhua X-Patchwork-Id: 30688 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:6506:0:0:0:0:0 with SMTP id z6csp441071iob; Thu, 30 Sep 2021 01:51:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz2UktO4bXJJUNqKp6K9IdvFwcCsRYp79vr2pCKnJt2xql1BAwkgbtquo5n6oBzNhBK7Esb X-Received: by 2002:a50:d802:: with SMTP id o2mr5395115edj.331.1632991883172; Thu, 30 Sep 2021 01:51:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632991883; cv=none; d=google.com; s=arc-20160816; b=XHUkX9NtSeqhbGDh/ju6xY7yiLh5gEB9fSNWPB0eqyXIDdOWP79DcOozAshiu6fzAQ zPdjklzE+LzRIAskpZkzhvSSwzPOcckdmWt3if3dBjNkSl8LLXy9Blw5kLixjaSkXPTQ nxjrPNI0nuicFrGnzeZPUh5WxwgUa9aJunxU0jxTGmgwLyQWuHU0Sm6Bc6Ovg/yYfSvq b94sVZcSAE6L/VQWenPsP8JRZrgAoPGtd29hU6h1SaKue7m6kPGP1pO1hmdEIlSCZ6e0 L3oPxjMUjXrRzSPM7IrLbal/zNhdwR6eeHuXSJ5Pex8ZhZMCmD3MLJ8TTgqS2XspzBKj TDAQ== 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=5LmGoIWB6ei3fRVhDYbfbPC4NjUkhm9ck+ioXBPsvrE=; b=dlydKsLosU9NMHfNUXI7QMIVXA9IstE2ObzAoQfVNK4/7ZYtgGnPFwM96BPmXm/vDw SHXy4E9ihWFYOYgqWo51zjoI8BlJrAyO0TYkjzSBsvMrFkj6y8FEXMsiZqgccvoYFhnW MrY/QVBYS0nKUWZnBkeTL38CVPQVcf0QZ44ZQm/9BaG9oODGghY7c1JJj86FZiDf+ShM JEIZJ9g8LDaqPMF+bYLX6oaa0Ebv5nJw+e1BAG2wZAv0DKvGfWaNhs+xe/5L5LDIjCm7 nGOd4dzwmcuaNAXfkqWEKNeXY1W7xTI4RzRkJL8zTIr2J7szyJ57JxruCzamDdEjeIzY 9xFA== 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 29si2684512eje.659.2021.09.30.01.51.21; Thu, 30 Sep 2021 01:51:23 -0700 (PDT) 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 D621568A7F5; Thu, 30 Sep 2021 11:51:06 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 51C9F68A6CC for ; Thu, 30 Sep 2021 11:50:59 +0300 (EEST) X-IronPort-AV: E=McAfee;i="6200,9189,10122"; a="310684257" X-IronPort-AV: E=Sophos;i="5.85,335,1624345200"; d="scan'208";a="310684257" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Sep 2021 01:50:38 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.85,335,1624345200"; d="scan'208";a="707805084" Received: from otc-skl-e5-server.sh.intel.com ([10.239.43.106]) by fmsmga006.fm.intel.com with ESMTP; 30 Sep 2021 01:50:35 -0700 From: Wu Jianhua To: ffmpeg-devel@ffmpeg.org Date: Thu, 30 Sep 2021 16:50:21 +0800 Message-Id: <20210930085023.58812-2-jianhua.wu@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210930085023.58812-1-jianhua.wu@intel.com> References: <20210930085023.58812-1-jianhua.wu@intel.com> Subject: [FFmpeg-devel] [PATCH v4 2/4] libswscale/x86/rgb2rgb: add shuffle_bytes avx512 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: 7Nv0j7p6Ow3R Performance data(Less is better): shuffle_bytes_avx2 0.94288 shuffle_bytes_avx512 0.60049 Signed-off-by: Wu Jianhua --- libswscale/x86/rgb2rgb.c | 13 +++++++++++++ libswscale/x86/rgb_2_rgb.asm | 8 ++++++++ 2 files changed, 21 insertions(+) diff --git a/libswscale/x86/rgb2rgb.c b/libswscale/x86/rgb2rgb.c index 0ab139aca4..c9ff33ab77 100644 --- a/libswscale/x86/rgb2rgb.c +++ b/libswscale/x86/rgb2rgb.c @@ -152,6 +152,12 @@ void ff_shuffle_bytes_1230_avx2(const uint8_t *src, uint8_t *dst, int src_size); void ff_shuffle_bytes_3012_avx2(const uint8_t *src, uint8_t *dst, int src_size); void ff_shuffle_bytes_3210_avx2(const uint8_t *src, uint8_t *dst, int src_size); +void ff_shuffle_bytes_2103_avx512(const uint8_t *src, uint8_t *dst, int src_size); +void ff_shuffle_bytes_0321_avx512(const uint8_t *src, uint8_t *dst, int src_size); +void ff_shuffle_bytes_1230_avx512(const uint8_t *src, uint8_t *dst, int src_size); +void ff_shuffle_bytes_3012_avx512(const uint8_t *src, uint8_t *dst, int src_size); +void ff_shuffle_bytes_3210_avx512(const uint8_t *src, uint8_t *dst, int src_size); + void ff_uyvytoyuv422_sse2(uint8_t *ydst, uint8_t *udst, uint8_t *vdst, const uint8_t *src, int width, int height, int lumStride, int chromStride, int srcStride); @@ -200,6 +206,13 @@ av_cold void rgb2rgb_init_x86(void) shuffle_bytes_3012 = ff_shuffle_bytes_3012_avx2; shuffle_bytes_3210 = ff_shuffle_bytes_3210_avx2; } + if (EXTERNAL_AVX512(cpu_flags)) { + shuffle_bytes_0321 = ff_shuffle_bytes_0321_avx512; + shuffle_bytes_2103 = ff_shuffle_bytes_2103_avx512; + shuffle_bytes_1230 = ff_shuffle_bytes_1230_avx512; + shuffle_bytes_3012 = ff_shuffle_bytes_3012_avx512; + shuffle_bytes_3210 = ff_shuffle_bytes_3210_avx512; + } if (EXTERNAL_AVX(cpu_flags)) { uyvytoyuv422 = ff_uyvytoyuv422_avx; } diff --git a/libswscale/x86/rgb_2_rgb.asm b/libswscale/x86/rgb_2_rgb.asm index c695c61d5c..3380a1272c 100644 --- a/libswscale/x86/rgb_2_rgb.asm +++ b/libswscale/x86/rgb_2_rgb.asm @@ -168,6 +168,14 @@ SHUFFLE_BYTES 1, 2, 3, 0 SHUFFLE_BYTES 3, 0, 1, 2 SHUFFLE_BYTES 3, 2, 1, 0 %endif +%if HAVE_AVX512_EXTERNAL +INIT_ZMM avx512 +SHUFFLE_BYTES 2, 1, 0, 3 +SHUFFLE_BYTES 0, 3, 2, 1 +SHUFFLE_BYTES 1, 2, 3, 0 +SHUFFLE_BYTES 3, 0, 1, 2 +SHUFFLE_BYTES 3, 2, 1, 0 +%endif %endif ;-----------------------------------------------------------------------------------------------