Browse Source

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>.

Originally committed as revision 31751 to svn://svn.mplayerhq.hu/mplayer/trunk/libswscale
tags/n0.8
Anton Mitrofanov Jason Garrett-Glaser 15 years ago
parent
commit
c85007d559
1 changed files with 12 additions and 9 deletions
  1. +12
    -9
      libswscale/swscale_template.c

+ 12
- 9
libswscale/swscale_template.c View File

@@ -80,7 +80,7 @@
"mov (%%"REG_d"), %%"REG_S" \n\t"\ "mov (%%"REG_d"), %%"REG_S" \n\t"\
"jb 1b \n\t"\ "jb 1b \n\t"\
:: "r" (&c->redDither),\ :: "r" (&c->redDither),\
"r" (dest), "g" (width)\
"r" (dest), "g" ((x86_reg)width)\
: "%"REG_a, "%"REG_d, "%"REG_S\ : "%"REG_a, "%"REG_d, "%"REG_S\
); );


@@ -142,7 +142,7 @@
"mov (%%"REG_d"), %%"REG_S" \n\t"\ "mov (%%"REG_d"), %%"REG_S" \n\t"\
"jb 1b \n\t"\ "jb 1b \n\t"\
:: "r" (&c->redDither),\ :: "r" (&c->redDither),\
"r" (dest), "g" (width)\
"r" (dest), "g" ((x86_reg)width)\
: "%"REG_a, "%"REG_d, "%"REG_S\ : "%"REG_a, "%"REG_d, "%"REG_S\
); );


@@ -180,7 +180,7 @@
/* /*
:: "m" (-lumFilterSize), "m" (-chrFilterSize), :: "m" (-lumFilterSize), "m" (-chrFilterSize),
"m" (lumMmxFilter+lumFilterSize*4), "m" (chrMmxFilter+chrFilterSize*4), "m" (lumMmxFilter+lumFilterSize*4), "m" (chrMmxFilter+chrFilterSize*4),
"r" (dest), "m" (dstW),
"r" (dest), "m" (dstW_reg),
"m" (lumSrc+lumFilterSize), "m" (chrSrc+chrFilterSize) "m" (lumSrc+lumFilterSize), "m" (chrSrc+chrFilterSize)
: "%eax", "%ebx", "%ecx", "%edx", "%esi" : "%eax", "%ebx", "%ecx", "%edx", "%esi"
*/ */
@@ -234,7 +234,7 @@
#define YSCALEYUV2PACKEDX_END \ #define YSCALEYUV2PACKEDX_END \
:: "r" (&c->redDither), \ :: "r" (&c->redDither), \
"m" (dummy), "m" (dummy), "m" (dummy),\ "m" (dummy), "m" (dummy), "m" (dummy),\
"r" (dest), "m" (dstW) \
"r" (dest), "m" (dstW_reg) \
: "%"REG_a, "%"REG_d, "%"REG_S \ : "%"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 #if COMPILE_TEMPLATE_MMX
x86_reg dummy=0; x86_reg dummy=0;
x86_reg dstW_reg = dstW;
if(!(c->flags & SWS_BITEXACT)) { if(!(c->flags & SWS_BITEXACT)) {
if (c->flags & SWS_ACCURATE_RND) { if (c->flags & SWS_ACCURATE_RND) {
switch(c->dstFormat) { switch(c->dstFormat) {
@@ -1063,7 +1064,7 @@ static inline void RENAME(yuv2packedX)(SwsContext *c, const int16_t *lumFilter,


:: "r" (&c->redDither), :: "r" (&c->redDither),
"m" (dummy), "m" (dummy), "m" (dummy), "m" (dummy), "m" (dummy), "m" (dummy),
"r" (dest), "m" (dstW)
"r" (dest), "m" (dstW_reg)
: "%"REG_a, "%"REG_c, "%"REG_d, "%"REG_S : "%"REG_a, "%"REG_c, "%"REG_d, "%"REG_S
); );
return; return;
@@ -1137,7 +1138,7 @@ static inline void RENAME(yuv2packedX)(SwsContext *c, const int16_t *lumFilter,


:: "r" (&c->redDither), :: "r" (&c->redDither),
"m" (dummy), "m" (dummy), "m" (dummy), "m" (dummy), "m" (dummy), "m" (dummy),
"r" (dest), "m" (dstW)
"r" (dest), "m" (dstW_reg)
: "%"REG_a, "%"REG_c, "%"REG_d, "%"REG_S : "%"REG_a, "%"REG_c, "%"REG_d, "%"REG_S
); );
return; return;
@@ -2328,6 +2329,7 @@ static inline void RENAME(hyscale_fast)(SwsContext *c, int16_t *dst,
#endif /* COMPILE_TEMPLATE_MMX2 */ #endif /* COMPILE_TEMPLATE_MMX2 */
x86_reg xInc_shr16 = xInc >> 16; x86_reg xInc_shr16 = xInc >> 16;
uint16_t xInc_mask = xInc & 0xffff; uint16_t xInc_mask = xInc & 0xffff;
x86_reg dstWidth_reg = dstWidth;
//NO MMX just normal asm ... //NO MMX just normal asm ...
__asm__ volatile( __asm__ volatile(
"xor %%"REG_a", %%"REG_a" \n\t" // i "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" " 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" : "%"REG_a, "%"REG_d, "%ecx", "%"REG_D, "%esi"
); );
#if COMPILE_TEMPLATE_MMX2 #if COMPILE_TEMPLATE_MMX2
@@ -2468,6 +2470,7 @@ static inline void RENAME(hcscale_fast)(SwsContext *c, int16_t *dst,
#endif /* COMPILE_TEMPLATE_MMX2 */ #endif /* COMPILE_TEMPLATE_MMX2 */
x86_reg xInc_shr16 = (x86_reg) (xInc >> 16); x86_reg xInc_shr16 = (x86_reg) (xInc >> 16);
uint16_t xInc_mask = xInc & 0xffff; uint16_t xInc_mask = xInc & 0xffff;
x86_reg dstWidth_reg = dstWidth;
__asm__ volatile( __asm__ volatile(
"xor %%"REG_a", %%"REG_a" \n\t" // i "xor %%"REG_a", %%"REG_a" \n\t" // i
"xor %%"REG_d", %%"REG_d" \n\t" // xx "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, /* GCC 3.3 makes MPlayer crash on IA-32 machines when using "g" operand here,
which is needed to support GCC 4.0. */ which is needed to support GCC 4.0. */
#if ARCH_X86_64 && AV_GCC_VERSION_AT_LEAST(3,4) #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 #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 #endif
"r" (src2) "r" (src2)
: "%"REG_a, "%"REG_d, "%ecx", "%"REG_D, "%esi" : "%"REG_a, "%"REG_d, "%ecx", "%"REG_D, "%esi"


Loading…
Cancel
Save