@@ -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;
@@ -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