[FFmpeg-devel] [PATCH] Make DECLARE_ALIGNED macros take array specifiers as separate argument

Måns Rullgård mans
Wed Oct 28 15:02:04 CET 2009


Reimar D?ffinger <Reimar.Doeffinger at gmx.de> writes:

> On Tue, Oct 27, 2009 at 08:35:47PM +0000, M?ns Rullg?rd wrote:
>> Reimar D?ffinger <Reimar.Doeffinger at gmx.de> writes:
>> 
>> > On Tue, Oct 27, 2009 at 07:25:51PM +0000, M?ns Rullg?rd wrote:
>> >> Reimar D?ffinger <Reimar.Doeffinger at gmx.de> writes:
>> >> > Don't worry, I wasn't going to object on that grounds, I just considered
>> >> > it reason enough to ask if there's an alternative.
>> >> > Could you give us an example for the syntax the TI compiler needs?
>> >> > In principle I guess it's ok, though checking if someone has a better
>> >> > idea can't hurt I'd think...
>> >> 
>> >> The following macros will need to be added in appropriate places:
>> >> 
>> >> #define AV_PRAGMA(s) _Pragma(#s)
>> >> 
>> >> #define DECLARE_ALIGNED(n,t,v,...)                  \
>> >>     AV_PRAGMA(DATA_ALIGN(v,n))                      \
>> >>     t v __VA_ARGS__ __attribute__((aligned(n)))
>> >> #define DECLARE_ASM_CONST(n,t,v,...)                \
>> >>     AV_PRAGMA(DATA_ALIGN(v,n))                      \
>> >>     static const t v __VA_ARGS__ __attribute__((aligned(n)))
>> >> 
>> >> #define LOCAL_ALIGNED(a, t, v, s, ...)                          \
>> >>     uint8_t la_##v[sizeof(t s __VA_ARGS__) + (a)];              \
>> >>     t (*v) __VA_ARGS__ = (void *)FFALIGN((uintptr_t)la_##v, a)
>> >> 
>> >> The last one will have to be used for local vars needing alignment.
>> >> This is needed with gcc too on some platforms.
>> >
>> > That's the only thing it is needed for?
>> 
>> The other macros are needed for non-stack variables.
>
> Oh. How do they work with static/extern/whatever? I thought there was
> some inconsistency there, I think the code I recently added to dsputil.h
> (COSTABLES etc.) puts the extern before the DECLARE_ALIGNED, does that
> make no difference to the TI compiler? Maybe that part should be
> separate macro argument, too?

An extern or static in front of the macro does no harm.

-- 
M?ns Rullg?rd
mans at mansr.com



More information about the ffmpeg-devel mailing list