changeset 28290:25337a2147e7

Lots and lots of #ifdef ARCH_... -> #if ARCH_... and #ifdef HAVE_MMX etc -> #if HAVE_MMX. There might be still more that need to be fixed.
author reimar
date Fri, 16 Jan 2009 09:21:21 +0000
parents 4210f3621db1
children 2f5073b600f4
files liba52/a52_internal.h liba52/bitstream.h liba52/downmix.c liba52/imdct.c liba52/resample.c liba52/resample_mmx.c libmpcodecs/dec_video.c libmpcodecs/pullup.c libmpcodecs/vd_libmpeg2.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_hue.c libmpcodecs/vf_ilpack.c libmpcodecs/vf_ivtc.c libmpcodecs/vf_noise.c libmpcodecs/vf_pp7.c libmpcodecs/vf_scale.c libmpcodecs/vf_spp.c libmpcodecs/vf_tfields.c libmpcodecs/vf_unsharp.c libmpcodecs/vf_uspp.c libmpdemux/asfguid.h libmpeg2/cpu_accel.c libmpeg2/cpu_state.c libmpeg2/idct.c libmpeg2/idct_alpha.c libmpeg2/idct_altivec.c libmpeg2/idct_mmx.c libmpeg2/motion_comp.c libmpeg2/motion_comp_alpha.c libmpeg2/motion_comp_altivec.c libmpeg2/motion_comp_arm.c libmpeg2/motion_comp_mmx.c libmpeg2/motion_comp_vis.c libmpeg2/mpeg2_internal.h libvo/aclib.c libvo/aclib_template.c libvo/osd.c libvo/osd_template.c mp3lib/decod386.c mp3lib/sr1.c vidix/dha.c
diffstat 46 files changed, 271 insertions(+), 215 deletions(-) [+]
line wrap: on
line diff
--- a/liba52/a52_internal.h	Fri Jan 16 08:45:35 2009 +0000
+++ b/liba52/a52_internal.h	Fri Jan 16 09:21:21 2009 +0000
@@ -107,7 +107,7 @@
 #define DELTA_BIT_NONE (2)
 #define DELTA_BIT_RESERVED (3)
 
-#ifdef ARCH_X86_64
+#if ARCH_X86_64
 # define REG_a "rax"
 # define REG_d "rdx"
 # define REG_S "rsi"
--- a/liba52/bitstream.h	Fri Jan 16 08:45:35 2009 +0000
+++ b/liba52/bitstream.h	Fri Jan 16 09:21:21 2009 +0000
@@ -37,7 +37,7 @@
 #define ALT_BITSTREAM_READER
 
 /* used to avoid misaligned exceptions on some archs (alpha, ...) */
-#if defined (ARCH_X86) || defined(HAVE_ARMV6)
+#if ARCH_X86 || defined(HAVE_ARMV6)
 #    define unaligned32(a) (*(uint32_t*)(a))
 #else
 #    ifdef __GNUC__
--- a/liba52/downmix.c	Fri Jan 16 08:45:35 2009 +0000
+++ b/liba52/downmix.c	Fri Jan 16 09:21:21 2009 +0000
@@ -56,7 +56,7 @@
 {
     a52_upmix= upmix_C;
     a52_downmix= downmix_C;
-#if defined(ARCH_X86) || defined(ARCH_X86_64)
+#if ARCH_X86 || ARCH_X86_64
     if(mm_accel & MM_ACCEL_X86_MMX) a52_upmix= upmix_MMX;
     if(mm_accel & MM_ACCEL_X86_SSE) a52_downmix= downmix_SSE;
     if(mm_accel & MM_ACCEL_X86_3DNOW) a52_downmix= downmix_3dnow;
@@ -686,7 +686,7 @@
     }
 }
 
-#if defined(ARCH_X86) || defined(ARCH_X86_64)
+#if ARCH_X86 || ARCH_X86_64
 static void mix2to1_SSE (sample_t * dest, sample_t * src, sample_t bias)
 {
 	__asm__ volatile(
--- a/liba52/imdct.c	Fri Jan 16 08:45:35 2009 +0000
+++ b/liba52/imdct.c	Fri Jan 16 09:21:21 2009 +0000
@@ -54,6 +54,7 @@
 
 #ifdef RUNTIME_CPUDETECT
 #undef HAVE_3DNOWEX
+#define HAVE_3DNOWEX 0
 #endif
 
 typedef struct complex_s {
@@ -118,7 +119,7 @@
 static sample_t __attribute__((aligned(16))) xcos1[128];
 static sample_t __attribute__((aligned(16))) xsin1[128];
 
-#if defined(ARCH_X86) || defined(ARCH_X86_64)
+#if ARCH_X86 || ARCH_X86_64
 // NOTE: SSE needs 16byte alignment or it will segfault 
 // 
 static float __attribute__((aligned(16))) sseSinCos1c[256];
@@ -365,7 +366,7 @@
     }
 }
 
-#ifdef HAVE_ALTIVEC
+#if HAVE_ALTIVEC
 
 #ifdef HAVE_ALTIVEC_H
 #include <altivec.h>
@@ -710,10 +711,9 @@
 
 // Stuff below this line is borrowed from libac3
 #include "srfftp.h"
-#if defined(ARCH_X86) || defined(ARCH_X86_64)
-#ifndef HAVE_3DNOW
+#if ARCH_X86 || ARCH_X86_64
+#undef HAVE_3DNOW
 #define HAVE_3DNOW 1
-#endif
 #include "srfftp_3dnow.h"
 
 const i_cmplx_t x_plus_minus_3dnow __attribute__ ((aligned (8))) = {{ 0x00000000UL, 0x80000000UL }}; 
@@ -721,8 +721,10 @@
 const complex_t HSQRT2_3DNOW __attribute__ ((aligned (8))) = { 0.707106781188, 0.707106781188 };
 
 #undef HAVE_3DNOWEX
+#define HAVE_3DNOWEX 0
 #include "imdct_3dnow.h"
-#define HAVE_3DNOWEX
+#undef HAVE_3DNOWEX
+#define HAVE_3DNOWEX 1
 #include "imdct_3dnow.h"
 
 void
@@ -1202,7 +1204,7 @@
 	    w[i][k].imag = sin (-M_PI * k / j);
 	}
     }
-#if defined(ARCH_X86) || defined(ARCH_X86_64)
+#if ARCH_X86 || ARCH_X86_64
 	for (i = 0; i < 128; i++) {
 	    sseSinCos1c[2*i+0]= xcos1[i];
 	    sseSinCos1c[2*i+1]= -xcos1[i];
@@ -1256,7 +1258,7 @@
 	ifft128 = ifft128_c;
 	ifft64 = ifft64_c;
 
-#if defined(ARCH_X86) || defined(ARCH_X86_64)
+#if ARCH_X86 || ARCH_X86_64
 	if(mm_accel & MM_ACCEL_X86_SSE)
 	{
 	  fprintf (stderr, "Using SSE optimized IMDCT transform\n");
@@ -1276,7 +1278,7 @@
 	}
 	else
 #endif // ARCH_X86 || ARCH_X86_64
-#ifdef HAVE_ALTIVEC
+#if HAVE_ALTIVEC
         if (mm_accel & MM_ACCEL_PPC_ALTIVEC)
 	{
 	  fprintf(stderr, "Using AltiVec optimized IMDCT transform\n");
@@ -1285,7 +1287,7 @@
 	else
 #endif
 
-#ifdef LIBA52_DJBFFT
+#if LIBA52_DJBFFT
     if (mm_accel & MM_ACCEL_DJBFFT) {
 	fprintf (stderr, "Using djbfft for IMDCT transform\n");
 	ifft128 = (void (*) (complex_t *)) fftc4_un128;
--- a/liba52/resample.c	Fri Jan 16 08:45:35 2009 +0000
+++ b/liba52/resample.c	Fri Jan 16 09:21:21 2009 +0000
@@ -38,18 +38,18 @@
 
 #include "resample_c.c"
 
-#if defined(ARCH_X86) || defined(ARCH_X86_64)
+#if ARCH_X86 || ARCH_X86_64
 #include "resample_mmx.c"
 #endif
 
-#ifdef HAVE_ALTIVEC
+#if HAVE_ALTIVEC
 #include "resample_altivec.c"
 #endif
 
 void* a52_resample_init(uint32_t mm_accel,int flags,int chans){
 void* tmp;
 
-#if defined(ARCH_X86) || defined(ARCH_X86_64)
+#if ARCH_X86 || ARCH_X86_64
     if(mm_accel&MM_ACCEL_X86_MMX){
 	tmp=a52_resample_MMX(flags,chans);
 	if(tmp){
@@ -59,7 +59,7 @@
 	}
     }
 #endif
-#ifdef HAVE_ALTIVEC
+#if HAVE_ALTIVEC
     if(mm_accel&MM_ACCEL_PPC_ALTIVEC){
       tmp=a52_resample_altivec(flags,chans);
       if(tmp){
--- a/liba52/resample_mmx.c	Fri Jan 16 08:45:35 2009 +0000
+++ b/liba52/resample_mmx.c	Fri Jan 16 09:21:21 2009 +0000
@@ -76,7 +76,7 @@
 static int a52_resample_STEREO_to_2_MMX(float * _f, int16_t * s16){
     int32_t * f = (int32_t *) _f;
 /* benchmark scores are 0.3% better with SSE but we would need to set bias=0 and premultiply it
-#ifdef HAVE_SSE
+#if HAVE_SSE
 	__asm__ volatile(
 		"mov $-1024, %%"REG_S"		\n\t"
 		"1:				\n\t"
--- a/libmpcodecs/dec_video.c	Fri Jan 16 08:45:35 2009 +0000
+++ b/libmpcodecs/dec_video.c	Fri Jan 16 09:21:21 2009 +0000
@@ -370,7 +370,7 @@
 
     //------------------------ frame decoded. --------------------
 
-#ifdef HAVE_MMX
+#if HAVE_MMX
     // some codecs are broken, and doesn't restore MMX state :(
     // it happens usually with broken/damaged files.
     if (gCpuCaps.has3DNow) {
--- a/libmpcodecs/pullup.c	Fri Jan 16 08:45:35 2009 +0000
+++ b/libmpcodecs/pullup.c	Fri Jan 16 09:21:21 2009 +0000
@@ -9,8 +9,8 @@
 
 
 
-#ifdef ARCH_X86
-#ifdef HAVE_MMX
+#if ARCH_X86
+#if HAVE_MMX
 static int diff_y_mmx(unsigned char *a, unsigned char *b, int s)
 {
 	int ret;
@@ -767,8 +767,8 @@
 		c->diff = diff_y;
 		c->comb = licomb_y;
 		c->var = var_y;
-#ifdef ARCH_X86
-#ifdef HAVE_MMX
+#if ARCH_X86
+#if HAVE_MMX
 		if (c->cpu & PULLUP_CPU_MMX) {
 			c->diff = diff_y_mmx;
 			c->comb = licomb_y_mmx;
--- a/libmpcodecs/vd_libmpeg2.c	Fri Jan 16 08:45:35 2009 +0000
+++ b/libmpcodecs/vd_libmpeg2.c	Fri Jan 16 09:21:21 2009 +0000
@@ -78,12 +78,12 @@
        accel |= MPEG2_ACCEL_X86_SSE2;
     if(gCpuCaps.hasAltiVec)
        accel |= MPEG2_ACCEL_PPC_ALTIVEC;
-    #ifdef ARCH_ALPHA
+    #if ARCH_ALPHA
        accel |= MPEG2_ACCEL_ALPHA;
     #elif ARCH_ARM
        accel |= MPEG2_ACCEL_ARM;
     #endif
-    #ifdef HAVE_MVI
+    #if HAVE_MVI
        accel |= MPEG2_ACCEL_ALPHA_MVI;
     #elif HAVE_VIS
        accel |= MPEG2_ACCEL_SPARC_VIS;
--- a/libmpcodecs/vf_decimate.c	Fri Jan 16 08:45:35 2009 +0000
+++ b/libmpcodecs/vf_decimate.c	Fri Jan 16 09:21:21 2009 +0000
@@ -19,7 +19,7 @@
 	int max, last, cnt;
 };
 
-#ifdef HAVE_MMX
+#if HAVE_MMX
 static int diff_MMX(unsigned char *old, unsigned char *new, int os, int ns)
 {
 	volatile short out[4];
@@ -164,7 +164,7 @@
 	p->frac = 0.33;
 	if (args) sscanf(args, "%d:%d:%d:%f", &p->max, &p->hi, &p->lo, &p->frac);
 	diff = diff_C;
-#ifdef HAVE_MMX
+#if HAVE_MMX
 	if(gCpuCaps.hasMMX) diff = diff_MMX;
 #endif
 	return 1;
--- a/libmpcodecs/vf_divtc.c	Fri Jan 16 08:45:35 2009 +0000
+++ b/libmpcodecs/vf_divtc.c	Fri Jan 16 09:21:21 2009 +0000
@@ -33,7 +33,7 @@
  * diff_MMX and diff_C stolen from vf_decimate.c
  */
 
-#ifdef HAVE_MMX
+#if HAVE_MMX
 static int diff_MMX(unsigned char *old, unsigned char *new, int os, int ns)
    {
    volatile short out[4];
@@ -683,7 +683,7 @@
       goto nomem;
 
    diff=
-#ifdef HAVE_MMX
+#if HAVE_MMX
       gCpuCaps.hasMMX?diff_MMX:
 #endif
       diff_C;
--- a/libmpcodecs/vf_eq.c	Fri Jan 16 08:45:35 2009 +0000
+++ b/libmpcodecs/vf_eq.c	Fri Jan 16 09:21:21 2009 +0000
@@ -26,7 +26,7 @@
   0
 };
 
-#ifdef HAVE_MMX
+#if HAVE_MMX
 static void process_MMX(unsigned char *dest, int dstride, unsigned char *src, int sstride,
 		    int w, int h, int brightness, int contrast)
 {
@@ -215,7 +215,7 @@
 	if (args) sscanf(args, "%d:%d", &vf->priv->brightness, &vf->priv->contrast);
 
 	process = process_C;
-#ifdef HAVE_MMX
+#if HAVE_MMX
 	if(gCpuCaps.hasMMX) process = process_MMX;
 #endif
 	
--- a/libmpcodecs/vf_eq2.c	Fri Jan 16 08:45:35 2009 +0000
+++ b/libmpcodecs/vf_eq2.c	Fri Jan 16 09:21:21 2009 +0000
@@ -106,7 +106,7 @@
   par->lut_clean = 1;
 }
 
-#ifdef HAVE_MMX
+#if HAVE_MMX
 static
 void affine_1d_MMX (eq2_param_t *par, unsigned char *dst, unsigned char *src,
   unsigned w, unsigned h, unsigned dstride, unsigned sstride)
@@ -275,7 +275,7 @@
   if ((par->c == 1.0) && (par->b == 0.0) && (par->g == 1.0)) {
     par->adjust = NULL;
   }
-#ifdef HAVE_MMX
+#if HAVE_MMX
   else if (par->g == 1.0 && gCpuCaps.hasMMX) {
     par->adjust = &affine_1d_MMX;
   }
--- a/libmpcodecs/vf_fspp.c	Fri Jan 16 08:45:35 2009 +0000
+++ b/libmpcodecs/vf_fspp.c	Fri Jan 16 09:21:21 2009 +0000
@@ -101,7 +101,7 @@
 };
 
 
-#ifndef HAVE_MMX
+#if !HAVE_MMX
 
 //This func reads from 1 slice, 1 and clears 0 & 1
 static void store_slice_c(uint8_t *dst, int16_t *src, int dst_stride, int src_stride, int width, int height, int log2_scale)
@@ -557,10 +557,10 @@
 	}
     }
 
-#ifdef HAVE_MMX
+#if HAVE_MMX
     if(gCpuCaps.hasMMX) __asm__ volatile ("emms\n\t");
 #endif
-#ifdef HAVE_MMX2
+#if HAVE_MMX2
     if(gCpuCaps.hasMMX2) __asm__ volatile ("sfence\n\t");
 #endif
     return vf_next_put_image(vf,dmpi, pts);
@@ -702,7 +702,7 @@
 #define THRESHOLD(r,x,t) if(((unsigned)((x)+t))>t*2) r=(x);else r=0;
 #define DESCALE(x,n)  (((x) + (1 << ((n)-1))) >> n)
 
-#ifdef HAVE_MMX
+#if HAVE_MMX
 
 DECLARE_ASM_CONST(8, uint64_t, MM_FIX_0_382683433)=FIX64(0.382683433, 14); 
 DECLARE_ASM_CONST(8, uint64_t, MM_FIX_0_541196100)=FIX64(0.541196100, 14); 
@@ -738,7 +738,7 @@
 
 #endif
 
-#ifndef HAVE_MMX
+#if !HAVE_MMX
 
 static void column_fidct_c(int16_t* thr_adr, DCTELEM *data, DCTELEM *output, int cnt)
 {
@@ -1598,7 +1598,7 @@
 
 #endif // HAVE_MMX
 
-#ifndef HAVE_MMX
+#if !HAVE_MMX
 
 static void row_idct_c(DCTELEM* workspace,
 		       int16_t* output_adr, int output_stride, int cnt)
@@ -1867,7 +1867,7 @@
 
 #endif // HAVE_MMX
 
-#ifndef HAVE_MMX
+#if !HAVE_MMX
 
 static void row_fdct_c(DCTELEM *data, const uint8_t *pixels, int line_size, int cnt)
 {
--- a/libmpcodecs/vf_halfpack.c	Fri Jan 16 08:45:35 2009 +0000
+++ b/libmpcodecs/vf_halfpack.c	Fri Jan 16 09:21:21 2009 +0000
@@ -17,7 +17,7 @@
 	int field;
 };
 
-#ifdef HAVE_MMX
+#if HAVE_MMX
 static void halfpack_MMX(unsigned char *dst, unsigned char *src[3],
 		     int dststride, int srcstride[3],
 		     int w, int h)
@@ -204,7 +204,7 @@
 	if (args) sscanf(args, "%d", &vf->priv->field);
 	
 	halfpack = halfpack_C;
-#ifdef HAVE_MMX
+#if HAVE_MMX
 	if(gCpuCaps.hasMMX) halfpack = halfpack_MMX;
 #endif
 	return 1;
--- a/libmpcodecs/vf_hue.c	Fri Jan 16 08:45:35 2009 +0000
+++ b/libmpcodecs/vf_hue.c	Fri Jan 16 09:21:21 2009 +0000
@@ -160,7 +160,7 @@
         vf->priv->hue *= M_PI / 180.0;
 
 	process = process_C;
-#ifdef HAVE_MMXX
+#if HAVE_MMXX
 	if(gCpuCaps.hasMMX) process = process_MMX;
 #endif
 	
--- a/libmpcodecs/vf_ilpack.c	Fri Jan 16 08:45:35 2009 +0000
+++ b/libmpcodecs/vf_ilpack.c	Fri Jan 16 09:21:21 2009 +0000
@@ -57,7 +57,7 @@
 	}
 }
 
-#ifdef HAVE_MMX
+#if HAVE_MMX
 static void pack_nn_MMX(unsigned char *dst, unsigned char *y,
 	unsigned char *u, unsigned char *v, int w)
 {
@@ -93,7 +93,7 @@
 {
 	__asm__ volatile (""
 		"push %%"REG_BP" \n\t"
-#ifdef ARCH_X86_64
+#if ARCH_X86_64
 		"mov %6, %%"REG_BP" \n\t"
 #else
 		"movl 4(%%"REG_d"), %%"REG_BP" \n\t"
@@ -186,7 +186,7 @@
 		"pop %%"REG_BP" \n\t"
 		: 
 		: "S" (y), "D" (dst), "a" (u), "b" (v), "c" (w/16),
-#ifdef ARCH_X86_64
+#if ARCH_X86_64
 		"d" ((long)us), "r" ((long)vs)
 #else
 		"d" (&us)
@@ -201,7 +201,7 @@
 {
 	__asm__ volatile (""
 		"push %%"REG_BP" \n\t"
-#ifdef ARCH_X86_64
+#if ARCH_X86_64
 		"mov %6, %%"REG_BP" \n\t"
 #else
 		"movl 4(%%"REG_d"), %%"REG_BP" \n\t"
@@ -298,7 +298,7 @@
 		"pop %%"REG_BP" \n\t"
 		: 
 		: "S" (y), "D" (dst), "a" (u), "b" (v), "c" (w/16),
-#ifdef ARCH_X86_64
+#if ARCH_X86_64
 		"d" ((long)us), "r" ((long)vs)
 #else
 		"d" (&us)
@@ -396,7 +396,7 @@
 	pack_nn = (pack_func_t *)pack_nn_C;
 	pack_li_0 = pack_li_0_C;
 	pack_li_1 = pack_li_1_C;
-#ifdef HAVE_MMX
+#if HAVE_MMX
 	if(gCpuCaps.hasMMX) {
 		pack_nn = (pack_func_t *)pack_nn_MMX;
 		pack_li_0 = pack_li_0_MMX;
--- a/libmpcodecs/vf_ivtc.c	Fri Jan 16 08:45:35 2009 +0000
+++ b/libmpcodecs/vf_ivtc.c	Fri Jan 16 09:21:21 2009 +0000
@@ -40,7 +40,7 @@
 	F_SHOW
 };
 
-#ifdef HAVE_MMX
+#if HAVE_MMX
 static void block_diffs_MMX(struct metrics *m, unsigned char *old, unsigned char *new, int os, int ns)
 {
 	int i;
@@ -516,7 +516,7 @@
 	p->first = 1;
 	if (args) sscanf(args, "%d", &p->drop);
 	block_diffs = block_diffs_C;
-#ifdef HAVE_MMX
+#if HAVE_MMX
 	if(gCpuCaps.hasMMX) block_diffs = block_diffs_MMX;
 #endif
 	return 1;
--- a/libmpcodecs/vf_noise.c	Fri Jan 16 08:45:35 2009 +0000
+++ b/libmpcodecs/vf_noise.c	Fri Jan 16 09:21:21 2009 +0000
@@ -145,7 +145,7 @@
 
 /***************************************************************************/
 
-#ifdef HAVE_MMX
+#if HAVE_MMX
 static inline void lineNoise_MMX(uint8_t *dst, uint8_t *src, int8_t *noise, int len, int shift){
 	long mmx_len= len&(~7);
 	noise+=shift;
@@ -174,7 +174,7 @@
 #endif
 
 //duplicate of previous except movntq
-#ifdef HAVE_MMX2
+#if HAVE_MMX2
 static inline void lineNoise_MMX2(uint8_t *dst, uint8_t *src, int8_t *noise, int len, int shift){
 	long mmx_len= len&(~7);
 	noise+=shift;
@@ -216,7 +216,7 @@
 
 /***************************************************************************/
 
-#ifdef HAVE_MMX
+#if HAVE_MMX
 static inline void lineNoiseAvg_MMX(uint8_t *dst, uint8_t *src, int len, int8_t **shift){
 	long mmx_len= len&(~7);
 
@@ -356,10 +356,10 @@
 
         vf_clone_mpi_attributes(dmpi, mpi);
 
-#ifdef HAVE_MMX
+#if HAVE_MMX
 	if(gCpuCaps.hasMMX) __asm__ volatile ("emms\n\t");
 #endif
-#ifdef HAVE_MMX2
+#if HAVE_MMX2
 	if(gCpuCaps.hasMMX2) __asm__ volatile ("sfence\n\t");
 #endif
 
@@ -447,13 +447,13 @@
     }
 
  
-#ifdef HAVE_MMX
+#if HAVE_MMX
     if(gCpuCaps.hasMMX){
         lineNoise= lineNoise_MMX;
         lineNoiseAvg= lineNoiseAvg_MMX;
     }
 #endif
-#ifdef HAVE_MMX2
+#if HAVE_MMX2
     if(gCpuCaps.hasMMX2) lineNoise= lineNoise_MMX2;
 //    if(gCpuCaps.hasMMX) lineNoiseAvg= lineNoiseAvg_MMX2;
 #endif
--- a/libmpcodecs/vf_pp7.c	Fri Jan 16 08:45:35 2009 +0000
+++ b/libmpcodecs/vf_pp7.c	Fri Jan 16 09:21:21 2009 +0000
@@ -155,7 +155,7 @@
     }
 }
 
-#ifdef HAVE_MMX
+#if HAVE_MMX
 static void dctB_mmx(DCTELEM *dst, DCTELEM *src){
     __asm__ volatile (
         "movq  (%0), %%mm0      \n\t"
@@ -397,10 +397,10 @@
         memcpy_pic(dmpi->planes[2], mpi->planes[2], mpi->w>>mpi->chroma_x_shift, mpi->h>>mpi->chroma_y_shift, dmpi->stride[2], mpi->stride[2]);
     }
 
-#ifdef HAVE_MMX
+#if HAVE_MMX
     if(gCpuCaps.hasMMX) __asm__ volatile ("emms\n\t");
 #endif
-#ifdef HAVE_MMX2
+#if HAVE_MMX2
     if(gCpuCaps.hasMMX2) __asm__ volatile ("sfence\n\t");
 #endif
 
@@ -464,7 +464,7 @@
 	case 2: requantize= mediumthresh_c; break;
     }
 
-#ifdef HAVE_MMX
+#if HAVE_MMX
     if(gCpuCaps.hasMMX){
         dctB= dctB_mmx;
     }
--- a/libmpcodecs/vf_scale.c	Fri Jan 16 08:45:35 2009 +0000
+++ b/libmpcodecs/vf_scale.c	Fri Jan 16 09:21:21 2009 +0000
@@ -556,7 +556,7 @@
 	static int firstTime=1;
 	*flags=0;
 
-#ifdef ARCH_X86
+#if ARCH_X86
 	if(gCpuCaps.hasMMX)
 		__asm__ volatile("emms\n\t"::: "memory"); //FIXME this should not be required but it IS (even for non-MMX versions)
 #endif
--- a/libmpcodecs/vf_spp.c	Fri Jan 16 08:45:35 2009 +0000
+++ b/libmpcodecs/vf_spp.c	Fri Jan 16 09:21:21 2009 +0000
@@ -146,7 +146,7 @@
 	}
 }
 
-#ifdef HAVE_MMX
+#if HAVE_MMX
 static void hardthresh_mmx(DCTELEM dst[64], DCTELEM src[64], int qp, uint8_t *permutation){
 	int bias= 0; //FIXME
 	unsigned int threshold1;
@@ -327,7 +327,7 @@
 	}
 }
 
-#ifdef HAVE_MMX
+#if HAVE_MMX
 static void store_slice_mmx(uint8_t *dst, int16_t *src, int dst_stride, int src_stride, int width, int height, int log2_scale){
 	int y;
 
@@ -499,10 +499,10 @@
 	    }
 	}
 
-#ifdef HAVE_MMX
+#if HAVE_MMX
 	if(gCpuCaps.hasMMX) __asm__ volatile ("emms\n\t");
 #endif
-#ifdef HAVE_MMX2
+#if HAVE_MMX2
 	if(gCpuCaps.hasMMX2) __asm__ volatile ("sfence\n\t");
 #endif
 
@@ -589,7 +589,7 @@
 	case 1: requantize= softthresh_c; break;
     }
 
-#ifdef HAVE_MMX
+#if HAVE_MMX
     if(gCpuCaps.hasMMX){
 	store_slice= store_slice_mmx;
 	switch(vf->priv->mode&3){
--- a/libmpcodecs/vf_tfields.c	Fri Jan 16 08:45:35 2009 +0000
+++ b/libmpcodecs/vf_tfields.c	Fri Jan 16 09:21:21 2009 +0000
@@ -46,7 +46,7 @@
 	}
 }
 
-#ifdef HAVE_3DNOW
+#if HAVE_3DNOW
 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;
@@ -82,7 +82,7 @@
 }
 #endif
 
-#ifdef HAVE_MMX2
+#if HAVE_MMX2
 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;
@@ -119,7 +119,7 @@
 }
 #endif
 
-#ifdef HAVE_MMX
+#if HAVE_MMX
 static void qpel_li_MMX(unsigned char *d, unsigned char *s, int w, int h, int ds, int ss, int up)
 {
 	int i, j, ssd=ss;
@@ -478,14 +478,14 @@
 	if (args) sscanf(args, "%d:%d", &vf->priv->mode, &vf->priv->parity);
 	qpel_li = qpel_li_C;
 	qpel_4tap = qpel_4tap_C;
-#ifdef HAVE_MMX
+#if HAVE_MMX
 	if(gCpuCaps.hasMMX) qpel_li = qpel_li_MMX;
 	if(gCpuCaps.hasMMX) qpel_4tap = qpel_4tap_MMX;
 #endif
-#ifdef HAVE_MMX2
+#if HAVE_MMX2
 	if(gCpuCaps.hasMMX2) qpel_li = qpel_li_MMX2;
 #endif
-#ifdef HAVE_3DNOW
+#if HAVE_3DNOW
 	if(gCpuCaps.has3DNow) qpel_li = qpel_li_3DNOW;
 #endif
 	return 1;
--- a/libmpcodecs/vf_unsharp.c	Fri Jan 16 08:45:35 2009 +0000
+++ b/libmpcodecs/vf_unsharp.c	Fri Jan 16 09:21:21 2009 +0000
@@ -192,11 +192,11 @@
     
     vf_clone_mpi_attributes(dmpi, mpi);
     
-#ifdef HAVE_MMX
+#if HAVE_MMX
     if(gCpuCaps.hasMMX)
 	__asm__ volatile ("emms\n\t");
 #endif
-#ifdef HAVE_MMX2
+#if HAVE_MMX2
     if(gCpuCaps.hasMMX2)
 	__asm__ volatile ("sfence\n\t");
 #endif
--- a/libmpcodecs/vf_uspp.c	Fri Jan 16 08:45:35 2009 +0000
+++ b/libmpcodecs/vf_uspp.c	Fri Jan 16 09:21:21 2009 +0000
@@ -291,10 +291,10 @@
         }
     }
 
-#ifdef HAVE_MMX
+#if HAVE_MMX
     if(gCpuCaps.hasMMX) __asm__ volatile ("emms\n\t");
 #endif
-#ifdef HAVE_MMX2
+#if HAVE_MMX2
     if(gCpuCaps.hasMMX2) __asm__ volatile ("sfence\n\t");
 #endif
 
@@ -370,7 +370,7 @@
     if(vf->priv->qp < 0)
         vf->priv->qp = 0;
 
-// #ifdef HAVE_MMX
+// #if HAVE_MMX
 //     if(gCpuCaps.hasMMX){
 // 	store_slice= store_slice_mmx;
 //     }
--- a/libmpdemux/asfguid.h	Fri Jan 16 08:45:35 2009 +0000
+++ b/libmpdemux/asfguid.h	Fri Jan 16 09:21:21 2009 +0000
@@ -26,7 +26,7 @@
 #include "mpbswap.h"
 
 
-#ifdef ARCH_X86
+#if ARCH_X86
 #define	ASF_LOAD_GUID_PREFIX(guid)	(*(uint32_t *)(guid))
 #else
 #define	ASF_LOAD_GUID_PREFIX(guid)	AV_RL32(guid)
--- a/libmpeg2/cpu_accel.c	Fri Jan 16 08:45:35 2009 +0000
+++ b/libmpeg2/cpu_accel.c	Fri Jan 16 09:21:21 2009 +0000
@@ -35,7 +35,7 @@
 
 #include "cpudetect.h"
 
-#if defined(ARCH_X86) || defined(ARCH_X86_64)
+#if ARCH_X86 || ARCH_X86_64
 static inline uint32_t arch_accel (uint32_t accel)
 {
 /* Use MPlayer CPU detection instead of libmpeg2 variant. */
@@ -150,7 +150,7 @@
 }
 #endif /* ARCH_X86 || ARCH_X86_64 */
 
-#if defined(ACCEL_DETECT) && (defined(ARCH_PPC) || defined(ARCH_SPARC))
+#if defined(ACCEL_DETECT) && (ARCH_PPC || ARCH_SPARC)
 #include <signal.h>
 #include <setjmp.h>
 
@@ -169,7 +169,7 @@
 }
 #endif /* ACCEL_DETECT && (ARCH_PPC || ARCH_SPARC) */
 
-#ifdef ARCH_PPC
+#if ARCH_PPC
 static uint32_t arch_accel (uint32_t accel)
 {
 #ifdef ACCEL_DETECT
@@ -206,7 +206,7 @@
 }
 #endif /* ARCH_PPC */
 
-#ifdef ARCH_SPARC
+#if ARCH_SPARC
 static uint32_t arch_accel (uint32_t accel)
 {
     if (accel & MPEG2_ACCEL_SPARC_VIS2)
@@ -252,7 +252,7 @@
 }
 #endif /* ARCH_SPARC */
 
-#ifdef ARCH_ALPHA
+#if ARCH_ALPHA
 static inline uint32_t arch_accel (uint32_t accel)
 {
     if (accel & MPEG2_ACCEL_ALPHA_MVI)
@@ -276,7 +276,7 @@
 
 uint32_t mpeg2_detect_accel (uint32_t accel)
 {
-#if defined (ARCH_X86) || defined (ARCH_X86_64) || defined (ARCH_PPC) || defined (ARCH_ALPHA) || defined (ARCH_SPARC)
+#if ARCH_X86 || ARCH_X86_64 || ARCH_PPC || ARCH_ALPHA || ARCH_SPARC
     accel = arch_accel (accel);
 #endif
     return accel;
--- a/libmpeg2/cpu_state.c	Fri Jan 16 08:45:35 2009 +0000
+++ b/libmpeg2/cpu_state.c	Fri Jan 16 09:21:21 2009 +0000
@@ -29,21 +29,21 @@
 #include "mpeg2.h"
 #include "attributes.h"
 #include "mpeg2_internal.h"
-#if defined(ARCH_X86) || defined(ARCH_X86_64)
+#if ARCH_X86 || ARCH_X86_64
 #include "mmx.h"
 #endif
 
 void (* mpeg2_cpu_state_save) (cpu_state_t * state) = NULL;
 void (* mpeg2_cpu_state_restore) (cpu_state_t * state) = NULL;
 
-#if defined(ARCH_X86) || defined(ARCH_X86_64)
+#if ARCH_X86 || ARCH_X86_64
 static void state_restore_mmx (cpu_state_t * state)
 {
     emms ();
 }
 #endif
 
-#ifdef ARCH_PPC
+#if ARCH_PPC
 #if defined(__APPLE_CC__)	/* apple */
 #define LI(a,b) "li r" #a "," #b "\n\t"
 #define STVX0(a,b,c) "stvx v" #a ",0,r" #c "\n\t"
@@ -115,12 +115,12 @@
 
 void mpeg2_cpu_state_init (uint32_t accel)
 {
-#if defined(ARCH_X86) || defined(ARCH_X86_64)
+#if ARCH_X86 || ARCH_X86_64
     if (accel & MPEG2_ACCEL_X86_MMX) {
 	mpeg2_cpu_state_restore = state_restore_mmx;
     }
 #endif
-#ifdef ARCH_PPC
+#if ARCH_PPC
     if (accel & MPEG2_ACCEL_PPC_ALTIVEC) {
 	mpeg2_cpu_state_save = state_save_altivec;
 	mpeg2_cpu_state_restore = state_restore_altivec;
--- a/libmpeg2/idct.c	Fri Jan 16 08:45:35 2009 +0000
+++ b/libmpeg2/idct.c	Fri Jan 16 09:21:21 2009 +0000
@@ -239,7 +239,7 @@
 
 void mpeg2_idct_init (uint32_t accel)
 {
-#ifdef HAVE_SSE2
+#if HAVE_SSE2
     if (accel & MPEG2_ACCEL_X86_SSE2) {
 	mpeg2_idct_copy = mpeg2_idct_copy_sse2;
 	mpeg2_idct_add = mpeg2_idct_add_sse2;
@@ -258,14 +258,14 @@
 	mpeg2_idct_mmx_init ();
     } else
 #endif
-#ifdef HAVE_ALTIVEC
+#if HAVE_ALTIVEC
     if (accel & MPEG2_ACCEL_PPC_ALTIVEC) {
 	mpeg2_idct_copy = mpeg2_idct_copy_altivec;
 	mpeg2_idct_add = mpeg2_idct_add_altivec;
 	mpeg2_idct_altivec_init ();
     } else
 #endif
-#ifdef HAVE_MVI
+#if HAVE_MVI
     if (accel & MPEG2_ACCEL_ALPHA_MVI) {
 	mpeg2_idct_copy = mpeg2_idct_copy_mvi;
 	mpeg2_idct_add = mpeg2_idct_add_mvi;
--- a/libmpeg2/idct_alpha.c	Fri Jan 16 08:45:35 2009 +0000
+++ b/libmpeg2/idct_alpha.c	Fri Jan 16 09:21:21 2009 +0000
@@ -24,7 +24,7 @@
 
 #include "config.h"
 
-#ifdef ARCH_ALPHA
+#if ARCH_ALPHA
 
 #include <stdlib.h>
 #include <inttypes.h>
--- a/libmpeg2/idct_altivec.c	Fri Jan 16 08:45:35 2009 +0000
+++ b/libmpeg2/idct_altivec.c	Fri Jan 16 09:21:21 2009 +0000
@@ -23,7 +23,7 @@
 
 #include "config.h"
 
-#ifdef ARCH_PPC
+#if ARCH_PPC
 
 #ifdef HAVE_ALTIVEC_H
 #include <altivec.h>
--- a/libmpeg2/idct_mmx.c	Fri Jan 16 08:45:35 2009 +0000
+++ b/libmpeg2/idct_mmx.c	Fri Jan 16 09:21:21 2009 +0000
@@ -23,7 +23,7 @@
 
 #include "config.h"
 
-#if defined(ARCH_X86) || defined(ARCH_X86_64)
+#if ARCH_X86 || ARCH_X86_64
 
 #include <inttypes.h>
 
--- a/libmpeg2/motion_comp.c	Fri Jan 16 08:45:35 2009 +0000
+++ b/libmpeg2/motion_comp.c	Fri Jan 16 09:21:21 2009 +0000
@@ -37,37 +37,37 @@
 
 void mpeg2_mc_init (uint32_t accel)
 {
-#ifdef HAVE_MMX2
+#if HAVE_MMX2
     if (accel & MPEG2_ACCEL_X86_MMXEXT)
 	mpeg2_mc = mpeg2_mc_mmxext;
     else
 #endif
-#ifdef HAVE_3DNOW
+#if HAVE_3DNOW
     if (accel & MPEG2_ACCEL_X86_3DNOW)
 	mpeg2_mc = mpeg2_mc_3dnow;
     else
 #endif
-#ifdef HAVE_MMX
+#if HAVE_MMX
     if (accel & MPEG2_ACCEL_X86_MMX)
 	mpeg2_mc = mpeg2_mc_mmx;
     else
 #endif
-#ifdef HAVE_ALTIVEC
+#if HAVE_ALTIVEC
     if (accel & MPEG2_ACCEL_PPC_ALTIVEC)
 	mpeg2_mc = mpeg2_mc_altivec;
     else
 #endif
-#ifdef ARCH_ALPHA
+#if ARCH_ALPHA
     if (accel & MPEG2_ACCEL_ALPHA)
 	mpeg2_mc = mpeg2_mc_alpha;
     else
 #endif
-#ifdef HAVE_VIS
+#if HAVE_VIS
     if (accel & MPEG2_ACCEL_SPARC_VIS)
 	mpeg2_mc = mpeg2_mc_vis;
     else
 #endif
-#ifdef ARCH_ARM
+#if ARCH_ARM
     if (accel & MPEG2_ACCEL_ARM)
 	mpeg2_mc = mpeg2_mc_arm;
     else
--- a/libmpeg2/motion_comp_alpha.c	Fri Jan 16 08:45:35 2009 +0000
+++ b/libmpeg2/motion_comp_alpha.c	Fri Jan 16 09:21:21 2009 +0000
@@ -22,7 +22,7 @@
 
 #include "config.h"
 
-#ifdef ARCH_ALPHA
+#if ARCH_ALPHA
 
 #include <inttypes.h>
 
--- a/libmpeg2/motion_comp_altivec.c	Fri Jan 16 08:45:35 2009 +0000
+++ b/libmpeg2/motion_comp_altivec.c	Fri Jan 16 09:21:21 2009 +0000
@@ -23,7 +23,7 @@
 
 #include "config.h"
 
-#ifdef ARCH_PPC
+#if ARCH_PPC
 
 #ifdef HAVE_ALTIVEC_H
 #include <altivec.h>
--- a/libmpeg2/motion_comp_arm.c	Fri Jan 16 08:45:35 2009 +0000
+++ b/libmpeg2/motion_comp_arm.c	Fri Jan 16 09:21:21 2009 +0000
@@ -22,7 +22,7 @@
 
 #include "config.h"
 
-#ifdef ARCH_ARM
+#if ARCH_ARM
 
 #include <inttypes.h>
 
--- a/libmpeg2/motion_comp_mmx.c	Fri Jan 16 08:45:35 2009 +0000
+++ b/libmpeg2/motion_comp_mmx.c	Fri Jan 16 09:21:21 2009 +0000
@@ -23,7 +23,7 @@
 
 #include "config.h"
 
-#if defined(ARCH_X86) || defined(ARCH_X86_64)
+#if ARCH_X86 || ARCH_X86_64
 
 #include <inttypes.h>
 
--- a/libmpeg2/motion_comp_vis.c	Fri Jan 16 08:45:35 2009 +0000
+++ b/libmpeg2/motion_comp_vis.c	Fri Jan 16 09:21:21 2009 +0000
@@ -22,7 +22,7 @@
 
 #include "config.h"
 
-#ifdef ARCH_SPARC
+#if ARCH_SPARC
 
 #include <inttypes.h>
 
--- a/libmpeg2/mpeg2_internal.h	Fri Jan 16 08:45:35 2009 +0000
+++ b/libmpeg2/mpeg2_internal.h	Fri Jan 16 09:21:21 2009 +0000
@@ -238,7 +238,7 @@
 };
 
 typedef struct {
-#ifdef ARCH_PPC
+#if ARCH_PPC
     uint8_t regv[12*16];
 #endif
     int dummy;
--- a/libvo/aclib.c	Fri Jan 16 08:45:35 2009 +0000
+++ b/libvo/aclib.c	Fri Jan 16 09:21:21 2009 +0000
@@ -18,7 +18,7 @@
 //Feel free to fine-tune the above 2, it might be possible to get some speedup with them :)
 
 //#define STATISTICS
-#ifdef ARCH_X86
+#if ARCH_X86
 #define CAN_COMPILE_X86_ASM
 #endif
 
@@ -30,19 +30,19 @@
 
 #ifdef CAN_COMPILE_X86_ASM
 
-#if (defined (HAVE_MMX) && !defined (HAVE_3DNOW) && !defined (HAVE_MMX2)) || defined (RUNTIME_CPUDETECT)
+#if (HAVE_MMX && !HAVE_3DNOW && !HAVE_MMX2) || defined (RUNTIME_CPUDETECT)
 #define COMPILE_MMX
 #endif
 
-#if (defined (HAVE_MMX2) && !defined (HAVE_SSE2)) || defined (RUNTIME_CPUDETECT)
+#if (HAVE_MMX2 && !HAVE_SSE2) || defined (RUNTIME_CPUDETECT)
 #define COMPILE_MMX2
 #endif
 
-#if (defined (HAVE_3DNOW) && !defined (HAVE_MMX2)) || defined (RUNTIME_CPUDETECT)
+#if (HAVE_3DNOW && !HAVE_MMX2) || defined (RUNTIME_CPUDETECT)
 #define COMPILE_3DNOW
 #endif
 
-#if defined (HAVE_SSE2) || defined (RUNTIME_CPUDETECT)
+#if HAVE_SSE2 || defined (RUNTIME_CPUDETECT)
 #define COMPILE_SSE
 #endif
 
@@ -51,12 +51,23 @@
 #undef HAVE_3DNOW
 #undef HAVE_SSE
 #undef HAVE_SSE2
+#define HAVE_MMX 0
+#define HAVE_MMX2 0
+#define HAVE_3DNOW 0
+#define HAVE_SSE 0
+#define HAVE_SSE2 0
 /*
 #ifdef COMPILE_C
 #undef HAVE_MMX
 #undef HAVE_MMX2
 #undef HAVE_3DNOW
-#undef ARCH_X86
+#undef HAVE_SSE
+#undef HAVE_SSE2
+#define HAVE_MMX 0
+#define HAVE_MMX2 0
+#define HAVE_3DNOW 0
+#define HAVE_SSE 0
+#define HAVE_SSE2 0
 #define RENAME(a) a ## _C
 #include "aclib_template.c"
 #endif
@@ -64,11 +75,16 @@
 //MMX versions
 #ifdef COMPILE_MMX
 #undef RENAME
-#define HAVE_MMX
+#undef HAVE_MMX
 #undef HAVE_MMX2
 #undef HAVE_3DNOW
 #undef HAVE_SSE
 #undef HAVE_SSE2
+#define HAVE_MMX 1
+#define HAVE_MMX2 0
+#define HAVE_3DNOW 0
+#define HAVE_SSE 0
+#define HAVE_SSE2 0
 #define RENAME(a) a ## _MMX
 #include "aclib_template.c"
 #endif
@@ -76,11 +92,18 @@
 //MMX2 versions
 #ifdef COMPILE_MMX2
 #undef RENAME
-#define HAVE_MMX
-#define HAVE_MMX2
+#undef HAVE_MMX
+#undef HAVE_MMX2
 #undef HAVE_3DNOW
 #undef HAVE_SSE
 #undef HAVE_SSE2
+#define HAVE_MMX 1
+#define HAVE_MMX2 1
+#define HAVE_3DNOW 0
+#define HAVE_SSE 0
+#define HAVE_SSE2 0
+#define HAVE_MMX
+#define HAVE_MMX2
 #define RENAME(a) a ## _MMX2
 #include "aclib_template.c"
 #endif
@@ -88,11 +111,16 @@
 //3DNOW versions
 #ifdef COMPILE_3DNOW
 #undef RENAME
-#define HAVE_MMX
+#undef HAVE_MMX
 #undef HAVE_MMX2
-#define HAVE_3DNOW
+#undef HAVE_3DNOW
 #undef HAVE_SSE
 #undef HAVE_SSE2
+#define HAVE_MMX 1
+#define HAVE_MMX2 0
+#define HAVE_3DNOW 1
+#define HAVE_SSE 0
+#define HAVE_SSE2 0
 #define RENAME(a) a ## _3DNow
 #include "aclib_template.c"
 #endif
@@ -100,11 +128,16 @@
 //SSE versions (only used on SSE2 cpus)
 #ifdef COMPILE_SSE
 #undef RENAME
-#define HAVE_MMX
-#define HAVE_MMX2
+#undef HAVE_MMX
+#undef HAVE_MMX2
 #undef HAVE_3DNOW
-#define HAVE_SSE
-#define HAVE_SSE2
+#undef HAVE_SSE
+#undef HAVE_SSE2
+#define HAVE_MMX 1
+#define HAVE_MMX2 1
+#define HAVE_3DNOW 0
+#define HAVE_SSE 1
+#define HAVE_SSE2 1
 #define RENAME(a) a ## _SSE
 #include "aclib_template.c"
 #endif
@@ -130,13 +163,13 @@
 #endif //CAN_COMPILE_X86_ASM
 		memcpy(to, from, len); // prior to mmx we use the standart memcpy
 #else
-#ifdef HAVE_SSE2
+#if HAVE_SSE2
 		fast_memcpy_SSE(to, from, len);
-#elif defined (HAVE_MMX2)
+#elif HAVE_MMX2
 		fast_memcpy_MMX2(to, from, len);
-#elif defined (HAVE_3DNOW)
+#elif HAVE_3DNOW
 		fast_memcpy_3DNow(to, from, len);
-#elif defined (HAVE_MMX)
+#elif HAVE_MMX
 		fast_memcpy_MMX(to, from, len);
 #else
 		memcpy(to, from, len); // prior to mmx we use the standart memcpy
@@ -164,13 +197,13 @@
 #endif //CAN_COMPILE_X86_ASM
 		memcpy(to, from, len); // prior to mmx we use the standart memcpy
 #else
-#ifdef HAVE_SSE2
+#if HAVE_SSE2
 		mem2agpcpy_SSE(to, from, len);
-#elif defined (HAVE_MMX2)
+#elif HAVE_MMX2
 		mem2agpcpy_MMX2(to, from, len);
-#elif defined (HAVE_3DNOW)
+#elif HAVE_3DNOW
 		mem2agpcpy_3DNow(to, from, len);
-#elif defined (HAVE_MMX)
+#elif HAVE_MMX
 		mem2agpcpy_MMX(to, from, len);
 #else
 		memcpy(to, from, len); // prior to mmx we use the standart memcpy
--- a/libvo/aclib_template.c	Fri Jan 16 08:45:35 2009 +0000
+++ b/libvo/aclib_template.c	Fri Jan 16 09:21:21 2009 +0000
@@ -3,7 +3,7 @@
   This file contains functions which improve and expand standard C-library
 */
 
-#ifndef HAVE_SSE2
+#if !HAVE_SSE2
 /*
    P3 processor has only one SSE decoder so can execute only 1 sse insn per
    cpu clock, but it has 3 mmx decoders (include load/store unit)
@@ -13,6 +13,7 @@
    I have doubts. Anyway SSE2 version of this code can be written better.
 */
 #undef HAVE_SSE
+#define HAVE_SSE 0
 #endif
 
 
@@ -65,7 +66,7 @@
 
 
 #undef HAVE_ONLY_MMX1
-#if defined(HAVE_MMX) && !defined(HAVE_MMX2) && !defined(HAVE_3DNOW) && !defined(HAVE_SSE)
+#if HAVE_MMX && !HAVE_MMX2 && !HAVE_3DNOW && !HAVE_SSE
 /*  means: mmx v.1. Note: Since we added alignment of destinition it speedups
     of memory copying on PentMMX, Celeron-1 and P2 upto 12% versus
     standard (non MMX-optimized) version.
@@ -76,7 +77,7 @@
 
 
 #undef HAVE_K6_2PLUS
-#if !defined( HAVE_MMX2) && defined( HAVE_3DNOW)
+#if !HAVE_MMX2 && HAVE_3DNOW
 #define HAVE_K6_2PLUS
 #endif
 
@@ -95,7 +96,7 @@
 }
 
 #undef MMREG_SIZE
-#ifdef HAVE_SSE
+#if HAVE_SSE
 #define MMREG_SIZE 16
 #else
 #define MMREG_SIZE 64 //8
@@ -104,23 +105,23 @@
 #undef PREFETCH
 #undef EMMS
 
-#ifdef HAVE_MMX2
+#if HAVE_MMX2
 #define PREFETCH "prefetchnta"
-#elif defined ( HAVE_3DNOW )
+#elif HAVE_3DNOW
 #define PREFETCH  "prefetch"
 #else
 #define PREFETCH " # nop"
 #endif
 
 /* On K6 femms is faster of emms. On K7 femms is directly mapped on emms. */
-#ifdef HAVE_3DNOW
+#if HAVE_3DNOW
 #define EMMS     "femms"
 #else
 #define EMMS     "emms"
 #endif
 
 #undef MOVNTQ
-#ifdef HAVE_MMX2
+#if HAVE_MMX2
 #define MOVNTQ "movntq"
 #else
 #define MOVNTQ "movq"
@@ -183,7 +184,7 @@
            perform reading and writing to be multiple to a number of
            processor's decoders, but it's not always possible.
         */
-#ifdef HAVE_SSE /* Only P3 (may be Cyrix3) */
+#if HAVE_SSE /* Only P3 (may be Cyrix3) */
 	if(((unsigned long)from) & 15)
 	/* if SRC is misaligned */
 	for(; i>0; i--)
@@ -343,12 +344,12 @@
 	}
 
 #endif /* Have SSE */
-#ifdef HAVE_MMX2
+#if HAVE_MMX2
                 /* since movntq is weakly-ordered, a "sfence"
 		 * is needed to become ordered again. */
 		__asm__ volatile ("sfence":::"memory");
 #endif
-#ifndef HAVE_SSE
+#if !HAVE_SSE
 		/* enables to use FPU */
 		__asm__ volatile (EMMS:::"memory");
 #endif
@@ -427,7 +428,7 @@
 		from=((const unsigned char *)from)+64;
 		to=((unsigned char *)to)+64;
 	}
-#ifdef HAVE_MMX2
+#if HAVE_MMX2
                 /* since movntq is weakly-ordered, a "sfence"
 		 * is needed to become ordered again. */
 		__asm__ volatile ("sfence":::"memory");
--- a/libvo/osd.c	Fri Jan 16 08:45:35 2009 +0000
+++ b/libvo/osd.c	Fri Jan 16 09:21:21 2009 +0000
@@ -11,7 +11,7 @@
 #include <inttypes.h>
 #include "cpudetect.h"
 
-#ifdef ARCH_X86
+#if ARCH_X86
 #define CAN_COMPILE_X86_ASM
 #endif
 
@@ -23,21 +23,21 @@
 
 //Note: we have C, X86-nommx, MMX, MMX2, 3DNOW version therse no 3DNOW+MMX2 one
 //Plain C versions
-#if !defined (HAVE_MMX) || defined (RUNTIME_CPUDETECT)
+#if !HAVE_MMX || defined (RUNTIME_CPUDETECT)
 #define COMPILE_C
 #endif
 
 #ifdef CAN_COMPILE_X86_ASM
 
-#if (defined (HAVE_MMX) && !defined (HAVE_3DNOW) && !defined (HAVE_MMX2)) || defined (RUNTIME_CPUDETECT)
+#if (HAVE_MMX && !HAVE_3DNOW && !HAVE_MMX2) || defined (RUNTIME_CPUDETECT)
 #define COMPILE_MMX
 #endif
 
-#if defined (HAVE_MMX2) || defined (RUNTIME_CPUDETECT)
+#if HAVE_MMX2 || defined (RUNTIME_CPUDETECT)
 #define COMPILE_MMX2
 #endif
 
-#if (defined (HAVE_3DNOW) && !defined (HAVE_MMX2)) || defined (RUNTIME_CPUDETECT)
+#if (HAVE_3DNOW && !HAVE_MMX2) || defined (RUNTIME_CPUDETECT)
 #define COMPILE_3DNOW
 #endif
 #endif //CAN_COMPILE_X86_ASM
@@ -45,6 +45,9 @@
 #undef HAVE_MMX
 #undef HAVE_MMX2
 #undef HAVE_3DNOW
+#define HAVE_MMX 0
+#define HAVE_MMX2 0
+#define HAVE_3DNOW 0
 
 #ifndef CAN_COMPILE_X86_ASM
 
@@ -52,6 +55,9 @@
 #undef HAVE_MMX
 #undef HAVE_MMX2
 #undef HAVE_3DNOW
+#define HAVE_MMX 0
+#define HAVE_MMX2 0
+#define HAVE_3DNOW 0
 #define RENAME(a) a ## _C
 #include "osd_template.c"
 #endif
@@ -64,6 +70,9 @@
 #undef HAVE_MMX
 #undef HAVE_MMX2
 #undef HAVE_3DNOW
+#define HAVE_MMX 0
+#define HAVE_MMX2 0
+#define HAVE_3DNOW 0
 #define RENAME(a) a ## _X86
 #include "osd_template.c"
 #endif
@@ -71,9 +80,12 @@
 //MMX versions
 #ifdef COMPILE_MMX
 #undef RENAME
-#define HAVE_MMX
+#undef HAVE_MMX
 #undef HAVE_MMX2
 #undef HAVE_3DNOW
+#define HAVE_MMX 1
+#define HAVE_MMX2 0
+#define HAVE_3DNOW 0
 #define RENAME(a) a ## _MMX
 #include "osd_template.c"
 #endif
@@ -81,9 +93,12 @@
 //MMX2 versions
 #ifdef COMPILE_MMX2
 #undef RENAME
-#define HAVE_MMX
-#define HAVE_MMX2
+#undef HAVE_MMX
+#undef HAVE_MMX2
 #undef HAVE_3DNOW
+#define HAVE_MMX 1
+#define HAVE_MMX2 1
+#define HAVE_3DNOW 0
 #define RENAME(a) a ## _MMX2
 #include "osd_template.c"
 #endif
@@ -91,9 +106,12 @@
 //3DNOW versions
 #ifdef COMPILE_3DNOW
 #undef RENAME
-#define HAVE_MMX
+#undef HAVE_MMX
 #undef HAVE_MMX2
-#define HAVE_3DNOW
+#undef HAVE_3DNOW
+#define HAVE_MMX 1
+#define HAVE_MMX2 0
+#define HAVE_3DNOW 1
 #define RENAME(a) a ## _3DNow
 #include "osd_template.c"
 #endif
@@ -116,13 +134,13 @@
 		vo_draw_alpha_yv12_C(w, h, src, srca, srcstride, dstbase, dststride);
 #endif
 #else //RUNTIME_CPUDETECT
-#ifdef HAVE_MMX2
+#if HAVE_MMX2
 		vo_draw_alpha_yv12_MMX2(w, h, src, srca, srcstride, dstbase, dststride);
-#elif defined (HAVE_3DNOW)
+#elif HAVE_3DNOW
 		vo_draw_alpha_yv12_3DNow(w, h, src, srca, srcstride, dstbase, dststride);
-#elif defined (HAVE_MMX)
+#elif HAVE_MMX
 		vo_draw_alpha_yv12_MMX(w, h, src, srca, srcstride, dstbase, dststride);
-#elif defined(ARCH_X86)
+#elif ARCH_X86
 		vo_draw_alpha_yv12_X86(w, h, src, srca, srcstride, dstbase, dststride);
 #else
 		vo_draw_alpha_yv12_C(w, h, src, srca, srcstride, dstbase, dststride);
@@ -146,13 +164,13 @@
 		vo_draw_alpha_yuy2_C(w, h, src, srca, srcstride, dstbase, dststride);
 #endif
 #else //RUNTIME_CPUDETECT
-#ifdef HAVE_MMX2
+#if HAVE_MMX2
 		vo_draw_alpha_yuy2_MMX2(w, h, src, srca, srcstride, dstbase, dststride);
-#elif defined (HAVE_3DNOW)
+#elif HAVE_3DNOW
 		vo_draw_alpha_yuy2_3DNow(w, h, src, srca, srcstride, dstbase, dststride);
-#elif defined (HAVE_MMX)
+#elif HAVE_MMX
 		vo_draw_alpha_yuy2_MMX(w, h, src, srca, srcstride, dstbase, dststride);
-#elif defined(ARCH_X86)
+#elif ARCH_X86
 		vo_draw_alpha_yuy2_X86(w, h, src, srca, srcstride, dstbase, dststride);
 #else
 		vo_draw_alpha_yuy2_C(w, h, src, srca, srcstride, dstbase, dststride);
@@ -176,13 +194,13 @@
 		vo_draw_alpha_uyvy_C(w, h, src, srca, srcstride, dstbase, dststride);
 #endif
 #else //RUNTIME_CPUDETECT
-#ifdef HAVE_MMX2
+#if HAVE_MMX2
 		vo_draw_alpha_uyvy_MMX2(w, h, src, srca, srcstride, dstbase, dststride);
-#elif defined (HAVE_3DNOW)
+#elif HAVE_3DNOW
 		vo_draw_alpha_uyvy_3DNow(w, h, src, srca, srcstride, dstbase, dststride);
-#elif defined (HAVE_MMX)
+#elif HAVE_MMX
 		vo_draw_alpha_uyvy_MMX(w, h, src, srca, srcstride, dstbase, dststride);
-#elif defined(ARCH_X86)
+#elif ARCH_X86
 		vo_draw_alpha_uyvy_X86(w, h, src, srca, srcstride, dstbase, dststride);
 #else
 		vo_draw_alpha_uyvy_C(w, h, src, srca, srcstride, dstbase, dststride);
@@ -206,13 +224,13 @@
 		vo_draw_alpha_rgb24_C(w, h, src, srca, srcstride, dstbase, dststride);
 #endif
 #else //RUNTIME_CPUDETECT
-#ifdef HAVE_MMX2
+#if HAVE_MMX2
 		vo_draw_alpha_rgb24_MMX2(w, h, src, srca, srcstride, dstbase, dststride);
-#elif defined (HAVE_3DNOW)
+#elif HAVE_3DNOW
 		vo_draw_alpha_rgb24_3DNow(w, h, src, srca, srcstride, dstbase, dststride);
-#elif defined (HAVE_MMX)
+#elif HAVE_MMX
 		vo_draw_alpha_rgb24_MMX(w, h, src, srca, srcstride, dstbase, dststride);
-#elif defined(ARCH_X86)
+#elif ARCH_X86
 		vo_draw_alpha_rgb24_X86(w, h, src, srca, srcstride, dstbase, dststride);
 #else
 		vo_draw_alpha_rgb24_C(w, h, src, srca, srcstride, dstbase, dststride);
@@ -236,13 +254,13 @@
 		vo_draw_alpha_rgb32_C(w, h, src, srca, srcstride, dstbase, dststride);
 #endif
 #else //RUNTIME_CPUDETECT
-#ifdef HAVE_MMX2
+#if HAVE_MMX2
 		vo_draw_alpha_rgb32_MMX2(w, h, src, srca, srcstride, dstbase, dststride);
-#elif defined (HAVE_3DNOW)
+#elif HAVE_3DNOW
 		vo_draw_alpha_rgb32_3DNow(w, h, src, srca, srcstride, dstbase, dststride);
-#elif defined (HAVE_MMX)
+#elif HAVE_MMX
 		vo_draw_alpha_rgb32_MMX(w, h, src, srca, srcstride, dstbase, dststride);
-#elif defined(ARCH_X86)
+#elif ARCH_X86
 		vo_draw_alpha_rgb32_X86(w, h, src, srca, srcstride, dstbase, dststride);
 #else
 		vo_draw_alpha_rgb32_C(w, h, src, srca, srcstride, dstbase, dststride);
@@ -281,13 +299,13 @@
 			mp_msg(MSGT_OSD,MSGL_INFO,"Using Unoptimized OnScreenDisplay\n");
 #endif
 #else //RUNTIME_CPUDETECT
-#ifdef HAVE_MMX2
+#if HAVE_MMX2
 			mp_msg(MSGT_OSD,MSGL_INFO,"Using MMX (with tiny bit MMX2) Optimized OnScreenDisplay\n");
-#elif defined (HAVE_3DNOW)
+#elif HAVE_3DNOW
 			mp_msg(MSGT_OSD,MSGL_INFO,"Using MMX (with tiny bit 3DNow) Optimized OnScreenDisplay\n");
-#elif defined (HAVE_MMX)
+#elif HAVE_MMX
 			mp_msg(MSGT_OSD,MSGL_INFO,"Using MMX Optimized OnScreenDisplay\n");
-#elif defined(ARCH_X86)
+#elif ARCH_X86
 			mp_msg(MSGT_OSD,MSGL_INFO,"Using X86 Optimized OnScreenDisplay\n");
 #else
 			mp_msg(MSGT_OSD,MSGL_INFO,"Using Unoptimized OnScreenDisplay\n");
--- a/libvo/osd_template.c	Fri Jan 16 08:45:35 2009 +0000
+++ b/libvo/osd_template.c	Fri Jan 16 09:21:21 2009 +0000
@@ -7,11 +7,11 @@
 #undef PREFETCHW
 #undef PAVGB
 
-#ifdef HAVE_3DNOW
+#if HAVE_3DNOW
 #define PREFETCH  "prefetch"
 #define PREFETCHW "prefetchw"
 #define PAVGB	  "pavgusb"
-#elif defined ( HAVE_MMX2 )
+#elif HAVE_MMX2
 #define PREFETCH "prefetchnta"
 #define PREFETCHW "prefetcht0"
 #define PAVGB	  "pavgb"
@@ -20,7 +20,7 @@
 #define PREFETCHW " # nop"
 #endif
 
-#ifdef HAVE_3DNOW
+#if HAVE_3DNOW
 /* On K6 femms is faster of emms. On K7 femms is directly mapped on emms. */
 #define EMMS     "femms"
 #else
@@ -29,10 +29,10 @@
 
 static inline void RENAME(vo_draw_alpha_yv12)(int w,int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride){
     int y;
-#if defined(FAST_OSD) && !defined(HAVE_MMX)
+#if defined(FAST_OSD) && !HAVE_MMX
     w=w>>1;
 #endif
-#ifdef HAVE_MMX
+#if HAVE_MMX
     __asm__ volatile(
         "pcmpeqb %%mm5, %%mm5\n\t" // F..F
         "movq %%mm5, %%mm4\n\t"
@@ -43,7 +43,7 @@
 #endif
     for(y=0;y<h;y++){
         register int x;
-#ifdef HAVE_MMX
+#if HAVE_MMX
     __asm__ volatile(
 	PREFETCHW" %0\n\t"
 	PREFETCH" %1\n\t"
@@ -91,7 +91,7 @@
         srca+=srcstride;
         dstbase+=dststride;
     }
-#ifdef HAVE_MMX
+#if HAVE_MMX
 	__asm__ volatile(EMMS:::"memory");
 #endif
     return;
@@ -99,10 +99,10 @@
 
 static inline void RENAME(vo_draw_alpha_yuy2)(int w,int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride){
     int y;
-#if defined(FAST_OSD) && !defined(HAVE_MMX)
+#if defined(FAST_OSD) && !HAVE_MMX
     w=w>>1;
 #endif
-#ifdef HAVE_MMX
+#if HAVE_MMX
     __asm__ volatile(
         "pxor %%mm7, %%mm7\n\t"
         "pcmpeqb %%mm5, %%mm5\n\t" // F..F
@@ -114,7 +114,7 @@
 #endif
     for(y=0;y<h;y++){
         register int x;
-#ifdef HAVE_MMX
+#if HAVE_MMX
     __asm__ volatile(
 	PREFETCHW" %0\n\t"
 	PREFETCH" %1\n\t"
@@ -163,7 +163,7 @@
         srca+=srcstride;
         dstbase+=dststride;
     }
-#ifdef HAVE_MMX
+#if HAVE_MMX
 	__asm__ volatile(EMMS:::"memory");
 #endif
     return;
@@ -195,7 +195,7 @@
 
 static inline void RENAME(vo_draw_alpha_rgb24)(int w,int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride){
     int y;
-#ifdef HAVE_MMX
+#if HAVE_MMX
     __asm__ volatile(
         "pxor %%mm7, %%mm7\n\t"
         "pcmpeqb %%mm6, %%mm6\n\t" // F..F
@@ -204,8 +204,8 @@
     for(y=0;y<h;y++){
         register unsigned char *dst = dstbase;
         register int x;
-#if defined(ARCH_X86) && (!defined(ARCH_X86_64) || defined(HAVE_MMX))
-#ifdef HAVE_MMX
+#if ARCH_X86 && (!ARCH_X86_64 || HAVE_MMX)
+#if HAVE_MMX
     __asm__ volatile(
 	PREFETCHW" %0\n\t"
 	PREFETCH" %1\n\t"
@@ -295,7 +295,7 @@
         srca+=srcstride;
         dstbase+=dststride;
     }
-#ifdef HAVE_MMX
+#if HAVE_MMX
 	__asm__ volatile(EMMS:::"memory");
 #endif
     return;
@@ -306,8 +306,8 @@
 #ifdef WORDS_BIGENDIAN
     dstbase++;
 #endif
-#ifdef HAVE_MMX
-#ifdef HAVE_3DNOW
+#if HAVE_MMX
+#if HAVE_3DNOW
     __asm__ volatile(
         "pxor %%mm7, %%mm7\n\t"
         "pcmpeqb %%mm6, %%mm6\n\t" // F..F
@@ -324,9 +324,9 @@
 #endif /* HAVE_MMX */
     for(y=0;y<h;y++){
         register int x;
-#if defined(ARCH_X86) && (!defined(ARCH_X86_64) || defined(HAVE_MMX))
-#ifdef HAVE_MMX
-#ifdef HAVE_3DNOW
+#if ARCH_X86 && (!ARCH_X86_64 || HAVE_MMX)
+#if HAVE_MMX
+#if HAVE_3DNOW
     __asm__ volatile(
 	PREFETCHW" %0\n\t"
 	PREFETCH" %1\n\t"
@@ -460,7 +460,7 @@
         srca+=srcstride;
         dstbase+=dststride;
     }
-#ifdef HAVE_MMX
+#if HAVE_MMX
 	__asm__ volatile(EMMS:::"memory");
 #endif
     return;
--- a/mp3lib/decod386.c	Fri Jan 16 08:45:35 2009 +0000
+++ b/mp3lib/decod386.c	Fri Jan 16 09:21:21 2009 +0000
@@ -102,7 +102,7 @@
 
 static synth_func_t synth_func;
 
-#ifdef HAVE_ALTIVEC
+#if HAVE_ALTIVEC
 #define dct64_base(a,b,c) if(gCpuCaps.hasAltiVec) dct64_altivec(a,b,c); else dct64(a,b,c)
 #else /* HAVE_ALTIVEC */
 #define dct64_base(a,b,c) dct64(a,b,c)
@@ -121,7 +121,7 @@
   *pnt += 128;
 
 /* optimized for x86 */
-#ifdef ARCH_X86
+#if ARCH_X86
   if ( synth_func )
    {
 //    printf("Calling %p, bandPtr=%p channel=%d samples=%p\n",synth_func,bandPtr,channel,samples);
--- a/mp3lib/sr1.c	Fri Jan 16 08:45:35 2009 +0000
+++ b/mp3lib/sr1.c	Fri Jan 16 09:21:21 2009 +0000
@@ -27,10 +27,12 @@
 
 #include "libvo/fastmemcpy.h"
 
-#ifdef ARCH_X86_64
+#if ARCH_X86_64
 // 3DNow! and 3DNow!Ext routines don't compile under AMD64
 #undef HAVE_3DNOW
 #undef HAVE_3DNOWEX
+#define HAVE_3DNOW 0
+#define HAVE_3DNOWEX 0
 #endif
 
 //static FILE* mp3_file=NULL;
@@ -134,7 +136,7 @@
 //  if(MP3_frames>=7741) printf("getbits_fast: bits=%d  bitsleft=%d  wordptr=%x\n",number_of_bits,bitsleft,wordpointer);
   if((bitsleft-=number_of_bits)<0) return 0;
   if(!number_of_bits) return 0;
-#ifdef ARCH_X86
+#if ARCH_X86
   rval = bswap_16(*((uint16_t *)wordpointer));
 #else
   /*
@@ -177,7 +179,7 @@
 
 LOCAL int stream_head_read(unsigned char *hbuf,uint32_t *newhead){
   if(mp3_read(hbuf,4) != 4) return FALSE;
-#ifdef ARCH_X86
+#if ARCH_X86
   *newhead = bswap_32(*((uint32_t*)hbuf));
 #else
   /*
@@ -413,7 +415,7 @@
 
     make_decode_tables(outscale);
 
-#ifdef HAVE_MMX
+#if HAVE_MMX
     if (gCpuCaps.hasMMX)
     {
 	_has_mmx = 1;
@@ -421,7 +423,7 @@
     }
 #endif
 
-#ifdef HAVE_3DNOWEX
+#if HAVE_3DNOWEX
     if (gCpuCaps.has3DNowExt)
     {
 	dct36_func=dct36_3dnowex;
@@ -430,7 +432,7 @@
     }
     else
 #endif
-#ifdef HAVE_3DNOW
+#if HAVE_3DNOW
     if (gCpuCaps.has3DNow)
     {
 	dct36_func = dct36_3dnow;
@@ -439,7 +441,7 @@
     }
     else
 #endif
-#ifdef HAVE_SSE
+#if HAVE_SSE
     if (gCpuCaps.hasSSE)
     {
 	dct64_MMX_func = dct64_sse;
@@ -447,8 +449,8 @@
     }
     else
 #endif
-#ifdef ARCH_X86_32
-#ifdef HAVE_MMX
+#if ARCH_X86_32
+#if HAVE_MMX
     if (gCpuCaps.hasMMX)
     {
 	dct64_MMX_func = dct64_MMX;
@@ -463,7 +465,7 @@
     }
     else
 #endif /* ARCH_X86_32 */
-#ifdef HAVE_ALTIVEC
+#if HAVE_ALTIVEC
     if (gCpuCaps.hasAltiVec)
     {
 	mp_msg(MSGT_DECAUDIO,MSGL_V,"mp3lib: using AltiVec optimized decore!\n");
--- a/vidix/dha.c	Fri Jan 16 08:45:35 2009 +0000
+++ b/vidix/dha.c	Fri Jan 16 09:21:21 2009 +0000
@@ -43,7 +43,7 @@
 #include <fcntl.h>
 #include <sys/stat.h>
 #include <sys/types.h>
-#ifdef ARCH_ALPHA
+#if ARCH_ALPHA
 #include <sys/io.h>
 #endif
 #include <unistd.h>
@@ -91,7 +91,7 @@
 
 void *map_phys_mem(unsigned long base, unsigned long size)
 {    
-#ifdef ARCH_ALPHA
+#if ARCH_ALPHA
 /* TODO: move it into sysdep */
   base += bus_base();
 #endif