diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 58a0274aacefea19f774f9924e1526e4b2d7181e..de9376bb0d9c988fdf49b3f4b3e5b835a74b4afc 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -35,7 +35,8 @@ SRCS = $(OBJS:.o=.c) $(ASM_OBJS:.o=.s)
 LIB= libavcodec.a
 TESTS= imgresample-test dct-test
 
-all: $(LIB) apiexample
+all: $(LIB)
+tests: apiexample $(TESTS)
 
 $(LIB): $(OBJS) $(ASM_OBJS)
 	rm -f $@
diff --git a/libavcodec/fastmemcpy.h b/libavcodec/fastmemcpy.h
new file mode 100644
index 0000000000000000000000000000000000000000..2a6f5c860d6e04902ff9b20b91a3417307a8623d
--- /dev/null
+++ b/libavcodec/fastmemcpy.h
@@ -0,0 +1 @@
+#include "../libvo/fastmemcpy.h"
diff --git a/libavcodec/imgconvert.c b/libavcodec/imgconvert.c
index 01289d4d83f6f081bcf234f77d02fe20b22a27d7..be2470b7bd9d839374f30152367278419e1cd9eb 100644
--- a/libavcodec/imgconvert.c
+++ b/libavcodec/imgconvert.c
@@ -21,6 +21,14 @@
 #include <string.h>
 #include "avcodec.h"
 
+/* Stuff below is useful only for mplayer project */
+#ifdef HAVE_CONFIG_H
+#include "../config.h"
+#endif
+
+#ifdef USE_FASTMEMCPY
+#include "fastmemcpy.h"
+#endif
 /* XXX: totally non optimized */
 
 static void yuv422_to_yuv420p(UINT8 *lum, UINT8 *cb, UINT8 *cr,
diff --git a/libavcodec/imgresample.c b/libavcodec/imgresample.c
index d394abdd3f09c5963ccb4fd0f9776a09f845cf39..52331a68d2ef4750596eb0bdcf50e9519643ba6a 100644
--- a/libavcodec/imgresample.c
+++ b/libavcodec/imgresample.c
@@ -23,6 +23,16 @@
 #include "dsputil.h"
 #include "avcodec.h"
 
+/* Stuff below is useful only for mplayer project */
+#ifdef HAVE_CONFIG_H
+#include "../config.h"
+#endif
+
+#ifdef USE_FASTMEMCPY
+#include "fastmemcpy.h"
+#endif
+
+
 #define NB_COMPONENTS 3
 
 #define PHASE_BITS 4
diff --git a/libavcodec/mpeg12.c b/libavcodec/mpeg12.c
index 326f043863177eaaf7387e08271c62626853e6ef..d497d14c6c1207f104edb63fa2cd40d613845ca1 100644
--- a/libavcodec/mpeg12.c
+++ b/libavcodec/mpeg12.c
@@ -25,6 +25,14 @@
 
 #include "mpeg12data.h"
 
+/* Stuff below is useful only for mplayer project */
+#ifdef HAVE_CONFIG_H
+#include "../config.h"
+#endif
+
+#ifdef USE_FASTMEMCPY
+#include "fastmemcpy.h"
+#endif
 //#define DEBUG
 
 #ifdef DEBUG
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index ec4b26bf28295e7bb6432f964a247d9875f363cb..49a99816782d9a210efac52bd0a63db8438cd24f 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -24,6 +24,15 @@
 #include "dsputil.h"
 #include "mpegvideo.h"
 
+/* Stuff below is useful only for mplayer project */
+#ifdef HAVE_CONFIG_H
+#include "../config.h"
+#endif
+
+#ifdef USE_FASTMEMCPY
+#include "fastmemcpy.h"
+#endif
+
 static void encode_picture(MpegEncContext *s, int picture_number);
 static void rate_control_init(MpegEncContext *s);
 static int rate_estimate_qscale(MpegEncContext *s);