diff options
author | kinddragon <kinddragon@users.sourceforge.net> | 2010-05-20 19:48:51 +0400 |
---|---|---|
committer | kinddragon <kinddragon@users.sourceforge.net> | 2010-05-20 19:48:51 +0400 |
commit | dc008c62b90578ba99bb2d3f8e9048b5be3d8930 (patch) | |
tree | 1c991bdbfe0a51d067eb19868f0653e26c2c2258 | |
parent | 329aff1cce7487cc629de0e9d6abf3fae5427e95 (diff) |
MPC x64 OSD fixed
git-svn-id: https://mpc-hc.svn.sourceforge.net/svnroot/mpc-hc/trunk@1900 10f7b99b-c216-0410-bff0-8a66a9350fd8
-rw-r--r-- | src/DSUtil/DSUtil.cpp | 40 | ||||
-rw-r--r-- | src/DSUtil/cpuid64.asm | 35 | ||||
-rw-r--r-- | src/DSUtil/cpuid_32_64.h | 15 | ||||
-rw-r--r-- | src/DSUtil/dsutil.vcproj | 48 |
4 files changed, 30 insertions, 108 deletions
diff --git a/src/DSUtil/DSUtil.cpp b/src/DSUtil/DSUtil.cpp index 0a46c539d..24134534f 100644 --- a/src/DSUtil/DSUtil.cpp +++ b/src/DSUtil/DSUtil.cpp @@ -25,7 +25,9 @@ #include <winddk/ntddcdrm.h>
#include "DSUtil.h"
#include "Mpeg2Def.h"
+#include "vd.h"
#include <moreuuids.h>
+#include <emmintrin.h>
#include <initguid.h>
#include <d3dx9.h>
@@ -957,19 +959,37 @@ REFERENCE_TIME HMSF2RT(DVD_HMSF_TIMECODE hmsf, double fps) void memsetd(void* dst, unsigned int c, size_t nbytes)
{
-#ifdef _WIN64
- memset(dst, c, nbytes);
-#else
- __asm
+#ifndef _WIN64
+ if (!(g_cpuid.m_flags & g_cpuid.sse2))
{
- mov eax, c
- mov ecx, nbytes
- shr ecx, 2
- mov edi, dst
- cld
- rep stosd
+ __asm
+ {
+ mov eax, c
+ mov ecx, nbytes
+ shr ecx, 2
+ mov edi, dst
+ cld
+ rep stosd
+ }
}
#endif
+ size_t n = nbytes / 4;
+ size_t o = n - (n % 4);
+
+ __m128i val = _mm_set1_epi32 ( (int)c );
+ if (((uintptr_t)dst & 0x0F) == 0) // 16-byte aligned
+ {
+ for (ptrdiff_t i = 0; i < o; i+=4)
+ _mm_store_si128( (__m128i*)&(((DWORD*)dst)[i]), val );
+ }
+ else
+ {
+ for (ptrdiff_t i = 0; i < o; i+=4)
+ _mm_storeu_si128( (__m128i*)&(((DWORD*)dst)[i]), val );
+ }
+
+ for (ptrdiff_t i = o; i < n; i++)
+ ((DWORD*)dst)[i] = c;
}
bool ExtractBIH(const AM_MEDIA_TYPE* pmt, BITMAPINFOHEADER* bih)
diff --git a/src/DSUtil/cpuid64.asm b/src/DSUtil/cpuid64.asm deleted file mode 100644 index 4c3d4c35b..000000000 --- a/src/DSUtil/cpuid64.asm +++ /dev/null @@ -1,35 +0,0 @@ -; ml64 /c /Cx /nologo /Fo"$(OutDir)\$(InputName).obj" "$(InputPath)"
-; call cpuid with args in eax, ecx
-; store eax, ebx, ecx, edx to p
-
- _TEXT64 segment page 'CODE'
-
- align 8
-
- PUBLIC cpuid64
-
- cpuid64 PROC FRAME
- ; void cpuid64(CPUID_ARGS* p);
- ; rcx <= p
- sub rsp, 32
- .allocstack 32
- push rbx
- .pushreg rbx
- .endprolog
- mov r8, rcx
- mov eax, DWORD PTR [r8+0]
- mov ecx, DWORD PTR [r8+8]
- cpuid
- mov DWORD PTR [r8+0], eax
- mov DWORD PTR [r8+4], ebx
- mov DWORD PTR [r8+8], ecx
- mov DWORD PTR [r8+12], edx
- pop rbx
- add rsp, 32
- ret
-
- ALIGN 8
- cpuid64 ENDP
-_TEXT64 ENDS
-
-END
\ No newline at end of file diff --git a/src/DSUtil/cpuid_32_64.h b/src/DSUtil/cpuid_32_64.h deleted file mode 100644 index 29990b681..000000000 --- a/src/DSUtil/cpuid_32_64.h +++ /dev/null @@ -1,15 +0,0 @@ -#pragma once
-
-typedef struct cpuid_args_s {
-DWORD eax;
-DWORD ebx;
-DWORD ecx;
-DWORD edx;
-} CPUID_ARGS;
-
-extern "C" {
-#ifdef _WIN64 // For 64-bit apps
- void cpuid64(CPUID_ARGS* p);
-#define _CPUID cpuid64
-#endif
-}
\ No newline at end of file diff --git a/src/DSUtil/dsutil.vcproj b/src/DSUtil/dsutil.vcproj index 8210bc73d..49162423b 100644 --- a/src/DSUtil/dsutil.vcproj +++ b/src/DSUtil/dsutil.vcproj @@ -404,50 +404,6 @@ </FileConfiguration>
</File>
<File
- RelativePath=".\cpuid64.asm"
- >
- <FileConfiguration
- Name="Debug Unicode|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCustomBuildTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug Unicode|x64"
- >
- <Tool
- Name="VCCustomBuildTool"
- Description="cpuid64.asm"
- CommandLine="ml64 /c /Cx /nologo /Fo"$(OutDir)\$(InputName).obj" "$(InputPath)"
"
- Outputs="$(OutDir)\$(InputName).obj"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release Unicode|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCustomBuildTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release Unicode|x64"
- >
- <Tool
- Name="VCCustomBuildTool"
- Description="cpuid64.asm"
- CommandLine="ml64 /c /Cx /nologo /Fo"$(OutDir)\$(InputName).obj" "$(InputPath)"
"
- Outputs="$(OutDir)\$(InputName).obj"
- />
- </FileConfiguration>
- </File>
- <File
- RelativePath=".\cpuid_32_64.cpp"
- >
- </File>
- <File
RelativePath=".\DSMPropertyBag.cpp"
>
</File>
@@ -557,10 +513,6 @@ Filter="h;hpp;hxx;hm;inl;inc"
>
<File
- RelativePath=".\cpuid_32_64.h"
- >
- </File>
- <File
RelativePath=".\DSMPropertyBag.h"
>
</File>
|