From 811483bc7a479eba57017723a24021cf4a4f8958 Mon Sep 17 00:00:00 2001 From: Fredrik Mellbin Date: Sun, 14 Sep 2008 17:45:11 +0000 Subject: [PATCH] FFmpegSource2: more portability Originally committed to SVN as r2354. --- FFmpegSource2/ffvideosource.cpp | 1 + FFmpegSource2/indexing.cpp | 1 + FFmpegSource2/utils.cpp | 44 +++++---------------------------- 3 files changed, 8 insertions(+), 38 deletions(-) diff --git a/FFmpegSource2/ffvideosource.cpp b/FFmpegSource2/ffvideosource.cpp index 942e07732..438c60cb4 100644 --- a/FFmpegSource2/ffvideosource.cpp +++ b/FFmpegSource2/ffvideosource.cpp @@ -19,6 +19,7 @@ // THE SOFTWARE. #include "ffvideosource.h" +#include int VideoBase::InitPP(const char *PP, int PixelFormat, char *ErrorMsg, unsigned MsgSize) { if (PP == NULL || !strcmp(PP, "")) diff --git a/FFmpegSource2/indexing.cpp b/FFmpegSource2/indexing.cpp index 9490b7163..14af03a14 100644 --- a/FFmpegSource2/indexing.cpp +++ b/FFmpegSource2/indexing.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #include "indexing.h" #include "wave64writer.h" diff --git a/FFmpegSource2/utils.cpp b/FFmpegSource2/utils.cpp index 0b86f0901..2e1ed0307 100644 --- a/FFmpegSource2/utils.cpp +++ b/FFmpegSource2/utils.cpp @@ -19,51 +19,19 @@ // THE SOFTWARE. #include "utils.h" +#include +#include int GetCPUFlags() { - bool hasmmx, hassse, hasisse = false; - - __asm { - mov eax, 1 // CPU feature detection - CPUID - - shr edx, 23 // MMX - mov eax, edx - and eax, 1 - mov [hasmmx], al - - shr edx, 2 // SSE - mov eax, edx - and eax, 1 - mov [hassse], al - jnz End // End if SSE detected, else... - - - //Athlon TBird Detection, since it has iSSE but not SSE - xor eax, eax // CPU Vendor detection (eax=0) - CPUID // call CPU identification function - - cmp ebx, 'htuA' - jne End - cmp edx, 'itne' - jne End - cmp ebx, 'DMAc' - jne End - - //detect Athlon Tbird, which has iSSE but not SSE - sub eax, 0x460000 //Find Family 6, Model 4 = Athlon Tbird - cmp eax, 0 - sete [hasisse] - -End: - } + int CPUInfo[4]; + __cpuid(CPUInfo, 0); int Flags = 0; // PP and SWS defines have the same values for their defines so this actually works - if (hasmmx) + if (CPUInfo[3] & (1 << 23)) Flags |= PP_CPU_CAPS_MMX; - if (hasisse) + if (CPUInfo[3] & (1 << 25)) Flags |= PP_CPU_CAPS_MMX2; return Flags;