annotate libfaad2/common.h @ 10740:0b5748047607

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