[FFmpeg-devel] [PATCH] lavfi/vf_deshake: fix segfaults #2443
João Bernardo
jbvsmo at gmail.com
Mon Apr 15 06:04:03 CEST 2013
Fixed both segfaults from ticket #2443 with deshake filter:
1st - Array 128x128 not big enough for rx=64
2nd - SSE2 instruction PSADBW need memory aligned for 128bit operands
(XMM)
diff --git a/libavcodec/x86/motion_est.c b/libavcodec/x86/motion_est.c
index 3ffb002..d828d8a 100644
--- a/libavcodec/x86/motion_est.c
+++ b/libavcodec/x86/motion_est.c
@@ -104,8 +104,10 @@ static int sad16_sse2(void *v, uint8_t *blk2, uint8_t
*blk1, int stride, int h)
"1: \n\t"
"movdqu (%1), %%xmm0 \n\t"
"movdqu (%1, %4), %%xmm1 \n\t"
- "psadbw (%2), %%xmm0 \n\t"
- "psadbw (%2, %4), %%xmm1 \n\t"
+ "movdqu (%2), %%xmm2 \n\t"
+ "movdqu (%2, %4), %%xmm3 \n\t"
+ "psadbw %%xmm2, %%xmm0 \n\t"
+ "psadbw %%xmm3, %%xmm1 \n\t"
"paddw %%xmm0, %%xmm2 \n\t"
"paddw %%xmm1, %%xmm2 \n\t"
"lea (%1,%4,2), %1 \n\t"
diff --git a/libavfilter/vf_deshake.c b/libavfilter/vf_deshake.c
index d5f80b0..11c828c 100644
--- a/libavfilter/vf_deshake.c
+++ b/libavfilter/vf_deshake.c
@@ -242,7 +242,7 @@ static void find_motion(DeshakeContext *deshake,
uint8_t *src1, uint8_t *src2,
{
int x, y;
IntMotionVector mv = {0, 0};
- int counts[128][128];
+ int counts[128 + 1][128 + 1];
int count_max_value = 0;
int contrast;
João Bernardo
More information about the ffmpeg-devel
mailing list