Mercurial > libavcodec.hg
diff dsputil.h @ 11194:7b3f6955462b libavcodec
Add LOCAL_ALIGNED() macro for declaring aligned local arrays
author | mru |
---|---|
date | Wed, 17 Feb 2010 20:36:12 +0000 |
parents | 34a65026fa06 |
children | 4f3503b0dc07 |
line wrap: on
line diff
--- a/dsputil.h Wed Feb 17 20:36:10 2010 +0000 +++ b/dsputil.h Wed Feb 17 20:36:12 2010 +0000 @@ -700,6 +700,22 @@ # define STRIDE_ALIGN 8 #endif +#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) + +#if HAVE_LOCAL_ALIGNED_8 +# define LOCAL_ALIGNED_8((t, v, s, ...) DECLARE_ALIGNED_8(t, v) s __VA_ARGS__ +#else +# define LOCAL_ALIGNED_8(t, v, s, ...) LOCAL_ALIGNED(8, t, v, s, __VA_ARGS__) +#endif + +#if HAVE_LOCAL_ALIGNED_16 +# define LOCAL_ALIGNED_16((t, v, s, ...) DECLARE_ALIGNED_16(t, v) s __VA_ARGS__ +#else +# define LOCAL_ALIGNED_16(t, v, s, ...) LOCAL_ALIGNED(16, t, v, s, __VA_ARGS__) +#endif + /* PSNR */ void get_psnr(uint8_t *orig_image[3], uint8_t *coded_image[3], int orig_linesize[3], int coded_linesize,