From patchwork Thu Sep 30 01:56:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wu Jianhua X-Patchwork-Id: 30673 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:6506:0:0:0:0:0 with SMTP id z6csp177111iob; Wed, 29 Sep 2021 18:56:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxDbXjUqOzxgb90KUy2uNMcEP+Axb/nPSQgklxrAX49cQWCeYC3tnVlvkRONaiVJC/oGimx X-Received: by 2002:a17:906:ad7:: with SMTP id z23mr3711694ejf.305.1632967002887; Wed, 29 Sep 2021 18:56:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632967002; cv=none; d=google.com; s=arc-20160816; b=AEcRq/Y81vpy9kWso2mUCPyll8JlvqIELwaXimdHFAWwu5OtnoD1pSqYbGwSmRRMAt k2lamT/ylrDqbEEpWeurYPImEEqZhdK7g8JNO2Zv4X2NQ4IJsZorXVuYVCHzuRW72gJz 6jCwY9biLpjr39JSR/P3r6YGT7CcQUcTDhWtgn7kDwEm1Roig6C1R1GElB4i4EA77WH1 f1tVZbI0SuPyz1GHbEprQD7CCx/YED2sp0CEcVQAseKEYrMs/0kyFpQGAPqsjeoUPMPq B7Ytp8NmH3HwBO8CRhJ5zA0qmlsumvJroJsnDi6ozid5bGPzf2taUC9XoPXb7rmXErQi U0Qw== 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=OaVCQcj2RBqB3hWIu+lBgNWrTWOJY5BBExz107hOZ0tcX9x/PTOyVoUpXReZAs1g+0 C9PbOmwdMichkrv2ETKOGQ8COZLbCT0OzpTvl0t4DTKasT0qJNDKW6vZ1lLQSYZVEYqf GmOob1z+dIzoEB212tTR/v53WX9d/aaHhgPoWGNuHvHmaF1Dl5p0m1vPcZvJWVwCSwFt LxeNPQYlRyyLT2RAer+FKxWb7MX9GQviNtlw9iMkjV7hTc36i+Kw1KPNBThpUcNwq1xM 5Lxu87zPhJJI0YVbbjVorFWlH7p1QLwy+Ae3qwOuOGgB1P5M0vCkHgw/W2VtB8MaLCXh hW4Q== 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 f21si1832972ejj.11.2021.09.29.18.56.42; Wed, 29 Sep 2021 18:56:42 -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 AED6668A713; Thu, 30 Sep 2021 04:56:28 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id A8E12680C55 for ; Thu, 30 Sep 2021 04:56:21 +0300 (EEST) X-IronPort-AV: E=McAfee;i="6200,9189,10122"; a="247614445" X-IronPort-AV: E=Sophos;i="5.85,334,1624345200"; d="scan'208";a="247614445" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Sep 2021 18:56:18 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.85,334,1624345200"; d="scan'208";a="563760889" Received: from otc-skl-e5-server.sh.intel.com ([10.239.43.106]) by fmsmga002.fm.intel.com with ESMTP; 29 Sep 2021 18:56:17 -0700 From: Wu Jianhua To: ffmpeg-devel@ffmpeg.org Date: Thu, 30 Sep 2021 09:56:10 +0800 Message-Id: <20210930015612.29608-2-jianhua.wu@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210930015612.29608-1-jianhua.wu@intel.com> References: <20210930015612.29608-1-jianhua.wu@intel.com> Subject: [FFmpeg-devel] [PATCH v2 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: 7MRTbD6k4/rF 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 ;-----------------------------------------------------------------------------------------------