Commit b2668c85 authored by Ronald S. Bultje's avatar Ronald S. Bultje Committed by 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: 's avatarDiego Biurrun <diego@biurrun.de>
parent 5354a904
...@@ -33,6 +33,8 @@ ...@@ -33,6 +33,8 @@
#include "libswscale/swscale.h" #include "libswscale/swscale.h"
#include "libswscale/swscale_internal.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_ff) = 0x00000000000000FFULL;
DECLARE_ASM_CONST(8, uint64_t, mmx_null) = 0x0000000000000000ULL; DECLARE_ASM_CONST(8, uint64_t, mmx_null) = 0x0000000000000000ULL;
DECLARE_ASM_CONST(8, uint64_t, mmx_one) = 0xFFFFFFFFFFFFFFFFULL; DECLARE_ASM_CONST(8, uint64_t, mmx_one) = 0xFFFFFFFFFFFFFFFFULL;
...@@ -123,8 +125,11 @@ DECLARE_ASM_CONST(8, uint64_t, blue_15mask) = 0x0000001f0000001fULL; ...@@ -123,8 +125,11 @@ DECLARE_ASM_CONST(8, uint64_t, blue_15mask) = 0x0000001f0000001fULL;
32-bit C version, and and&add trick by Michael Niedermayer 32-bit C version, and and&add trick by Michael Niedermayer
*/ */
#endif /* HAVE_INLINE_ASM */
void rgb2rgb_init_x86(void) void rgb2rgb_init_x86(void)
{ {
#if HAVE_INLINE_ASM
int cpu_flags = av_get_cpu_flags(); int cpu_flags = av_get_cpu_flags();
if (cpu_flags & AV_CPU_FLAG_MMX) if (cpu_flags & AV_CPU_FLAG_MMX)
...@@ -135,4 +140,5 @@ void rgb2rgb_init_x86(void) ...@@ -135,4 +140,5 @@ void rgb2rgb_init_x86(void)
rgb2rgb_init_MMX2(); rgb2rgb_init_MMX2();
if (HAVE_SSE && cpu_flags & AV_CPU_FLAG_SSE2) if (HAVE_SSE && cpu_flags & AV_CPU_FLAG_SSE2)
rgb2rgb_init_SSE2(); rgb2rgb_init_SSE2();
#endif /* HAVE_INLINE_ASM */
} }
...@@ -27,6 +27,8 @@ ...@@ -27,6 +27,8 @@
#include "libavutil/cpu.h" #include "libavutil/cpu.h"
#include "libavutil/pixdesc.h" #include "libavutil/pixdesc.h"
#if HAVE_INLINE_ASM
#define DITHER1XBPP #define DITHER1XBPP
DECLARE_ASM_CONST(8, uint64_t, bF8)= 0xF8F8F8F8F8F8F8F8LL; DECLARE_ASM_CONST(8, uint64_t, bF8)= 0xF8F8F8F8F8F8F8F8LL;
...@@ -199,6 +201,8 @@ void updateMMXDitherTables(SwsContext *c, int dstY, int lumBufIndex, int chrBufI ...@@ -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) \ #define SCALE_FUNC(filter_n, from_bpc, to_bpc, opt) \
extern void ff_hscale ## from_bpc ## to ## to_bpc ## _ ## filter_n ## _ ## opt( \ extern void ff_hscale ## from_bpc ## to ## to_bpc ## _ ## filter_n ## _ ## opt( \
SwsContext *c, int16_t *data, \ SwsContext *c, int16_t *data, \
...@@ -300,12 +304,14 @@ void ff_sws_init_swScale_mmx(SwsContext *c) ...@@ -300,12 +304,14 @@ void ff_sws_init_swScale_mmx(SwsContext *c)
{ {
int cpu_flags = av_get_cpu_flags(); int cpu_flags = av_get_cpu_flags();
#if HAVE_INLINE_ASM
if (cpu_flags & AV_CPU_FLAG_MMX) if (cpu_flags & AV_CPU_FLAG_MMX)
sws_init_swScale_MMX(c); sws_init_swScale_MMX(c);
#if HAVE_MMX2 #if HAVE_MMX2
if (cpu_flags & AV_CPU_FLAG_MMX2) if (cpu_flags & AV_CPU_FLAG_MMX2)
sws_init_swScale_MMX2(c); sws_init_swScale_MMX2(c);
#endif #endif
#endif /* HAVE_INLINE_ASM */
#if HAVE_YASM #if HAVE_YASM
#define ASSIGN_SCALE_FUNC2(hscalefn, filtersize, opt1, opt2) do { \ #define ASSIGN_SCALE_FUNC2(hscalefn, filtersize, opt1, opt2) do { \
......
...@@ -36,6 +36,8 @@ ...@@ -36,6 +36,8 @@
#include "libavutil/x86_cpu.h" #include "libavutil/x86_cpu.h"
#include "libavutil/cpu.h" #include "libavutil/cpu.h"
#if HAVE_INLINE_ASM
#define DITHER1XBPP // only for MMX #define DITHER1XBPP // only for MMX
/* hope these constant values are cache line aligned */ /* hope these constant values are cache line aligned */
...@@ -64,8 +66,11 @@ DECLARE_ASM_CONST(8, uint64_t, pb_07) = 0x0707070707070707ULL; ...@@ -64,8 +66,11 @@ DECLARE_ASM_CONST(8, uint64_t, pb_07) = 0x0707070707070707ULL;
#include "yuv2rgb_template.c" #include "yuv2rgb_template.c"
#endif /* HAVE_MMX2 */ #endif /* HAVE_MMX2 */
#endif /* HAVE_INLINE_ASM */
SwsFunc ff_yuv2rgb_init_mmx(SwsContext *c) SwsFunc ff_yuv2rgb_init_mmx(SwsContext *c)
{ {
#if HAVE_INLINE_ASM
int cpu_flags = av_get_cpu_flags(); int cpu_flags = av_get_cpu_flags();
if (c->srcFormat != PIX_FMT_YUV420P && if (c->srcFormat != PIX_FMT_YUV420P &&
...@@ -103,6 +108,7 @@ SwsFunc ff_yuv2rgb_init_mmx(SwsContext *c) ...@@ -103,6 +108,7 @@ SwsFunc ff_yuv2rgb_init_mmx(SwsContext *c)
case PIX_FMT_RGB555: return yuv420_rgb15_MMX; case PIX_FMT_RGB555: return yuv420_rgb15_MMX;
} }
} }
#endif /* HAVE_INLINE_ASM */
return NULL; return NULL;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment