aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/riscv
diff options
context:
space:
mode:
authorRémi Denis-Courmont <remi@remlab.net>2024-07-28 21:40:52 +0300
committerRémi Denis-Courmont <remi@remlab.net>2024-08-01 18:43:04 +0300
commit54ae270213b5a98f923bfd4506e450b2e764ede2 (patch)
treea45efa58ced295e4a53f37839259ff9f4e1adda9 /libavcodec/riscv
parent952b426f3bcc6206eff2fa338ff7da475a28692b (diff)
downloadffmpeg-54ae270213b5a98f923bfd4506e450b2e764ede2.tar.gz
lavc/rv34dsp: use saturating add/sub for R-V V DC add
T-Head C908 (cycles): rv34_idct_dc_add_c: 113.2 rv34_idct_dc_add_rvv_i32: 48.5 (before) rv34_idct_dc_add_rvv_i32: 39.5 (after)
Diffstat (limited to 'libavcodec/riscv')
-rw-r--r--libavcodec/riscv/rv34dsp_rvv.S19
1 files changed, 11 insertions, 8 deletions
diff --git a/libavcodec/riscv/rv34dsp_rvv.S b/libavcodec/riscv/rv34dsp_rvv.S
index 478bc0a860..fc0ffec4fe 100644
--- a/libavcodec/riscv/rv34dsp_rvv.S
+++ b/libavcodec/riscv/rv34dsp_rvv.S
@@ -41,14 +41,17 @@ func ff_rv34_idct_dc_add_rvv, zve32x
mul t1, t1, a2
addi t1, t1, 512
srai t1, t1, 10
- vsetivli zero, 4*4, e16, m2, ta, ma
- vzext.vf2 v2, v0
- vadd.vx v2, v2, t1
- vmax.vx v2, v2, zero
- vsetvli zero, zero, e8, m1, ta, ma
- vnclipu.wi v0, v2, 0
- vsetivli zero, 4, e8, mf4, ta, ma
- vsse32.v v0, (a0), a1
+ vsetivli zero, 4*4, e8, m2, ta, ma
+ bgez t1, 1f
+ neg t1, t1
+ vssubu.vx v0, v0, t1
+ vsetivli zero, 4, e8, mf4, ta, ma
+ vsse32.v v0, (a0), a1
+ ret
+1:
+ vsaddu.vx v0, v0, t1
+ vsetivli zero, 4, e8, mf4, ta, ma
+ vsse32.v v0, (a0), a1
ret
endfunc