aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/riscv/mpegvideoencdsp_rvv.S
diff options
context:
space:
mode:
authorRémi Denis-Courmont <remi@remlab.net>2024-08-09 22:03:49 +0300
committerRémi Denis-Courmont <remi@remlab.net>2024-08-19 22:41:13 +0300
commit0fd37c00d728becba6c49aff9efaf7cae17d46d7 (patch)
tree7a799319d6ccfbceb385d2ee8c054134ab802f1f /libavcodec/riscv/mpegvideoencdsp_rvv.S
parent63d016aea5d9e6e10f68b29d001dd708b29f869f (diff)
downloadffmpeg-0fd37c00d728becba6c49aff9efaf7cae17d46d7.tar.gz
lavc/mpegvideoencdsp: R-V V pix_norm1
T-Head C908: pix_norm1_c: 480.2 pix_norm1_rvv_i64: 146.9 SpacemiT X60: pix_norm1_c: 478.2 pix_norm1_rvv_i64: 92.7
Diffstat (limited to 'libavcodec/riscv/mpegvideoencdsp_rvv.S')
-rw-r--r--libavcodec/riscv/mpegvideoencdsp_rvv.S27
1 files changed, 27 insertions, 0 deletions
diff --git a/libavcodec/riscv/mpegvideoencdsp_rvv.S b/libavcodec/riscv/mpegvideoencdsp_rvv.S
index 83cd919b7c..2f25b00eb2 100644
--- a/libavcodec/riscv/mpegvideoencdsp_rvv.S
+++ b/libavcodec/riscv/mpegvideoencdsp_rvv.S
@@ -44,3 +44,30 @@ func ff_pix_sum_rvv, zve64x, b
zext.h a0, a0
ret
endfunc
+
+func ff_pix_norm1_rvv, zve64x
+ lpad 0
+ li t1, 16
+ vsetvli t0, zero, e32, m8, ta, ma
+ vmv.v.x v16, zero
+ vmv.s.x v1, zero
+1:
+ vsetvli t0, t1, e64, m2, ta, ma
+ vlsseg2e64.v v8, (a0), a1
+ slli t2, t0, 3
+ vsetvli zero, t2, e8, m2, ta, ma
+ vwmulu.vv v24, v8, v8
+ sub t1, t1, t0
+ vwmulu.vv v28, v10, v10
+ mul t3, a1, t0
+ vsetvli zero, zero, e16, m4, tu, ma
+ vwaddu.wv v16, v16, v24
+ add a0, t3, a0
+ vwaddu.wv v16, v16, v28
+ bnez t1, 1b
+
+ vsetvli zero, zero, e32, m8, ta, ma
+ vredsum.vs v1, v16, v1
+ vmv.x.s a0, v1
+ ret
+endfunc