From 3d39b8d4e7ca43baafa3b4cd5784dd64197dd232 Mon Sep 17 00:00:00 2001 From: sunyuechi Date: Mon, 18 Dec 2023 22:53:39 +0800 Subject: [PATCH] lavc/takdsp: R-V V decorrelate_sm MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit C908: decorrelate_sm_c: 130.0 decorrelate_sm_rvv_i32: 43.2 Signed-off-by: RĂ©mi Denis-Courmont (with minor changes) --- libavcodec/riscv/takdsp_init.c | 2 ++ libavcodec/riscv/takdsp_rvv.S | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/libavcodec/riscv/takdsp_init.c b/libavcodec/riscv/takdsp_init.c index 2d5c974459..4312c8d99d 100644 --- a/libavcodec/riscv/takdsp_init.c +++ b/libavcodec/riscv/takdsp_init.c @@ -27,6 +27,7 @@ void ff_decorrelate_ls_rvv(const int32_t *p1, int32_t *p2, int length); void ff_decorrelate_sr_rvv(int32_t *p1, const int32_t *p2, int length); +void ff_decorrelate_sm_rvv(int32_t *p1, int32_t *p2, int length); av_cold void ff_takdsp_init_riscv(TAKDSPContext *dsp) { @@ -36,6 +37,7 @@ av_cold void ff_takdsp_init_riscv(TAKDSPContext *dsp) if ((flags & AV_CPU_FLAG_RVV_I32) && (flags & AV_CPU_FLAG_RVB_ADDR)) { dsp->decorrelate_ls = ff_decorrelate_ls_rvv; dsp->decorrelate_sr = ff_decorrelate_sr_rvv; + dsp->decorrelate_sm = ff_decorrelate_sm_rvv; } #endif } diff --git a/libavcodec/riscv/takdsp_rvv.S b/libavcodec/riscv/takdsp_rvv.S index 65672cdfb8..b593d9139a 100644 --- a/libavcodec/riscv/takdsp_rvv.S +++ b/libavcodec/riscv/takdsp_rvv.S @@ -47,3 +47,21 @@ func ff_decorrelate_sr_rvv, zve32x bnez a2, 1b ret endfunc + +func ff_decorrelate_sm_rvv, zve32x +1: + vsetvli t0, a2, e32, m8, ta, ma + vle32.v v8, (a1) + sub a2, a2, t0 + vle32.v v0, (a0) + vsra.vi v16, v8, 1 + vsub.vv v0, v0, v16 + vse32.v v0, (a0) + sh2add a0, t0, a0 + vadd.vv v8, v0, v8 + vse32.v v8, (a1) + sh2add a1, t0, a1 + bnez a2, 1b + + ret +endfunc