* [FFmpeg-devel] [PATCH 1/2] lavc/blockdsp: R-V V clear_block
@ 2024-02-01 8:42 flow gg
0 siblings, 0 replies; only message in thread
From: flow gg @ 2024-02-01 8:42 UTC (permalink / raw)
To: FFmpeg development discussions and patches
[-- Attachment #1: Type: text/plain, Size: 1 bytes --]
[-- Attachment #2: 0001-lavc-blockdsp-R-V-V-clear_block.patch --]
[-- Type: text/x-patch, Size: 5039 bytes --]
From d545f5ccc1c5923cb38c25b18ca750ef0ee529f4 Mon Sep 17 00:00:00 2001
From: sunyuechi <sunyuechi@iscas.ac.cn>
Date: Thu, 1 Feb 2024 15:12:49 +0800
Subject: [PATCH 1/2] lavc/blockdsp: R-V V clear_block
C908:
blockdsp.clear_block_c: 47.2
blockdsp.clear_block_rvv_i64: 28.5
---
libavcodec/blockdsp.c | 2 ++
libavcodec/blockdsp.h | 1 +
libavcodec/riscv/Makefile | 2 ++
libavcodec/riscv/blockdsp_init.c | 39 ++++++++++++++++++++++++++++++++
libavcodec/riscv/blockdsp_rvv.S | 29 ++++++++++++++++++++++++
5 files changed, 73 insertions(+)
create mode 100644 libavcodec/riscv/blockdsp_init.c
create mode 100644 libavcodec/riscv/blockdsp_rvv.S
diff --git a/libavcodec/blockdsp.c b/libavcodec/blockdsp.c
index 98f06c5d16..79a8814262 100644
--- a/libavcodec/blockdsp.c
+++ b/libavcodec/blockdsp.c
@@ -69,6 +69,8 @@ av_cold void ff_blockdsp_init(BlockDSPContext *c)
ff_blockdsp_init_arm(c);
#elif ARCH_PPC
ff_blockdsp_init_ppc(c);
+#elif ARCH_RISCV
+ ff_blockdsp_init_riscv(c);
#elif ARCH_X86
ff_blockdsp_init_x86(c);
#elif ARCH_MIPS
diff --git a/libavcodec/blockdsp.h b/libavcodec/blockdsp.h
index d853adada2..6d751d797b 100644
--- a/libavcodec/blockdsp.h
+++ b/libavcodec/blockdsp.h
@@ -41,6 +41,7 @@ void ff_blockdsp_init(BlockDSPContext *c);
void ff_blockdsp_init_alpha(BlockDSPContext *c);
void ff_blockdsp_init_arm(BlockDSPContext *c);
void ff_blockdsp_init_ppc(BlockDSPContext *c);
+void ff_blockdsp_init_riscv(BlockDSPContext *c);
void ff_blockdsp_init_x86(BlockDSPContext *c);
void ff_blockdsp_init_mips(BlockDSPContext *c);
diff --git a/libavcodec/riscv/Makefile b/libavcodec/riscv/Makefile
index ffe6631cf2..579a716487 100644
--- a/libavcodec/riscv/Makefile
+++ b/libavcodec/riscv/Makefile
@@ -10,6 +10,8 @@ RVV-OBJS-$(CONFIG_ALAC_DECODER) += riscv/alacdsp_rvv.o
OBJS-$(CONFIG_AUDIODSP) += riscv/audiodsp_init.o
RV-OBJS-$(CONFIG_AUDIODSP) += riscv/audiodsp_rvf.o
RVV-OBJS-$(CONFIG_AUDIODSP) += riscv/audiodsp_rvv.o
+OBJS-$(CONFIG_BLOCKDSP) += riscv/blockdsp_init.o
+RVV-OBJS-$(CONFIG_BLOCKDSP) += riscv/blockdsp_rvv.o
OBJS-$(CONFIG_BSWAPDSP) += riscv/bswapdsp_init.o
RV-OBJS-$(CONFIG_BSWAPDSP) += riscv/bswapdsp_rvb.o
RVV-OBJS-$(CONFIG_BSWAPDSP) += riscv/bswapdsp_rvv.o
diff --git a/libavcodec/riscv/blockdsp_init.c b/libavcodec/riscv/blockdsp_init.c
new file mode 100644
index 0000000000..5370418687
--- /dev/null
+++ b/libavcodec/riscv/blockdsp_init.c
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2024 Institue of Software Chinese Academy of Sciences (ISCAS).
+ *
+ * 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/attributes.h"
+#include "libavutil/cpu.h"
+#include "libavutil/riscv/cpu.h"
+#include "libavcodec/blockdsp.h"
+
+void ff_clear_block_rvv(int16_t *block);
+
+av_cold void ff_blockdsp_init_riscv(BlockDSPContext *c)
+{
+#if HAVE_RVV
+ int flags = av_get_cpu_flags();
+
+ if (flags & AV_CPU_FLAG_RVV_I64 && ff_get_rv_vlenb() >= 16) {
+ c->clear_block = ff_clear_block_rvv;
+ }
+#endif
+}
diff --git a/libavcodec/riscv/blockdsp_rvv.S b/libavcodec/riscv/blockdsp_rvv.S
new file mode 100644
index 0000000000..e85697613a
--- /dev/null
+++ b/libavcodec/riscv/blockdsp_rvv.S
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2024 Institue of Software Chinese Academy of Sciences (ISCAS).
+ *
+ * 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 "libavutil/riscv/asm.S"
+
+func ff_clear_block_rvv, zve64x
+ vsetivli zero, 16, e64, m8, ta, ma
+ vmv.v.i v0, 0
+ vse64.v v0, (a0)
+
+ ret
+endfunc
--
2.43.0
[-- Attachment #3: Type: text/plain, Size: 251 bytes --]
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2024-02-01 8:43 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-01 8:42 [FFmpeg-devel] [PATCH 1/2] lavc/blockdsp: R-V V clear_block flow gg
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git