Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mpc-hc/mpc-hc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXhmikosR <xhmikosr@users.sourceforge.net>2012-09-17 23:30:34 +0400
committerXhmikosR <xhmikosr@users.sourceforge.net>2012-09-17 23:30:34 +0400
commitf5087d23eaacc5a7d59f1a8c5f1550b86e3af84f (patch)
tree221518a85ba98aff18cc7a61316f68c0d90ac144 /src/thirdparty/VirtualDub
parent8dab9e55b7b8b21031335346e895f21ed6b889df (diff)
VirtualDub: put back our custom code
Diffstat (limited to 'src/thirdparty/VirtualDub')
-rw-r--r--src/thirdparty/VirtualDub/system/source/a_memory.asm62
-rw-r--r--src/thirdparty/VirtualDub/system/source/memory.cpp13
2 files changed, 74 insertions, 1 deletions
diff --git a/src/thirdparty/VirtualDub/system/source/a_memory.asm b/src/thirdparty/VirtualDub/system/source/a_memory.asm
index e4b6cac8b..226be0801 100644
--- a/src/thirdparty/VirtualDub/system/source/a_memory.asm
+++ b/src/thirdparty/VirtualDub/system/source/a_memory.asm
@@ -71,6 +71,67 @@ _VDFastMemcpyPartialMMX:
pop edi
ret
+; MPC custom code start
+ global _VDFastMemcpyPartialSSE2
+_VDFastMemcpyPartialSSE2:
+ push ebp
+ push edi
+ push esi
+ push ebx
+
+ mov ecx, [esp+12+16]
+ cmp ecx, 128
+ jb _VDFastMemcpyPartialMMX2.MMX2
+ mov edi, [esp+4+16]
+ mov esi, [esp+8+16]
+ mov eax, edi
+ or eax, esi
+ test al, 15
+ jne SHORT _VDFastMemcpyPartialMMX2.MMX2
+
+ shr ecx, 7
+.loop128:
+ prefetchnta [esi+16*8]
+ movaps xmm0, [esi]
+ movaps xmm1, [esi+16*1]
+ movaps xmm2, [esi+16*2]
+ movaps xmm3, [esi+16*3]
+ movaps xmm4, [esi+16*4]
+ movaps xmm5, [esi+16*5]
+ movaps xmm6, [esi+16*6]
+ movaps xmm7, [esi+16*7]
+ movntps [edi], xmm0
+ movntps [edi+16*1], xmm1
+ movntps [edi+16*2], xmm2
+ movntps [edi+16*3], xmm3
+ movntps [edi+16*4], xmm4
+ movntps [edi+16*5], xmm5
+ movntps [edi+16*6], xmm6
+ movntps [edi+16*7], xmm7
+ add esi, 128
+ add edi, 128
+ dec ecx
+ jne .loop128
+.skiploop128:
+ mov ecx, [esp+12+16]
+ and ecx, 127
+ cmp ecx, 0
+ je .nooddballs
+.loop:
+ mov dl, [esi]
+ mov [edi], dl
+ inc esi
+ inc edi
+ dec ecx
+ jne .loop
+.nooddballs:
+ pop ebx
+ pop esi
+ pop edi
+ pop ebp
+ ret
+; MPC custom code end
+
global _VDFastMemcpyPartialMMX2
_VDFastMemcpyPartialMMX2:
push ebp
@@ -78,6 +139,7 @@ _VDFastMemcpyPartialMMX2:
push esi
push ebx
+.MMX2 ; MPC custom code
mov ebx, [esp+4+16]
mov edx, [esp+8+16]
mov eax, [esp+12+16]
diff --git a/src/thirdparty/VirtualDub/system/source/memory.cpp b/src/thirdparty/VirtualDub/system/source/memory.cpp
index ab3498f11..3c870cb87 100644
--- a/src/thirdparty/VirtualDub/system/source/memory.cpp
+++ b/src/thirdparty/VirtualDub/system/source/memory.cpp
@@ -410,7 +410,14 @@ void VDMemset32Rect(void *dst, ptrdiff_t pitch, uint32 value, size_t w, size_t h
void VDFastMemcpyAutodetect() {
long exts = CPUGetEnabledExtensions();
- if (exts & CPUF_SUPPORTS_SSE) {
+ // 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) {
VDFastMemcpyPartial = VDFastMemcpyPartialMMX2;
VDFastMemcpyFinish = VDFastMemcpyFinishMMX2;
VDSwapMemory = VDSwapMemorySSE;
@@ -447,6 +454,10 @@ void VDMemcpyRect(void *dst, ptrdiff_t dststride, const void *src, ptrdiff_t src
if (w == srcstride && w == dststride)
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);
+ // MPC custom code (end)
else {
char *dst2 = (char *)dst;
const char *src2 = (const char *)src;