aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-09-09 13:27:42 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-09-09 13:27:42 +0200
commit77aedc77abbe21f2c28052544a0b2f227bca1c77 (patch)
tree78e2b3d349105d6f73cd5f811e5374bca4bbcb94 /libavcodec
parent4819d43d7f0e220b231699e0ac7b0dc906b3147c (diff)
parent75c37c5ace6271dc9dc996a61b799bcd2fc1b30d (diff)
downloadffmpeg-77aedc77abbe21f2c28052544a0b2f227bca1c77.tar.gz
Merge remote-tracking branch 'qatar/master'
* qatar/master: swscale: Provide the right alignment for external mmx asm x86: Replace checks for CPU extensions and flags by convenience macros configure: msvc: fix/simplify setting of flags for hostcc x86: mlpdsp: mlp_filter_channel_x86 requires inline asm Conflicts: libavcodec/x86/fft_init.c libavcodec/x86/h264_intrapred_init.c libavcodec/x86/h264dsp_init.c libavcodec/x86/mpegaudiodec.c libavcodec/x86/proresdsp_init.c libavutil/x86/float_dsp_init.c libswscale/utils.c libswscale/x86/swscale.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/x86/ac3dsp_init.c15
-rw-r--r--libavcodec/x86/dsputilenc_mmx.c13
-rw-r--r--libavcodec/x86/fft_init.c19
-rw-r--r--libavcodec/x86/fmtconvert_init.c11
-rw-r--r--libavcodec/x86/h264_intrapred_init.c21
-rw-r--r--libavcodec/x86/h264dsp_init.c29
-rw-r--r--libavcodec/x86/mlpdsp.c6
-rw-r--r--libavcodec/x86/mpegaudiodec.c16
-rw-r--r--libavcodec/x86/mpegvideoenc.c9
-rw-r--r--libavcodec/x86/pngdsp_init.c12
-rw-r--r--libavcodec/x86/proresdsp_init.c11
-rw-r--r--libavcodec/x86/rv34dsp_init.c9
-rw-r--r--libavcodec/x86/rv40dsp_init.c11
-rw-r--r--libavcodec/x86/sbrdsp_init.c11
-rw-r--r--libavcodec/x86/vp3dsp_init.c9
-rw-r--r--libavcodec/x86/vp56dsp_init.c7
16 files changed, 95 insertions, 114 deletions
diff --git a/libavcodec/x86/ac3dsp_init.c b/libavcodec/x86/ac3dsp_init.c
index cf1d7db8a4..516a6adb19 100644
--- a/libavcodec/x86/ac3dsp_init.c
+++ b/libavcodec/x86/ac3dsp_init.c
@@ -20,6 +20,7 @@
*/
#include "libavutil/x86/asm.h"
+#include "libavutil/x86/cpu.h"
#include "dsputil_mmx.h"
#include "libavcodec/ac3dsp.h"
@@ -50,29 +51,28 @@ extern void ff_ac3_extract_exponents_ssse3(uint8_t *exp, int32_t *coef, int nb_c
av_cold void ff_ac3dsp_init_x86(AC3DSPContext *c, int bit_exact)
{
-#if HAVE_YASM
int mm_flags = av_get_cpu_flags();
- if (mm_flags & AV_CPU_FLAG_MMX) {
+ if (EXTERNAL_MMX(mm_flags)) {
c->ac3_exponent_min = ff_ac3_exponent_min_mmx;
c->ac3_max_msb_abs_int16 = ff_ac3_max_msb_abs_int16_mmx;
c->ac3_lshift_int16 = ff_ac3_lshift_int16_mmx;
c->ac3_rshift_int32 = ff_ac3_rshift_int32_mmx;
}
- if (mm_flags & AV_CPU_FLAG_3DNOW && HAVE_AMD3DNOW) {
+ if (EXTERNAL_AMD3DNOW(mm_flags)) {
c->extract_exponents = ff_ac3_extract_exponents_3dnow;
if (!bit_exact) {
c->float_to_fixed24 = ff_float_to_fixed24_3dnow;
}
}
- if (mm_flags & AV_CPU_FLAG_MMXEXT && HAVE_MMXEXT) {
+ if (EXTERNAL_MMXEXT(mm_flags)) {
c->ac3_exponent_min = ff_ac3_exponent_min_mmxext;
c->ac3_max_msb_abs_int16 = ff_ac3_max_msb_abs_int16_mmx2;
}
- if (mm_flags & AV_CPU_FLAG_SSE && HAVE_SSE) {
+ if (EXTERNAL_SSE(mm_flags)) {
c->float_to_fixed24 = ff_float_to_fixed24_sse;
}
- if (mm_flags & AV_CPU_FLAG_SSE2 && HAVE_SSE) {
+ if (EXTERNAL_SSE2(mm_flags)) {
c->ac3_exponent_min = ff_ac3_exponent_min_sse2;
c->ac3_max_msb_abs_int16 = ff_ac3_max_msb_abs_int16_sse2;
c->float_to_fixed24 = ff_float_to_fixed24_sse2;
@@ -83,11 +83,10 @@ av_cold void ff_ac3dsp_init_x86(AC3DSPContext *c, int bit_exact)
c->ac3_rshift_int32 = ff_ac3_rshift_int32_sse2;
}
}
- if (mm_flags & AV_CPU_FLAG_SSSE3 && HAVE_SSSE3) {
+ if (EXTERNAL_SSSE3(mm_flags)) {
c->ac3_max_msb_abs_int16 = ff_ac3_max_msb_abs_int16_ssse3;
if (!(mm_flags & AV_CPU_FLAG_ATOM)) {
c->extract_exponents = ff_ac3_extract_exponents_ssse3;
}
}
-#endif
}
diff --git a/libavcodec/x86/dsputilenc_mmx.c b/libavcodec/x86/dsputilenc_mmx.c
index 325d55062b..1110f9c377 100644
--- a/libavcodec/x86/dsputilenc_mmx.c
+++ b/libavcodec/x86/dsputilenc_mmx.c
@@ -24,6 +24,7 @@
#include "libavutil/cpu.h"
#include "libavutil/x86/asm.h"
+#include "libavutil/x86/cpu.h"
#include "libavcodec/dsputil.h"
#include "libavcodec/mpegvideo.h"
#include "libavcodec/mathops.h"
@@ -1181,17 +1182,16 @@ void ff_dsputilenc_init_mmx(DSPContext* c, AVCodecContext *avctx)
}
#endif /* HAVE_INLINE_ASM */
-#if HAVE_YASM
- if (mm_flags & AV_CPU_FLAG_MMX) {
+ if (EXTERNAL_MMX(mm_flags)) {
c->hadamard8_diff[0] = ff_hadamard8_diff16_mmx;
c->hadamard8_diff[1] = ff_hadamard8_diff_mmx;
- if (mm_flags & AV_CPU_FLAG_MMXEXT) {
+ if (EXTERNAL_MMXEXT(mm_flags)) {
c->hadamard8_diff[0] = ff_hadamard8_diff16_mmx2;
c->hadamard8_diff[1] = ff_hadamard8_diff_mmx2;
}
- if (mm_flags & AV_CPU_FLAG_SSE2){
+ if (EXTERNAL_SSE2(mm_flags)) {
c->sse[0] = ff_sse16_sse2;
#if HAVE_ALIGNED_STACK
@@ -1200,14 +1200,11 @@ void ff_dsputilenc_init_mmx(DSPContext* c, AVCodecContext *avctx)
#endif
}
-#if HAVE_SSSE3 && HAVE_ALIGNED_STACK
- if (mm_flags & AV_CPU_FLAG_SSSE3) {
+ if (EXTERNAL_SSSE3(mm_flags) && HAVE_ALIGNED_STACK) {
c->hadamard8_diff[0] = ff_hadamard8_diff16_ssse3;
c->hadamard8_diff[1] = ff_hadamard8_diff_ssse3;
}
-#endif
}
-#endif /* HAVE_YASM */
ff_dsputil_init_pix_mmx(c, avctx);
}
diff --git a/libavcodec/x86/fft_init.c b/libavcodec/x86/fft_init.c
index f14c588e20..d7a31d4efa 100644
--- a/libavcodec/x86/fft_init.c
+++ b/libavcodec/x86/fft_init.c
@@ -17,29 +17,29 @@
*/
#include "libavutil/cpu.h"
+#include "libavutil/x86/cpu.h"
#include "libavcodec/dsputil.h"
#include "libavcodec/dct.h"
#include "fft.h"
av_cold void ff_fft_init_mmx(FFTContext *s)
{
-#if HAVE_YASM
int has_vectors = av_get_cpu_flags();
#if ARCH_X86_32
- if (has_vectors & AV_CPU_FLAG_3DNOW && HAVE_AMD3DNOW) {
+ if (EXTERNAL_AMD3DNOW(has_vectors)) {
/* 3DNow! for K6-2/3 */
s->imdct_calc = ff_imdct_calc_3dnow;
s->imdct_half = ff_imdct_half_3dnow;
s->fft_calc = ff_fft_calc_3dnow;
}
- if (has_vectors & AV_CPU_FLAG_3DNOWEXT && HAVE_AMD3DNOWEXT) {
+ if (EXTERNAL_AMD3DNOWEXT(has_vectors)) {
/* 3DNowEx for K7 */
s->imdct_calc = ff_imdct_calc_3dnowext;
s->imdct_half = ff_imdct_half_3dnowext;
s->fft_calc = ff_fft_calc_3dnowext;
}
#endif
- if (has_vectors & AV_CPU_FLAG_SSE && HAVE_SSE) {
+ if (EXTERNAL_SSE(has_vectors)) {
/* SSE for P3/P4/K8 */
s->imdct_calc = ff_imdct_calc_sse;
s->imdct_half = ff_imdct_half_sse;
@@ -47,26 +47,23 @@ av_cold void ff_fft_init_mmx(FFTContext *s)
s->fft_calc = ff_fft_calc_sse;
s->fft_permutation = FF_FFT_PERM_SWAP_LSBS;
}
- if (has_vectors & AV_CPU_FLAG_AVX && HAVE_AVX_EXTERNAL && s->nbits >= 5) {
+ if (EXTERNAL_AVX(has_vectors) && s->nbits >= 5) {
/* AVX for SB */
s->imdct_half = ff_imdct_half_avx;
s->fft_calc = ff_fft_calc_avx;
s->fft_permutation = FF_FFT_PERM_AVX;
}
-#endif
}
#if CONFIG_DCT
av_cold void ff_dct_init_mmx(DCTContext *s)
{
-#if HAVE_YASM
int has_vectors = av_get_cpu_flags();
- if (has_vectors & AV_CPU_FLAG_SSE && HAVE_SSE)
+ if (EXTERNAL_SSE(has_vectors))
s->dct32 = ff_dct32_float_sse;
- if (has_vectors & AV_CPU_FLAG_SSE2 && HAVE_SSE)
+ if (EXTERNAL_SSE2(has_vectors))
s->dct32 = ff_dct32_float_sse2;
- if (has_vectors & AV_CPU_FLAG_AVX && HAVE_AVX_EXTERNAL)
+ if (EXTERNAL_AVX(has_vectors))
s->dct32 = ff_dct32_float_avx;
-#endif
}
#endif
diff --git a/libavcodec/x86/fmtconvert_init.c b/libavcodec/x86/fmtconvert_init.c
index 2aa23ba780..528b7b1221 100644
--- a/libavcodec/x86/fmtconvert_init.c
+++ b/libavcodec/x86/fmtconvert_init.c
@@ -24,6 +24,7 @@
#include "libavutil/cpu.h"
#include "libavutil/x86/asm.h"
+#include "libavutil/x86/cpu.h"
#include "libavcodec/fmtconvert.h"
#include "libavcodec/dsputil.h"
@@ -117,27 +118,27 @@ void ff_fmt_convert_init_x86(FmtConvertContext *c, AVCodecContext *avctx)
#if HAVE_YASM
int mm_flags = av_get_cpu_flags();
- if (mm_flags & AV_CPU_FLAG_MMX) {
+ if (EXTERNAL_MMX(mm_flags)) {
c->float_interleave = float_interleave_mmx;
- if (HAVE_AMD3DNOW && mm_flags & AV_CPU_FLAG_3DNOW) {
+ if (EXTERNAL_AMD3DNOW(mm_flags)) {
if(!(avctx->flags & CODEC_FLAG_BITEXACT)){
c->float_to_int16 = ff_float_to_int16_3dnow;
c->float_to_int16_interleave = float_to_int16_interleave_3dnow;
}
}
- if (HAVE_AMD3DNOWEXT && mm_flags & AV_CPU_FLAG_3DNOWEXT) {
+ if (EXTERNAL_AMD3DNOWEXT(mm_flags)) {
if(!(avctx->flags & CODEC_FLAG_BITEXACT)){
c->float_to_int16_interleave = float_to_int16_interleave_3dnowext;
}
}
- if (HAVE_SSE && mm_flags & AV_CPU_FLAG_SSE) {
+ if (EXTERNAL_SSE(mm_flags)) {
c->int32_to_float_fmul_scalar = ff_int32_to_float_fmul_scalar_sse;
c->float_to_int16 = ff_float_to_int16_sse;
c->float_to_int16_interleave = float_to_int16_interleave_sse;
c->float_interleave = float_interleave_sse;
}
- if (HAVE_SSE && mm_flags & AV_CPU_FLAG_SSE2) {
+ if (EXTERNAL_SSE2(mm_flags)) {
c->int32_to_float_fmul_scalar = ff_int32_to_float_fmul_scalar_sse2;
c->float_to_int16 = ff_float_to_int16_sse2;
c->float_to_int16_interleave = float_to_int16_interleave_sse2;
diff --git a/libavcodec/x86/h264_intrapred_init.c b/libavcodec/x86/h264_intrapred_init.c
index d40a08a6bb..6d8b414dd3 100644
--- a/libavcodec/x86/h264_intrapred_init.c
+++ b/libavcodec/x86/h264_intrapred_init.c
@@ -19,6 +19,7 @@
*/
#include "libavutil/cpu.h"
+#include "libavutil/x86/cpu.h"
#include "libavcodec/h264pred.h"
#define PRED4x4(TYPE, DEPTH, OPT) \
@@ -169,11 +170,10 @@ void ff_pred4x4_vertical_vp8_mmxext(uint8_t *src, const uint8_t *topright, int s
void ff_h264_pred_init_x86(H264PredContext *h, int codec_id, const int bit_depth, const int chroma_format_idc)
{
-#if HAVE_YASM
int mm_flags = av_get_cpu_flags();
if (bit_depth == 8) {
- if (mm_flags & AV_CPU_FLAG_MMX) {
+ if (EXTERNAL_MMX(mm_flags)) {
h->pred16x16[VERT_PRED8x8 ] = ff_pred16x16_vertical_mmx;
h->pred16x16[HOR_PRED8x8 ] = ff_pred16x16_horizontal_mmx;
if (chroma_format_idc == 1) {
@@ -198,7 +198,7 @@ void ff_h264_pred_init_x86(H264PredContext *h, int codec_id, const int bit_depth
}
}
- if (mm_flags & AV_CPU_FLAG_MMXEXT) {
+ if (EXTERNAL_MMXEXT(mm_flags)) {
h->pred16x16[HOR_PRED8x8 ] = ff_pred16x16_horizontal_mmx2;
h->pred16x16[DC_PRED8x8 ] = ff_pred16x16_dc_mmx2;
if (chroma_format_idc == 1)
@@ -250,11 +250,11 @@ void ff_h264_pred_init_x86(H264PredContext *h, int codec_id, const int bit_depth
}
}
- if (mm_flags & AV_CPU_FLAG_SSE) {
+ if (EXTERNAL_SSE(mm_flags)) {
h->pred16x16[VERT_PRED8x8] = ff_pred16x16_vertical_sse;
}
- if (mm_flags & AV_CPU_FLAG_SSE2) {
+ if (EXTERNAL_SSE2(mm_flags)) {
h->pred16x16[DC_PRED8x8 ] = ff_pred16x16_dc_sse2;
h->pred8x8l [DIAG_DOWN_LEFT_PRED ] = ff_pred8x8l_down_left_sse2;
h->pred8x8l [DIAG_DOWN_RIGHT_PRED ] = ff_pred8x8l_down_right_sse2;
@@ -277,7 +277,7 @@ void ff_h264_pred_init_x86(H264PredContext *h, int codec_id, const int bit_depth
}
}
- if (mm_flags & AV_CPU_FLAG_SSSE3) {
+ if (EXTERNAL_SSSE3(mm_flags)) {
h->pred16x16[HOR_PRED8x8 ] = ff_pred16x16_horizontal_ssse3;
h->pred16x16[DC_PRED8x8 ] = ff_pred16x16_dc_ssse3;
if (chroma_format_idc == 1)
@@ -308,7 +308,7 @@ void ff_h264_pred_init_x86(H264PredContext *h, int codec_id, const int bit_depth
}
}
} else if (bit_depth == 10) {
- if (mm_flags & AV_CPU_FLAG_MMXEXT) {
+ if (EXTERNAL_MMXEXT(mm_flags)) {
h->pred4x4[DC_PRED ] = ff_pred4x4_dc_10_mmxext;
h->pred4x4[HOR_UP_PRED ] = ff_pred4x4_horizontal_up_10_mmxext;
@@ -324,7 +324,7 @@ void ff_h264_pred_init_x86(H264PredContext *h, int codec_id, const int bit_depth
h->pred16x16[VERT_PRED8x8 ] = ff_pred16x16_vertical_10_mmxext;
h->pred16x16[HOR_PRED8x8 ] = ff_pred16x16_horizontal_10_mmxext;
}
- if (mm_flags & AV_CPU_FLAG_SSE2) {
+ if (EXTERNAL_SSE2(mm_flags)) {
h->pred4x4[DIAG_DOWN_LEFT_PRED ] = ff_pred4x4_down_left_10_sse2;
h->pred4x4[DIAG_DOWN_RIGHT_PRED] = ff_pred4x4_down_right_10_sse2;
h->pred4x4[VERT_LEFT_PRED ] = ff_pred4x4_vertical_left_10_sse2;
@@ -356,7 +356,7 @@ void ff_h264_pred_init_x86(H264PredContext *h, int codec_id, const int bit_depth
h->pred16x16[VERT_PRED8x8 ] = ff_pred16x16_vertical_10_sse2;
h->pred16x16[HOR_PRED8x8 ] = ff_pred16x16_horizontal_10_sse2;
}
- if (mm_flags & AV_CPU_FLAG_SSSE3) {
+ if (EXTERNAL_SSSE3(mm_flags)) {
h->pred4x4[DIAG_DOWN_RIGHT_PRED] = ff_pred4x4_down_right_10_ssse3;
h->pred4x4[VERT_RIGHT_PRED ] = ff_pred4x4_vertical_right_10_ssse3;
h->pred4x4[HOR_DOWN_PRED ] = ff_pred4x4_horizontal_down_10_ssse3;
@@ -367,7 +367,7 @@ void ff_h264_pred_init_x86(H264PredContext *h, int codec_id, const int bit_depth
h->pred8x8l[VERT_RIGHT_PRED ] = ff_pred8x8l_vertical_right_10_ssse3;
h->pred8x8l[HOR_UP_PRED ] = ff_pred8x8l_horizontal_up_10_ssse3;
}
- if (HAVE_AVX_EXTERNAL && mm_flags & AV_CPU_FLAG_AVX) {
+ if (EXTERNAL_AVX(mm_flags)) {
h->pred4x4[DIAG_DOWN_LEFT_PRED ] = ff_pred4x4_down_left_10_avx;
h->pred4x4[DIAG_DOWN_RIGHT_PRED] = ff_pred4x4_down_right_10_avx;
h->pred4x4[VERT_LEFT_PRED ] = ff_pred4x4_vertical_left_10_avx;
@@ -384,5 +384,4 @@ void ff_h264_pred_init_x86(H264PredContext *h, int codec_id, const int bit_depth
h->pred8x8l[HOR_UP_PRED ] = ff_pred8x8l_horizontal_up_10_avx;
}
}
-#endif /* HAVE_YASM */
}
diff --git a/libavcodec/x86/h264dsp_init.c b/libavcodec/x86/h264dsp_init.c
index 6c83d8ce58..7ada4950cc 100644
--- a/libavcodec/x86/h264dsp_init.c
+++ b/libavcodec/x86/h264dsp_init.c
@@ -20,6 +20,7 @@
#include "libavutil/cpu.h"
#include "libavutil/x86/asm.h"
+#include "libavutil/x86/cpu.h"
#include "libavcodec/h264dsp.h"
#include "dsputil_mmx.h"
@@ -209,14 +210,13 @@ H264_BIWEIGHT_10_SSE(4, 10)
void ff_h264dsp_init_x86(H264DSPContext *c, const int bit_depth,
const int chroma_format_idc)
{
-#if HAVE_YASM
int mm_flags = av_get_cpu_flags();
- if (chroma_format_idc == 1 && mm_flags & AV_CPU_FLAG_MMXEXT)
+ if (chroma_format_idc == 1 && EXTERNAL_MMXEXT(mm_flags))
c->h264_loop_filter_strength = ff_h264_loop_filter_strength_mmx2;
if (bit_depth == 8) {
- if (mm_flags & AV_CPU_FLAG_MMX) {
+ if (EXTERNAL_MMX(mm_flags)) {
c->h264_idct_dc_add =
c->h264_idct_add = ff_h264_idct_add_8_mmx;
c->h264_idct8_dc_add =
@@ -230,7 +230,7 @@ void ff_h264dsp_init_x86(H264DSPContext *c, const int bit_depth,
if (mm_flags & AV_CPU_FLAG_CMOV)
c->h264_luma_dc_dequant_idct = ff_h264_luma_dc_dequant_idct_mmx;
- if (mm_flags & AV_CPU_FLAG_MMXEXT) {
+ if (EXTERNAL_MMXEXT(mm_flags)) {
c->h264_idct_dc_add = ff_h264_idct_dc_add_8_mmx2;
c->h264_idct8_dc_add = ff_h264_idct8_dc_add_8_mmx2;
c->h264_idct_add16 = ff_h264_idct_add16_8_mmx2;
@@ -259,7 +259,7 @@ void ff_h264dsp_init_x86(H264DSPContext *c, const int bit_depth,
c->biweight_h264_pixels_tab[1] = ff_h264_biweight_8_mmx2;
c->biweight_h264_pixels_tab[2] = ff_h264_biweight_4_mmx2;
- if (mm_flags & AV_CPU_FLAG_SSE2) {
+ if (EXTERNAL_SSE2(mm_flags)) {
c->h264_idct8_add = ff_h264_idct8_add_8_sse2;
c->h264_idct_add16 = ff_h264_idct_add16_8_sse2;
@@ -282,23 +282,21 @@ void ff_h264dsp_init_x86(H264DSPContext *c, const int bit_depth,
c->h264_h_loop_filter_luma_intra = ff_deblock_h_luma_intra_8_sse2;
#endif /* HAVE_ALIGNED_STACK */
}
- if (mm_flags & AV_CPU_FLAG_SSSE3) {
+ if (EXTERNAL_SSSE3(mm_flags)) {
c->biweight_h264_pixels_tab[0] = ff_h264_biweight_16_ssse3;
c->biweight_h264_pixels_tab[1] = ff_h264_biweight_8_ssse3;
}
- if (HAVE_AVX_EXTERNAL && mm_flags & AV_CPU_FLAG_AVX) {
-#if HAVE_ALIGNED_STACK
+ if (EXTERNAL_AVX(mm_flags) && HAVE_ALIGNED_STACK) {
c->h264_v_loop_filter_luma = ff_deblock_v_luma_8_avx;
c->h264_h_loop_filter_luma = ff_deblock_h_luma_8_avx;
c->h264_v_loop_filter_luma_intra = ff_deblock_v_luma_intra_8_avx;
c->h264_h_loop_filter_luma_intra = ff_deblock_h_luma_intra_8_avx;
-#endif /* HAVE_ALIGNED_STACK */
}
}
}
} else if (bit_depth == 10) {
- if (mm_flags & AV_CPU_FLAG_MMX) {
- if (mm_flags & AV_CPU_FLAG_MMXEXT) {
+ if (EXTERNAL_MMX(mm_flags)) {
+ if (EXTERNAL_MMXEXT(mm_flags)) {
#if ARCH_X86_32
c->h264_v_loop_filter_chroma = ff_deblock_v_chroma_10_mmx2;
c->h264_v_loop_filter_chroma_intra = ff_deblock_v_chroma_intra_10_mmx2;
@@ -308,7 +306,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_mmx2;
#endif /* ARCH_X86_32 */
c->h264_idct_dc_add = ff_h264_idct_dc_add_10_mmx2;
- if (mm_flags & AV_CPU_FLAG_SSE2) {
+ if (EXTERNAL_SSE2(mm_flags)) {
c->h264_idct_add = ff_h264_idct_add_10_sse2;
c->h264_idct8_dc_add = ff_h264_idct8_dc_add_10_sse2;
@@ -338,7 +336,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_sse2;
#endif /* HAVE_ALIGNED_STACK */
}
- if (mm_flags & AV_CPU_FLAG_SSE4) {
+ if (EXTERNAL_SSE4(mm_flags)) {
c->weight_h264_pixels_tab[0] = ff_h264_weight_16_10_sse4;
c->weight_h264_pixels_tab[1] = ff_h264_weight_8_10_sse4;
c->weight_h264_pixels_tab[2] = ff_h264_weight_4_10_sse4;
@@ -347,8 +345,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_EXTERNAL
- if (mm_flags & AV_CPU_FLAG_AVX) {
+ if (EXTERNAL_AVX(mm_flags)) {
c->h264_idct_dc_add =
c->h264_idct_add = ff_h264_idct_add_10_avx;
c->h264_idct8_dc_add = ff_h264_idct8_dc_add_10_avx;
@@ -371,9 +368,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_EXTERNAL */
}
}
}
-#endif /* HAVE_YASM */
}
diff --git a/libavcodec/x86/mlpdsp.c b/libavcodec/x86/mlpdsp.c
index 0cd0e4c2fb..f7c0f21f64 100644
--- a/libavcodec/x86/mlpdsp.c
+++ b/libavcodec/x86/mlpdsp.c
@@ -23,7 +23,7 @@
#include "libavcodec/dsputil.h"
#include "libavcodec/mlp.h"
-#if HAVE_7REGS
+#if HAVE_7REGS && HAVE_INLINE_ASM
extern char ff_mlp_firorder_8;
extern char ff_mlp_firorder_7;
@@ -171,11 +171,11 @@ static void mlp_filter_channel_x86(int32_t *state, const int32_t *coeff,
);
}
-#endif /* HAVE_7REGS */
+#endif /* HAVE_7REGS && HAVE_INLINE_ASM */
void ff_mlp_init_x86(DSPContext* c, AVCodecContext *avctx)
{
-#if HAVE_7REGS
+#if HAVE_7REGS && HAVE_INLINE_ASM
c->mlp_filter_channel = mlp_filter_channel_x86;
#endif
}
diff --git a/libavcodec/x86/mpegaudiodec.c b/libavcodec/x86/mpegaudiodec.c
index 8a6d59ad6a..edf630b31d 100644
--- a/libavcodec/x86/mpegaudiodec.c
+++ b/libavcodec/x86/mpegaudiodec.c
@@ -21,6 +21,7 @@
#include "libavutil/cpu.h"
#include "libavutil/x86/asm.h"
+#include "libavutil/x86/cpu.h"
#include "libavcodec/dsputil.h"
#include "libavcodec/mpegaudiodsp.h"
@@ -251,21 +252,16 @@ void ff_mpadsp_init_mmx(MPADSPContext *s)
#endif /* HAVE_SSE2_INLINE */
#if HAVE_YASM
- if (0) {
-#if HAVE_AVX_EXTERNAL
- } else if (mm_flags & AV_CPU_FLAG_AVX && HAVE_AVX) {
+ if (EXTERNAL_AVX(mm_flags)) {
s->imdct36_blocks_float = imdct36_blocks_avx;
-#endif
-#if HAVE_SSE
- } else if (mm_flags & AV_CPU_FLAG_SSSE3) {
+ } else if (EXTERNAL_SSSE3(mm_flags)) {
s->imdct36_blocks_float = imdct36_blocks_ssse3;
- } else if (mm_flags & AV_CPU_FLAG_SSE3) {
+ } else if (EXTERNAL_SSE3(mm_flags)) {
s->imdct36_blocks_float = imdct36_blocks_sse3;
- } else if (mm_flags & AV_CPU_FLAG_SSE2) {
+ } else if (EXTERNAL_SSE2(mm_flags)) {
s->imdct36_blocks_float = imdct36_blocks_sse2;
- } else if (mm_flags & AV_CPU_FLAG_SSE) {
+ } else if (EXTERNAL_SSE(mm_flags)) {
s->imdct36_blocks_float = imdct36_blocks_sse;
-#endif /* HAVE_SSE */
}
#endif /* HAVE_YASM */
}
diff --git a/libavcodec/x86/mpegvideoenc.c b/libavcodec/x86/mpegvideoenc.c
index 850467f663..20d26ec8b6 100644
--- a/libavcodec/x86/mpegvideoenc.c
+++ b/libavcodec/x86/mpegvideoenc.c
@@ -21,6 +21,7 @@
#include "libavutil/cpu.h"
#include "libavutil/x86/asm.h"
+#include "libavutil/x86/cpu.h"
#include "libavcodec/avcodec.h"
#include "libavcodec/dsputil.h"
#include "libavcodec/mpegvideo.h"
@@ -86,19 +87,19 @@ void ff_MPV_encode_init_x86(MpegEncContext *s)
if (dct_algo == FF_DCT_AUTO || dct_algo == FF_DCT_MMX) {
#if HAVE_MMX_INLINE
- if (mm_flags & AV_CPU_FLAG_MMX && HAVE_MMX)
+ if (INLINE_MMX(mm_flags))
s->dct_quantize = dct_quantize_MMX;
#endif
#if HAVE_MMXEXT_INLINE
- if (mm_flags & AV_CPU_FLAG_MMXEXT && HAVE_MMXEXT)
+ if (INLINE_MMXEXT(mm_flags))
s->dct_quantize = dct_quantize_MMX2;
#endif
#if HAVE_SSE2_INLINE
- if (mm_flags & AV_CPU_FLAG_SSE2 && HAVE_SSE2)
+ if (INLINE_SSE2(mm_flags))
s->dct_quantize = dct_quantize_SSE2;
#endif
#if HAVE_SSSE3_INLINE
- if (mm_flags & AV_CPU_FLAG_SSSE3)
+ if (INLINE_SSSE3(mm_flags))
s->dct_quantize = dct_quantize_SSSE3;
#endif
}
diff --git a/libavcodec/x86/pngdsp_init.c b/libavcodec/x86/pngdsp_init.c
index 7a12730620..05fd051210 100644
--- a/libavcodec/x86/pngdsp_init.c
+++ b/libavcodec/x86/pngdsp_init.c
@@ -20,7 +20,7 @@
*/
#include "libavutil/common.h"
-#include "libavutil/cpu.h"
+#include "libavutil/x86/cpu.h"
#include "libavcodec/pngdsp.h"
void ff_add_png_paeth_prediction_mmx2 (uint8_t *dst, uint8_t *src,
@@ -34,18 +34,16 @@ void ff_add_bytes_l2_sse2(uint8_t *dst, uint8_t *src1,
void ff_pngdsp_init_x86(PNGDSPContext *dsp)
{
-#if HAVE_YASM
int flags = av_get_cpu_flags();
#if ARCH_X86_32
- if (flags & AV_CPU_FLAG_MMX)
+ if (EXTERNAL_MMX(flags))
dsp->add_bytes_l2 = ff_add_bytes_l2_mmx;
#endif
- if (flags & AV_CPU_FLAG_MMXEXT)
+ if (EXTERNAL_MMXEXT(flags))
dsp->add_paeth_prediction = ff_add_png_paeth_prediction_mmx2;
- if (flags & AV_CPU_FLAG_SSE2)
+ if (EXTERNAL_SSE2(flags))
dsp->add_bytes_l2 = ff_add_bytes_l2_sse2;
- if (flags & AV_CPU_FLAG_SSSE3)
+ if (EXTERNAL_SSSE3(flags))
dsp->add_paeth_prediction = ff_add_png_paeth_prediction_ssse3;
-#endif
}
diff --git a/libavcodec/x86/proresdsp_init.c b/libavcodec/x86/proresdsp_init.c
index 5892af2518..21ce0986d2 100644
--- a/libavcodec/x86/proresdsp_init.c
+++ b/libavcodec/x86/proresdsp_init.c
@@ -20,6 +20,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "libavutil/x86/cpu.h"
#include "libavcodec/proresdsp.h"
void ff_prores_idct_put_10_sse2(uint16_t *dst, int linesize,
@@ -31,25 +32,25 @@ void ff_prores_idct_put_10_avx (uint16_t *dst, int linesize,
void ff_proresdsp_x86_init(ProresDSPContext *dsp, AVCodecContext *avctx)
{
-#if ARCH_X86_64 && HAVE_YASM
+#if ARCH_X86_64
int flags = av_get_cpu_flags();
if(avctx->flags & CODEC_FLAG_BITEXACT)
return;
- if (flags & AV_CPU_FLAG_SSE2) {
+ if (EXTERNAL_SSE2(flags)) {
dsp->idct_permutation_type = FF_TRANSPOSE_IDCT_PERM;
dsp->idct_put = ff_prores_idct_put_10_sse2;
}
- if (flags & AV_CPU_FLAG_SSE4) {
+ if (EXTERNAL_SSE4(flags)) {
dsp->idct_permutation_type = FF_TRANSPOSE_IDCT_PERM;
dsp->idct_put = ff_prores_idct_put_10_sse4;
}
- if (HAVE_AVX_EXTERNAL && flags & AV_CPU_FLAG_AVX) {
+ if (EXTERNAL_AVX(flags)) {
dsp->idct_permutation_type = FF_TRANSPOSE_IDCT_PERM;
dsp->idct_put = ff_prores_idct_put_10_avx;
}
-#endif /* ARCH_X86_64 && HAVE_YASM */
+#endif /* ARCH_X86_64 */
}
diff --git a/libavcodec/x86/rv34dsp_init.c b/libavcodec/x86/rv34dsp_init.c
index de323e9c3c..305745aa95 100644
--- a/libavcodec/x86/rv34dsp_init.c
+++ b/libavcodec/x86/rv34dsp_init.c
@@ -21,6 +21,7 @@
#include "libavutil/cpu.h"
#include "libavutil/x86/asm.h"
+#include "libavutil/x86/cpu.h"
#include "libavcodec/dsputil.h"
#include "libavcodec/rv34dsp.h"
@@ -32,16 +33,14 @@ void ff_rv34_idct_add_mmx2(uint8_t *dst, ptrdiff_t stride, DCTELEM *block);
av_cold void ff_rv34dsp_init_x86(RV34DSPContext* c, DSPContext *dsp)
{
-#if HAVE_YASM
int mm_flags = av_get_cpu_flags();
- if (mm_flags & AV_CPU_FLAG_MMX)
+ if (EXTERNAL_MMX(mm_flags))
c->rv34_idct_dc_add = ff_rv34_idct_dc_add_mmx;
- if (mm_flags & AV_CPU_FLAG_MMXEXT) {
+ if (EXTERNAL_MMXEXT(mm_flags)) {
c->rv34_inv_transform_dc = ff_rv34_idct_dc_noround_mmx2;
c->rv34_idct_add = ff_rv34_idct_add_mmx2;
}
- if (mm_flags & AV_CPU_FLAG_SSE4)
+ if (EXTERNAL_SSE4(mm_flags))
c->rv34_idct_dc_add = ff_rv34_idct_dc_add_sse4;
-#endif /* HAVE_YASM */
}
diff --git a/libavcodec/x86/rv40dsp_init.c b/libavcodec/x86/rv40dsp_init.c
index 50aaa24b43..966e3f22f5 100644
--- a/libavcodec/x86/rv40dsp_init.c
+++ b/libavcodec/x86/rv40dsp_init.c
@@ -28,6 +28,7 @@
#include "libavcodec/rv34dsp.h"
#include "libavutil/mem.h"
+#include "libavutil/x86/cpu.h"
#include "dsputil_mmx.h"
#if HAVE_YASM
@@ -191,7 +192,7 @@ void ff_rv40dsp_init_x86(RV34DSPContext *c, DSPContext *dsp)
#if HAVE_YASM
int mm_flags = av_get_cpu_flags();
- if (mm_flags & AV_CPU_FLAG_MMX) {
+ if (EXTERNAL_MMX(mm_flags)) {
c->put_chroma_pixels_tab[0] = ff_put_rv40_chroma_mc8_mmx;
c->put_chroma_pixels_tab[1] = ff_put_rv40_chroma_mc4_mmx;
#if HAVE_INLINE_ASM
@@ -204,7 +205,7 @@ void ff_rv40dsp_init_x86(RV34DSPContext *c, DSPContext *dsp)
QPEL_MC_SET(put_, _mmx)
#endif
}
- if (mm_flags & AV_CPU_FLAG_MMXEXT) {
+ if (EXTERNAL_MMXEXT(mm_flags)) {
c->avg_chroma_pixels_tab[0] = ff_avg_rv40_chroma_mc8_mmx2;
c->avg_chroma_pixels_tab[1] = ff_avg_rv40_chroma_mc4_mmx2;
c->rv40_weight_pixels_tab[0][0] = ff_rv40_weight_func_rnd_16_mmx2;
@@ -214,14 +215,14 @@ void ff_rv40dsp_init_x86(RV34DSPContext *c, DSPContext *dsp)
#if ARCH_X86_32
QPEL_MC_SET(avg_, _mmx2)
#endif
- } else if (mm_flags & AV_CPU_FLAG_3DNOW) {
+ } else if (EXTERNAL_AMD3DNOW(mm_flags)) {
c->avg_chroma_pixels_tab[0] = ff_avg_rv40_chroma_mc8_3dnow;
c->avg_chroma_pixels_tab[1] = ff_avg_rv40_chroma_mc4_3dnow;
#if ARCH_X86_32
QPEL_MC_SET(avg_, _3dnow)
#endif
}
- if (mm_flags & AV_CPU_FLAG_SSE2) {
+ if (EXTERNAL_SSE2(mm_flags)) {
c->rv40_weight_pixels_tab[0][0] = ff_rv40_weight_func_rnd_16_sse2;
c->rv40_weight_pixels_tab[0][1] = ff_rv40_weight_func_rnd_8_sse2;
c->rv40_weight_pixels_tab[1][0] = ff_rv40_weight_func_nornd_16_sse2;
@@ -229,7 +230,7 @@ void ff_rv40dsp_init_x86(RV34DSPContext *c, DSPContext *dsp)
QPEL_MC_SET(put_, _sse2)
QPEL_MC_SET(avg_, _sse2)
}
- if (mm_flags & AV_CPU_FLAG_SSSE3) {
+ if (EXTERNAL_SSSE3(mm_flags)) {
c->rv40_weight_pixels_tab[0][0] = ff_rv40_weight_func_rnd_16_ssse3;
c->rv40_weight_pixels_tab[0][1] = ff_rv40_weight_func_rnd_8_ssse3;
c->rv40_weight_pixels_tab[1][0] = ff_rv40_weight_func_nornd_16_ssse3;
diff --git a/libavcodec/x86/sbrdsp_init.c b/libavcodec/x86/sbrdsp_init.c
index 0ffe5b9e11..d272896704 100644
--- a/libavcodec/x86/sbrdsp_init.c
+++ b/libavcodec/x86/sbrdsp_init.c
@@ -21,6 +21,7 @@
#include "config.h"
#include "libavutil/cpu.h"
+#include "libavutil/x86/cpu.h"
#include "libavcodec/sbrdsp.h"
float ff_sbr_sum_square_sse(float (*x)[2], int n);
@@ -29,12 +30,10 @@ void ff_sbr_hf_g_filt_sse(float (*Y)[2], const float (*X_high)[40][2],
void ff_sbrdsp_init_x86(SBRDSPContext *s)
{
- if (HAVE_YASM) {
- int mm_flags = av_get_cpu_flags();
+ int mm_flags = av_get_cpu_flags();
- if (mm_flags & AV_CPU_FLAG_SSE) {
- s->sum_square = ff_sbr_sum_square_sse;
- s->hf_g_filt = ff_sbr_hf_g_filt_sse;
- }
+ if (EXTERNAL_SSE(mm_flags)) {
+ s->sum_square = ff_sbr_sum_square_sse;
+ s->hf_g_filt = ff_sbr_hf_g_filt_sse;
}
}
diff --git a/libavcodec/x86/vp3dsp_init.c b/libavcodec/x86/vp3dsp_init.c
index 8905452dcf..c4d462bc62 100644
--- a/libavcodec/x86/vp3dsp_init.c
+++ b/libavcodec/x86/vp3dsp_init.c
@@ -20,6 +20,7 @@
#include "libavutil/attributes.h"
#include "libavutil/cpu.h"
+#include "libavutil/x86/cpu.h"
#include "libavcodec/avcodec.h"
#include "libavcodec/vp3dsp.h"
#include "config.h"
@@ -38,18 +39,17 @@ void ff_vp3_h_loop_filter_mmx2(uint8_t *src, int stride, int *bounding_values);
av_cold void ff_vp3dsp_init_x86(VP3DSPContext *c, int flags)
{
-#if HAVE_YASM
int cpuflags = av_get_cpu_flags();
#if ARCH_X86_32
- if (HAVE_MMX && cpuflags & AV_CPU_FLAG_MMX) {
+ if (EXTERNAL_MMX(cpuflags)) {
c->idct_put = ff_vp3_idct_put_mmx;
c->idct_add = ff_vp3_idct_add_mmx;
c->idct_perm = FF_PARTTRANS_IDCT_PERM;
}
#endif
- if (HAVE_MMXEXT && cpuflags & AV_CPU_FLAG_MMXEXT) {
+ if (EXTERNAL_MMXEXT(cpuflags)) {
c->idct_dc_add = ff_vp3_idct_dc_add_mmx2;
if (!(flags & CODEC_FLAG_BITEXACT)) {
@@ -58,10 +58,9 @@ av_cold void ff_vp3dsp_init_x86(VP3DSPContext *c, int flags)
}
}
- if (cpuflags & AV_CPU_FLAG_SSE2) {
+ if (EXTERNAL_SSE2(cpuflags)) {
c->idct_put = ff_vp3_idct_put_sse2;
c->idct_add = ff_vp3_idct_add_sse2;
c->idct_perm = FF_TRANSPOSE_IDCT_PERM;
}
-#endif
}
diff --git a/libavcodec/x86/vp56dsp_init.c b/libavcodec/x86/vp56dsp_init.c
index bef1af6546..b699f793ca 100644
--- a/libavcodec/x86/vp56dsp_init.c
+++ b/libavcodec/x86/vp56dsp_init.c
@@ -22,6 +22,7 @@
#include "libavutil/cpu.h"
#include "libavutil/x86/asm.h"
+#include "libavutil/x86/cpu.h"
#include "libavcodec/dsputil.h"
#include "libavcodec/vp56dsp.h"
@@ -32,19 +33,17 @@ void ff_vp6_filter_diag4_sse2(uint8_t *dst, uint8_t *src, int stride,
av_cold void ff_vp56dsp_init_x86(VP56DSPContext* c, enum AVCodecID codec)
{
-#if HAVE_YASM
int mm_flags = av_get_cpu_flags();
if (CONFIG_VP6_DECODER && codec == AV_CODEC_ID_VP6) {
#if ARCH_X86_32
- if (mm_flags & AV_CPU_FLAG_MMX) {
+ if (EXTERNAL_MMX(mm_flags)) {
c->vp6_filter_diag4 = ff_vp6_filter_diag4_mmx;
}
#endif
- if (mm_flags & AV_CPU_FLAG_SSE2) {
+ if (EXTERNAL_SSE2(mm_flags)) {
c->vp6_filter_diag4 = ff_vp6_filter_diag4_sse2;
}
}
-#endif
}