aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRonald S. Bultje <rsbultje@gmail.com>2012-06-22 18:46:52 +0100
committerMans Rullgard <mans@mansr.com>2012-06-25 13:23:12 +0100
commit8123e0901fc7faa3d7dcf80af9ed0d874f8e7a06 (patch)
treec974aee3e8eabea7a6a6cd3c2dc37e3a08d0f936
parent145a8096d53c20da7898539e521e6d4267ab2f09 (diff)
downloadffmpeg-8123e0901fc7faa3d7dcf80af9ed0d874f8e7a06.tar.gz
x86: place some inline asm under #if HAVE_INLINE_ASM
Signed-off-by: Mans Rullgard <mans@mansr.com>
-rw-r--r--libavcodec/x86/cabac.h3
-rw-r--r--libavcodec/x86/cavsdsp_mmx.c6
-rw-r--r--libavcodec/x86/dnxhd_mmx.c6
-rw-r--r--libavcodec/x86/h264_i386.h3
-rw-r--r--libavcodec/x86/lpc_mmx.c6
-rw-r--r--libavcodec/x86/mathops.h3
-rw-r--r--libavcodec/x86/snowdsp_mmx.c6
-rw-r--r--libavcodec/x86/vc1dsp_mmx.c6
-rw-r--r--libavutil/internal.h2
-rw-r--r--libavutil/x86/bswap.h3
-rw-r--r--libavutil/x86/intmath.h2
11 files changed, 45 insertions, 1 deletions
diff --git a/libavcodec/x86/cabac.h b/libavcodec/x86/cabac.h
index 6fc2ddb4dd..02dbc54db7 100644
--- a/libavcodec/x86/cabac.h
+++ b/libavcodec/x86/cabac.h
@@ -27,6 +27,8 @@
#include "libavutil/internal.h"
#include "config.h"
+#if HAVE_INLINE_ASM
+
#ifdef BROKEN_RELOCATIONS
#define TABLES_ARG , "r"(tables)
@@ -225,4 +227,5 @@ static av_always_inline int get_cabac_bypass_sign_x86(CABACContext *c, int val)
return val;
}
+#endif /* HAVE_INLINE_ASM */
#endif /* AVCODEC_X86_CABAC_H */
diff --git a/libavcodec/x86/cavsdsp_mmx.c b/libavcodec/x86/cavsdsp_mmx.c
index f56f85932a..b3d2c27441 100644
--- a/libavcodec/x86/cavsdsp_mmx.c
+++ b/libavcodec/x86/cavsdsp_mmx.c
@@ -29,6 +29,8 @@
#include "libavcodec/cavsdsp.h"
#include "dsputil_mmx.h"
+#if HAVE_INLINE_ASM
+
/* in/out: mma=mma+mmb, mmb=mmb-mma */
#define SUMSUB_BA( a, b ) \
"paddw "#b", "#a" \n\t"\
@@ -477,10 +479,14 @@ static void ff_cavsdsp_init_3dnow(CAVSDSPContext* c, AVCodecContext *avctx) {
c->cavs_idct8_add = cavs_idct8_add_mmx;
}
+#endif /* HAVE_INLINE_ASM */
+
void ff_cavsdsp_init_mmx(CAVSDSPContext *c, AVCodecContext *avctx)
{
int mm_flags = av_get_cpu_flags();
+#if HAVE_INLINE_ASM
if (mm_flags & AV_CPU_FLAG_MMX2) ff_cavsdsp_init_mmx2 (c, avctx);
if (mm_flags & AV_CPU_FLAG_3DNOW) ff_cavsdsp_init_3dnow(c, avctx);
+#endif /* HAVE_INLINE_ASM */
}
diff --git a/libavcodec/x86/dnxhd_mmx.c b/libavcodec/x86/dnxhd_mmx.c
index e193d62e21..54293aa280 100644
--- a/libavcodec/x86/dnxhd_mmx.c
+++ b/libavcodec/x86/dnxhd_mmx.c
@@ -24,6 +24,8 @@
#include "libavutil/x86_cpu.h"
#include "libavcodec/dnxhdenc.h"
+#if HAVE_INLINE_ASM
+
static void get_pixels_8x4_sym_sse2(DCTELEM *block, const uint8_t *pixels, int line_size)
{
__asm__ volatile(
@@ -50,10 +52,14 @@ static void get_pixels_8x4_sym_sse2(DCTELEM *block, const uint8_t *pixels, int l
);
}
+#endif /* HAVE_INLINE_ASM */
+
void ff_dnxhd_init_mmx(DNXHDEncContext *ctx)
{
+#if HAVE_INLINE_ASM
if (av_get_cpu_flags() & AV_CPU_FLAG_SSE2) {
if (ctx->cid_table->bit_depth == 8)
ctx->get_pixels_8x4_sym = get_pixels_8x4_sym_sse2;
}
+#endif /* HAVE_INLINE_ASM */
}
diff --git a/libavcodec/x86/h264_i386.h b/libavcodec/x86/h264_i386.h
index c0033b7ff3..2daa40ae52 100644
--- a/libavcodec/x86/h264_i386.h
+++ b/libavcodec/x86/h264_i386.h
@@ -34,6 +34,8 @@
#include "libavcodec/cabac.h"
#include "cabac.h"
+#if HAVE_INLINE_ASM
+
//FIXME use some macros to avoid duplicating get_cabac (cannot be done yet
//as that would make optimization work hard)
#if HAVE_7REGS
@@ -187,4 +189,5 @@ static int decode_significance_8x8_x86(CABACContext *c,
}
#endif /* HAVE_7REGS && !defined(BROKEN_RELOCATIONS) */
+#endif /* HAVE_INLINE_ASM */
#endif /* AVCODEC_X86_H264_I386_H */
diff --git a/libavcodec/x86/lpc_mmx.c b/libavcodec/x86/lpc_mmx.c
index d41c19b443..27bebe856a 100644
--- a/libavcodec/x86/lpc_mmx.c
+++ b/libavcodec/x86/lpc_mmx.c
@@ -23,6 +23,8 @@
#include "libavutil/cpu.h"
#include "libavcodec/lpc.h"
+#if HAVE_INLINE_ASM
+
static void lpc_apply_welch_window_sse2(const int32_t *data, int len,
double *w_data)
{
@@ -136,12 +138,16 @@ static void lpc_compute_autocorr_sse2(const double *data, int len, int lag,
}
}
+#endif /* HAVE_INLINE_ASM */
+
av_cold void ff_lpc_init_x86(LPCContext *c)
{
int mm_flags = av_get_cpu_flags();
+#if HAVE_INLINE_ASM
if (mm_flags & (AV_CPU_FLAG_SSE2|AV_CPU_FLAG_SSE2SLOW)) {
c->lpc_apply_welch_window = lpc_apply_welch_window_sse2;
c->lpc_compute_autocorr = lpc_compute_autocorr_sse2;
}
+#endif /* HAVE_INLINE_ASM */
}
diff --git a/libavcodec/x86/mathops.h b/libavcodec/x86/mathops.h
index 50b0283151..e056eb0a2d 100644
--- a/libavcodec/x86/mathops.h
+++ b/libavcodec/x86/mathops.h
@@ -25,6 +25,8 @@
#include "config.h"
#include "libavutil/common.h"
+#if HAVE_INLINE_ASM
+
#if ARCH_X86_32
#define MULL MULL
@@ -118,4 +120,5 @@ static inline uint32_t NEG_USR32(uint32_t a, int8_t s){
return a;
}
+#endif /* HAVE_INLINE_ASM */
#endif /* AVCODEC_X86_MATHOPS_H */
diff --git a/libavcodec/x86/snowdsp_mmx.c b/libavcodec/x86/snowdsp_mmx.c
index 729a13a4ce..38f3246fda 100644
--- a/libavcodec/x86/snowdsp_mmx.c
+++ b/libavcodec/x86/snowdsp_mmx.c
@@ -26,6 +26,8 @@
#include "libavcodec/dwt.h"
#include "dsputil_mmx.h"
+#if HAVE_INLINE_ASM
+
static void ff_snow_horizontal_compose97i_sse2(IDWTELEM *b, IDWTELEM *temp, int width){
const int w2= (width+1)>>1;
const int w_l= (width>>1);
@@ -871,8 +873,11 @@ static void ff_snow_inner_add_yblock_mmx(const uint8_t *obmc, const int obmc_str
ff_snow_inner_add_yblock(obmc, obmc_stride, block, b_w, b_h, src_x,src_y, src_stride, sb, add, dst8);
}
+#endif /* HAVE_INLINE_ASM */
+
void ff_dwt_init_x86(DWTContext *c)
{
+#if HAVE_INLINE_ASM
int mm_flags = av_get_cpu_flags();
if (mm_flags & AV_CPU_FLAG_MMX) {
@@ -893,4 +898,5 @@ void ff_dwt_init_x86(DWTContext *c)
c->inner_add_yblock = ff_snow_inner_add_yblock_mmx;
}
}
+#endif /* HAVE_INLINE_ASM */
}
diff --git a/libavcodec/x86/vc1dsp_mmx.c b/libavcodec/x86/vc1dsp_mmx.c
index e1f5145735..4e996f1ce6 100644
--- a/libavcodec/x86/vc1dsp_mmx.c
+++ b/libavcodec/x86/vc1dsp_mmx.c
@@ -30,6 +30,8 @@
#include "dsputil_mmx.h"
#include "libavcodec/vc1dsp.h"
+#if HAVE_INLINE_ASM
+
#define OP_PUT(S,D)
#define OP_AVG(S,D) "pavgb " #S ", " #D " \n\t"
@@ -682,6 +684,8 @@ static void vc1_inv_trans_8x8_dc_mmx2(uint8_t *dest, int linesize, DCTELEM *bloc
);
}
+#endif /* HAVE_INLINE_ASM */
+
#define LOOP_FILTER(EXT) \
void ff_vc1_v_loop_filter4_ ## EXT(uint8_t *src, int stride, int pq); \
void ff_vc1_h_loop_filter4_ ## EXT(uint8_t *src, int stride, int pq); \
@@ -730,6 +734,7 @@ void ff_vc1dsp_init_mmx(VC1DSPContext *dsp)
{
int mm_flags = av_get_cpu_flags();
+#if HAVE_INLINE_ASM
if (mm_flags & AV_CPU_FLAG_MMX) {
dsp->put_vc1_mspel_pixels_tab[ 0] = ff_put_vc1_mspel_mc00_mmx;
dsp->put_vc1_mspel_pixels_tab[ 4] = put_vc1_mspel_mc01_mmx;
@@ -778,6 +783,7 @@ void ff_vc1dsp_init_mmx(VC1DSPContext *dsp)
dsp->vc1_inv_trans_8x4_dc = vc1_inv_trans_8x4_dc_mmx2;
dsp->vc1_inv_trans_4x4_dc = vc1_inv_trans_4x4_dc_mmx2;
}
+#endif /* HAVE_INLINE_ASM */
#define ASSIGN_LF(EXT) \
dsp->vc1_v_loop_filter4 = ff_vc1_v_loop_filter4_ ## EXT; \
diff --git a/libavutil/internal.h b/libavutil/internal.h
index ae678d5840..41e8a9ab36 100644
--- a/libavutil/internal.h
+++ b/libavutil/internal.h
@@ -110,7 +110,7 @@ struct AVDictionary {
/* math */
-#if ARCH_X86
+#if ARCH_X86 && HAVE_INLINE_ASM
#define MASK_ABS(mask, level)\
__asm__ volatile(\
"cltd \n\t"\
diff --git a/libavutil/x86/bswap.h b/libavutil/x86/bswap.h
index c6cf007c86..c73be9af81 100644
--- a/libavutil/x86/bswap.h
+++ b/libavutil/x86/bswap.h
@@ -28,6 +28,8 @@
#include "config.h"
#include "libavutil/attributes.h"
+#if HAVE_INLINE_ASM
+
#if !AV_GCC_VERSION_AT_LEAST(4,1)
#define av_bswap16 av_bswap16
static av_always_inline av_const unsigned av_bswap16(unsigned x)
@@ -55,4 +57,5 @@ static inline uint64_t av_const av_bswap64(uint64_t x)
#endif
#endif /* !AV_GCC_VERSION_AT_LEAST(4,5) */
+#endif /* HAVE_INLINE_ASM */
#endif /* AVUTIL_X86_BSWAP_H */
diff --git a/libavutil/x86/intmath.h b/libavutil/x86/intmath.h
index a7e82b1340..b23c0f1bd0 100644
--- a/libavutil/x86/intmath.h
+++ b/libavutil/x86/intmath.h
@@ -21,6 +21,7 @@
#ifndef AVUTIL_X86_INTMATH_H
#define AVUTIL_X86_INTMATH_H
+#if HAVE_INLINE_ASM
#define FASTDIV(a,b) \
({\
int ret, dmy;\
@@ -31,5 +32,6 @@
);\
ret;\
})
+#endif
#endif /* AVUTIL_X86_INTMATH_H */