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
69 ff_blockdsp_init_arm(c);69 ff_blockdsp_init_arm(c);
70#elif ARCH_PPC70#elif ARCH_PPC
71 ff_blockdsp_init_ppc(c);71 ff_blockdsp_init_ppc(c);
72#elif ARCH_RISCV
73 ff_blockdsp_init_riscv(c);
72#elif ARCH_X8674#elif ARCH_X86
73 ff_blockdsp_init_x86(c);75 ff_blockdsp_init_x86(c);
74#elif ARCH_MIPS76#elif ARCH_MIPS
libavcodec/blockdsp.h+1−0
@@ -41,6 +41,7 @@ void ff_blockdsp_init(BlockDSPContext *c); · 40 unmodified lines
41void ff_blockdsp_init_alpha(BlockDSPContext *c);41void ff_blockdsp_init_alpha(BlockDSPContext *c);
42void ff_blockdsp_init_arm(BlockDSPContext *c);42void ff_blockdsp_init_arm(BlockDSPContext *c);
43void ff_blockdsp_init_ppc(BlockDSPContext *c);43void ff_blockdsp_init_ppc(BlockDSPContext *c);
44void ff_blockdsp_init_riscv(BlockDSPContext *c);
44void ff_blockdsp_init_x86(BlockDSPContext *c);45void ff_blockdsp_init_x86(BlockDSPContext *c);
45void ff_blockdsp_init_mips(BlockDSPContext *c);46void ff_blockdsp_init_mips(BlockDSPContext *c);
46 47
libavcodec/riscv/Makefile+2−0
@@ -10,6 +10,8 @@ RVV-OBJS-$(CONFIG_ALAC_DECODER) += riscv/alacdsp_rvv.o · 9 unmodified lines
10OBJS-$(CONFIG_AUDIODSP) += riscv/audiodsp_init.o10OBJS-$(CONFIG_AUDIODSP) += riscv/audiodsp_init.o
11RV-OBJS-$(CONFIG_AUDIODSP) += riscv/audiodsp_rvf.o11RV-OBJS-$(CONFIG_AUDIODSP) += riscv/audiodsp_rvf.o
12RVV-OBJS-$(CONFIG_AUDIODSP) += riscv/audiodsp_rvv.o12RVV-OBJS-$(CONFIG_AUDIODSP) += riscv/audiodsp_rvv.o
13OBJS-$(CONFIG_BLOCKDSP) += riscv/blockdsp_init.o
14RVV-OBJS-$(CONFIG_BLOCKDSP) += riscv/blockdsp_rvv.o
13OBJS-$(CONFIG_BSWAPDSP) += riscv/bswapdsp_init.o15OBJS-$(CONFIG_BSWAPDSP) += riscv/bswapdsp_init.o
14RV-OBJS-$(CONFIG_BSWAPDSP) += riscv/bswapdsp_rvb.o16RV-OBJS-$(CONFIG_BSWAPDSP) += riscv/bswapdsp_rvb.o
15RVV-OBJS-$(CONFIG_BSWAPDSP) += riscv/bswapdsp_rvv.o17RVV-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
28void ff_clear_block_rvv(int16_t *block);
29
30av_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
23func 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
29endfunc

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