From 806f84ea5557c4652e48451decc4c679c9485472 Mon Sep 17 00:00:00 2001 From: sunyuechi Date: Tue, 16 Jan 2024 23:56:33 +0800 Subject: [PATCH 2/3] lavc/h264pred: R-V V pred16x16_horizontal_8 C908 pred16x16_horizontal_8_c: 3.0 pred16x16_horizontal_8_rvv_i32: 2.5 --- libavcodec/riscv/h264pred_init.c | 2 ++ libavcodec/riscv/h264pred_rvv.S | 15 +++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/libavcodec/riscv/h264pred_init.c b/libavcodec/riscv/h264pred_init.c index 179bd8c8a5..8665bc729e 100644 --- a/libavcodec/riscv/h264pred_init.c +++ b/libavcodec/riscv/h264pred_init.c @@ -25,6 +25,7 @@ #include "libavcodec/h264pred.h" void ff_pred16x16_vertical_8_rvv(uint8_t *src, ptrdiff_t stride); +void ff_pred16x16_horizontal_8_rvv(uint8_t *src, ptrdiff_t stride); av_cold void ff_h264_pred_init_riscv(H264PredContext *h, int codec_id, const int bit_depth, @@ -36,6 +37,7 @@ av_cold void ff_h264_pred_init_riscv(H264PredContext *h, int codec_id, if (flags & AV_CPU_FLAG_RVV_I32) { h->pred16x16[VERT_PRED8x8] = ff_pred16x16_vertical_8_rvv; + h->pred16x16[HOR_PRED8x8] = ff_pred16x16_horizontal_8_rvv; } #endif } diff --git a/libavcodec/riscv/h264pred_rvv.S b/libavcodec/riscv/h264pred_rvv.S index 0e48662922..ba1e9045e1 100644 --- a/libavcodec/riscv/h264pred_rvv.S +++ b/libavcodec/riscv/h264pred_rvv.S @@ -33,3 +33,18 @@ func ff_pred16x16_vertical_8_rvv, zve32x ret endfunc + +func ff_pred16x16_horizontal_8_rvv, zve32x + li t0, 16 +1: + lbu t1, -1(a0) + vsetivli zero, 16, e8, m1, ta, ma + vmv.v.x v0, t1 + vsetivli zero, 4, e8, mf4, ta, ma + addi t0, t0, -1 + vse32.v v0, (a0) + add a0, a0, a1 + bnez t0, 1b + + ret +endfunc -- 2.43.0