changeset 31685:31b6397e3b28

Another try at fixing swscale on win64, as per r31153. Don't change paramater passing, but instead use casts. Shouldn't affect asm output on anything other than win64. libswscale should work on win64 now. The rest of ffmpeg still isn't win64 compatible due to the issue of xmm clobbers, but swscale doesn't use any SSE. Patch by Anton Mitrofanov <BugMaster AT narod DOT ru>.
author darkshikari
date Sun, 18 Jul 2010 21:39:57 +0000
parents 6547d064bded
children b41cbf02f854
files libswscale/swscale_template.c
diffstat 1 files changed, 12 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/libswscale/swscale_template.c	Sun Jul 18 18:04:50 2010 +0000
+++ b/libswscale/swscale_template.c	Sun Jul 18 21:39:57 2010 +0000
@@ -80,7 +80,7 @@
         "mov                        (%%"REG_d"), %%"REG_S"  \n\t"\
         "jb                                  1b             \n\t"\
         :: "r" (&c->redDither),\
-        "r" (dest), "g" (width)\
+        "r" (dest), "g" ((x86_reg)width)\
         : "%"REG_a, "%"REG_d, "%"REG_S\
     );
 
@@ -142,7 +142,7 @@
         "mov                        (%%"REG_d"), %%"REG_S"  \n\t"\
         "jb                                  1b             \n\t"\
         :: "r" (&c->redDither),\
-        "r" (dest), "g" (width)\
+        "r" (dest), "g" ((x86_reg)width)\
         : "%"REG_a, "%"REG_d, "%"REG_S\
     );
 
@@ -180,7 +180,7 @@
 /*
     :: "m" (-lumFilterSize), "m" (-chrFilterSize),
        "m" (lumMmxFilter+lumFilterSize*4), "m" (chrMmxFilter+chrFilterSize*4),
-       "r" (dest), "m" (dstW),
+       "r" (dest), "m" (dstW_reg),
        "m" (lumSrc+lumFilterSize), "m" (chrSrc+chrFilterSize)
     : "%eax", "%ebx", "%ecx", "%edx", "%esi"
 */
@@ -234,7 +234,7 @@
 #define YSCALEYUV2PACKEDX_END                     \
         :: "r" (&c->redDither),                   \
             "m" (dummy), "m" (dummy), "m" (dummy),\
-            "r" (dest), "m" (dstW)                \
+            "r" (dest), "m" (dstW_reg)            \
         : "%"REG_a, "%"REG_d, "%"REG_S            \
     );
 
@@ -1025,6 +1025,7 @@
 {
 #if COMPILE_TEMPLATE_MMX
     x86_reg dummy=0;
+    x86_reg dstW_reg = dstW;
     if(!(c->flags & SWS_BITEXACT)) {
         if (c->flags & SWS_ACCURATE_RND) {
             switch(c->dstFormat) {
@@ -1063,7 +1064,7 @@
 
                 :: "r" (&c->redDither),
                 "m" (dummy), "m" (dummy), "m" (dummy),
-                "r" (dest), "m" (dstW)
+                "r" (dest), "m" (dstW_reg)
                 : "%"REG_a, "%"REG_c, "%"REG_d, "%"REG_S
                 );
                 return;
@@ -1137,7 +1138,7 @@
 
                 :: "r" (&c->redDither),
                 "m" (dummy), "m" (dummy), "m" (dummy),
-                "r" (dest),  "m" (dstW)
+                "r" (dest),  "m" (dstW_reg)
                 : "%"REG_a, "%"REG_c, "%"REG_d, "%"REG_S
                 );
                 return;
@@ -2328,6 +2329,7 @@
 #endif /* COMPILE_TEMPLATE_MMX2 */
     x86_reg xInc_shr16 = xInc >> 16;
     uint16_t xInc_mask = xInc & 0xffff;
+    x86_reg dstWidth_reg = dstWidth;
     //NO MMX just normal asm ...
     __asm__ volatile(
         "xor %%"REG_a", %%"REG_a"            \n\t" // i
@@ -2355,7 +2357,7 @@
         " jb        1b                       \n\t"
 
 
-        :: "r" (src), "m" (dst), "m" (dstWidth), "m" (xInc_shr16), "m" (xInc_mask)
+        :: "r" (src), "m" (dst), "m" (dstWidth_reg), "m" (xInc_shr16), "m" (xInc_mask)
         : "%"REG_a, "%"REG_d, "%ecx", "%"REG_D, "%esi"
     );
 #if COMPILE_TEMPLATE_MMX2
@@ -2468,6 +2470,7 @@
 #endif /* COMPILE_TEMPLATE_MMX2 */
         x86_reg xInc_shr16 = (x86_reg) (xInc >> 16);
         uint16_t xInc_mask = xInc & 0xffff;
+        x86_reg dstWidth_reg = dstWidth;
         __asm__ volatile(
             "xor %%"REG_a", %%"REG_a"               \n\t" // i
             "xor %%"REG_d", %%"REG_d"               \n\t" // xx
@@ -2494,9 +2497,9 @@
 /* GCC 3.3 makes MPlayer crash on IA-32 machines when using "g" operand here,
 which is needed to support GCC 4.0. */
 #if ARCH_X86_64 && AV_GCC_VERSION_AT_LEAST(3,4)
-            :: "m" (src1), "m" (dst), "g" (dstWidth), "m" (xInc_shr16), "m" (xInc_mask),
+            :: "m" (src1), "m" (dst), "g" (dstWidth_reg), "m" (xInc_shr16), "m" (xInc_mask),
 #else
-            :: "m" (src1), "m" (dst), "m" (dstWidth), "m" (xInc_shr16), "m" (xInc_mask),
+            :: "m" (src1), "m" (dst), "m" (dstWidth_reg), "m" (xInc_shr16), "m" (xInc_mask),
 #endif
             "r" (src2)
             : "%"REG_a, "%"REG_d, "%ecx", "%"REG_D, "%esi"