[FFmpeg-devel] [PATCH 7/7] lavc/pixblockdsp: RISC-V diff_pixels & diff_pixels_unaligned

remi at remlab.net remi at remlab.net
Tue Sep 27 23:04:27 EEST 2022


From: Rémi Denis-Courmont <remi at remlab.net>

---
 libavcodec/riscv/pixblockdsp_init.c |  4 ++++
 libavcodec/riscv/pixblockdsp_rvv.S  | 16 ++++++++++++++++
 2 files changed, 20 insertions(+)

diff --git a/libavcodec/riscv/pixblockdsp_init.c b/libavcodec/riscv/pixblockdsp_init.c
index bbda381c12..aa39a8a665 100644
--- a/libavcodec/riscv/pixblockdsp_init.c
+++ b/libavcodec/riscv/pixblockdsp_init.c
@@ -36,6 +36,8 @@ void ff_get_pixels_8_rvv(int16_t *block, const uint8_t *pixels,
                          ptrdiff_t stride);
 void ff_get_pixels_16_rvv(int16_t *block, const uint8_t *pixels,
                           ptrdiff_t stride);
+void ff_diff_pixels_rvv(int16_t *block, const uint8_t *s1, const uint8_t *s2,
+                        ptrdiff_t stride);
 
 av_cold void ff_pixblockdsp_init_riscv(PixblockDSPContext *c,
                                        AVCodecContext *avctx,
@@ -56,6 +58,8 @@ av_cold void ff_pixblockdsp_init_riscv(PixblockDSPContext *c,
             c->get_pixels_unaligned = c->get_pixels = ff_get_pixels_16_rvv;
         else
             c->get_pixels_unaligned = c->get_pixels = ff_get_pixels_8_rvv;
+
+        c->diff_pixels_unaligned = c->diff_pixels = ff_diff_pixels_rvv;
     }
 #endif
 }
diff --git a/libavcodec/riscv/pixblockdsp_rvv.S b/libavcodec/riscv/pixblockdsp_rvv.S
index 5bf83ebe5e..62cdfe22b1 100644
--- a/libavcodec/riscv/pixblockdsp_rvv.S
+++ b/libavcodec/riscv/pixblockdsp_rvv.S
@@ -42,3 +42,19 @@ func ff_get_pixels_16_rvv, zve32x
         vsseg8e16.v  v0, (a0)
         ret
 endfunc
+
+func ff_diff_pixels_rvv, zve32x
+        vsetivli    zero, 8, e8, mf2, ta, ma
+        vlsseg8e8.v v16, (a1), a3
+        vlsseg8e8.v v24, (a2), a3
+        vwsubu.vv   v8, v16, v24
+        vwsubu.vv   v9, v17, v25
+        vwsubu.vv   v10, v18, v26
+        vwsubu.vv   v11, v19, v27
+        vwsubu.vv   v12, v20, v28
+        vwsubu.vv   v13, v21, v29
+        vwsubu.vv   v14, v22, v30
+        vwsubu.vv   v15, v23, v31
+        vsseg8e16.v v8, (a0)
+        ret
+endfunc
-- 
2.37.2



More information about the ffmpeg-devel mailing list