diff options
author | CrystalP <CrystalP@xbmc.org> | 2011-01-26 23:29:09 -0500 |
---|---|---|
committer | CrystalP <CrystalP@xbmc.org> | 2011-01-29 00:51:27 -0500 |
commit | e19f160e829e414cea79320c0f17f6615cf29dd8 (patch) | |
tree | 230f794540766327c9312f863b241198b3e8b59c /lib/DllSwScale.h | |
parent | 78efd6f498d94e472ba95d2c6c0dcf560e935d98 (diff) |
Changed: make swscale use the dynamically detected capabilities of the CPU
Diffstat (limited to 'lib/DllSwScale.h')
-rw-r--r-- | lib/DllSwScale.h | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/lib/DllSwScale.h b/lib/DllSwScale.h index da43968fa0..6365b85592 100644 --- a/lib/DllSwScale.h +++ b/lib/DllSwScale.h @@ -66,15 +66,23 @@ extern "C" { #endif } +#include "../xbmc/utils/CPUInfo.h" + inline int SwScaleCPUFlags() { -#if !defined(__powerpc__) && !defined(__ppc__) && !defined(__arm__) - return SWS_CPU_CAPS_MMX; -#elif defined(__powerpc__) || defined(__ppc__) - return SWS_CPU_CAPS_ALTIVEC; -#else - return 0; -#endif + unsigned int cpuFeatures = g_cpuInfo.GetCPUFeatures(); + int flags = 0; + + if (cpuFeatures & CPU_FEATURE_MMX) + flags |= SWS_CPU_CAPS_MMX; + if (cpuFeatures & CPU_FEATURE_MMX2) + flags |= SWS_CPU_CAPS_MMX2; + if (cpuFeatures & CPU_FEATURE_3DNOW) + flags |= SWS_CPU_CAPS_3DNOW; + if (cpuFeatures & CPU_FEATURE_ALTIVEC) + flags |= SWS_CPU_CAPS_ALTIVEC; + + return flags; } class DllSwScaleInterface |