diff --git a/libavcodec/arm/dsputil_iwmmxt.c b/libavcodec/arm/dsputil_iwmmxt.c index 6a23732e3334932dc221e9201d138c57cb0b2dee..a23ccfc58ff7b4c888ec3f0e91277b46d0ed33a3 100644 --- a/libavcodec/arm/dsputil_iwmmxt.c +++ b/libavcodec/arm/dsputil_iwmmxt.c @@ -150,10 +150,11 @@ static void nop(uint8_t *block, const uint8_t *pixels, int line_size, int h) /* A run time test is not simple. If this file is compiled in * then we should install the functions */ -int mm_flags = FF_MM_IWMMXT; /* multimedia extension flags */ void ff_dsputil_init_iwmmxt(DSPContext* c, AVCodecContext *avctx) { + int mm_flags = FF_MM_IWMMXT; /* multimedia extension flags */ + if (avctx->dsp_mask) { if (avctx->dsp_mask & FF_MM_FORCE) mm_flags |= (avctx->dsp_mask & 0xffff); diff --git a/libavcodec/dsputil.h b/libavcodec/dsputil.h index 9ef0270ade88eb06795a3af14ae686702c2e09c7..31eeb7bb10682fec735d333997c52d40d8d688a7 100644 --- a/libavcodec/dsputil.h +++ b/libavcodec/dsputil.h @@ -618,7 +618,6 @@ static inline int get_penalty_factor(int lambda, int lambda2, int type){ /* should be defined by architectures supporting one or more MultiMedia extension */ int mm_support(void); -extern int mm_flags; void dsputil_init_alpha(DSPContext* c, AVCodecContext *avctx); void dsputil_init_arm(DSPContext* c, AVCodecContext *avctx); @@ -647,12 +646,7 @@ static inline void emms(void) __asm__ volatile ("emms;":::"memory"); } - -#define emms_c() \ -{\ - if (mm_flags & FF_MM_MMX)\ - emms();\ -} +#define emms_c() emms() #elif ARCH_ARM @@ -670,7 +664,6 @@ static inline void emms(void) #else -#define mm_flags 0 #define mm_support() 0 #endif diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c index d9d6f7e5d673c4e6125b7d2d2dc77c0ffadb96bb..9091042abb7b59015511a50b3fbc963312b3dfe2 100644 --- a/libavcodec/h263dec.c +++ b/libavcodec/h263dec.c @@ -553,7 +553,7 @@ retry: #endif #if HAVE_MMX - if(s->codec_id == CODEC_ID_MPEG4 && s->xvid_build>=0 && avctx->idct_algo == FF_IDCT_AUTO && (mm_flags & FF_MM_MMX)){ + if(s->codec_id == CODEC_ID_MPEG4 && s->xvid_build>=0 && avctx->idct_algo == FF_IDCT_AUTO && (mm_support() & FF_MM_MMX)){ avctx->idct_algo= FF_IDCT_XVIDMMX; avctx->coded_width= 0; // force reinit // dsputil_init(&s->dsp, avctx); diff --git a/libavcodec/ppc/dsputil_ppc.c b/libavcodec/ppc/dsputil_ppc.c index 229ca0996001bca70a55b4f0dd58ccefbdb7c069..4f1c501c77bf8216ebb0215208fcefef669ba009 100644 --- a/libavcodec/ppc/dsputil_ppc.c +++ b/libavcodec/ppc/dsputil_ppc.c @@ -23,8 +23,6 @@ #include "libavcodec/dsputil.h" #include "dsputil_altivec.h" -int mm_flags = 0; - int mm_support(void) { int result = 0; @@ -182,8 +180,6 @@ void dsputil_init_ppc(DSPContext* c, AVCodecContext *avctx) if(CONFIG_H264_DECODER) dsputil_h264_init_ppc(c, avctx); if (has_altivec()) { - mm_flags |= FF_MM_ALTIVEC; - dsputil_init_altivec(c, avctx); if(CONFIG_VC1_DECODER) vc1dsp_init_altivec(c, avctx); diff --git a/libavcodec/ppc/mpegvideo_altivec.c b/libavcodec/ppc/mpegvideo_altivec.c index 0126b7f42edf5a3994cb1c338563fbe1cf6bb28f..19d897fe66c1b7a62efaeb8d508b34c30d4004fd 100644 --- a/libavcodec/ppc/mpegvideo_altivec.c +++ b/libavcodec/ppc/mpegvideo_altivec.c @@ -570,7 +570,7 @@ static void dct_unquantize_h263_altivec(MpegEncContext *s, void MPV_common_init_altivec(MpegEncContext *s) { - if ((mm_flags & FF_MM_ALTIVEC) == 0) return; + if (!has_altivec()) return; if (s->avctx->lowres==0) { if ((s->avctx->idct_algo == FF_IDCT_AUTO) || diff --git a/libavcodec/x86/dnxhd_mmx.c b/libavcodec/x86/dnxhd_mmx.c index 59bcb3929bf992e6afeeb80b1cdbd283bd70d7b6..1e6299bcd11d426cc51a2e837215eeb325c675d8 100644 --- a/libavcodec/x86/dnxhd_mmx.c +++ b/libavcodec/x86/dnxhd_mmx.c @@ -52,7 +52,7 @@ static void get_pixels_8x4_sym_sse2(DCTELEM *block, const uint8_t *pixels, int l void ff_dnxhd_init_mmx(DNXHDEncContext *ctx) { - if (mm_flags & FF_MM_SSE2) { + if (mm_support() & FF_MM_SSE2) { ctx->get_pixels_8x4_sym = get_pixels_8x4_sym_sse2; } } diff --git a/libavcodec/x86/dsputil_mmx.c b/libavcodec/x86/dsputil_mmx.c index 2b96be3a33e7b2fb462cf62c2cf154ccb70e2424..1163e438172e7b470ffa2e43060b475ff836ef61 100644 --- a/libavcodec/x86/dsputil_mmx.c +++ b/libavcodec/x86/dsputil_mmx.c @@ -37,8 +37,6 @@ //#undef NDEBUG //#include <assert.h> -int mm_flags; /* multimedia extension flags */ - /* pixel operations */ DECLARE_ALIGNED(8, const uint64_t, ff_bone) = 0x0101010101010101ULL; DECLARE_ALIGNED(8, const uint64_t, ff_wtwo) = 0x0002000200020002ULL; @@ -2504,7 +2502,7 @@ float ff_scalarproduct_float_sse(const float *v1, const float *v2, int order); void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx) { - mm_flags = mm_support(); + int mm_flags = mm_support(); if (avctx->dsp_mask) { if (avctx->dsp_mask & FF_MM_FORCE) @@ -2941,7 +2939,7 @@ void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx) #if CONFIG_H264DSP void ff_h264dsp_init_x86(H264DSPContext *c) { - mm_flags = mm_support(); + int mm_flags = mm_support(); if (mm_flags & FF_MM_MMX) { c->h264_idct_dc_add= diff --git a/libavcodec/x86/dsputilenc_mmx.c b/libavcodec/x86/dsputilenc_mmx.c index d3e412a3dcee340dec2c26efe8656c211625cdd0..bc24abadc72876856ab6c2372414e2c6974ef562 100644 --- a/libavcodec/x86/dsputilenc_mmx.c +++ b/libavcodec/x86/dsputilenc_mmx.c @@ -1350,6 +1350,8 @@ static int ssd_int8_vs_int16_mmx(const int8_t *pix1, const int16_t *pix2, int si void dsputilenc_init_mmx(DSPContext* c, AVCodecContext *avctx) { + int mm_flags = mm_support(); + if (mm_flags & FF_MM_MMX) { const int dct_algo = avctx->dct_algo; if(dct_algo==FF_DCT_AUTO || dct_algo==FF_DCT_MMX){ diff --git a/libavcodec/x86/h264dsp_mmx.c b/libavcodec/x86/h264dsp_mmx.c index ebd87518baf73812dd6c74497ac7e12a8a554773..e402e420f8362ded6c14f03bbc1ccd5979581239 100644 --- a/libavcodec/x86/h264dsp_mmx.c +++ b/libavcodec/x86/h264dsp_mmx.c @@ -2368,7 +2368,7 @@ void ff_pred4x4_vertical_vp8_mmxext(uint8_t *src, const uint8_t *topright, int s #if CONFIG_H264PRED void ff_h264_pred_init_x86(H264PredContext *h, int codec_id) { - mm_flags = mm_support(); + int mm_flags = mm_support(); #if HAVE_YASM if (mm_flags & FF_MM_MMX) { diff --git a/libavcodec/x86/motion_est_mmx.c b/libavcodec/x86/motion_est_mmx.c index 0272410dc56f757c3444c508c1ccf4936eefd37a..87e7a15a471a2fbd208bc89e62ae58e18c941861 100644 --- a/libavcodec/x86/motion_est_mmx.c +++ b/libavcodec/x86/motion_est_mmx.c @@ -427,6 +427,8 @@ PIX_SAD(mmx2) void dsputil_init_pix_mmx(DSPContext* c, AVCodecContext *avctx) { + int mm_flags = mm_support(); + if (mm_flags & FF_MM_MMX) { c->pix_abs[0][0] = sad16_mmx; c->pix_abs[0][1] = sad16_x2_mmx; diff --git a/libavcodec/x86/mpegaudiodec_mmx.c b/libavcodec/x86/mpegaudiodec_mmx.c index e7e1150789fd5ca4cbb467dc9b56438f55d81f00..f4c9b45986be7661e9698c3f843d95571300d25d 100644 --- a/libavcodec/x86/mpegaudiodec_mmx.c +++ b/libavcodec/x86/mpegaudiodec_mmx.c @@ -149,7 +149,7 @@ static void apply_window_mp3(float *in, float *win, int *unused, float *out, void ff_mpegaudiodec_init_mmx(MPADecodeContext *s) { - mm_flags = mm_support(); + int mm_flags = mm_support(); if (mm_flags & FF_MM_SSE2) { s->apply_window_mp3 = apply_window_mp3; diff --git a/libavcodec/x86/mpegvideo_mmx.c b/libavcodec/x86/mpegvideo_mmx.c index 5deb68d28d911b5eff38a34f5348a9057a88985b..3556e1caa77da0644de414e8264d9c3af6b9ad63 100644 --- a/libavcodec/x86/mpegvideo_mmx.c +++ b/libavcodec/x86/mpegvideo_mmx.c @@ -625,6 +625,8 @@ static void denoise_dct_sse2(MpegEncContext *s, DCTELEM *block){ void MPV_common_init_mmx(MpegEncContext *s) { + int mm_flags = mm_support(); + if (mm_flags & FF_MM_MMX) { const int dct_algo = s->avctx->dct_algo; diff --git a/libavcodec/x86/snowdsp_mmx.c b/libavcodec/x86/snowdsp_mmx.c index 263f0bbf699b8ca3264295e131e16017169bca1e..96b3bf29ba21ce1d9e3e15e0a367d60fe03fae9d 100644 --- a/libavcodec/x86/snowdsp_mmx.c +++ b/libavcodec/x86/snowdsp_mmx.c @@ -874,7 +874,7 @@ static void ff_snow_inner_add_yblock_mmx(const uint8_t *obmc, const int obmc_str void ff_dwt_init_x86(DWTContext *c) { - mm_flags = mm_support(); + int mm_flags = mm_support(); if (mm_flags & FF_MM_MMX) { if(mm_flags & FF_MM_SSE2 & 0){ diff --git a/libavcodec/x86/vc1dsp_mmx.c b/libavcodec/x86/vc1dsp_mmx.c index 3ce097894d014ca1851b507b860938468008e946..eb3ad2c32fa3f5cff6a3fcbf1cf82ca59c6dc582 100644 --- a/libavcodec/x86/vc1dsp_mmx.c +++ b/libavcodec/x86/vc1dsp_mmx.c @@ -714,7 +714,7 @@ static void vc1_h_loop_filter16_sse4(uint8_t *src, int stride, int pq) #endif void ff_vc1dsp_init_mmx(DSPContext* dsp, AVCodecContext *avctx) { - mm_flags = mm_support(); + int mm_flags = mm_support(); 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; diff --git a/libavcodec/x86/vp8dsp-init.c b/libavcodec/x86/vp8dsp-init.c index aceec6a346431f8b3d14993af8f3b8c4ccd250c0..ed5cf460248da504c3a7671cb4cf776a98bb6c04 100644 --- a/libavcodec/x86/vp8dsp-init.c +++ b/libavcodec/x86/vp8dsp-init.c @@ -282,7 +282,7 @@ DECLARE_LOOP_FILTER(sse4) av_cold void ff_vp8dsp_init_x86(VP8DSPContext* c) { - mm_flags = mm_support(); + int mm_flags = mm_support(); #if HAVE_YASM if (mm_flags & FF_MM_MMX) {