From patchwork Tue Sep 28 05:34:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wu Jianhua X-Patchwork-Id: 30615 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:6506:0:0:0:0:0 with SMTP id z6csp4860181iob; Mon, 27 Sep 2021 22:34:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzFJ/maIF98+tRQ8UVkyPFlmtJGFxQFB542kMrNLlmNVGjreGxNXiV2YrWmbtkIrJlufK7L X-Received: by 2002:a05:6402:220c:: with SMTP id cq12mr3479620edb.229.1632807281993; Mon, 27 Sep 2021 22:34:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632807281; cv=none; d=google.com; s=arc-20160816; b=Rr8MZ3VaxlkDIbIwCBKkCQfAwb7PtPKtPd+1FAjBeEG+dYiwfQKlvP1DCjg/CkoL/E b3lrrBLiB0Geudvtklc37qmrtzUXH5HrUlKoemI+l48Pl+jZF2xGADUgMi/5b8qj5hvz Xe7j3Yk+Pjpc3nLyvSChzCh6As55QRl7sKJv4QFemKuANnST01MfwUfS35SC6LCx0fIu pCHpNztDH4qo4RMBb2suDpZEu8Qn8LLlNrCQG2KD/6bGg71cofK6/Y5P0yx1LxQQa6cf 0eaXiJYnFmF2aoYSLX+rDaadCN0ZbWrVprwi5yGuSlcBCJmZr7t2R+g6lQZJf4cBRgvP XvNA== 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=ScGaebMz+CJAwJoFs97l+He1of24fRzWXqrFvXgzyeh6JkmnNwJGj+U2SwoVVdqQds GOg6z5WoESSVunIE5csE4BykS9xqthfcX9s4uH7/DZN6qx0yoTGqHzYLufSwWaOayUeP 3oNmysRBe6zF+jJa9eptyR/ubZ0J9OvJ8xKs3oamMpSPa0ibwPynUnBjfhWGl3fBMOxe wvy0rDc8rWWjV012xHQV6w+KS9NCYZ/iQMnldgkmIsej10zUsr5rVR17NyOZtjuyIqfx TaNiBkV8cSYCsLx8l+6zsQFhwPn3cZjxbWHC5LIJZedREg1dqOdtOuaVxW4/QKkcMH6k lsFQ== 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 g21si14225718edb.488.2021.09.27.22.34.41; Mon, 27 Sep 2021 22:34:41 -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 78D2B68A24C; Tue, 28 Sep 2021 08:34:27 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 7E0D868076B for ; Tue, 28 Sep 2021 08:34:20 +0300 (EEST) X-IronPort-AV: E=McAfee;i="6200,9189,10120"; a="224689069" X-IronPort-AV: E=Sophos;i="5.85,328,1624345200"; d="scan'208";a="224689069" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Sep 2021 22:34:16 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.85,328,1624345200"; d="scan'208";a="553794981" Received: from otc-skl-e5-server.sh.intel.com ([10.239.43.106]) by FMSMGA003.fm.intel.com with ESMTP; 27 Sep 2021 22:34:15 -0700 From: Wu Jianhua To: ffmpeg-devel@ffmpeg.org Date: Tue, 28 Sep 2021 13:34:02 +0800 Message-Id: <20210928053404.30714-2-jianhua.wu@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210928053404.30714-1-jianhua.wu@intel.com> References: <20210928053404.30714-1-jianhua.wu@intel.com> Subject: [FFmpeg-devel] [PATCH 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: hEaTndNWDfgU 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 ;-----------------------------------------------------------------------------------------------