History

lavc/blockdsp: R-V V clear_block

C908: blockdsp.clear_block_c: 47.2 blockdsp.clear_block_rvv_i64: 28.5

sunyuechi committed 2 years ago

Commit 0748d2b1 parent 7bf1b9b5 files · +73 −0Browse files

Unified · Split

5 files
  1. libavcodec/blockdsp.c +2 −0
  2. libavcodec/blockdsp.h +1 −0
  3. libavcodec/riscv/Makefile +2 −0
  4. libavcodec/riscv/blockdsp_init.c +39 −0
  5. libavcodec/riscv/blockdsp_rvv.S +29 −0
libavcodec/blockdsp.c+2−0
@@ -69,6 +69,8 @@ av_cold void ff_blockdsp_init(BlockDSPContext *c) · 68 unmodified lines
6969 ff_blockdsp_init_arm(c);
7070 #elif ARCH_PPC
7171 ff_blockdsp_init_ppc(c);
72+#elif ARCH_RISCV
73+ ff_blockdsp_init_riscv(c);
7274 #elif ARCH_X86
7375 ff_blockdsp_init_x86(c);
7476 #elif ARCH_MIPS
libavcodec/blockdsp.h+1−0
@@ -41,6 +41,7 @@ void ff_blockdsp_init(BlockDSPContext *c); · 40 unmodified lines
4141 void ff_blockdsp_init_alpha(BlockDSPContext *c);
4242 void ff_blockdsp_init_arm(BlockDSPContext *c);
4343 void ff_blockdsp_init_ppc(BlockDSPContext *c);
44+void ff_blockdsp_init_riscv(BlockDSPContext *c);
4445 void ff_blockdsp_init_x86(BlockDSPContext *c);
4546 void ff_blockdsp_init_mips(BlockDSPContext *c);
4647
libavcodec/riscv/Makefile+2−0
@@ -10,6 +10,8 @@ RVV-OBJS-$(CONFIG_ALAC_DECODER) += riscv/alacdsp_rvv.o · 9 unmodified lines
1010 OBJS-$(CONFIG_AUDIODSP) += riscv/audiodsp_init.o
1111 RV-OBJS-$(CONFIG_AUDIODSP) += riscv/audiodsp_rvf.o
1212 RVV-OBJS-$(CONFIG_AUDIODSP) += riscv/audiodsp_rvv.o
13+OBJS-$(CONFIG_BLOCKDSP) += riscv/blockdsp_init.o
14+RVV-OBJS-$(CONFIG_BLOCKDSP) += riscv/blockdsp_rvv.o
1315 OBJS-$(CONFIG_BSWAPDSP) += riscv/bswapdsp_init.o
1416 RV-OBJS-$(CONFIG_BSWAPDSP) += riscv/bswapdsp_rvb.o
1517 RVV-OBJS-$(CONFIG_BSWAPDSP) += riscv/bswapdsp_rvv.o
libavcodec/riscv/blockdsp_init.c+39−0
@@ -0,0 +1,39 @@
1+/*
2+ * Copyright (c) 2024 Institue of Software Chinese Academy of Sciences (ISCAS).
3+ *
4+ * This file is part of FFmpeg.
5+ *
6+ * FFmpeg is free software; you can redistribute it and/or
7+ * modify it under the terms of the GNU Lesser General Public
8+ * License as published by the Free Software Foundation; either
9+ * version 2.1 of the License, or (at your option) any later version.
10+ *
11+ * FFmpeg is distributed in the hope that it will be useful,
12+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14+ * Lesser General Public License for more details.
15+ *
16+ * You should have received a copy of the GNU Lesser General Public
17+ * License along with FFmpeg; if not, write to the Free Software
18+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19+ */
20+
21+#include "config.h"
22+
23+#include "libavutil/attributes.h"
24+#include "libavutil/cpu.h"
25+#include "libavutil/riscv/cpu.h"
26+#include "libavcodec/blockdsp.h"
27+
28+void ff_clear_block_rvv(int16_t *block);
29+
30+av_cold void ff_blockdsp_init_riscv(BlockDSPContext *c)
31+{
32+#if HAVE_RVV
33+ int flags = av_get_cpu_flags();
34+
35+ if (flags & AV_CPU_FLAG_RVV_I64 && ff_get_rv_vlenb() >= 16) {
36+ c->clear_block = ff_clear_block_rvv;
37+ }
38+#endif
39+}
libavcodec/riscv/blockdsp_rvv.S+29−0
@@ -0,0 +1,29 @@
1+/*
2+ * Copyright (c) 2024 Institue of Software Chinese Academy of Sciences (ISCAS).
3+ *
4+ * This file is part of FFmpeg.
5+ *
6+ * FFmpeg is free software; you can redistribute it and/or
7+ * modify it under the terms of the GNU Lesser General Public
8+ * License as published by the Free Software Foundation; either
9+ * version 2.1 of the License, or (at your option) any later version.
10+ *
11+ * FFmpeg is distributed in the hope that it will be useful,
12+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14+ * Lesser General Public License for more details.
15+ *
16+ * You should have received a copy of the GNU Lesser General Public
17+ * License along with FFmpeg; if not, write to the Free Software
18+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19+ */
20+
21+#include "libavutil/riscv/asm.S"
22+
23+func ff_clear_block_rvv, zve64x
24+ vsetivli zero, 16, e64, m8, ta, ma
25+ vmv.v.i v0, 0
26+ vse64.v v0, (a0)
27+
28+ ret
29+endfunc

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t