1
2 /* -----------------------------------------------------------------------------------------------------------
3 Software License for The Fraunhofer FDK AAC Codec Library for Android
4
5 � Copyright 1995 - 2012 Fraunhofer-Gesellschaft zur F�rderung der angewandten Forschung e.V.
6 All rights reserved.
7
8 1. INTRODUCTION
9 The Fraunhofer FDK AAC Codec Library for Android ("FDK AAC Codec") is software that implements
10 the MPEG Advanced Audio Coding ("AAC") encoding and decoding scheme for digital audio.
11 This FDK AAC Codec software is intended to be used on a wide variety of Android devices.
12
13 AAC's HE-AAC and HE-AAC v2 versions are regarded as today's most efficient general perceptual
14 audio codecs. AAC-ELD is considered the best-performing full-bandwidth communications codec by
15 independent studies and is widely deployed. AAC has been standardized by ISO and IEC as part
16 of the MPEG specifications.
17
18 Patent licenses for necessary patent claims for the FDK AAC Codec (including those of Fraunhofer)
19 may be obtained through Via Licensing (www.vialicensing.com) or through the respective patent owners
20 individually for the purpose of encoding or decoding bit streams in products that are compliant with
21 the ISO/IEC MPEG audio standards. Please note that most manufacturers of Android devices already license
22 these patent claims through Via Licensing or directly from the patent owners, and therefore FDK AAC Codec
23 software may already be covered under those patent licenses when it is used for those licensed purposes only.
24
25 Commercially-licensed AAC software libraries, including floating-point versions with enhanced sound quality,
26 are also available from Fraunhofer. Users are encouraged to check the Fraunhofer website for additional
27 applications information and documentation.
28
29 2. COPYRIGHT LICENSE
30
31 Redistribution and use in source and binary forms, with or without modification, are permitted without
32 payment of copyright license fees provided that you satisfy the following conditions:
33
34 You must retain the complete text of this software license in redistributions of the FDK AAC Codec or
35 your modifications thereto in source code form.
36
37 You must retain the complete text of this software license in the documentation and/or other materials
38 provided with redistributions of the FDK AAC Codec or your modifications thereto in binary form.
39 You must make available free of charge copies of the complete source code of the FDK AAC Codec and your
40 modifications thereto to recipients of copies in binary form.
41
42 The name of Fraunhofer may not be used to endorse or promote products derived from this library without
43 prior written permission.
44
45 You may not charge copyright license fees for anyone to use, copy or distribute the FDK AAC Codec
46 software or your modifications thereto.
47
48 Your modified versions of the FDK AAC Codec must carry prominent notices stating that you changed the software
49 and the date of any change. For modified versions of the FDK AAC Codec, the term
50 "Fraunhofer FDK AAC Codec Library for Android" must be replaced by the term
51 "Third-Party Modified Version of the Fraunhofer FDK AAC Codec Library for Android."
52
53 3. NO PATENT LICENSE
54
55 NO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without limitation the patents of Fraunhofer,
56 ARE GRANTED BY THIS SOFTWARE LICENSE. Fraunhofer provides no warranty of patent non-infringement with
57 respect to this software.
58
59 You may use this FDK AAC Codec software or modifications thereto only for purposes that are authorized
60 by appropriate patent licenses.
61
62 4. DISCLAIMER
63
64 This FDK AAC Codec software is provided by Fraunhofer on behalf of the copyright holders and contributors
65 "AS IS" and WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, including but not limited to the implied warranties
66 of merchantability and fitness for a particular purpose. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
67 CONTRIBUTORS BE LIABLE for any direct, indirect, incidental, special, exemplary, or consequential damages,
68 including but not limited to procurement of substitute goods or services; loss of use, data, or profits,
69 or business interruption, however caused and on any theory of liability, whether in contract, strict
70 liability, or tort (including negligence), arising in any way out of the use of this software, even if
71 advised of the possibility of such damage.
72
73 5. CONTACT INFORMATION
74
75 Fraunhofer Institute for Integrated Circuits IIS
76 Attention: Audio and Multimedia Departments - FDK AAC LL
77 Am Wolfsmantel 33
78 91058 Erlangen, Germany
79
80 www.iis.fraunhofer.de/amm
81 amm-info@iis.fraunhofer.de
82 ----------------------------------------------------------------------------------------------------------- */
83
84 /*************************** Fraunhofer IIS FDK Tools **********************
85
86 Author(s): M. Lohwasser, M. Gayer
87 Description: Flexible fixpoint library configuration
88
89 ******************************************************************************/
90
91 #ifndef _COMMON_FIX_H
92 #define _COMMON_FIX_H
93
94 #include "FDK_archdef.h"
95 #include "machine_type.h"
96
97 /* ***** Start of former fix.h ****** */
98
99 /* Configure fractional or integer arithmetic */
100 #define FIX_FRACT 0 /* Define this to "1" to use fractional arithmetic simulation in class fract instead of integer arithmetic */
101 /* 1 for debug with extra runtime overflow checking. */
102
103 /* Define bit sizes of integer fixpoint fractional data types */
104 #define FRACT_BITS 16 /* single precision */
105 #define DFRACT_BITS 32 /* double precision */
106 #define ACCU_BITS 40 /* double precision plus overflow */
107
108 /* Fixpoint equivalent type fot PCM audio time domain data. */
109 #if defined(SAMPLE_BITS)
110 #if (SAMPLE_BITS == DFRACT_BITS)
111 #define FIXP_PCM FIXP_DBL
112 #define FX_PCM2FX_DBL(x) ((FIXP_DBL)(x))
113 #define FX_DBL2FX_PCM(x) ((INT_PCM)(x))
114 #elif (SAMPLE_BITS == FRACT_BITS)
115 #define FIXP_PCM FIXP_SGL
116 #define FX_PCM2FX_DBL(x) FX_SGL2FX_DBL((FIXP_SGL)(x))
117 #define FX_DBL2FX_PCM(x) FX_DBL2FX_SGL(x)
118 #else
119 #error SAMPLE_BITS different from FRACT_BITS or DFRACT_BITS not implemented!
120 #endif
121 #endif
122
123 /* ****** End of former fix.h ****** */
124
125 #define SGL_MASK ((1UL<<FRACT_BITS)-1) /* 16bit: (2^16)-1 = 0xFFFF */
126
127 #define MAX_SHIFT_SGL (FRACT_BITS-1) /* maximum possible shift for FIXP_SGL values */
128 #define MAX_SHIFT_DBL (DFRACT_BITS-1) /* maximum possible shift for FIXP_DBL values */
129
130 /* Scale factor from/to float/fixpoint values. DO NOT USE THESE VALUES AS SATURATION LIMITS !! */
131 #define FRACT_FIX_SCALE ((INT64(1)<<(FRACT_BITS-1)))
132 #define DFRACT_FIX_SCALE ((INT64(1)<<(DFRACT_BITS-1)))
133
134 /* Max and Min values for saturation purposes. DO NOT USE THESE VALUES AS SCALE VALUES !! */
135 #define MAXVAL_SGL ((signed)0x00007FFF) /* this has to be synchronized to FRACT_BITS */
136 #define MINVAL_SGL ((signed)0xFFFF8000) /* this has to be synchronized to FRACT_BITS */
137 #define MAXVAL_DBL ((signed)0x7FFFFFFF) /* this has to be synchronized to DFRACT_BITS */
138 #define MINVAL_DBL ((signed)0x80000000) /* this has to be synchronized to DFRACT_BITS */
139
140
141 #define FX_DBL2FXCONST_SGL(val) ( ( ((((val) >> (DFRACT_BITS-FRACT_BITS-1)) + 1) > (((LONG)1<<FRACT_BITS)-1)) && ((LONG)(val) > 0) ) ? \
142 (FIXP_SGL)(SHORT)(((LONG)1<<(FRACT_BITS-1))-1):(FIXP_SGL)(SHORT)((((val) >> (DFRACT_BITS-FRACT_BITS-1)) + 1) >> 1) )
143
144
145
146 #define shouldBeUnion union /* unions are possible */
147
148 typedef SHORT FIXP_SGL;
149 typedef LONG FIXP_DBL;
150
151 /* macros for compile-time conversion of constant float values to fixedpoint */
152 #define FL2FXCONST_SPC FL2FXCONST_DBL
153
154 #define MINVAL_DBL_CONST MINVAL_DBL
155 #define MINVAL_SGL_CONST MINVAL_SGL
156
157 #define FL2FXCONST_SGL(val) \
158 (FIXP_SGL)( ( (val) >= 0) ? \
159 ((( (double)(val) * (FRACT_FIX_SCALE) + 0.5 ) >= (double)(MAXVAL_SGL) ) ? (SHORT)(MAXVAL_SGL) : (SHORT)( (double)(val) * (double)(FRACT_FIX_SCALE) + 0.5)) : \
160 ((( (double)(val) * (FRACT_FIX_SCALE) - 0.5) <= (double)(MINVAL_SGL_CONST) ) ? (SHORT)(MINVAL_SGL_CONST) : (SHORT)( (double)(val) * (double)(FRACT_FIX_SCALE) - 0.5)) )
161
162 #define FL2FXCONST_DBL(val) \
163 (FIXP_DBL)( ( (val) >= 0) ? \
164 ((( (double)(val) * (DFRACT_FIX_SCALE) + 0.5 ) >= (double)(MAXVAL_DBL) ) ? (LONG)(MAXVAL_DBL) : (LONG)( (double)(val) * (double)(DFRACT_FIX_SCALE) + 0.5)) : \
165 ((( (double)(val) * (DFRACT_FIX_SCALE) - 0.5) <= (double)(MINVAL_DBL_CONST) ) ? (LONG)(MINVAL_DBL_CONST) : (LONG)( (double)(val) * (double)(DFRACT_FIX_SCALE) - 0.5)) )
166
167 /* macros for runtime conversion of float values to integer fixedpoint. NO OVERFLOW CHECK!!! */
168 #define FL2FX_SPC FL2FX_DBL
169 #define FL2FX_SGL(val) ( (val)>0.0f ? (SHORT)( (val)*(float)(FRACT_FIX_SCALE)+0.5f ) : (SHORT)( (val)*(float)(FRACT_FIX_SCALE)-0.5f ) )
170 #define FL2FX_DBL(val) ( (val)>0.0f ? (LONG)( (val)*(float)(DFRACT_FIX_SCALE)+0.5f ) : (LONG)( (val)*(float)(DFRACT_FIX_SCALE)-0.5f ) )
171
172 /* macros for runtime conversion of fixedpoint values to other fixedpoint. NO ROUNDING!!! */
173 #define FX_ACC2FX_SGL(val) ((FIXP_SGL)((val)>>(ACCU_BITS-FRACT_BITS)))
174 #define FX_ACC2FX_DBL(val) ((FIXP_DBL)((val)>>(ACCU_BITS-DFRACT_BITS)))
175 #define FX_SGL2FX_ACC(val) ((FIXP_ACC)((LONG)(val)<<(ACCU_BITS-FRACT_BITS)))
176 #define FX_SGL2FX_DBL(val) ((FIXP_DBL)((LONG)(val)<<(DFRACT_BITS-FRACT_BITS)))
177 #define FX_DBL2FX_SGL(val) ((FIXP_SGL)((val)>>(DFRACT_BITS-FRACT_BITS)))
178
179 /* ############################################################# */
180
181 /* macros for runtime conversion of integer fixedpoint values to float. */
182 /* This is just for temporary use and should not be required in a final version! */
183
184 /* #define FX_DBL2FL(val) ((float)(pow(2.,-31.)*(float)val)) */ /* version #1 */
185 #define FX_DBL2FL(val) ((float)((double)(val)/(double)DFRACT_FIX_SCALE)) /* version #2 - identical to class dfract cast from dfract to float */
186
187 /* ############################################################# */
188 #include "fixmul.h"
189
fMult(SHORT a,SHORT b)190 FDK_INLINE LONG fMult(SHORT a, SHORT b) { return fixmul_SS(a, b); }
fMult(SHORT a,LONG b)191 FDK_INLINE LONG fMult(SHORT a, LONG b) { return fixmul_SD(a, b); }
fMult(LONG a,SHORT b)192 FDK_INLINE LONG fMult(LONG a, SHORT b) { return fixmul_DS(a, b); }
fMult(LONG a,LONG b)193 FDK_INLINE LONG fMult(LONG a, LONG b) { return fixmul_DD(a, b); }
fPow2(LONG a)194 FDK_INLINE LONG fPow2(LONG a) { return fixpow2_D(a); }
fPow2(SHORT a)195 FDK_INLINE LONG fPow2(SHORT a) { return fixpow2_S(a); }
196
fMultI(LONG a,SHORT b)197 FDK_INLINE INT fMultI(LONG a, SHORT b) { return ( (INT)(((1<<(FRACT_BITS-2)) +
198 fixmuldiv2_DD(a,((INT)b<<FRACT_BITS)))>>(FRACT_BITS-1)) ); }
199
fMultIfloor(LONG a,INT b)200 FDK_INLINE INT fMultIfloor(LONG a, INT b) { return ( (INT)((1 +
201 fixmuldiv2_DD(a,(b<<FRACT_BITS))) >> (FRACT_BITS-1)) ); }
202
fMultIceil(LONG a,INT b)203 FDK_INLINE INT fMultIceil(LONG a, INT b) { return ( (INT)(((INT)0x7fff +
204 fixmuldiv2_DD(a,(b<<FRACT_BITS))) >> (FRACT_BITS-1)) ); }
205
fMultDiv2(SHORT a,SHORT b)206 FDK_INLINE LONG fMultDiv2(SHORT a, SHORT b) { return fixmuldiv2_SS(a, b); }
fMultDiv2(SHORT a,LONG b)207 FDK_INLINE LONG fMultDiv2(SHORT a, LONG b) { return fixmuldiv2_SD(a, b); }
fMultDiv2(LONG a,SHORT b)208 FDK_INLINE LONG fMultDiv2(LONG a, SHORT b) { return fixmuldiv2_DS(a, b); }
fMultDiv2(LONG a,LONG b)209 FDK_INLINE LONG fMultDiv2(LONG a, LONG b) { return fixmuldiv2_DD(a, b); }
fPow2Div2(LONG a)210 FDK_INLINE LONG fPow2Div2(LONG a) { return fixpow2div2_D(a); }
fPow2Div2(SHORT a)211 FDK_INLINE LONG fPow2Div2(SHORT a) { return fixpow2div2_S(a); }
212
fMultDiv2BitExact(LONG a,LONG b)213 FDK_INLINE LONG fMultDiv2BitExact(LONG a, LONG b) { return fixmuldiv2BitExact_DD(a, b); }
fMultDiv2BitExact(SHORT a,LONG b)214 FDK_INLINE LONG fMultDiv2BitExact(SHORT a, LONG b) { return fixmuldiv2BitExact_SD(a, b); }
fMultDiv2BitExact(LONG a,SHORT b)215 FDK_INLINE LONG fMultDiv2BitExact(LONG a, SHORT b) { return fixmuldiv2BitExact_DS(a, b); }
fMultBitExact(LONG a,LONG b)216 FDK_INLINE LONG fMultBitExact(LONG a, LONG b) { return fixmulBitExact_DD(a, b); }
fMultBitExact(SHORT a,LONG b)217 FDK_INLINE LONG fMultBitExact(SHORT a, LONG b) { return fixmulBitExact_SD(a, b); }
fMultBitExact(LONG a,SHORT b)218 FDK_INLINE LONG fMultBitExact(LONG a, SHORT b) { return fixmulBitExact_DS(a, b); }
219
220 /* ******************************************************************************** */
221 #include "abs.h"
222
fAbs(FIXP_DBL x)223 FDK_INLINE FIXP_DBL fAbs(FIXP_DBL x)
224 { return fixabs_D(x); }
fAbs(FIXP_SGL x)225 FDK_INLINE FIXP_SGL fAbs(FIXP_SGL x)
226 { return fixabs_S(x); }
227
228
229 /* workaround for TI C6x compiler but not for TI ARM9E compiler */
230 #if (!defined(__TI_COMPILER_VERSION__) || defined(__TI_TMS470_V5__)) && !defined(__x86_64__)
fAbs(INT x)231 FDK_INLINE INT fAbs(INT x)
232 { return fixabs_I(x); }
233 #endif
234
235 /* ******************************************************************************** */
236
237 #include "clz.h"
238
fNormz(FIXP_DBL x)239 FDK_INLINE INT fNormz(FIXP_DBL x)
240 { return fixnormz_D(x); }
fNormz(FIXP_SGL x)241 FDK_INLINE INT fNormz(FIXP_SGL x)
242 { return fixnormz_S(x); }
fNorm(FIXP_DBL x)243 FDK_INLINE INT fNorm(FIXP_DBL x)
244 { return fixnorm_D(x); }
fNorm(FIXP_SGL x)245 FDK_INLINE INT fNorm(FIXP_SGL x)
246 { return fixnorm_S(x); }
247
248
249 /* ******************************************************************************** */
250 /* ******************************************************************************** */
251 /* ******************************************************************************** */
252
253 #include "clz.h"
254 #define fixp_abs(x) fAbs(x)
255 #define fixMin(a,b) fMin(a,b)
256 #define fixMax(a,b) fMax(a,b)
257 #define CntLeadingZeros(x) fixnormz_D(x)
258 #define CountLeadingBits(x) fixnorm_D(x)
259
260 #include "fixmadd.h"
261
262 /* y = (x+0.5*a*b) */
fMultAddDiv2(FIXP_DBL x,FIXP_DBL a,FIXP_DBL b)263 FDK_INLINE FIXP_DBL fMultAddDiv2(FIXP_DBL x, FIXP_DBL a, FIXP_DBL b)
264 { return fixmadddiv2_DD(x, a, b); }
fMultAddDiv2(FIXP_DBL x,FIXP_SGL a,FIXP_DBL b)265 FDK_INLINE FIXP_DBL fMultAddDiv2(FIXP_DBL x, FIXP_SGL a, FIXP_DBL b)
266 { return fixmadddiv2_SD(x, a, b); }
fMultAddDiv2(FIXP_DBL x,FIXP_DBL a,FIXP_SGL b)267 FDK_INLINE FIXP_DBL fMultAddDiv2(FIXP_DBL x, FIXP_DBL a, FIXP_SGL b)
268 { return fixmadddiv2_DS(x, a, b); }
fMultAddDiv2(FIXP_DBL x,FIXP_SGL a,FIXP_SGL b)269 FDK_INLINE FIXP_DBL fMultAddDiv2(FIXP_DBL x, FIXP_SGL a, FIXP_SGL b)
270 { return fixmadddiv2_SS(x, a, b); }
271
fPow2AddDiv2(FIXP_DBL x,FIXP_DBL a)272 FDK_INLINE FIXP_DBL fPow2AddDiv2(FIXP_DBL x, FIXP_DBL a)
273 { return fixpadddiv2_D(x, a); }
fPow2AddDiv2(FIXP_DBL x,FIXP_SGL a)274 FDK_INLINE FIXP_DBL fPow2AddDiv2(FIXP_DBL x, FIXP_SGL a)
275 { return fixpadddiv2_S(x, a); }
276
277
278 /* y = 2*(x+0.5*a*b) = (2x+a*b) */
fMultAdd(FIXP_DBL x,FIXP_DBL a,FIXP_DBL b)279 FDK_INLINE FIXP_DBL fMultAdd(FIXP_DBL x, FIXP_DBL a, FIXP_DBL b)
280 { return fixmadd_DD(x, a, b); }
fMultAdd(FIXP_DBL x,FIXP_SGL a,FIXP_DBL b)281 inline FIXP_DBL fMultAdd(FIXP_DBL x, FIXP_SGL a, FIXP_DBL b)
282 { return fixmadd_SD(x, a, b); }
fMultAdd(FIXP_DBL x,FIXP_DBL a,FIXP_SGL b)283 inline FIXP_DBL fMultAdd(FIXP_DBL x, FIXP_DBL a, FIXP_SGL b)
284 { return fixmadd_DS(x, a, b); }
fMultAdd(FIXP_DBL x,FIXP_SGL a,FIXP_SGL b)285 inline FIXP_DBL fMultAdd(FIXP_DBL x, FIXP_SGL a, FIXP_SGL b)
286 { return fixmadd_SS(x, a, b); }
287
fPow2Add(FIXP_DBL x,FIXP_DBL a)288 inline FIXP_DBL fPow2Add(FIXP_DBL x, FIXP_DBL a)
289 { return fixpadd_D(x, a); }
fPow2Add(FIXP_DBL x,FIXP_SGL a)290 inline FIXP_DBL fPow2Add(FIXP_DBL x, FIXP_SGL a)
291 { return fixpadd_S(x, a); }
292
293
294 /* y = (x-0.5*a*b) */
fMultSubDiv2(FIXP_DBL x,FIXP_DBL a,FIXP_DBL b)295 inline FIXP_DBL fMultSubDiv2(FIXP_DBL x, FIXP_DBL a, FIXP_DBL b)
296 { return fixmsubdiv2_DD(x, a, b); }
fMultSubDiv2(FIXP_DBL x,FIXP_SGL a,FIXP_DBL b)297 inline FIXP_DBL fMultSubDiv2(FIXP_DBL x, FIXP_SGL a, FIXP_DBL b)
298 { return fixmsubdiv2_SD(x, a, b); }
fMultSubDiv2(FIXP_DBL x,FIXP_DBL a,FIXP_SGL b)299 inline FIXP_DBL fMultSubDiv2(FIXP_DBL x, FIXP_DBL a, FIXP_SGL b)
300 { return fixmsubdiv2_DS(x, a, b); }
fMultSubDiv2(FIXP_DBL x,FIXP_SGL a,FIXP_SGL b)301 inline FIXP_DBL fMultSubDiv2(FIXP_DBL x, FIXP_SGL a, FIXP_SGL b)
302 { return fixmsubdiv2_SS(x, a, b); }
303
304 /* y = 2*(x-0.5*a*b) = (2*x-a*b) */
fMultSub(FIXP_DBL x,FIXP_DBL a,FIXP_DBL b)305 FDK_INLINE FIXP_DBL fMultSub(FIXP_DBL x, FIXP_DBL a, FIXP_DBL b)
306 { return fixmsub_DD(x, a, b); }
fMultSub(FIXP_DBL x,FIXP_SGL a,FIXP_DBL b)307 inline FIXP_DBL fMultSub(FIXP_DBL x, FIXP_SGL a, FIXP_DBL b)
308 { return fixmsub_SD(x, a, b); }
fMultSub(FIXP_DBL x,FIXP_DBL a,FIXP_SGL b)309 inline FIXP_DBL fMultSub(FIXP_DBL x, FIXP_DBL a, FIXP_SGL b)
310 { return fixmsub_DS(x, a, b); }
fMultSub(FIXP_DBL x,FIXP_SGL a,FIXP_SGL b)311 inline FIXP_DBL fMultSub(FIXP_DBL x, FIXP_SGL a, FIXP_SGL b)
312 { return fixmsub_SS(x, a, b); }
313
fMultAddDiv2BitExact(FIXP_DBL x,FIXP_DBL a,FIXP_DBL b)314 FDK_INLINE FIXP_DBL fMultAddDiv2BitExact(FIXP_DBL x, FIXP_DBL a, FIXP_DBL b)
315 { return fixmadddiv2BitExact_DD(x, a, b); }
fMultAddDiv2BitExact(FIXP_DBL x,FIXP_SGL a,FIXP_DBL b)316 FDK_INLINE FIXP_DBL fMultAddDiv2BitExact(FIXP_DBL x, FIXP_SGL a, FIXP_DBL b)
317 { return fixmadddiv2BitExact_SD(x, a, b); }
fMultAddDiv2BitExact(FIXP_DBL x,FIXP_DBL a,FIXP_SGL b)318 FDK_INLINE FIXP_DBL fMultAddDiv2BitExact(FIXP_DBL x, FIXP_DBL a, FIXP_SGL b)
319 { return fixmadddiv2BitExact_DS(x, a, b); }
fMultSubDiv2BitExact(FIXP_DBL x,FIXP_DBL a,FIXP_DBL b)320 FDK_INLINE FIXP_DBL fMultSubDiv2BitExact(FIXP_DBL x, FIXP_DBL a, FIXP_DBL b)
321 { return fixmsubdiv2BitExact_DD(x, a, b); }
fMultSubDiv2BitExact(FIXP_DBL x,FIXP_SGL a,FIXP_DBL b)322 FDK_INLINE FIXP_DBL fMultSubDiv2BitExact(FIXP_DBL x, FIXP_SGL a, FIXP_DBL b)
323 { return fixmsubdiv2BitExact_SD(x, a, b); }
fMultSubDiv2BitExact(FIXP_DBL x,FIXP_DBL a,FIXP_SGL b)324 FDK_INLINE FIXP_DBL fMultSubDiv2BitExact(FIXP_DBL x, FIXP_DBL a, FIXP_SGL b)
325 { return fixmsubdiv2BitExact_DS(x, a, b); }
326
327 #include "fixminmax.h"
328
fMin(FIXP_DBL a,FIXP_DBL b)329 FDK_INLINE FIXP_DBL fMin(FIXP_DBL a, FIXP_DBL b)
330 { return fixmin_D(a,b); }
fMax(FIXP_DBL a,FIXP_DBL b)331 FDK_INLINE FIXP_DBL fMax(FIXP_DBL a, FIXP_DBL b)
332 { return fixmax_D(a,b); }
333
fMin(FIXP_SGL a,FIXP_SGL b)334 FDK_INLINE FIXP_SGL fMin(FIXP_SGL a, FIXP_SGL b)
335 { return fixmin_S(a,b); }
fMax(FIXP_SGL a,FIXP_SGL b)336 FDK_INLINE FIXP_SGL fMax(FIXP_SGL a, FIXP_SGL b)
337 { return fixmax_S(a,b); }
338
339
340 /* workaround for TI C6x compiler but not for TI ARM9E */
341 #if ((!defined(__TI_COMPILER_VERSION__) || defined(__TI_TMS470_V5__)) && !defined(__x86_64__)) || (FIX_FRACT == 1)
fMax(INT a,INT b)342 FDK_INLINE INT fMax(INT a, INT b)
343 { return fixmax_I(a,b); }
fMin(INT a,INT b)344 FDK_INLINE INT fMin(INT a, INT b)
345 { return fixmin_I(a,b); }
346 #endif
347
fMax(UINT a,UINT b)348 inline UINT fMax(UINT a, UINT b)
349 { return fixmax_UI(a,b); }
fMin(UINT a,UINT b)350 inline UINT fMin(UINT a, UINT b)
351 { return fixmin_UI(a,b); }
352
353 /* Complex data types */
354 typedef shouldBeUnion {
355 /* vector representation for arithmetic */
356 struct {
357 FIXP_SGL re;
358 FIXP_SGL im;
359 } v;
360 /* word representation for memory move */
361 LONG w;
362 } FIXP_SPK;
363
364 typedef shouldBeUnion {
365 /* vector representation for arithmetic */
366 struct {
367 FIXP_DBL re;
368 FIXP_DBL im;
369 } v;
370 /* word representation for memory move */
371 INT64 w;
372 } FIXP_DPK;
373
374 #include "fixmul.h"
375 #include "fixmadd.h"
376 #include "cplx_mul.h"
377 #include "scale.h"
378 #include "fixpoint_math.h"
379
380 #endif
381