summaryrefslogtreecommitdiffstats
path: root/libavutil
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-02-09 14:33:57 +0100
committerMichael Niedermayer <michaelni@gmx.at>2013-02-09 14:33:57 +0100
commit6b2e65078c02cb1e09b555603a1eb10ddb3bd244 (patch)
tree380272a56318a4153fce51926e1104de55fd262f /libavutil
parent276c9c0577e99c870d4d281bc8f0df82b402efc4 (diff)
parent218aefce4472dc02ee3f12830a9a894bf7916da9 (diff)
downloadffmpeg-streaming-6b2e65078c02cb1e09b555603a1eb10ddb3bd244.zip
ffmpeg-streaming-6b2e65078c02cb1e09b555603a1eb10ddb3bd244.tar.gz
Merge commit '218aefce4472dc02ee3f12830a9a894bf7916da9'
* commit '218aefce4472dc02ee3f12830a9a894bf7916da9': dsputil: Move LOCAL_ALIGNED macros to libavutil Conflicts: libavcodec/dvdec.c libavcodec/imc.c libavcodec/mpegvideo_motion.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavutil')
-rw-r--r--libavutil/internal.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/libavutil/internal.h b/libavutil/internal.h
index 487d098..6186d8e 100644
--- a/libavutil/internal.h
+++ b/libavutil/internal.h
@@ -58,6 +58,32 @@
# define INT_BIT (CHAR_BIT * sizeof(int))
#endif
+// Some broken preprocessors need a second expansion
+// to be forced to tokenize __VA_ARGS__
+#define E(x) x
+
+#define LOCAL_ALIGNED_A(a, t, v, s, o, ...) \
+ uint8_t la_##v[sizeof(t s o) + (a)]; \
+ t (*v) o = (void *)FFALIGN((uintptr_t)la_##v, a)
+
+#define LOCAL_ALIGNED_D(a, t, v, s, o, ...) \
+ DECLARE_ALIGNED(a, t, la_##v) s o; \
+ t (*v) o = la_##v
+
+#define LOCAL_ALIGNED(a, t, v, ...) E(LOCAL_ALIGNED_A(a, t, v, __VA_ARGS__,,))
+
+#if HAVE_LOCAL_ALIGNED_8
+# define LOCAL_ALIGNED_8(t, v, ...) E(LOCAL_ALIGNED_D(8, t, v, __VA_ARGS__,,))
+#else
+# define LOCAL_ALIGNED_8(t, v, ...) LOCAL_ALIGNED(8, t, v, __VA_ARGS__)
+#endif
+
+#if HAVE_LOCAL_ALIGNED_16
+# define LOCAL_ALIGNED_16(t, v, ...) E(LOCAL_ALIGNED_D(16, t, v, __VA_ARGS__,,))
+#else
+# define LOCAL_ALIGNED_16(t, v, ...) LOCAL_ALIGNED(16, t, v, __VA_ARGS__)
+#endif
+
#define FF_ALLOC_OR_GOTO(ctx, p, size, label)\
{\
p = av_malloc(size);\
OpenPOWER on IntegriCloud