PR #25530 opened by gnattu
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/25530
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/25530.patch

# Summary of changes

Cropped frames can have unaligned data pointers, but the SSE2 PSADBW
memory operand requires 16-byte alignment. Use an unaligned load to
avoid crashes in scene detection.

See https://github.com/jellyfin/jellyfin-ffmpeg/issues/795 for more info. 


>From 82eb3ad2c2f16a1cbcd25d94054633577a86f061 Mon Sep 17 00:00:00 2001
From: gnattu <[email protected]>
Date: Tue, 27 Oct 2026 23:41:45 +0800
Subject: [PATCH] avfilter/x86/scene_sad: fix unaligned input in SSE2

Cropped frames can have unaligned data pointers, but the SSE2 PSADBW
memory operand requires 16-byte alignment. Use an unaligned load to
avoid crashes in scene detection.

Signed-off-by: gnattu <[email protected]>
---
 libavfilter/x86/scene_sad.asm | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/libavfilter/x86/scene_sad.asm b/libavfilter/x86/scene_sad.asm
index 181c2908935..506e8330001 100644
--- a/libavfilter/x86/scene_sad.asm
+++ b/libavfilter/x86/scene_sad.asm
@@ -41,7 +41,13 @@ cglobal scene_sad%1, 6, 7, 3, src1, stride1, src2, stride2, 
width, end, x
 
 %macro PSADQ 4 ; depth, dst, [src2], tmp
 %if %1 == 8
+    %if cpuflag(avx)
         psadbw %2, %3
+    %else
+        ; PSADBW requires an aligned memory operand.
+        movu   %4, %3
+        psadbw %2, %4
+    %endif
 %else
         psubw     %2, %3
         pabsw     %2, %2
-- 
2.54.0

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to