[FFmpeg-devel] Stack variables alignment check in libavcodec/dsputil.c
Ramiro Polla
ramiro
Sun Aug 12 19:39:36 CEST 2007
Michael Niedermayer wrote:
> Hi
>
> On Sat, Aug 11, 2007 at 08:14:45PM -0300, Ramiro Polla wrote:
> [...]
>
>>> why is the realignment not always done?
>>>
>>>
>> If ffmpeg.c is compiled with gcc, it will align main() to 16 bytes and
>> maintain alignment everywhere. If libavcodec is called from MSVC++,
>> these functions will be called with 4-byte alignment. The same happens
>> for threads (both in w32threads and pthreads-win32).
>>
>
> how do you know during compilation how libavcodec will be called?
>
>
You don't, unless you're building it for a specific purpose. In that
case, you should know about this option (it should print out somewhere).
>
>>> what effect does it have on object size?
>>>
>>>
>>>
>> .text: unpatched patched
>> dsputil.o 0004e270 0004e280
>> pthread.o 000003c0 000003d0
>> utils.o 000029d0 00002a30
>>
>
> 128 bytes difference
>
> please add the realignment unconditionally! 128 bytes arent worth the
> time users might end up spending due to some random crash (as well as the
> number of bugreports we might get) and as someone else already said
> the ABI does not gurantee 16byte alignment so the realignment is needed
>
>
Ok. Attached patch sets it unconditionally for every platform and OS.
Should we make a list in configure only for the platforms that need it,
or is this ok?
Patch also adds avcodec_open, which I missed yesterday, and a note in
ff_check_alignment.
Ramiro Polla
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: align_arg_6.diff
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070812/85d1ce79/attachment.txt>
More information about the ffmpeg-devel
mailing list