diff --git a/libavcodec/riscv/ac3dsp_init.c b/libavcodec/riscv/ac3dsp_init.c index c7c375273d..8cfa69055a 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_rvb(uint8_t *exp, int, int); 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); @@ -39,6 +40,8 @@ av_cold void ff_ac3dsp_init_riscv(AC3DSPContext *c) #if HAVE_RV int flags = av_get_cpu_flags(); + if (flags & AV_CPU_FLAG_RVB_BASIC) + c->ac3_exponent_min = ff_ac3_exponent_min_rvb; if (flags & AV_CPU_FLAG_RVV_I32) c->ac3_exponent_min = ff_ac3_exponent_min_rvv; diff --git a/libavcodec/riscv/ac3dsp_rvb.S b/libavcodec/riscv/ac3dsp_rvb.S index 48f8bb101e..0ca56466e1 100644 --- a/libavcodec/riscv/ac3dsp_rvb.S +++ b/libavcodec/riscv/ac3dsp_rvb.S @@ -21,6 +21,27 @@ #include "config.h" #include "libavutil/riscv/asm.S" +func ff_ac3_exponent_min_rvb, zbb + beqz a1, 3f +1: + addi a2, a2, -1 + lb t3, (a0) + addi t0, a0, 256 + mv t1, a1 +2: + lb t4, (t0) + addi t1, t1, -1 + addi t0, t0, 256 + minu t3, t3, t4 + bnez t1, 2b + + sb t3, (a0) + addi a0, a0, 1 + bnez a2, 1b +3: + ret +endfunc + func ff_extract_exponents_rvb, zbb 1: lw t0, (a1)