lavc/bswapdsp: RISC-V V bswap16_buf

This commit is contained in:
Rémi Denis-Courmont 2022-10-02 14:55:01 +03:00 committed by Lynne
parent d7528af4df
commit 2abafd7307
2 changed files with 21 additions and 1 deletions

View File

@ -27,6 +27,7 @@
void ff_bswap32_buf_rvb(uint32_t *dst, const uint32_t *src, int len);
void ff_bswap32_buf_rvv(uint32_t *dst, const uint32_t *src, int len);
void ff_bswap16_buf_rvv(uint16_t *dst, const uint16_t *src, int len);
av_cold void ff_bswapdsp_init_riscv(BswapDSPContext *c)
{
@ -37,7 +38,9 @@ av_cold void ff_bswapdsp_init_riscv(BswapDSPContext *c)
c->bswap_buf = ff_bswap32_buf_rvb;
#endif
#if HAVE_RVV
if (cpu_flags & AV_CPU_FLAG_RVV_I32)
if (cpu_flags & AV_CPU_FLAG_RVV_I32) {
c->bswap_buf = ff_bswap32_buf_rvv;
c->bswap16_buf = ff_bswap16_buf_rvv;
}
#endif
}

View File

@ -43,3 +43,20 @@ func ff_bswap32_buf_rvv, zve32x
ret
endfunc
func ff_bswap16_buf_rvv, zve32x
li t2, 2
addi t1, a0, 1
1:
vsetvli t0, a2, e8, m1, ta, ma
vlseg2e8.v v8, (a1)
sub a2, a2, t0
sh1add a1, t0, a1
vsse8.v v8, (t1), t2
sh1add t1, t0, t1
vsse8.v v9, (a0), t2
sh1add a0, t0, a0
bnez a2, 1b
ret
endfunc