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 44E9B4B0F3 for ; Thu, 27 Jun 2024 19:04:45 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id E103668D5BA; Thu, 27 Jun 2024 22:04:42 +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 93CEC68D3C1 for ; Thu, 27 Jun 2024 22:04:36 +0300 (EEST) Received: from basile.remlab.net (localhost [IPv6:::1]) by ursule.remlab.net (Postfix) with ESMTP id 06C86C02F8 for ; Thu, 27 Jun 2024 22:04:35 +0300 (EEST) From: =?UTF-8?q?R=C3=A9mi=20Denis-Courmont?= To: ffmpeg-devel@ffmpeg.org Date: Thu, 27 Jun 2024 22:04:35 +0300 Message-ID: <20240627190435.12159-3-remi@remlab.net> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240627190435.12159-1-remi@remlab.net> References: <20240627190435.12159-1-remi@remlab.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 3/3] lavc/vc1dsp: fix potential overflow in R-V V inv_trans_4 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: Judging by the coefficients, the last round of add/sub can overflow to 17 bits with a very small probability just as with the 8-point transform. This is not observed under FATE, but better safe than sorry. --- libavcodec/riscv/vc1dsp_rvv.S | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/libavcodec/riscv/vc1dsp_rvv.S b/libavcodec/riscv/vc1dsp_rvv.S index d038981a02..e857805ccf 100644 --- a/libavcodec/riscv/vc1dsp_rvv.S +++ b/libavcodec/riscv/vc1dsp_rvv.S @@ -206,13 +206,14 @@ func ff_vc1_inv_trans_4_rvv, zve32x vmul.vx v20, v1, t2 vadd.vv v26, v14, v16 # t3 vsub.vv v27, v18, v20 # t4 - vadd.vv v0, v24, v26 - vsub.vv v1, v25, v27 - vadd.vv v2, v25, v27 - vsub.vv v3, v24, v26 - .irp n,0,1,2,3 - vssra.vx v\n, v\n, t1 # + 4 >> 3 or + 64 >> 7 - .endr + vwadd.vv v8, v24, v26 + vwsub.vv v10, v25, v27 + vwadd.vv v12, v25, v27 + vwsub.vv v14, v24, v26 + vnclip.wx v0, v8, t1 + vnclip.wx v1, v10, t1 + vnclip.wx v2, v12, t1 + vnclip.wx v3, v14, t1 jr t0 endfunc -- 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".