[FFmpeg-devel] Stack variables alignment check in libavcodec/dsputil.c

Michael Niedermayer michaelni
Sun Aug 12 00:26:15 CEST 2007


Hi

On Sat, Aug 11, 2007 at 07:14:29PM -0300, Ramiro Polla wrote:
> Michael Niedermayer wrote:
>
> [...]
>
>> avcodec_encode/decode_* are just small wraper functions and a register 
>> less
>> doesnt matter
>> and for execute i actually would suggest to make pthread.c and co
>> do the stack alignment so that no changes to functions which are passed
>> to execute() are needed that practically means adding the attribute to 
>> worker() in pthread.c
>>
>>   
>
> MinGW finally released gcc 4.2, and as promised here's my patch to fix this 
> alignment issue (based on Ga?l Chardon's patch).
>
> Zuxy, are you working on this too? Could you test it further too? 
> Everything worked fine with all my tests (w32threads and pthreads) from 
> within MSVC++.

why is the realignment not always done?
what effect does it have on object size?


[...]
> Index: libavcodec/dsputil.c
> ===================================================================
> --- libavcodec/dsputil.c	(revision 10074)
> +++ libavcodec/dsputil.c	(working copy)
> @@ -3823,7 +3823,7 @@
>      for(i=0; i<64; i++) inv_zigzag_direct16[ff_zigzag_direct[i]]= i+1;
>  }
>  
> -int ff_check_alignment(void){
> +int attribute_align_arg ff_check_alignment(void){
>      static int did_fail=0;
>      DECLARE_ALIGNED_16(int, aligned);

this IS wrong, it defeats the purpose of the function which is to check that
the stack of the caller is properly aligned

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Everything should be made as simple as possible, but not simpler.
-- Albert Einstein
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070812/9370aa8f/attachment.pgp>



More information about the ffmpeg-devel mailing list