changeset 18104:7b408d60de9e

add support for intel mac. mp3lib is not fixed yet.
author nplourde
date Sat, 15 Apr 2006 20:46:54 +0000
parents 26ea12332e67
children 954eac69b532
files asmalign.h configure liba52/downmix.c liba52/imdct.c libmpcodecs/pullup.c libmpcodecs/vf_decimate.c libmpcodecs/vf_divtc.c libmpcodecs/vf_eq.c libmpcodecs/vf_eq2.c libmpcodecs/vf_fspp.c libmpcodecs/vf_halfpack.c libmpcodecs/vf_ilpack.c libmpcodecs/vf_ivtc.c libmpcodecs/vf_noise.c mangle.h postproc/rgb2rgb_template.c postproc/swscale_template.c
diffstat 17 files changed, 123 insertions(+), 88 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/asmalign.h	Sat Apr 15 20:46:54 2006 +0000
@@ -0,0 +1,7 @@
+#ifdef SYS_DARWIN
+#define ASMALIGN8  ".align 3\n\t"
+#define ASMALIGN16 ".align 4\n\t"
+#else
+#define ASMALIGN8  ".balign 8\n\t"
+#define ASMALIGN16 ".balign 16\n\t"
+#endif
--- a/configure	Sat Apr 15 16:47:25 2006 +0000
+++ b/configure	Sat Apr 15 20:46:54 2006 +0000
@@ -6972,7 +6972,10 @@
 echores "$_crash_debug"
 
 if darwin ; then
-  CFLAGS="$CFLAGS -mdynamic-no-pic -falign-loops=16 -DSYS_DARWIN"
+  CFLAGS="$CFLAGS -mdynamic-no-pic -falign-loops=16 -DSYS_DARWIN -DCONFIG_DARWIN"  
+  if x86 ; then
+  CFLAGS="$CFLAGS -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk"
+  fi
   if [ "$_cc_major" = 3 ] && [ "$_cc_minor" -lt 1 ]; then
     CFLAGS="$CFLAGS -no-cpp-precomp"
   fi
--- a/liba52/downmix.c	Sat Apr 15 16:47:25 2006 +0000
+++ b/liba52/downmix.c	Sat Apr 15 20:46:54 2006 +0000
@@ -28,6 +28,7 @@
  */
 
 #include "config.h"
+#include "asmalign.h"
 
 #include <string.h>
 #include <inttypes.h>
@@ -691,7 +692,7 @@
 	"movlps %2, %%xmm7		\n\t"
 	"shufps $0x00, %%xmm7, %%xmm7	\n\t"
 	"mov $-1024, %%"REG_S"		\n\t"
-	".balign 16\n\t"
+	ASMALIGN16
 	"1:				\n\t"
 	"movaps (%0, %%"REG_S"), %%xmm0	\n\t" 
 	"movaps 16(%0, %%"REG_S"), %%xmm1\n\t" 
@@ -714,7 +715,7 @@
 	"movlps %1, %%xmm7		\n\t"
 	"shufps $0x00, %%xmm7, %%xmm7	\n\t"
 	"mov $-1024, %%"REG_S"		\n\t"
-	".balign 16\n\t"
+	ASMALIGN16
 	"1:				\n\t"
 	"movaps (%0, %%"REG_S"), %%xmm0	\n\t" 
 	"movaps 1024(%0, %%"REG_S"), %%xmm1\n\t" 
@@ -735,7 +736,7 @@
 	"movlps %1, %%xmm7		\n\t"
 	"shufps $0x00, %%xmm7, %%xmm7	\n\t"
 	"mov $-1024, %%"REG_S"		\n\t"
-	".balign 16\n\t"
+	ASMALIGN16
 	"1:				\n\t"
 	"movaps (%0, %%"REG_S"), %%xmm0	\n\t" 
 	"movaps 1024(%0, %%"REG_S"), %%xmm1\n\t" 
@@ -757,7 +758,7 @@
 	"movlps %1, %%xmm7		\n\t"
 	"shufps $0x00, %%xmm7, %%xmm7	\n\t"
 	"mov $-1024, %%"REG_S"		\n\t"
-	".balign 16\n\t"
+	ASMALIGN16
 	"1:				\n\t"
 	"movaps (%0, %%"REG_S"), %%xmm0	\n\t" 
 	"movaps 1024(%0, %%"REG_S"), %%xmm1\n\t" 
@@ -780,7 +781,7 @@
 	"movlps %1, %%xmm7		\n\t"
 	"shufps $0x00, %%xmm7, %%xmm7	\n\t"
 	"mov $-1024, %%"REG_S"		\n\t"
-	".balign 16\n\t"
+	ASMALIGN16
 	"1:				\n\t"
 	"movaps 1024(%0, %%"REG_S"), %%xmm0\n\t" 
 	"addps %%xmm7, %%xmm0		\n\t" //common
@@ -803,7 +804,7 @@
 		"movlps %2, %%xmm7		\n\t"
 		"shufps $0x00, %%xmm7, %%xmm7	\n\t"
 		"mov $-1024, %%"REG_S"		\n\t"
-		".balign 16\n\t"
+		ASMALIGN16
 		"1:				\n\t"
 		"movaps 1024(%1, %%"REG_S"), %%xmm0\n\t" 
 		"addps %%xmm7, %%xmm0		\n\t" //common
@@ -826,7 +827,7 @@
 		"movlps %1, %%xmm7		\n\t"
 		"shufps $0x00, %%xmm7, %%xmm7	\n\t"
 		"mov $-1024, %%"REG_S"		\n\t"
-		".balign 16\n\t"
+		ASMALIGN16
 		"1:				\n\t"
 		"movaps 2048(%0, %%"REG_S"), %%xmm0\n\t"  // surround
 		"movaps (%0, %%"REG_S"), %%xmm1	\n\t" 
@@ -850,7 +851,7 @@
 		"movlps %1, %%xmm7		\n\t"
 		"shufps $0x00, %%xmm7, %%xmm7	\n\t"
 		"mov $-1024, %%"REG_S"		\n\t"
-		".balign 16\n\t"
+		ASMALIGN16
 		"1:				\n\t"
 		"movaps 1024(%0, %%"REG_S"), %%xmm0\n\t"  
 		"addps 3072(%0, %%"REG_S"), %%xmm0\n\t"  
@@ -874,7 +875,7 @@
 		"movlps %1, %%xmm7		\n\t"
 		"shufps $0x00, %%xmm7, %%xmm7	\n\t"
 		"mov $-1024, %%"REG_S"		\n\t"
-		".balign 16\n\t"
+		ASMALIGN16
 		"1:				\n\t"
 		"movaps 1024(%0, %%"REG_S"), %%xmm0\n\t"  
 		"movaps 3072(%0, %%"REG_S"), %%xmm3\n\t" // surround
@@ -900,7 +901,7 @@
 		"movlps %1, %%xmm7		\n\t"
 		"shufps $0x00, %%xmm7, %%xmm7	\n\t"
 		"mov $-1024, %%"REG_S"		\n\t"
-		".balign 16\n\t"
+		ASMALIGN16
 		"1:				\n\t"
 		"movaps 2048(%0, %%"REG_S"), %%xmm0\n\t"  
 		"addps 3072(%0, %%"REG_S"), %%xmm0\n\t" // surround
@@ -925,7 +926,7 @@
 	"movlps %1, %%xmm7		\n\t"
 	"shufps $0x00, %%xmm7, %%xmm7	\n\t"
 	"mov $-1024, %%"REG_S"		\n\t"
-	".balign 16\n\t"
+	ASMALIGN16
 	"1:				\n\t"
 	"movaps 1024(%0, %%"REG_S"), %%xmm0\n\t" 
 	"addps %%xmm7, %%xmm0		\n\t" // common
@@ -949,7 +950,7 @@
 	"movlps %1, %%xmm7		\n\t"
 	"shufps $0x00, %%xmm7, %%xmm7	\n\t"
 	"mov $-1024, %%"REG_S"		\n\t"
-	".balign 16\n\t"
+	ASMALIGN16
 	"1:				\n\t"
 	"movaps 1024(%0, %%"REG_S"), %%xmm0\n\t" 
 	"movaps 3072(%0, %%"REG_S"), %%xmm2\n\t" 
@@ -976,7 +977,7 @@
 		"movlps %2, %%xmm7		\n\t"
 		"shufps $0x00, %%xmm7, %%xmm7	\n\t"
 		"mov $-1024, %%"REG_S"		\n\t"
-		".balign 16\n\t"
+		ASMALIGN16
 		"1:				\n\t"
 		"movaps (%0, %%"REG_S"), %%xmm0	\n\t"  
 		"movaps 16(%0, %%"REG_S"), %%xmm1\n\t"  
@@ -998,7 +999,7 @@
 	asm volatile(
 		"mov $-1024, %%"REG_S"		\n\t"
 		"pxor %%mm0, %%mm0		\n\t"
-		".balign 16\n\t"
+		ASMALIGN16
 		"1:				\n\t"
 		"movq %%mm0, (%0, %%"REG_S")	\n\t"
 		"movq %%mm0, 8(%0, %%"REG_S")	\n\t"
@@ -1258,7 +1259,7 @@
 	"movd  %2, %%mm7	\n\t"
 	"punpckldq %2, %%mm7	\n\t"
 	"mov $-1024, %%"REG_S"	\n\t"
-	".balign 16\n\t"
+	ASMALIGN16
 	"1:			\n\t"
 	"movq  (%0, %%"REG_S"), %%mm0	\n\t" 
 	"movq  8(%0, %%"REG_S"), %%mm1	\n\t"
@@ -1289,7 +1290,7 @@
 	"movd  %1, %%mm7	\n\t"
 	"punpckldq %1, %%mm7	\n\t"
 	"mov $-1024, %%"REG_S"	\n\t"
-	".balign 16\n\t"
+	ASMALIGN16
 	"1:			\n\t"
 	"movq  (%0, %%"REG_S"), %%mm0	\n\t" 
 	"movq  8(%0, %%"REG_S"), %%mm1	\n\t"
@@ -1316,7 +1317,7 @@
 	"movd  %1, %%mm7	\n\t"
 	"punpckldq %1, %%mm7	\n\t"
 	"mov $-1024, %%"REG_S"	\n\t"
-	".balign 16\n\t"
+	ASMALIGN16
 	"1:			\n\t"
 	"movq  (%0, %%"REG_S"), %%mm0	\n\t" 
 	"movq  8(%0, %%"REG_S"), %%mm1	\n\t"
@@ -1345,7 +1346,7 @@
 	"movd  %1, %%mm7	\n\t"
 	"punpckldq %1, %%mm7	\n\t"
 	"mov $-1024, %%"REG_S"	\n\t"
-	".balign 16\n\t"
+	ASMALIGN16
 	"1:			\n\t"
 	"movq  (%0, %%"REG_S"), %%mm0	\n\t" 
 	"movq  8(%0, %%"REG_S"), %%mm1	\n\t"
@@ -1376,7 +1377,7 @@
 	"movd  %1, %%mm7	\n\t"
 	"punpckldq %1, %%mm7	\n\t"
 	"mov $-1024, %%"REG_S"	\n\t"
-	".balign 16\n\t"
+	ASMALIGN16
 	"1:			\n\t"
 	"movq   1024(%0, %%"REG_S"), %%mm0\n\t" 
 	"movq   1032(%0, %%"REG_S"), %%mm1\n\t"
@@ -1407,7 +1408,7 @@
 		"movd  %2, %%mm7	\n\t"
 		"punpckldq %2, %%mm7	\n\t"
 		"mov $-1024, %%"REG_S"	\n\t"
-		".balign 16\n\t"
+		ASMALIGN16
 		"1:			\n\t"
 		"movq  1024(%1, %%"REG_S"), %%mm0\n\t" 
 		"movq  1032(%1, %%"REG_S"), %%mm1\n\t"
@@ -1438,7 +1439,7 @@
 		"movd  %1, %%mm7	\n\t"
 		"punpckldq %1, %%mm7	\n\t"
 		"mov $-1024, %%"REG_S"	\n\t"
-		".balign 16\n\t"
+		ASMALIGN16
 		"1:			\n\t"
 		"movq  2048(%0, %%"REG_S"), %%mm0\n\t"  // surround
 		"movq  2056(%0, %%"REG_S"), %%mm1\n\t"  // surround
@@ -1471,7 +1472,7 @@
 		"movd  %1, %%mm7	\n\t"
 		"punpckldq %1, %%mm7	\n\t"
 		"mov $-1024, %%"REG_S"	\n\t"
-		".balign 16\n\t"
+		ASMALIGN16
 		"1:			\n\t"
 		"movq  1024(%0, %%"REG_S"), %%mm0\n\t"  
 		"movq  1032(%0, %%"REG_S"), %%mm1\n\t"
@@ -1504,7 +1505,7 @@
 		"movd  %1, %%mm7	\n\t"
 		"punpckldq %1, %%mm7	\n\t"
 		"mov $-1024, %%"REG_S"	\n\t"
-		".balign 16\n\t"
+		ASMALIGN16
 		"1:			\n\t"
 		"movq   1024(%0, %%"REG_S"), %%mm0\n\t"  
 		"movq   1032(%0, %%"REG_S"), %%mm1\n\t"
@@ -1541,7 +1542,7 @@
 		"movd  %1, %%mm7	\n\t"
 		"punpckldq %1, %%mm7	\n\t"
 		"mov $-1024, %%"REG_S"	\n\t"
-		".balign 16\n\t"
+		ASMALIGN16
 		"1:			\n\t"
 		"movq  2048(%0, %%"REG_S"), %%mm0\n\t"  
 		"movq  2056(%0, %%"REG_S"), %%mm1\n\t"
@@ -1576,7 +1577,7 @@
 	"movd  %1, %%mm7	\n\t"
 	"punpckldq %1, %%mm7	\n\t"
 	"mov $-1024, %%"REG_S"	\n\t"
-	".balign 16\n\t"
+	ASMALIGN16
 	"1:			\n\t"
 	"movq   1024(%0, %%"REG_S"), %%mm0\n\t" 
 	"movq   1032(%0, %%"REG_S"), %%mm1\n\t"
@@ -1608,7 +1609,7 @@
 {
 	asm volatile(
 	"mov $-1024, %%"REG_S"		\n\t"
-	".balign 16\n\t"
+	ASMALIGN16
 	"1:			\n\t"
 	"movd  %1, %%mm7		\n\t"
 	"punpckldq %1, %%mm7		\n\t"
@@ -1649,7 +1650,7 @@
 		"movd  %2, %%mm7	\n\t"
 		"punpckldq %2, %%mm7	\n\t"
 		"mov $-1024, %%"REG_S"	\n\t"
-		".balign 16\n\t"
+		ASMALIGN16
 		"1:			\n\t"
 		"movq  (%0, %%"REG_S"), %%mm0	\n\t"  
 		"movq  8(%0, %%"REG_S"), %%mm1	\n\t"
--- a/liba52/imdct.c	Sat Apr 15 16:47:25 2006 +0000
+++ b/liba52/imdct.c	Sat Apr 15 20:46:54 2006 +0000
@@ -31,6 +31,7 @@
  */
 
 #include "config.h"
+#include "asmalign.h"
 
 #include <math.h>
 #include <stdio.h>
@@ -792,7 +793,7 @@
 		"lea "MANGLE(bit_reverse_512)", %%"REG_a"\n\t"
 		"mov $1008, %%"REG_D"			\n\t"
 		"push %%"REG_BP"			\n\t" //use ebp without telling gcc
-		".balign 16				\n\t"
+		ASMALIGN16
 		"1:					\n\t"
 		"movlps (%0, %%"REG_S"), %%xmm0	\n\t" // XXXI
 		"movhps 8(%0, %%"REG_D"), %%xmm0	\n\t" // RXXI
@@ -851,7 +852,7 @@
 		"xorps %%xmm1, %%xmm1	\n\t"
 		"xorps %%xmm2, %%xmm2	\n\t"
 		"mov %0, %%"REG_S"	\n\t"
-		".balign 16				\n\t"
+		ASMALIGN16
 		"1:			\n\t"
 		"movlps (%%"REG_S"), %%xmm0\n\t" //buf[p]
 		"movlps 8(%%"REG_S"), %%xmm1\n\t" //buf[q]
@@ -872,7 +873,7 @@
 	asm volatile(
 		"movaps "MANGLE(ps111_1)", %%xmm7\n\t" // 1,1,1,-1
 		"mov %0, %%"REG_S"		\n\t"
-		".balign 16				\n\t"
+		ASMALIGN16
 		"1:				\n\t"
 		"movaps 16(%%"REG_S"), %%xmm2	\n\t" //r2,i2,r3,i3
 		"shufps $0xB4, %%xmm2, %%xmm2	\n\t" //r2,i2,i3,r3
@@ -903,7 +904,7 @@
 		"xorps %%xmm5, %%xmm5		\n\t"
 		"xorps %%xmm2, %%xmm2		\n\t"
 		"mov %0, %%"REG_S"		\n\t"
-		".balign 16			\n\t"
+		ASMALIGN16
 		"1:				\n\t"
 		"movaps 32(%%"REG_S"), %%xmm2	\n\t" //r4,i4,r5,i5
 		"movaps 48(%%"REG_S"), %%xmm3	\n\t" //r6,i6,r7,i7
@@ -944,7 +945,7 @@
 	buf_offset = buf+128;
 	asm volatile(
 		"mov %0, %%"REG_S"			\n\t"
-		".balign 16				\n\t"
+		ASMALIGN16
 		"1:					\n\t"
 		"xor %%"REG_D", %%"REG_D"		\n\t" // k
 		"lea (%%"REG_S", %3), %%"REG_d"		\n\t"
@@ -976,7 +977,7 @@
     /* Post IFFT complex multiply  plus IFFT complex conjugate*/
 	asm volatile(
 		"mov $-1024, %%"REG_S"			\n\t"
-		".balign 16				\n\t"
+		ASMALIGN16
 		"1:					\n\t"
 		"movaps (%0, %%"REG_S"), %%xmm0		\n\t"
 		"movaps (%0, %%"REG_S"), %%xmm1		\n\t"
@@ -1002,7 +1003,7 @@
 		"xor %%"REG_S", %%"REG_S"		\n\t"  // 0
 		"movss %3, %%xmm2			\n\t"  // bias
 		"shufps $0x00, %%xmm2, %%xmm2		\n\t"  // bias, bias, ...
-		".balign 16				\n\t"
+		ASMALIGN16
 		"1:					\n\t"
 		"movlps (%0, %%"REG_S"), %%xmm0		\n\t" // ? ? A ?
 		"movlps 8(%0, %%"REG_S"), %%xmm1	\n\t" // ? ? C ?
@@ -1029,7 +1030,7 @@
 		"xor %%"REG_S", %%"REG_S"		\n\t"  // 0
 		"movss %3, %%xmm2			\n\t"  // bias
 		"shufps $0x00, %%xmm2, %%xmm2		\n\t"  // bias, bias, ...
-		".balign 16				\n\t"
+		ASMALIGN16
 		"1:					\n\t"
 		"movlps (%0, %%"REG_S"), %%xmm0		\n\t" // ? ? ? A
 		"movlps 8(%0, %%"REG_S"), %%xmm1	\n\t" // ? ? ? C
@@ -1056,7 +1057,7 @@
 	asm volatile(
 		"xor %%"REG_D", %%"REG_D"		\n\t"  // 0
 		"xor %%"REG_S", %%"REG_S"		\n\t"  // 0
-		".balign 16				\n\t"
+		ASMALIGN16
 		"1:					\n\t"
 		"movlps (%0, %%"REG_S"), %%xmm0		\n\t" // ? ? ? A
 		"movlps 8(%0, %%"REG_S"), %%xmm1	\n\t" // ? ? ? C
@@ -1078,7 +1079,7 @@
 	asm volatile(
 		"mov $1024, %%"REG_D"			\n\t"  // 1024
 		"xor %%"REG_S", %%"REG_S"		\n\t"  // 0
-		".balign 16				\n\t"
+		ASMALIGN16
 		"1:					\n\t"
 		"movlps (%0, %%"REG_S"), %%xmm0	\n\t" // ? ? A ?
 		"movlps 8(%0, %%"REG_S"), %%xmm1	\n\t" // ? ? C ?
--- a/libmpcodecs/pullup.c	Sat Apr 15 16:47:25 2006 +0000
+++ b/libmpcodecs/pullup.c	Sat Apr 15 20:46:54 2006 +0000
@@ -5,6 +5,7 @@
 #include <string.h>
 #include "pullup.h"
 #include "config.h"
+#include "asmalign.h"
 
 
 
@@ -18,7 +19,7 @@
 		"pxor %%mm4, %%mm4 \n\t"
 		"pxor %%mm7, %%mm7 \n\t"
 		
-		".balign 16 \n\t"
+		ASMALIGN16
 		"1: \n\t"
 		
 		"movq (%%esi), %%mm0 \n\t"
@@ -67,7 +68,7 @@
 		"pxor %%mm7, %%mm7 \n\t"
 		"subl %%eax, %%edi \n\t"
 		
-		".balign 16 \n\t"
+		ASMALIGN16
 		"2: \n\t"
 
 		"movq (%%esi), %%mm0 \n\t"
@@ -156,7 +157,7 @@
 		"pxor %%mm4, %%mm4 \n\t"
 		"pxor %%mm7, %%mm7 \n\t"
 		
-		".balign 16 \n\t"
+		ASMALIGN16
 		"1: \n\t"
 		
 		"movq (%%esi), %%mm0 \n\t"
--- a/libmpcodecs/vf_decimate.c	Sat Apr 15 16:47:25 2006 +0000
+++ b/libmpcodecs/vf_decimate.c	Sat Apr 15 20:46:54 2006 +0000
@@ -5,6 +5,7 @@
 #include "config.h"
 #include "mp_msg.h"
 #include "cpudetect.h"
+#include "asmalign.h"
 
 #include "img_format.h"
 #include "mp_image.h"
@@ -28,7 +29,7 @@
 		"pxor %%mm4, %%mm4 \n\t"
 		"pxor %%mm7, %%mm7 \n\t"
 		
-		".balign 16 \n\t"
+		ASMALIGN16
 		"1: \n\t"
 		
 		"movq (%%"REG_S"), %%mm0 \n\t"
--- a/libmpcodecs/vf_divtc.c	Sat Apr 15 16:47:25 2006 +0000
+++ b/libmpcodecs/vf_divtc.c	Sat Apr 15 20:46:54 2006 +0000
@@ -8,6 +8,7 @@
 #include "mp_msg.h"
 #include "cpudetect.h"
 #include "bswap.h"
+#include "asmalign.h"
 
 #include "img_format.h"
 #include "mp_image.h"
@@ -41,7 +42,7 @@
 	"pxor %%mm4, %%mm4 \n\t"
 	"pxor %%mm7, %%mm7 \n\t"
 
-	".balign 16 \n\t"
+	ASMALIGN16
 	"1: \n\t"
 
 	"movq (%%"REG_S"), %%mm0 \n\t"
--- a/libmpcodecs/vf_eq.c	Sat Apr 15 16:47:25 2006 +0000
+++ b/libmpcodecs/vf_eq.c	Sat Apr 15 20:46:54 2006 +0000
@@ -6,6 +6,7 @@
 #include "config.h"
 #include "mp_msg.h"
 #include "cpudetect.h"
+#include "asmalign.h"
 
 #include "img_format.h"
 #include "mp_image.h"
@@ -51,7 +52,7 @@
 			"movq (%6), %%mm4 \n\t"
 			"pxor %%mm0, %%mm0 \n\t"
 			"movl %4, %%eax\n\t"
-                       ".balign 16 \n\t"
+                       ASMALIGN16
 			"1: \n\t"
 			"movq (%0), %%mm1 \n\t"
 			"movq (%0), %%mm2 \n\t"
--- a/libmpcodecs/vf_eq2.c	Sat Apr 15 16:47:25 2006 +0000
+++ b/libmpcodecs/vf_eq2.c	Sat Apr 15 20:46:54 2006 +0000
@@ -18,6 +18,7 @@
 #include "config.h"
 #include "mp_msg.h"
 #include "cpudetect.h"
+#include "asmalign.h"
 
 #include "img_format.h"
 #include "mp_image.h"
@@ -135,7 +136,7 @@
       "movq (%6), %%mm4 \n\t"
       "pxor %%mm0, %%mm0 \n\t"
       "movl %4, %%eax\n\t"
-      ".balign 16 \n\t"
+      ASMALIGN16
       "1: \n\t"
       "movq (%0), %%mm1 \n\t"
       "movq (%0), %%mm2 \n\t"
--- a/libmpcodecs/vf_fspp.c	Sat Apr 15 16:47:25 2006 +0000
+++ b/libmpcodecs/vf_fspp.c	Sat Apr 15 20:46:54 2006 +0000
@@ -37,6 +37,7 @@
 #include <math.h>
 
 #include "config.h"
+#include "asmalign.h"
 
 #include "mp_msg.h"
 #include "cpudetect.h"
@@ -888,7 +889,7 @@
 static void column_fidct_mmx(int16_t* thr_adr,  DCTELEM *data,  DCTELEM *output,  int cnt)
 {
     asm volatile(
-	".align 16                   \n\t"
+	ASMALIGN16
 	"1:                   \n\t"
 	"movq "DCTSIZE_S"*0*2(%%"REG_S"), %%mm1 \n\t"
 	//
--- a/libmpcodecs/vf_halfpack.c	Sat Apr 15 16:47:25 2006 +0000
+++ b/libmpcodecs/vf_halfpack.c	Sat Apr 15 20:46:54 2006 +0000
@@ -6,6 +6,7 @@
 #include "config.h"
 #include "mp_msg.h"
 #include "cpudetect.h"
+#include "asmalign.h"
 
 #include "img_format.h"
 #include "mp_image.h"
@@ -40,7 +41,7 @@
 	for (h/=2; h; h--) {
 		asm (
 			"pxor %%mm0, %%mm0 \n\t"
-			".balign 16 \n\t"
+			ASMALIGN16
 			"1: \n\t"
 			"movq (%0), %%mm1 \n\t"
 			"movq (%0), %%mm2 \n\t"
--- a/libmpcodecs/vf_ilpack.c	Sat Apr 15 16:47:25 2006 +0000
+++ b/libmpcodecs/vf_ilpack.c	Sat Apr 15 20:46:54 2006 +0000
@@ -6,6 +6,7 @@
 #include "config.h"
 #include "mp_msg.h"
 #include "cpudetect.h"
+#include "asmalign.h"
 
 #include "img_format.h"
 #include "mp_image.h"
@@ -66,7 +67,7 @@
 {
 	int j;
 	asm volatile (""
-		".balign 16 \n\t"
+		ASMALIGN16                
 		"1: \n\t"
 		"movq (%0), %%mm1 \n\t"
 		"movq (%0), %%mm2 \n\t"
@@ -105,7 +106,7 @@
 #endif
 		"pxor %%mm0, %%mm0 \n\t"
 		
-		".balign 16 \n\t"
+		ASMALIGN16 
 		".Lli0: \n\t"
 		"movq (%%"REG_S"), %%mm1 \n\t"
 		"movq (%%"REG_S"), %%mm2 \n\t"
@@ -213,7 +214,7 @@
 #endif
 		"pxor %%mm0, %%mm0 \n\t"
 		
-		".balign 16 \n\t"
+		ASMALIGN16  
 		".Lli1: \n\t"
 		"movq (%%"REG_S"), %%mm1 \n\t"
 		"movq (%%"REG_S"), %%mm2 \n\t"
--- a/libmpcodecs/vf_ivtc.c	Sat Apr 15 16:47:25 2006 +0000
+++ b/libmpcodecs/vf_ivtc.c	Sat Apr 15 20:46:54 2006 +0000
@@ -5,6 +5,7 @@
 #include "config.h"
 #include "mp_msg.h"
 #include "cpudetect.h"
+#include "asmalign.h"
 
 #include "img_format.h"
 #include "mp_image.h"
@@ -67,7 +68,7 @@
 		"pxor %%mm5, %%mm5 \n\t" // 4 odd difference sums
 		"pxor %%mm7, %%mm7 \n\t" // all zeros
 		
-		".balign 16 \n\t"
+		ASMALIGN16  
 		"1: \n\t"
 		
 		// Even difference
@@ -127,7 +128,7 @@
 		"pxor %%mm5, %%mm5 \n\t" // Temporal noise
 		"pxor %%mm6, %%mm6 \n\t" // Current spacial noise
 		
-		".balign 16 \n\t"
+		ASMALIGN16  
 		"2: \n\t"
 		
 		"movq (%%"REG_S"), %%mm0 \n\t"
@@ -181,7 +182,7 @@
 		"pxor %%mm5, %%mm5 \n\t"
 		"pxor %%mm6, %%mm6 \n\t"
 		
-		".balign 16 \n\t"
+		ASMALIGN16
 		"3: \n\t"
 		
 		"movq (%%"REG_S"), %%mm0 \n\t"
--- a/libmpcodecs/vf_noise.c	Sat Apr 15 16:47:25 2006 +0000
+++ b/libmpcodecs/vf_noise.c	Sat Apr 15 20:46:54 2006 +0000
@@ -25,6 +25,7 @@
 #include "config.h"
 #include "mp_msg.h"
 #include "cpudetect.h"
+#include "asmalign.h"
 
 #ifdef HAVE_MALLOC_H
 #include <malloc.h>
@@ -153,7 +154,7 @@
 		"pcmpeqb %%mm7, %%mm7		\n\t"
 		"psllw $15, %%mm7		\n\t"
 		"packsswb %%mm7, %%mm7		\n\t"
-		".balign 16			\n\t"
+		ASMALIGN16   
 		"1:				\n\t"
 		"movq (%0, %%"REG_a"), %%mm0	\n\t"
 		"movq (%1, %%"REG_a"), %%mm1	\n\t"
@@ -182,7 +183,7 @@
 		"pcmpeqb %%mm7, %%mm7		\n\t"
 		"psllw $15, %%mm7		\n\t"
 		"packsswb %%mm7, %%mm7		\n\t"
-		".balign 16			\n\t"
+		ASMALIGN16  
 		"1:				\n\t"
 		"movq (%0, %%"REG_a"), %%mm0	\n\t"
 		"movq (%1, %%"REG_a"), %%mm1	\n\t"
@@ -220,7 +221,7 @@
 
 	asm volatile(
 		"mov %5, %%"REG_a"		\n\t"
-		".balign 16			\n\t"
+		ASMALIGN16   
 		"1:				\n\t"
 		"movq (%1, %%"REG_a"), %%mm1	\n\t"
 		"movq (%0, %%"REG_a"), %%mm0	\n\t"
--- a/mangle.h	Sat Apr 15 16:47:25 2006 +0000
+++ b/mangle.h	Sat Apr 15 20:46:54 2006 +0000
@@ -9,7 +9,7 @@
 
 /* Feel free to add more to the list, eg. a.out IMO */
 #if defined(__CYGWIN__) || defined(__MINGW32__) || defined(__OS2__) || \
-   (defined(__OpenBSD__) && !defined(__ELF__))
+   (defined(__OpenBSD__) && !defined(__ELF__)) || defined(__APPLE__)
 #define MANGLE(a) "_" #a
 #else
 #define MANGLE(a) #a
--- a/postproc/rgb2rgb_template.c	Sat Apr 15 16:47:25 2006 +0000
+++ b/postproc/rgb2rgb_template.c	Sat Apr 15 20:46:54 2006 +0000
@@ -12,6 +12,8 @@
 #include <stddef.h>
 #include <inttypes.h> /* for __WORDSIZE */
 
+#include "asmalign.h"
+
 #ifndef __WORDSIZE
 // #warning You have misconfigured system and probably will lose performance!
 #define __WORDSIZE MP_WORDSIZE
@@ -40,9 +42,14 @@
 #define PREFETCHW "prefetcht0"
 #define PAVGB	  "pavgb"
 #else
+#ifdef __APPLE__
+#define PREFETCH "#"
+#define PREFETCHW "#"
+#elif
 #define PREFETCH "/nop"
 #define PREFETCHW "/nop"
 #endif
+#endif
 
 #ifdef HAVE_3DNOW
 /* On K6 femms is faster of emms. On K7 femms is directly mapped on emms. */
@@ -56,8 +63,12 @@
 #define SFENCE "sfence"
 #else
 #define MOVNTQ "movq"
+#ifdef __APPLE__
+#define SFENCE "#"
+#elif
 #define SFENCE "/nop"
 #endif
+#endif
 
 static inline void RENAME(rgb24to32)(const uint8_t *src,uint8_t *dst,long src_size)
 {
@@ -332,7 +343,7 @@
 		"movq %3, %%mm5			\n\t"
 		"movq %4, %%mm6			\n\t"
 		"movq %5, %%mm7			\n\t"
-		".balign 16			\n\t"
+		ASMALIGN16
 		"1:				\n\t"
 		PREFETCH" 32(%1)		\n\t"
 		"movd	(%1), %%mm0		\n\t"
@@ -489,7 +500,7 @@
 		"movq %3, %%mm5			\n\t"
 		"movq %4, %%mm6			\n\t"
 		"movq %5, %%mm7			\n\t"
-		".balign 16			\n\t"
+		ASMALIGN16
 		"1:				\n\t"
 		PREFETCH" 32(%1)		\n\t"
 		"movd	(%1), %%mm0		\n\t"
@@ -1344,7 +1355,7 @@
 /* TODO: unroll this loop */
 	asm volatile (
 		"xor %%"REG_a", %%"REG_a"	\n\t"
-		".balign 16			\n\t"
+		ASMALIGN16
 		"1:				\n\t"
 		PREFETCH" 32(%0, %%"REG_a")	\n\t"
 		"movq (%0, %%"REG_a"), %%mm0	\n\t"
@@ -1394,7 +1405,7 @@
 		"movq "MANGLE(mask24r)", %%mm5	\n\t"
 		"movq "MANGLE(mask24g)", %%mm6	\n\t"
 		"movq "MANGLE(mask24b)", %%mm7	\n\t"
-		".balign 16			\n\t"
+		ASMALIGN16
 		"1:				\n\t"
 		PREFETCH" 32(%1, %%"REG_a")	\n\t"
 		"movq   (%1, %%"REG_a"), %%mm0	\n\t" // BGR BGR BG
@@ -1464,7 +1475,7 @@
 //FIXME handle 2 lines a once (fewer prefetch, reuse some chrom, but very likely limited by mem anyway)
 		asm volatile(
 			"xor %%"REG_a", %%"REG_a"	\n\t"
-			".balign 16			\n\t"
+			ASMALIGN16
 			"1:				\n\t"
 			PREFETCH" 32(%1, %%"REG_a", 2)	\n\t"
 			PREFETCH" 32(%2, %%"REG_a")	\n\t"
@@ -1617,7 +1628,7 @@
 //FIXME handle 2 lines a once (fewer prefetch, reuse some chrom, but very likely limited by mem anyway)
 		asm volatile(
 			"xor %%"REG_a", %%"REG_a"	\n\t"
-			".balign 16			\n\t"
+			ASMALIGN16
 			"1:				\n\t"
 			PREFETCH" 32(%1, %%"REG_a", 2)	\n\t"
 			PREFETCH" 32(%2, %%"REG_a")	\n\t"
@@ -1741,7 +1752,7 @@
 			"xor %%"REG_a", %%"REG_a"	\n\t"
 			"pcmpeqw %%mm7, %%mm7		\n\t"
 			"psrlw $8, %%mm7		\n\t" // FF,00,FF,00...
-			".balign 16			\n\t"
+			ASMALIGN16
 			"1:				\n\t"
 			PREFETCH" 64(%0, %%"REG_a", 4)	\n\t"
 			"movq (%0, %%"REG_a", 4), %%mm0	\n\t" // YUYV YUYV(0)
@@ -1794,7 +1805,7 @@
 
 		asm volatile(
 			"xor %%"REG_a", %%"REG_a"	\n\t"
-			".balign 16			\n\t"
+			ASMALIGN16
 			"1:				\n\t"
 			PREFETCH" 64(%0, %%"REG_a", 4)	\n\t"
 			"movq (%0, %%"REG_a", 4), %%mm0	\n\t" // YUYV YUYV(0)
@@ -1979,7 +1990,7 @@
 			"xorl %%eax, %%eax		\n\t"
 			"pcmpeqw %%mm7, %%mm7		\n\t"
 			"psrlw $8, %%mm7		\n\t" // FF,00,FF,00...
-			".balign 16			\n\t"
+			ASMALIGN16
 			"1:				\n\t"
 			PREFETCH" 64(%0, %%eax, 4)	\n\t"
 			"movq (%0, %%eax, 4), %%mm0	\n\t" // UYVY UYVY(0)
@@ -2032,7 +2043,7 @@
 
 		asm volatile(
 			"xorl %%eax, %%eax		\n\t"
-			".balign 16			\n\t"
+			ASMALIGN16
 			"1:				\n\t"
 			PREFETCH" 64(%0, %%eax, 4)	\n\t"
 			"movq (%0, %%eax, 4), %%mm0	\n\t" // YUYV YUYV(0)
@@ -2110,7 +2121,7 @@
 				"movq "MANGLE(w1111)", %%mm5		\n\t"
 				"pxor %%mm7, %%mm7		\n\t"
 				"lea (%%"REG_a", %%"REG_a", 2), %%"REG_b"\n\t"
-				".balign 16			\n\t"
+				ASMALIGN16
 				"1:				\n\t"
 				PREFETCH" 64(%0, %%"REG_b")	\n\t"
 				"movd (%0, %%"REG_b"), %%mm0	\n\t"
@@ -2184,7 +2195,7 @@
 			"pxor %%mm7, %%mm7		\n\t"
 			"lea (%%"REG_a", %%"REG_a", 2), %%"REG_b"\n\t"
 			"add %%"REG_b", %%"REG_b"	\n\t"
-			".balign 16			\n\t"
+			ASMALIGN16
 			"1:				\n\t"
 			PREFETCH" 64(%0, %%"REG_b")	\n\t"
 			PREFETCH" 64(%1, %%"REG_b")	\n\t"
--- a/postproc/swscale_template.c	Sat Apr 15 16:47:25 2006 +0000
+++ b/postproc/swscale_template.c	Sat Apr 15 20:46:54 2006 +0000
@@ -16,6 +16,8 @@
     Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 */
 
+#include "asmalign.h"
+
 #undef REAL_MOVNTQ
 #undef MOVNTQ
 #undef PAVGB
@@ -71,7 +73,7 @@
 			"movq %%mm3, %%mm4		\n\t"\
 			"lea " offset "(%0), %%"REG_d"	\n\t"\
 			"mov (%%"REG_d"), %%"REG_S"	\n\t"\
-			".balign 16			\n\t" /* FIXME Unroll? */\
+			ASMALIGN16 /* FIXME Unroll? */\
 			"1:				\n\t"\
 			"movq 8(%%"REG_d"), %%mm0	\n\t" /* filterCoeff */\
 			"movq " #x "(%%"REG_S", %%"REG_a", 2), %%mm2\n\t" /* srcData */\
@@ -98,7 +100,7 @@
 
 #define YSCALEYUV2YV121 \
 			"mov %2, %%"REG_a"		\n\t"\
-			".balign 16			\n\t" /* FIXME Unroll? */\
+			ASMALIGN16 /* FIXME Unroll? */\
 			"1:				\n\t"\
 			"movq (%0, %%"REG_a", 2), %%mm0	\n\t"\
 			"movq 8(%0, %%"REG_a", 2), %%mm1\n\t"\
@@ -118,14 +120,14 @@
 */
 #define YSCALEYUV2PACKEDX \
 		"xor %%"REG_a", %%"REG_a"	\n\t"\
-		".balign 16			\n\t"\
+		ASMALIGN16\
 		"nop				\n\t"\
 		"1:				\n\t"\
 		"lea "CHR_MMX_FILTER_OFFSET"(%0), %%"REG_d"\n\t"\
 		"mov (%%"REG_d"), %%"REG_S"	\n\t"\
 		"movq "VROUNDER_OFFSET"(%0), %%mm3\n\t"\
 		"movq %%mm3, %%mm4		\n\t"\
-		".balign 16			\n\t"\
+		ASMALIGN16\
 		"2:				\n\t"\
 		"movq 8(%%"REG_d"), %%mm0	\n\t" /* filterCoeff */\
 		"movq (%%"REG_S", %%"REG_a"), %%mm2	\n\t" /* UsrcData */\
@@ -143,7 +145,7 @@
 		"mov (%%"REG_d"), %%"REG_S"	\n\t"\
 		"movq "VROUNDER_OFFSET"(%0), %%mm1\n\t"\
 		"movq %%mm1, %%mm7		\n\t"\
-		".balign 16			\n\t"\
+		ASMALIGN16\
 		"2:				\n\t"\
 		"movq 8(%%"REG_d"), %%mm0	\n\t" /* filterCoeff */\
 		"movq (%%"REG_S", %%"REG_a", 2), %%mm2	\n\t" /* Y1srcData */\
@@ -205,7 +207,7 @@
 		"punpcklwd %%mm5, %%mm5		\n\t"\
 		"punpcklwd %%mm5, %%mm5		\n\t"\
 		"xor %%"REG_a", %%"REG_a"		\n\t"\
-		".balign 16			\n\t"\
+		ASMALIGN16\
 		"1:				\n\t"\
 		"movq (%0, %%"REG_a", 2), %%mm0	\n\t" /*buf0[eax]*/\
 		"movq (%1, %%"REG_a", 2), %%mm1	\n\t" /*buf1[eax]*/\
@@ -258,7 +260,7 @@
 		"movq %%mm0, "CHR_MMX_FILTER_OFFSET"+8("#c")\n\t"\
 		"movq %%mm1, "LUM_MMX_FILTER_OFFSET"+8("#c")\n\t"\
 		"xor "#index", "#index"		\n\t"\
-		".balign 16			\n\t"\
+		ASMALIGN16\
 		"1:				\n\t"\
 		"movq (%2, "#index"), %%mm2	\n\t" /* uvbuf0[eax]*/\
 		"movq (%3, "#index"), %%mm3	\n\t" /* uvbuf1[eax]*/\
@@ -290,7 +292,7 @@
                 
 #define REAL_YSCALEYUV2RGB(index, c) \
 		"xor "#index", "#index"	\n\t"\
-		".balign 16			\n\t"\
+		ASMALIGN16\
 		"1:				\n\t"\
 		"movq (%2, "#index"), %%mm2	\n\t" /* uvbuf0[eax]*/\
 		"movq (%3, "#index"), %%mm3	\n\t" /* uvbuf1[eax]*/\
@@ -356,7 +358,7 @@
                 
 #define REAL_YSCALEYUV2PACKED1(index, c) \
 		"xor "#index", "#index"		\n\t"\
-		".balign 16			\n\t"\
+		ASMALIGN16\
 		"1:				\n\t"\
 		"movq (%2, "#index"), %%mm3	\n\t" /* uvbuf0[eax]*/\
 		"movq 4096(%2, "#index"), %%mm4	\n\t" /* uvbuf0[eax+2048]*/\
@@ -371,7 +373,7 @@
                 
 #define REAL_YSCALEYUV2RGB1(index, c) \
 		"xor "#index", "#index"	\n\t"\
-		".balign 16			\n\t"\
+		ASMALIGN16\
 		"1:				\n\t"\
 		"movq (%2, "#index"), %%mm3	\n\t" /* uvbuf0[eax]*/\
 		"movq 4096(%2, "#index"), %%mm4	\n\t" /* uvbuf0[eax+2048]*/\
@@ -420,7 +422,7 @@
 
 #define REAL_YSCALEYUV2PACKED1b(index, c) \
 		"xor "#index", "#index"		\n\t"\
-		".balign 16			\n\t"\
+		ASMALIGN16\
 		"1:				\n\t"\
 		"movq (%2, "#index"), %%mm2	\n\t" /* uvbuf0[eax]*/\
 		"movq (%3, "#index"), %%mm3	\n\t" /* uvbuf1[eax]*/\
@@ -439,7 +441,7 @@
 // do vertical chrominance interpolation
 #define REAL_YSCALEYUV2RGB1b(index, c) \
 		"xor "#index", "#index"		\n\t"\
-		".balign 16			\n\t"\
+		ASMALIGN16\
 		"1:				\n\t"\
 		"movq (%2, "#index"), %%mm2	\n\t" /* uvbuf0[eax]*/\
 		"movq (%3, "#index"), %%mm3	\n\t" /* uvbuf1[eax]*/\
@@ -1662,7 +1664,7 @@
 		"movq "MANGLE(w1111)", %%mm5		\n\t"
 		"pxor %%mm7, %%mm7		\n\t"
 		"lea (%%"REG_a", %%"REG_a", 2), %%"REG_b"\n\t"
-		".balign 16			\n\t"
+		ASMALIGN16
 		"1:				\n\t"
 		PREFETCH" 64(%0, %%"REG_b")	\n\t"
 		"movd (%0, %%"REG_b"), %%mm0	\n\t"
@@ -1748,7 +1750,7 @@
 		"pxor %%mm7, %%mm7		\n\t"
 		"lea (%%"REG_a", %%"REG_a", 2), %%"REG_b"	\n\t"
 		"add %%"REG_b", %%"REG_b"	\n\t"
-		".balign 16			\n\t"
+		ASMALIGN16
 		"1:				\n\t"
 		PREFETCH" 64(%0, %%"REG_b")	\n\t"
 		PREFETCH" 64(%1, %%"REG_b")	\n\t"
@@ -2055,7 +2057,7 @@
 			"movq "MANGLE(w02)", %%mm6	\n\t"
 			"push %%"REG_BP"		\n\t" // we use 7 regs here ...
 			"mov %%"REG_a", %%"REG_BP"	\n\t"
-			".balign 16			\n\t"
+			ASMALIGN16
 			"1:				\n\t"
 			"movzwl (%2, %%"REG_BP"), %%eax	\n\t"
 			"movzwl 2(%2, %%"REG_BP"), %%ebx\n\t"
@@ -2093,7 +2095,7 @@
 			"movq "MANGLE(w02)", %%mm6	\n\t"
 			"push %%"REG_BP"		\n\t" // we use 7 regs here ...
 			"mov %%"REG_a", %%"REG_BP"	\n\t"
-			".balign 16			\n\t"
+			ASMALIGN16
 			"1:				\n\t"
 			"movzwl (%2, %%"REG_BP"), %%eax	\n\t"
 			"movzwl 2(%2, %%"REG_BP"), %%ebx\n\t"
@@ -2142,7 +2144,7 @@
 		asm volatile(
 			"pxor %%mm7, %%mm7		\n\t"
 			"movq "MANGLE(w02)", %%mm6	\n\t"
-			".balign 16			\n\t"
+			ASMALIGN16
 			"1:				\n\t"
 			"mov %2, %%"REG_c"		\n\t"
 			"movzwl (%%"REG_c", %0), %%eax	\n\t"
@@ -2326,7 +2328,7 @@
 		"xor %%"REG_a", %%"REG_a"	\n\t" // i
 		"xor %%"REG_b", %%"REG_b"	\n\t" // xx
 		"xorl %%ecx, %%ecx		\n\t" // 2*xalpha
-		".balign 16			\n\t"
+		ASMALIGN16
 		"1:				\n\t"
 		"movzbl  (%0, %%"REG_b"), %%edi	\n\t" //src[xx]
 		"movzbl 1(%0, %%"REG_b"), %%esi	\n\t" //src[xx+1]
@@ -2523,7 +2525,7 @@
 		"xor %%"REG_a", %%"REG_a"	\n\t" // i
 		"xor %%"REG_b", %%"REG_b"		\n\t" // xx
 		"xorl %%ecx, %%ecx		\n\t" // 2*xalpha
-		".balign 16			\n\t"
+		ASMALIGN16
 		"1:				\n\t"
 		"mov %0, %%"REG_S"		\n\t"
 		"movzbl  (%%"REG_S", %%"REG_b"), %%edi	\n\t" //src[xx]