mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2026-01-12 00:06:51 +08:00
lavfi/vf_blackdetect: R-V V count_pixels_16
SpacemiT X60: blackdetect16_c: 7171.0 ( 1.00x) blackdetect16_rvv_i32: 383.6 (18.69x)
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user