PR #25600 opened by Marvin Scholz (ePirat) URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/25600 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/25600.patch
The horizontal scaler intermediate buffer holds signed 16-bit samples that can be negative when scaling with filters that have negative lobes (such as bicubic). The 16-pixel and 8-pixel NEON vector loops in ff_yuv2planeX_10_neon treat src as signed int16_t via smlal, but the scalar tail loop for remaining (dstW % 8) pixels used unsigned ldrh before sxtw, interpreting negative intermediate values as large positive values around 65536 and saturating output pixels. Use ldrsh instead of ldrh so negative intermediate samples are properly sign-extended in the scalar tail loop. Signed-off-by: Marvin Scholz <[email protected]> # Summary of changes Briefly describe what this PR does and why. <!-- If this PR requires new FATE test samples, attach them to the PR and list their target paths below (relative to the fate-suite root). Attached filenames must match the sample's filename: ```fate-samples # e.g. vorbis/new-sample.ogg ``` --> >From 00fef808a9b10cd47337d0ae2a2e9679f4bbdca2 Mon Sep 17 00:00:00 2001 From: Greg Falcon <[email protected]> Date: Tue, 27 Oct 2026 12:58:57 -0400 Subject: [PATCH] swscale/aarch64: fix signed load in yuv2planeX_10 The horizontal scaler intermediate buffer holds signed 16-bit samples that can be negative when scaling with filters that have negative lobes (such as bicubic). The 16-pixel and 8-pixel NEON vector loops in ff_yuv2planeX_10_neon treat src as signed int16_t via smlal, but the scalar tail loop for remaining (dstW % 8) pixels used unsigned ldrh before sxtw, interpreting negative intermediate values as large positive values around 65536 and saturating output pixels. Use ldrsh instead of ldrh so negative intermediate samples are properly sign-extended in the scalar tail loop. Signed-off-by: Marvin Scholz <[email protected]> --- libswscale/aarch64/output.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libswscale/aarch64/output.S b/libswscale/aarch64/output.S index a650d72f54c..2e559ba1e55 100644 --- a/libswscale/aarch64/output.S +++ b/libswscale/aarch64/output.S @@ -165,7 +165,7 @@ function ff_yuv2planeX_10_neon, export=1 ldr x14, [x12], #8 // Load src pointer ldrsh w15, [x13], #2 // Load filter coefficient add x14, x14, x7, lsl #1 // Add pixel offset - ldrh w16, [x14] + ldrsh w16, [x14] sxtw x16, w16 sxtw x15, w15 -- 2.54.0 _______________________________________________ ffmpeg-devel mailing list -- [email protected] To unsubscribe send an email to [email protected]
