From patchwork Wed May 8 16:00:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?R=C3=A9mi_Denis-Courmont?= X-Patchwork-Id: 48674 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:9c8f:b0:1af:cdee:28c5 with SMTP id mj15csp289657pzb; Wed, 8 May 2024 09:01:08 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWo0G7Kh6bUK/363kfhL4L9ouoQkwcxhZjxHXQysGMqt7qV5J9qNlOnnmJYX580dTyfABYHUKGV6fGtPjSujQW/MXxoLMz4XXh6Qg== X-Google-Smtp-Source: AGHT+IHx2SYAECAbbPbZCw6nIy0BFZisgtbeorE32yhYGf7xLeOQCV6IO8eHUK4nSgNgPYG5hKez X-Received: by 2002:a17:907:60e:b0:a59:9eee:837d with SMTP id a640c23a62f3a-a59fb920510mr187247766b.2.1715184068379; Wed, 08 May 2024 09:01:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1715184068; cv=none; d=google.com; s=arc-20160816; b=W6UlxGz21GcL+BZpUzsprx+09A3GrQZNiqTDUP413HuMVp+Vup6RP4JoBCoK2cgkke MKd/ptz+qG57I5vQYDZLK9ZXLHN/ge8hlVrJfLiW7BAR7D43IJ/WeHnSR7hWxJxkmtJQ Q+6jZdZOBO1WH2ob7T10wXBwyde5DU9L3pPyzAWZi0YvPGKqXKGxs2IHR79wx0B0rSeO N2E8ayxMqoQYblanyJbFBo0vSQ5ePxZei1o+q48JMmVE7Hq4A5Qz4moSlb2FfZzPmD6a 6lCA0Pbok1m0NyNlotgGkd5L0Rp1YJQBYQKVNyl0eWoGK8ev8OPIkgmYWOww5KQpd/lv ZH7w== 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 :delivered-to; bh=uyCpbUzvDk8yZluxzUoReMvFOOcQx9W75JG22hMyPuE=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=kjCmd0BYKlmhyvQD/sVTy3evyQR/O4GE0C0GBRWH4DLTSvZbo1RNaK9OFfG3AFsS/H C5S9/ChklAUVHmYEVHU6WDRgG2RwljF+huwzOqHPFyo9j7Q6MD1nDDcC4zqvaA68AItV 2hcHM20jZBl5wUZ6jWdI7m4I7aKqajnfHf2LQ3yyJEuqSjFwRaGI0yJC+O5Tch6LAXe9 Rwr4Vs+eURiMr7LpY506DSnwtz3x2CVNLzIG6GRbYexLMYU3mgGV3tGJPlVVxpshqixR L/LJOydve7elPHFFk83StyXLI7hRoUfkQgqsVai1Uf+BMRXjydT8lvOuk/0SmNbnBNi/ 7oTw==; dara=google.com 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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id hr9-20020a1709073f8900b00a59e3d52035si2251028ejc.175.2024.05.08.09.01.07; Wed, 08 May 2024 09:01:08 -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 Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 8497F68D6CA; Wed, 8 May 2024 19:01:04 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from ursule.remlab.net (vps-a2bccee9.vps.ovh.net [51.75.19.47]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id D2EFE68D61A for ; Wed, 8 May 2024 19:00:57 +0300 (EEST) Received: from basile.remlab.net (localhost [IPv6:::1]) by ursule.remlab.net (Postfix) with ESMTP id 1FF39C016C for ; Wed, 8 May 2024 19:00:57 +0300 (EEST) From: =?utf-8?q?R=C3=A9mi_Denis-Courmont?= To: ffmpeg-devel@ffmpeg.org Date: Wed, 8 May 2024 19:00:54 +0300 Message-ID: <20240508160056.11648-1-remi@remlab.net> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCHv2 1/3] riscv: add Zvbb vector bit manipulation extension 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: mucAJ8F/94Om --- Makefile | 2 +- configure | 3 +++ doc/APIchanges | 3 +++ ffbuild/arch.mak | 1 + libavutil/cpu.c | 1 + libavutil/cpu.h | 1 + libavutil/tests/cpu.c | 1 + tests/checkasm/checkasm.c | 1 + 8 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index de727cbe00..4c3af09fec 100644 --- a/Makefile +++ b/Makefile @@ -101,7 +101,7 @@ SUBDIR_VARS := CLEANFILES FFLIBS HOSTPROGS TESTPROGS TOOLS \ ARMV5TE-OBJS ARMV6-OBJS ARMV8-OBJS VFP-OBJS NEON-OBJS \ ALTIVEC-OBJS VSX-OBJS MMX-OBJS X86ASM-OBJS \ MIPSFPU-OBJS MIPSDSPR2-OBJS MIPSDSP-OBJS MSA-OBJS \ - MMI-OBJS LSX-OBJS LASX-OBJS RV-OBJS RVV-OBJS \ + MMI-OBJS LSX-OBJS LASX-OBJS RV-OBJS RVV-OBJS RVVB-OBJS \ OBJS SLIBOBJS SHLIBOBJS STLIBOBJS HOSTOBJS TESTOBJS define RESET diff --git a/configure b/configure index beb1fa6d3c..2193905a54 100755 --- a/configure +++ b/configure @@ -2222,6 +2222,7 @@ ARCH_EXT_LIST_PPC=" ARCH_EXT_LIST_RISCV=" rv rvv + rv_zvbb " ARCH_EXT_LIST_X86=" @@ -2760,6 +2761,7 @@ power8_deps="vsx" rv_deps="riscv" rvv_deps="rv" +rv_zvbb_deps="rvv" loongson2_deps="mips" loongson3_deps="mips" @@ -6384,6 +6386,7 @@ elif enabled riscv; then enabled rv && check_inline_asm rv '".option arch, +zbb\nrev8 t0, t1"' enabled rvv && check_inline_asm rvv '".option arch, +v\nvsetivli zero, 0, e8, m1, ta, ma"' + enabled rv_zvbb && check_inline_asm rv_zvbb '".option arch, +zvbb\nvclz.v v0, v8"' elif enabled x86; then diff --git a/doc/APIchanges b/doc/APIchanges index 824beec9d3..238d22c135 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -2,6 +2,9 @@ The last version increases of all libraries were on 2024-03-07 API changes, most recent first: +2024-05-10 - xxxxxxxxx - lavu 59.18.100 - cpu.h + Add AV_CPU_FLAG_RV_ZVBB. + 2024-05-04 - xxxxxxxxxx - lavu 59.17.100 - opt.h Add AV_OPT_TYPE_UINT and av_opt_eval_uint(). diff --git a/ffbuild/arch.mak b/ffbuild/arch.mak index 23a3feb090..3fc40e5e5d 100644 --- a/ffbuild/arch.mak +++ b/ffbuild/arch.mak @@ -17,6 +17,7 @@ OBJS-$(HAVE_VSX) += $(VSX-OBJS) $(VSX-OBJS-yes) OBJS-$(HAVE_RV) += $(RV-OBJS) $(RV-OBJS-yes) OBJS-$(HAVE_RVV) += $(RVV-OBJS) $(RVV-OBJS-yes) +OBJS-$(HAVE_RV_ZVBB) += $(RVVB-OBJS) $(RVVB-OBJS-yes) OBJS-$(HAVE_MMX) += $(MMX-OBJS) $(MMX-OBJS-yes) OBJS-$(HAVE_X86ASM) += $(X86ASM-OBJS) $(X86ASM-OBJS-yes) diff --git a/libavutil/cpu.c b/libavutil/cpu.c index d4f947360a..396eeb38d6 100644 --- a/libavutil/cpu.c +++ b/libavutil/cpu.c @@ -192,6 +192,7 @@ int av_parse_cpu_caps(unsigned *flags, const char *s) { "zve64d", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_RVV_F64 }, .unit = "flags" }, { "zba", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_RVB_ADDR }, .unit = "flags" }, { "zbb", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_RVB_BASIC }, .unit = "flags" }, + { "zvbb", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_RV_ZVBB }, .unit = "flags" }, #endif { NULL }, }; diff --git a/libavutil/cpu.h b/libavutil/cpu.h index 8dff341886..cc19828d4b 100644 --- a/libavutil/cpu.h +++ b/libavutil/cpu.h @@ -90,6 +90,7 @@ #define AV_CPU_FLAG_RVV_F64 (1 << 6) ///< Vectors of double's #define AV_CPU_FLAG_RVB_BASIC (1 << 7) ///< Basic bit-manipulations #define AV_CPU_FLAG_RVB_ADDR (1 << 8) ///< Address bit-manipulations +#define AV_CPU_FLAG_RV_ZVBB (1 << 9) ///< Vector basic bit-manipulations /** * Return the flags which specify extensions supported by the CPU. diff --git a/libavutil/tests/cpu.c b/libavutil/tests/cpu.c index d91bfeab5c..10e620963b 100644 --- a/libavutil/tests/cpu.c +++ b/libavutil/tests/cpu.c @@ -94,6 +94,7 @@ static const struct { { AV_CPU_FLAG_RVV_F32, "zve32f" }, { AV_CPU_FLAG_RVV_I64, "zve64x" }, { AV_CPU_FLAG_RVV_F64, "zve64d" }, + { AV_CPU_FLAG_RV_ZVBB, "zvbb" }, #endif { 0 } }; diff --git a/tests/checkasm/checkasm.c b/tests/checkasm/checkasm.c index 9be32fc16e..9a05c1f95e 100644 --- a/tests/checkasm/checkasm.c +++ b/tests/checkasm/checkasm.c @@ -282,6 +282,7 @@ static const struct { { "RVVf32", "rvv_f32", AV_CPU_FLAG_RVV_F32 }, { "RVVi64", "rvv_i64", AV_CPU_FLAG_RVV_I64 }, { "RVVf64", "rvv_f64", AV_CPU_FLAG_RVV_F64 }, + { "RV_Zvbb", "rv_zvbb", AV_CPU_FLAG_RV_ZVBB }, #elif ARCH_MIPS { "MMI", "mmi", AV_CPU_FLAG_MMI }, { "MSA", "msa", AV_CPU_FLAG_MSA }, From patchwork Wed May 8 16:00:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?R=C3=A9mi_Denis-Courmont?= X-Patchwork-Id: 48675 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:9c8f:b0:1af:cdee:28c5 with SMTP id mj15csp289827pzb; Wed, 8 May 2024 09:01:19 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWHiZi6O99d+dRuuhUyZZjMSNvp3O1zCgjlmizMJG3ouELrzlVVKRnsrI1W4DqPu48fUu6OX0e3xzv7PNLgJDHM97362/H/MyOKRQ== X-Google-Smtp-Source: AGHT+IGrZq/dQolNDyejDDG3kw45R49Ovpmi6zTf+G6RwdC7U8fek5R4XXSkdLS+7S4sO4WFG/DZ X-Received: by 2002:a50:cd07:0:b0:56c:d1b:e088 with SMTP id 4fb4d7f45d1cf-5731d9db357mr2073234a12.19.1715184078722; Wed, 08 May 2024 09:01:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1715184078; cv=none; d=google.com; s=arc-20160816; b=CWIgnrkqy7qrswqjQBgH+X82lR7POwXuUuVf12gWGXy8Y1iIb1DdVjb4jgvbjYkBvl K/Bws7nxfCS/Aiu/tSosNJUAZ5+ElkhMhNJSl91kWyhPyneGaDFvz//r9qV6pPMpobLV Tvy0nt+coj3BfBHtc179GjuPBYxuIAb66Trc5uOnczoJU20QAdmby2sufeGAqqjJJt0K sQhYFI2ub+uXOcj8kjdz8dsbiGmXFzJA1wzreyLNl/GNo6ZhjDghmgzXOG/fp6KUf/jy 9u83so2I6oMKBBK671Q2eEXhtNDQ6oM53LXhHMGve4u94JT4Tr1OAD3bdM/5VA21a2SG 7vBA== 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:delivered-to; bh=z8dkY7P4fvvyXQ9Z11mdgw18VpJDpz2Q/KFEwZQgzzw=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=qnsl2qbtspfROCQBh5+N5NjCBtnF8k4x34S7sDgh17wvEoLqfCCIF/4GjuqI9h2fn8 EZBsoexqw1jR7+YO4X09Dh/boQ2O+zEcPF2Od1yBYmKEXUr7gdcu5juHmQAVMal55K1l q3NVW+pNnyl0tvXXLDI1AF2tI2ziVPeQyJb7b8Gaj5vKDBxHv/WS+yAT5r4yUOtfMl0w 98N7d+XUazT6VxwU/eJaRtICq0dq7itDgfws1VhrtunKCtTAGqsvVas9gRA9134vi+5i NTRVQxNTzHtz5n1DLPNB8A0AlGfshrPICJOON5fCI0Ku3G9xtVTBgczvH+wCtTGvNy1y DI+Q==; dara=google.com 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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id b17-20020a50ccd1000000b00572cecc685csi6974980edj.151.2024.05.08.09.01.18; Wed, 08 May 2024 09:01:18 -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 Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 99B8368D6F5; Wed, 8 May 2024 19:01:05 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from ursule.remlab.net (vps-a2bccee9.vps.ovh.net [51.75.19.47]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 0305168D65B for ; Wed, 8 May 2024 19:00:58 +0300 (EEST) Received: from basile.remlab.net (localhost [IPv6:::1]) by ursule.remlab.net (Postfix) with ESMTP id 54003C016E for ; Wed, 8 May 2024 19:00:57 +0300 (EEST) From: =?utf-8?q?R=C3=A9mi_Denis-Courmont?= To: ffmpeg-devel@ffmpeg.org Date: Wed, 8 May 2024 19:00:55 +0300 Message-ID: <20240508160056.11648-2-remi@remlab.net> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240508160056.11648-1-remi@remlab.net> References: <20240508160056.11648-1-remi@remlab.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/3] lavu/riscv: add Zvbb CPU capability detection 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: glu9JUCZsE1d This requires Linux kernel version 6.8 or later. --- libavutil/riscv/cpu.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/libavutil/riscv/cpu.c b/libavutil/riscv/cpu.c index 69d1afe853..3cf4e25bc9 100644 --- a/libavutil/riscv/cpu.c +++ b/libavutil/riscv/cpu.c @@ -54,6 +54,10 @@ int ff_get_cpu_flags_riscv(void) ret |= AV_CPU_FLAG_RVB_ADDR; if (pairs[1].value & RISCV_HWPROBE_EXT_ZBB) ret |= AV_CPU_FLAG_RVB_BASIC; +#ifdef RISCV_HWPROBE_EXT_ZVBB + if (pairs[1].value & RISCV_HWPROBE_EXT_ZVBB) + ret |= AV_CPU_FLAG_RV_ZVBB; +#endif } else #endif #if HAVE_GETAUXVAL @@ -105,6 +109,9 @@ int ff_get_cpu_flags_riscv(void) ret |= AV_CPU_FLAG_RVV_F64; #endif #endif +#endif +#ifdef __riscv_zvbb + ret |= AV_CPU_FLAG_RV_ZVBB; #endif return ret; From patchwork Wed May 8 16:00:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?R=C3=A9mi_Denis-Courmont?= X-Patchwork-Id: 48676 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:9c8f:b0:1af:cdee:28c5 with SMTP id mj15csp289993pzb; Wed, 8 May 2024 09:01:30 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUrYzjxL/fMsHBvh/qt01mwtV7UfcXGma6SmgrzjJ7QJ7okh6+vLAGNzFxgCz0LucUqgh/kgPTfZ3aEfkqa788H8nFjqJNvHAoWyw== X-Google-Smtp-Source: AGHT+IHrfbO7054yYhxOusgTvox2b78vacu0Rd7Li2DSquU4Tb8Z+/H7IlgRkLrzMenX1j9ForV/ X-Received: by 2002:a17:906:1b59:b0:a59:9a40:4086 with SMTP id a640c23a62f3a-a59fb93fdc2mr186391166b.19.1715184089987; Wed, 08 May 2024 09:01:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1715184089; cv=none; d=google.com; s=arc-20160816; b=IGCyIK0Kr504PKuXoFD6qqAHZlwO9Mi71JCq/Ewve8wwRC0T5cmpuXHd0Pg2Fsn2IP wpPZeMJ3F9/0V5JAB5yzQ76BV8yFztJw+7xzyPVVfhE4UjL64xCKK4+c1s8vt/JqOEdR N+GSMh4TOGWKZWTfslDcspf9KU/8hGBXe5G6uM4PuEMt96lEic1P/wBqQ+pX07eAQ5DE fcrjHQFzUQF/SDoUfcBR3JS/k0pl/bWgRNUOsYf+C94p17siUHNpLirBKZQehRzMX519 grytYCtAOtVkrxGycb9LxJc0R0ClAu35eI6KJZUEkSNCupe00rnGzKMp5Yuufyt1dJQY xNcw== 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:delivered-to; bh=txGWgDyUnZZ5QBKHPHYx0DKfT3iHbjhBKt/M2dBla+c=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=TnDTKtnmdfOzFbaE3D3nzDFsPrNvILb+bkf4m0HLba7Y5z0iZNwpC1LYv2q5MJmjAs UcJoeaGZC7SqY5YlosKq1utuTQPsmfsEppjlQA1PLZdJRRUCK0FJ7atq6AM+09TNTiJY 6r41oCbqEkjdd3FYHska79Oxa44/FXRlM0VwwnldypBkefyZlAnfZwuDfnKN/wDIvdmo NeSuIpLP1HTmcKqZL1oy4xTnTyFzF157W4b5BmKON9za+zDCMq7jH7AHqkg6AWDWTJ/T BL546a0MTtyazMkSJL8Plan9R+MhNhxZUuABS4zc7g3VR3Pk0aESmjmzrW0j1JAi/dqf rI4g==; dara=google.com 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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id p9-20020a17090635c900b00a5a014598ccsi757778ejb.202.2024.05.08.09.01.28; Wed, 08 May 2024 09:01:29 -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 Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 01FE968D706; Wed, 8 May 2024 19:01:07 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from ursule.remlab.net (vps-a2bccee9.vps.ovh.net [51.75.19.47]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 0D5A468D6A6 for ; Wed, 8 May 2024 19:00:58 +0300 (EEST) Received: from basile.remlab.net (localhost [IPv6:::1]) by ursule.remlab.net (Postfix) with ESMTP id 84EF8C018C for ; Wed, 8 May 2024 19:00:57 +0300 (EEST) From: =?utf-8?q?R=C3=A9mi_Denis-Courmont?= To: ffmpeg-devel@ffmpeg.org Date: Wed, 8 May 2024 19:00:56 +0300 Message-ID: <20240508160056.11648-3-remi@remlab.net> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240508160056.11648-1-remi@remlab.net> References: <20240508160056.11648-1-remi@remlab.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 3/3] lavc/ac3dsp: add R-V Zvbb extract_exponents 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: vhciAh3iquJZ --- libavcodec/riscv/Makefile | 1 + libavcodec/riscv/ac3dsp_init.c | 5 ++++ libavcodec/riscv/ac3dsp_rvvb.S | 43 ++++++++++++++++++++++++++++++++++ 3 files changed, 49 insertions(+) create mode 100644 libavcodec/riscv/ac3dsp_rvvb.S diff --git a/libavcodec/riscv/Makefile b/libavcodec/riscv/Makefile index 11d47f9a57..bd24f18cb9 100644 --- a/libavcodec/riscv/Makefile +++ b/libavcodec/riscv/Makefile @@ -5,6 +5,7 @@ RVV-OBJS-$(CONFIG_AAC_ENCODER) += riscv/aacencdsp_rvv.o OBJS-$(CONFIG_AC3DSP) += riscv/ac3dsp_init.o RV-OBJS-$(CONFIG_AC3DSP) += riscv/ac3dsp_rvb.o RVV-OBJS-$(CONFIG_AC3DSP) += riscv/ac3dsp_rvv.o +RVVB-OBJS-$(CONFIG_AC3DSP) += riscv/ac3dsp_rvvb.o OBJS-$(CONFIG_ALAC_DECODER) += riscv/alacdsp_init.o RVV-OBJS-$(CONFIG_ALAC_DECODER) += riscv/alacdsp_rvv.o OBJS-$(CONFIG_AUDIODSP) += riscv/audiodsp_init.o diff --git a/libavcodec/riscv/ac3dsp_init.c b/libavcodec/riscv/ac3dsp_init.c index 8cfa69055a..f66b6cac57 100644 --- a/libavcodec/riscv/ac3dsp_init.c +++ b/libavcodec/riscv/ac3dsp_init.c @@ -29,6 +29,7 @@ void ff_ac3_exponent_min_rvb(uint8_t *exp, int, int); void ff_ac3_exponent_min_rvv(uint8_t *exp, int, int); void ff_extract_exponents_rvb(uint8_t *exp, int32_t *coef, int nb_coefs); +void ff_extract_exponents_rvvb(uint8_t *exp, int32_t *coef, int nb_coefs); void ff_float_to_fixed24_rvv(int32_t *dst, const float *src, size_t len); void ff_sum_square_butterfly_int32_rvv(int64_t *, const int32_t *, const int32_t *, int); @@ -48,6 +49,10 @@ av_cold void ff_ac3dsp_init_riscv(AC3DSPContext *c) if (flags & AV_CPU_FLAG_RVB_ADDR) { if (flags & AV_CPU_FLAG_RVB_BASIC) c->extract_exponents = ff_extract_exponents_rvb; +# if HAVE_RV_ZVBB + if (flags & AV_CPU_FLAG_RV_ZVBB) + c->extract_exponents = ff_extract_exponents_rvvb; +# endif if (flags & AV_CPU_FLAG_RVV_F32) { c->float_to_fixed24 = ff_float_to_fixed24_rvv; c->sum_square_butterfly_float = ff_sum_square_butterfly_float_rvv; diff --git a/libavcodec/riscv/ac3dsp_rvvb.S b/libavcodec/riscv/ac3dsp_rvvb.S new file mode 100644 index 0000000000..64766b56be --- /dev/null +++ b/libavcodec/riscv/ac3dsp_rvvb.S @@ -0,0 +1,43 @@ +/* + * Copyright © 2023 Rémi Denis-Courmont. + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "config.h" +#include "libavutil/riscv/asm.S" + +func ff_extract_exponents_rvvb, zve32x, zvbb +1: + vsetvli t0, a2, e32, m8, ta, ma + vle32.v v8, (a1) + sub a2, a2, t0 + vneg.v v16, v8 + sh2add a1, t0, a1 + vmax.vv v8, v8, v16 + vclz.v v8, v8 + vsetvli zero, zero, e16, m4, ta, ma + vncvt.x.x.w v4, v8 + vsetvli zero, zero, e8, m2, ta, ma + vncvt.x.x.w v2, v4 + vadd.vi v2, v2, 24 - 32 + vse8.v v2, (a0) + add a0, a0, t0 + bnez a2, 1b + + ret +endfunc