Commit 8123e090 authored by Ronald S. Bultje's avatar Ronald S. Bultje Committed by Mans Rullgard

x86: place some inline asm under #if HAVE_INLINE_ASM

Signed-off-by: 's avatarMans Rullgard <mans@mansr.com>
parent 145a8096
......@@ -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 */
......@@ -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 */
}
......@@ -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 */
}
......@@ -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 */
......@@ -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 */
}
......@@ -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 */
......@@ -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 */
}
......@@ -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; \
......
......@@ -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"\
......
......@@ -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 */
......@@ -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 */
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