annotate libfaad2/common.h @ 12464:d4f559200e16

changes for alsa9/alsa1.x merge, only alsa.
author joyping
date Wed, 12 May 2004 22:49:23 +0000
parents 3185f64f6350
children 4a370c80fe5c
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
10805
125a35fc47a5 fixed win32 compile problems and broken bigendian support
alex
parents: 10725
diff changeset
112 #if 0
10725
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;
10805
125a35fc47a5 fixed win32 compile problems and broken bigendian support
alex
parents: 10725
diff changeset
121 #else
125a35fc47a5 fixed win32 compile problems and broken bigendian support
alex
parents: 10725
diff changeset
122 #include <inttypes.h>
125a35fc47a5 fixed win32 compile problems and broken bigendian support
alex
parents: 10725
diff changeset
123 #endif
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
124 typedef float float32_t;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
125
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
126
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
127 #else
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
128
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
129 /* Define if needed */
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
130 /* #undef HAVE_FLOAT32_T */
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 <inttypes.h> header file. */
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
133 #define HAVE_INTTYPES_H 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 `memcpy' function. */
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
136 #define HAVE_MEMCPY 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 <stdint.h> header file. */
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
139 #define HAVE_STDINT_H 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 `strchr' function. */
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
142 #define HAVE_STRCHR 1
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
143
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
144 /* Define if you have the ANSI C header files. */
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
145 #define STDC_HEADERS 1
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
146
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
147
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
148
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
149 #include <stdio.h>
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
150 #if HAVE_SYS_TYPES_H
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
151 # include <sys/types.h>
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
152 #endif
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
153 #if HAVE_SYS_STAT_H
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
154 # include <sys/stat.h>
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
155 #endif
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
156 #if STDC_HEADERS
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
157 # include <stdlib.h>
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
158 # include <stddef.h>
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
159 #else
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
160 # if HAVE_STDLIB_H
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
161 # include <stdlib.h>
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
162 # endif
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
163 #endif
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
164 #if HAVE_STRING_H
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
165 # if !STDC_HEADERS && HAVE_MEMORY_H
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
166 # include <memory.h>
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
167 # endif
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
168 # include <string.h>
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
169 #endif
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
170 #if HAVE_STRINGS_H
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
171 # include <strings.h>
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
172 #endif
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
173 #if HAVE_INTTYPES_H
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
174 # include <inttypes.h>
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
175 #else
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
176 # if HAVE_STDINT_H
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
177 # include <stdint.h>
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
178 # else
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
179 /* we need these... */
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
180 typedef unsigned long long uint64_t;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
181 typedef unsigned long uint32_t;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
182 typedef unsigned short uint16_t;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
183 typedef unsigned char uint8_t;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
184 typedef long long int64_t;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
185 typedef long int32_t;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
186 typedef short int16_t;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
187 typedef char int8_t;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
188 # endif
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
189 #endif
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
190 #if HAVE_UNISTD_H
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
191 # include <unistd.h>
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
192 #endif
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
193
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
194 #ifndef HAVE_FLOAT32_T
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
195 typedef float float32_t;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
196 #endif
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
197
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
198 #if STDC_HEADERS
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
199 # include <string.h>
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
200 #else
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
201 # if !HAVE_STRCHR
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
202 # define strchr index
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
203 # define strrchr rindex
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
204 # endif
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
205 char *strchr(), *strrchr();
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
206 # if !HAVE_MEMCPY
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
207 # define memcpy(d, s, n) bcopy((s), (d), (n))
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
208 # define memmove(d, s, n) bcopy((s), (d), (n))
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
209 # endif
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
210 #endif
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
211
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
212 #endif
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
213
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
214 #ifdef WORDS_BIGENDIAN
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
215 #define ARCH_IS_BIG_ENDIAN
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
216 #endif
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
217
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
218 /* FIXED_POINT doesn't work with MAIN and SSR yet */
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
219 #ifdef FIXED_POINT
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
220 #undef MAIN_DEC
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
221 #undef SSR_DEC
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
222 #endif
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
223
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
224
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
225 #if defined(FIXED_POINT)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
226
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
227 #ifdef HAS_MATHF_H
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
228 #include <mathf.h>
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
229 #else
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
230 #include <math.h>
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
231 #endif
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
232
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
233 #include "fixed.h"
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
234
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
235 #elif defined(USE_DOUBLE_PRECISION)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
236
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
237 typedef double real_t;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
238
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
239 #include <math.h>
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
240
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
241 #define MUL(A,B) ((A)*(B))
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
242 #define MUL_C_C(A,B) ((A)*(B))
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
243 #define MUL_R_C(A,B) ((A)*(B))
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
244
10989
3185f64f6350 synced with current cvs
alex
parents: 10805
diff changeset
245 #define REAL_CONST(A) ((real_t)(A))
3185f64f6350 synced with current cvs
alex
parents: 10805
diff changeset
246 #define COEF_CONST(A) ((real_t)(A))
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
247
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
248 #else /* Normal floating point operation */
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
249
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
250 typedef float real_t;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
251
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
252 #define MUL(A,B) ((A)*(B))
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
253 #define MUL_C_C(A,B) ((A)*(B))
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
254 #define MUL_R_C(A,B) ((A)*(B))
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
255
10989
3185f64f6350 synced with current cvs
alex
parents: 10805
diff changeset
256 #define REAL_CONST(A) ((real_t)(A))
3185f64f6350 synced with current cvs
alex
parents: 10805
diff changeset
257 #define COEF_CONST(A) ((real_t)(A))
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
258
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
259 #ifdef __ICL /* only Intel C compiler has fmath ??? */
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
260
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
261 #include <mathf.h>
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
262
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
263 #define sin sinf
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
264 #define cos cosf
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
265 #define log logf
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
266 #define floor floorf
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
267 #define ceil ceilf
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
268 #define sqrt sqrtf
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
269
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
270 #else
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
271
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
272 #include <math.h>
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
273
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
274 #ifdef HAVE_SINF
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
275 # define sin sinf
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
276 #error
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
277 #endif
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
278 #ifdef HAVE_COSF
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
279 # define cos cosf
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
280 #endif
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
281 #ifdef HAVE_LOGF
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
282 # define log logf
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
283 #endif
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
284 #ifdef HAVE_EXPF
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
285 # define exp expf
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
286 #endif
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
287 #ifdef HAVE_FLOORF
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
288 # define floor floorf
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
289 #endif
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
290 #ifdef HAVE_CEILF
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
291 # define ceil ceilf
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
292 #endif
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
293 #ifdef HAVE_SQRTF
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
294 # define sqrt sqrtf
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
295 #endif
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
296
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
297 #endif
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
298
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
299 #endif
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
300
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
301 typedef real_t complex_t[2];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
302 #define RE(A) A[0]
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
303 #define IM(A) A[1]
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
304
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
305
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
306 /* common functions */
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
307 int32_t int_log2(int32_t val);
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
308 uint32_t random_int(void);
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
309 uint8_t get_sr_index(uint32_t samplerate);
10989
3185f64f6350 synced with current cvs
alex
parents: 10805
diff changeset
310 uint32_t get_sample_rate(uint8_t sr_index);
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
311 int8_t can_decode_ot(uint8_t object_type);
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
312
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
313 #ifndef M_PI
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
314 #define M_PI 3.14159265358979323846f
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
315 #endif
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
316 #ifndef M_PI_2 /* PI/2 */
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
317 #define M_PI_2 1.57079632679489661923
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
318 #endif
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
319
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
320
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
321 #ifdef __cplusplus
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
322 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
323 #endif
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
324 #endif