summaryrefslogtreecommitdiff
path: root/libavutil
diff options
context:
space:
mode:
authorAurelien Jacobs <aurel@gnuage.org>2009-01-13 23:44:16 +0000
committerAurelien Jacobs <aurel@gnuage.org>2009-01-13 23:44:16 +0000
commitb250f9c66d3ddd84652d158fb979a5f21e3f2c71 (patch)
treeef84366029d6f8af6ed82e90c5f188bb7dfc844d /libavutil
parent959da985b03570cfe7d239c0ba6d550ecb04c460 (diff)
downloadffmpeg-b250f9c66d3ddd84652d158fb979a5f21e3f2c71.tar.gz
Change semantic of CONFIG_*, HAVE_* and ARCH_*.
They are now always defined to either 0 or 1. Originally committed as revision 16590 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavutil')
-rw-r--r--libavutil/adler32.c2
-rw-r--r--libavutil/aes.c6
-rw-r--r--libavutil/arm/bswap.h4
-rw-r--r--libavutil/bswap.h8
-rw-r--r--libavutil/common.h12
-rw-r--r--libavutil/crc.c8
-rw-r--r--libavutil/des.c6
-rw-r--r--libavutil/internal.h28
-rw-r--r--libavutil/intreadwrite.h2
-rw-r--r--libavutil/md5.c2
-rw-r--r--libavutil/mem.c16
-rw-r--r--libavutil/mem.h2
-rw-r--r--libavutil/sha1.c4
-rw-r--r--libavutil/x86/bswap.h4
-rw-r--r--libavutil/x86_cpu.h13
15 files changed, 56 insertions, 61 deletions
diff --git a/libavutil/adler32.c b/libavutil/adler32.c
index 148664e532..dad8dabed1 100644
--- a/libavutil/adler32.c
+++ b/libavutil/adler32.c
@@ -35,7 +35,7 @@ unsigned long av_adler32_update(unsigned long adler, const uint8_t *buf, unsigne
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 --git a/libavutil/aes.c b/libavutil/aes.c
index 5030dac487..1631cb6543 100644
--- a/libavutil/aes.c
+++ b/libavutil/aes.c
@@ -39,7 +39,7 @@ static const uint8_t rcon[10] = {
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 void subshift(uint8_t s0[2][16], int s, uint8_t *box){
}
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 @@ static void init_multbl2(uint8_t tbl[1024], int c[4], uint8_t *log8, uint8_t *al
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 --git a/libavutil/arm/bswap.h b/libavutil/arm/bswap.h
index deb739407b..65c73c5ccb 100644
--- a/libavutil/arm/bswap.h
+++ b/libavutil/arm/bswap.h
@@ -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 @@ static av_always_inline av_const uint16_t bswap_16(uint16_t x)
#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 --git a/libavutil/bswap.h b/libavutil/bswap.h
index 100ed1c262..41e98d4649 100644
--- a/libavutil/bswap.h
+++ b/libavutil/bswap.h
@@ -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 --git a/libavutil/common.h b/libavutil/common.h
index d66120fa66..ddeecad7dc 100644
--- a/libavutil/common.h
+++ b/libavutil/common.h
@@ -154,7 +154,7 @@ static inline av_const int av_log2_16bit(unsigned int v)
/* 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 @@ static inline av_pure int ff_get_fourcc(const char *s){
}\
}
-#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 @@ static inline uint64_t read_time(void)
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 @@ tend= AV_READ_TIME();\
#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 --git a/libavutil/crc.c b/libavutil/crc.c
index cc968024d3..8b8a90e6a5 100644
--- a/libavutil/crc.c
+++ b/libavutil/crc.c
@@ -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 @@ int av_crc_init(AVCRC *ctx, int le, int bits, uint32_t poly, int ctx_size){
}
}
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 @@ int av_crc_init(AVCRC *ctx, int le, int bits, uint32_t poly, int ctx_size){
* @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 @@ const AVCRC *av_crc_get_table(AVCRCId crc_id){
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;
diff --git a/libavutil/des.c b/libavutil/des.c
index 43a14f6e6e..51d73a3c1e 100644
--- a/libavutil/des.c
+++ b/libavutil/des.c
@@ -74,7 +74,7 @@ static const uint8_t PC2_shuffle[] = {
};
#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 @@ static uint32_t f_func(uint32_t r, uint64_t k) {
// 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 @@ static uint32_t f_func(uint32_t r, uint64_t k) {
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 --git a/libavutil/internal.h b/libavutil/internal.h
index 957566026d..52fa7e8c97 100644
--- a/libavutil/internal.h
+++ b/libavutil/internal.h
@@ -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 @@ extern const uint32_t ff_inverse[256];
);\
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 @@ static inline av_const int FASTDIV(int a, int b)
: "=&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 @@ static inline av_const int FASTDIV(int a, int b)
: "=&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 @@ static inline av_const unsigned int ff_sqrt(unsigned int a)
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 @@ static inline av_const unsigned int ff_sqrt(unsigned int a)
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 @@ static inline av_const unsigned int ff_sqrt(unsigned int a)
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 @@ if((y)<(x)){\
}\
}
-#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);
diff --git a/libavutil/intreadwrite.h b/libavutil/intreadwrite.h
index 535fdd2dfe..7c5909ea51 100644
--- a/libavutil/intreadwrite.h
+++ b/libavutil/intreadwrite.h
@@ -66,7 +66,7 @@ struct unaligned_16 { uint16_t l; } __attribute__((packed));
#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 --git a/libavutil/md5.c b/libavutil/md5.c
index 87b4026dc1..289fa56d72 100644
--- a/libavutil/md5.c
+++ b/libavutil/md5.c
@@ -98,7 +98,7 @@ static void body(uint32_t ABCD[4], uint32_t X[16]){
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 --git a/libavutil/mem.c b/libavutil/mem.c
index 328bef787c..95299a1c0b 100644
--- a/libavutil/mem.c
+++ b/libavutil/mem.c
@@ -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 @@ void *av_malloc(unsigned int size)
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_malloc(unsigned int size)
void *av_realloc(void *ptr, unsigned int size)
{
-#ifdef CONFIG_MEMALIGN_HACK
+#if CONFIG_MEMALIGN_HACK
int diff;
#endif
@@ -104,7 +104,7 @@ void *av_realloc(void *ptr, unsigned int size)
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 @@ void av_free(void *ptr)
{
/* 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 --git a/libavutil/mem.h b/libavutil/mem.h
index 3ea9858236..ec6e3b7456 100644
--- a/libavutil/mem.h
+++ b/libavutil/mem.h
@@ -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 --git a/libavutil/sha1.c b/libavutil/sha1.c
index 61ad38de28..72c2726e3b 100644
--- a/libavutil/sha1.c
+++ b/libavutil/sha1.c
@@ -54,7 +54,7 @@ static void transform(uint32_t state[5], const uint8_t buffer[64]){
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 @@ void av_sha1_update(AVSHA1* ctx, const uint8_t* data, unsigned int len){
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 --git a/libavutil/x86/bswap.h b/libavutil/x86/bswap.h
index c52b5290e1..0ff8a93385 100644
--- a/libavutil/x86/bswap.h
+++ b/libavutil/x86/bswap.h
@@ -38,7 +38,7 @@ static av_always_inline av_const uint16_t bswap_16(uint16_t x)
#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 @@ static av_always_inline av_const uint32_t bswap_32(uint32_t x)
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 --git a/libavutil/x86_cpu.h b/libavutil/x86_cpu.h
index 4b5f10527e..d29b7d8ad9 100644
--- a/libavutil/x86_cpu.h
+++ b/libavutil/x86_cpu.h
@@ -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 @@ typedef int32_t x86_reg;
# 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
-
-#if defined(ARCH_X86_64) || (defined(ARCH_X86_32) && (defined(HAVE_EBX_AVAILABLE) || defined(HAVE_EBP_AVAILABLE)))
-# define HAVE_6REGS 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(PIC)
+#if ARCH_X86_64 && defined(PIC)
# define BROKEN_RELOCATIONS 1
#endif