aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorMåns Rullgård <mans@mansr.com>2010-02-17 20:36:12 +0000
committerMåns Rullgård <mans@mansr.com>2010-02-17 20:36:12 +0000
commitd96cd42969964f2b86949e89c0ba138465646bf3 (patch)
treecc3335a19c763eb1f7ae73d2c77fb65cc1c27061 /libavcodec
parent2480c390bdb5c96b1910f17dcccbe79b32350488 (diff)
downloadffmpeg-d96cd42969964f2b86949e89c0ba138465646bf3.tar.gz
Add LOCAL_ALIGNED() macro for declaring aligned local arrays
Originally committed as revision 21864 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/dsputil.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/libavcodec/dsputil.h b/libavcodec/dsputil.h
index 2d8d41af84..af15d9687c 100644
--- a/libavcodec/dsputil.h
+++ b/libavcodec/dsputil.h
@@ -700,6 +700,22 @@ static inline void emms(void)
# 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,