[FFmpeg-cvslog] lavc/idctdsp: RISC-V V put_signed_pixels_clamped function

Rémi Denis-Courmont git at videolan.org
Wed Sep 28 12:46:54 EEST 2022


ffmpeg | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Tue Sep 27 23:04:24 2022 +0300| [2746329ce25fb3d30bbf2aab187e90e21ae98064] | committer: Lynne

lavc/idctdsp: RISC-V V put_signed_pixels_clamped function

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

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

diff --git a/libavcodec/riscv/idctdsp_init.c b/libavcodec/riscv/idctdsp_init.c
index 58b8a6c97a..e6e616a555 100644
--- a/libavcodec/riscv/idctdsp_init.c
+++ b/libavcodec/riscv/idctdsp_init.c
@@ -28,6 +28,8 @@
 
 void ff_put_pixels_clamped_rvv(const int16_t *block, uint8_t *pixels,
                                ptrdiff_t stride);
+void ff_put_signed_pixels_clamped_rvv(const int16_t *block, uint8_t *pixels,
+                                      ptrdiff_t stride);
 void ff_add_pixels_clamped_rvv(const int16_t *block, uint8_t *pixels,
                                ptrdiff_t stride);
 
@@ -39,6 +41,7 @@ av_cold void ff_idctdsp_init_riscv(IDCTDSPContext *c, AVCodecContext *avctx,
 
     if ((flags & AV_CPU_FLAG_RVV_I32) && ff_get_rv_vlenb() >= 16) {
         c->put_pixels_clamped = ff_put_pixels_clamped_rvv;
+        c->put_signed_pixels_clamped = ff_put_signed_pixels_clamped_rvv;
         c->add_pixels_clamped = ff_add_pixels_clamped_rvv;
     }
 #endif
diff --git a/libavcodec/riscv/idctdsp_rvv.S b/libavcodec/riscv/idctdsp_rvv.S
index 3b504f5866..f5e1165eee 100644
--- a/libavcodec/riscv/idctdsp_rvv.S
+++ b/libavcodec/riscv/idctdsp_rvv.S
@@ -43,6 +43,27 @@ func ff_put_pixels_clamped_rvv, zve32x
         ret
 endfunc
 
+func ff_put_signed_pixels_clamped_rvv, zve32x
+        vsetivli    zero, 8, e16, m1, ta, ma
+        vlseg8e16.v v24, (a0)
+
+        li          t1, 128
+        vsetivli    zero, 8, e8, mf2, ta, ma
+        vnclip.wi   v16, v24, 0
+        vnclip.wi   v17, v25, 0
+        vnclip.wi   v18, v26, 0
+        vnclip.wi   v19, v27, 0
+        vnclip.wi   v20, v28, 0
+        vnclip.wi   v21, v29, 0
+        vnclip.wi   v22, v30, 0
+        vnclip.wi   v23, v31, 0
+        vsetvli     t0, zero, e8, m8, ta, ma
+        vadd.vx     v16, v16, t1
+        vsetivli    zero, 8, e8, mf2, ta, ma
+        vssseg8e8.v v16, (a1), a2
+        ret
+endfunc
+
 func ff_add_pixels_clamped_rvv, zve32x
         vsetivli    zero, 8, e8, mf2, ta, ma
         vlseg8e16.v v24, (a0)



More information about the ffmpeg-cvslog mailing list