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 26A3A48A94 for ; Sat, 27 Jul 2024 19:39:55 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 6360068D6A7; Sat, 27 Jul 2024 22:39:44 +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 B70FC68D506 for ; Sat, 27 Jul 2024 22:39:36 +0300 (EEST) Received: from basile.remlab.net (localhost [IPv6:::1]) by ursule.remlab.net (Postfix) with ESMTP id 35405C01A0 for ; Sat, 27 Jul 2024 22:39:36 +0300 (EEST) From: =?UTF-8?q?R=C3=A9mi=20Denis-Courmont?= To: ffmpeg-devel@ffmpeg.org Date: Sat, 27 Jul 2024 22:39:35 +0300 Message-ID: <20240727193935.85724-2-remi@remlab.net> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240727193935.85724-1-remi@remlab.net> References: <20240727193935.85724-1-remi@remlab.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/2] lavc/vc1dsp: use saturating arithmetic for RVV inv_trans_dc 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: T-Head C908 (cycles): vc1dsp.vc1_inv_trans_4x4_dc_c: 113.7 vc1dsp.vc1_inv_trans_4x4_dc_rvv_i32: 46.5 (before) vc1dsp.vc1_inv_trans_4x4_dc_rvv_i32: 45.5 (after) vc1dsp.vc1_inv_trans_4x8_dc_c: 230.7 vc1dsp.vc1_inv_trans_4x8_dc_rvv_i32: 65.7 (before) vc1dsp.vc1_inv_trans_4x8_dc_rvv_i32: 52.5 (after) vc1dsp.vc1_inv_trans_8x4_dc_c: 246.7 vc1dsp.vc1_inv_trans_8x4_dc_rvv_i64: 56.7 (before) vc1dsp.vc1_inv_trans_8x4_dc_rvv_i64: 45.5 (after) vc1dsp.vc1_inv_trans_8x8_dc_c: 419.7 vc1dsp.vc1_inv_trans_8x8_dc_rvv_i64: 81.2 (before) vc1dsp.vc1_inv_trans_8x8_dc_rvv_i64: 53.5 (after) --- libavcodec/riscv/vc1dsp_rvv.S | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/libavcodec/riscv/vc1dsp_rvv.S b/libavcodec/riscv/vc1dsp_rvv.S index 548ef9d3bf..f9b59688ae 100644 --- a/libavcodec/riscv/vc1dsp_rvv.S +++ b/libavcodec/riscv/vc1dsp_rvv.S @@ -38,18 +38,20 @@ func ff_vc1_inv_trans_\cols\()x\rows\()_dc_rvv, zve64x, zba .endif addi t2, t2, 64 srai t2, t2, 7 -.if \rows * \cols == 64 - vsetvli zero, t0, e16, m8, ta, ma -.elseif \rows * \cols == 32 - vsetvli zero, t0, e16, m4, ta, ma +.if \rows * \cols >= 32 + vsetvli zero, t0, e8, m\mat_lmul, ta, ma .else - vsetivli zero, \rows * \cols, e16, m2, ta, ma + vsetivli zero, \rows * \cols, e8, m\mat_lmul, ta, ma .endif - vzext.vf2 v8, v0 - vadd.vx v8, v8, t2 - vmax.vx v8, v8, zero - vsetvli zero, zero, e8, m\mat_lmul, ta, ma - vnclipu.wi v0, v8, 0 + bgez t2, 1f + + neg t2, t2 + vssubu.vx v0, v0, t2 + vsetivli zero, \rows, e8, m\row_lmul, ta, ma + vsse\w\().v v0, (a0), a1 + ret +1: + vsaddu.vx v0, v0, t2 vsetivli zero, \rows, e8, m\row_lmul, ta, ma vsse\w\().v v0, (a0), a1 ret -- 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".