[FFmpeg-cvslog] x86: mpegvideoenc: Do not abuse HAVE_ variables for template instantiation

Diego Biurrun git at videolan.org
Wed Aug 29 18:16:19 CEST 2012


ffmpeg | branch: master | Diego Biurrun <diego at biurrun.de> | Tue Aug 28 17:37:54 2012 +0200| [d39791bf398bedd842ed75260e9de6fcc64c6fe0] | committer: Diego Biurrun

x86: mpegvideoenc: Do not abuse HAVE_ variables for template instantiation

This avoids trouble if HAVE_ variables are used elsewhere in the file.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d39791bf398bedd842ed75260e9de6fcc64c6fe0
---

 libavcodec/x86/mpegvideoenc.c          |   39 ++++++++++++++++++--------------
 libavcodec/x86/mpegvideoenc_template.c |    8 +++----
 2 files changed, 26 insertions(+), 21 deletions(-)

diff --git a/libavcodec/x86/mpegvideoenc.c b/libavcodec/x86/mpegvideoenc.c
index 5949a63..184912d 100644
--- a/libavcodec/x86/mpegvideoenc.c
+++ b/libavcodec/x86/mpegvideoenc.c
@@ -30,39 +30,44 @@
 
 extern uint16_t ff_inv_zigzag_direct16[64];
 
-#if HAVE_SSSE3
-#define HAVE_SSSE3_BAK
-#endif
-#undef HAVE_SSSE3
-#define HAVE_SSSE3 0
-
-#undef HAVE_SSE2
-#undef HAVE_MMXEXT
-#define HAVE_SSE2 0
-#define HAVE_MMXEXT 0
+#define COMPILE_TEMPLATE_MMXEXT 0
+#define COMPILE_TEMPLATE_SSE2   0
+#define COMPILE_TEMPLATE_SSSE3  0
 #define RENAME(a) a ## _MMX
 #define RENAMEl(a) a ## _mmx
 #include "mpegvideoenc_template.c"
 
-#undef HAVE_MMXEXT
-#define HAVE_MMXEXT 1
+#undef COMPILE_TEMPLATE_SSSE3
+#undef COMPILE_TEMPLATE_SSE2
+#undef COMPILE_TEMPLATE_MMXEXT
+#define COMPILE_TEMPLATE_MMXEXT 1
+#define COMPILE_TEMPLATE_SSE2   0
+#define COMPILE_TEMPLATE_SSSE3  0
 #undef RENAME
 #undef RENAMEl
 #define RENAME(a) a ## _MMX2
 #define RENAMEl(a) a ## _mmx2
 #include "mpegvideoenc_template.c"
 
-#undef HAVE_SSE2
-#define HAVE_SSE2 1
+#undef COMPILE_TEMPLATE_MMXEXT
+#undef COMPILE_TEMPLATE_SSE2
+#undef COMPILE_TEMPLATE_SSSE3
+#define COMPILE_TEMPLATE_MMXEXT 0
+#define COMPILE_TEMPLATE_SSE2   1
+#define COMPILE_TEMPLATE_SSSE3  0
 #undef RENAME
 #undef RENAMEl
 #define RENAME(a) a ## _SSE2
 #define RENAMEl(a) a ## _sse2
 #include "mpegvideoenc_template.c"
 
-#ifdef HAVE_SSSE3_BAK
-#undef HAVE_SSSE3
-#define HAVE_SSSE3 1
+#if HAVE_SSSE3
+#undef COMPILE_TEMPLATE_MMXEXT
+#undef COMPILE_TEMPLATE_SSE2
+#undef COMPILE_TEMPLATE_SSSE3
+#define COMPILE_TEMPLATE_MMXEXT 0
+#define COMPILE_TEMPLATE_SSE2   1
+#define COMPILE_TEMPLATE_SSSE3  1
 #undef RENAME
 #undef RENAMEl
 #define RENAME(a) a ## _SSSE3
diff --git a/libavcodec/x86/mpegvideoenc_template.c b/libavcodec/x86/mpegvideoenc_template.c
index 195298d..a6e7ba4 100644
--- a/libavcodec/x86/mpegvideoenc_template.c
+++ b/libavcodec/x86/mpegvideoenc_template.c
@@ -29,7 +29,7 @@
 #undef SAVE_SIGN
 #undef RESTORE_SIGN
 
-#if HAVE_SSE2
+#if COMPILE_TEMPLATE_SSE2
 #define MMREG_WIDTH "16"
 #define MM "%%xmm"
 #define MOVQ "movdqa"
@@ -48,7 +48,7 @@
 #define MMREG_WIDTH "8"
 #define MM "%%mm"
 #define MOVQ "movq"
-#if HAVE_MMXEXT
+#if COMPILE_TEMPLATE_MMXEXT
 #define SPREADW(a) "pshufw $0, "a", "a" \n\t"
 #define PMAXW(a,b) "pmaxsw "a", "b"     \n\t"
 #define PMAX(a,b) \
@@ -74,7 +74,7 @@
 #endif
 #endif
 
-#if HAVE_SSSE3
+#if COMPILE_TEMPLATE_SSSE3
 #define SAVE_SIGN(a,b) \
             "movdqa "b", "a"            \n\t"\
             "pabsw  "b", "b"            \n\t"
@@ -212,7 +212,7 @@ static int RENAME(dct_quantize)(MpegEncContext *s,
         SPREADW(MM"1")
         "psubusw "MM"1, "MM"4               \n\t"
         "packuswb "MM"4, "MM"4              \n\t"
-#if HAVE_SSE2
+#if COMPILE_TEMPLATE_SSE2
         "packuswb "MM"4, "MM"4              \n\t"
 #endif
         "movd "MM"4, %0                     \n\t" // *overflow



More information about the ffmpeg-cvslog mailing list