[FFmpeg-cvslog] lavc/ac3dsp: R-V Zbb ac3_exponent_min

Rémi Denis-Courmont git at videolan.org
Mon May 6 22:12:45 EEST 2024


ffmpeg | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Fri May  3 20:56:34 2024 +0300| [9e77188cba63920f51801fbbc1f7be4a995def7a] | committer: Rémi Denis-Courmont

lavc/ac3dsp: R-V Zbb ac3_exponent_min

SiFive U74:
ac3_exponent_min_reuse0_c:       10.0
ac3_exponent_min_reuse0_rvb_b:    8.0
ac3_exponent_min_reuse1_c:     2924.7
ac3_exponent_min_reuse1_rvb_b: 1803.0
ac3_exponent_min_reuse2_c:     5043.0
ac3_exponent_min_reuse2_rvb_b: 2827.5
ac3_exponent_min_reuse3_c:     7028.7
ac3_exponent_min_reuse3_rvb_b: 3872.0
ac3_exponent_min_reuse4_c:     8824.2
ac3_exponent_min_reuse4_rvb_b: 5122.2
ac3_exponent_min_reuse5_c:    10487.5
ac3_exponent_min_reuse5_rvb_b: 6412.2

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9e77188cba63920f51801fbbc1f7be4a995def7a
---

 libavcodec/riscv/ac3dsp_init.c |  3 +++
 libavcodec/riscv/ac3dsp_rvb.S  | 21 +++++++++++++++++++++
 2 files changed, 24 insertions(+)

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)



More information about the ffmpeg-cvslog mailing list