# HG changeset patch # User aurel # Date 1231890256 0 # Node ID 880c6441f56aad402d7347ed3bcb85c19a936b3f # Parent 0b84593767d8e259d35703d753a2c4d6c803b1c3 Change semantic of CONFIG_*, HAVE_* and ARCH_*. They are now always defined to either 0 or 1. diff -r 0b84593767d8 -r 880c6441f56a adler32.c --- a/adler32.c Tue Jan 13 00:14:43 2009 +0000 +++ b/adler32.c Tue Jan 13 23:44:16 2009 +0000 @@ -35,7 +35,7 @@ unsigned long s2 = adler >> 16; while (len>0) { -#ifdef CONFIG_SMALL +#if CONFIG_SMALL while(len>4 && s2 < (1U<<31)){ DO4(buf); len-=4; #else diff -r 0b84593767d8 -r 880c6441f56a aes.c --- a/aes.c Tue Jan 13 00:14:43 2009 +0000 +++ b/aes.c Tue Jan 13 23:44:16 2009 +0000 @@ -39,7 +39,7 @@ static uint8_t sbox[256]; static uint8_t inv_sbox[256]; -#ifdef CONFIG_SMALL +#if CONFIG_SMALL static uint32_t enc_multbl[1][256]; static uint32_t dec_multbl[1][256]; #else @@ -62,7 +62,7 @@ } static inline int mix_core(uint32_t multbl[4][256], int a, int b, int c, int d){ -#ifdef CONFIG_SMALL +#if CONFIG_SMALL #define ROT(x,s) ((x<>(32-s))) return multbl[0][a] ^ ROT(multbl[0][b], 8) ^ ROT(multbl[0][c], 16) ^ ROT(multbl[0][d], 24); #else @@ -114,7 +114,7 @@ int x= sbox[i>>2]; if(x) tbl[i]= alog8[ log8[x] + log8[c[i&3]] ]; } -#ifndef CONFIG_SMALL +#if !CONFIG_SMALL for(j=256; j<1024; j++) for(i=0; i<4; i++) tbl[4*j+i]= tbl[4*j + ((i-1)&3) - 1024]; diff -r 0b84593767d8 -r 880c6441f56a arm/bswap.h --- a/arm/bswap.h Tue Jan 13 00:14:43 2009 +0000 +++ b/arm/bswap.h Tue Jan 13 23:44:16 2009 +0000 @@ -23,7 +23,7 @@ #include "config.h" #include "libavutil/common.h" -#ifdef HAVE_ARMV6 +#if HAVE_ARMV6 #define bswap_16 bswap_16 static av_always_inline av_const uint16_t bswap_16(uint16_t x) { @@ -35,7 +35,7 @@ #define bswap_32 bswap_32 static av_always_inline av_const uint32_t bswap_32(uint32_t x) { -#ifdef HAVE_ARMV6 +#if HAVE_ARMV6 __asm__("rev %0, %0" : "+r"(x)); #else uint32_t t; diff -r 0b84593767d8 -r 880c6441f56a bswap.h --- a/bswap.h Tue Jan 13 00:14:43 2009 +0000 +++ b/bswap.h Tue Jan 13 23:44:16 2009 +0000 @@ -30,13 +30,13 @@ #include "config.h" #include "common.h" -#if defined(ARCH_ARM) +#if ARCH_ARM # include "arm/bswap.h" -#elif defined(ARCH_BFIN) +#elif ARCH_BFIN # include "bfin/bswap.h" -#elif defined(ARCH_SH4) +#elif ARCH_SH4 # include "sh4/bswap.h" -#elif defined(ARCH_X86) +#elif ARCH_X86 # include "x86/bswap.h" #endif diff -r 0b84593767d8 -r 880c6441f56a common.h --- a/common.h Tue Jan 13 00:14:43 2009 +0000 +++ b/common.h Tue Jan 13 23:44:16 2009 +0000 @@ -154,7 +154,7 @@ /* median of 3 */ static inline av_const int mid_pred(int a, int b, int c) { -#ifdef HAVE_CMOV +#if HAVE_CMOV int i=b; __asm__ volatile( "cmp %2, %1 \n\t" @@ -323,9 +323,9 @@ }\ } -#if defined(ARCH_X86) || defined(ARCH_PPC) || defined(ARCH_BFIN) +#if ARCH_X86 || ARCH_PPC || ARCH_BFIN #define AV_READ_TIME read_time -#if defined(ARCH_X86) +#if ARCH_X86 static inline uint64_t read_time(void) { uint32_t a, d; @@ -366,7 +366,7 @@ return (((uint64_t)tbu)<<32) | (uint64_t)tbl; } #endif -#elif defined(HAVE_GETHRTIME) +#elif HAVE_GETHRTIME #define AV_READ_TIME gethrtime #endif @@ -397,11 +397,11 @@ #endif /** - * Returns NULL if CONFIG_SMALL is defined otherwise the argument + * Returns NULL if CONFIG_SMALL is true otherwise the argument * without modifications, used to disable the definition of strings * (for example AVCodec long_names). */ -#ifdef CONFIG_SMALL +#if CONFIG_SMALL # define NULL_IF_CONFIG_SMALL(x) NULL #else # define NULL_IF_CONFIG_SMALL(x) x diff -r 0b84593767d8 -r 880c6441f56a crc.c --- a/crc.c Tue Jan 13 00:14:43 2009 +0000 +++ b/crc.c Tue Jan 13 23:44:16 2009 +0000 @@ -22,7 +22,7 @@ #include "bswap.h" #include "crc.h" -#ifdef CONFIG_HARDCODED_TABLES +#if CONFIG_HARDCODED_TABLES #include "crc_data.h" #else static struct { @@ -75,7 +75,7 @@ } } ctx[256]=1; -#ifndef CONFIG_SMALL +#if !CONFIG_SMALL if(ctx_size >= sizeof(AVCRC)*1024) for (i = 0; i < 256; i++) for(j=0; j<3; j++) @@ -91,7 +91,7 @@ * @return a pointer to the CRC table or NULL on failure */ const AVCRC *av_crc_get_table(AVCRCId crc_id){ -#ifndef CONFIG_HARDCODED_TABLES +#if !CONFIG_HARDCODED_TABLES if (!av_crc_table[crc_id][FF_ARRAY_ELEMS(av_crc_table[crc_id])-1]) if (av_crc_init(av_crc_table[crc_id], av_crc_table_params[crc_id].le, @@ -113,7 +113,7 @@ uint32_t av_crc(const AVCRC *ctx, uint32_t crc, const uint8_t *buffer, size_t length){ const uint8_t *end= buffer+length; -#ifndef CONFIG_SMALL +#if !CONFIG_SMALL if(!ctx[256]) while(buffer= 0; i--) { uint8_t tmp = (r ^ k) & 0x3f; -#ifdef CONFIG_SMALL +#if CONFIG_SMALL uint8_t v = S_boxes[i][tmp >> 1]; if (tmp & 1) v >>= 4; out = (out >> 4) | (v << 28); @@ -229,7 +229,7 @@ r = (r >> 4) | (r << 28); k >>= 6; } -#ifdef CONFIG_SMALL +#if CONFIG_SMALL out = shuffle(out, P_shuffle, sizeof(P_shuffle)); #endif return out; diff -r 0b84593767d8 -r 880c6441f56a internal.h --- a/internal.h Tue Jan 13 00:14:43 2009 +0000 +++ b/internal.h Tue Jan 13 23:44:16 2009 +0000 @@ -102,7 +102,7 @@ #endif // Use rip-relative addressing if compiling PIC code on x86-64. -#if defined(ARCH_X86_64) && defined(PIC) +#if ARCH_X86_64 && defined(PIC) # define LOCAL_MANGLE(a) #a "(%%rip)" #else # define LOCAL_MANGLE(a) #a @@ -125,7 +125,7 @@ extern const uint32_t ff_inverse[256]; -#if defined(ARCH_X86) +#if ARCH_X86 # define FASTDIV(a,b) \ ({\ int ret,dmy;\ @@ -136,7 +136,7 @@ );\ ret;\ }) -#elif defined(HAVE_ARMV6) +#elif HAVE_ARMV6 static inline av_const int FASTDIV(int a, int b) { int r, t; @@ -147,7 +147,7 @@ : "=&r"(r), "=&r"(t) : "r"(a), "r"(b), "r"(ff_inverse)); return r; } -#elif defined(ARCH_ARM) +#elif ARCH_ARM static inline av_const int FASTDIV(int a, int b) { int r, t; @@ -155,7 +155,7 @@ : "=&r"(r), "=&r"(t) : "r"(a), "r"(ff_inverse[b])); return r; } -#elif defined(CONFIG_FASTDIV) +#elif CONFIG_FASTDIV # define FASTDIV(a,b) ((uint32_t)((((uint64_t)a)*ff_inverse[b])>>32)) #else # define FASTDIV(a,b) ((a)/(b)) @@ -171,7 +171,7 @@ if(a<255) return (ff_sqrt_tab[a+1]-1)>>4; else if(a<(1<<12)) b= ff_sqrt_tab[a>>4 ]>>2; -#ifndef CONFIG_SMALL +#if !CONFIG_SMALL else if(a<(1<<14)) b= ff_sqrt_tab[a>>6 ]>>1; else if(a<(1<<16)) b= ff_sqrt_tab[a>>8 ] ; #endif @@ -185,7 +185,7 @@ return b - (a 0) ? floor(x + 0.5) : ceil(x - 0.5); } #endif /* HAVE_ROUND */ -#ifndef HAVE_ROUNDF +#if !HAVE_ROUNDF static av_always_inline av_const float roundf(float x) { return (x > 0) ? floor(x + 0.5) : ceil(x - 0.5); } #endif /* HAVE_ROUNDF */ -#ifndef HAVE_TRUNCF +#if !HAVE_TRUNCF static av_always_inline av_const float truncf(float x) { return (x > 0) ? floor(x) : ceil(x); diff -r 0b84593767d8 -r 880c6441f56a intreadwrite.h --- a/intreadwrite.h Tue Jan 13 00:14:43 2009 +0000 +++ b/intreadwrite.h Tue Jan 13 23:44:16 2009 +0000 @@ -66,7 +66,7 @@ #define AV_RL8(x) AV_RB8(x) #define AV_WL8(p, d) AV_WB8(p, d) -#ifdef HAVE_FAST_UNALIGNED +#if HAVE_FAST_UNALIGNED # ifdef WORDS_BIGENDIAN # define AV_RB16(x) AV_RN16(x) # define AV_WB16(p, d) AV_WN16(p, d) diff -r 0b84593767d8 -r 880c6441f56a md5.c --- a/md5.c Tue Jan 13 00:14:43 2009 +0000 +++ b/md5.c Tue Jan 13 23:44:16 2009 +0000 @@ -98,7 +98,7 @@ X[i]= bswap_32(X[i]); #endif -#ifdef CONFIG_SMALL +#if CONFIG_SMALL for( i = 0; i < 64; i++ ){ CORE(i,a,b,c,d) t=d; d=c; c=b; b=a; a=t; diff -r 0b84593767d8 -r 880c6441f56a mem.c --- a/mem.c Tue Jan 13 00:14:43 2009 +0000 +++ b/mem.c Tue Jan 13 23:44:16 2009 +0000 @@ -32,7 +32,7 @@ #undef realloc #include -#ifdef HAVE_MALLOC_H +#if HAVE_MALLOC_H #include #endif @@ -43,7 +43,7 @@ void *av_malloc(unsigned int size) { void *ptr = NULL; -#ifdef CONFIG_MEMALIGN_HACK +#if CONFIG_MEMALIGN_HACK long diff; #endif @@ -51,16 +51,16 @@ if(size > (INT_MAX-16) ) return NULL; -#ifdef CONFIG_MEMALIGN_HACK +#if CONFIG_MEMALIGN_HACK ptr = malloc(size+16); if(!ptr) return ptr; diff= ((-(long)ptr - 1)&15) + 1; ptr = (char*)ptr + diff; ((char*)ptr)[-1]= diff; -#elif defined (HAVE_POSIX_MEMALIGN) +#elif HAVE_POSIX_MEMALIGN posix_memalign(&ptr,16,size); -#elif defined (HAVE_MEMALIGN) +#elif HAVE_MEMALIGN ptr = memalign(16,size); /* Why 64? Indeed, we should align it: @@ -96,7 +96,7 @@ void *av_realloc(void *ptr, unsigned int size) { -#ifdef CONFIG_MEMALIGN_HACK +#if CONFIG_MEMALIGN_HACK int diff; #endif @@ -104,7 +104,7 @@ if(size > (INT_MAX-16) ) return NULL; -#ifdef CONFIG_MEMALIGN_HACK +#if CONFIG_MEMALIGN_HACK //FIXME this isn't aligned correctly, though it probably isn't needed if(!ptr) return av_malloc(size); diff= ((char*)ptr)[-1]; @@ -118,7 +118,7 @@ { /* XXX: this test should not be needed on most libcs */ if (ptr) -#ifdef CONFIG_MEMALIGN_HACK +#if CONFIG_MEMALIGN_HACK free((char*)ptr - ((char*)ptr)[-1]); #else free(ptr); diff -r 0b84593767d8 -r 880c6441f56a mem.h --- a/mem.h Tue Jan 13 00:14:43 2009 +0000 +++ b/mem.h Tue Jan 13 23:44:16 2009 +0000 @@ -37,7 +37,7 @@ #elif defined(_MSC_VER) #define DECLARE_ALIGNED(n,t,v) __declspec(align(n)) t v #define DECLARE_ASM_CONST(n,t,v) __declspec(align(n)) static const t v -#elif defined(HAVE_INLINE_ASM) +#elif HAVE_INLINE_ASM #error The asm code needs alignment, but we do not know how to do it for this compiler. #else #define DECLARE_ALIGNED(n,t,v) t v diff -r 0b84593767d8 -r 880c6441f56a sha1.c --- a/sha1.c Tue Jan 13 00:14:43 2009 +0000 +++ b/sha1.c Tue Jan 13 23:44:16 2009 +0000 @@ -54,7 +54,7 @@ c = state[2]; d = state[3]; e = state[4]; -#ifdef CONFIG_SMALL +#if CONFIG_SMALL for(i=0; i<80; i++){ int t; if(i<16) t= be2me_32(((uint32_t*)buffer)[i]); @@ -110,7 +110,7 @@ j = ctx->count & 63; ctx->count += len; -#ifdef CONFIG_SMALL +#if CONFIG_SMALL for( i = 0; i < len; i++ ){ ctx->buffer[ j++ ] = data[i]; if( 64 == j ){ diff -r 0b84593767d8 -r 880c6441f56a x86/bswap.h --- a/x86/bswap.h Tue Jan 13 00:14:43 2009 +0000 +++ b/x86/bswap.h Tue Jan 13 23:44:16 2009 +0000 @@ -38,7 +38,7 @@ #define bswap_32 bswap_32 static av_always_inline av_const uint32_t bswap_32(uint32_t x) { -#ifdef HAVE_BSWAP +#if HAVE_BSWAP __asm__("bswap %0" : "+r" (x)); #else __asm__("rorw $8, %w0 \n\t" @@ -49,7 +49,7 @@ return x; } -#ifdef ARCH_X86_64 +#if ARCH_X86_64 #define bswap_64 bswap_64 static inline uint64_t av_const bswap_64(uint64_t x) { diff -r 0b84593767d8 -r 880c6441f56a x86_cpu.h --- a/x86_cpu.h Tue Jan 13 00:14:43 2009 +0000 +++ b/x86_cpu.h Tue Jan 13 23:44:16 2009 +0000 @@ -24,7 +24,7 @@ #include #include "config.h" -#ifdef ARCH_X86_64 +#if ARCH_X86_64 # define REG_a "rax" # define REG_b "rbx" # define REG_c "rcx" @@ -64,15 +64,10 @@ # define REGSP esp #endif -#if defined(ARCH_X86_64) || (defined(ARCH_X86_32) && defined(HAVE_EBX_AVAILABLE) && defined(HAVE_EBP_AVAILABLE)) -# define HAVE_7REGS 1 -#endif +#define HAVE_7REGS (ARCH_X86_64 || (HAVE_EBX_AVAILABLE && HAVE_EBP_AVAILABLE)) +#define HAVE_6REGS (ARCH_X86_64 || (HAVE_EBX_AVAILABLE || HAVE_EBP_AVAILABLE)) -#if defined(ARCH_X86_64) || (defined(ARCH_X86_32) && (defined(HAVE_EBX_AVAILABLE) || defined(HAVE_EBP_AVAILABLE))) -# define HAVE_6REGS 1 -#endif - -#if defined(ARCH_X86_64) && defined(PIC) +#if ARCH_X86_64 && defined(PIC) # define BROKEN_RELOCATIONS 1 #endif