1 2/* ----------------------------------------------------------------------------------------------------------- 3Software 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 9The Fraunhofer FDK AAC Codec Library for Android ("FDK AAC Codec") is software that implements 10the MPEG Advanced Audio Coding ("AAC") encoding and decoding scheme for digital audio. 11This FDK AAC Codec software is intended to be used on a wide variety of Android devices. 12 13AAC's HE-AAC and HE-AAC v2 versions are regarded as today's most efficient general perceptual 14audio codecs. AAC-ELD is considered the best-performing full-bandwidth communications codec by 15independent studies and is widely deployed. AAC has been standardized by ISO and IEC as part 16of the MPEG specifications. 17 18Patent licenses for necessary patent claims for the FDK AAC Codec (including those of Fraunhofer) 19may be obtained through Via Licensing (www.vialicensing.com) or through the respective patent owners 20individually for the purpose of encoding or decoding bit streams in products that are compliant with 21the ISO/IEC MPEG audio standards. Please note that most manufacturers of Android devices already license 22these patent claims through Via Licensing or directly from the patent owners, and therefore FDK AAC Codec 23software may already be covered under those patent licenses when it is used for those licensed purposes only. 24 25Commercially-licensed AAC software libraries, including floating-point versions with enhanced sound quality, 26are also available from Fraunhofer. Users are encouraged to check the Fraunhofer website for additional 27applications information and documentation. 28 292. COPYRIGHT LICENSE 30 31Redistribution and use in source and binary forms, with or without modification, are permitted without 32payment of copyright license fees provided that you satisfy the following conditions: 33 34You must retain the complete text of this software license in redistributions of the FDK AAC Codec or 35your modifications thereto in source code form. 36 37You must retain the complete text of this software license in the documentation and/or other materials 38provided with redistributions of the FDK AAC Codec or your modifications thereto in binary form. 39You must make available free of charge copies of the complete source code of the FDK AAC Codec and your 40modifications thereto to recipients of copies in binary form. 41 42The name of Fraunhofer may not be used to endorse or promote products derived from this library without 43prior written permission. 44 45You may not charge copyright license fees for anyone to use, copy or distribute the FDK AAC Codec 46software or your modifications thereto. 47 48Your modified versions of the FDK AAC Codec must carry prominent notices stating that you changed the software 49and 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 533. NO PATENT LICENSE 54 55NO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without limitation the patents of Fraunhofer, 56ARE GRANTED BY THIS SOFTWARE LICENSE. Fraunhofer provides no warranty of patent non-infringement with 57respect to this software. 58 59You may use this FDK AAC Codec software or modifications thereto only for purposes that are authorized 60by appropriate patent licenses. 61 624. DISCLAIMER 63 64This 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 66of merchantability and fitness for a particular purpose. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 67CONTRIBUTORS BE LIABLE for any direct, indirect, incidental, special, exemplary, or consequential damages, 68including but not limited to procurement of substitute goods or services; loss of use, data, or profits, 69or business interruption, however caused and on any theory of liability, whether in contract, strict 70liability, or tort (including negligence), arising in any way out of the use of this software, even if 71advised of the possibility of such damage. 72 735. CONTACT INFORMATION 74 75Fraunhofer Institute for Integrated Circuits IIS 76Attention: Audio and Multimedia Departments - FDK AAC LL 77Am Wolfsmantel 33 7891058 Erlangen, Germany 79 80www.iis.fraunhofer.de/amm 81amm-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) 115inline 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) 120inline 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) 130inline 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) 140inline 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) 145inline 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) 150inline 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) 160inline 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) 170inline 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 177inline 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 183inline 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 193inline 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 204inline 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 210inline 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 220inline 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) 232inline 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) 236inline 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) 245inline 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) 254inline 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) 259inline 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) 263inline 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) 272inline 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) 281inline 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) 286inline INT fixpadddiv2_D (FIXP_DBL x, const FIXP_DBL a) 287 { return (x + fPow2Div2(a)); } 288#endif 289#if !defined(FUNCTION_fixpow2add_D) 290inline INT fixpadd_D (FIXP_DBL x, const FIXP_DBL a) 291 { return (x + fPow2(a)); } 292#endif 293 294#if !defined(FUNCTION_fixpow2adddiv2_S) 295inline INT fixpadddiv2_S (FIXP_DBL x, const FIXP_SGL a) 296 { return (x + fPow2Div2(a)); } 297#endif 298#if !defined(FUNCTION_fixpow2add_S) 299inline 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