From c85007d5594d93ac016888cdb3a5d21e9412b920 Mon Sep 17 00:00:00 2001 From: Anton Mitrofanov Date: Sun, 18 Jul 2010 21:39:57 +0000 Subject: [PATCH] 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 . Originally committed as revision 31751 to svn://svn.mplayerhq.hu/mplayer/trunk/libswscale --- libswscale/swscale_template.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/libswscale/swscale_template.c b/libswscale/swscale_template.c index 0d259ed1a0..f4aa432d10 100644 --- a/libswscale/swscale_template.c +++ b/libswscale/swscale_template.c @@ -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 @@ static inline void RENAME(yuv2packedX)(SwsContext *c, const int16_t *lumFilter, { #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 @@ static inline void RENAME(yuv2packedX)(SwsContext *c, const int16_t *lumFilter, :: "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 @@ static inline void RENAME(yuv2packedX)(SwsContext *c, const int16_t *lumFilter, :: "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 @@ static inline void RENAME(hyscale_fast)(SwsContext *c, int16_t *dst, #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 @@ static inline void RENAME(hyscale_fast)(SwsContext *c, int16_t *dst, " 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 @@ static inline void RENAME(hcscale_fast)(SwsContext *c, int16_t *dst, #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 @@ static inline void RENAME(hcscale_fast)(SwsContext *c, int16_t *dst, /* 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"