diff options
author | Rémi Denis-Courmont <remi@remlab.net> | 2023-10-29 18:10:07 +0200 |
---|---|---|
committer | Rémi Denis-Courmont <remi@remlab.net> | 2023-11-01 22:53:26 +0200 |
commit | b0aba7dd0c1ee34941370997fd20049150f04a36 (patch) | |
tree | bd126fa727dc7ca1af33e885d1fe5075bfe211d2 /libavcodec | |
parent | 86bee424730bc0dcba0e101773e6f3c71e39bd29 (diff) | |
download | ffmpeg-b0aba7dd0c1ee34941370997fd20049150f04a36.tar.gz |
lavc/sbrdsp: R-V V sum_square
sum_square_c: 803.5
sum_square_rvv_f32: 283.2
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/riscv/sbrdsp_init.c | 2 | ||||
-rw-r--r-- | libavcodec/riscv/sbrdsp_rvv.S | 19 |
2 files changed, 21 insertions, 0 deletions
diff --git a/libavcodec/riscv/sbrdsp_init.c b/libavcodec/riscv/sbrdsp_init.c index 837f24e1e0..e0e62278b0 100644 --- a/libavcodec/riscv/sbrdsp_init.c +++ b/libavcodec/riscv/sbrdsp_init.c @@ -24,6 +24,7 @@ #include "libavcodec/sbrdsp.h" void ff_sbr_sum64x5_rvv(float *z); +float ff_sbr_sum_square_rvv(float (*x)[2], int n); av_cold void ff_sbrdsp_init_riscv(SBRDSPContext *c) { @@ -32,6 +33,7 @@ av_cold void ff_sbrdsp_init_riscv(SBRDSPContext *c) if ((flags & AV_CPU_FLAG_RVV_F32) && (flags & AV_CPU_FLAG_RVB_ADDR)) { c->sum64x5 = ff_sbr_sum64x5_rvv; + c->sum_square = ff_sbr_sum_square_rvv; } #endif } diff --git a/libavcodec/riscv/sbrdsp_rvv.S b/libavcodec/riscv/sbrdsp_rvv.S index e1d548b41b..4684630953 100644 --- a/libavcodec/riscv/sbrdsp_rvv.S +++ b/libavcodec/riscv/sbrdsp_rvv.S @@ -48,3 +48,22 @@ func ff_sbr_sum64x5_rvv, zve32f ret endfunc + +func ff_sbr_sum_square_rvv, zve32f + vsetvli t0, zero, e32, m8, ta, ma + slli a1, a1, 1 + vmv.v.x v8, zero + vmv.s.x v0, zero +1: + vsetvli t0, a1, e32, m8, tu, ma + vle32.v v16, (a0) + sub a1, a1, t0 + vfmacc.vv v8, v16, v16 + sh2add a0, t0, a0 + bnez a1, 1b + + vfredusum.vs v0, v8, v0 + vfmv.f.s fa0, v0 +NOHWF fmv.x.w a0, fa0 + ret +endfunc |