C908: blockdsp.clear_block_c: 47.2 blockdsp.clear_block_rvv_i64: 28.5
Unified · Split
| @@ -69,6 +69,8 @@ av_cold void ff_blockdsp_init(BlockDSPContext *c) · 68 unmodified lines | ||
| 69 | 69 | ff_blockdsp_init_arm(c); |
| 70 | 70 | #elif ARCH_PPC |
| 71 | 71 | ff_blockdsp_init_ppc(c); |
| 72 | +#elif ARCH_RISCV | |
| 73 | + ff_blockdsp_init_riscv(c); | |
| 72 | 74 | #elif ARCH_X86 |
| 73 | 75 | ff_blockdsp_init_x86(c); |
| 74 | 76 | #elif ARCH_MIPS |
| @@ -41,6 +41,7 @@ void ff_blockdsp_init(BlockDSPContext *c); · 40 unmodified lines | ||
| 41 | 41 | void ff_blockdsp_init_alpha(BlockDSPContext *c); |
| 42 | 42 | void ff_blockdsp_init_arm(BlockDSPContext *c); |
| 43 | 43 | void ff_blockdsp_init_ppc(BlockDSPContext *c); |
| 44 | +void ff_blockdsp_init_riscv(BlockDSPContext *c); | |
| 44 | 45 | void ff_blockdsp_init_x86(BlockDSPContext *c); |
| 45 | 46 | void ff_blockdsp_init_mips(BlockDSPContext *c); |
| 46 | 47 | |
| @@ -10,6 +10,8 @@ RVV-OBJS-$(CONFIG_ALAC_DECODER) += riscv/alacdsp_rvv.o · 9 unmodified lines | ||
| 10 | 10 | OBJS-$(CONFIG_AUDIODSP) += riscv/audiodsp_init.o |
| 11 | 11 | RV-OBJS-$(CONFIG_AUDIODSP) += riscv/audiodsp_rvf.o |
| 12 | 12 | 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 | |
| 13 | 15 | OBJS-$(CONFIG_BSWAPDSP) += riscv/bswapdsp_init.o |
| 14 | 16 | RV-OBJS-$(CONFIG_BSWAPDSP) += riscv/bswapdsp_rvb.o |
| 15 | 17 | RVV-OBJS-$(CONFIG_BSWAPDSP) += riscv/bswapdsp_rvv.o |
| @@ -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 | +} | |
| @@ -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 | |