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