diff --git a/libavcodec/riscv/blockdsp_init.c b/libavcodec/riscv/blockdsp_init.c index 59b2f9d47b..42c8e87fa7 100644 --- a/libavcodec/riscv/blockdsp_init.c +++ b/libavcodec/riscv/blockdsp_init.c @@ -27,6 +27,10 @@ void ff_clear_block_rvv(int16_t *block); void ff_clear_blocks_rvv(int16_t *block); +void ff_fill_block16_rvv(uint8_t *block, uint8_t value, ptrdiff_t line_size, + int h); +void ff_fill_block8_rvv(uint8_t *block, uint8_t value, ptrdiff_t line_size, + int h); av_cold void ff_blockdsp_init_riscv(BlockDSPContext *c) { @@ -36,6 +40,8 @@ av_cold void ff_blockdsp_init_riscv(BlockDSPContext *c) if (flags & AV_CPU_FLAG_RVV_I64 && ff_get_rv_vlenb() >= 16) { c->clear_block = ff_clear_block_rvv; c->clear_blocks = ff_clear_blocks_rvv; + c->fill_block_tab[0] = ff_fill_block16_rvv; + c->fill_block_tab[1] = ff_fill_block8_rvv; } #endif } diff --git a/libavcodec/riscv/blockdsp_rvv.S b/libavcodec/riscv/blockdsp_rvv.S index 8bb00bb467..18ab17da00 100644 --- a/libavcodec/riscv/blockdsp_rvv.S +++ b/libavcodec/riscv/blockdsp_rvv.S @@ -40,3 +40,24 @@ func ff_clear_blocks_rvv, zve64x ret endfunc + +func ff_fill_block16_rvv, zve32x + vsetivli t0, 16, e8, m1, ta, ma + vmv.v.x v8, a1 +1: + addi a3, a3, -1 + vse8.v v8, (a0) + add a0, a0, a2 + bnez a3, 1b + + ret +endfunc + +func ff_fill_block8_rvv, zve64x + vsetvli t0, zero, e8, m4, ta, ma + vmv.v.x v8, a1 + vsetvli t0, a3, e64, m4, ta, ma + vsse64.v v8, (a0), a2 + + ret +endfunc