annotate libfaad2/common.h @ 14406:21e784e1c405

synced (wording, formatting) the following lavc options: atag, bit_exact, threads, vcodec, vqmin, lmax, vqscale, vqmax, mbqmin, mbqmax, vqdiff, vmax_b_frames
author kraymer
date Thu, 06 Jan 2005 18:12:47 +0000
parents ebd158d142f7
children b4378a6f87a6
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
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
3 ** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
4 **
10725
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.
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
9 **
10725
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.
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
14 **
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
15 ** You should have received a copy of the GNU General Public License
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
16 ** along with this program; if not, write to the Free Software
10725
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 **
12625
d81145997036 More information about modifications to comply more closely with GPL 2a.
diego
parents: 12527
diff changeset
25 ** Initially modified for use with MPlayer by Arpad Gereöffy on 2003/08/30
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
26 ** $Id$
12625
d81145997036 More information about modifications to comply more closely with GPL 2a.
diego
parents: 12527
diff changeset
27 ** detailed CVS changelog at http://www.mplayerhq.hu/cgi-bin/cvsweb.cgi/main/
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
28 **/
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
29
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
30 #ifndef __COMMON_H__
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
31 #define __COMMON_H__
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
32
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
33 #ifdef __cplusplus
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
34 extern "C" {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
35 #endif
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
36
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
37 /* Allow build on cygwin*/
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
38 #if defined(__CYGWIN__)
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
39 #define __STRICT_ANSI__
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
40 #endif
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
41
13685
ebd158d142f7 Fix playback on big-endian systems.
diego
parents: 13485
diff changeset
42 #include "../config.h"
13453
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
43
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
44 #define INLINE __inline
13453
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
45 #if 0 //defined(_WIN32) && !defined(_WIN32_WCE)
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
46 #define ALIGN __declspec(align(16))
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
47 #else
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
48 #define ALIGN
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
49 #endif
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
50
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
51 #ifndef max
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
52 #define max(a, b) (((a) > (b)) ? (a) : (b))
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
53 #endif
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
54 #ifndef min
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
55 #define min(a, b) (((a) < (b)) ? (a) : (b))
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
56 #endif
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
57
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
58 /* COMPILE TIME DEFINITIONS */
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
59
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
60 /* use double precision */
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
61 /* #define USE_DOUBLE_PRECISION */
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
62 /* use fixed point reals */
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
63 //#define FIXED_POINT
13453
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
64 //#define BIG_IQ_TABLE
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
65
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
66 /* Use if target platform has address generators with autoincrement */
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
67 //#define PREFER_POINTERS
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
68
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
69 #ifdef _WIN32_WCE
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
70 #define FIXED_POINT
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
71 #endif
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
72
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
73
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
74 #define ERROR_RESILIENCE
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 /* Allow decoding of MAIN profile AAC */
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
78 #define MAIN_DEC
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
79 /* Allow decoding of SSR profile AAC */
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
80 //#define SSR_DEC
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
81 /* Allow decoding of LTP profile AAC */
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
82 #define LTP_DEC
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
83 /* Allow decoding of LD profile AAC */
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
84 #define LD_DEC
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
85 /* Allow decoding of scalable profiles */
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
86 //#define SCALABLE_DEC
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
87 /* Allow decoding of Digital Radio Mondiale (DRM) */
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
88 //#define DRM
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
89 //#define DRM_PS
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
90
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
91 /* LD can't do without LTP */
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
92 #ifdef LD_DEC
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
93 #ifndef ERROR_RESILIENCE
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
94 #define ERROR_RESILIENCE
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
95 #endif
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
96 #ifndef LTP_DEC
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
97 #define LTP_DEC
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
98 #endif
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
99 #endif
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
100
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
101 #define ALLOW_SMALL_FRAMELENGTH
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
102
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
103
13453
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
104 // Define LC_ONLY_DECODER if you want a pure AAC LC decoder (independant of SBR_DEC and PS_DEC)
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
105 //#define LC_ONLY_DECODER
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
106 #ifdef LC_ONLY_DECODER
13453
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
107 #undef LD_DEC
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
108 #undef LTP_DEC
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
109 #undef MAIN_DEC
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
110 #undef SSR_DEC
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
111 #undef DRM
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
112 #undef ALLOW_SMALL_FRAMELENGTH
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
113 #undef ERROR_RESILIENCE
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
114 #endif
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
115
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
116 #define SBR_DEC
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
117 //#define SBR_LOW_POWER
13453
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
118 #define PS_DEC
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
119
13453
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
120 /* FIXED POINT: No MAIN decoding */
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
121 #ifdef FIXED_POINT
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
122 # ifdef MAIN_DEC
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
123 # undef MAIN_DEC
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
124 # endif
13485
93a84777a6b5 SBR code does NOT work with fixed point (uses floats, slow as hell)
rfelker
parents: 13453
diff changeset
125 # ifdef SBR_DEC
93a84777a6b5 SBR code does NOT work with fixed point (uses floats, slow as hell)
rfelker
parents: 13453
diff changeset
126 # undef SBR_DEC
93a84777a6b5 SBR code does NOT work with fixed point (uses floats, slow as hell)
rfelker
parents: 13453
diff changeset
127 # endif
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
128 #endif // FIXED_POINT
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
129
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
130 #ifdef DRM
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
131 # ifndef SCALABLE_DEC
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
132 # define SCALABLE_DEC
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
133 # endif
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
134 #endif
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
135
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
136 #if ((defined(_WIN32) && !defined(_WIN32_WCE)) /* || ((__GNUC__ >= 3) && defined(__i386__)) */ )
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
137 #ifndef FIXED_POINT
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
138 /* includes <xmmintrin.h> to enable SSE intrinsics */
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
139 //#define USE_SSE
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
140 #endif
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
141 #endif
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
142
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
143 #ifdef FIXED_POINT
13453
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
144 #define DIV_R(A, B) (((int64_t)A << REAL_BITS)/B)
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
145 #define DIV_C(A, B) (((int64_t)A << COEF_BITS)/B)
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
146 #else
13453
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
147 #define DIV_R(A, B) ((A)/(B))
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
148 #define DIV_C(A, B) ((A)/(B))
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
149 #endif
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
150
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
151 #ifndef SBR_LOW_POWER
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
152 #define qmf_t complex_t
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
153 #define QMF_RE(A) RE(A)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
154 #define QMF_IM(A) IM(A)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
155 #else
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
156 #define qmf_t real_t
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
157 #define QMF_RE(A) (A)
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
158 #define QMF_IM(A)
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
159 #endif
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
160
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
161
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
162 /* END COMPILE TIME DEFINITIONS */
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
163
13453
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
164 #if defined(_WIN32) && !defined(__MINGW32__)
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
165
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
166 #include <stdlib.h>
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
167
10805
125a35fc47a5 fixed win32 compile problems and broken bigendian support
alex
parents: 10725
diff changeset
168 #if 0
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
169 typedef unsigned __int64 uint64_t;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
170 typedef unsigned __int32 uint32_t;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
171 typedef unsigned __int16 uint16_t;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
172 typedef unsigned __int8 uint8_t;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
173 typedef __int64 int64_t;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
174 typedef __int32 int32_t;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
175 typedef __int16 int16_t;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
176 typedef __int8 int8_t;
10805
125a35fc47a5 fixed win32 compile problems and broken bigendian support
alex
parents: 10725
diff changeset
177 #else
125a35fc47a5 fixed win32 compile problems and broken bigendian support
alex
parents: 10725
diff changeset
178 #include <inttypes.h>
125a35fc47a5 fixed win32 compile problems and broken bigendian support
alex
parents: 10725
diff changeset
179 #endif
13453
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
180
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
181 typedef float float32_t;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
182
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
183
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
184 #else
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
185
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
186 /* #undef HAVE_FLOAT32_T */
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
187 /* Define if you have the <inttypes.h> header file. */
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
188 #define HAVE_INTTYPES_H 1
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
189
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
190 /* Define if you have the `memcpy' function. */
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
191 #define HAVE_MEMCPY 1
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
192
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
193 /* Define if you have the <stdint.h> header file. */
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
194 #define HAVE_STDINT_H 1
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
195
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
196 /* Define if you have the `strchr' function. */
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
197 #define HAVE_STRCHR 1
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
198
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
199 /* Define if you have the ANSI C header files. */
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
200 #define STDC_HEADERS 1
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
201
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
202 #include <stdio.h>
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
203 #if HAVE_SYS_TYPES_H
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
204 # include <sys/types.h>
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
205 #endif
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
206 #if HAVE_SYS_STAT_H
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
207 # include <sys/stat.h>
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
208 #endif
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
209 #if STDC_HEADERS
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
210 # include <stdlib.h>
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
211 # include <stddef.h>
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
212 #else
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
213 # if HAVE_STDLIB_H
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
214 # include <stdlib.h>
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
215 # endif
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
216 #endif
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
217 #if HAVE_STRING_H
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
218 # if !STDC_HEADERS && HAVE_MEMORY_H
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
219 # include <memory.h>
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
220 # endif
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
221 # include <string.h>
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
222 #endif
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
223 #if HAVE_STRINGS_H
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
224 # include <strings.h>
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
225 #endif
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
226 #if HAVE_INTTYPES_H
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
227 # include <inttypes.h>
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
228 #else
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
229 # if HAVE_STDINT_H
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
230 # include <stdint.h>
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
231 # else
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
232 /* we need these... */
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
233 typedef unsigned long long uint64_t;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
234 typedef unsigned long uint32_t;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
235 typedef unsigned short uint16_t;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
236 typedef unsigned char uint8_t;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
237 typedef long long int64_t;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
238 typedef long int32_t;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
239 typedef short int16_t;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
240 typedef char int8_t;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
241 # endif
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
242 #endif
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
243 #if HAVE_UNISTD_H
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
244 # include <unistd.h>
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
245 #endif
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
246
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
247 #ifndef HAVE_FLOAT32_T
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
248 typedef float float32_t;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
249 #endif
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
250
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
251 #if STDC_HEADERS
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
252 # include <string.h>
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
253 #else
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
254 # if !HAVE_STRCHR
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
255 # define strchr index
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
256 # define strrchr rindex
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
257 # endif
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
258 char *strchr(), *strrchr();
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
259 # if !HAVE_MEMCPY
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
260 # define memcpy(d, s, n) bcopy((s), (d), (n))
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
261 # define memmove(d, s, n) bcopy((s), (d), (n))
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
262 # endif
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
263 #endif
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
264
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
265 #endif
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
266
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
267 #ifdef WORDS_BIGENDIAN
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
268 #define ARCH_IS_BIG_ENDIAN
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
269 #endif
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
270
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
271 /* FIXED_POINT doesn't work with MAIN and SSR yet */
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
272 #ifdef FIXED_POINT
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
273 #undef MAIN_DEC
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
274 #undef SSR_DEC
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
275 #endif
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
276
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
277
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
278 #if defined(FIXED_POINT)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
279
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
280 #include "fixed.h"
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
281
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
282 #elif defined(USE_DOUBLE_PRECISION)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
283
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
284 typedef double real_t;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
285
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
286 #include <math.h>
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
287
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
288 #define MUL_R(A,B) ((A)*(B))
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
289 #define MUL_C(A,B) ((A)*(B))
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
290 #define MUL_F(A,B) ((A)*(B))
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
291
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
292 /* Complex multiplication */
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
293 static INLINE void ComplexMult(real_t *y1, real_t *y2,
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
294 real_t x1, real_t x2, real_t c1, real_t c2)
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
295 {
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
296 *y1 = MUL_F(x1, c1) + MUL_F(x2, c2);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
297 *y2 = MUL_F(x2, c1) - MUL_F(x1, c2);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
298 }
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
299
10989
3185f64f6350 synced with current cvs
alex
parents: 10805
diff changeset
300 #define REAL_CONST(A) ((real_t)(A))
3185f64f6350 synced with current cvs
alex
parents: 10805
diff changeset
301 #define COEF_CONST(A) ((real_t)(A))
13453
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
302 #define Q2_CONST(A) ((real_t)(A))
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
303 #define FRAC_CONST(A) ((real_t)(A)) /* pure fractional part */
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
304
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
305 #else /* Normal floating point operation */
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
306
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
307 typedef float real_t;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
308
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
309 #ifdef USE_SSE
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
310 # include <xmmintrin.h>
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
311 #endif
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
312
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
313 #define MUL_R(A,B) ((A)*(B))
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
314 #define MUL_C(A,B) ((A)*(B))
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
315 #define MUL_F(A,B) ((A)*(B))
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
316
10989
3185f64f6350 synced with current cvs
alex
parents: 10805
diff changeset
317 #define REAL_CONST(A) ((real_t)(A))
3185f64f6350 synced with current cvs
alex
parents: 10805
diff changeset
318 #define COEF_CONST(A) ((real_t)(A))
13453
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
319 #define Q2_CONST(A) ((real_t)(A))
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
320 #define FRAC_CONST(A) ((real_t)(A)) /* pure fractional part */
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
321
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
322 /* Complex multiplication */
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
323 static INLINE void ComplexMult(real_t *y1, real_t *y2,
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
324 real_t x1, real_t x2, real_t c1, real_t c2)
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
325 {
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
326 *y1 = MUL_F(x1, c1) + MUL_F(x2, c2);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
327 *y2 = MUL_F(x2, c1) - MUL_F(x1, c2);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
328 }
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
329
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
330
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
331 #if defined(_WIN32) && !defined(__MINGW32__)
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
332 #define HAS_LRINTF
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
333 static INLINE int lrintf(float f)
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
334 {
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
335 int i;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
336 __asm
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
337 {
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
338 fld f
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
339 fistp i
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
340 }
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
341 return i;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
342 }
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
343 #elif (defined(__i386__) && defined(__GNUC__)) && !defined(__MINGW32__)
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
344 #define HAS_LRINTF
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
345 // from http://www.stereopsis.com/FPU.html
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
346 static INLINE int lrintf(float f)
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
347 {
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
348 int i;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
349 __asm__ __volatile__ (
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
350 "flds %1 \n\t"
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
351 "fistpl %0 \n\t"
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
352 : "=m" (i)
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
353 : "m" (f));
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
354 return i;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
355 }
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
356 #endif
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
357
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
358
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
359 #ifdef __ICL /* only Intel C compiler has fmath ??? */
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
360
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
361 #include <mathf.h>
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
362
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
363 #define sin sinf
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
364 #define cos cosf
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
365 #define log logf
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
366 #define floor floorf
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
367 #define ceil ceilf
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
368 #define sqrt sqrtf
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
369
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
370 #else
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
371
13685
ebd158d142f7 Fix playback on big-endian systems.
diego
parents: 13485
diff changeset
372 #include <math.h>
ebd158d142f7 Fix playback on big-endian systems.
diego
parents: 13485
diff changeset
373
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
374 #ifdef HAVE_LRINTF
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
375 # define HAS_LRINTF
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
376 # define _ISOC9X_SOURCE 1
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
377 # define _ISOC99_SOURCE 1
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
378 # define __USE_ISOC9X 1
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
379 # define __USE_ISOC99 1
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
380 #endif
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
381
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
382 #ifdef HAVE_SINF
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
383 # define sin sinf
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
384 #error
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
385 #endif
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
386 #ifdef HAVE_COSF
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
387 # define cos cosf
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
388 #endif
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
389 #ifdef HAVE_LOGF
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
390 # define log logf
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
391 #endif
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
392 #ifdef HAVE_EXPF
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
393 # define exp expf
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
394 #endif
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
395 #ifdef HAVE_FLOORF
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
396 # define floor floorf
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
397 #endif
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
398 #ifdef HAVE_CEILF
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
399 # define ceil ceilf
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
400 #endif
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
401 #ifdef HAVE_SQRTF
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
402 # define sqrt sqrtf
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
403 #endif
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
404
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
405 #endif
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
406
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
407 #endif
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
408
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
409 #ifndef HAS_LRINTF
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
410 /* standard cast */
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
411 #define lrintf(f) ((int32_t)(f))
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
412 #endif
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
413
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
414 typedef real_t complex_t[2];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
415 #define RE(A) A[0]
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
416 #define IM(A) A[1]
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
417
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
418
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
419 /* common functions */
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
420 uint8_t cpu_has_sse(void);
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
421 uint32_t random_int(void);
13453
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
422 uint32_t ones32(uint32_t x);
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
423 uint32_t floor_log2(uint32_t x);
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
424 uint32_t wl_min_lzc(uint32_t x);
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
425 #ifdef FIXED_POINT
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
426 #define LOG2_MIN_INF REAL_CONST(-10000)
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
427 int32_t log2_int(uint32_t val);
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
428 int32_t pow2_int(real_t val);
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
429 real_t pow2_fix(real_t val);
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
430 #endif
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
431 uint8_t get_sr_index(const uint32_t samplerate);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
432 uint8_t max_pred_sfb(const uint8_t sr_index);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
433 uint8_t max_tns_sfb(const uint8_t sr_index, const uint8_t object_type,
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
434 const uint8_t is_short);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
435 uint32_t get_sample_rate(const uint8_t sr_index);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
436 int8_t can_decode_ot(const uint8_t object_type);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
437
13453
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
438 void *faad_malloc(size_t size);
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
439 void faad_free(void *b);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
440
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
441 //#define PROFILE
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
442 #ifdef PROFILE
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
443 static int64_t faad_get_ts()
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
444 {
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
445 __asm
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
446 {
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
447 rdtsc
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
448 }
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
449 }
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
450 #endif
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
451
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
452 #ifndef M_PI
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
453 #define M_PI 3.14159265358979323846
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
454 #endif
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
455 #ifndef M_PI_2 /* PI/2 */
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
456 #define M_PI_2 1.57079632679489661923
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
457 #endif
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
458
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
459
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
460 #ifdef __cplusplus
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
461 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
462 #endif
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
463 #endif