# HG changeset patch # User stefano # Date 1283958434 0 # Node ID 9fef0a8ddd635adf3aecf01fac80ba020a4f6dba # Parent cf54b8e98e7a59d3c86c1aa6282e13d2aa67d03e Move mm_support() from libavcodec to libavutil, make it a public function and rename it to av_get_cpu_flags(). diff -r cf54b8e98e7a -r 9fef0a8ddd63 Makefile --- a/Makefile Wed Sep 08 14:36:13 2010 +0000 +++ b/Makefile Wed Sep 08 15:07:14 2010 +0000 @@ -633,7 +633,6 @@ EXAMPLES = api TESTPROGS = cabac dct eval fft h264 iirfilter rangecoder snow -TESTPROGS-$(ARCH_X86) += x86/cpuid TESTPROGS-$(HAVE_MMX) += motion TESTOBJS = dctref.o diff -r cf54b8e98e7a -r 9fef0a8ddd63 arm/dsputil_init_arm.c --- a/arm/dsputil_init_arm.c Wed Sep 08 14:36:13 2010 +0000 +++ b/arm/dsputil_init_arm.c Wed Sep 08 15:07:14 2010 +0000 @@ -73,11 +73,6 @@ ff_add_pixels_clamped(block, dest, line_size); } -int mm_support(void) -{ - return HAVE_IWMMXT * AV_CPU_FLAG_IWMMXT; -} - void dsputil_init_arm(DSPContext* c, AVCodecContext *avctx) { ff_put_pixels_clamped = c->put_pixels_clamped; diff -r cf54b8e98e7a -r 9fef0a8ddd63 avcodec.h --- a/avcodec.h Wed Sep 08 14:36:13 2010 +0000 +++ b/avcodec.h Wed Sep 08 15:07:14 2010 +0000 @@ -32,7 +32,7 @@ #define LIBAVCODEC_VERSION_MAJOR 52 #define LIBAVCODEC_VERSION_MINOR 87 -#define LIBAVCODEC_VERSION_MICRO 4 +#define LIBAVCODEC_VERSION_MICRO 5 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ LIBAVCODEC_VERSION_MINOR, \ diff -r cf54b8e98e7a -r 9fef0a8ddd63 dct-test.c --- a/dct-test.c Wed Sep 08 14:36:13 2010 +0000 +++ b/dct-test.c Wed Sep 08 15:07:14 2010 +0000 @@ -32,6 +32,7 @@ #include #include +#include "libavutil/cpu.h" #include "libavutil/common.h" #include "libavutil/lfg.h" @@ -554,7 +555,7 @@ int test_idct = 0, test_248_dct = 0; int c,i; int test=1; - cpu_flags = mm_support(); + cpu_flags = av_get_cpu_flags(); ff_ref_dct_init(); idct_mmx_init(); diff -r cf54b8e98e7a -r 9fef0a8ddd63 dsputil.h --- a/dsputil.h Wed Sep 08 14:36:13 2010 +0000 +++ b/dsputil.h Wed Sep 08 15:07:14 2010 +0000 @@ -610,10 +610,6 @@ */ #define emms_c() -/* should be defined by architectures supporting - one or more MultiMedia extension */ -int mm_support(void); - void dsputil_init_alpha(DSPContext* c, AVCodecContext *avctx); void dsputil_init_arm(DSPContext* c, AVCodecContext *avctx); void dsputil_init_bfin(DSPContext* c, AVCodecContext *avctx); @@ -657,10 +653,6 @@ #define STRIDE_ALIGN 16 -#else - -#define mm_support() 0 - #endif #ifndef STRIDE_ALIGN diff -r cf54b8e98e7a -r 9fef0a8ddd63 h263dec.c --- a/h263dec.c Wed Sep 08 14:36:13 2010 +0000 +++ b/h263dec.c Wed Sep 08 15:07:14 2010 +0000 @@ -25,6 +25,7 @@ * H.263 decoder. */ +#include "libavutil/cpu.h" #include "internal.h" #include "avcodec.h" #include "dsputil.h" @@ -553,7 +554,7 @@ #endif #if HAVE_MMX - if(s->codec_id == CODEC_ID_MPEG4 && s->xvid_build>=0 && avctx->idct_algo == FF_IDCT_AUTO && (mm_support() & AV_CPU_FLAG_MMX)){ + if (s->codec_id == CODEC_ID_MPEG4 && s->xvid_build>=0 && avctx->idct_algo == FF_IDCT_AUTO && (av_get_cpu_flags() & AV_CPU_FLAG_MMX)) { avctx->idct_algo= FF_IDCT_XVIDMMX; avctx->coded_width= 0; // force reinit // dsputil_init(&s->dsp, avctx); diff -r cf54b8e98e7a -r 9fef0a8ddd63 libxvidff.c --- a/libxvidff.c Wed Sep 08 14:36:13 2010 +0000 +++ b/libxvidff.c Wed Sep 08 15:07:14 2010 +0000 @@ -31,7 +31,7 @@ #include #include #include "avcodec.h" -#include "dsputil.h" +#include "libavutil/cpu.h" #include "libavutil/intreadwrite.h" #include "libxvid_internal.h" #if !HAVE_MKSTEMP @@ -213,7 +213,7 @@ #if ARCH_PPC /* Xvid's PPC support is borked, use libavcodec to detect */ #if HAVE_ALTIVEC - if (mm_support() & AV_CPU_FLAG_ALTIVEC) { + if (av_get_cpu_flags() & AV_CPU_FLAG_ALTIVEC) { xvid_gbl_init.cpu_flags = XVID_CPU_FORCE | XVID_CPU_ALTIVEC; } else #endif diff -r cf54b8e98e7a -r 9fef0a8ddd63 ppc/Makefile --- a/ppc/Makefile Wed Sep 08 14:36:13 2010 +0000 +++ b/ppc/Makefile Wed Sep 08 15:07:14 2010 +0000 @@ -18,8 +18,7 @@ ALTIVEC-OBJS-$(CONFIG_FFT) += ppc/fft_altivec.o \ $(FFT-OBJS-yes) -OBJS-$(HAVE_ALTIVEC) += ppc/check_altivec.o \ - ppc/dsputil_altivec.o \ +OBJS-$(HAVE_ALTIVEC) += ppc/dsputil_altivec.o \ ppc/fdct_altivec.o \ ppc/float_altivec.o \ ppc/gmc_altivec.o \ diff -r cf54b8e98e7a -r 9fef0a8ddd63 ppc/check_altivec.c --- a/ppc/check_altivec.c Wed Sep 08 14:36:13 2010 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,92 +0,0 @@ -/* - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - - -/** - * @file - * Check for AltiVec presence. - */ - -#ifdef __APPLE__ -#undef _POSIX_C_SOURCE -#include -#elif defined(__OpenBSD__) -#include -#include -#include -#elif defined(__AMIGAOS4__) -#include -#include -#include -#endif /* __APPLE__ */ - -#include "config.h" -#include "dsputil_altivec.h" - -/** - * This function MAY rely on signal() or fork() in order to make sure AltiVec - * is present. - */ - -int mm_support(void) -{ -#if HAVE_ALTIVEC -#ifdef __AMIGAOS4__ - ULONG result = 0; - extern struct ExecIFace *IExec; - - IExec->GetCPUInfoTags(GCIT_VectorUnit, &result, TAG_DONE); - if (result == VECTORTYPE_ALTIVEC) - return AV_CPU_FLAG_ALTIVEC; - return 0; -#elif defined(__APPLE__) || defined(__OpenBSD__) -#ifdef __OpenBSD__ - int sels[2] = {CTL_MACHDEP, CPU_ALTIVEC}; -#else - int sels[2] = {CTL_HW, HW_VECTORUNIT}; -#endif - int has_vu = 0; - size_t len = sizeof(has_vu); - int err; - - err = sysctl(sels, 2, &has_vu, &len, NULL, 0); - - if (err == 0) - return has_vu ? AV_CPU_FLAG_ALTIVEC : 0; - return 0; -#elif CONFIG_RUNTIME_CPUDETECT - int proc_ver; - // Support of mfspr PVR emulation added in Linux 2.6.17. - __asm__ volatile("mfspr %0, 287" : "=r" (proc_ver)); - proc_ver >>= 16; - if (proc_ver & 0x8000 || - proc_ver == 0x000c || - proc_ver == 0x0039 || proc_ver == 0x003c || - proc_ver == 0x0044 || proc_ver == 0x0045 || - proc_ver == 0x0070) - return AV_CPU_FLAG_ALTIVEC; - return 0; -#else - // Since we were compiled for AltiVec, just assume we have it - // until someone comes up with a proper way (not involving signal hacks). - return AV_CPU_FLAG_ALTIVEC; -#endif /* __AMIGAOS4__ */ -#endif /* HAVE_ALTIVEC */ - return 0; -} - diff -r cf54b8e98e7a -r 9fef0a8ddd63 ppc/dsputil_ppc.c --- a/ppc/dsputil_ppc.c Wed Sep 08 14:36:13 2010 +0000 +++ b/ppc/dsputil_ppc.c Wed Sep 08 15:07:14 2010 +0000 @@ -20,6 +20,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include "libavutil/cpu.h" #include "libavcodec/dsputil.h" #include "dsputil_altivec.h" @@ -168,7 +169,7 @@ #if HAVE_ALTIVEC if(CONFIG_H264_DECODER) dsputil_h264_init_ppc(c, avctx); - if (mm_support() & AV_CPU_FLAG_ALTIVEC) { + if (av_get_cpu_flags() & AV_CPU_FLAG_ALTIVEC) { dsputil_init_altivec(c, avctx); if(CONFIG_VC1_DECODER) vc1dsp_init_altivec(c, avctx); diff -r cf54b8e98e7a -r 9fef0a8ddd63 ppc/h264_altivec.c --- a/ppc/h264_altivec.c Wed Sep 08 14:36:13 2010 +0000 +++ b/ppc/h264_altivec.c Wed Sep 08 15:07:14 2010 +0000 @@ -18,6 +18,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include "libavutil/cpu.h" #include "libavcodec/dsputil.h" #include "libavcodec/h264data.h" #include "libavcodec/h264dsp.h" @@ -969,7 +970,7 @@ void dsputil_h264_init_ppc(DSPContext* c, AVCodecContext *avctx) { - if (mm_support() & AV_CPU_FLAG_ALTIVEC) { + if (av_get_cpu_flags() & AV_CPU_FLAG_ALTIVEC) { c->put_h264_chroma_pixels_tab[0] = put_h264_chroma_mc8_altivec; c->avg_h264_chroma_pixels_tab[0] = avg_h264_chroma_mc8_altivec; c->put_no_rnd_vc1_chroma_pixels_tab[0] = put_no_rnd_vc1_chroma_mc8_altivec; @@ -1001,7 +1002,7 @@ void ff_h264dsp_init_ppc(H264DSPContext *c) { - if (mm_support() & AV_CPU_FLAG_ALTIVEC) { + if (av_get_cpu_flags() & AV_CPU_FLAG_ALTIVEC) { c->h264_idct_add = ff_h264_idct_add_altivec; c->h264_idct_add8 = ff_h264_idct_add8_altivec; c->h264_idct_add16 = ff_h264_idct_add16_altivec; diff -r cf54b8e98e7a -r 9fef0a8ddd63 ppc/mpegvideo_altivec.c --- a/ppc/mpegvideo_altivec.c Wed Sep 08 14:36:13 2010 +0000 +++ b/ppc/mpegvideo_altivec.c Wed Sep 08 15:07:14 2010 +0000 @@ -23,6 +23,7 @@ #include #include +#include "libavutil/cpu.h" #include "libavcodec/dsputil.h" #include "libavcodec/mpegvideo.h" @@ -570,7 +571,7 @@ void MPV_common_init_altivec(MpegEncContext *s) { - if (!(mm_support() & AV_CPU_FLAG_ALTIVEC)) return; + if (!(av_get_cpu_flags() & AV_CPU_FLAG_ALTIVEC)) return; if (s->avctx->lowres==0) { if ((s->avctx->idct_algo == FF_IDCT_AUTO) || diff -r cf54b8e98e7a -r 9fef0a8ddd63 ppc/vp8dsp_altivec.c --- a/ppc/vp8dsp_altivec.c Wed Sep 08 14:36:13 2010 +0000 +++ b/ppc/vp8dsp_altivec.c Wed Sep 08 15:07:14 2010 +0000 @@ -20,6 +20,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include "libavutil/cpu.h" #include "libavcodec/vp8dsp.h" #include "dsputil_altivec.h" #include "types_altivec.h" @@ -265,7 +266,7 @@ av_cold void ff_vp8dsp_init_altivec(VP8DSPContext *c) { - if (!(mm_support() & AV_CPU_FLAG_ALTIVEC)) + if (!(av_get_cpu_flags() & AV_CPU_FLAG_ALTIVEC)) return; c->put_vp8_epel_pixels_tab[0][0][0] = put_vp8_pixels16_altivec; diff -r cf54b8e98e7a -r 9fef0a8ddd63 x86/Makefile --- a/x86/Makefile Wed Sep 08 14:36:13 2010 +0000 +++ b/x86/Makefile Wed Sep 08 15:07:14 2010 +0000 @@ -43,8 +43,7 @@ MMX-OBJS-$(CONFIG_FFT) += x86/fft.o -OBJS-$(HAVE_MMX) += x86/cpuid.o \ - x86/dnxhd_mmx.o \ +OBJS-$(HAVE_MMX) += x86/dnxhd_mmx.o \ x86/dsputil_mmx.o \ x86/fdct_mmx.o \ x86/idct_mmx_xvid.o \ diff -r cf54b8e98e7a -r 9fef0a8ddd63 x86/cavsdsp_mmx.c --- a/x86/cavsdsp_mmx.c Wed Sep 08 14:36:13 2010 +0000 +++ b/x86/cavsdsp_mmx.c Wed Sep 08 15:07:14 2010 +0000 @@ -23,6 +23,7 @@ */ #include "libavutil/common.h" +#include "libavutil/cpu.h" #include "libavutil/x86_cpu.h" #include "libavcodec/dsputil.h" #include "libavcodec/cavsdsp.h" @@ -472,7 +473,7 @@ void ff_cavsdsp_init_mmx(CAVSDSPContext *c, AVCodecContext *avctx) { - int mm_flags = mm_support(); + int mm_flags = av_get_cpu_flags(); 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); diff -r cf54b8e98e7a -r 9fef0a8ddd63 x86/cpuid.c --- a/x86/cpuid.c Wed Sep 08 14:36:13 2010 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,150 +0,0 @@ -/* - * CPU detection code, extracted from mmx.h - * (c)1997-99 by H. Dietz and R. Fisher - * Converted to C and improved by Fabrice Bellard. - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include -#include "libavutil/x86_cpu.h" -#include "libavcodec/dsputil.h" - -#undef printf - -/* ebx saving is necessary for PIC. gcc seems unable to see it alone */ -#define cpuid(index,eax,ebx,ecx,edx)\ - __asm__ volatile\ - ("mov %%"REG_b", %%"REG_S"\n\t"\ - "cpuid\n\t"\ - "xchg %%"REG_b", %%"REG_S\ - : "=a" (eax), "=S" (ebx),\ - "=c" (ecx), "=d" (edx)\ - : "0" (index)); - -/* Function to test if multimedia instructions are supported... */ -int mm_support(void) -{ - int rval = 0; - int eax, ebx, ecx, edx; - int max_std_level, max_ext_level, std_caps=0, ext_caps=0; - int family=0, model=0; - union { int i[3]; char c[12]; } vendor; - -#if ARCH_X86_32 - x86_reg a, c; - __asm__ volatile ( - /* See if CPUID instruction is supported ... */ - /* ... Get copies of EFLAGS into eax and ecx */ - "pushfl\n\t" - "pop %0\n\t" - "mov %0, %1\n\t" - - /* ... Toggle the ID bit in one copy and store */ - /* to the EFLAGS reg */ - "xor $0x200000, %0\n\t" - "push %0\n\t" - "popfl\n\t" - - /* ... Get the (hopefully modified) EFLAGS */ - "pushfl\n\t" - "pop %0\n\t" - : "=a" (a), "=c" (c) - : - : "cc" - ); - - if (a == c) - return 0; /* CPUID not supported */ -#endif - - cpuid(0, max_std_level, vendor.i[0], vendor.i[2], vendor.i[1]); - - if(max_std_level >= 1){ - cpuid(1, eax, ebx, ecx, std_caps); - family = ((eax>>8)&0xf) + ((eax>>20)&0xff); - model = ((eax>>4)&0xf) + ((eax>>12)&0xf0); - if (std_caps & (1<<23)) - rval |= AV_CPU_FLAG_MMX; - if (std_caps & (1<<25)) - rval |= AV_CPU_FLAG_MMX2 -#if HAVE_SSE - | AV_CPU_FLAG_SSE; - if (std_caps & (1<<26)) - rval |= AV_CPU_FLAG_SSE2; - if (ecx & 1) - rval |= AV_CPU_FLAG_SSE3; - if (ecx & 0x00000200 ) - rval |= AV_CPU_FLAG_SSSE3; - if (ecx & 0x00080000 ) - rval |= AV_CPU_FLAG_SSE4; - if (ecx & 0x00100000 ) - rval |= AV_CPU_FLAG_SSE42; -#endif - ; - } - - cpuid(0x80000000, max_ext_level, ebx, ecx, edx); - - if(max_ext_level >= 0x80000001){ - cpuid(0x80000001, eax, ebx, ecx, ext_caps); - if (ext_caps & (1<<31)) - rval |= AV_CPU_FLAG_3DNOW; - if (ext_caps & (1<<30)) - rval |= AV_CPU_FLAG_3DNOWEXT; - if (ext_caps & (1<<23)) - rval |= AV_CPU_FLAG_MMX; - if (ext_caps & (1<<22)) - rval |= AV_CPU_FLAG_MMX2; - } - - if (!strncmp(vendor.c, "GenuineIntel", 12) && - family == 6 && (model == 9 || model == 13 || model == 14)) { - /* 6/9 (pentium-m "banias"), 6/13 (pentium-m "dothan"), and 6/14 (core1 "yonah") - * theoretically support sse2, but it's usually slower than mmx, - * so let's just pretend they don't. */ - if (rval & AV_CPU_FLAG_SSE2) rval ^= AV_CPU_FLAG_SSE2SLOW|AV_CPU_FLAG_SSE2; - if (rval & AV_CPU_FLAG_SSE3) rval ^= AV_CPU_FLAG_SSE3SLOW|AV_CPU_FLAG_SSE3; - } - -#if 0 - av_log(NULL, AV_LOG_DEBUG, "%s%s%s%s%s%s%s%s%s%s%s%s\n", - (rval&AV_CPU_FLAG_MMX) ? "MMX ":"", - (rval&AV_CPU_FLAG_MMX2) ? "MMX2 ":"", - (rval&AV_CPU_FLAG_SSE) ? "SSE ":"", - (rval&AV_CPU_FLAG_SSE2) ? "SSE2 ":"", - (rval&AV_CPU_FLAG_SSE2SLOW) ? "SSE2(slow) ":"", - (rval&AV_CPU_FLAG_SSE3) ? "SSE3 ":"", - (rval&AV_CPU_FLAG_SSE3SLOW) ? "SSE3(slow) ":"", - (rval&AV_CPU_FLAG_SSSE3) ? "SSSE3 ":"", - (rval&AV_CPU_FLAG_SSE4) ? "SSE4.1 ":"", - (rval&AV_CPU_FLAG_SSE42) ? "SSE4.2 ":"", - (rval&AV_CPU_FLAG_3DNOW) ? "3DNow ":"", - (rval&AV_CPU_FLAG_3DNOWEXT) ? "3DNowExt ":""); -#endif - return rval; -} - -#ifdef TEST -int main ( void ) -{ - int mm_flags; - mm_flags = mm_support(); - printf("mm_support = 0x%08X\n",mm_flags); - return 0; -} -#endif diff -r cf54b8e98e7a -r 9fef0a8ddd63 x86/dnxhd_mmx.c --- a/x86/dnxhd_mmx.c Wed Sep 08 14:36:13 2010 +0000 +++ b/x86/dnxhd_mmx.c Wed Sep 08 15:07:14 2010 +0000 @@ -52,7 +52,7 @@ void ff_dnxhd_init_mmx(DNXHDEncContext *ctx) { - if (mm_support() & AV_CPU_FLAG_SSE2) { + if (av_get_cpu_flags() & AV_CPU_FLAG_SSE2) { ctx->get_pixels_8x4_sym = get_pixels_8x4_sym_sse2; } } diff -r cf54b8e98e7a -r 9fef0a8ddd63 x86/dsputil_mmx.c --- a/x86/dsputil_mmx.c Wed Sep 08 14:36:13 2010 +0000 +++ b/x86/dsputil_mmx.c Wed Sep 08 15:07:14 2010 +0000 @@ -2523,7 +2523,7 @@ void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx) { - int mm_flags = mm_support(); + int mm_flags = av_get_cpu_flags(); if (avctx->dsp_mask) { if (avctx->dsp_mask & AV_CPU_FLAG_FORCE) diff -r cf54b8e98e7a -r 9fef0a8ddd63 x86/dsputilenc_mmx.c --- a/x86/dsputilenc_mmx.c Wed Sep 08 14:36:13 2010 +0000 +++ b/x86/dsputilenc_mmx.c Wed Sep 08 15:07:14 2010 +0000 @@ -22,6 +22,7 @@ * MMX optimization by Nick Kurshev */ +#include "libavutil/cpu.h" #include "libavutil/x86_cpu.h" #include "libavcodec/dsputil.h" #include "libavcodec/mpegvideo.h" @@ -1350,7 +1351,7 @@ void dsputilenc_init_mmx(DSPContext* c, AVCodecContext *avctx) { - int mm_flags = mm_support(); + int mm_flags = av_get_cpu_flags(); if (mm_flags & AV_CPU_FLAG_MMX) { const int dct_algo = avctx->dct_algo; diff -r cf54b8e98e7a -r 9fef0a8ddd63 x86/fft.c --- a/x86/fft.c Wed Sep 08 14:36:13 2010 +0000 +++ b/x86/fft.c Wed Sep 08 15:07:14 2010 +0000 @@ -16,13 +16,14 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include "libavutil/cpu.h" #include "libavcodec/dsputil.h" #include "fft.h" av_cold void ff_fft_init_mmx(FFTContext *s) { #if HAVE_YASM - int has_vectors = mm_support(); + int has_vectors = av_get_cpu_flags(); if (has_vectors & AV_CPU_FLAG_SSE && HAVE_SSE) { /* SSE for P3/P4/K8 */ s->imdct_calc = ff_imdct_calc_sse; @@ -46,7 +47,7 @@ #if CONFIG_DCT av_cold void ff_dct_init_mmx(DCTContext *s) { - int has_vectors = mm_support(); + int has_vectors = av_get_cpu_flags(); if (has_vectors & AV_CPU_FLAG_SSE && HAVE_SSE) s->dct32 = ff_dct32_float_sse; } diff -r cf54b8e98e7a -r 9fef0a8ddd63 x86/h264_intrapred_init.c --- a/x86/h264_intrapred_init.c Wed Sep 08 14:36:13 2010 +0000 +++ b/x86/h264_intrapred_init.c Wed Sep 08 15:07:14 2010 +0000 @@ -18,6 +18,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include "libavutil/cpu.h" #include "libavcodec/h264pred.h" void ff_pred16x16_vertical_mmx (uint8_t *src, int stride); @@ -48,7 +49,7 @@ void ff_h264_pred_init_x86(H264PredContext *h, int codec_id) { - int mm_flags = mm_support(); + int mm_flags = av_get_cpu_flags(); #if HAVE_YASM if (mm_flags & AV_CPU_FLAG_MMX) { diff -r cf54b8e98e7a -r 9fef0a8ddd63 x86/h264dsp_mmx.c --- a/x86/h264dsp_mmx.c Wed Sep 08 14:36:13 2010 +0000 +++ b/x86/h264dsp_mmx.c Wed Sep 08 15:07:14 2010 +0000 @@ -18,6 +18,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include "libavutil/cpu.h" #include "libavutil/x86_cpu.h" #include "libavcodec/h264dsp.h" #include "dsputil_mmx.h" @@ -742,7 +743,7 @@ void ff_h264dsp_init_x86(H264DSPContext *c) { - int mm_flags = mm_support(); + int mm_flags = av_get_cpu_flags(); if (mm_flags & AV_CPU_FLAG_MMX) { c->h264_idct_dc_add= diff -r cf54b8e98e7a -r 9fef0a8ddd63 x86/motion_est_mmx.c --- a/x86/motion_est_mmx.c Wed Sep 08 14:36:13 2010 +0000 +++ b/x86/motion_est_mmx.c Wed Sep 08 15:07:14 2010 +0000 @@ -427,7 +427,7 @@ void dsputil_init_pix_mmx(DSPContext* c, AVCodecContext *avctx) { - int mm_flags = mm_support(); + int mm_flags = av_get_cpu_flags(); if (mm_flags & AV_CPU_FLAG_MMX) { c->pix_abs[0][0] = sad16_mmx; diff -r cf54b8e98e7a -r 9fef0a8ddd63 x86/mpegaudiodec_mmx.c --- a/x86/mpegaudiodec_mmx.c Wed Sep 08 14:36:13 2010 +0000 +++ b/x86/mpegaudiodec_mmx.c Wed Sep 08 15:07:14 2010 +0000 @@ -19,6 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include "libavutil/cpu.h" #include "libavutil/x86_cpu.h" #define CONFIG_FLOAT 1 @@ -149,7 +150,7 @@ void ff_mpegaudiodec_init_mmx(MPADecodeContext *s) { - int mm_flags = mm_support(); + int mm_flags = av_get_cpu_flags(); if (mm_flags & AV_CPU_FLAG_SSE2) { s->apply_window_mp3 = apply_window_mp3; diff -r cf54b8e98e7a -r 9fef0a8ddd63 x86/mpegvideo_mmx.c --- a/x86/mpegvideo_mmx.c Wed Sep 08 14:36:13 2010 +0000 +++ b/x86/mpegvideo_mmx.c Wed Sep 08 15:07:14 2010 +0000 @@ -22,6 +22,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include "libavutil/cpu.h" #include "libavutil/x86_cpu.h" #include "libavcodec/avcodec.h" #include "libavcodec/dsputil.h" @@ -625,7 +626,7 @@ void MPV_common_init_mmx(MpegEncContext *s) { - int mm_flags = mm_support(); + int mm_flags = av_get_cpu_flags(); if (mm_flags & AV_CPU_FLAG_MMX) { const int dct_algo = s->avctx->dct_algo; diff -r cf54b8e98e7a -r 9fef0a8ddd63 x86/snowdsp_mmx.c --- a/x86/snowdsp_mmx.c Wed Sep 08 14:36:13 2010 +0000 +++ b/x86/snowdsp_mmx.c Wed Sep 08 15:07:14 2010 +0000 @@ -875,7 +875,7 @@ void ff_dwt_init_x86(DWTContext *c) { - int mm_flags = mm_support(); + int mm_flags = av_get_cpu_flags(); if (mm_flags & AV_CPU_FLAG_MMX) { if(mm_flags & AV_CPU_FLAG_SSE2 & 0){ diff -r cf54b8e98e7a -r 9fef0a8ddd63 x86/vc1dsp_mmx.c --- a/x86/vc1dsp_mmx.c Wed Sep 08 14:36:13 2010 +0000 +++ b/x86/vc1dsp_mmx.c Wed Sep 08 15:07:14 2010 +0000 @@ -24,6 +24,7 @@ * OTHER DEALINGS IN THE SOFTWARE. */ +#include "libavutil/cpu.h" #include "libavutil/x86_cpu.h" #include "libavcodec/dsputil.h" #include "dsputil_mmx.h" @@ -714,7 +715,7 @@ #endif void ff_vc1dsp_init_mmx(DSPContext* dsp, AVCodecContext *avctx) { - int mm_flags = mm_support(); + int mm_flags = av_get_cpu_flags(); 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 -r cf54b8e98e7a -r 9fef0a8ddd63 x86/vp56dsp_init.c --- a/x86/vp56dsp_init.c Wed Sep 08 14:36:13 2010 +0000 +++ b/x86/vp56dsp_init.c Wed Sep 08 15:07:14 2010 +0000 @@ -20,6 +20,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include "libavutil/cpu.h" #include "libavutil/x86_cpu.h" #include "libavcodec/dsputil.h" #include "libavcodec/vp56dsp.h" @@ -32,7 +33,7 @@ av_cold void ff_vp56dsp_init_x86(VP56DSPContext* c, enum CodecID codec) { #if HAVE_YASM - int mm_flags = mm_support(); + int mm_flags = av_get_cpu_flags(); if (CONFIG_VP6_DECODER && codec == CODEC_ID_VP6) { if (mm_flags & AV_CPU_FLAG_MMX) { diff -r cf54b8e98e7a -r 9fef0a8ddd63 x86/vp8dsp-init.c --- a/x86/vp8dsp-init.c Wed Sep 08 14:36:13 2010 +0000 +++ b/x86/vp8dsp-init.c Wed Sep 08 15:07:14 2010 +0000 @@ -20,6 +20,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include "libavutil/cpu.h" #include "libavutil/x86_cpu.h" #include "libavcodec/vp8dsp.h" @@ -282,7 +283,7 @@ av_cold void ff_vp8dsp_init_x86(VP8DSPContext* c) { - int mm_flags = mm_support(); + int mm_flags = av_get_cpu_flags(); #if HAVE_YASM if (mm_flags & AV_CPU_FLAG_MMX) {