[FFmpeg-cvslog] x86: swscale: Place inline assembly code under appropriate #ifdefs

Ronald S. Bultje git at videolan.org
Sun Jul 22 05:09:35 CEST 2012


ffmpeg | branch: master | Ronald S. Bultje <rsbultje at gmail.com> | Sat Jul 14 21:25:55 2012 -0700| [b2668c85e9d3745847f716f909ba4d3f6de0e12e] | committer: Diego Biurrun

x86: swscale: Place inline assembly code under appropriate #ifdefs

Fixes compilation for compilers that do not support gcc inline assembly.

Signed-off-by: Diego Biurrun <diego at biurrun.de>

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

 libswscale/x86/rgb2rgb.c     |    6 ++++++
 libswscale/x86/swscale_mmx.c |    6 ++++++
 libswscale/x86/yuv2rgb_mmx.c |    6 ++++++
 3 files changed, 18 insertions(+)

diff --git a/libswscale/x86/rgb2rgb.c b/libswscale/x86/rgb2rgb.c
index 282618c..353b0aa 100644
--- a/libswscale/x86/rgb2rgb.c
+++ b/libswscale/x86/rgb2rgb.c
@@ -33,6 +33,8 @@
 #include "libswscale/swscale.h"
 #include "libswscale/swscale_internal.h"
 
+#if HAVE_INLINE_ASM
+
 DECLARE_ASM_CONST(8, uint64_t, mmx_ff)       = 0x00000000000000FFULL;
 DECLARE_ASM_CONST(8, uint64_t, mmx_null)     = 0x0000000000000000ULL;
 DECLARE_ASM_CONST(8, uint64_t, mmx_one)      = 0xFFFFFFFFFFFFFFFFULL;
@@ -123,8 +125,11 @@ DECLARE_ASM_CONST(8, uint64_t, blue_15mask)  = 0x0000001f0000001fULL;
  32-bit C version, and and&add trick by Michael Niedermayer
 */
 
+#endif /* HAVE_INLINE_ASM */
+
 void rgb2rgb_init_x86(void)
 {
+#if HAVE_INLINE_ASM
     int cpu_flags = av_get_cpu_flags();
 
     if (cpu_flags & AV_CPU_FLAG_MMX)
@@ -135,4 +140,5 @@ void rgb2rgb_init_x86(void)
         rgb2rgb_init_MMX2();
     if (HAVE_SSE      && cpu_flags & AV_CPU_FLAG_SSE2)
         rgb2rgb_init_SSE2();
+#endif /* HAVE_INLINE_ASM */
 }
diff --git a/libswscale/x86/swscale_mmx.c b/libswscale/x86/swscale_mmx.c
index 37d786a..b57b7a4 100644
--- a/libswscale/x86/swscale_mmx.c
+++ b/libswscale/x86/swscale_mmx.c
@@ -27,6 +27,8 @@
 #include "libavutil/cpu.h"
 #include "libavutil/pixdesc.h"
 
+#if HAVE_INLINE_ASM
+
 #define DITHER1XBPP
 
 DECLARE_ASM_CONST(8, uint64_t, bF8)=       0xF8F8F8F8F8F8F8F8LL;
@@ -199,6 +201,8 @@ void updateMMXDitherTables(SwsContext *c, int dstY, int lumBufIndex, int chrBufI
     }
 }
 
+#endif /* HAVE_INLINE_ASM */
+
 #define SCALE_FUNC(filter_n, from_bpc, to_bpc, opt) \
 extern void ff_hscale ## from_bpc ## to ## to_bpc ## _ ## filter_n ## _ ## opt( \
                                                 SwsContext *c, int16_t *data, \
@@ -300,12 +304,14 @@ void ff_sws_init_swScale_mmx(SwsContext *c)
 {
     int cpu_flags = av_get_cpu_flags();
 
+#if HAVE_INLINE_ASM
     if (cpu_flags & AV_CPU_FLAG_MMX)
         sws_init_swScale_MMX(c);
 #if HAVE_MMX2
     if (cpu_flags & AV_CPU_FLAG_MMX2)
         sws_init_swScale_MMX2(c);
 #endif
+#endif /* HAVE_INLINE_ASM */
 
 #if HAVE_YASM
 #define ASSIGN_SCALE_FUNC2(hscalefn, filtersize, opt1, opt2) do { \
diff --git a/libswscale/x86/yuv2rgb_mmx.c b/libswscale/x86/yuv2rgb_mmx.c
index 0eaea77..f534e0e 100644
--- a/libswscale/x86/yuv2rgb_mmx.c
+++ b/libswscale/x86/yuv2rgb_mmx.c
@@ -36,6 +36,8 @@
 #include "libavutil/x86_cpu.h"
 #include "libavutil/cpu.h"
 
+#if HAVE_INLINE_ASM
+
 #define DITHER1XBPP // only for MMX
 
 /* hope these constant values are cache line aligned */
@@ -64,8 +66,11 @@ DECLARE_ASM_CONST(8, uint64_t, pb_07) = 0x0707070707070707ULL;
 #include "yuv2rgb_template.c"
 #endif /* HAVE_MMX2 */
 
+#endif /* HAVE_INLINE_ASM */
+
 SwsFunc ff_yuv2rgb_init_mmx(SwsContext *c)
 {
+#if HAVE_INLINE_ASM
     int cpu_flags = av_get_cpu_flags();
 
     if (c->srcFormat != PIX_FMT_YUV420P &&
@@ -103,6 +108,7 @@ SwsFunc ff_yuv2rgb_init_mmx(SwsContext *c)
             case PIX_FMT_RGB555: return yuv420_rgb15_MMX;
         }
     }
+#endif /* HAVE_INLINE_ASM */
 
     return NULL;
 }



More information about the ffmpeg-cvslog mailing list