diff options
author | Diego Biurrun <diego@biurrun.de> | 2013-08-20 14:46:58 +0200 |
---|---|---|
committer | Diego Biurrun <diego@biurrun.de> | 2013-08-29 13:07:37 +0200 |
commit | 6369ba3c9cc74becfaad2a8882dff3dd3e7ae3c0 (patch) | |
tree | 24a69c3793e5791b75d5e7b421583ddfda1f7b44 /libavcodec/x86 | |
parent | 79aec43ce813a3e270743ca64fa3f31fa43df80b (diff) | |
download | ffmpeg-6369ba3c9cc74becfaad2a8882dff3dd3e7ae3c0.tar.gz |
x86: avcodec: Use convenience macros to check for CPU flags
Diffstat (limited to 'libavcodec/x86')
-rw-r--r-- | libavcodec/x86/cavsdsp.c | 6 | ||||
-rw-r--r-- | libavcodec/x86/dnxhdenc.c | 3 | ||||
-rw-r--r-- | libavcodec/x86/dsputil_init.c | 13 | ||||
-rw-r--r-- | libavcodec/x86/dsputilenc_mmx.c | 10 | ||||
-rw-r--r-- | libavcodec/x86/hpeldsp_init.c | 9 | ||||
-rw-r--r-- | libavcodec/x86/lpc.c | 5 | ||||
-rw-r--r-- | libavcodec/x86/motion_est.c | 7 | ||||
-rw-r--r-- | libavcodec/x86/mpegvideo.c | 6 | ||||
-rw-r--r-- | libavcodec/x86/vc1dsp_init.c | 14 | ||||
-rw-r--r-- | libavcodec/x86/videodsp_init.c | 9 | ||||
-rw-r--r-- | libavcodec/x86/vorbisdsp_init.c | 5 | ||||
-rw-r--r-- | libavcodec/x86/vp8dsp_init.c | 15 |
12 files changed, 54 insertions, 48 deletions
diff --git a/libavcodec/x86/cavsdsp.c b/libavcodec/x86/cavsdsp.c index f8d881e693..9d2b95067f 100644 --- a/libavcodec/x86/cavsdsp.c +++ b/libavcodec/x86/cavsdsp.c @@ -544,15 +544,15 @@ av_cold void ff_cavsdsp_init_x86(CAVSDSPContext *c, AVCodecContext *avctx) #if HAVE_MMX_INLINE int cpu_flags = av_get_cpu_flags(); - if (cpu_flags & AV_CPU_FLAG_MMX) + if (INLINE_MMX(cpu_flags)) cavsdsp_init_mmx(c, avctx); #endif /* HAVE_MMX_INLINE */ #if HAVE_MMXEXT_INLINE - if (cpu_flags & AV_CPU_FLAG_MMXEXT) + if (INLINE_MMXEXT(cpu_flags)) cavsdsp_init_mmxext(c, avctx); #endif /* HAVE_MMXEXT_INLINE */ #if HAVE_AMD3DNOW_INLINE - if (cpu_flags & AV_CPU_FLAG_3DNOW) + if (INLINE_AMD3DNOW(cpu_flags)) cavsdsp_init_3dnow(c, avctx); #endif /* HAVE_AMD3DNOW_INLINE */ } diff --git a/libavcodec/x86/dnxhdenc.c b/libavcodec/x86/dnxhdenc.c index 9f71c82e91..0bab69f67d 100644 --- a/libavcodec/x86/dnxhdenc.c +++ b/libavcodec/x86/dnxhdenc.c @@ -23,6 +23,7 @@ #include "libavutil/attributes.h" #include "libavutil/x86/asm.h" +#include "libavutil/x86/cpu.h" #include "libavcodec/dnxhdenc.h" #if HAVE_SSE2_INLINE @@ -58,7 +59,7 @@ static void get_pixels_8x4_sym_sse2(int16_t *block, const uint8_t *pixels, int l av_cold void ff_dnxhdenc_init_x86(DNXHDEncContext *ctx) { #if HAVE_SSE2_INLINE - if (av_get_cpu_flags() & AV_CPU_FLAG_SSE2) { + if (INLINE_SSE2(av_get_cpu_flags())) { if (ctx->cid_table->bit_depth == 8) ctx->get_pixels_8x4_sym = get_pixels_8x4_sym_sse2; } diff --git a/libavcodec/x86/dsputil_init.c b/libavcodec/x86/dsputil_init.c index 898c3639cf..a38cf24d3c 100644 --- a/libavcodec/x86/dsputil_init.c +++ b/libavcodec/x86/dsputil_init.c @@ -20,6 +20,7 @@ #include "libavutil/attributes.h" #include "libavutil/cpu.h" #include "libavutil/x86/asm.h" +#include "libavutil/x86/cpu.h" #include "libavcodec/dsputil.h" #include "libavcodec/simple_idct.h" #include "dsputil_x86.h" @@ -695,22 +696,22 @@ av_cold void ff_dsputil_init_x86(DSPContext *c, AVCodecContext *avctx) c->add_hfyu_median_prediction = ff_add_hfyu_median_prediction_cmov; #endif - if (cpu_flags & AV_CPU_FLAG_MMX) + if (X86_MMX(cpu_flags)) dsputil_init_mmx(c, avctx, cpu_flags); - if (cpu_flags & AV_CPU_FLAG_MMXEXT) + if (X86_MMXEXT(cpu_flags)) dsputil_init_mmxext(c, avctx, cpu_flags); - if (cpu_flags & AV_CPU_FLAG_SSE) + if (X86_SSE(cpu_flags)) dsputil_init_sse(c, avctx, cpu_flags); - if (cpu_flags & AV_CPU_FLAG_SSE2) + if (X86_SSE2(cpu_flags)) dsputil_init_sse2(c, avctx, cpu_flags); - if (cpu_flags & AV_CPU_FLAG_SSSE3) + if (EXTERNAL_SSSE3(cpu_flags)) dsputil_init_ssse3(c, avctx, cpu_flags); - if (cpu_flags & AV_CPU_FLAG_SSE4) + if (EXTERNAL_SSE4(cpu_flags)) dsputil_init_sse4(c, avctx, cpu_flags); if (CONFIG_ENCODERS) diff --git a/libavcodec/x86/dsputilenc_mmx.c b/libavcodec/x86/dsputilenc_mmx.c index 150c594b8d..7862028739 100644 --- a/libavcodec/x86/dsputilenc_mmx.c +++ b/libavcodec/x86/dsputilenc_mmx.c @@ -964,7 +964,7 @@ av_cold void ff_dsputilenc_init_mmx(DSPContext *c, AVCodecContext *avctx) #endif /* HAVE_YASM */ #if HAVE_INLINE_ASM - if (cpu_flags & AV_CPU_FLAG_MMX) { + if (INLINE_MMX(cpu_flags)) { const int dct_algo = avctx->dct_algo; if (avctx->bits_per_raw_sample <= 8 && (dct_algo==FF_DCT_AUTO || dct_algo==FF_DCT_MMX)) { @@ -998,7 +998,7 @@ av_cold void ff_dsputilenc_init_mmx(DSPContext *c, AVCodecContext *avctx) c->ssd_int8_vs_int16 = ssd_int8_vs_int16_mmx; - if (cpu_flags & AV_CPU_FLAG_MMXEXT) { + if (INLINE_MMXEXT(cpu_flags)) { c->sum_abs_dctelem = sum_abs_dctelem_mmxext; c->vsad[4] = vsad_intra16_mmxext; @@ -1009,12 +1009,12 @@ av_cold void ff_dsputilenc_init_mmx(DSPContext *c, AVCodecContext *avctx) c->sub_hfyu_median_prediction = sub_hfyu_median_prediction_mmxext; } - if (cpu_flags & AV_CPU_FLAG_SSE2) { + if (INLINE_SSE2(cpu_flags)) { c->sum_abs_dctelem= sum_abs_dctelem_sse2; } #if HAVE_SSSE3_INLINE - if (cpu_flags & AV_CPU_FLAG_SSSE3) { + if (INLINE_SSSE3(cpu_flags)) { if(!(avctx->flags & CODEC_FLAG_BITEXACT)){ c->try_8x8basis= try_8x8basis_ssse3; } @@ -1023,7 +1023,7 @@ av_cold void ff_dsputilenc_init_mmx(DSPContext *c, AVCodecContext *avctx) } #endif - if (cpu_flags & AV_CPU_FLAG_3DNOW) { + if (INLINE_AMD3DNOW(cpu_flags)) { if(!(avctx->flags & CODEC_FLAG_BITEXACT)){ c->try_8x8basis= try_8x8basis_3dnow; } diff --git a/libavcodec/x86/hpeldsp_init.c b/libavcodec/x86/hpeldsp_init.c index 7974021b42..209781c724 100644 --- a/libavcodec/x86/hpeldsp_init.c +++ b/libavcodec/x86/hpeldsp_init.c @@ -24,6 +24,7 @@ #include "libavutil/cpu.h" #include "libavutil/x86/asm.h" +#include "libavutil/x86/cpu.h" #include "libavcodec/hpeldsp.h" #include "dsputil_x86.h" @@ -254,15 +255,15 @@ void ff_hpeldsp_init_x86(HpelDSPContext *c, int flags) { int cpu_flags = av_get_cpu_flags(); - if (cpu_flags & AV_CPU_FLAG_MMX) + if (INLINE_MMX(cpu_flags)) hpeldsp_init_mmx(c, flags, cpu_flags); - if (cpu_flags & AV_CPU_FLAG_MMXEXT) + if (EXTERNAL_MMXEXT(cpu_flags)) hpeldsp_init_mmxext(c, flags, cpu_flags); - if (cpu_flags & AV_CPU_FLAG_3DNOW) + if (EXTERNAL_AMD3DNOW(cpu_flags)) hpeldsp_init_3dnow(c, flags, cpu_flags); - if (cpu_flags & AV_CPU_FLAG_SSE2) + if (EXTERNAL_SSE2(cpu_flags)) hpeldsp_init_sse2(c, flags, cpu_flags); } diff --git a/libavcodec/x86/lpc.c b/libavcodec/x86/lpc.c index aa36bc121c..12245c4298 100644 --- a/libavcodec/x86/lpc.c +++ b/libavcodec/x86/lpc.c @@ -19,11 +19,12 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "libavutil/x86/asm.h" #include "libavutil/attributes.h" #include "libavutil/cpu.h" #include "libavutil/internal.h" #include "libavutil/mem.h" +#include "libavutil/x86/asm.h" +#include "libavutil/x86/cpu.h" #include "libavcodec/lpc.h" DECLARE_ASM_CONST(16, double, pd_1)[2] = { 1.0, 1.0 }; @@ -151,7 +152,7 @@ av_cold void ff_lpc_init_x86(LPCContext *c) #if HAVE_SSE2_INLINE int cpu_flags = av_get_cpu_flags(); - if (cpu_flags & (AV_CPU_FLAG_SSE2 | AV_CPU_FLAG_SSE2SLOW)) { + if (INLINE_SSE2(cpu_flags) && (cpu_flags & AV_CPU_FLAG_SSE2SLOW)) { c->lpc_apply_welch_window = lpc_apply_welch_window_sse2; c->lpc_compute_autocorr = lpc_compute_autocorr_sse2; } diff --git a/libavcodec/x86/motion_est.c b/libavcodec/x86/motion_est.c index 361c16f02a..41b9c5c781 100644 --- a/libavcodec/x86/motion_est.c +++ b/libavcodec/x86/motion_est.c @@ -26,6 +26,7 @@ #include "libavutil/internal.h" #include "libavutil/mem.h" #include "libavutil/x86/asm.h" +#include "libavutil/x86/cpu.h" #include "dsputil_x86.h" #if HAVE_INLINE_ASM @@ -437,7 +438,7 @@ av_cold void ff_dsputil_init_pix_mmx(DSPContext *c, AVCodecContext *avctx) #if HAVE_INLINE_ASM int cpu_flags = av_get_cpu_flags(); - if (cpu_flags & AV_CPU_FLAG_MMX) { + if (INLINE_MMX(cpu_flags)) { c->pix_abs[0][0] = sad16_mmx; c->pix_abs[0][1] = sad16_x2_mmx; c->pix_abs[0][2] = sad16_y2_mmx; @@ -450,7 +451,7 @@ av_cold void ff_dsputil_init_pix_mmx(DSPContext *c, AVCodecContext *avctx) c->sad[0]= sad16_mmx; c->sad[1]= sad8_mmx; } - if (cpu_flags & AV_CPU_FLAG_MMXEXT) { + if (INLINE_MMXEXT(cpu_flags)) { c->pix_abs[0][0] = sad16_mmxext; c->pix_abs[1][0] = sad8_mmxext; @@ -466,7 +467,7 @@ av_cold void ff_dsputil_init_pix_mmx(DSPContext *c, AVCodecContext *avctx) c->pix_abs[1][3] = sad8_xy2_mmxext; } } - if ((cpu_flags & AV_CPU_FLAG_SSE2) && !(cpu_flags & AV_CPU_FLAG_3DNOW)) { + if (INLINE_SSE2(cpu_flags) && !(cpu_flags & AV_CPU_FLAG_3DNOW)) { c->sad[0]= sad16_sse2; } #endif /* HAVE_INLINE_ASM */ diff --git a/libavcodec/x86/mpegvideo.c b/libavcodec/x86/mpegvideo.c index 2289a6dcc1..caf1e3a96d 100644 --- a/libavcodec/x86/mpegvideo.c +++ b/libavcodec/x86/mpegvideo.c @@ -22,6 +22,7 @@ #include "libavutil/attributes.h" #include "libavutil/cpu.h" #include "libavutil/x86/asm.h" +#include "libavutil/x86/cpu.h" #include "libavcodec/avcodec.h" #include "libavcodec/mpegvideo.h" #include "dsputil_x86.h" @@ -559,7 +560,7 @@ av_cold void ff_MPV_common_init_x86(MpegEncContext *s) #if HAVE_INLINE_ASM int cpu_flags = av_get_cpu_flags(); - if (cpu_flags & AV_CPU_FLAG_MMX) { + if (INLINE_MMX(cpu_flags)) { s->dct_unquantize_h263_intra = dct_unquantize_h263_intra_mmx; s->dct_unquantize_h263_inter = dct_unquantize_h263_inter_mmx; s->dct_unquantize_mpeg1_intra = dct_unquantize_mpeg1_intra_mmx; @@ -567,8 +568,7 @@ av_cold void ff_MPV_common_init_x86(MpegEncContext *s) if(!(s->flags & CODEC_FLAG_BITEXACT)) s->dct_unquantize_mpeg2_intra = dct_unquantize_mpeg2_intra_mmx; s->dct_unquantize_mpeg2_inter = dct_unquantize_mpeg2_inter_mmx; - - if (cpu_flags & AV_CPU_FLAG_SSE2) { + if (INLINE_SSE2(cpu_flags)) { s->denoise_dct= denoise_dct_sse2; } else { s->denoise_dct= denoise_dct_mmx; diff --git a/libavcodec/x86/vc1dsp_init.c b/libavcodec/x86/vc1dsp_init.c index 2ee7699d60..c477d8485c 100644 --- a/libavcodec/x86/vc1dsp_init.c +++ b/libavcodec/x86/vc1dsp_init.c @@ -100,31 +100,29 @@ av_cold void ff_vc1dsp_init_x86(VC1DSPContext *dsp) dsp->vc1_h_loop_filter16 = vc1_h_loop_filter16_ ## EXT #if HAVE_YASM - if (cpu_flags & AV_CPU_FLAG_MMX) { + if (EXTERNAL_MMX(cpu_flags)) { dsp->put_no_rnd_vc1_chroma_pixels_tab[0] = ff_put_vc1_chroma_mc8_nornd_mmx; } - - if (cpu_flags & AV_CPU_FLAG_MMXEXT) { + if (EXTERNAL_MMXEXT(cpu_flags)) { ASSIGN_LF(mmxext); dsp->avg_no_rnd_vc1_chroma_pixels_tab[0] = ff_avg_vc1_chroma_mc8_nornd_mmxext; dsp->avg_vc1_mspel_pixels_tab[0] = avg_vc1_mspel_mc00_mmxext; - } else if (cpu_flags & AV_CPU_FLAG_3DNOW) { + } else if (EXTERNAL_AMD3DNOW(cpu_flags)) { dsp->avg_no_rnd_vc1_chroma_pixels_tab[0] = ff_avg_vc1_chroma_mc8_nornd_3dnow; } - - if (cpu_flags & AV_CPU_FLAG_SSE2) { + if (EXTERNAL_SSE2(cpu_flags)) { dsp->vc1_v_loop_filter8 = ff_vc1_v_loop_filter8_sse2; dsp->vc1_h_loop_filter8 = ff_vc1_h_loop_filter8_sse2; dsp->vc1_v_loop_filter16 = vc1_v_loop_filter16_sse2; dsp->vc1_h_loop_filter16 = vc1_h_loop_filter16_sse2; } - if (cpu_flags & AV_CPU_FLAG_SSSE3) { + if (EXTERNAL_SSSE3(cpu_flags)) { ASSIGN_LF(ssse3); dsp->put_no_rnd_vc1_chroma_pixels_tab[0] = ff_put_vc1_chroma_mc8_nornd_ssse3; dsp->avg_no_rnd_vc1_chroma_pixels_tab[0] = ff_avg_vc1_chroma_mc8_nornd_ssse3; } - if (cpu_flags & AV_CPU_FLAG_SSE4) { + if (EXTERNAL_SSE4(cpu_flags)) { dsp->vc1_h_loop_filter8 = ff_vc1_h_loop_filter8_sse4; dsp->vc1_h_loop_filter16 = vc1_h_loop_filter16_sse4; } diff --git a/libavcodec/x86/videodsp_init.c b/libavcodec/x86/videodsp_init.c index 0b88845dad..f7fd267e11 100644 --- a/libavcodec/x86/videodsp_init.c +++ b/libavcodec/x86/videodsp_init.c @@ -24,6 +24,7 @@ #include "libavutil/cpu.h" #include "libavutil/mem.h" #include "libavutil/x86/asm.h" +#include "libavutil/x86/cpu.h" #include "libavcodec/videodsp.h" #if HAVE_YASM @@ -103,17 +104,17 @@ av_cold void ff_videodsp_init_x86(VideoDSPContext *ctx, int bpc) int cpu_flags = av_get_cpu_flags(); #if ARCH_X86_32 - if (bpc <= 8 && cpu_flags & AV_CPU_FLAG_MMX) { + if (EXTERNAL_MMX(cpu_flags) && bpc <= 8) { ctx->emulated_edge_mc = emulated_edge_mc_mmx; } - if (cpu_flags & AV_CPU_FLAG_3DNOW) { + if (EXTERNAL_AMD3DNOW(cpu_flags)) { ctx->prefetch = ff_prefetch_3dnow; } #endif /* ARCH_X86_32 */ - if (cpu_flags & AV_CPU_FLAG_MMXEXT) { + if (EXTERNAL_MMXEXT(cpu_flags)) { ctx->prefetch = ff_prefetch_mmxext; } - if (bpc <= 8 && cpu_flags & AV_CPU_FLAG_SSE) { + if (EXTERNAL_SSE(cpu_flags) && bpc <= 8) { ctx->emulated_edge_mc = emulated_edge_mc_sse; } #endif /* HAVE_YASM */ diff --git a/libavcodec/x86/vorbisdsp_init.c b/libavcodec/x86/vorbisdsp_init.c index 9f7954bcb7..2a978b66aa 100644 --- a/libavcodec/x86/vorbisdsp_init.c +++ b/libavcodec/x86/vorbisdsp_init.c @@ -21,6 +21,7 @@ #include "config.h" #include "libavutil/attributes.h" #include "libavutil/cpu.h" +#include "libavutil/x86/cpu.h" #include "libavcodec/vorbisdsp.h" void ff_vorbis_inverse_coupling_3dnow(float *mag, float *ang, @@ -34,10 +35,10 @@ av_cold void ff_vorbisdsp_init_x86(VorbisDSPContext *dsp) int cpu_flags = av_get_cpu_flags(); #if ARCH_X86_32 - if (cpu_flags & AV_CPU_FLAG_3DNOW) + if (EXTERNAL_AMD3DNOW(cpu_flags)) dsp->vorbis_inverse_coupling = ff_vorbis_inverse_coupling_3dnow; #endif /* ARCH_X86_32 */ - if (cpu_flags & AV_CPU_FLAG_SSE) + if (EXTERNAL_SSE(cpu_flags)) dsp->vorbis_inverse_coupling = ff_vorbis_inverse_coupling_sse; #endif /* HAVE_YASM */ } diff --git a/libavcodec/x86/vp8dsp_init.c b/libavcodec/x86/vp8dsp_init.c index 6677743571..6d06666888 100644 --- a/libavcodec/x86/vp8dsp_init.c +++ b/libavcodec/x86/vp8dsp_init.c @@ -23,6 +23,7 @@ #include "libavutil/cpu.h" #include "libavutil/mem.h" #include "libavutil/x86/asm.h" +#include "libavutil/x86/cpu.h" #include "libavcodec/vp8dsp.h" #if HAVE_YASM @@ -318,7 +319,7 @@ av_cold void ff_vp8dsp_init_x86(VP8DSPContext* c) #if HAVE_YASM int cpu_flags = av_get_cpu_flags(); - if (cpu_flags & AV_CPU_FLAG_MMX) { + if (EXTERNAL_MMX(cpu_flags)) { c->vp8_idct_dc_add = ff_vp8_idct_dc_add_mmx; c->vp8_idct_dc_add4uv = ff_vp8_idct_dc_add4uv_mmx; #if ARCH_X86_32 @@ -349,7 +350,7 @@ av_cold void ff_vp8dsp_init_x86(VP8DSPContext* c) /* note that 4-tap width=16 functions are missing because w=16 * is only used for luma, and luma is always a copy or sixtap. */ - if (cpu_flags & AV_CPU_FLAG_MMXEXT) { + if (EXTERNAL_MMXEXT(cpu_flags)) { VP8_MC_FUNC(2, 4, mmxext); VP8_BILINEAR_MC_FUNC(2, 4, mmxext); #if ARCH_X86_32 @@ -373,14 +374,14 @@ av_cold void ff_vp8dsp_init_x86(VP8DSPContext* c) #endif } - if (cpu_flags & AV_CPU_FLAG_SSE) { + if (EXTERNAL_SSE(cpu_flags)) { c->vp8_idct_add = ff_vp8_idct_add_sse; c->vp8_luma_dc_wht = ff_vp8_luma_dc_wht_sse; c->put_vp8_epel_pixels_tab[0][0][0] = c->put_vp8_bilinear_pixels_tab[0][0][0] = ff_put_vp8_pixels16_sse; } - if (cpu_flags & (AV_CPU_FLAG_SSE2 | AV_CPU_FLAG_SSE2SLOW)) { + if (EXTERNAL_SSE2(cpu_flags) && (cpu_flags & AV_CPU_FLAG_SSE2SLOW)) { VP8_LUMA_MC_FUNC(0, 16, sse2); VP8_MC_FUNC(1, 8, sse2); VP8_BILINEAR_MC_FUNC(0, 16, sse2); @@ -395,7 +396,7 @@ av_cold void ff_vp8dsp_init_x86(VP8DSPContext* c) c->vp8_v_loop_filter8uv = ff_vp8_v_loop_filter8uv_mbedge_sse2; } - if (cpu_flags & AV_CPU_FLAG_SSE2) { + if (EXTERNAL_SSE2(cpu_flags)) { c->vp8_idct_dc_add4y = ff_vp8_idct_dc_add4y_sse2; c->vp8_h_loop_filter_simple = ff_vp8_h_loop_filter_simple_sse2; @@ -407,7 +408,7 @@ av_cold void ff_vp8dsp_init_x86(VP8DSPContext* c) c->vp8_h_loop_filter8uv = ff_vp8_h_loop_filter8uv_mbedge_sse2; } - if (cpu_flags & AV_CPU_FLAG_SSSE3) { + if (EXTERNAL_SSSE3(cpu_flags)) { VP8_LUMA_MC_FUNC(0, 16, ssse3); VP8_MC_FUNC(1, 8, ssse3); VP8_MC_FUNC(2, 4, ssse3); @@ -429,7 +430,7 @@ av_cold void ff_vp8dsp_init_x86(VP8DSPContext* c) c->vp8_h_loop_filter8uv = ff_vp8_h_loop_filter8uv_mbedge_ssse3; } - if (cpu_flags & AV_CPU_FLAG_SSE4) { + if (EXTERNAL_SSE4(cpu_flags)) { c->vp8_idct_dc_add = ff_vp8_idct_dc_add_sse4; c->vp8_h_loop_filter_simple = ff_vp8_h_loop_filter_simple_sse4; |