From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id EC78A4A3EF for ; Sun, 30 Jun 2024 09:05:42 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 8965668D759; Sun, 30 Jun 2024 12:05:36 +0300 (EEST) Received: from ursule.remlab.net (vps-a2bccee9.vps.ovh.net [51.75.19.47]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 9F7A868D688 for ; Sun, 30 Jun 2024 12:05:28 +0300 (EEST) Received: from basile.remlab.net (localhost [IPv6:::1]) by ursule.remlab.net (Postfix) with ESMTP id 3733FC0145 for ; Sun, 30 Jun 2024 12:05:28 +0300 (EEST) From: =?UTF-8?q?R=C3=A9mi=20Denis-Courmont?= To: ffmpeg-devel@ffmpeg.org Date: Sun, 30 Jun 2024 12:05:27 +0300 Message-ID: <20240630090527.65998-2-remi@remlab.net> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240630090527.65998-1-remi@remlab.net> References: <20240630090527.65998-1-remi@remlab.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/2] lavc/h264dsp: R-V V 8-bit MBAFF loop filter X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: Performance is (unfortunately) the same as with non-MBAFF, since the hardware under test does not short-circuit vector tail calculations. (IMO, a generic solution or work-around should be agreed on, rather than bespoke approaches all over the place.) --- libavcodec/riscv/h264dsp_init.c | 4 ++++ libavcodec/riscv/h264dsp_rvv.S | 19 ++++++++++++++++--- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/libavcodec/riscv/h264dsp_init.c b/libavcodec/riscv/h264dsp_init.c index 0d4d541992..ab412a9924 100644 --- a/libavcodec/riscv/h264dsp_init.c +++ b/libavcodec/riscv/h264dsp_init.c @@ -31,6 +31,8 @@ void ff_h264_v_loop_filter_luma_8_rvv(uint8_t *pix, ptrdiff_t stride, int alpha, int beta, int8_t *tc0); void ff_h264_h_loop_filter_luma_8_rvv(uint8_t *pix, ptrdiff_t stride, int alpha, int beta, int8_t *tc0); +void ff_h264_h_loop_filter_luma_mbaff_8_rvv(uint8_t *pix, ptrdiff_t stride, + int alpha, int beta, int8_t *tc0); extern int ff_startcode_find_candidate_rvb(const uint8_t *, int); extern int ff_startcode_find_candidate_rvv(const uint8_t *, int); @@ -48,6 +50,8 @@ av_cold void ff_h264dsp_init_riscv(H264DSPContext *dsp, const int bit_depth, if (bit_depth == 8 && ff_rv_vlen_least(128)) { dsp->h264_v_loop_filter_luma = ff_h264_v_loop_filter_luma_8_rvv; dsp->h264_h_loop_filter_luma = ff_h264_h_loop_filter_luma_8_rvv; + dsp->h264_h_loop_filter_luma_mbaff = + ff_h264_h_loop_filter_luma_mbaff_8_rvv; } dsp->startcode_find_candidate = ff_startcode_find_candidate_rvv; } diff --git a/libavcodec/riscv/h264dsp_rvv.S b/libavcodec/riscv/h264dsp_rvv.S index ea9dfb1a7e..c5d21ba607 100644 --- a/libavcodec/riscv/h264dsp_rvv.S +++ b/libavcodec/riscv/h264dsp_rvv.S @@ -26,6 +26,15 @@ #include "libavutil/riscv/asm.S" + .macro .mbaff + .irp type,,_mbaff + .ifb \type + .equ IS_MBAFF, 0 + .else + .equ IS_MBAFF, 1 + .endif + .endm + .variant_cc ff_h264_loop_filter_luma_8_rvv func ff_h264_loop_filter_luma_8_rvv, zve32x # p2: v8, p1: v9, p0: v10, q0: v11, q1: v12, q2: v13 @@ -33,7 +42,7 @@ func ff_h264_loop_filter_luma_8_rvv, zve32x csrwi vxrm, 0 vid.v v0 vaaddu.vv v14, v10, v11 # (p0 + q0 + 1) / 2 - vsrl.vi v0, v0, 2 # v0[i] = i / inner_iters + vsrl.vx v0, v0, a4 # v0[i] = i / inner_iters vwsubu.vv v16, v9, v12 vrgather.vv v6, v4, v0 # tc_orig vwaddu.vv v18, v8, v14 @@ -116,6 +125,7 @@ func ff_h264_v_loop_filter_luma_8_rvv, zve32x add t6, t5, a1 vle8.v v12, (t5) vle8.v v13, (t6) + li a4, 2 # log2(inner_iters) jal t0, ff_h264_loop_filter_luma_8_rvv vse8.v v9, (t2) vse8.v v10, (t3) @@ -124,13 +134,16 @@ func ff_h264_v_loop_filter_luma_8_rvv, zve32x ret endfunc -func ff_h264_h_loop_filter_luma_8_rvv, zve32x +.mbaff +func ff_h264_h_loop_filter_luma\type\()_8_rvv, zve32x vsetivli zero, 4, e8, mf4, ta, ma vle8.v v4, (a4) addi a0, a0, -3 - vsetivli zero, 16, e8, m1, ta, ma + vsetivli zero, 16 >> IS_MBAFF, e8, m1, ta, ma vlsseg6e8.v v8, (a0), a1 + li a4, 2 >> IS_MBAFF # log2(inner_iters) jal t0, ff_h264_loop_filter_luma_8_rvv vssseg6e8.v v8, (a0), a1 ret endfunc +.endr -- 2.45.2 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".