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

Git pushed a commit to branch master
in repository ffmpeg.

The following commit(s) were added to refs/heads/master by this push:
     new b87602a63a swscale/riscv: fix uyvy/yuyv to yuv422p on odd widths
b87602a63a is described below

commit b87602a63a52b0f7f968fd314f02be14acde16b7
Author:     Hongyan Wang <[email protected]>
AuthorDate: Thu Sep 17 15:47:14 2026 +0800
Commit:     michaelni <[email protected]>
CommitDate: Sun Sep 27 12:06:07 2026 +0000

    swscale/riscv: fix uyvy/yuyv to yuv422p on odd widths
    
    The vector loop writes all luma samples, but only width / 2 chroma
    samples. For odd widths, the last U and V samples are left untouched,
    unlike the C implementations which use AV_CEIL_RSHIFT(width, 1).
    
    Write the remaining U/V samples in a scalar tail for both packed
    formats. Keep the existing vector loop and row stride adjustments.
    
    Fixes the uyvytoyuv422_rvv_i32 and yuyvtoyuv422_rvv_i32 failures in
    checkasm-sw_rgb.
    
    Signed-off-by: Hongyan Wang <[email protected]>
    Co-authored-by: YuanSheng <[email protected]>
    Co-authored-by: Fei Zhang <[email protected]>
---
 libswscale/riscv/rgb2rgb_rvv.S | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/libswscale/riscv/rgb2rgb_rvv.S b/libswscale/riscv/rgb2rgb_rvv.S
index a1a927b00f..b945d16bf1 100644
--- a/libswscale/riscv/rgb2rgb_rvv.S
+++ b/libswscale/riscv/rgb2rgb_rvv.S
@@ -132,7 +132,7 @@ func ff_deinterleave_bytes_rvv, zve32x, zba
         ret
 endfunc
 
-.macro yuy2_to_i422p luma, chroma
+.macro yuy2_to_i422p luma, chroma, chroma_offset
         lpad    0
         srai    t4, a4, 1 // pixel width -> chroma width
         lw      t6, (sp)
@@ -163,6 +163,14 @@ endfunc
         add     a0, t0, a0
         bnez    t4, 2b
 
+        andi    t0, a4, 1
+        beqz    t0, 3f
+        // Odd widths need one final U/V sample.
+        lbu     t0, \chroma_offset - 2(a3)
+        lbu     t1, \chroma_offset(a3)
+        sb      t0, (a1)
+        sb      t1, (a2)
+3:
         add     a3, a3, t6
         add     a0, a0, a6
         add     a1, a1, a7
@@ -173,9 +181,9 @@ endfunc
 .endm
 
 func ff_uyvytoyuv422_rvv, zve32x, b
-        yuy2_to_i422p v20, v16
+        yuy2_to_i422p v20, v16, 0
 endfunc
 
 func ff_yuyvtoyuv422_rvv, zve32x, b
-        yuy2_to_i422p v16, v20
+        yuy2_to_i422p v16, v20, 1
 endfunc

-- 
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