This is now firmly slower than C. SiFive-U74 (cycles): audiodsp.vector_clipf_c: 31.2 audiodsp.vector_clipf_rvf: 39.5
Unified · Split
| @@ -9,7 +9,6 @@ RVVB-OBJS-$(CONFIG_AC3DSP) += riscv/ac3dsp_rvvb.o · 8 unmodified lines | ||
| 9 | 9 | OBJS-$(CONFIG_ALAC_DECODER) += riscv/alacdsp_init.o |
| 10 | 10 | RVV-OBJS-$(CONFIG_ALAC_DECODER) += riscv/alacdsp_rvv.o |
| 11 | 11 | OBJS-$(CONFIG_AUDIODSP) += riscv/audiodsp_init.o |
| 12 | −RV-OBJS-$(CONFIG_AUDIODSP) += riscv/audiodsp_rvf.o | |
| 13 | 12 | RVV-OBJS-$(CONFIG_AUDIODSP) += riscv/audiodsp_rvv.o |
| 14 | 13 | OBJS-$(CONFIG_BLOCKDSP) += riscv/blockdsp_init.o |
| 15 | 14 | RVV-OBJS-$(CONFIG_BLOCKDSP) += riscv/blockdsp_rvv.o |
| @@ -24,8 +24,6 @@ · 23 unmodified lines | ||
| 24 | 24 | #include "libavutil/cpu.h" |
| 25 | 25 | #include "libavcodec/audiodsp.h" |
| 26 | 26 | |
| 27 | −void ff_vector_clipf_rvf(float *dst, const float *src, int len, float min, float max); | |
| 28 | − | |
| 29 | 27 | int32_t ff_scalarproduct_int16_rvv(const int16_t *v1, const int16_t *v2, int len); |
| 30 | 28 | void ff_vector_clip_int32_rvv(int32_t *dst, const int32_t *src, int32_t min, |
| 31 | 29 | int32_t max, unsigned int len); |
| @@ -33,12 +31,9 @@ void ff_vector_clipf_rvv(float *dst, const float *src, int len, float min, float · 1 unmodified line | ||
| 33 | 31 | |
| 34 | 32 | av_cold void ff_audiodsp_init_riscv(AudioDSPContext *c) |
| 35 | 33 | { |
| 36 | −#if HAVE_RV | |
| 34 | +#if HAVE_RVV | |
| 37 | 35 | int flags = av_get_cpu_flags(); |
| 38 | 36 | |
| 39 | − if (flags & AV_CPU_FLAG_RVF) | |
| 40 | − c->vector_clipf = ff_vector_clipf_rvf; | |
| 41 | −#if HAVE_RVV | |
| 42 | 37 | if (flags & AV_CPU_FLAG_RVB_ADDR) { |
| 43 | 38 | if (flags & AV_CPU_FLAG_RVV_I32) { |
| 44 | 39 | c->scalarproduct_int16 = ff_scalarproduct_int16_rvv; |
| @@ -48,5 +43,4 @@ av_cold void ff_audiodsp_init_riscv(AudioDSPContext *c) · 3 unmodified lines | ||
| 48 | 43 | c->vector_clipf = ff_vector_clipf_rvv; |
| 49 | 44 | } |
| 50 | 45 | #endif |
| 51 | −#endif | |
| 52 | 46 | } |
| @@ -1,50 +0,0 @@ | ||
| 1 | −/* | |
| 2 | − * Copyright © 2022 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_vector_clipf_rvf, f | |
| 24 | − lpad 0 | |
| 25 | −NOHWF fmv.w.x fa0, a3 | |
| 26 | −NOHWF fmv.w.x fa1, a4 | |
| 27 | −1: | |
| 28 | − flw ft0, (a1) | |
| 29 | − flw ft1, 4(a1) | |
| 30 | − fmax.s ft0, ft0, fa0 | |
| 31 | − flw ft2, 8(a1) | |
| 32 | − fmax.s ft1, ft1, fa0 | |
| 33 | − flw ft3, 12(a1) | |
| 34 | − fmax.s ft2, ft2, fa0 | |
| 35 | − addi a2, a2, -4 | |
| 36 | − fmax.s ft3, ft3, fa0 | |
| 37 | − addi a1, a1, 16 | |
| 38 | − fmin.s ft0, ft0, fa1 | |
| 39 | − fmin.s ft1, ft1, fa1 | |
| 40 | − fsw ft0, (a0) | |
| 41 | − fmin.s ft2, ft2, fa1 | |
| 42 | − fsw ft1, 4(a0) | |
| 43 | − fmin.s ft3, ft3, fa1 | |
| 44 | − fsw ft2, 8(a0) | |
| 45 | − fsw ft3, 12(a0) | |
| 46 | − addi a0, a0, 16 | |
| 47 | − bnez a2, 1b | |
| 48 | − | |
| 49 | − ret | |
| 50 | −endfunc | |