sum64x5_c: 385.0 sum64x5_rvv_f32: 116.0
Showing the changes to libavcodec (5 of 5 files). Show all
Unified · Split
| @@ -1,5 +1,5 @@ | ||
| 1 | −OBJS-$(CONFIG_AAC_DECODER) += riscv/aacpsdsp_init.o | |
| 2 | −RVV-OBJS-$(CONFIG_AAC_DECODER) += riscv/aacpsdsp_rvv.o | |
| 1 | +OBJS-$(CONFIG_AAC_DECODER) += riscv/aacpsdsp_init.o riscv/sbrdsp_init.o | |
| 2 | +RVV-OBJS-$(CONFIG_AAC_DECODER) += riscv/aacpsdsp_rvv.o riscv/sbrdsp_rvv.o | |
| 3 | 3 | OBJS-$(CONFIG_AC3DSP) += riscv/ac3dsp_init.o \ |
| 4 | 4 | riscv/ac3dsp_rvb.o |
| 5 | 5 | OBJS-$(CONFIG_ALAC_DECODER) += riscv/alacdsp_init.o |
| @@ -0,0 +1,37 @@ | ||
| 1 | +/* | |
| 2 | + * Copyright © 2023 Rémi Denis-Courmont. | |
| 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 | +#include "libavutil/attributes.h" | |
| 23 | +#include "libavutil/cpu.h" | |
| 24 | +#include "libavcodec/sbrdsp.h" | |
| 25 | + | |
| 26 | +void ff_sbr_sum64x5_rvv(float *z); | |
| 27 | + | |
| 28 | +av_cold void ff_sbrdsp_init_riscv(SBRDSPContext *c) | |
| 29 | +{ | |
| 30 | +#if HAVE_RVV | |
| 31 | + int flags = av_get_cpu_flags(); | |
| 32 | + | |
| 33 | + if ((flags & AV_CPU_FLAG_RVV_F32) && (flags & AV_CPU_FLAG_RVB_ADDR)) { | |
| 34 | + c->sum64x5 = ff_sbr_sum64x5_rvv; | |
| 35 | + } | |
| 36 | +#endif | |
| 37 | +} | |
| @@ -0,0 +1,50 @@ | ||
| 1 | +/* | |
| 2 | + * Copyright © 2023 Rémi Denis-Courmont. | |
| 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_sbr_sum64x5_rvv, zve32f | |
| 24 | + li a5, 64 | |
| 25 | + addi a1, a0, 64 * 4 | |
| 26 | + addi a2, a0, 128 * 4 | |
| 27 | + addi a3, a0, 192 * 4 | |
| 28 | + addi a4, a0, 256 * 4 | |
| 29 | +1: | |
| 30 | + vsetvli t0, a5, e32, m8, ta, ma | |
| 31 | + sub a5, a5, t0 | |
| 32 | + vle32.v v0, (a0) | |
| 33 | + vle32.v v8, (a1) | |
| 34 | + sh2add a1, t0, a1 | |
| 35 | + vle32.v v16, (a2) | |
| 36 | + vfadd.vv v0, v0, v8 | |
| 37 | + sh2add a2, t0, a2 | |
| 38 | + vle32.v v24, (a3) | |
| 39 | + vfadd.vv v0, v0, v16 | |
| 40 | + sh2add a3, t0, a3 | |
| 41 | + vle32.v v8, (a4) | |
| 42 | + vfadd.vv v0, v0, v24 | |
| 43 | + sh2add a4, t0, a4 | |
| 44 | + vfadd.vv v0, v0, v8 | |
| 45 | + vse32.v v0, (a0) | |
| 46 | + sh2add a0, t0, a0 | |
| 47 | + bnez a5, 1b | |
| 48 | + | |
| 49 | + ret | |
| 50 | +endfunc | |
| @@ -48,6 +48,7 @@ extern const INTFLOAT AAC_RENAME(ff_sbr_noise_table)[][2]; · 47 unmodified lines | ||
| 48 | 48 | void AAC_RENAME(ff_sbrdsp_init)(SBRDSPContext *s); |
| 49 | 49 | void ff_sbrdsp_init_arm(SBRDSPContext *s); |
| 50 | 50 | void ff_sbrdsp_init_aarch64(SBRDSPContext *s); |
| 51 | +void ff_sbrdsp_init_riscv(SBRDSPContext *s); | |
| 51 | 52 | void ff_sbrdsp_init_x86(SBRDSPContext *s); |
| 52 | 53 | void ff_sbrdsp_init_mips(SBRDSPContext *s); |
| 53 | 54 | |
| @@ -98,6 +98,8 @@ av_cold void AAC_RENAME(ff_sbrdsp_init)(SBRDSPContext *s) · 97 unmodified lines | ||
| 98 | 98 | ff_sbrdsp_init_arm(s); |
| 99 | 99 | #elif ARCH_AARCH64 |
| 100 | 100 | ff_sbrdsp_init_aarch64(s); |
| 101 | +#elif ARCH_RISCV | |
| 102 | + ff_sbrdsp_init_riscv(s); | |
| 101 | 103 | #elif ARCH_X86 |
| 102 | 104 | ff_sbrdsp_init_x86(s); |
| 103 | 105 | #elif ARCH_MIPS |