1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
|
/*
** FAAD - Freeware Advanced Audio Decoder
** Copyright (C) 2002 M. Bakker
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** $Id: common.h,v 1.3 2002/10/22 04:46:22 storri Exp $
**/
#ifndef __COMMON_H__
#define __COMMON_H__
#ifdef __cplusplus
extern "C" {
#endif
#ifdef LINUX
#define INLINE inline
#else
#ifdef _WIN32
#define INLINE __inline
#else
#define INLINE
#endif
#endif
#ifndef max
#define max(a, b) (((a) > (b)) ? (a) : (b))
#endif
#ifndef min
#define min(a, b) (((a) < (b)) ? (a) : (b))
#endif
#ifndef LN2
#define LN2 0.6931471805599453
#endif
#ifndef LN05
#define LN05 -LN2
#endif
/* COMPILE TIME DEFINITIONS */
/* use the somewhat faster, but a lot larger FFTW library */
/* #define USE_FFTW */
/* use double precision */
/* #define USE_DOUBLE_PRECISION */
/* #define SBR */
#define ERROR_RESILIENCE
/* Allow decoding of MAIN profile AAC */
#define MAIN_DEC
/* Allow decoding of LTP profile AAC */
#define LTP_DEC
/* Allow decoding of LD profile AAC */
#define LD_DEC
/* LD can't do without LTP */
#ifdef LD_DEC
#ifndef ERROR_RESILIENCE
#define ERROR_RESILIENCE
#endif
#ifndef LTP_DEC
#define LTP_DEC
#endif
#endif
/* END COMPILE TIME DEFINITIONS */
#if defined(_WIN32)
typedef unsigned __int32 uint32_t;
typedef unsigned __int16 uint16_t;
typedef unsigned __int8 uint8_t;
typedef __int32 int32_t;
typedef __int16 int16_t;
typedef __int8 int8_t;
typedef float float32_t;
#elif defined(LINUX) || defined(DJGPP)
#if defined(LINUX)
#include <stdint.h>
#else
typedef unsigned long uint32_t;
typedef unsigned short uint16_t;
typedef unsigned char uint8_t;
typedef long int32_t;
typedef short int16_t;
typedef char int8_t;
typedef float float32_t;
#endif
#else /* Some other OS */
#include <inttypes.h>
#endif
#ifndef USE_DOUBLE_PRECISION
typedef float real_t;
#define MUL(A,B) ((A)*(B))
#ifdef __ICL /* only Intel C compiler has fmath ??? */
#include <mathf.h>
#define sin sinf
#define cos cosf
#define log logf
#define exp expf
#define floor floorf
#define ceil ceilf
#define sqrt sqrtf
#else
#include <math.h>
#ifdef HAVE_SINF
# define sin sinf
#endif
#ifdef HAVE_COSF
# define cos cosf
#endif
#ifdef HAVE_LOGF
# define log logf
#endif
#ifdef HAVE_EXPF
# define exp expf
#endif
#ifdef HAVE_FLOORF
# define floor floorf
#endif
#ifdef HAVE_FLOORF
# define ceil ceilf
#endif
#ifdef HAVE_SQRTF
# define sqrt sqrtf
#endif
#endif
#else
typedef double real_t;
#include <math.h>
#define MUL(A,B) ((A)*(B))
#endif
typedef struct {
real_t re;
real_t im;
} complex_t;
/* common functions */
uint32_t int_log2(uint32_t val);
#ifndef M_PI
#define M_PI 3.14159265358979323846f
#endif
#ifndef M_PI_2 /* PI/2 */
#define M_PI_2 1.57079632679489661923
#endif
#ifdef __cplusplus
}
#endif
#endif
|