This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch master
in repository ffmpeg.

commit f02837ddb903ec462d4afbae670659402feabf5b
Author:     Wesley Maa <[email protected]>
AuthorDate: Sun Nov 8 21:38:45 2026 -0500
Commit:     Martin Storsjö <[email protected]>
CommitDate: Wed Nov 25 11:36:41 2026 +0000

    riscv/vc1dsp: fix inv_trans_*_dc for DC values above 255
    
    vsaddu.vx and vssubu.vx with 8-bit elements only use the low 8 bits of
    the scalar operand, so a DC of e.g. 256 was added as 0 and 281 as 25.
    The C code clips dest + dc, so any DC of 255 or more saturates every
    pixel to 255 (or 0 for -255 or less). Clamp the magnitude to 255 before
    the saturating add or subtract, which gives the same result.
    
    The smallest affected DC-only blocks are a DC of 906 for 4x4, 1283 for
    8x4 and 4x8 and 1817 for 8x8.
    
    Signed-off-by: Wesley Maa <[email protected]>
---
 libavcodec/riscv/vc1dsp_rvv.S | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/libavcodec/riscv/vc1dsp_rvv.S b/libavcodec/riscv/vc1dsp_rvv.S
index 1ff5991288..01a8d42298 100644
--- a/libavcodec/riscv/vc1dsp_rvv.S
+++ b/libavcodec/riscv/vc1dsp_rvv.S
@@ -43,14 +43,21 @@ func ff_vc1_inv_trans_\cols\()x\rows\()_dc_rvv, zve64x, zba
 .else
         vsetivli    zero, \rows * \cols, e8, m\mat_lmul, ta, ma
 .endif
+        li      t1, 255
         bgez    t2, 1f
 
         neg     t2, t2
+        bltu    t2, t1, 2f
+        mv      t2, t1
+2:
         vssubu.vx   v0, v0, t2
         vsetivli    zero, \rows, e8, m\row_lmul, ta, ma
         vsse\w\().v v0, (a0), a1
         ret
 1:
+        bltu    t2, t1, 3f
+        mv      t2, t1
+3:
         vsaddu.vx   v0, v0, t2
         vsetivli    zero, \rows, e8, m\row_lmul, ta, ma
         vsse\w\().v v0, (a0), a1

-- 
To stop receiving notification emails like this one, please contact
[email protected].
_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to