summaryrefslogtreecommitdiffstats
path: root/libmpcodecs
diff options
context:
space:
mode:
authoraurel <aurel@b3059339-0415-0410-9bf9-f77b7e298cf2>2004-10-21 11:55:20 +0000
committeraurel <aurel@b3059339-0415-0410-9bf9-f77b7e298cf2>2004-10-21 11:55:20 +0000
commit798d2d133780c000166f01fd2d7fbde395196be3 (patch)
tree1346451ddb9911c63cd778af21261a6ae6f70346 /libmpcodecs
parent159928a38a3fc65427a1336b2c73aa3f78a82aa7 (diff)
downloadmpv-798d2d133780c000166f01fd2d7fbde395196be3.tar.bz2
mpv-798d2d133780c000166f01fd2d7fbde395196be3.tar.xz
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@13721 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpcodecs')
-rw-r--r--libmpcodecs/pullup.c4
-rw-r--r--libmpcodecs/vf_decimate.c14
-rw-r--r--libmpcodecs/vf_divtc.c14
-rw-r--r--libmpcodecs/vf_eq.c4
-rw-r--r--libmpcodecs/vf_eq2.c4
-rw-r--r--libmpcodecs/vf_filmdint.c8
-rw-r--r--libmpcodecs/vf_halfpack.c10
-rw-r--r--libmpcodecs/vf_ilpack.c126
-rw-r--r--libmpcodecs/vf_ivtc.c82
-rw-r--r--libmpcodecs/vf_noise.c46
-rw-r--r--libmpcodecs/vf_spp.c6
-rw-r--r--libmpcodecs/vf_tfields.c76
12 files changed, 208 insertions, 186 deletions
diff --git a/libmpcodecs/pullup.c b/libmpcodecs/pullup.c
index 2abaa158a7..3627084cb5 100644
--- a/libmpcodecs/pullup.c
+++ b/libmpcodecs/pullup.c
@@ -8,6 +8,7 @@
+#ifdef ARCH_X86
#ifdef HAVE_MMX
static int diff_y_mmx(unsigned char *a, unsigned char *b, int s)
{
@@ -147,6 +148,7 @@ static int licomb_y_mmx(unsigned char *a, unsigned char *b, int s)
return ret;
}
#endif
+#endif
#define ABS(a) (((a)^((a)>>31))-((a)>>31))
@@ -682,12 +684,14 @@ void pullup_init_context(struct pullup_context *c)
case PULLUP_FMT_Y:
c->diff = diff_y;
c->comb = licomb_y;
+#ifdef ARCH_X86
#ifdef HAVE_MMX
if (c->cpu & PULLUP_CPU_MMX) {
c->diff = diff_y_mmx;
c->comb = licomb_y_mmx;
}
#endif
+#endif
/* c->comb = qpcomb_y; */
break;
#if 0
diff --git a/libmpcodecs/vf_decimate.c b/libmpcodecs/vf_decimate.c
index 7cc8d2af76..1a80e9dd07 100644
--- a/libmpcodecs/vf_decimate.c
+++ b/libmpcodecs/vf_decimate.c
@@ -31,11 +31,11 @@ static int diff_MMX(unsigned char *old, unsigned char *new, int os, int ns)
".balign 16 \n\t"
"1: \n\t"
- "movq (%%esi), %%mm0 \n\t"
- "movq (%%esi), %%mm2 \n\t"
- "addl %%eax, %%esi \n\t"
- "movq (%%edi), %%mm1 \n\t"
- "addl %%ebx, %%edi \n\t"
+ "movq (%%"REG_S"), %%mm0 \n\t"
+ "movq (%%"REG_S"), %%mm2 \n\t"
+ "add %%"REG_a", %%"REG_S" \n\t"
+ "movq (%%"REG_D"), %%mm1 \n\t"
+ "add %%"REG_b", %%"REG_D" \n\t"
"psubusb %%mm1, %%mm2 \n\t"
"psubusb %%mm0, %%mm1 \n\t"
"movq %%mm2, %%mm0 \n\t"
@@ -51,10 +51,10 @@ static int diff_MMX(unsigned char *old, unsigned char *new, int os, int ns)
"decl %%ecx \n\t"
"jnz 1b \n\t"
- "movq %%mm4, (%%edx) \n\t"
+ "movq %%mm4, (%%"REG_d") \n\t"
"emms \n\t"
:
- : "S" (old), "D" (new), "a" (os), "b" (ns), "d" (out)
+ : "S" (old), "D" (new), "a" ((long)os), "b" ((long)ns), "d" (out)
: "memory"
);
return out[0]+out[1]+out[2]+out[3];
diff --git a/libmpcodecs/vf_divtc.c b/libmpcodecs/vf_divtc.c
index e17600edbd..d3f287a73d 100644
--- a/libmpcodecs/vf_divtc.c
+++ b/libmpcodecs/vf_divtc.c
@@ -44,11 +44,11 @@ static int diff_MMX(unsigned char *old, unsigned char *new, int os, int ns)
".balign 16 \n\t"
"1: \n\t"
- "movq (%%esi), %%mm0 \n\t"
- "movq (%%esi), %%mm2 \n\t"
- "addl %%eax, %%esi \n\t"
- "movq (%%edi), %%mm1 \n\t"
- "addl %%ebx, %%edi \n\t"
+ "movq (%%"REG_S"), %%mm0 \n\t"
+ "movq (%%"REG_S"), %%mm2 \n\t"
+ "add %%"REG_a", %%"REG_S" \n\t"
+ "movq (%%"REG_D"), %%mm1 \n\t"
+ "add %%"REG_b", %%"REG_D" \n\t"
"psubusb %%mm1, %%mm2 \n\t"
"psubusb %%mm0, %%mm1 \n\t"
"movq %%mm2, %%mm0 \n\t"
@@ -64,10 +64,10 @@ static int diff_MMX(unsigned char *old, unsigned char *new, int os, int ns)
"decl %%ecx \n\t"
"jnz 1b \n\t"
- "movq %%mm4, (%%edx) \n\t"
+ "movq %%mm4, (%%"REG_d") \n\t"
"emms \n\t"
:
- : "S" (old), "D" (new), "a" (os), "b" (ns), "d" (out)
+ : "S" (old), "D" (new), "a" ((long)os), "b" ((long)ns), "d" (out)
: "memory"
);
return out[0]+out[1]+out[2]+out[3];
diff --git a/libmpcodecs/vf_eq.c b/libmpcodecs/vf_eq.c
index 74395f61c6..d7adeea1ff 100644
--- a/libmpcodecs/vf_eq.c
+++ b/libmpcodecs/vf_eq.c
@@ -64,9 +64,9 @@ static void process_MMX(unsigned char *dest, int dstride, unsigned char *src, in
"paddw %%mm3, %%mm1 \n\t"
"paddw %%mm3, %%mm2 \n\t"
"packuswb %%mm2, %%mm1 \n\t"
- "addl $8, %0 \n\t"
+ "add $8, %0 \n\t"
"movq %%mm1, (%1) \n\t"
- "addl $8, %1 \n\t"
+ "add $8, %1 \n\t"
"decl %%eax \n\t"
"jnz 1b \n\t"
: "=r" (src), "=r" (dest)
diff --git a/libmpcodecs/vf_eq2.c b/libmpcodecs/vf_eq2.c
index 123bcea55e..f2641f9c0b 100644
--- a/libmpcodecs/vf_eq2.c
+++ b/libmpcodecs/vf_eq2.c
@@ -152,9 +152,9 @@ void affine_1d_MMX (eq2_param_t *par, unsigned char *dst, unsigned char *src,
"paddw %%mm3, %%mm1 \n\t"
"paddw %%mm3, %%mm2 \n\t"
"packuswb %%mm2, %%mm1 \n\t"
- "addl $8, %0 \n\t"
+ "add $8, %0 \n\t"
"movq %%mm1, (%1) \n\t"
- "addl $8, %1 \n\t"
+ "add $8, %1 \n\t"
"decl %%eax \n\t"
"jnz 1b \n\t"
: "=r" (src), "=r" (dst)
diff --git a/libmpcodecs/vf_filmdint.c b/libmpcodecs/vf_filmdint.c
index 27a527cac3..90e25b8423 100644
--- a/libmpcodecs/vf_filmdint.c
+++ b/libmpcodecs/vf_filmdint.c
@@ -406,8 +406,8 @@ block_metrics_faster_c(unsigned char *a, unsigned char *b, int as, int bs,
"psllq $16, %%mm0\n\t" \
"paddusw %%mm0, %%mm7\n\t" \
"movq (%1), %%mm4\n\t" \
- "leal (%0,%2,2), %0\n\t" \
- "leal (%1,%3,2), %1\n\t" \
+ "lea (%0,%2,2), %0\n\t" \
+ "lea (%1,%3,2), %1\n\t" \
"psubusb %4, %%mm4\n\t" \
PAVGB(%%mm2, %%mm4) \
PAVGB(%%mm2, %%mm4) /* mm4 = qup odd */ \
@@ -440,7 +440,7 @@ block_metrics_faster_c(unsigned char *a, unsigned char *b, int as, int bs,
"paddusw %%mm2, %%mm7\n\t" \
"paddusw %%mm1, %%mm7\n\t" \
: "=r" (a), "=r" (b) \
- : "r"(as), "r"(bs), "m" (ones), "0"(a), "1"(b), "X"(*a), "X"(*b) \
+ : "r"((long)as), "r"((long)bs), "m" (ones), "0"(a), "1"(b), "X"(*a), "X"(*b) \
); \
} while (--lines);
@@ -650,7 +650,7 @@ dint_copy_line_mmx2(unsigned char *dst, unsigned char *a, long bos,
"por %%mm3, %%mm1 \n\t" /* avg if >= threshold */
"movq %%mm1, (%2,%4) \n\t"
: /* no output */
- : "r" (a), "r" (bos), "r" (dst), "r" (ss), "r" (ds), "r" (cos)
+ : "r" (a), "r" (bos), "r" (dst), "r" ((long)ss), "r" ((long)ds), "r" (cos)
);
a += 8;
dst += 8;
diff --git a/libmpcodecs/vf_halfpack.c b/libmpcodecs/vf_halfpack.c
index b4fc0e648f..900aed6a9c 100644
--- a/libmpcodecs/vf_halfpack.c
+++ b/libmpcodecs/vf_halfpack.c
@@ -75,13 +75,13 @@ static void halfpack_MMX(unsigned char *dst, unsigned char *src[3],
"por %%mm5, %%mm1 \n\t"
"por %%mm6, %%mm2 \n\t"
- "addl $8, %0 \n\t"
- "addl $8, %1 \n\t"
- "addl $4, %2 \n\t"
- "addl $4, %3 \n\t"
+ "add $8, %0 \n\t"
+ "add $8, %1 \n\t"
+ "add $4, %2 \n\t"
+ "add $4, %3 \n\t"
"movq %%mm1, (%8) \n\t"
"movq %%mm2, 8(%8) \n\t"
- "addl $16, %8 \n\t"
+ "add $16, %8 \n\t"
"decl %9 \n\t"
"jnz 1b \n\t"
: "=r" (y1), "=r" (y2), "=r" (u), "=r" (v)
diff --git a/libmpcodecs/vf_ilpack.c b/libmpcodecs/vf_ilpack.c
index 66bad26de4..43c6bad218 100644
--- a/libmpcodecs/vf_ilpack.c
+++ b/libmpcodecs/vf_ilpack.c
@@ -76,12 +76,12 @@ static void pack_nn_MMX(unsigned char *dst, unsigned char *y,
"punpcklbw %%mm4, %%mm1 \n\t"
"punpckhbw %%mm4, %%mm2 \n\t"
- "addl $8, %0 \n\t"
- "addl $4, %1 \n\t"
- "addl $4, %2 \n\t"
+ "add $8, %0 \n\t"
+ "add $4, %1 \n\t"
+ "add $4, %2 \n\t"
"movq %%mm1, (%3) \n\t"
"movq %%mm2, 8(%3) \n\t"
- "addl $16, %3 \n\t"
+ "add $16, %3 \n\t"
"decl %4 \n\t"
"jnz 1b \n\t"
"emms \n\t"
@@ -96,22 +96,26 @@ static void pack_li_0_MMX(unsigned char *dst, unsigned char *y,
unsigned char *u, unsigned char *v, int w, int us, int vs)
{
asm volatile (""
- "pushl %%ebp \n\t"
- "movl 4(%%edx), %%ebp \n\t"
- "movl (%%edx), %%edx \n\t"
+ "push %%"REG_BP" \n\t"
+#ifdef ARCH_X86_64
+ "mov %6, %%"REG_BP" \n\t"
+#else
+ "movl 4(%%"REG_d"), %%"REG_BP" \n\t"
+ "movl (%%"REG_d"), %%"REG_d" \n\t"
+#endif
"pxor %%mm0, %%mm0 \n\t"
".balign 16 \n\t"
".Lli0: \n\t"
- "movq (%%esi), %%mm1 \n\t"
- "movq (%%esi), %%mm2 \n\t"
+ "movq (%%"REG_S"), %%mm1 \n\t"
+ "movq (%%"REG_S"), %%mm2 \n\t"
- "movq (%%eax,%%edx,2), %%mm4 \n\t"
- "movq (%%ebx,%%ebp,2), %%mm6 \n\t"
+ "movq (%%"REG_a",%%"REG_d",2), %%mm4 \n\t"
+ "movq (%%"REG_b",%%"REG_BP",2), %%mm6 \n\t"
"punpcklbw %%mm0, %%mm4 \n\t"
"punpcklbw %%mm0, %%mm6 \n\t"
- "movq (%%eax), %%mm3 \n\t"
- "movq (%%ebx), %%mm5 \n\t"
+ "movq (%%"REG_a"), %%mm3 \n\t"
+ "movq (%%"REG_b"), %%mm5 \n\t"
"punpcklbw %%mm0, %%mm3 \n\t"
"punpcklbw %%mm0, %%mm5 \n\t"
"paddw %%mm3, %%mm4 \n\t"
@@ -136,18 +140,18 @@ static void pack_li_0_MMX(unsigned char *dst, unsigned char *y,
"punpcklbw %%mm4, %%mm1 \n\t"
"punpckhbw %%mm4, %%mm2 \n\t"
- "movq %%mm1, (%%edi) \n\t"
- "movq %%mm2, 8(%%edi) \n\t"
+ "movq %%mm1, (%%"REG_D") \n\t"
+ "movq %%mm2, 8(%%"REG_D") \n\t"
- "movq 8(%%esi), %%mm1 \n\t"
- "movq 8(%%esi), %%mm2 \n\t"
+ "movq 8(%%"REG_S"), %%mm1 \n\t"
+ "movq 8(%%"REG_S"), %%mm2 \n\t"
- "movq (%%eax,%%edx,2), %%mm4 \n\t"
- "movq (%%ebx,%%ebp,2), %%mm6 \n\t"
+ "movq (%%"REG_a",%%"REG_d",2), %%mm4 \n\t"
+ "movq (%%"REG_b",%%"REG_BP",2), %%mm6 \n\t"
"punpckhbw %%mm0, %%mm4 \n\t"
"punpckhbw %%mm0, %%mm6 \n\t"
- "movq (%%eax), %%mm3 \n\t"
- "movq (%%ebx), %%mm5 \n\t"
+ "movq (%%"REG_a"), %%mm3 \n\t"
+ "movq (%%"REG_b"), %%mm5 \n\t"
"punpckhbw %%mm0, %%mm3 \n\t"
"punpckhbw %%mm0, %%mm5 \n\t"
"paddw %%mm3, %%mm4 \n\t"
@@ -172,20 +176,25 @@ static void pack_li_0_MMX(unsigned char *dst, unsigned char *y,
"punpcklbw %%mm4, %%mm1 \n\t"
"punpckhbw %%mm4, %%mm2 \n\t"
- "addl $16, %%esi \n\t"
- "addl $8, %%eax \n\t"
- "addl $8, %%ebx \n\t"
+ "add $16, %%"REG_S" \n\t"
+ "add $8, %%"REG_a" \n\t"
+ "add $8, %%"REG_b" \n\t"
- "movq %%mm1, 16(%%edi) \n\t"
- "movq %%mm2, 24(%%edi) \n\t"
- "addl $32, %%edi \n\t"
+ "movq %%mm1, 16(%%"REG_D") \n\t"
+ "movq %%mm2, 24(%%"REG_D") \n\t"
+ "add $32, %%"REG_D" \n\t"
"decl %%ecx \n\t"
"jnz .Lli0 \n\t"
"emms \n\t"
- "popl %%ebp \n\t"
+ "pop %%"REG_BP" \n\t"
:
- : "S" (y), "D" (dst), "a" (u), "b" (v), "d" (&us), "c" (w/16)
+ : "S" (y), "D" (dst), "a" (u), "b" (v), "c" (w/16),
+#ifdef ARCH_X86_64
+ "d" ((long)us), "r" ((long)vs)
+#else
+ "d" (&us)
+#endif
: "memory"
);
pack_li_0_C(dst, y, u, v, (w&15), us, vs);
@@ -195,22 +204,26 @@ static void pack_li_1_MMX(unsigned char *dst, unsigned char *y,
unsigned char *u, unsigned char *v, int w, int us, int vs)
{
asm volatile (""
- "pushl %%ebp \n\t"
- "movl 4(%%edx), %%ebp \n\t"
- "movl (%%edx), %%edx \n\t"
+ "push %%"REG_BP" \n\t"
+#ifdef ARCH_X86_64
+ "mov %6, %%"REG_BP" \n\t"
+#else
+ "movl 4(%%"REG_d"), %%"REG_BP" \n\t"
+ "movl (%%"REG_d"), %%"REG_d" \n\t"
+#endif
"pxor %%mm0, %%mm0 \n\t"
".balign 16 \n\t"
".Lli1: \n\t"
- "movq (%%esi), %%mm1 \n\t"
- "movq (%%esi), %%mm2 \n\t"
+ "movq (%%"REG_S"), %%mm1 \n\t"
+ "movq (%%"REG_S"), %%mm2 \n\t"
- "movq (%%eax,%%edx,2), %%mm4 \n\t"
- "movq (%%ebx,%%ebp,2), %%mm6 \n\t"
+ "movq (%%"REG_a",%%"REG_d",2), %%mm4 \n\t"
+ "movq (%%"REG_b",%%"REG_BP",2), %%mm6 \n\t"
"punpcklbw %%mm0, %%mm4 \n\t"
"punpcklbw %%mm0, %%mm6 \n\t"
- "movq (%%eax), %%mm3 \n\t"
- "movq (%%ebx), %%mm5 \n\t"
+ "movq (%%"REG_a"), %%mm3 \n\t"
+ "movq (%%"REG_b"), %%mm5 \n\t"
"punpcklbw %%mm0, %%mm3 \n\t"
"punpcklbw %%mm0, %%mm5 \n\t"
"movq %%mm4, %%mm7 \n\t"
@@ -237,18 +250,18 @@ static void pack_li_1_MMX(unsigned char *dst, unsigned char *y,
"punpcklbw %%mm4, %%mm1 \n\t"
"punpckhbw %%mm4, %%mm2 \n\t"
- "movq %%mm1, (%%edi) \n\t"
- "movq %%mm2, 8(%%edi) \n\t"
+ "movq %%mm1, (%%"REG_D") \n\t"
+ "movq %%mm2, 8(%%"REG_D") \n\t"
- "movq 8(%%esi), %%mm1 \n\t"
- "movq 8(%%esi), %%mm2 \n\t"
+ "movq 8(%%"REG_S"), %%mm1 \n\t"
+ "movq 8(%%"REG_S"), %%mm2 \n\t"
- "movq (%%eax,%%edx,2), %%mm4 \n\t"
- "movq (%%ebx,%%ebp,2), %%mm6 \n\t"
+ "movq (%%"REG_a",%%"REG_d",2), %%mm4 \n\t"
+ "movq (%%"REG_b",%%"REG_BP",2), %%mm6 \n\t"
"punpckhbw %%mm0, %%mm4 \n\t"
"punpckhbw %%mm0, %%mm6 \n\t"
- "movq (%%eax), %%mm3 \n\t"
- "movq (%%ebx), %%mm5 \n\t"
+ "movq (%%"REG_a"), %%mm3 \n\t"
+ "movq (%%"REG_b"), %%mm5 \n\t"
"punpckhbw %%mm0, %%mm3 \n\t"
"punpckhbw %%mm0, %%mm5 \n\t"
"movq %%mm4, %%mm7 \n\t"
@@ -275,20 +288,25 @@ static void pack_li_1_MMX(unsigned char *dst, unsigned char *y,
"punpcklbw %%mm4, %%mm1 \n\t"
"punpckhbw %%mm4, %%mm2 \n\t"
- "addl $16, %%esi \n\t"
- "addl $8, %%eax \n\t"
- "addl $8, %%ebx \n\t"
+ "add $16, %%"REG_S" \n\t"
+ "add $8, %%"REG_a" \n\t"
+ "add $8, %%"REG_b" \n\t"
- "movq %%mm1, 16(%%edi) \n\t"
- "movq %%mm2, 24(%%edi) \n\t"
- "addl $32, %%edi \n\t"
+ "movq %%mm1, 16(%%"REG_D") \n\t"
+ "movq %%mm2, 24(%%"REG_D") \n\t"
+ "add $32, %%"REG_D" \n\t"
"decl %%ecx \n\t"
"jnz .Lli1 \n\t"
"emms \n\t"
- "popl %%ebp \n\t"
+ "pop %%"REG_BP" \n\t"
:
- : "S" (y), "D" (dst), "a" (u), "b" (v), "d" (&us), "c" (w/16)
+ : "S" (y), "D" (dst), "a" (u), "b" (v), "c" (w/16),
+#ifdef ARCH_X86_64
+ "d" ((long)us), "r" ((long)vs)
+#else
+ "d" (&us)
+#endif
: "memory"
);
pack_li_1_C(dst, y, u, v, (w&15), us, vs);
diff --git a/libmpcodecs/vf_ivtc.c b/libmpcodecs/vf_ivtc.c
index 804f68a084..3fb00e5f7b 100644
--- a/libmpcodecs/vf_ivtc.c
+++ b/libmpcodecs/vf_ivtc.c
@@ -71,11 +71,11 @@ static void block_diffs_MMX(struct metrics *m, unsigned char *old, unsigned char
"1: \n\t"
// Even difference
- "movq (%%esi), %%mm0 \n\t"
- "movq (%%esi), %%mm2 \n\t"
- "addl %%eax, %%esi \n\t"
- "movq (%%edi), %%mm1 \n\t"
- "addl %%ebx, %%edi \n\t"
+ "movq (%%"REG_S"), %%mm0 \n\t"
+ "movq (%%"REG_S"), %%mm2 \n\t"
+ "add %%"REG_a", %%"REG_S" \n\t"
+ "movq (%%"REG_D"), %%mm1 \n\t"
+ "add %%"REG_b", %%"REG_D" \n\t"
"psubusb %%mm1, %%mm2 \n\t"
"psubusb %%mm0, %%mm1 \n\t"
"movq %%mm2, %%mm0 \n\t"
@@ -90,11 +90,11 @@ static void block_diffs_MMX(struct metrics *m, unsigned char *old, unsigned char
"paddw %%mm3, %%mm4 \n\t"
// Odd difference
- "movq (%%esi), %%mm0 \n\t"
- "movq (%%esi), %%mm2 \n\t"
- "addl %%eax, %%esi \n\t"
- "movq (%%edi), %%mm1 \n\t"
- "addl %%ebx, %%edi \n\t"
+ "movq (%%"REG_S"), %%mm0 \n\t"
+ "movq (%%"REG_S"), %%mm2 \n\t"
+ "add %%"REG_a", %%"REG_S" \n\t"
+ "movq (%%"REG_D"), %%mm1 \n\t"
+ "add %%"REG_b", %%"REG_D" \n\t"
"psubusb %%mm1, %%mm2 \n\t"
"psubusb %%mm0, %%mm1 \n\t"
"movq %%mm2, %%mm0 \n\t"
@@ -110,8 +110,8 @@ static void block_diffs_MMX(struct metrics *m, unsigned char *old, unsigned char
"decl %%ecx \n\t"
"jnz 1b \n\t"
- "movq %%mm4, (%%edx) \n\t"
- "movq %%mm5, 8(%%edx) \n\t"
+ "movq %%mm4, (%%"REG_d") \n\t"
+ "movq %%mm5, 8(%%"REG_d") \n\t"
:
: "S" (old), "D" (new), "a" (os), "b" (ns), "d" (out)
: "memory"
@@ -130,14 +130,14 @@ static void block_diffs_MMX(struct metrics *m, unsigned char *old, unsigned char
".balign 16 \n\t"
"2: \n\t"
- "movq (%%esi), %%mm0 \n\t"
- "movq (%%esi,%%eax), %%mm1 \n\t"
- "addl %%eax, %%esi \n\t"
- "addl %%eax, %%esi \n\t"
- "movq (%%edi), %%mm2 \n\t"
- "movq (%%edi,%%ebx), %%mm3 \n\t"
- "addl %%ebx, %%edi \n\t"
- "addl %%ebx, %%edi \n\t"
+ "movq (%%"REG_S"), %%mm0 \n\t"
+ "movq (%%"REG_S",%%"REG_a"), %%mm1 \n\t"
+ "add %%"REG_a", %%"REG_S" \n\t"
+ "add %%"REG_a", %%"REG_S" \n\t"
+ "movq (%%"REG_D"), %%mm2 \n\t"
+ "movq (%%"REG_D",%%"REG_b"), %%mm3 \n\t"
+ "add %%"REG_b", %%"REG_D" \n\t"
+ "add %%"REG_b", %%"REG_D" \n\t"
"punpcklbw %%mm7, %%mm0 \n\t"
"punpcklbw %%mm7, %%mm1 \n\t"
"punpcklbw %%mm7, %%mm2 \n\t"
@@ -164,16 +164,16 @@ static void block_diffs_MMX(struct metrics *m, unsigned char *old, unsigned char
"psubw %%mm1, %%mm4 \n\t"
"psubw %%mm2, %%mm5 \n\t"
"psubw %%mm3, %%mm6 \n\t"
- "movq %%mm4, (%%edx) \n\t"
- "movq %%mm5, 16(%%edx) \n\t"
- "movq %%mm6, 32(%%edx) \n\t"
+ "movq %%mm4, (%%"REG_d") \n\t"
+ "movq %%mm5, 16(%%"REG_d") \n\t"
+ "movq %%mm6, 32(%%"REG_d") \n\t"
- "movl %%eax, %%ecx \n\t"
- "shll $3, %%ecx \n\t"
- "subl %%ecx, %%esi \n\t"
- "movl %%ebx, %%ecx \n\t"
- "shll $3, %%ecx \n\t"
- "subl %%ecx, %%edi \n\t"
+ "mov %%"REG_a", %%"REG_c" \n\t"
+ "shl $3, %%"REG_c" \n\t"
+ "sub %%"REG_c", %%"REG_S" \n\t"
+ "mov %%"REG_b", %%"REG_c" \n\t"
+ "shl $3, %%"REG_c" \n\t"
+ "sub %%"REG_c", %%"REG_D" \n\t"
// Second loop for the last four columns
"movl $4, %%ecx \n\t"
@@ -184,14 +184,14 @@ static void block_diffs_MMX(struct metrics *m, unsigned char *old, unsigned char
".balign 16 \n\t"
"3: \n\t"
- "movq (%%esi), %%mm0 \n\t"
- "movq (%%esi,%%eax), %%mm1 \n\t"
- "addl %%eax, %%esi \n\t"
- "addl %%eax, %%esi \n\t"
- "movq (%%edi), %%mm2 \n\t"
- "movq (%%edi,%%ebx), %%mm3 \n\t"
- "addl %%ebx, %%edi \n\t"
- "addl %%ebx, %%edi \n\t"
+ "movq (%%"REG_S"), %%mm0 \n\t"
+ "movq (%%"REG_S",%%"REG_a"), %%mm1 \n\t"
+ "add %%"REG_a", %%"REG_S" \n\t"
+ "add %%"REG_a", %%"REG_S" \n\t"
+ "movq (%%"REG_D"), %%mm2 \n\t"
+ "movq (%%"REG_D",%%"REG_b"), %%mm3 \n\t"
+ "add %%"REG_b", %%"REG_D" \n\t"
+ "add %%"REG_b", %%"REG_D" \n\t"
"punpckhbw %%mm7, %%mm0 \n\t"
"punpckhbw %%mm7, %%mm1 \n\t"
"punpckhbw %%mm7, %%mm2 \n\t"
@@ -218,13 +218,13 @@ static void block_diffs_MMX(struct metrics *m, unsigned char *old, unsigned char
"psubw %%mm1, %%mm4 \n\t"
"psubw %%mm2, %%mm5 \n\t"
"psubw %%mm3, %%mm6 \n\t"
- "movq %%mm4, 8(%%edx) \n\t"
- "movq %%mm5, 24(%%edx) \n\t"
- "movq %%mm6, 40(%%edx) \n\t"
+ "movq %%mm4, 8(%%"REG_d") \n\t"
+ "movq %%mm5, 24(%%"REG_d") \n\t"
+ "movq %%mm6, 40(%%"REG_d") \n\t"
"emms \n\t"
:
- : "S" (old), "D" (new), "a" (os), "b" (ns), "d" (out)
+ : "S" (old), "D" (new), "a" ((long)os), "b" ((long)ns), "d" (out)
: "memory"
);
m->p = m->t = m->s = 0;
diff --git a/libmpcodecs/vf_noise.c b/libmpcodecs/vf_noise.c
index 14ad8f9604..c8f669bffa 100644
--- a/libmpcodecs/vf_noise.c
+++ b/libmpcodecs/vf_noise.c
@@ -143,26 +143,26 @@ static int8_t *initNoise(FilterParam *fp){
#ifdef HAVE_MMX
static inline void lineNoise_MMX(uint8_t *dst, uint8_t *src, int8_t *noise, int len, int shift){
- int mmx_len= len&(~7);
+ long mmx_len= len&(~7);
noise+=shift;
asm volatile(
- "movl %3, %%eax \n\t"
+ "mov %3, %%"REG_a" \n\t"
"pcmpeqb %%mm7, %%mm7 \n\t"
"psllw $15, %%mm7 \n\t"
"packsswb %%mm7, %%mm7 \n\t"
".balign 16 \n\t"
"1: \n\t"
- "movq (%0, %%eax), %%mm0 \n\t"
- "movq (%1, %%eax), %%mm1 \n\t"
+ "movq (%0, %%"REG_a"), %%mm0 \n\t"
+ "movq (%1, %%"REG_a"), %%mm1 \n\t"
"pxor %%mm7, %%mm0 \n\t"
"paddsb %%mm1, %%mm0 \n\t"
"pxor %%mm7, %%mm0 \n\t"
- "movq %%mm0, (%2, %%eax) \n\t"
- "addl $8, %%eax \n\t"
+ "movq %%mm0, (%2, %%"REG_a") \n\t"
+ "add $8, %%"REG_a" \n\t"
" js 1b \n\t"
:: "r" (src+mmx_len), "r" (noise+mmx_len), "r" (dst+mmx_len), "g" (-mmx_len)
- : "%eax"
+ : "%"REG_a
);
if(mmx_len!=len)
lineNoise_C(dst+mmx_len, src+mmx_len, noise+mmx_len, len-mmx_len, 0);
@@ -172,26 +172,26 @@ static inline void lineNoise_MMX(uint8_t *dst, uint8_t *src, int8_t *noise, int
//duplicate of previous except movntq
#ifdef HAVE_MMX2
static inline void lineNoise_MMX2(uint8_t *dst, uint8_t *src, int8_t *noise, int len, int shift){
- int mmx_len= len&(~7);
+ long mmx_len= len&(~7);
noise+=shift;
asm volatile(
- "movl %3, %%eax \n\t"
+ "mov %3, %%"REG_a" \n\t"
"pcmpeqb %%mm7, %%mm7 \n\t"
"psllw $15, %%mm7 \n\t"
"packsswb %%mm7, %%mm7 \n\t"
".balign 16 \n\t"
"1: \n\t"
- "movq (%0, %%eax), %%mm0 \n\t"
- "movq (%1, %%eax), %%mm1 \n\t"
+ "movq (%0, %%"REG_a"), %%mm0 \n\t"
+ "movq (%1, %%"REG_a"), %%mm1 \n\t"
"pxor %%mm7, %%mm0 \n\t"
"paddsb %%mm1, %%mm0 \n\t"
"pxor %%mm7, %%mm0 \n\t"
- "movntq %%mm0, (%2, %%eax) \n\t"
- "addl $8, %%eax \n\t"
+ "movntq %%mm0, (%2, %%"REG_a") \n\t"
+ "add $8, %%"REG_a" \n\t"
" js 1b \n\t"
:: "r" (src+mmx_len), "r" (noise+mmx_len), "r" (dst+mmx_len), "g" (-mmx_len)
- : "%eax"
+ : "%"REG_a
);
if(mmx_len!=len)
lineNoise_C(dst+mmx_len, src+mmx_len, noise+mmx_len, len-mmx_len, 0);
@@ -214,16 +214,16 @@ static inline void lineNoise_C(uint8_t *dst, uint8_t *src, int8_t *noise, int le
#ifdef HAVE_MMX
static inline void lineNoiseAvg_MMX(uint8_t *dst, uint8_t *src, int len, int8_t **shift){
- int mmx_len= len&(~7);
+ long mmx_len= len&(~7);
asm volatile(
- "movl %5, %%eax \n\t"
+ "mov %5, %%"REG_a" \n\t"
".balign 16 \n\t"
"1: \n\t"
- "movq (%1, %%eax), %%mm1 \n\t"
- "movq (%0, %%eax), %%mm0 \n\t"
- "paddb (%2, %%eax), %%mm1 \n\t"
- "paddb (%3, %%eax), %%mm1 \n\t"
+ "movq (%1, %%"REG_a"), %%mm1 \n\t"
+ "movq (%0, %%"REG_a"), %%mm0 \n\t"
+ "paddb (%2, %%"REG_a"), %%mm1 \n\t"
+ "paddb (%3, %%"REG_a"), %%mm1 \n\t"
"movq %%mm0, %%mm2 \n\t"
"movq %%mm1, %%mm3 \n\t"
"punpcklbw %%mm0, %%mm0 \n\t"
@@ -239,12 +239,12 @@ static inline void lineNoiseAvg_MMX(uint8_t *dst, uint8_t *src, int len, int8_t
"psrlw $8, %%mm1 \n\t"
"psrlw $8, %%mm3 \n\t"
"packuswb %%mm3, %%mm1 \n\t"
- "movq %%mm1, (%4, %%eax) \n\t"
- "addl $8, %%eax \n\t"
+ "movq %%mm1, (%4, %%"REG_a") \n\t"
+ "add $8, %%"REG_a" \n\t"
" js 1b \n\t"
:: "r" (src+mmx_len), "r" (shift[0]+mmx_len), "r" (shift[1]+mmx_len), "r" (shift[2]+mmx_len),
"r" (dst+mmx_len), "g" (-mmx_len)
- : "%eax"
+ : "%"REG_a
);
if(mmx_len!=len){
diff --git a/libmpcodecs/vf_spp.c b/libmpcodecs/vf_spp.c
index 0447ab9838..6cc147b8f6 100644
--- a/libmpcodecs/vf_spp.c
+++ b/libmpcodecs/vf_spp.c
@@ -357,9 +357,9 @@ static void store_slice_mmx(uint8_t *dst, int16_t *src, int dst_stride, int src_
"psraw %%mm2, %%mm1 \n\t"
"packuswb %%mm1, %%mm0 \n\t"
"movq %%mm0, (%1) \n\t"
- "addl $16, %0 \n\t"
- "addl $8, %1 \n\t"
- "cmpl %2, %1 \n\t"
+ "add $16, %0 \n\t"
+ "add $8, %1 \n\t"
+ "cmp %2, %1 \n\t"
" jb 1b \n\t"
: "+r" (src1), "+r"(dst1)
: "r"(dst + width), "r"(dither[y]), "g"(log2_scale), "g"(6-log2_scale)
diff --git a/libmpcodecs/vf_tfields.c b/libmpcodecs/vf_tfields.c
index 779fb6744d..76211d92cf 100644
--- a/libmpcodecs/vf_tfields.c
+++ b/libmpcodecs/vf_tfields.c
@@ -61,7 +61,7 @@ static void deint(unsigned char *dest, int ds, unsigned char *src, int ss, int w
static void qpel_li_3DNOW(unsigned char *d, unsigned char *s, int w, int h, int ds, int ss, int up)
{
int i, j, ssd=ss;
- int crap1, crap2;
+ long crap1, crap2;
if (up) {
ssd = -ss;
memcpy(d, s, w);
@@ -71,17 +71,17 @@ static void qpel_li_3DNOW(unsigned char *d, unsigned char *s, int w, int h, int
for (i=h-1; i; i--) {
asm volatile(
"1: \n\t"
- "movq (%%esi), %%mm0 \n\t"
- "movq (%%esi,%%eax), %%mm1 \n\t"
+ "movq (%%"REG_S"), %%mm0 \n\t"
+ "movq (%%"REG_S",%%"REG_a"), %%mm1 \n\t"
"pavgusb %%mm0, %%mm1 \n\t"
- "addl $8, %%esi \n\t"
+ "add $8, %%"REG_S" \n\t"
"pavgusb %%mm0, %%mm1 \n\t"
- "movq %%mm1, (%%edi) \n\t"
- "addl $8, %%edi \n\t"
+ "movq %%mm1, (%%"REG_D") \n\t"
+ "add $8, %%"REG_D" \n\t"
"decl %%ecx \n\t"
"jnz 1b \n\t"
: "=S"(crap1), "=D"(crap2)
- : "c"(w>>3), "S"(s), "D"(d), "a"(ssd)
+ : "c"(w>>3), "S"(s), "D"(d), "a"((long)ssd)
);
for (j=w-(w&7); j<w; j++)
d[j] = (s[j+ssd] + 3*s[j])>>2;
@@ -97,7 +97,7 @@ static void qpel_li_3DNOW(unsigned char *d, unsigned char *s, int w, int h, int
static void qpel_li_MMX2(unsigned char *d, unsigned char *s, int w, int h, int ds, int ss, int up)
{
int i, j, ssd=ss;
- int crap1, crap2;
+ long crap1, crap2;
if (up) {
ssd = -ss;
memcpy(d, s, w);
@@ -108,17 +108,17 @@ static void qpel_li_MMX2(unsigned char *d, unsigned char *s, int w, int h, int d
asm volatile(
"pxor %%mm7, %%mm7 \n\t"
"2: \n\t"
- "movq (%%esi), %%mm0 \n\t"
- "movq (%%esi,%%eax), %%mm1 \n\t"
+ "movq (%%"REG_S"), %%mm0 \n\t"
+ "movq (%%"REG_S",%%"REG_a"), %%mm1 \n\t"
"pavgb %%mm0, %%mm1 \n\t"
- "addl $8, %%esi \n\t"
+ "add $8, %%"REG_S" \n\t"
"pavgb %%mm0, %%mm1 \n\t"
- "movq %%mm1, (%%edi) \n\t"
- "addl $8, %%edi \n\t"
+ "movq %%mm1, (%%"REG_D") \n\t"
+ "add $8, %%"REG_D" \n\t"
"decl %%ecx \n\t"
"jnz 2b \n\t"
: "=S"(crap1), "=D"(crap2)
- : "c"(w>>3), "S"(s), "D"(d), "a"(ssd)
+ : "c"(w>>3), "S"(s), "D"(d), "a"((long)ssd)
);
for (j=w-(w&7); j<w; j++)
d[j] = (s[j+ssd] + 3*s[j])>>2;
@@ -145,11 +145,11 @@ static void qpel_li_MMX(unsigned char *d, unsigned char *s, int w, int h, int ds
asm volatile(
"pxor %%mm7, %%mm7 \n\t"
"3: \n\t"
- "movq (%%esi), %%mm0 \n\t"
- "movq (%%esi), %%mm1 \n\t"
- "movq (%%esi,%%eax), %%mm2 \n\t"
- "movq (%%esi,%%eax), %%mm3 \n\t"
- "addl $8, %%esi \n\t"
+ "movq (%%"REG_S"), %%mm0 \n\t"
+ "movq (%%"REG_S"), %%mm1 \n\t"
+ "movq (%%"REG_S",%%"REG_a"), %%mm2 \n\t"
+ "movq (%%"REG_S",%%"REG_a"), %%mm3 \n\t"
+ "add $8, %%"REG_S" \n\t"
"punpcklbw %%mm7, %%mm0 \n\t"
"punpckhbw %%mm7, %%mm1 \n\t"
"punpcklbw %%mm7, %%mm2 \n\t"
@@ -163,12 +163,12 @@ static void qpel_li_MMX(unsigned char *d, unsigned char *s, int w, int h, int ds
"psrlw $2, %%mm2 \n\t"
"psrlw $2, %%mm3 \n\t"
"packsswb %%mm3, %%mm2 \n\t"
- "movq %%mm2, (%%edi) \n\t"
- "addl $8, %%edi \n\t"
+ "movq %%mm2, (%%"REG_D") \n\t"
+ "add $8, %%"REG_D" \n\t"
"decl %%ecx \n\t"
"jnz 3b \n\t"
: "=S"(crap1), "=D"(crap2)
- : "c"(w>>3), "S"(s), "D"(d), "a"(ssd)
+ : "c"(w>>3), "S"(s), "D"(d), "a"((long)ssd)
);
for (j=w-(w&7); j<w; j++)
d[j] = (s[j+ssd] + 3*s[j])>>2;
@@ -198,15 +198,15 @@ static void qpel_4tap_MMX(unsigned char *d, unsigned char *s, int w, int h, int
for (i=h-3; i; i--) {
asm volatile(
"pxor %%mm0, %%mm0 \n\t"
- "movq (%%edx), %%mm4 \n\t"
- "movq 8(%%edx), %%mm5 \n\t"
- "movq 16(%%edx), %%mm6 \n\t"
- "movq 24(%%edx), %%mm7 \n\t"
+ "movq (%%"REG_d"), %%mm4 \n\t"
+ "movq 8(%%"REG_d"), %%mm5 \n\t"
+ "movq 16(%%"REG_d"), %%mm6 \n\t"
+ "movq 24(%%"REG_d"), %%mm7 \n\t"
"4: \n\t"
- "movq (%%esi,%%eax), %%mm1 \n\t"
- "movq (%%esi), %%mm2 \n\t"
- "movq (%%esi,%%ebx), %%mm3 \n\t"
+ "movq (%%"REG_S",%%"REG_a"), %%mm1 \n\t"
+ "movq (%%"REG_S"), %%mm2 \n\t"
+ "movq (%%"REG_S",%%"REG_b"), %%mm3 \n\t"
"punpcklbw %%mm0, %%mm1 \n\t"
"punpcklbw %%mm0, %%mm2 \n\t"
"pmullw %%mm4, %%mm1 \n\t"
@@ -214,38 +214,38 @@ static void qpel_4tap_MMX(unsigned char *d, unsigned char *s, int w, int h, int
"pmullw %%mm5, %%mm2 \n\t"
"paddusw %%mm2, %%mm1 \n\t"
"pmullw %%mm6, %%mm3 \n\t"
- "movq (%%esi,%%eax,2), %%mm2 \n\t"
+ "movq (%%"REG_S",%%"REG_a",2), %%mm2 \n\t"
"psubusw %%mm3, %%mm1 \n\t"
"punpcklbw %%mm0, %%mm2 \n\t"
"pmullw %%mm7, %%mm2 \n\t"
"psubusw %%mm2, %%mm1 \n\t"
"psrlw $7, %%mm1 \n\t"
- "movq (%%esi,%%eax), %%mm2 \n\t"
- "movq (%%esi), %%mm3 \n\t"
+ "movq (%%"REG_S",%%"REG_a"), %%mm2 \n\t"
+ "movq (%%"REG_S"), %%mm3 \n\t"
"punpckhbw %%mm0, %%mm2 \n\t"
"punpckhbw %%mm0, %%mm3 \n\t"
"pmullw %%mm4, %%mm2 \n\t"
"pmullw %%mm5, %%mm3 \n\t"
"paddusw %%mm3, %%mm2 \n\t"
- "movq (%%esi,%%ebx), %%mm3 \n\t"
+ "movq (%%"REG_S",%%"REG_b"), %%mm3 \n\t"
"punpckhbw %%mm0, %%mm3 \n\t"
"pmullw %%mm6, %%mm3 \n\t"
"psubusw %%mm3, %%mm2 \n\t"
- "movq (%%esi,%%eax,2), %%mm3 \n\t"
+ "movq (%%"REG_S",%%"REG_a",2), %%mm3 \n\t"
"punpckhbw %%mm0, %%mm3 \n\t"
- "addl $8, %%esi \n\t"
+ "add $8, %%"REG_S" \n\t"
"pmullw %%mm7, %%mm3 \n\t"
"psubusw %%mm3, %%mm2 \n\t"
"psrlw $7, %%mm2 \n\t"
"packuswb %%mm2, %%mm1 \n\t"
- "movq %%mm1, (%%edi) \n\t"
- "addl $8, %%edi \n\t"
+ "movq %%mm1, (%%"REG_D") \n\t"
+ "add $8, %%"REG_D" \n\t"
"decl %%ecx \n\t"
"jnz 4b \n\t"
: "=S"(crap1), "=D"(crap2)
- : "c"(w>>3), "S"(s), "D"(d), "a"(ssd), "b"(-ssd), "d"(filter)
+ : "c"(w>>3), "S"(s), "D"(d), "a"((long)ssd), "b"((long)-ssd), "d"(filter)
);
for (j=w-(w&7); j<w; j++)
d[j] = (-9*s[j-ssd] + 111*s[j] + 29*s[j+ssd] - 3*s[j+ssd+ssd])>>7;