• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 
2 /* -----------------------------------------------------------------------------------------------------------
3 Software License for The Fraunhofer FDK AAC Codec Library for Android
4 
5 � Copyright  1995 - 2013 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: fixed point intrinsics
88 
89 ******************************************************************************/
90 
91 #if !defined(__FIXMADD_H__)
92 #define __FIXMADD_H__
93 
94 #include "FDK_archdef.h"
95 #include "machine_type.h"
96 #include "fixmul.h"
97 
98 #if defined(__arm__)
99 #include "arm/fixmadd_arm.h"
100 
101 #elif defined(__mips__)	/* cppp replaced: elif */
102 #include "mips/fixmadd_mips.h"
103 
104 #endif /* all cores */
105 
106 /*************************************************************************
107  *************************************************************************
108     Software fallbacks for missing functions.
109 **************************************************************************
110 **************************************************************************/
111 
112 /* Divide by two versions. */
113 
114 #if !defined(FUNCTION_fixmadddiv2_DD)
fixmadddiv2_DD(FIXP_DBL x,const FIXP_DBL a,const FIXP_DBL b)115 inline FIXP_DBL fixmadddiv2_DD (FIXP_DBL x, const FIXP_DBL a, const FIXP_DBL b)
116             { return (x + fMultDiv2 (a, b)); }
117 #endif
118 
119 #if !defined(FUNCTION_fixmadddiv2_SD)
fixmadddiv2_SD(FIXP_DBL x,const FIXP_SGL a,const FIXP_DBL b)120 inline FIXP_DBL fixmadddiv2_SD (FIXP_DBL x, const FIXP_SGL a, const FIXP_DBL b) {
121 #ifdef FUNCTION_fixmadddiv2_DS
122   return fixmadddiv2_DS(x, b, a);
123 #else
124   return fixmadddiv2_DD(x, FX_SGL2FX_DBL(a), b);
125 #endif
126 }
127 #endif
128 
129 #if !defined(FUNCTION_fixmadddiv2_DS)
fixmadddiv2_DS(FIXP_DBL x,const FIXP_DBL a,const FIXP_SGL b)130 inline FIXP_DBL fixmadddiv2_DS (FIXP_DBL x, const FIXP_DBL a, const FIXP_SGL b) {
131 #ifdef FUNCTION_fixmadddiv2_SD
132   return fixmadddiv2_SD(x, b, a);
133 #else
134   return fixmadddiv2_DD(x, a, FX_SGL2FX_DBL(b));
135 #endif
136 }
137 #endif
138 
139 #if !defined(FUNCTION_fixmadddiv2_SS)
fixmadddiv2_SS(FIXP_DBL x,const FIXP_SGL a,const FIXP_SGL b)140 inline FIXP_DBL fixmadddiv2_SS (FIXP_DBL x, const FIXP_SGL a, const FIXP_SGL b)
141             { return x + fMultDiv2(a,b); }
142 #endif
143 
144 #if !defined(FUNCTION_fixmsubdiv2_DD)
fixmsubdiv2_DD(FIXP_DBL x,const FIXP_DBL a,const FIXP_DBL b)145 inline FIXP_DBL fixmsubdiv2_DD (FIXP_DBL x, const FIXP_DBL a, const FIXP_DBL b)
146             { return (x - fMultDiv2 (a, b)); }
147 #endif
148 
149 #if !defined(FUNCTION_fixmsubdiv2_SD)
fixmsubdiv2_SD(FIXP_DBL x,const FIXP_SGL a,const FIXP_DBL b)150 inline FIXP_DBL fixmsubdiv2_SD (FIXP_DBL x, const FIXP_SGL a, const FIXP_DBL b) {
151 #ifdef FUNCTION_fixmsubdiv2_DS
152   return fixmsubdiv2_DS(x, b, a);
153 #else
154   return fixmsubdiv2_DD(x, FX_SGL2FX_DBL(a), b);
155 #endif
156 }
157 #endif
158 
159 #if !defined(FUNCTION_fixmsubdiv2_DS)
fixmsubdiv2_DS(FIXP_DBL x,const FIXP_DBL a,const FIXP_SGL b)160 inline FIXP_DBL fixmsubdiv2_DS (FIXP_DBL x, const FIXP_DBL a, const FIXP_SGL b) {
161 #ifdef FUNCTION_fixmsubdiv2_SD
162   return fixmsubdiv2_SD(x, b, a);
163 #else
164   return fixmsubdiv2_DD(x, a, FX_SGL2FX_DBL(b));
165 #endif
166 }
167 #endif
168 
169 #if !defined(FUNCTION_fixmsubdiv2_SS)
fixmsubdiv2_SS(FIXP_DBL x,const FIXP_SGL a,const FIXP_SGL b)170 inline FIXP_DBL fixmsubdiv2_SS (FIXP_DBL x, const FIXP_SGL a, const FIXP_SGL b)
171             { return x - fMultDiv2(a,b); }
172 #endif
173 
174 
175 #if !defined(FUNCTION_fixmadddiv2BitExact_DD)
176 #define FUNCTION_fixmadddiv2BitExact_DD
fixmadddiv2BitExact_DD(FIXP_DBL x,const FIXP_DBL a,const FIXP_DBL b)177 inline FIXP_DBL fixmadddiv2BitExact_DD (FIXP_DBL x, const FIXP_DBL a, const FIXP_DBL b) {
178   return x + fMultDiv2BitExact(a, b);
179 }
180 #endif
181 #if !defined(FUNCTION_fixmadddiv2BitExact_SD)
182 #define FUNCTION_fixmadddiv2BitExact_SD
fixmadddiv2BitExact_SD(FIXP_DBL x,const FIXP_SGL a,const FIXP_DBL b)183 inline FIXP_DBL fixmadddiv2BitExact_SD (FIXP_DBL x, const FIXP_SGL a, const FIXP_DBL b) {
184 #ifdef FUNCTION_fixmadddiv2BitExact_DS
185   return fixmadddiv2BitExact_DS(x, b, a);
186 #else
187   return x + fMultDiv2BitExact(a, b);
188 #endif
189 }
190 #endif
191 #if !defined(FUNCTION_fixmadddiv2BitExact_DS)
192 #define FUNCTION_fixmadddiv2BitExact_DS
fixmadddiv2BitExact_DS(FIXP_DBL x,const FIXP_DBL a,const FIXP_SGL b)193 inline FIXP_DBL fixmadddiv2BitExact_DS (FIXP_DBL x, const FIXP_DBL a, const FIXP_SGL b) {
194 #ifdef FUNCTION_fixmadddiv2BitExact_SD
195   return fixmadddiv2BitExact_SD(x, b, a);
196 #else
197   return x + fMultDiv2BitExact(a, b);
198 #endif
199 }
200 #endif
201 
202 #if !defined(FUNCTION_fixmsubdiv2BitExact_DD)
203 #define FUNCTION_fixmsubdiv2BitExact_DD
fixmsubdiv2BitExact_DD(FIXP_DBL x,const FIXP_DBL a,const FIXP_DBL b)204 inline FIXP_DBL fixmsubdiv2BitExact_DD (FIXP_DBL x, const FIXP_DBL a, const FIXP_DBL b) {
205   return x - fMultDiv2BitExact(a, b);
206 }
207 #endif
208 #if !defined(FUNCTION_fixmsubdiv2BitExact_SD)
209 #define FUNCTION_fixmsubdiv2BitExact_SD
fixmsubdiv2BitExact_SD(FIXP_DBL x,const FIXP_SGL a,const FIXP_DBL b)210 inline FIXP_DBL fixmsubdiv2BitExact_SD (FIXP_DBL x, const FIXP_SGL a, const FIXP_DBL b) {
211 #ifdef FUNCTION_fixmsubdiv2BitExact_DS
212   return fixmsubdiv2BitExact_DS(x, b, a);
213 #else
214   return x - fMultDiv2BitExact(a, b);
215 #endif
216 }
217 #endif
218 #if !defined(FUNCTION_fixmsubdiv2BitExact_DS)
219 #define FUNCTION_fixmsubdiv2BitExact_DS
fixmsubdiv2BitExact_DS(FIXP_DBL x,const FIXP_DBL a,const FIXP_SGL b)220 inline FIXP_DBL fixmsubdiv2BitExact_DS (FIXP_DBL x, const FIXP_DBL a, const FIXP_SGL b) {
221 #ifdef FUNCTION_fixmsubdiv2BitExact_SD
222   return fixmsubdiv2BitExact_SD(x, b, a);
223 #else
224   return x - fMultDiv2BitExact(a, b);
225 #endif
226 }
227 #endif
228 
229 /* Normal versions */
230 
231 #if !defined(FUNCTION_fixmadd_DD)
fixmadd_DD(FIXP_DBL x,const FIXP_DBL a,const FIXP_DBL b)232 inline FIXP_DBL fixmadd_DD (FIXP_DBL x, const FIXP_DBL a, const FIXP_DBL b)
233             { return fixmadddiv2_DD(x,a,b)<<1; }
234 #endif
235 #if !defined(FUNCTION_fixmadd_SD)
fixmadd_SD(FIXP_DBL x,const FIXP_SGL a,const FIXP_DBL b)236 inline FIXP_DBL fixmadd_SD (FIXP_DBL x, const FIXP_SGL a, const FIXP_DBL b) {
237 #ifdef FUNCTION_fixmadd_DS
238   return fixmadd_DS(x, b, a);
239 #else
240   return fixmadd_DD(x, FX_SGL2FX_DBL(a), b);
241 #endif
242 }
243 #endif
244 #if !defined(FUNCTION_fixmadd_DS)
fixmadd_DS(FIXP_DBL x,const FIXP_DBL a,const FIXP_SGL b)245 inline FIXP_DBL fixmadd_DS (FIXP_DBL x, const FIXP_DBL a, const FIXP_SGL b) {
246 #ifdef FUNCTION_fixmadd_SD
247   return fixmadd_SD(x, b, a);
248 #else
249   return fixmadd_DD(x, a, FX_SGL2FX_DBL(b));
250 #endif
251 }
252 #endif
253 #if !defined(FUNCTION_fixmadd_SS)
fixmadd_SS(FIXP_DBL x,const FIXP_SGL a,const FIXP_SGL b)254 inline FIXP_DBL fixmadd_SS (FIXP_DBL x, const FIXP_SGL a, const FIXP_SGL b)
255             { return (x + fMultDiv2(a,b))<<1; }
256 #endif
257 
258 #if !defined(FUNCTION_fixmsub_DD)
fixmsub_DD(FIXP_DBL x,const FIXP_DBL a,const FIXP_DBL b)259 inline FIXP_DBL fixmsub_DD (FIXP_DBL x, const FIXP_DBL a, const FIXP_DBL b)
260             { return fixmsubdiv2_DD(x,a,b)<<1; }
261 #endif
262 #if !defined(FUNCTION_fixmsub_SD)
fixmsub_SD(FIXP_DBL x,const FIXP_SGL a,const FIXP_DBL b)263 inline FIXP_DBL fixmsub_SD (FIXP_DBL x, const FIXP_SGL a, const FIXP_DBL b) {
264 #ifdef FUNCTION_fixmsub_DS
265   return fixmsub_DS(x, b, a);
266 #else
267   return fixmsub_DD(x, FX_SGL2FX_DBL(a), b);
268 #endif
269 }
270 #endif
271 #if !defined(FUNCTION_fixmsub_DS)
fixmsub_DS(FIXP_DBL x,const FIXP_DBL a,const FIXP_SGL b)272 inline FIXP_DBL fixmsub_DS (FIXP_DBL x, const FIXP_DBL a, const FIXP_SGL b) {
273 #ifdef FUNCTION_fixmsub_SD
274   return fixmsub_SD(x, b, a);
275 #else
276   return fixmsub_DD(x, a, FX_SGL2FX_DBL(b));
277 #endif
278 }
279 #endif
280 #if !defined(FUNCTION_fixmsub_SS)
fixmsub_SS(FIXP_DBL x,const FIXP_SGL a,const FIXP_SGL b)281 inline FIXP_DBL fixmsub_SS (FIXP_DBL x, const FIXP_SGL a, const FIXP_SGL b)
282             { return (x - fMultDiv2(a,b))<<1; }
283 #endif
284 
285 #if !defined(FUNCTION_fixpow2adddiv2_D)
fixpadddiv2_D(FIXP_DBL x,const FIXP_DBL a)286 inline INT fixpadddiv2_D (FIXP_DBL x, const FIXP_DBL a)
287             { return (x + fPow2Div2(a)); }
288 #endif
289 #if !defined(FUNCTION_fixpow2add_D)
fixpadd_D(FIXP_DBL x,const FIXP_DBL a)290 inline INT fixpadd_D (FIXP_DBL x, const FIXP_DBL a)
291             {  return (x + fPow2(a)); }
292 #endif
293 
294 #if !defined(FUNCTION_fixpow2adddiv2_S)
fixpadddiv2_S(FIXP_DBL x,const FIXP_SGL a)295 inline INT fixpadddiv2_S (FIXP_DBL x, const FIXP_SGL a)
296             { return (x + fPow2Div2(a)); }
297 #endif
298 #if !defined(FUNCTION_fixpow2add_S)
fixpadd_S(FIXP_DBL x,const FIXP_SGL a)299 inline INT fixpadd_S (FIXP_DBL x, const FIXP_SGL a)
300             {  return (x + fPow2(a)); }
301 #endif
302 
303 
304 
305 #endif // __FIXMADD_H__
306 
307