lavc/alacdsp: RISC-V V append_extra_bits[0]

This commit is contained in:
Rémi Denis-Courmont 2022-10-04 20:17:17 +03:00 committed by Lynne
parent 64ab577954
commit 55bde97f29
2 changed files with 25 additions and 1 deletions

View File

@ -27,13 +27,19 @@
void ff_alac_decorrelate_stereo_rvv(int32_t *buffer[2], int nb_samples,
int decorr_shift, int decorr_left_weight);
void ff_alac_append_extra_bits_mono_rvv(int32_t *buffer[2],
int32_t *extra_bits_buf[2],
int extra_bits, int channels,
int nb_samples);
av_cold void ff_alacdsp_init_riscv(ALACDSPContext *c)
{
#if HAVE_RVV && (__riscv_xlen == 64)
int flags = av_get_cpu_flags();
if (flags & AV_CPU_FLAG_RVV_I32)
if (flags & AV_CPU_FLAG_RVV_I32) {
c->decorrelate_stereo = ff_alac_decorrelate_stereo_rvv;
c->append_extra_bits[0] = ff_alac_append_extra_bits_mono_rvv;
}
#endif
}

View File

@ -43,4 +43,22 @@ func ff_alac_decorrelate_stereo_rvv, zve32x
ret
endfunc
func ff_alac_append_extra_bits_mono_rvv, zve32x
ld a0, (a0)
ld a1, (a1)
1:
vsetvli t0, a4, e32, m1, ta, ma
vle32.v v16, (a0)
sub a4, a4, t0
vle32.v v24, (a1)
sh2add a1, t0, a1
vsll.vx v16, v16, a2
vor.vv v16, v24, v16
vse32.v v16, (a0)
sh2add a0, t0, a0
bnez a4, 1b
ret
endfunc
#endif