[x264-devel] gcc stack alignment
aaron
aaron_ppus at fmad.co.jp
Sat Dec 20 06:00:28 CET 2008
ahh, tho looks like using that function might be difficult for some
things e.g. calling x264_slicetype_mb_cost() with it
I just made all the DECLARE_ALIGNED__* static and it fixed the prob.
ugly as sin... but works for now.
also in x264_slicetype_mb_cost() is missing a DECLARE_ALIGNED_16 on the
x264_me_t m[2] stack var -> causes fault on h->mc.memcpy_aligned() line 137
Aaron
Jason Garrett-Glaser wrote:
> On Fri, Dec 19, 2008 at 12:03 AM, aaron <aaron_ppus at fmad.co.jp> wrote:
>
>> Hi,
>>
>> Found a kind of interesting but wrt to stack aligned variables. so in
>>
>> encoder/slicetype.c : x264_slicetype_mb_cost() line 194
>> (x264-snapshot-20081207-2245)
>>
>> it declares
>>
>> DECLARE_ALLIGNED_16( uint8_t edge[33]);
>>
>> with gcc 4.3.1 edge ends up being on an 8B boundary, and thus the SSE2 asm
>>
>> predict_8x8_ddl_sse2:
>> movdqa xmm3, [r1+16]
>>
>> will fault, non 128b aligned address.
>>
>> My understanding was gcc could not gaurentee the alignment of variables
>> on the stack? it would only gaurentee the alignment of static/globals
>> variables?
>>
>> Quick fix is either
>>
>> 1) move edge[] to be a static var
>>
>> 2) use movdqu & take the perf hit.
>>
>
> or use x264_stack_align like one is supposed to and suffer no penalty at all.
>
> Dark Shikari
> _______________________________________________
> x264-devel mailing list
> x264-devel at videolan.org
> http://mailman.videolan.org/listinfo/x264-devel
>
>
More information about the x264-devel
mailing list