Commit 17337f54 authored by Diego Biurrun's avatar Diego Biurrun

x86: Split inline and external assembly #ifdefs

parent 43b73d59
......@@ -85,7 +85,7 @@ static const struct algo fdct_tab[] = {
{ "IJG-AAN-INT", ff_fdct_ifast, SCALE_PERM },
{ "IJG-LLM-INT", ff_jpeg_fdct_islow_8, NO_PERM },
#if HAVE_MMX && HAVE_INLINE_ASM
#if HAVE_MMX_INLINE
{ "MMX", ff_fdct_mmx, NO_PERM, AV_CPU_FLAG_MMX },
{ "MMXEXT", ff_fdct_mmx2, NO_PERM, AV_CPU_FLAG_MMXEXT },
{ "SSE2", ff_fdct_sse2, NO_PERM, AV_CPU_FLAG_SSE2 },
......@@ -108,7 +108,7 @@ static const struct algo idct_tab[] = {
{ "INT", ff_j_rev_dct, MMX_PERM },
{ "SIMPLE-C", ff_simple_idct_8, NO_PERM },
#if HAVE_MMX && HAVE_INLINE_ASM
#if HAVE_MMX_INLINE
{ "SIMPLE-MMX", ff_simple_idct_mmx, MMX_SIMPLE_PERM, AV_CPU_FLAG_MMX },
{ "XVID-MMX", ff_idct_xvid_mmx, NO_PERM, AV_CPU_FLAG_MMX, 1 },
{ "XVID-MMXEXT", ff_idct_xvid_mmx2, NO_PERM, AV_CPU_FLAG_MMXEXT, 1 },
......
......@@ -39,7 +39,7 @@
#include "libavutil/pixdesc.h"
#include "libavutil/imgutils.h"
#if HAVE_MMX && HAVE_YASM
#if HAVE_MMX_EXTERNAL
#include "x86/dsputil_mmx.h"
#endif
......@@ -52,7 +52,7 @@
#define FF_PIXEL_PACKED 1 /**< only one components containing all the channels */
#define FF_PIXEL_PALETTE 2 /**< one components containing indexes for a palette */
#if HAVE_MMX && HAVE_YASM
#if HAVE_MMX_EXTERNAL
#define deinterlace_line_inplace ff_deinterlace_line_inplace_mmx
#define deinterlace_line ff_deinterlace_line_mmx
#else
......@@ -877,7 +877,7 @@ int av_picture_pad(AVPicture *dst, const AVPicture *src, int height, int width,
return 0;
}
#if !(HAVE_MMX && HAVE_YASM)
#if !HAVE_MMX_EXTERNAL
/* filter parameters: [-1 4 2 4 -1] // 8 */
static void deinterlace_line_c(uint8_t *dst,
const uint8_t *lum_m4, const uint8_t *lum_m3,
......@@ -926,7 +926,7 @@ static void deinterlace_line_inplace_c(uint8_t *lum_m4, uint8_t *lum_m3,
lum++;
}
}
#endif
#endif /* !HAVE_MMX_EXTERNAL */
/* deinterlacing : 2 temporal taps, 3 spatial taps linear filter. The
top field is copied as is, but the bottom field is deinterlaced
......
......@@ -73,7 +73,7 @@ AC3_EXPONENT_MIN mmx
%define LOOP_ALIGN ALIGN 16
AC3_EXPONENT_MIN mmxext
%endif
%if HAVE_SSE
%if HAVE_SSE2_EXTERNAL
INIT_XMM
AC3_EXPONENT_MIN sse2
%endif
......@@ -385,7 +385,7 @@ cglobal ac3_compute_mantissa_size_sse2, 1,2,4, mant_cnt, sum
pabsd %1, %1
%endmacro
%if HAVE_AMD3DNOW
%if HAVE_AMD3DNOW_EXTERNAL
INIT_MMX
cglobal ac3_extract_exponents_3dnow, 3,3,0, exp, coef, len
add expq, lenq
......@@ -453,11 +453,11 @@ cglobal ac3_extract_exponents_%1, 3,3,4, exp, coef, len
REP_RET
%endmacro
%if HAVE_SSE
%if HAVE_SSE2_EXTERNAL
INIT_XMM
%define PABSD PABSD_MMX
AC3_EXTRACT_EXPONENTS sse2
%if HAVE_SSSE3
%if HAVE_SSSE3_EXTERNAL
%define PABSD PABSD_SSSE3
AC3_EXTRACT_EXPONENTS ssse3
%endif
......
......@@ -193,7 +193,7 @@ ps_p1p1m1m1: dd 0, 0, 0x80000000, 0x80000000, 0, 0, 0x80000000, 0x80000000
INIT_YMM avx
SECTION_TEXT
%if HAVE_AVX
%if HAVE_AVX_EXTERNAL
; void ff_dct32_float_avx(FFTSample *out, const FFTSample *in)
cglobal dct32_float, 2,3,8, out, in, tmp
; pass 1
......
......@@ -1169,7 +1169,7 @@ ALIGN 16
INIT_XMM sse
VECTOR_FMUL_REVERSE
%if HAVE_AVX
%if HAVE_AVX_EXTERNAL
INIT_YMM avx
VECTOR_FMUL_REVERSE
%endif
......@@ -1199,7 +1199,7 @@ ALIGN 16
INIT_XMM sse
VECTOR_FMUL_ADD
%if HAVE_AVX
%if HAVE_AVX_EXTERNAL
INIT_YMM avx
VECTOR_FMUL_ADD
%endif
......@@ -1245,7 +1245,7 @@ cglobal butterflies_float_interleave, 4,4,3, dst, src0, src1, len
INIT_XMM sse
BUTTERFLIES_FLOAT_INTERLEAVE
%if HAVE_AVX
%if HAVE_AVX_EXTERNAL
INIT_YMM avx
BUTTERFLIES_FLOAT_INTERLEAVE
%endif
......
......@@ -2812,7 +2812,7 @@ static void dsputil_init_3dnow(DSPContext *c, AVCodecContext *avctx,
static void dsputil_init_3dnowext(DSPContext *c, AVCodecContext *avctx,
int mm_flags)
{
#if HAVE_6REGS && HAVE_INLINE_ASM
#if HAVE_AMD3DNOWEXT_INLINE && HAVE_6REGS
c->vector_fmul_window = vector_fmul_window_3dnowext;
#endif
}
......@@ -2926,11 +2926,10 @@ static void dsputil_init_sse2(DSPContext *c, AVCodecContext *avctx,
static void dsputil_init_ssse3(DSPContext *c, AVCodecContext *avctx,
int mm_flags)
{
#if HAVE_SSSE3
const int high_bit_depth = avctx->bits_per_raw_sample > 8;
const int bit_depth = avctx->bits_per_raw_sample;
#if HAVE_INLINE_ASM
#if HAVE_SSSE3_INLINE
if (!high_bit_depth && CONFIG_H264QPEL) {
H264_QPEL_FUNCS(1, 0, ssse3);
H264_QPEL_FUNCS(1, 1, ssse3);
......@@ -2945,8 +2944,9 @@ static void dsputil_init_ssse3(DSPContext *c, AVCodecContext *avctx,
H264_QPEL_FUNCS(3, 2, ssse3);
H264_QPEL_FUNCS(3, 3, ssse3);
}
#endif /* HAVE_INLINE_ASM */
#if HAVE_YASM
#endif /* HAVE_SSSE3_INLINE */
#if HAVE_SSSE3_EXTERNAL
if (bit_depth == 10 && CONFIG_H264QPEL) {
H264_QPEL_FUNCS_10(1, 0, ssse3_cache64);
H264_QPEL_FUNCS_10(2, 0, ssse3_cache64);
......@@ -2969,21 +2969,20 @@ static void dsputil_init_ssse3(DSPContext *c, AVCodecContext *avctx,
if (!(mm_flags & (AV_CPU_FLAG_SSE42|AV_CPU_FLAG_3DNOW))) // cachesplit
c->scalarproduct_and_madd_int16 = ff_scalarproduct_and_madd_int16_ssse3;
c->bswap_buf = ff_bswap32_buf_ssse3;
#endif
#endif
#endif /* HAVE_SSSE3_EXTERNAL */
}
static void dsputil_init_sse4(DSPContext *c, AVCodecContext *avctx,
int mm_flags)
{
#if HAVE_YASM
#if HAVE_SSE4_EXTERNAL
c->vector_clip_int32 = ff_vector_clip_int32_sse4;
#endif
#endif /* HAVE_SSE4_EXTERNAL */
}
static void dsputil_init_avx(DSPContext *c, AVCodecContext *avctx, int mm_flags)
{
#if HAVE_AVX && HAVE_YASM
#if HAVE_AVX_EXTERNAL
const int bit_depth = avctx->bits_per_raw_sample;
if (bit_depth == 10) {
......@@ -3003,7 +3002,7 @@ static void dsputil_init_avx(DSPContext *c, AVCodecContext *avctx, int mm_flags)
c->butterflies_float_interleave = ff_butterflies_float_interleave_avx;
c->vector_fmul_reverse = ff_vector_fmul_reverse_avx;
c->vector_fmul_add = ff_vector_fmul_add_avx;
#endif
#endif /* HAVE_AVX_EXTERNAL */
}
void ff_dsputil_init_mmx(DSPContext *c, AVCodecContext *avctx)
......
......@@ -982,7 +982,7 @@ DCT_SAD_FUNC(mmx2)
DCT_SAD_FUNC(sse2)
#undef MMABS
#if HAVE_SSSE3
#if HAVE_SSSE3_INLINE
#define MMABS(a,z) MMABS_SSSE3(a,z)
DCT_SAD_FUNC(ssse3)
#undef MMABS
......@@ -1062,7 +1062,7 @@ static int ssd_int8_vs_int16_mmx(const int8_t *pix1, const int16_t *pix2, int si
#undef SCALE_OFFSET
#undef PMULHRW
#if HAVE_SSSE3
#if HAVE_SSSE3_INLINE
#undef PHADDD
#define DEF(x) x ## _ssse3
#define SET_RND(x)
......@@ -1081,7 +1081,7 @@ static int ssd_int8_vs_int16_mmx(const int8_t *pix1, const int16_t *pix2, int si
#undef SCALE_OFFSET
#undef PMULHRW
#undef PHADDD
#endif //HAVE_SSSE3
#endif /* HAVE_SSSE3_INLINE */
#endif /* HAVE_INLINE_ASM */
......@@ -1161,7 +1161,7 @@ void ff_dsputilenc_init_mmx(DSPContext* c, AVCodecContext *avctx)
c->sum_abs_dctelem= sum_abs_dctelem_sse2;
}
#if HAVE_SSSE3
#if HAVE_SSSE3_INLINE
if(mm_flags & AV_CPU_FLAG_SSSE3){
if(!(avctx->flags & CODEC_FLAG_BITEXACT)){
c->try_8x8basis= try_8x8basis_ssse3;
......
......@@ -305,7 +305,7 @@ IF%1 mova Z(1), m5
INIT_YMM avx
%if HAVE_AVX
%if HAVE_AVX_EXTERNAL
align 16
fft8_avx:
mova m0, Z(0)
......@@ -552,7 +552,7 @@ DEFINE_ARGS zc, w, n, o1, o3
INIT_YMM avx
%if HAVE_AVX
%if HAVE_AVX_EXTERNAL
%macro INTERL_AVX 5
vunpckhps %3, %2, %1
vunpcklps %2, %2, %1
......@@ -793,7 +793,7 @@ align 8
dispatch_tab %+ fullsuffix: pointer list_of_fft
%endmacro ; DECL_FFT
%if HAVE_AVX
%if HAVE_AVX_EXTERNAL
INIT_YMM avx
DECL_FFT 6
DECL_FFT 6, _interleave
......@@ -1100,6 +1100,6 @@ DECL_IMDCT POSROTATESHUF_3DNOW
INIT_YMM avx
%if HAVE_AVX
%if HAVE_AVX_EXTERNAL
DECL_IMDCT POSROTATESHUF_AVX
%endif
......@@ -252,7 +252,7 @@ cglobal %1_h264_chroma_mc2_10, 6,7
%define CHROMAMC_AVG NOTHING
INIT_XMM sse2
CHROMA_MC8 put
%if HAVE_AVX
%if HAVE_AVX_EXTERNAL
INIT_XMM avx
CHROMA_MC8 put
%endif
......@@ -264,7 +264,7 @@ CHROMA_MC2 put
%define PAVG pavgw
INIT_XMM sse2
CHROMA_MC8 avg
%if HAVE_AVX
%if HAVE_AVX_EXTERNAL
INIT_XMM avx
CHROMA_MC8 avg
%endif
......
......@@ -80,7 +80,7 @@ cglobal h264_idct_add_10, 3,3
INIT_XMM sse2
IDCT_ADD_10
%if HAVE_AVX
%if HAVE_AVX_EXTERNAL
INIT_XMM avx
IDCT_ADD_10
%endif
......@@ -110,7 +110,7 @@ add4x4_idct %+ SUFFIX:
INIT_XMM sse2
ALIGN 16
ADD4x4IDCT
%if HAVE_AVX
%if HAVE_AVX_EXTERNAL
INIT_XMM avx
ALIGN 16
ADD4x4IDCT
......@@ -150,7 +150,7 @@ cglobal h264_idct_add16_10, 5,6
INIT_XMM sse2
IDCT_ADD16_10
%if HAVE_AVX
%if HAVE_AVX_EXTERNAL
INIT_XMM avx
IDCT_ADD16_10
%endif
......@@ -216,7 +216,7 @@ cglobal h264_idct8_dc_add_10,3,3,7
INIT_XMM sse2
IDCT8_DC_ADD
%if HAVE_AVX
%if HAVE_AVX_EXTERNAL
INIT_XMM avx
IDCT8_DC_ADD
%endif
......@@ -287,7 +287,7 @@ cglobal h264_idct_add16intra_10,5,7,8
INIT_XMM sse2
IDCT_ADD16INTRA_10
%if HAVE_AVX
%if HAVE_AVX_EXTERNAL
INIT_XMM avx
IDCT_ADD16INTRA_10
%endif
......@@ -324,7 +324,7 @@ cglobal h264_idct_add8_10,5,8,7
INIT_XMM sse2
IDCT_ADD8
%if HAVE_AVX
%if HAVE_AVX_EXTERNAL
INIT_XMM avx
IDCT_ADD8
%endif
......@@ -501,7 +501,7 @@ h264_idct8_add1_10 %+ SUFFIX:
INIT_XMM sse2
IDCT8_ADD
%if HAVE_AVX
%if HAVE_AVX_EXTERNAL
INIT_XMM avx
IDCT8_ADD
%endif
......@@ -541,7 +541,7 @@ cglobal h264_idct8_add4_10, 0,7,16
INIT_XMM sse2
IDCT8_ADD4
%if HAVE_AVX
%if HAVE_AVX_EXTERNAL
INIT_XMM avx
IDCT8_ADD4
%endif
......@@ -84,7 +84,7 @@ INIT_XMM
PRED4x4_DR sse2
%define PALIGNR PALIGNR_SSSE3
PRED4x4_DR ssse3
%if HAVE_AVX
%if HAVE_AVX_EXTERNAL
INIT_AVX
PRED4x4_DR avx
%endif
......@@ -124,7 +124,7 @@ INIT_XMM
PRED4x4_VR sse2
%define PALIGNR PALIGNR_SSSE3
PRED4x4_VR ssse3
%if HAVE_AVX
%if HAVE_AVX_EXTERNAL
INIT_AVX
PRED4x4_VR avx
%endif
......@@ -167,7 +167,7 @@ INIT_XMM
PRED4x4_HD sse2
%define PALIGNR PALIGNR_SSSE3
PRED4x4_HD ssse3
%if HAVE_AVX
%if HAVE_AVX_EXTERNAL
INIT_AVX
PRED4x4_HD avx
%endif
......@@ -238,7 +238,7 @@ cglobal pred4x4_down_left_10_%1, 3,3
INIT_XMM
PRED4x4_DL sse2
%if HAVE_AVX
%if HAVE_AVX_EXTERNAL
INIT_AVX
PRED4x4_DL avx
%endif
......@@ -267,7 +267,7 @@ cglobal pred4x4_vertical_left_10_%1, 3,3
INIT_XMM
PRED4x4_VL sse2
%if HAVE_AVX
%if HAVE_AVX_EXTERNAL
INIT_AVX
PRED4x4_VL avx
%endif
......@@ -577,7 +577,7 @@ cglobal pred8x8l_top_dc_10_%1, 4,4,6
INIT_XMM
PRED8x8L_TOP_DC sse2
%if HAVE_AVX
%if HAVE_AVX_EXTERNAL
INIT_AVX
PRED8x8L_TOP_DC avx
%endif
......@@ -636,7 +636,7 @@ cglobal pred8x8l_dc_10_%1, 4,6,6
INIT_XMM
PRED8x8L_DC sse2
%if HAVE_AVX
%if HAVE_AVX_EXTERNAL
INIT_AVX
PRED8x8L_DC avx
%endif
......@@ -671,7 +671,7 @@ cglobal pred8x8l_vertical_10_%1, 4,4,6
INIT_XMM
PRED8x8L_VERTICAL sse2
%if HAVE_AVX
%if HAVE_AVX_EXTERNAL
INIT_AVX
PRED8x8L_VERTICAL avx
%endif
......@@ -728,7 +728,7 @@ INIT_XMM
PRED8x8L_HORIZONTAL sse2
%define PALIGNR PALIGNR_SSSE3
PRED8x8L_HORIZONTAL ssse3
%if HAVE_AVX
%if HAVE_AVX_EXTERNAL
INIT_AVX
PRED8x8L_HORIZONTAL avx
%endif
......@@ -797,7 +797,7 @@ INIT_XMM
PRED8x8L_DOWN_LEFT sse2
%define PALIGNR PALIGNR_SSSE3
PRED8x8L_DOWN_LEFT ssse3
%if HAVE_AVX
%if HAVE_AVX_EXTERNAL
INIT_AVX
PRED8x8L_DOWN_LEFT avx
%endif
......@@ -872,7 +872,7 @@ INIT_XMM
PRED8x8L_DOWN_RIGHT sse2
%define PALIGNR PALIGNR_SSSE3
PRED8x8L_DOWN_RIGHT ssse3
%if HAVE_AVX
%if HAVE_AVX_EXTERNAL
INIT_AVX
PRED8x8L_DOWN_RIGHT avx
%endif
......@@ -943,7 +943,7 @@ INIT_XMM
PRED8x8L_VERTICAL_RIGHT sse2
%define PALIGNR PALIGNR_SSSE3
PRED8x8L_VERTICAL_RIGHT ssse3
%if HAVE_AVX
%if HAVE_AVX_EXTERNAL
INIT_AVX
PRED8x8L_VERTICAL_RIGHT avx
%endif
......@@ -1005,7 +1005,7 @@ INIT_XMM
PRED8x8L_HORIZONTAL_UP sse2
%define PALIGNR PALIGNR_SSSE3
PRED8x8L_HORIZONTAL_UP ssse3
%if HAVE_AVX
%if HAVE_AVX_EXTERNAL
INIT_AVX
PRED8x8L_HORIZONTAL_UP avx
%endif
......
......@@ -1174,7 +1174,7 @@ QPEL_H264_V_XMM(put_, PUT_OP, sse2)
QPEL_H264_V_XMM(avg_, AVG_MMX2_OP, sse2)
QPEL_H264_HV_XMM(put_, PUT_OP, sse2)
QPEL_H264_HV_XMM(avg_, AVG_MMX2_OP, sse2)
#if HAVE_SSSE3
#if HAVE_SSSE3_INLINE
QPEL_H264_H_XMM(put_, PUT_OP, ssse3)
QPEL_H264_H_XMM(avg_, AVG_MMX2_OP, ssse3)
QPEL_H264_HV2_XMM(put_, PUT_OP, ssse3)
......@@ -1188,7 +1188,7 @@ H264_MC_4816(3dnow)
H264_MC_4816(mmx2)
H264_MC_816(H264_MC_V, sse2)
H264_MC_816(H264_MC_HV, sse2)
#if HAVE_SSSE3
#if HAVE_SSSE3_INLINE
H264_MC_816(H264_MC_H, ssse3)
H264_MC_816(H264_MC_HV, ssse3)
#endif
......
......@@ -39,7 +39,7 @@ IDCT_ADD_FUNC(8_dc, 10, sse2)
IDCT_ADD_FUNC(8, 8, mmx)
IDCT_ADD_FUNC(8, 8, sse2)
IDCT_ADD_FUNC(8, 10, sse2)
#if HAVE_AVX
#if HAVE_AVX_EXTERNAL
IDCT_ADD_FUNC(, 10, avx)
IDCT_ADD_FUNC(8_dc, 10, avx)
IDCT_ADD_FUNC(8, 10, avx)
......@@ -64,7 +64,7 @@ IDCT_ADD_REP_FUNC(, 16intra, 8, mmx)
IDCT_ADD_REP_FUNC(, 16intra, 8, mmx2)
IDCT_ADD_REP_FUNC(, 16intra, 8, sse2)
IDCT_ADD_REP_FUNC(, 16intra, 10, sse2)
#if HAVE_AVX
#if HAVE_AVX_EXTERNAL
IDCT_ADD_REP_FUNC(, 16, 10, avx)
IDCT_ADD_REP_FUNC(, 16intra, 10, avx)
#endif
......@@ -79,7 +79,7 @@ IDCT_ADD_REP_FUNC2(, 8, 8, mmx)
IDCT_ADD_REP_FUNC2(, 8, 8, mmx2)
IDCT_ADD_REP_FUNC2(, 8, 8, sse2)
IDCT_ADD_REP_FUNC2(, 8, 10, sse2)
#if HAVE_AVX
#if HAVE_AVX_EXTERNAL
IDCT_ADD_REP_FUNC2(, 8, 10, avx)
#endif
......@@ -353,7 +353,7 @@ void ff_h264dsp_init_x86(H264DSPContext *c, const int bit_depth,
c->biweight_h264_pixels_tab[1] = ff_h264_biweight_8_10_sse4;
c->biweight_h264_pixels_tab[2] = ff_h264_biweight_4_10_sse4;
}
#if HAVE_AVX
#if HAVE_AVX_EXTERNAL
if (mm_flags & AV_CPU_FLAG_AVX) {
c->h264_idct_dc_add =
c->h264_idct_add = ff_h264_idct_add_10_avx;
......@@ -377,7 +377,7 @@ void ff_h264dsp_init_x86(H264DSPContext *c, const int bit_depth,
c->h264_h_loop_filter_luma_intra = ff_deblock_h_luma_intra_10_avx;
#endif /* HAVE_ALIGNED_STACK */
}
#endif /* HAVE_AVX */
#endif /* HAVE_AVX_EXTERNAL */
}
}
}
......
......@@ -26,20 +26,18 @@
#include "libavcodec/mpegvideo.h"
#include "dsputil_mmx.h"
#if HAVE_INLINE_ASM
extern uint16_t ff_inv_zigzag_direct16[64];
#if HAVE_MMX
#if HAVE_MMX_INLINE
#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"
#endif /* HAVE_MMX */
#endif /* HAVE_MMX_INLINE */
#if HAVE_MMXEXT
#if HAVE_MMXEXT_INLINE
#undef COMPILE_TEMPLATE_SSSE3
#undef COMPILE_TEMPLATE_SSE2
#undef COMPILE_TEMPLATE_MMXEXT
......@@ -51,9 +49,9 @@ extern uint16_t ff_inv_zigzag_direct16[64];
#define RENAME(a) a ## _MMX2
#define RENAMEl(a) a ## _mmx2
#include "mpegvideoenc_template.c"
#endif /* HAVE_MMXEXT */
#endif /* HAVE_MMXEXT_INLINE */
#if HAVE_SSE2
#if HAVE_SSE2_INLINE
#undef COMPILE_TEMPLATE_MMXEXT
#undef COMPILE_TEMPLATE_SSE2
#undef COMPILE_TEMPLATE_SSSE3
......@@ -65,9 +63,9 @@ extern uint16_t ff_inv_zigzag_direct16[64];
#define RENAME(a) a ## _SSE2
#define RENAMEl(a) a ## _sse2
#include "mpegvideoenc_template.c"
#endif /* HAVE_SSE2 */
#endif /* HAVE_SSE2_INLINE */
#if HAVE_SSSE3
#if HAVE_SSSE3_INLINE
#undef COMPILE_TEMPLATE_MMXEXT
#undef COMPILE_TEMPLATE_SSE2
#undef COMPILE_TEMPLATE_SSSE3
......@@ -79,33 +77,29 @@ extern uint16_t ff_inv_zigzag_direct16[64];
#define RENAME(a) a ## _SSSE3
#define RENAMEl(a) a ## _sse2
#include "mpegvideoenc_template.c"
#endif /* HAVE_SSSE3 */
#endif /* HAVE_INLINE_ASM */
#endif /* HAVE_SSSE3_INLINE */
void ff_MPV_encode_init_x86(MpegEncContext *s)
{
#if HAVE_INLINE_ASM
int mm_flags = av_get_cpu_flags();
const int dct_algo = s->avctx->dct_algo;
if (dct_algo == FF_DCT_AUTO || dct_algo == FF_DCT_MMX) {
#if HAVE_MMX
#if HAVE_MMX_INLINE
if (mm_flags & AV_CPU_FLAG_MMX && HAVE_MMX)
s->dct_quantize = dct_quantize_MMX;
#endif
#if HAVE_MMXEXT
#if HAVE_MMXEXT_INLINE
if (mm_flags & AV_CPU_FLAG_MMXEXT && HAVE_MMXEXT)
s->dct_quantize = dct_quantize_MMX2;
#endif
#if HAVE_SSE2
#if HAVE_SSE2_INLINE
if (mm_flags & AV_CPU_FLAG_SSE2 && HAVE_SSE2)
s->dct_quantize = dct_quantize_SSE2;
#endif
#if HAVE_SSSE3
#if HAVE_SSSE3_INLINE
if (mm_flags & AV_CPU_FLAG_SSSE3)
s->dct_quantize = dct_quantize_SSSE3;
#endif
}
#endif /* HAVE_INLINE_ASM */
}
......@@ -29,7 +29,7 @@
DECLARE_ALIGNED(16, static const uint16_t, pw_7f)[8] = {0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F};
DECLARE_ALIGNED(16, static const uint16_t, pw_ff)[8] = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF};
#if HAVE_MMXEXT
#if HAVE_MMXEXT_INLINE
static void gradfun_filter_line_mmx2(uint8_t *dst, uint8_t *src, uint16_t *dc, int width, int thresh, const uint16_t *dithers)
{
intptr_t x;
......@@ -77,7 +77,7 @@ static void gradfun_filter_line_mmx2(uint8_t *dst, uint8_t *src, uint16_t *dc, i
}
#endif
#if HAVE_SSSE3
#if HAVE_SSSE3_INLINE
static void gradfun_filter_line_ssse3(uint8_t *dst, uint8_t *src, uint16_t *dc, int width, int thresh, const uint16_t *dithers)
{
intptr_t x;
......@@ -122,9 +122,9 @@ static void gradfun_filter_line_ssse3(uint8_t *dst, uint8_t *src, uint16_t *dc,
:"memory"
);
}
#endif // HAVE_SSSE3
#endif /* HAVE_SSSE3_INLINE */
#if HAVE_SSE
#if HAVE_SSE2_INLINE
static void gradfun_blur_line_sse2(uint16_t *dc, uint16_t *buf, uint16_t *buf1, uint8_t *src, int src_linesize, int width)
{
#define BLURV(load)\
......@@ -165,7 +165,7 @@ static void gradfun_blur_line_sse2(uint16_t *dc, uint16_t *buf, uint16_t *buf1,
BLURV("movdqa");
}
}
#endif // HAVE_SSE
#endif /* HAVE_SSE2_INLINE */
#endif /* HAVE_INLINE_ASM */
......@@ -173,18 +173,16 @@ av_cold void ff_gradfun_init_x86(GradFunContext *gf)
{
int cpu_flags = av_get_cpu_flags();
#if HAVE_INLINE_ASM
#if HAVE_MMXEXT
#if HAVE_MMXEXT_INLINE
if (cpu_flags & AV_CPU_FLAG_MMXEXT)
gf->filter_line = gradfun_filter_line_mmx2;
#endif
#if HAVE_SSSE3
#if HAVE_SSSE3_INLINE
if (cpu_flags & AV_CPU_FLAG_SSSE3)
gf->filter_line = gradfun_filter_line_ssse3;
#endif
#if HAVE_SSE
#if HAVE_SSE2_INLINE
if (cpu_flags & AV_CPU_FLAG_SSE2)
gf->blur_line = gradfun_blur_line_sse2;
#endif
#endif /* HAVE_INLINE_ASM */
}
......@@ -31,7 +31,7 @@
DECLARE_ASM_CONST(16, const xmm_reg, pb_1) = {0x0101010101010101ULL, 0x0101010101010101ULL};
DECLARE_ASM_CONST(16, const xmm_reg, pw_1) = {0x0001000100010001ULL, 0x0001000100010001ULL};
#if HAVE_SSSE3
#if HAVE_SSSE3_INLINE
#define COMPILE_TEMPLATE_SSE2 1
#define COMPILE_TEMPLATE_SSSE3 1
#undef RENAME
......@@ -40,14 +40,14 @@ DECLARE_ASM_CONST(16, const xmm_reg, pw_1) = {0x0001000100010001ULL, 0x000100010
#undef COMPILE_TEMPLATE_SSSE3
#endif
#if HAVE_SSE
#if HAVE_SSE2_INLINE
#undef RENAME
#define RENAME(a) a ## _sse2
#include "yadif_template.c"
#undef COMPILE_TEMPLATE_SSE2
#endif
#if HAVE_MMXEXT
#if HAVE_MMXEXT_INLINE
#undef RENAME
#define RENAME(a) a ## _mmx2
#include "yadif_template.c"
......@@ -59,18 +59,16 @@ av_cold void ff_yadif_init_x86(YADIFContext *yadif)
{
int cpu_flags = av_get_cpu_flags();
#if HAVE_INLINE_ASM
#if HAVE_MMXEXT
#if HAVE_MMXEXT_INLINE
if (cpu_flags & AV_CPU_FLAG_MMXEXT)
yadif->filter_line = yadif_filter_line_mmx2;
#endif
#if HAVE_SSE
#if HAVE_SSE2_INLINE
if (cpu_flags & AV_CPU_FLAG_SSE2)
yadif->filter_line = yadif_filter_line_sse2;
#endif
#if HAVE_SSSE3
#if HAVE_SSSE3_INLINE
if (cpu_flags & AV_CPU_FLAG_SSSE3)
yadif->filter_line = yadif_filter_line_ssse3;
#endif
#endif /* HAVE_INLINE_ASM */
}
......@@ -155,7 +155,7 @@ cglobal conv_s32_to_flt, 3,3,3, dst, src, len
INIT_XMM sse2
CONV_S32_TO_FLT
%if HAVE_AVX
%if HAVE_AVX_EXTERNAL
INIT_YMM avx
CONV_S32_TO_FLT
%endif
......@@ -223,7 +223,7 @@ cglobal conv_flt_to_s32, 3,3,5, dst, src, len
INIT_XMM sse2
CONV_FLT_TO_S32
%if HAVE_AVX
%if HAVE_AVX_EXTERNAL
INIT_YMM avx
CONV_FLT_TO_S32
%endif
......@@ -260,7 +260,7 @@ cglobal conv_s16p_to_s16_2ch, 3,4,5, dst, src0, len, src1
INIT_XMM sse2
CONV_S16P_TO_S16_2CH
%if HAVE_AVX
%if HAVE_AVX_EXTERNAL
INIT_XMM avx
CONV_S16P_TO_S16_2CH
%endif
......@@ -383,7 +383,7 @@ INIT_XMM sse2
CONV_S16P_TO_S16_6CH
INIT_XMM sse2slow
CONV_S16P_TO_S16_6CH
%if HAVE_AVX
%if HAVE_AVX_EXTERNAL
INIT_XMM avx
CONV_S16P_TO_S16_6CH
%endif
......@@ -432,7 +432,7 @@ cglobal conv_s16p_to_flt_2ch, 3,4,6, dst, src0, len, src1
INIT_XMM sse2
CONV_S16P_TO_FLT_2CH
%if HAVE_AVX
%if HAVE_AVX_EXTERNAL
INIT_XMM avx
CONV_S16P_TO_FLT_2CH
%endif
......@@ -536,7 +536,7 @@ INIT_XMM sse2
CONV_S16P_TO_FLT_6CH
INIT_XMM ssse3
CONV_S16P_TO_FLT_6CH
%if HAVE_AVX
%if HAVE_AVX_EXTERNAL
INIT_XMM avx
CONV_S16P_TO_FLT_6CH
%endif
......@@ -692,7 +692,7 @@ INIT_MMX sse
CONV_FLTP_TO_S16_6CH