aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRémi Denis-Courmont <remi@remlab.net>2024-05-01 09:19:46 +0300
committerRémi Denis-Courmont <remi@remlab.net>2024-05-04 10:17:11 +0300
commit38f67a32b3831c8dd0b34db888c16d4a7af9091c (patch)
treed27eda34a32f9bf8b1d39c8ae691ffed17b52ce7
parent5e7180864fd3bda8e37f55181c8bdbc5fc9a1bf1 (diff)
downloadffmpeg-38f67a32b3831c8dd0b34db888c16d4a7af9091c.tar.gz
lavc/ac3dsp: R-V V min_exponents
T-Head C908: ac3_exponent_min_reuse0_c: 7.5 ac3_exponent_min_reuse0_rvv_i32: 7.5 ac3_exponent_min_reuse1_c: 1820.7 ac3_exponent_min_reuse1_rvv_i32: 102.5 ac3_exponent_min_reuse2_c: 3088.5 ac3_exponent_min_reuse2_rvv_i32: 138.7 ac3_exponent_min_reuse3_c: 5073.7 ac3_exponent_min_reuse3_rvv_i32: 174.7 ac3_exponent_min_reuse4_c: 4624.2 ac3_exponent_min_reuse4_rvv_i32: 204.2 ac3_exponent_min_reuse5_c: 5138.7 ac3_exponent_min_reuse5_rvv_i32: 238.0
-rw-r--r--libavcodec/riscv/ac3dsp_init.c4
-rw-r--r--libavcodec/riscv/ac3dsp_rvv.S22
2 files changed, 26 insertions, 0 deletions
diff --git a/libavcodec/riscv/ac3dsp_init.c b/libavcodec/riscv/ac3dsp_init.c
index e120aa2dce..c7c375273d 100644
--- a/libavcodec/riscv/ac3dsp_init.c
+++ b/libavcodec/riscv/ac3dsp_init.c
@@ -26,6 +26,7 @@
#include "libavutil/cpu.h"
#include "libavcodec/ac3dsp.h"
+void ff_ac3_exponent_min_rvv(uint8_t *exp, int, int);
void ff_extract_exponents_rvb(uint8_t *exp, int32_t *coef, int nb_coefs);
void ff_float_to_fixed24_rvv(int32_t *dst, const float *src, size_t len);
void ff_sum_square_butterfly_int32_rvv(int64_t *, const int32_t *,
@@ -38,6 +39,9 @@ av_cold void ff_ac3dsp_init_riscv(AC3DSPContext *c)
#if HAVE_RV
int flags = av_get_cpu_flags();
+ if (flags & AV_CPU_FLAG_RVV_I32)
+ c->ac3_exponent_min = ff_ac3_exponent_min_rvv;
+
if (flags & AV_CPU_FLAG_RVB_ADDR) {
if (flags & AV_CPU_FLAG_RVB_BASIC)
c->extract_exponents = ff_extract_exponents_rvb;
diff --git a/libavcodec/riscv/ac3dsp_rvv.S b/libavcodec/riscv/ac3dsp_rvv.S
index 397e000ab0..1b5f67a9ec 100644
--- a/libavcodec/riscv/ac3dsp_rvv.S
+++ b/libavcodec/riscv/ac3dsp_rvv.S
@@ -21,6 +21,28 @@
#include "config.h"
#include "libavutil/riscv/asm.S"
+func ff_ac3_exponent_min_rvv, zve32x
+ beqz a1, 3f
+1:
+ vsetvli t2, a2, e8, m8, ta, ma
+ vle8.v v8, (a0)
+ addi t0, a0, 256
+ sub a2, a2, t2
+ mv t1, a1
+2:
+ vle8.v v16, (t0)
+ addi t1, t1, -1
+ vminu.vv v8, v8, v16
+ addi t0, t0, 256
+ bnez t1, 2b
+
+ vse8.v v8, (a0)
+ add a0, a0, t2
+ bnez a2, 1b
+3:
+ ret
+endfunc
+
func ff_float_to_fixed24_rvv, zve32f
li t1, 1 << 24
fcvt.s.w f0, t1