From patchwork Thu Dec 15 10:49:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Darnley X-Patchwork-Id: 39712 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:bc95:b0:ad:ade2:bfd2 with SMTP id fx21csp470604pzb; Thu, 15 Dec 2022 02:51:26 -0800 (PST) X-Google-Smtp-Source: AA0mqf7UvvC/83rwRmbxyqklx6NWkyULe/7BIuKVDmaGggJwviJPqQAtuEN0E+M2Iais5Rbw0IXX X-Received: by 2002:a17:906:4e9a:b0:7c0:b292:e56b with SMTP id v26-20020a1709064e9a00b007c0b292e56bmr21199301eju.68.1671101485879; Thu, 15 Dec 2022 02:51:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671101485; cv=none; d=google.com; s=arc-20160816; b=pqJw8ZQ0fjWnQDpR2s8jk5VscMjCBRAuYErlsbl7BEM6rJ/ryxPR14LLnrZQGL35VJ AiiPPZ0/7Yc7sOJireQG5h60ig89pzPHtpk/ieVLtvVy4ufPK6jZRON919tTs0JHB91T pumhHkkHPCugjObDsEH/vRkHzhhMMSUuXyK7gZBxn+ptLDcYwCYfMZ5ERpL7AuXkO+5c apCZ7+eJ3XWO2DV/CQ12bkf5HAFgSU03581+3F5q9sGHY8Ql+QHnRQPBlW9CYnXnWcE1 gEaImMvdCZOCHgRJei5rS4d+hjaH4efC+yfIO7iE0zPmPrj8/mXzo0St65YqVoUY59Qf QOOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:message-id:date:to:from :dkim-signature:delivered-to; bh=wJDuKEzq6UvPO+KaNoGrZF/24tz0mXuQvtC9b3u1qXo=; b=rsmJR7yoOWeMoiNdsEfu8t4jNl8y1IfMDsg4zuli+X79MklBzcva6icFpU/zZzItpi gRoAUmFo0m/XsYGJk6BqXmEgnxG1mZzz17qZtaaAj0/NmZZra4jPvPpZcOocmzuAOnKv zzD70odCTF84YoERClt8RZ6GcWDtOUAnlI76TV8qooaTwSnlrjTfgdccTmMGu8ym7X9E sefypUENaDQ1OVKESU7ouZbaM0XXPg/TpaPbcSz9NKniHmTcISSb+Y4j2xRh5FWDUMhV BJLNquEF762rW7xRJSgfMGHcpGGWQD1K1XoQnB4psPTtImT2ohJxRGz99K0zkM8Pg3Xz BGwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@obe-tv.20210112.gappssmtp.com header.s=20210112 header.b=QFQwAxLC; 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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id kf22-20020a17090776d600b007c111fc30absi10043819ejc.865.2022.12.15.02.51.25; Thu, 15 Dec 2022 02:51:25 -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; dkim=neutral (body hash did not verify) header.i=@obe-tv.20210112.gappssmtp.com header.s=20210112 header.b=QFQwAxLC; 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 Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 4972268BA61; Thu, 15 Dec 2022 12:51:22 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr1-f43.google.com (mail-wr1-f43.google.com [209.85.221.43]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id C889068BA61 for ; Thu, 15 Dec 2022 12:51:14 +0200 (EET) Received: by mail-wr1-f43.google.com with SMTP id h12so2584524wrv.10 for ; Thu, 15 Dec 2022 02:51:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=obe-tv.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=/PEwgkX/578fNVw2vaAn4BOMru9w83vX1hqP9jomb4o=; b=QFQwAxLCTk5qaUoAeE+cGJysLjmJ8UGKdjXzsqEmXkBPnr/c3u1YscjZhRCvzYZ9v/ MhJgwq7fH7nxMoBzET0ONiz46Izo+8Wja//kZYJe9YRFNZAkYlD2lF3TtqQwX/Zdhf/7 waM5bMTxc2nzlUQXKpSXwd5PKbiyEge30tZFxxM5tl3LwlB/Y7aE6s2DHdhJq69+IrWD 9WpMzZC0exrtDt5SbTmPjaI8NK+4nwOGTIH5IDrW3yblG76728zulp6dx3M2jkR1vDUV ghxmsNReLYk/GPu82M8oUpjjz6kuamZi5WERCX2HK94HXOnZAPiYqhBoI/UCBGFSbrC+ KIpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=/PEwgkX/578fNVw2vaAn4BOMru9w83vX1hqP9jomb4o=; b=BUl15LaMXC1MUL0MJX/8dG8q/f5FlPAnwOxYMShdR1Mx0hpj0QhW0+7ynMKG9fUqHe LXrXfPPu37ePj3zvbMzLItu9llrq3KkbbjOuiTxsM4HkmIaIZgYXDdMSpgdawnRIw/c3 BN4rMDwq7WwXXWtqfAZkla7rT9h5bluhxw8AhyQMIAcn+WR7V7ojvznnrvyiQWbbQu9Z Y2UOSp5Hp3H0g3/ifvEqkwo1BTTx6+7RRGmc34/kFkHT/jGuhcN/2cxrPCLbFoTBRGv+ 2EbNZ93SMcCsoYuyD6S1N2mrQ5RK7fPYFRRqxoAmOF8+llGYPTmAyXnLKYIdKA4WD/jA y6fA== X-Gm-Message-State: ANoB5pkci+VRulG9UDJrjE3KplyaMKlUUe/se8PuT86NdEpzZAwRGNse dR+QQJ+YZN6M7M/Fm9dns+TOWS6bDOIRfyD1 X-Received: by 2002:a5d:4012:0:b0:242:5878:2923 with SMTP id n18-20020a5d4012000000b0024258782923mr16868391wrp.10.1671101474118; Thu, 15 Dec 2022 02:51:14 -0800 (PST) Received: from Dana.systemlords.lan (d51A44418.access.telenet.be. [81.164.68.24]) by smtp.gmail.com with ESMTPSA id x12-20020a5d650c000000b002415dd45320sm5421977wru.112.2022.12.15.02.51.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Dec 2022 02:51:13 -0800 (PST) From: James Darnley To: ffmpeg-devel@ffmpeg.org Date: Thu, 15 Dec 2022 11:49:03 +0100 Message-Id: <20221215104904.3264109-1-jdarnley@obe.tv> X-Mailer: git-send-email 2.38.0 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 1/2] avcodec/x86/v210: add some comments to the improved avx2 function 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: vA5mUtYLqWbv --- libavcodec/x86/v210.asm | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libavcodec/x86/v210.asm b/libavcodec/x86/v210.asm index 3b9e0761df..600a4ddc5f 100644 --- a/libavcodec/x86/v210.asm +++ b/libavcodec/x86/v210.asm @@ -65,18 +65,18 @@ cglobal v210_planar_unpack_%1, 5, 5, 6 + 2 * cpuflag(avx2), src, y, u, v, w mova m0, [srcq] %endif - pmullw m1, m0, m3 - pslld m0, 12 - psrlw m1, 6 ; yB yA u5 v4 y8 y7 v3 u3 y5 y4 u2 v1 y2 y1 v0 u0 - psrld m0, 22 ; 00 v5 00 y9 00 u4 00 y6 00 v2 00 y3 00 u1 00 y0 + pmullw m1, m0, m3 ; shifts the 1st and 3rd sample of each dword into the high 10 bits of each word + pslld m0, 12 ; shifts the 2nd sample of each dword into the high 10 bits of each dword + psrlw m1, 6 ; shifts the 1st and 3rd samples back into the low 10 bits + psrld m0, 22 ; shifts the 2nd sample back into the low 10 bits of each dword %if cpuflag(avx2) - vpblendd m2, m1, m0, 0x55 ; yB yA 00 y9 y8 y7 00 y6 y5 y4 00 y3 y2 y1 00 y0 + vpblendd m2, m1, m0, 0x55 ; merge the odd dwords from m0 and even from m1 ; yB yA 00 y9 y8 y7 00 y6 y5 y4 00 y3 y2 y1 00 y0 pshufb m2, m4 ; 00 00 yB yA y9 y8 y7 y6 00 00 y5 y4 y3 y2 y1 y0 vpermd m2, m6, m2 ; 00 00 00 00 yB yA y9 y8 y7 y6 y5 y4 y3 y2 y1 y0 movu [yq+2*wq], m2 - vpblendd m1, m1, m0, 0xaa ; 00 v5 u5 v4 00 u4 v3 u3 00 v2 u2 v1 00 u1 v0 u0 + vpblendd m1, m1, m0, 0xaa ; merge the even dwords from m0 and odd from m1 ; 00 v5 u5 v4 00 u4 v3 u3 00 v2 u2 v1 00 u1 v0 u0 pshufb m1, m5 ; 00 v5 v4 v3 00 u5 u4 u3 00 v2 v1 v0 00 u2 u1 u0 vpermq m1, m1, 0xd8 ; 00 v5 v4 v3 00 v2 v1 v0 00 u5 u4 u3 00 u2 u1 u0 pshufb m1, m7 ; 00 00 v5 v4 v3 v2 v1 v0 00 00 u5 u4 u3 u2 u1 u0 From patchwork Thu Dec 15 10:49:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: James Darnley X-Patchwork-Id: 39713 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:bc95:b0:ad:ade2:bfd2 with SMTP id fx21csp470713pzb; Thu, 15 Dec 2022 02:51:34 -0800 (PST) X-Google-Smtp-Source: AA0mqf6rgX8rWXkIhTex9jQnDtSlqy3XOR2cYiLvKuWWNo7Rp41RTxyYckPFJT1iPPAF912DQG+w X-Received: by 2002:a17:907:8e92:b0:7ad:b286:8d48 with SMTP id tx18-20020a1709078e9200b007adb2868d48mr23740329ejc.9.1671101494645; Thu, 15 Dec 2022 02:51:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671101494; cv=none; d=google.com; s=arc-20160816; b=Xm7/qWPIw+AvwQLK8+YZi5LI6IV+WGpaQhmj77gO23IVgRacrxTx5aTsd/bicIEsGq LbLD5fdg+/ovs+NNnEV8QJDC941gG1mzqA38WJVpTj6FvaOe9hRjesmxJsQ1n2ZIZ/ui 4hqf48ygzXQYCY1YAzoYQQSuxnJHaFSSmmgS48jwfjbdw47tR9ujHRkY4JJWSzACRLZZ Sj6/4cltPTCVrB7ybmHRdfI0NqkPeaP1anGWkYC5yurATEGEWco7sH9XTmM59GwW0XKa BhPg+OhgBNnODQmvmbhCG13S8gmQm7yxmG++PBH7Y9Mcenw7xm7PiYq9v45CWzUrWUgB Cf8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:dkim-signature:delivered-to; bh=5gd9JpfkgrsJh2voO8aJMzvrMRcbDdSmaAQIRZja7fw=; b=VfWZxj11v8LRZrZG5iNx7cnfxQQdwRWeo3obES+nxoeCz7tSEjfcjP91Pg4N6p4uox MHLZ4D/oBXbzwOCWkZpvnH3j3mAplJxLiW4XlJfuiPZKuqwwQXIMW9vGmK7DxSSZr5T7 fJl48lNMWvD5oS8iO3FN+MKoI9rfuX7E6mP7YuO3LJi58dwVRR3kHU1SGSQy3ijr8oNM s6li7e9srmnlapDEzd0BfdQ/mmqhEgnaOQHUQLfoIsfgCbrAV5p6OQIJDa2r2lf4faS/ Pjau0kkj9OpJMOCb768d2ere/bUm3K6GuuvrspvxHPzheA3FFXhppXQpVZtnn5Ls/aw1 iOEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@obe-tv.20210112.gappssmtp.com header.s=20210112 header.b=KPwRh8uq; 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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id l25-20020aa7d959000000b0046cf61af9fbsi13062527eds.525.2022.12.15.02.51.34; Thu, 15 Dec 2022 02:51:34 -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; dkim=neutral (body hash did not verify) header.i=@obe-tv.20210112.gappssmtp.com header.s=20210112 header.b=KPwRh8uq; 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 Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 5CC5968BD67; Thu, 15 Dec 2022 12:51:23 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr1-f51.google.com (mail-wr1-f51.google.com [209.85.221.51]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 5F92E68BA61 for ; Thu, 15 Dec 2022 12:51:15 +0200 (EET) Received: by mail-wr1-f51.google.com with SMTP id m14so2593962wrh.7 for ; Thu, 15 Dec 2022 02:51:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=obe-tv.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=zffw5++xV5WLs3QBeeXRLv4tjz6axQ8TbE3K7TqncII=; b=KPwRh8uqS42f6jlF3725sa3bfMZTaKLz4kn28dMF2Z5KtLHbyH6ZcD2OTI5g7tnXJc lv5t4ig4V0INAZWqGs0mBlyDJvfmzIb8nfYdmlS+VW4MINgQohYsXDJCPNUQXC2RuPbG 4WKUK2UVYA8ZOl4TaBV2ZlJ1VR+QSzlrfV1Zpw8RK30081fsD04GEs/81sDrrT5QqmPI Gzg+81VNux7/OTJMuStbBaoFLV93wW2jDD7DpRlwP9covW4sab9dWKmUBQD2P17R/08j ggYA0uurKexdoZumGmHCUxUp5LrUwxAN+SlkeagQRpRG80uWAIFFCtk9QrxE/8WQX1TJ soig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=zffw5++xV5WLs3QBeeXRLv4tjz6axQ8TbE3K7TqncII=; b=j7bP6Qv20ndwDG2Hyr8mIC1iWTTBdAvdFUfaCns93htrR8p8REZccetgsrECV6fHvz EymoBhpomLNDD+onJJlYtvuR7apiSHcjU+yY9mNo+Y9kBHbjr2c0rYHsnl3CAjQmINpM VPIFHED92oilXvJddX8atki/CxsHsLoIyT13pn8UfvU84SEk83EIe9W1A6zVaNEjBhu1 FKZcPM69x58HEV0hC5OhvqkkA0esEtHZz0zDBC7Fj4XP7iFPKEY4lNSfoUi6tiCEfDw9 JKNKrjHyfsVdOZ5sCzpvY4VehXx8YK2iMypc67sE6KXa5dHV5OlN+EQg5xOcDwv5KyeA 6ztw== X-Gm-Message-State: ANoB5pkyLzDeml/5oh4nVnELNVWoUYehHo+/G9MXwh2LJAbp8+p9ceAT u6A/MVEvu+xve8Nq4I3p0n5gGYVD/yNpn7Sd X-Received: by 2002:a5d:550c:0:b0:242:2713:1fb9 with SMTP id b12-20020a5d550c000000b0024227131fb9mr14718434wrv.16.1671101474744; Thu, 15 Dec 2022 02:51:14 -0800 (PST) Received: from Dana.systemlords.lan (d51A44418.access.telenet.be. [81.164.68.24]) by smtp.gmail.com with ESMTPSA id x12-20020a5d650c000000b002415dd45320sm5421977wru.112.2022.12.15.02.51.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Dec 2022 02:51:14 -0800 (PST) From: James Darnley To: ffmpeg-devel@ffmpeg.org Date: Thu, 15 Dec 2022 11:49:04 +0100 Message-Id: <20221215104904.3264109-2-jdarnley@obe.tv> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221215104904.3264109-1-jdarnley@obe.tv> References: <20221215104904.3264109-1-jdarnley@obe.tv> MIME-Version: 1.0 Subject: [FFmpeg-devel] [RFC PATCH 2/2] avcodec/x86: add avx512icl function for v210dec 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: MNdr1MnGa9ca Ice Lake (Xeon Silver 4316): 2.01x faster (1147±36.8 vs. 571±38.2 decicycles) compared with avx2 --- I think I can merge this with the existing macro without it being too ugly. That might allow a plain avx512 version too but I can't say if that would be any faster. libavcodec/x86/v210-init.c | 10 ++++++- libavcodec/x86/v210.asm | 60 +++++++++++++++++++++++++++++++++++++- tests/checkasm/v210dec.c | 12 ++++---- 3 files changed, 74 insertions(+), 8 deletions(-) diff --git a/libavcodec/x86/v210-init.c b/libavcodec/x86/v210-init.c index 5db1fef98c..8b3677b8aa 100644 --- a/libavcodec/x86/v210-init.c +++ b/libavcodec/x86/v210-init.c @@ -17,7 +17,7 @@ */ #include "libavutil/attributes.h" -#include "libavutil/cpu.h" +#include "libavutil/x86/cpu.h" #include "libavcodec/v210dec.h" extern void ff_v210_planar_unpack_unaligned_ssse3(const uint32_t *src, uint16_t *y, uint16_t *u, uint16_t *v, int width); @@ -28,6 +28,8 @@ extern void ff_v210_planar_unpack_aligned_ssse3(const uint32_t *src, uint16_t *y extern void ff_v210_planar_unpack_aligned_avx(const uint32_t *src, uint16_t *y, uint16_t *u, uint16_t *v, int width); extern void ff_v210_planar_unpack_aligned_avx2(const uint32_t *src, uint16_t *y, uint16_t *u, uint16_t *v, int width); +extern void ff_v210_planar_unpack_avx512icl(const uint32_t *src, uint16_t *y, uint16_t *u, uint16_t *v, int width); + av_cold void ff_v210_x86_init(V210DecContext *s) { #if HAVE_X86ASM @@ -42,6 +44,9 @@ av_cold void ff_v210_x86_init(V210DecContext *s) if (HAVE_AVX2_EXTERNAL && cpu_flags & AV_CPU_FLAG_AVX2) s->unpack_frame = ff_v210_planar_unpack_aligned_avx2; + + if (EXTERNAL_AVX512ICL(cpu_flags)) + s->unpack_frame = ff_v210_planar_unpack_avx512icl; } else { if (cpu_flags & AV_CPU_FLAG_SSSE3) @@ -52,6 +57,9 @@ av_cold void ff_v210_x86_init(V210DecContext *s) if (HAVE_AVX2_EXTERNAL && cpu_flags & AV_CPU_FLAG_AVX2) s->unpack_frame = ff_v210_planar_unpack_unaligned_avx2; + + if (EXTERNAL_AVX512ICL(cpu_flags)) + s->unpack_frame = ff_v210_planar_unpack_avx512icl; } #endif } diff --git a/libavcodec/x86/v210.asm b/libavcodec/x86/v210.asm index 600a4ddc5f..f247737ed0 100644 --- a/libavcodec/x86/v210.asm +++ b/libavcodec/x86/v210.asm @@ -22,7 +22,21 @@ %include "libavutil/x86/x86util.asm" -SECTION_RODATA 32 +SECTION_RODATA 64 + +perm_y: + db 0,1, 4,5, 6,7, 8,9, 12,13, 14,15, 16,17, 20,21 + db 22,23, 24,25, 28,29, 30,31, 32,33, 36,37, 38,39, 40,41 + db 44,45, 46,47, 48,49, 52,53, 54,55, 56,57, 60,61, 62,63 +times 16 db 0xff ; align to 64 + +perm_uv: + db 0,1, 4,5, 10,11, 16,17, 20,21, 26,27, 32,33, 36,37 + db 42,43, 48,49, 52,53, 58,59 +times 8 db 0xff ; align to 32 + db 2,3, 8,9, 12,13, 18,19, 24,25, 28,29, 34,35, 40,41 + db 44,45, 50,51, 56,57, 60,61 +times 8 db 0xff ; align to 32 ; for AVX2 version only v210_luma_permute: dd 0,1,2,4,5,6,7,7 ; 32-byte alignment required @@ -34,6 +48,9 @@ v210_mult: dw 64,4,64,4,64,4,64,4 v210_luma_shuf: db 8,9,0,1,2,3,12,13,4,5,6,7,-1,-1,-1,-1 v210_chroma_shuf: db 0,1,8,9,6,7,-1,-1,2,3,4,5,12,13,-1,-1 +shift: times 4 dw 6, 2 +kmask: dw 0x5555, 0xaaaa + SECTION .text %macro v210_planar_unpack 1 @@ -127,3 +144,44 @@ v210_planar_unpack aligned INIT_YMM avx2 v210_planar_unpack aligned %endif + +%if HAVE_AVX512ICL_EXTERNAL + +INIT_ZMM avx512icl + +cglobal v210_planar_unpack, 5, 5, 6, src, y, u, v, w + movsxdifnidn wq, wd + lea yq, [yq+2*wq] + add uq, wq + add vq, wq + neg wq + + kmovw k1, [kmask] ; odd dword mask + kmovw k2, [kmask+2] ; even dword mask + + VBROADCASTI128 m0, [shift] + mova m1, [perm_y] + mova m2, [perm_uv] + + .loop: + movu m3, [srcq] + vpsllvw m4, m3, m0 + pslld m5, m3, 12 + psrlw m4, 6 + psrld m5, 22 + + vpblendmd m3{k1}, m4, m5 + vpermb m3, m1, m3 ; could use vpcompressw + movu [yq+2*wq], m3 + + vpblendmd m5{k2}, m4, m5 + vpermb m5, m2, m5 + movu [uq+wq], ym5 + vextracti32x8 [vq+wq], zm5, 1 + + add srcq, mmsize + add wq, (mmsize*3)/8 + jl .loop +RET + +%endif diff --git a/tests/checkasm/v210dec.c b/tests/checkasm/v210dec.c index 6aef519cc5..93993bae71 100644 --- a/tests/checkasm/v210dec.c +++ b/tests/checkasm/v210dec.c @@ -54,12 +54,12 @@ void checkasm_check_v210dec(void) if (check_func(h.unpack_frame, "v210_unpack")) { uint32_t src0[NUM_SAMPLES/3]; uint32_t src1[NUM_SAMPLES/3]; - uint16_t y0[NUM_SAMPLES/2]; - uint16_t y1[NUM_SAMPLES/2]; - uint16_t u0[NUM_SAMPLES/4]; - uint16_t u1[NUM_SAMPLES/4]; - uint16_t v0[NUM_SAMPLES/4]; - uint16_t v1[NUM_SAMPLES/4]; + uint16_t y0[NUM_SAMPLES/2 + 15]; + uint16_t y1[NUM_SAMPLES/2 + 15]; + uint16_t u0[NUM_SAMPLES/4 + 7]; + uint16_t u1[NUM_SAMPLES/4 + 7]; + uint16_t v0[NUM_SAMPLES/4 + 7]; + uint16_t v1[NUM_SAMPLES/4 + 7]; declare_func(void, const uint32_t *src, uint16_t *y, uint16_t *u, uint16_t *v, int width); const int pixels = NUM_SAMPLES / 2 / 6 * 6;