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