[FFmpeg-devel] cavs.c DECLARE_ALIGNED in ff_cavs_filter

Loren Merritt lorenm
Mon May 25 12:10:39 CEST 2009


On Mon, 25 May 2009, M?ns Rullg?rd wrote:
> Reimar D?ffinger <Reimar.Doeffinger at gmx.de> writes:
>
>> currently there is this code in cavs.c:
>>     DECLARE_ALIGNED_8(uint8_t, bs[8]);
>> The reason for it is that kind of code:
>>> *((uint64_t *)bs) = 0x0202020202020202ULL;
>>> if( *((uint64_t *)bs) ) {
>>
>> I thought of "solving" this via a union, but is this code really this
>> speed critical that we need such a mess?
>> Can't we just use memset for the writes and e.g. AV_RN64 for the read?

Are you complaining about the aliasing, or trying to simplify the code?

> Such huge literals are fairly inefficient anyway on most CPUs.

As opposed to what? The compiler should emit the same code for memset as 
for *(uint64_t*), and gcc on x86 does.

--Loren Merritt



More information about the ffmpeg-devel mailing list