lavc/mpegvideoencdsp: R-V V add_8x8basis

T-Head C908:
add_8x8basis_c:      440.6
add_8x8basis_rvv_i32: 70.3

SpacemiT X60:
add_8x8basis_c:      436.3
add_8x8basis_rvv_i32: 40.5

Signed-off-by: Paul B Mahol <onemda@gmail.com>
This commit is contained in:
Rémi Denis-Courmont 2024-08-14 20:16:30 +03:00 committed by Paul B Mahol
parent 6840f34d63
commit 0de31b9892
2 changed files with 23 additions and 1 deletions

View File

@ -25,6 +25,7 @@
int ff_try_8x8basis_rvv(const int16_t rem[64], const int16_t weight[64],
const int16_t basis[16], int scale);
void ff_add_8x8basis_rvv(int16_t rem[64], const int16_t basis[16], int scale);
int ff_pix_sum_rvv(const uint8_t *pix, int line_size);
int ff_pix_norm1_rvv(const uint8_t *pix, int line_size);
@ -35,8 +36,10 @@ av_cold void ff_mpegvideoencdsp_init_riscv(MpegvideoEncDSPContext *c,
int flags = av_get_cpu_flags();
if (flags & AV_CPU_FLAG_RVV_I32) {
if (flags & AV_CPU_FLAG_RVB)
if (flags & AV_CPU_FLAG_RVB) {
c->try_8x8basis = ff_try_8x8basis_rvv;
c->add_8x8basis = ff_add_8x8basis_rvv;
}
if (flags & AV_CPU_FLAG_RVV_I64) {
if ((flags & AV_CPU_FLAG_RVB) && ff_rv_vlen_least(128))

View File

@ -55,6 +55,25 @@ func ff_try_8x8basis_rvv, zve32x, b
ret
endfunc
func ff_add_8x8basis_rvv, zve32x, b
li t1, 64
csrwi vxrm, 0
1:
vsetvli t0, t1, e16, m4, ta, ma
vle16.v v4, (a1)
sub t1, t1, t0
vwmul.vx v16, v4, a2
sh1add a1, t0, a1
vle16.v v8, (a0)
vnclip.wi v4, v16, BASIS_SHIFT - RECON_SHIFT
vadd.vv v4, v8, v4
vse16.v v4, (a0)
sh1add a0, t0, a0
bnez t1, 1b
ret
endfunc
func ff_pix_sum_rvv, zve64x, b
lpad 0
vsetivli t0, 16, e16, m1, ta, ma