From 02d704b259a3c2a384f8a8a8f620ac9dce9d3042 Mon Sep 17 00:00:00 2001 From: kinddragon Date: Fri, 28 May 2010 02:35:46 +0000 Subject: Previous commit fix git-svn-id: https://mpc-hc.svn.sourceforge.net/svnroot/mpc-hc/trunk@1966 10f7b99b-c216-0410-bff0-8a66a9350fd8 --- src/thirdparty/VirtualDub/system/source/memory.cpp | 26 ++++++++-------------- 1 file changed, 9 insertions(+), 17 deletions(-) (limited to 'src/thirdparty') diff --git a/src/thirdparty/VirtualDub/system/source/memory.cpp b/src/thirdparty/VirtualDub/system/source/memory.cpp index 6edce7873..5ba295427 100644 --- a/src/thirdparty/VirtualDub/system/source/memory.cpp +++ b/src/thirdparty/VirtualDub/system/source/memory.cpp @@ -392,13 +392,7 @@ void VDMemset32Rect(void *dst, ptrdiff_t pitch, uint32 value, size_t w, size_t h void VDFastMemcpyAutodetect() { long exts = CPUGetEnabledExtensions(); - // MPC custom code (begin) - if (exts & CPUF_SUPPORTS_SSE2) { - VDFastMemcpyPartial = VDFastMemcpyPartialSSE2; - VDFastMemcpyFinish = VDFastMemcpyFinishMMX2; - VDSwapMemory = VDSwapMemorySSE; - // MPC custom code (end) - } else if (exts & CPUF_SUPPORTS_SSE) { + if (exts & CPUF_SUPPORTS_SSE) { VDFastMemcpyPartial = VDFastMemcpyPartialMMX2; VDFastMemcpyFinish = VDFastMemcpyFinishMMX2; VDSwapMemory = VDSwapMemorySSE; @@ -433,29 +427,27 @@ void VDMemcpyRect(void *dst, ptrdiff_t dststride, const void *src, ptrdiff_t src if (w <= 0 || h <= 0) return; + void (__cdecl *VDFastMemcpyPartial_)(void *dst, const void *src, size_t bytes) = VDFastMemcpyPartial; // MPC custom code (begin) -#ifdef _DEBUG - if (CPUGetEnabledExtensions() & CPUF_SUPPORTS_SSE2) { - _ASSERT(!(((UINT_PTR)dst | (UINT_PTR)src) & 0xF)); - if (h > 1) { - _ASSERT(!((dststride | srcstride) & 0xF)); - } - } +#if defined(_WIN32) && defined(_M_IX86) + if ((CPUGetEnabledExtensions() & CPUF_SUPPORTS_SSE2) && + !(((UINT_PTR)dst | dststride | (UINT_PTR)src | srcstride) & 0xF)) + VDFastMemcpyPartial_ = VDFastMemcpyPartialSSE2; #endif // MPC custom code (end) if (w == srcstride && w == dststride) - VDFastMemcpyPartial(dst, src, w*h); + VDFastMemcpyPartial_(dst, src, w*h); // MPC custom code (begin) else if (w == -srcstride && w == -dststride) - VDFastMemcpyPartial((char *)dst + dststride * (h - 1), (char *)src + srcstride * (h - 1), w*h); + VDFastMemcpyPartial_((char *)dst + dststride * (h - 1), (char *)src + srcstride * (h - 1), w*h); // MPC custom code (end) else { char *dst2 = (char *)dst; const char *src2 = (const char *)src; do { - VDFastMemcpyPartial(dst2, src2, w); + VDFastMemcpyPartial_(dst2, src2, w); dst2 += dststride; src2 += srcstride; } while(--h); -- cgit v1.2.3