This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch master
in repository ffmpeg.

commit 7ee5c907e533d669dd4e39052a61b88232ca705b
Author:     Rémi Denis-Courmont <[email protected]>
AuthorDate: Mon Dec 15 20:40:24 2025 +0200
Commit:     Rémi Denis-Courmont <[email protected]>
CommitDate: Tue Dec 16 17:30:29 2025 +0200

    lavfi/vf_blackdetect: R-V V count_pixels_16
    
    SpacemiT X60:
    blackdetect16_c:                                      7171.0 ( 1.00x)
    blackdetect16_rvv_i32:                                 383.6 (18.69x)
---
 libavfilter/riscv/vf_blackdetect_init.c |  5 +++++
 libavfilter/riscv/vf_blackdetect_rvv.S  | 25 +++++++++++++++++++++++++
 2 files changed, 30 insertions(+)

diff --git a/libavfilter/riscv/vf_blackdetect_init.c 
b/libavfilter/riscv/vf_blackdetect_init.c
index 665603c114..fcf63501e5 100644
--- a/libavfilter/riscv/vf_blackdetect_init.c
+++ b/libavfilter/riscv/vf_blackdetect_init.c
@@ -27,6 +27,9 @@
 unsigned ff_count_pixels_8_rvv(const uint8_t *src, ptrdiff_t stride,
                                ptrdiff_t width, ptrdiff_t height,
                                unsigned threshold);
+unsigned ff_count_pixels_16_rvv(const uint8_t *src, ptrdiff_t stride,
+                                ptrdiff_t width, ptrdiff_t height,
+                                unsigned threshold);
 
 ff_blackdetect_fn ff_blackdetect_get_fn_riscv(int depth)
 {
@@ -36,6 +39,8 @@ ff_blackdetect_fn ff_blackdetect_get_fn_riscv(int depth)
     if (flags & AV_CPU_FLAG_RVV_I32) {
         if (depth <= 8)
             return ff_count_pixels_8_rvv;
+        if ((flags & AV_CPU_FLAG_RVB) && (depth <= 16))
+            return ff_count_pixels_16_rvv;
     }
 #endif
     return NULL;
diff --git a/libavfilter/riscv/vf_blackdetect_rvv.S 
b/libavfilter/riscv/vf_blackdetect_rvv.S
index bd753effc0..89152e1a8d 100644
--- a/libavfilter/riscv/vf_blackdetect_rvv.S
+++ b/libavfilter/riscv/vf_blackdetect_rvv.S
@@ -43,3 +43,28 @@ func ff_count_pixels_8_rvv, zve32x
         mv      a0, a5
         ret
 endfunc
+
+func ff_count_pixels_16_rvv, zve32x, zba
+        lpad    0
+        slli    t2, a2, 1
+        mv      a5, zero
+        sub     a1, a1, t2
+1:
+        mv      t2, a2
+        addi    a3, a3, -1
+2:
+        vsetvli t1, t2, e16, m8, ta, ma
+        vle16.v v8, (a0)
+        sub     t2, t2, t1
+        vmsleu.vx   v0, v8, a4
+        sh1add  a0, t1, a0
+        vcpop.m t3, v0
+        add     a5, t3, a5
+        bnez    t2, 2b
+
+        add     a0, a0, a1
+        bnez    a3, 1b
+
+        mv      a0, a5
+        ret
+endfunc

_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to