From: "Rémi Denis-Courmont" <remi@remlab.net> To: ffmpeg-devel@ffmpeg.org Subject: [FFmpeg-devel] [PATCH 3/3] lavc/vc1dsp: fix potential overflow in R-V V inv_trans_4 Date: Thu, 27 Jun 2024 22:04:35 +0300 Message-ID: <20240627190435.12159-3-remi@remlab.net> (raw) In-Reply-To: <20240627190435.12159-1-remi@remlab.net> 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".
prev parent reply other threads:[~2024-06-27 19:04 UTC|newest] Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top 2024-06-27 19:04 [FFmpeg-devel] [PATCH 1/3] lavc/vc1dsp: factor R-V V inv_trans_8 code Rémi Denis-Courmont 2024-06-27 19:04 ` [FFmpeg-devel] [PATCH 2/3] lavc/vc1dsp: fix overflow in R-V V inv_trans_8 Rémi Denis-Courmont 2024-06-27 19:04 ` Rémi Denis-Courmont [this message]
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20240627190435.12159-3-remi@remlab.net \ --to=remi@remlab.net \ --cc=ffmpeg-devel@ffmpeg.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel This inbox may be cloned and mirrored by anyone: git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \ ffmpegdev@gitmailbox.com public-inbox-index ffmpegdev Example config snippet for mirrors. AGPL code for this site: git clone https://public-inbox.org/public-inbox.git