changeset 603:880c6441f56a libavutil

Change semantic of CONFIG_*, HAVE_* and ARCH_*. They are now always defined to either 0 or 1.
author aurel
date Tue, 13 Jan 2009 23:44:16 +0000
parents 0b84593767d8
children 3c748945c2ad
files adler32.c aes.c arm/bswap.h bswap.h common.h crc.c des.c internal.h intreadwrite.h md5.c mem.c mem.h sha1.c x86/bswap.h x86_cpu.h
diffstat 15 files changed, 56 insertions(+), 61 deletions(-) [+]
line wrap: on
line diff
--- 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
--- 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<<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];
--- 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;
--- 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
 
--- 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
--- 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<end-3){
             crc ^= le2me_32(*(const uint32_t*)buffer); buffer+=4;
--- a/des.c	Tue Jan 13 00:14:43 2009 +0000
+++ b/des.c	Tue Jan 13 23:44:16 2009 +0000
@@ -74,7 +74,7 @@
 };
 #undef T
 
-#ifdef CONFIG_SMALL
+#if CONFIG_SMALL
 static const uint8_t S_boxes[8][32] = {
     {
     0x0e, 0xf4, 0x7d, 0x41, 0xe2, 0x2f, 0xdb, 0x18, 0xa3, 0x6a, 0xc6, 0xbc, 0x95, 0x59, 0x30, 0x87,
@@ -218,7 +218,7 @@
     // apply S-boxes, those compress the data again from 8 * 6 to 8 * 4 bits
     for (i = 7; i >= 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;
--- 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<b*b);
 }
 
-#if defined(ARCH_X86)
+#if ARCH_X86
 #define MASK_ABS(mask, level)\
             __asm__ volatile(\
                 "cltd                   \n\t"\
@@ -199,7 +199,7 @@
             level= (level^mask)-mask;
 #endif
 
-#ifdef HAVE_CMOV
+#if HAVE_CMOV
 #define COPY3_IF_LT(x,y,a,b,c,d)\
 __asm__ volatile (\
     "cmpl %0, %3        \n\t"\
@@ -259,42 +259,42 @@
     }\
 }
 
-#ifndef HAVE_LLRINT
+#if !HAVE_LLRINT
 static av_always_inline av_const long long llrint(double x)
 {
     return rint(x);
 }
 #endif /* HAVE_LLRINT */
 
-#ifndef HAVE_LRINT
+#if !HAVE_LRINT
 static av_always_inline av_const long int lrint(double x)
 {
     return rint(x);
 }
 #endif /* HAVE_LRINT */
 
-#ifndef HAVE_LRINTF
+#if !HAVE_LRINTF
 static av_always_inline av_const long int lrintf(float x)
 {
     return (int)(rint(x));
 }
 #endif /* HAVE_LRINTF */
 
-#ifndef HAVE_ROUND
+#if !HAVE_ROUND
 static av_always_inline av_const double round(double x)
 {
     return (x > 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);
--- 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)
--- 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;
--- 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 <stdlib.h>
-#ifdef HAVE_MALLOC_H
+#if HAVE_MALLOC_H
 #include <malloc.h>
 #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);
--- 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
--- 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 ){
--- 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)
 {
--- 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 <stdint.h>
 #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