annotate Input/aac/libfaad2/common.h @ 53:710d8b266d7e trunk

[svn] Cleaning autogenerated files
author msameer
date Thu, 27 Oct 2005 12:54:05 -0700
parents f013913a30e5
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
1 /*
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
2 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
3 ** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
4 **
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
5 ** This program is free software; you can redistribute it and/or modify
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
6 ** it under the terms of the GNU General Public License as published by
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
7 ** the Free Software Foundation; either version 2 of the License, or
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
8 ** (at your option) any later version.
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
9 **
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
10 ** This program is distributed in the hope that it will be useful,
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
11 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
12 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
13 ** GNU General Public License for more details.
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
14 **
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
15 ** You should have received a copy of the GNU General Public License
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
16 ** along with this program; if not, write to the Free Software
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
17 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
18 **
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
19 ** Any non-GPL usage of this software or parts of this software is strictly
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
20 ** forbidden.
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
21 **
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
22 ** Commercial non-GPL licensing of this software is possible.
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
23 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
24 **
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
25 ** $Id: common.h,v 1.38 2003/11/12 20:47:57 menno Exp $
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
26 **/
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
27
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
28 #ifndef __COMMON_H__
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
29 #define __COMMON_H__
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
30
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
31 #ifdef __cplusplus
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
32 extern "C" {
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
33 #endif
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
34
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
35 #define INLINE __inline
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
36
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
37 #ifndef max
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
38 #define max(a, b) (((a) > (b)) ? (a) : (b))
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
39 #endif
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
40 #ifndef min
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
41 #define min(a, b) (((a) < (b)) ? (a) : (b))
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
42 #endif
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
43
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
44 /* COMPILE TIME DEFINITIONS */
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
45
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
46 /* use double precision */
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
47 /* #define USE_DOUBLE_PRECISION */
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
48 /* use fixed point reals */
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
49 //#define FIXED_POINT
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
50
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
51 #ifdef _WIN32_WCE
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
52 #define FIXED_POINT
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
53 #endif
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
54
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
55
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
56 #define ERROR_RESILIENCE
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
57
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
58
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
59 /* Allow decoding of MAIN profile AAC */
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
60 #define MAIN_DEC
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
61 /* Allow decoding of SSR profile AAC */
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
62 //#define SSR_DEC
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
63 /* Allow decoding of LTP profile AAC */
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
64 #define LTP_DEC
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
65 /* Allow decoding of LD profile AAC */
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
66 #define LD_DEC
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
67 /* Allow decoding of Digital Radio Mondiale (DRM) */
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
68 //#define DRM
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
69
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
70 /* LD can't do without LTP */
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
71 #ifdef LD_DEC
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
72 #ifndef ERROR_RESILIENCE
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
73 #define ERROR_RESILIENCE
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
74 #endif
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
75 #ifndef LTP_DEC
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
76 #define LTP_DEC
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
77 #endif
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
78 #endif
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
79
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
80 #define ALLOW_SMALL_FRAMELENGTH
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
81
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
82
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
83 // Define LC_ONLY_DECODER if you want a pure AAC LC decoder (independant of SBR_DEC)
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
84 //#define LC_ONLY_DECODER
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
85 #ifdef LC_ONLY_DECODER
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
86 #undef LTP_DEC
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
87 #undef MAIN_DEC
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
88 #undef SSR_DEC
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
89 #undef DRM
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
90 #undef ALLOW_SMALL_FRAMELENGTH
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
91 #undef ERROR_RESILIENCE
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
92 #endif
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
93
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
94 #define SBR_DEC
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
95 //#define SBR_LOW_POWER
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
96
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
97 /* FIXED POINT: No MAIN decoding, forced SBR Low Power decoder */
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
98 #ifdef FIXED_POINT
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
99 # ifdef MAIN_DEC
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
100 # undef MAIN_DEC
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
101 # endif
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
102 # ifndef SBR_LOW_POWER
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
103 # define SBR_LOW_POWER
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
104 # endif
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
105 #endif // FIXED_POINT
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
106
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
107 #ifdef FIXED_POINT
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
108 #define SBR_DIV(A, B) (((int64_t)A << REAL_BITS)/B)
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
109 #else
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
110 #define SBR_DIV(A, B) ((A)/(B))
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
111 #endif
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
112
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
113 #ifndef SBR_LOW_POWER
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
114 #define qmf_t complex_t
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
115 #define QMF_RE(A) RE(A)
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
116 #define QMF_IM(A) IM(A)
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
117 #else
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
118 #define qmf_t real_t
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
119 #define QMF_RE(A) (A)
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
120 #define QMF_IM(A)
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
121 #endif
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
122
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
123
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
124 /* END COMPILE TIME DEFINITIONS */
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
125
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
126 #ifndef FIXED_POINT
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
127 #define POW_TABLE_SIZE 200
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
128 #endif
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
129
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
130
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
131 #if defined(_WIN32)
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
132
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
133
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
134 typedef unsigned __int64 uint64_t;
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
135 typedef unsigned __int32 uint32_t;
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
136 typedef unsigned __int16 uint16_t;
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
137 typedef unsigned __int8 uint8_t;
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
138 typedef __int64 int64_t;
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
139 typedef __int32 int32_t;
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
140 typedef __int16 int16_t;
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
141 typedef __int8 int8_t;
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
142 typedef float float32_t;
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
143
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
144
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
145 #else
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
146
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
147 #ifdef HAVE_CONFIG_H
5
f013913a30e5 [svn] - libfaad fixes.
nenolod
parents: 2
diff changeset
148 # include "../../../config.h"
2
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
149 #endif
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
150
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
151 #include <stdio.h>
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
152 #if HAVE_SYS_TYPES_H
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
153 # include <sys/types.h>
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
154 #endif
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
155 #if HAVE_SYS_STAT_H
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
156 # include <sys/stat.h>
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
157 #endif
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
158 #if STDC_HEADERS
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
159 # include <stdlib.h>
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
160 # include <stddef.h>
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
161 #else
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
162 # if HAVE_STDLIB_H
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
163 # include <stdlib.h>
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
164 # endif
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
165 #endif
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
166 #if HAVE_STRING_H
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
167 # if !STDC_HEADERS && HAVE_MEMORY_H
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
168 # include <memory.h>
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
169 # endif
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
170 # include <string.h>
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
171 #endif
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
172 #if HAVE_STRINGS_H
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
173 # include <strings.h>
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
174 #endif
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
175 #if HAVE_INTTYPES_H
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
176 # include <inttypes.h>
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
177 #else
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
178 # if HAVE_STDINT_H
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
179 # include <stdint.h>
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
180 # else
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
181 /* we need these... */
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
182 typedef unsigned long long uint64_t;
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
183 typedef unsigned long uint32_t;
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
184 typedef unsigned short uint16_t;
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
185 typedef unsigned char uint8_t;
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
186 typedef long long int64_t;
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
187 typedef long int32_t;
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
188 typedef short int16_t;
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
189 typedef char int8_t;
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
190 # endif
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
191 #endif
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
192 #if HAVE_UNISTD_H
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
193 # include <unistd.h>
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
194 #endif
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
195
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
196 #ifndef HAVE_FLOAT32_T
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
197 typedef float float32_t;
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
198 #endif
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
199
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
200 #if STDC_HEADERS
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
201 # include <string.h>
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
202 #else
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
203 # if !HAVE_STRCHR
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
204 # define strchr index
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
205 # define strrchr rindex
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
206 # endif
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
207 char *strchr(), *strrchr();
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
208 # if !HAVE_MEMCPY
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
209 # define memcpy(d, s, n) bcopy((s), (d), (n))
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
210 # define memmove(d, s, n) bcopy((s), (d), (n))
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
211 # endif
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
212 #endif
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
213
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
214 #endif
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
215
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
216 #ifdef WORDS_BIGENDIAN
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
217 #define ARCH_IS_BIG_ENDIAN
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
218 #endif
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
219
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
220 /* FIXED_POINT doesn't work with MAIN and SSR yet */
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
221 #ifdef FIXED_POINT
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
222 #undef MAIN_DEC
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
223 #undef SSR_DEC
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
224 #endif
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
225
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
226
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
227 #if defined(FIXED_POINT)
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
228
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
229 #ifdef HAS_MATHF_H
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
230 #include <mathf.h>
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
231 #else
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
232 #include <math.h>
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
233 #endif
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
234
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
235 #include "fixed.h"
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
236
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
237 #elif defined(USE_DOUBLE_PRECISION)
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
238
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
239 typedef double real_t;
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
240
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
241 #include <math.h>
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
242
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
243 #define MUL_R(A,B) ((A)*(B))
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
244 #define MUL_C(A,B) ((A)*(B))
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
245 #define MUL_F(A,B) ((A)*(B))
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
246
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
247 /* Complex multiplication */
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
248 static INLINE void ComplexMult(real_t *y1, real_t *y2,
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
249 real_t x1, real_t x2, real_t c1, real_t c2)
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
250 {
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
251 *y1 = MUL_F(x1, c1) + MUL_F(x2, c2);
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
252 *y2 = MUL_F(x2, c1) - MUL_F(x1, c2);
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
253 }
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
254
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
255 #define REAL_CONST(A) ((real_t)(A))
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
256 #define COEF_CONST(A) ((real_t)(A))
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
257 #define FRAC_CONST(A) ((real_t)(A)) /* pure fractional part */
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
258
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
259 #else /* Normal floating point operation */
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
260
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
261 typedef float real_t;
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
262
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
263 #define MUL_R(A,B) ((A)*(B))
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
264 #define MUL_C(A,B) ((A)*(B))
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
265 #define MUL_F(A,B) ((A)*(B))
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
266
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
267 #define REAL_CONST(A) ((real_t)(A))
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
268 #define COEF_CONST(A) ((real_t)(A))
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
269 #define FRAC_CONST(A) ((real_t)(A)) /* pure fractional part */
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
270
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
271 /* Complex multiplication */
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
272 static INLINE void ComplexMult(real_t *y1, real_t *y2,
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
273 real_t x1, real_t x2, real_t c1, real_t c2)
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
274 {
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
275 *y1 = MUL_F(x1, c1) + MUL_F(x2, c2);
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
276 *y2 = MUL_F(x2, c1) - MUL_F(x1, c2);
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
277 }
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
278
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
279
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
280 #ifdef _WIN32
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
281 #define HAS_LRINTF
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
282 static INLINE int lrintf(float f)
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
283 {
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
284 int i;
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
285 __asm
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
286 {
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
287 fld f
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
288 fistp i
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
289 }
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
290 return i;
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
291 }
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
292 #endif
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
293
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
294
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
295 #ifdef __ICL /* only Intel C compiler has fmath ??? */
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
296
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
297 #include <mathf.h>
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
298
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
299 #define sin sinf
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
300 #define cos cosf
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
301 #define log logf
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
302 #define floor floorf
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
303 #define ceil ceilf
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
304 #define sqrt sqrtf
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
305
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
306 #else
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
307
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
308 #ifdef HAVE_LRINTF
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
309 # define HAS_LRINTF
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
310 # define _ISOC9X_SOURCE 1
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
311 # define _ISOC99_SOURCE 1
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
312 # define __USE_ISOC9X 1
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
313 # define __USE_ISOC99 1
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
314 #endif
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
315
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
316 #include <math.h>
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
317
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
318 #ifdef HAVE_SINF
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
319 # define sin sinf
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
320 #error
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
321 #endif
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
322 #ifdef HAVE_COSF
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
323 # define cos cosf
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
324 #endif
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
325 #ifdef HAVE_LOGF
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
326 # define log logf
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
327 #endif
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
328 #ifdef HAVE_EXPF
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
329 # define exp expf
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
330 #endif
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
331 #ifdef HAVE_FLOORF
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
332 # define floor floorf
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
333 #endif
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
334 #ifdef HAVE_CEILF
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
335 # define ceil ceilf
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
336 #endif
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
337 #ifdef HAVE_SQRTF
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
338 # define sqrt sqrtf
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
339 #endif
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
340
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
341 #endif
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
342
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
343 #endif
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
344
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
345 #ifndef HAS_LRINTF
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
346 /* standard cast */
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
347 #define lrintf(f) ((int32_t)(f))
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
348 #endif
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
349
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
350 typedef real_t complex_t[2];
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
351 #define RE(A) A[0]
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
352 #define IM(A) A[1]
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
353
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
354
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
355 /* common functions */
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
356 int32_t int_log2(int32_t val);
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
357 uint32_t random_int(void);
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
358 uint8_t get_sr_index(uint32_t samplerate);
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
359 uint8_t max_pred_sfb(uint8_t sr_index);
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
360 uint8_t max_tns_sfb(uint8_t sr_index, uint8_t object_type, uint8_t is_short);
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
361 uint32_t get_sample_rate(uint8_t sr_index);
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
362 int8_t can_decode_ot(uint8_t object_type);
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
363
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
364 #ifndef M_PI
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
365 #define M_PI 3.14159265358979323846f
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
366 #endif
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
367 #ifndef M_PI_2 /* PI/2 */
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
368 #define M_PI_2 1.57079632679489661923
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
369 #endif
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
370
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
371
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
372 #ifdef __cplusplus
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
373 }
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
374 #endif
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
375 #endif