Index: include/sse.h
===================================================================
--- include/sse.h	(revision 1172)
+++ include/sse.h	(working copy)
@@ -23,9 +23,9 @@
 #ifndef LIBMPEG2_SSE_H
 #define LIBMPEG2_SSE_H
 
-typedef	union {
+DECLARE_ALIGNED(16, typedef union {
 	float			sf[4];	/* Single-precision (32-bit) value */
-} ATTR_ALIGN(16) sse_t;	/* On a 16 byte (128-bit) boundary */
+}, sse_t);	/* On a 16 byte (128-bit) boundary */
 
 
 #define	sse_i2r(op, imm, reg) \
Index: include/mmx.h
===================================================================
--- include/mmx.h	(revision 1172)
+++ include/mmx.h	(working copy)
@@ -30,7 +30,7 @@
  * values by ULL, lest they be truncated by the compiler)
  */
 
-typedef	union {
+DECLARE_ALIGNED(8, typedef union {
 	long long		q;	/* Quadword (64-bit) value */
 	unsigned long long	uq;	/* Unsigned Quadword */
 	int			d[2];	/* 2 Doubleword (32-bit) values */
@@ -40,7 +40,7 @@
 	char			b[8];	/* 8 Byte (8-bit) values */
 	unsigned char		ub[8];	/* 8 Unsigned Byte */
 	float			s[2];	/* Single-precision (32-bit) value */
-} ATTR_ALIGN(8) mmx_t;	/* On an 8-byte (64-bit) boundary */
+}, mmx_t);	/* On an 8-byte (64-bit) boundary */
 
 
 #define	mmx_i2r(op,imm,reg) \
@@ -263,7 +263,7 @@
 
 /* SSE2 */
 
-typedef	union {
+DECLARE_ALIGNED(16, typedef union {
 	long long		q[2];	/* Quadword (64-bit) value */
 	unsigned long long	uq[2];	/* Unsigned Quadword */
 	int			d[4];	/* 2 Doubleword (32-bit) values */
@@ -273,7 +273,7 @@
 	char			b[16];	/* 8 Byte (8-bit) values */
 	unsigned char		ub[16];	/* 8 Unsigned Byte */
 	float			s[4];	/* Single-precision (32-bit) value */
-} ATTR_ALIGN(16) sse_t;	/* On an 16-byte (128-bit) boundary */
+}, sse_t);	/* On an 16-byte (128-bit) boundary */
 
 #define	movdqu_m2r(var,reg)	mmx_m2r (movdqu, var, reg)
 #define	movdqu_r2m(reg,var)	mmx_r2m (movdqu, reg, var)
Index: include/attributes.h
===================================================================
--- include/attributes.h	(revision 1172)
+++ include/attributes.h	(working copy)
@@ -24,11 +24,13 @@
 #ifndef LIBMPEG2_ATTRIBUTES_H
 #define LIBMPEG2_ATTRIBUTES_H
 
-/* use gcc attribs to align critical data structures */
-#ifdef ATTRIBUTE_ALIGNED_MAX
-#define ATTR_ALIGN(align) __attribute__ ((__aligned__ ((ATTRIBUTE_ALIGNED_MAX < align) ? ATTRIBUTE_ALIGNED_MAX : align)))
+/* use GCC and MSVC attribs to align critical data structures */
+#if (defined(ATTRIBUTE_ALIGNED_MAX) && defined(__GNUC__))
+#define DECLARE_ALIGNED(n,t,v) t v __attribute__ ((__aligned__ ((ATTRIBUTE_ALIGNED_MAX < n) ? ATTRIBUTE_ALIGNED_MAX : n)))
+#elif defined(_MSC_VER)
+#define DECLARE_ALIGNED(n,t,v) t __declspec(align(n)) v 
 #else
-#define ATTR_ALIGN(align)
+#define DECLARE_ALIGNED(n,t,v) t v
 #endif
 
 #ifdef HAVE_BUILTIN_EXPECT
Index: vc++/config.h
===================================================================
--- vc++/config.h	(revision 1172)
+++ vc++/config.h	(working copy)
@@ -1,7 +1,9 @@
 /* vc++/config.h - manually adapted from include/config.h.in */
 
 /* Suppress warnings relating to mismatched declarations */
+#ifdef _MSC_VER
 #pragma warning (disable:4028)
+#endif
 
 /* autodetect accelerations */
 #define ACCEL_DETECT
@@ -165,7 +167,7 @@
 
 /* Define as `__restrict' if that's what the C compiler calls it, or to
    nothing if it is not supported. */
-#define restrict __restrict
+//#define restrict __restrict
 
 /* Define to `unsigned' if <sys/types.h> does not define. */
 /* #undef size_t */
Index: libmpeg2/convert/rgb.c
===================================================================
--- libmpeg2/convert/rgb.c	(revision 1172)
+++ libmpeg2/convert/rgb.c	(working copy)
@@ -43,7 +43,7 @@
     {117579, 136230, 16907, 35559}  /* SMPTE 240M (1987) */
 };
 
-static const uint8_t dither[] ATTR_ALIGN(32) = {
+DECLARE_ALIGNED(32, static const uint8_t, dither[]) = {
      0,  0, 23, 54,  5, 13, 29, 68,  1,  3, 24, 58,  7, 17, 30, 71,
      0,  0, 23, 54,  5, 13, 29, 68,  1,  3, 24, 58,  7, 17, 30, 71,
      0,  0, 23, 54,  5, 13, 29, 68,  1,  3, 24, 58,  7, 17, 30, 71,
Index: libmpeg2/convert/rgb_vis.c
===================================================================
--- libmpeg2/convert/rgb_vis.c	(revision 1172)
+++ libmpeg2/convert/rgb_vis.c	(working copy)
@@ -39,16 +39,16 @@
  * process both even and odd scanlines in one pass.
  */
 
-static const uint16_t const_2048[] ATTR_ALIGN(8) = {2048, 2048, 2048, 2048};
-static const uint16_t const_1024[] ATTR_ALIGN(8) = {1024, 1024, 1024, 1024};
-static const uint16_t const_128[] ATTR_ALIGN(8) = {128, 128, 128, 128};
-static const uint8_t const_Ugreen[] ATTR_ALIGN(8) =
+DECLARE_ALIGNED(8, static const uint16_t, const_2048[]) = {2048, 2048, 2048, 2048};
+DECLARE_ALIGNED(8, static const uint16_t, const_1024[]) = {1024, 1024, 1024, 1024};
+DECLARE_ALIGNED(8, static const uint16_t, const_128[]) = {128, 128, 128, 128};
+DECLARE_ALIGNED(8, static const uint8_t, const_Ugreen[]) =
 	{0xf3, 0x00, 0xf3, 0x00, 0xf3, 0x00, 0xf3, 0x00};
-static const uint8_t const_Vgreen[] ATTR_ALIGN(8) =
+DECLARE_ALIGNED(8, static const uint8_t, const_Vgreen[]) =
 	{0xe6, 0x00, 0xe6, 0x00, 0xe6, 0x00, 0xe6, 0x00};
-static const uint8_t const_Ublue_Vred[] ATTR_ALIGN(8) =
+DECLARE_ALIGNED(8, static const uint8_t, const_Ublue_Vred[]) =
 	{0x41, 0x41, 0x41, 0x41, 0x33, 0x33, 0x33, 0x33};
-static const uint8_t const_Ycoeff[] ATTR_ALIGN(4) = {0x25, 0x25, 0x25, 0x25};
+DECLARE_ALIGNED(4, static const uint8_t, const_Ycoeff[]) = {0x25, 0x25, 0x25, 0x25};
 
 #define TMP0		0
 #define TMP1		1
Index: libmpeg2/motion_comp_vis.c
===================================================================
--- libmpeg2/motion_comp_vis.c	(revision 1172)
+++ libmpeg2/motion_comp_vis.c	(working copy)
@@ -53,16 +53,16 @@
 
 #define DUP4(x) {x, x, x, x}
 #define DUP8(x) {x, x, x, x, x, x, x, x}
-static const int16_t constants1[] ATTR_ALIGN(8) = DUP4 (1);
-static const int16_t constants2[] ATTR_ALIGN(8) = DUP4 (2);
-static const int16_t constants3[] ATTR_ALIGN(8) = DUP4 (3);
-static const int16_t constants6[] ATTR_ALIGN(8) = DUP4 (6);
-static const int8_t constants_fe[] ATTR_ALIGN(8) = DUP8 (0xfe);
-static const int8_t constants_7f[] ATTR_ALIGN(8) = DUP8 (0x7f);
-static const int8_t constants128[] ATTR_ALIGN(8) = DUP8 (128);
-static const int16_t constants256_512[] ATTR_ALIGN(8) =
+DECLARE_ALIGNED(8, static const int16_t, constants1[]) = DUP4 (1);
+DECLARE_ALIGNED(8, static const int16_t, constants2[]) = DUP4 (2);
+DECLARE_ALIGNED(8, static const int16_t, constants3[]) = DUP4 (3);
+DECLARE_ALIGNED(8, static const int16_t, constants6[]) = DUP4 (6);
+DECLARE_ALIGNED(8, static const int8_t, constants_fe[]) = DUP8 (0xfe);
+DECLARE_ALIGNED(8, static const int8_t, constants_7f[]) = DUP8 (0x7f);
+DECLARE_ALIGNED(8, static const int8_t, constants128[]) = DUP8 (128);
+DECLARE_ALIGNED(8, static const int16_t, constants256_512[]) =
 	{256, 512, 256, 512};
-static const int16_t constants256_1024[] ATTR_ALIGN(8) =
+DECLARE_ALIGNED(8, static const int16_t, constants256_1024[]) =
 	{256, 1024, 256, 1024};
 
 #define REF_0		0
Index: libmpeg2/idct_mmx.c
===================================================================
--- libmpeg2/idct_mmx.c	(revision 1172)
+++ libmpeg2/idct_mmx.c	(working copy)
@@ -464,10 +464,10 @@
     /* Almost identical to mmxext version:  */
     /* just do both 4x8 columns in paraller */
 
-    static const short t1_vector[] ATTR_ALIGN(16) = {T1,T1,T1,T1,T1,T1,T1,T1};
-    static const short t2_vector[] ATTR_ALIGN(16) = {T2,T2,T2,T2,T2,T2,T2,T2};
-    static const short t3_vector[] ATTR_ALIGN(16) = {T3,T3,T3,T3,T3,T3,T3,T3};
-    static const short c4_vector[] ATTR_ALIGN(16) = {C4,C4,C4,C4,C4,C4,C4,C4};
+    DECLARE_ALIGNED(16, static const short, t1_vector[]) = {T1,T1,T1,T1,T1,T1,T1,T1};
+    DECLARE_ALIGNED(16, static const short, t2_vector[]) = {T2,T2,T2,T2,T2,T2,T2,T2};
+    DECLARE_ALIGNED(16, static const short, t3_vector[]) = {T3,T3,T3,T3,T3,T3,T3,T3};
+    DECLARE_ALIGNED(16, static const short, c4_vector[]) = {C4,C4,C4,C4,C4,C4,C4,C4};
 
 #if defined(__x86_64__)
 
@@ -710,10 +710,10 @@
 /* MMX column IDCT */
 static inline void idct_col (int16_t * const col, const int offset)
 {
-    static const short t1_vector[] ATTR_ALIGN(8) = {T1,T1,T1,T1};
-    static const short t2_vector[] ATTR_ALIGN(8) = {T2,T2,T2,T2};
-    static const short t3_vector[] ATTR_ALIGN(8) = {T3,T3,T3,T3};
-    static const short c4_vector[] ATTR_ALIGN(8) = {C4,C4,C4,C4};
+    DECLARE_ALIGNED(8, static const short, t1_vector[]) = {T1,T1,T1,T1};
+    DECLARE_ALIGNED(8, static const short, t2_vector[]) = {T2,T2,T2,T2};
+    DECLARE_ALIGNED(8, static const short, t3_vector[]) = {T3,T3,T3,T3};
+    DECLARE_ALIGNED(8, static const short, c4_vector[]) = {C4,C4,C4,C4};
 
     /* column code adapted from peter gubanov */
     /* http://www.elecard.com/peter/idct.shtml */
@@ -847,33 +847,33 @@
 }
 
 
-static const int32_t rounder0[] ATTR_ALIGN(8) =
+DECLARE_ALIGNED(8, static const int32_t, rounder0[]) =
     rounder ((1 << (COL_SHIFT - 1)) - 0.5);
-static const int32_t rounder4[] ATTR_ALIGN(8) = rounder (0);
-static const int32_t rounder1[] ATTR_ALIGN(8) =
+DECLARE_ALIGNED(8, static const int32_t, rounder4[]) = rounder (0);
+DECLARE_ALIGNED(8, static const int32_t, rounder1[]) =
     rounder (1.25683487303);	/* C1*(C1/C4+C1+C7)/2 */
-static const int32_t rounder7[] ATTR_ALIGN(8) =
+DECLARE_ALIGNED(8, static const int32_t, rounder7[]) =
     rounder (-0.25);		/* C1*(C7/C4+C7-C1)/2 */
-static const int32_t rounder2[] ATTR_ALIGN(8) =
+DECLARE_ALIGNED(8, static const int32_t, rounder2[]) =
     rounder (0.60355339059);	/* C2 * (C6+C2)/2 */
-static const int32_t rounder6[] ATTR_ALIGN(8) =
+DECLARE_ALIGNED(8, static const int32_t, rounder6[]) =
     rounder (-0.25);		/* C2 * (C6-C2)/2 */
-static const int32_t rounder3[] ATTR_ALIGN(8) =
+DECLARE_ALIGNED(8, static const int32_t, rounder3[]) =
     rounder (0.087788325588);	/* C3*(-C3/C4+C3+C5)/2 */
-static const int32_t rounder5[] ATTR_ALIGN(8) =
+DECLARE_ALIGNED(8, static const int32_t, rounder5[]) =
     rounder (-0.441341716183);	/* C3*(-C5/C4+C5-C3)/2 */
 
 
 #define declare_idct(idct,table,idct_row_head,idct_row,idct_row_tail,idct_row_mid)	\
 static inline void idct (int16_t * const block)				\
 {									\
-    static const int16_t table04[] ATTR_ALIGN(16) =			\
+    DECLARE_ALIGNED(16, static const int16_t, table04[]) =			\
 	table (22725, 21407, 19266, 16384, 12873,  8867, 4520);		\
-    static const int16_t table17[] ATTR_ALIGN(16) =			\
+    DECLARE_ALIGNED(16, static const int16_t, table17[]) =			\
 	table (31521, 29692, 26722, 22725, 17855, 12299, 6270);		\
-    static const int16_t table26[] ATTR_ALIGN(16) =			\
+    DECLARE_ALIGNED(16, static const int16_t, table26[]) =			\
 	table (29692, 27969, 25172, 21407, 16819, 11585, 5906);		\
-    static const int16_t table35[] ATTR_ALIGN(16) =			\
+    DECLARE_ALIGNED(16, static const int16_t, table35[]) =			\
 	table (26722, 25172, 22654, 19266, 15137, 10426, 5315);		\
 									\
     idct_row_head (block, 0*8, table04);				\
@@ -900,29 +900,29 @@
 
 static inline void sse2_idct (int16_t * const block)
 {
-    static const int16_t table04[] ATTR_ALIGN(16) =
+    DECLARE_ALIGNED(16, static const int16_t, table04[]) =
 	sse2_table (22725, 21407, 19266, 16384, 12873,  8867, 4520);
-    static const int16_t table17[] ATTR_ALIGN(16) =
+    DECLARE_ALIGNED(16, static const int16_t, table17[]) =
 	sse2_table (31521, 29692, 26722, 22725, 17855, 12299, 6270);
-    static const int16_t table26[] ATTR_ALIGN(16) =
+    DECLARE_ALIGNED(16, static const int16_t, table26[]) =
 	sse2_table (29692, 27969, 25172, 21407, 16819, 11585, 5906);
-    static const int16_t table35[] ATTR_ALIGN(16) =
+    DECLARE_ALIGNED(16, static const int16_t, table35[]) =
 	sse2_table (26722, 25172, 22654, 19266, 15137, 10426, 5315);
 
-    static const int32_t rounder0_128[] ATTR_ALIGN(16) =
+    DECLARE_ALIGNED(16, static const int32_t, rounder0_128[]) =
 	rounder_sse2 ((1 << (COL_SHIFT - 1)) - 0.5);
-    static const int32_t rounder4_128[] ATTR_ALIGN(16) = rounder_sse2 (0);
-    static const int32_t rounder1_128[] ATTR_ALIGN(16) =
+    DECLARE_ALIGNED(16, static const int32_t, rounder4_128[]) = rounder_sse2 (0);
+    DECLARE_ALIGNED(16, static const int32_t, rounder1_128[]) =
 	rounder_sse2 (1.25683487303);	/* C1*(C1/C4+C1+C7)/2 */
-    static const int32_t rounder7_128[] ATTR_ALIGN(16) =
+    DECLARE_ALIGNED(16, static const int32_t, rounder7_128[]) =
 	rounder_sse2 (-0.25);		/* C1*(C7/C4+C7-C1)/2 */
-    static const int32_t rounder2_128[] ATTR_ALIGN(16) =
+    DECLARE_ALIGNED(16, static const int32_t, rounder2_128[]) =
 	rounder_sse2 (0.60355339059);	/* C2 * (C6+C2)/2 */
-    static const int32_t rounder6_128[] ATTR_ALIGN(16) =
+    DECLARE_ALIGNED(16, static const int32_t, rounder6_128[]) =
 	rounder_sse2 (-0.25);		/* C2 * (C6-C2)/2 */
-    static const int32_t rounder3_128[] ATTR_ALIGN(16) =
+    DECLARE_ALIGNED(16, static const int32_t, rounder3_128[]) =
 	rounder_sse2 (0.087788325588);	/* C3*(-C3/C4+C3+C5)/2 */
-    static const int32_t rounder5_128[] ATTR_ALIGN(16) =
+    DECLARE_ALIGNED(16, static const int32_t, rounder5_128[]) =
 	rounder_sse2 (-0.441341716183);	/* C3*(-C5/C4+C5-C3)/2 */
 
 #if defined(__x86_64__)
Index: libmpeg2/mpeg2_internal.h
===================================================================
--- libmpeg2/mpeg2_internal.h	(revision 1172)
+++ libmpeg2/mpeg2_internal.h	(working copy)
@@ -97,7 +97,7 @@
     int16_t dc_dct_pred[3];
 
     /* DCT coefficients */
-    int16_t DCTblock[64] ATTR_ALIGN(64);
+    DECLARE_ALIGNED(64, int16_t, DCTblock[64]);
 
     uint8_t * picture_dest[3];
     void (* convert) (void * convert_id, uint8_t * const * src,
Index: libmpeg2/header.c
===================================================================
--- libmpeg2/header.c	(revision 1172)
+++ libmpeg2/header.c	(working copy)
@@ -40,7 +40,7 @@
 #define PIC_CODING_EXT 0x100
 
 /* default intra quant matrix, in zig-zag order */
-static const uint8_t default_intra_quantizer_matrix[64] ATTR_ALIGN(16) = {
+static const DECLARE_ALIGNED(16, uint8_t, default_intra_quantizer_matrix[64]) = {
     8,
     16, 16,
     19, 16, 19,
@@ -58,7 +58,7 @@
     83
 };
 
-uint8_t mpeg2_scan_norm[64] ATTR_ALIGN(16) = {
+DECLARE_ALIGNED(16, uint8_t, mpeg2_scan_norm[64]) = {
     /* Zig-Zag scan pattern */
      0,  1,  8, 16,  9,  2,  3, 10, 17, 24, 32, 25, 18, 11,  4,  5,
     12, 19, 26, 33, 40, 48, 41, 34, 27, 20, 13,  6,  7, 14, 21, 28,
@@ -66,7 +66,7 @@
     58, 59, 52, 45, 38, 31, 39, 46, 53, 60, 61, 54, 47, 55, 62, 63
 };
 
-uint8_t mpeg2_scan_alt[64] ATTR_ALIGN(16) = {
+DECLARE_ALIGNED(16, uint8_t, mpeg2_scan_alt[64]) = {
     /* Alternate scan pattern */
      0, 8,  16, 24,  1,  9,  2, 10, 17, 25, 32, 40, 48, 56, 57, 49,
     41, 33, 26, 18,  3, 11,  4, 12, 19, 27, 34, 42, 50, 58, 35, 43,
Index: libmpeg2/idct_altivec.c
===================================================================
--- libmpeg2/idct_altivec.c	(revision 1172)
+++ libmpeg2/idct_altivec.c	(working copy)
@@ -62,15 +62,15 @@
 #define VEC_S16(a,b,c,d,e,f,g,h) {a, b, c, d, e, f, g, h}
 #endif
 
-static const vector_s16_t constants ATTR_ALIGN(16) =
+DECLARE_ALIGNED(16, static const vector_s16_t, constants) =
     VEC_S16 (23170, 13573, 6518, 21895, -23170, -21895, 32, 31);
-static const vector_s16_t constants_1 ATTR_ALIGN(16) =
+DECLARE_ALIGNED(16, static const vector_s16_t, constants_1) =
     VEC_S16 (16384, 22725, 21407, 19266, 16384, 19266, 21407, 22725);
-static const vector_s16_t constants_2 ATTR_ALIGN(16) =
+DECLARE_ALIGNED(16, static const vector_s16_t, constants_2) =
     VEC_S16 (16069, 22289, 20995, 18895, 16069, 18895, 20995, 22289);
-static const vector_s16_t constants_3 ATTR_ALIGN(16) =
+DECLARE_ALIGNED(16, static const vector_s16_t, constants_3) =
     VEC_S16 (21407, 29692, 27969, 25172, 21407, 25172, 27969, 29692);
-static const vector_s16_t constants_4 ATTR_ALIGN(16) =
+DECLARE_ALIGNED(16, static const vector_s16_t, constants_4) =
     VEC_S16 (13623, 18895, 17799, 16019, 13623, 16019, 17799, 18895);
 
 #define IDCT								\
