diff --git a/libavcodec/aacps.c b/libavcodec/aacps.c
index fa7e9ac7a394028392ea97e56a9b64182bd86bfe..1abafe280f9c4a3e8b419c7916e0edf43003c098 100644
--- a/libavcodec/aacps.c
+++ b/libavcodec/aacps.c
@@ -21,13 +21,13 @@
 
 #include <stdint.h>
 #include "libavutil/common.h"
+#include "libavutil/internal.h"
 #include "libavutil/mathematics.h"
 #include "avcodec.h"
 #include "get_bits.h"
 #include "aacps.h"
 #include "aacps_tablegen.h"
 #include "aacpsdata.c"
-#include "dsputil.h"
 
 #define PS_BASELINE 0  ///< Operate in Baseline PS mode
                        ///< Baseline implies 10 or 20 stereo bands,
diff --git a/libavcodec/aacsbr.c b/libavcodec/aacsbr.c
index 8b290340d4ec3637ce8779bb46cdad7e85d08447..0d0e23d83f8c54324cc93eab12d404865dfaad9b 100644
--- a/libavcodec/aacsbr.c
+++ b/libavcodec/aacsbr.c
@@ -33,6 +33,7 @@
 #include "fft.h"
 #include "aacps.h"
 #include "sbrdsp.h"
+#include "libavutil/internal.h"
 #include "libavutil/libm.h"
 
 #include <stdint.h>
diff --git a/libavcodec/ac3enc.c b/libavcodec/ac3enc.c
index c0acc648500a68abdea2fb9c0d9d15d7fa7511b1..b3be2dbf107a144b02e2ff34dea21287a5a35dea 100644
--- a/libavcodec/ac3enc.c
+++ b/libavcodec/ac3enc.c
@@ -34,10 +34,10 @@
 #include "libavutil/avstring.h"
 #include "libavutil/channel_layout.h"
 #include "libavutil/crc.h"
+#include "libavutil/internal.h"
 #include "libavutil/opt.h"
 #include "avcodec.h"
 #include "put_bits.h"
-#include "dsputil.h"
 #include "ac3dsp.h"
 #include "ac3.h"
 #include "fft.h"
diff --git a/libavcodec/ac3enc_template.c b/libavcodec/ac3enc_template.c
index 388d75377e8d6f60adfb253408a58ac2dcfbdfba..ae9100c3acb7fe9ccb4f6ac5886239a8d17148dc 100644
--- a/libavcodec/ac3enc_template.c
+++ b/libavcodec/ac3enc_template.c
@@ -28,6 +28,7 @@
 
 #include <stdint.h>
 
+#include "libavutil/internal.h"
 
 /* prototypes for static functions in ac3enc_fixed.c and ac3enc_float.c */
 
diff --git a/libavcodec/bink.c b/libavcodec/bink.c
index 3a74cf9d7f4e8df44d7c5071e51883ccd428359a..033e9bf0a1f2c21a45c9698de00f7ab0640dce1d 100644
--- a/libavcodec/bink.c
+++ b/libavcodec/bink.c
@@ -21,6 +21,7 @@
  */
 
 #include "libavutil/imgutils.h"
+#include "libavutil/internal.h"
 #include "avcodec.h"
 #include "dsputil.h"
 #include "binkdata.h"
diff --git a/libavcodec/dcadec.c b/libavcodec/dcadec.c
index f26111a3876602dc8e8364e821ce971963e8689a..ab2757543a1f25fcadf809c8d6c69c14c1e16e3b 100644
--- a/libavcodec/dcadec.c
+++ b/libavcodec/dcadec.c
@@ -29,12 +29,12 @@
 #include "libavutil/channel_layout.h"
 #include "libavutil/common.h"
 #include "libavutil/float_dsp.h"
+#include "libavutil/internal.h"
 #include "libavutil/intmath.h"
 #include "libavutil/intreadwrite.h"
 #include "libavutil/mathematics.h"
 #include "libavutil/samplefmt.h"
 #include "avcodec.h"
-#include "dsputil.h"
 #include "fft.h"
 #include "get_bits.h"
 #include "put_bits.h"
diff --git a/libavcodec/dnxhdenc.c b/libavcodec/dnxhdenc.c
index 7ece9f2bce8c43257a301e4fc3df9438961c8064..4ea3709b082683f17f32e4a2351c8c20bda7b972 100644
--- a/libavcodec/dnxhdenc.c
+++ b/libavcodec/dnxhdenc.c
@@ -26,6 +26,7 @@
 //#define DEBUG
 #define RC_VARIANCE 1 // use variance or ssd for fast rc
 
+#include "libavutil/internal.h"
 #include "libavutil/opt.h"
 #include "avcodec.h"
 #include "dsputil.h"
diff --git a/libavcodec/dsputil.c b/libavcodec/dsputil.c
index 3b88164b2e2d27fc8546bc51d1beb2d02029f9ff..203c33ecd9581687a4d79c8bac395c7c61f3810f 100644
--- a/libavcodec/dsputil.c
+++ b/libavcodec/dsputil.c
@@ -28,6 +28,7 @@
  */
 
 #include "libavutil/imgutils.h"
+#include "libavutil/internal.h"
 #include "avcodec.h"
 #include "copy_block.h"
 #include "dsputil.h"
diff --git a/libavcodec/dsputil.h b/libavcodec/dsputil.h
index e4568ab4536f25f046106ae77b2f7228f9e2e66b..14c5db03bbbb2a6efd9b7e008a2791f3a6f0f753 100644
--- a/libavcodec/dsputil.h
+++ b/libavcodec/dsputil.h
@@ -417,30 +417,4 @@ void ff_dsputil_init_vis(DSPContext* c, AVCodecContext *avctx);
 #   define STRIDE_ALIGN 8
 #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
-
 #endif /* AVCODEC_DSPUTIL_H */
diff --git a/libavcodec/dv.c b/libavcodec/dv.c
index 1ea04be9e8359372bdc64544f7c1b004e0985e68..7ff0f74a90f2438e333488946bd40ffc86c5e206 100644
--- a/libavcodec/dv.c
+++ b/libavcodec/dv.c
@@ -38,6 +38,7 @@
  * DV codec.
  */
 
+#include "libavutil/internal.h"
 #include "libavutil/pixdesc.h"
 #include "avcodec.h"
 #include "dsputil.h"
diff --git a/libavcodec/dvdec.c b/libavcodec/dvdec.c
index 142cd6bdbf9d923879c87bbf17572518435f173a..441deadaab2ce2d29b92d5bd2f0ae4985c0504ec 100644
--- a/libavcodec/dvdec.c
+++ b/libavcodec/dvdec.c
@@ -35,9 +35,9 @@
  * DV decoder
  */
 
+#include "libavutil/internal.h"
 #include "libavutil/pixdesc.h"
 #include "avcodec.h"
-#include "dsputil.h"
 #include "internal.h"
 #include "get_bits.h"
 #include "put_bits.h"
diff --git a/libavcodec/h264_loopfilter.c b/libavcodec/h264_loopfilter.c
index b045d2388a74524fd572eb4786ac47ee5a34d5d9..45e1cdf88db79654b22ff26b00ee7b8c125a3652 100644
--- a/libavcodec/h264_loopfilter.c
+++ b/libavcodec/h264_loopfilter.c
@@ -25,9 +25,9 @@
  * @author Michael Niedermayer <michaelni@gmx.at>
  */
 
+#include "libavutil/internal.h"
 #include "libavutil/intreadwrite.h"
 #include "internal.h"
-#include "dsputil.h"
 #include "avcodec.h"
 #include "mpegvideo.h"
 #include "h264.h"
diff --git a/libavcodec/imc.c b/libavcodec/imc.c
index 6dac4302848fac6a9d84b2ca48b930295bc0563b..909fa476318693b2128900232a959d22dd37bbe8 100644
--- a/libavcodec/imc.c
+++ b/libavcodec/imc.c
@@ -37,6 +37,7 @@
 
 #include "libavutil/channel_layout.h"
 #include "libavutil/float_dsp.h"
+#include "libavutil/internal.h"
 #include "avcodec.h"
 #include "get_bits.h"
 #include "dsputil.h"
diff --git a/libavcodec/ituh263dec.c b/libavcodec/ituh263dec.c
index 30cd58efd3ed84a9b973e7134c916532c013fae1..c3552da35e12edddf72a62155606b5da9e737d9d 100644
--- a/libavcodec/ituh263dec.c
+++ b/libavcodec/ituh263dec.c
@@ -30,6 +30,7 @@
 //#define DEBUG
 #include <limits.h>
 
+#include "libavutil/internal.h"
 #include "libavutil/mathematics.h"
 #include "dsputil.h"
 #include "avcodec.h"
diff --git a/libavcodec/mpc7.c b/libavcodec/mpc7.c
index ab6fd9f2231f3efc53575b202f92bb0e590b8f81..6a2b12023010d83696838e651edcdf04653d12d5 100644
--- a/libavcodec/mpc7.c
+++ b/libavcodec/mpc7.c
@@ -26,6 +26,7 @@
  */
 
 #include "libavutil/channel_layout.h"
+#include "libavutil/internal.h"
 #include "libavutil/lfg.h"
 #include "avcodec.h"
 #include "get_bits.h"
diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index ee1d022234c54c7b9384771e35fc4ef9538b6f7c..8e63314779bc4172e3d8a5ba7b35a929bb94a439 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -27,6 +27,7 @@
  * The simplest mpeg encoder (well, it was the simplest!).
  */
 
+#include "libavutil/internal.h"
 #include "libavutil/intmath.h"
 #include "libavutil/mathematics.h"
 #include "libavutil/pixdesc.h"
diff --git a/libavcodec/mpegvideo_motion.c b/libavcodec/mpegvideo_motion.c
index 536377a46f45c23571c324cc7701a683e8c24925..24507a457565d0b0626a947752118d151a9936d5 100644
--- a/libavcodec/mpegvideo_motion.c
+++ b/libavcodec/mpegvideo_motion.c
@@ -22,6 +22,8 @@
  */
 
 #include <string.h>
+
+#include "libavutil/internal.h"
 #include "avcodec.h"
 #include "dsputil.h"
 #include "mpegvideo.h"
diff --git a/libavcodec/ppc/mpegaudiodec_altivec.c b/libavcodec/ppc/mpegaudiodec_altivec.c
index fcd127abca6164c3d2aa0000e1ac4b4445a4098d..7965183999c66042620779038b451968622b10f8 100644
--- a/libavcodec/ppc/mpegaudiodec_altivec.c
+++ b/libavcodec/ppc/mpegaudiodec_altivec.c
@@ -21,8 +21,8 @@
 
 #include "dsputil_altivec.h"
 #include "libavutil/attributes.h"
+#include "libavutil/internal.h"
 #include "libavutil/ppc/util_altivec.h"
-#include "libavcodec/dsputil.h"
 #include "libavcodec/mpegaudiodsp.h"
 
 #define MACS(rt, ra, rb) rt+=(ra)*(rb)
diff --git a/libavcodec/ra288.c b/libavcodec/ra288.c
index 319bdd4e2228576faa88d53995ae58ef5b050fb7..677a6c2f57d42c6944b80aa17e16a9f501c76e57 100644
--- a/libavcodec/ra288.c
+++ b/libavcodec/ra288.c
@@ -21,6 +21,7 @@
 
 #include "libavutil/channel_layout.h"
 #include "libavutil/float_dsp.h"
+#include "libavutil/internal.h"
 #include "avcodec.h"
 #include "internal.h"
 #define BITSTREAM_READER_LE
diff --git a/libavcodec/rv34.c b/libavcodec/rv34.c
index 4c98e9964ff668037d9e72790dca15f7bf6caec7..a131c105eb9ba393e8239562623523b5c8d27f54 100644
--- a/libavcodec/rv34.c
+++ b/libavcodec/rv34.c
@@ -27,7 +27,6 @@
 #include "libavutil/internal.h"
 
 #include "avcodec.h"
-#include "dsputil.h"
 #include "mpegvideo.h"
 #include "golomb.h"
 #include "internal.h"
diff --git a/libavcodec/simple_idct.c b/libavcodec/simple_idct.c
index 328c96c747b73fac8e8a675e203b421bae3fb486..f61e9e639ded885ef2969245c208c7df3f273160 100644
--- a/libavcodec/simple_idct.c
+++ b/libavcodec/simple_idct.c
@@ -27,7 +27,6 @@
 
 #include "libavutil/intreadwrite.h"
 #include "avcodec.h"
-#include "dsputil.h"
 #include "mathops.h"
 #include "simple_idct.h"
 
diff --git a/libavcodec/takdec.c b/libavcodec/takdec.c
index d47db4818c4a6e03efc3ab33709756ca9af0937d..1a2cc3bed76b175e8134903023f36d7ef3690d86 100644
--- a/libavcodec/takdec.c
+++ b/libavcodec/takdec.c
@@ -25,6 +25,7 @@
  * @author Paul B Mahol
  */
 
+#include "libavutil/internal.h"
 #include "libavutil/samplefmt.h"
 #include "tak.h"
 #include "avcodec.h"
diff --git a/libavcodec/x86/mpegaudiodec.c b/libavcodec/x86/mpegaudiodec.c
index cc2b6619b65fd24dddbec18455eb69af11e6b0c9..79a29ce506b063a5acf307fab356e8d50e2841ba 100644
--- a/libavcodec/x86/mpegaudiodec.c
+++ b/libavcodec/x86/mpegaudiodec.c
@@ -21,9 +21,9 @@
 
 #include "libavutil/attributes.h"
 #include "libavutil/cpu.h"
+#include "libavutil/internal.h"
 #include "libavutil/x86/asm.h"
 #include "libavutil/x86/cpu.h"
-#include "libavcodec/dsputil.h"
 #include "libavcodec/mpegaudiodsp.h"
 
 void ff_imdct36_float_sse(float *out, float *buf, float *in, float *win);
diff --git a/libavutil/internal.h b/libavutil/internal.h
index 5bc6a085d6c9ce4770989668838c7349e0545881..43cbaeaca27cfcc55a66ca5d80bb63829027b5f2 100644
--- a/libavutil/internal.h
+++ b/libavutil/internal.h
@@ -57,6 +57,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);\