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 SysLib ********************** 85 86 Author(s): 87 88******************************************************************************/ 89 90/** \file machine_type.h 91 * \brief Type defines for various processors and compiler tools. 92 */ 93 94#if !defined(__MACHINE_TYPE_H__) 95#define __MACHINE_TYPE_H__ 96 97 98/* Library calling convention spec. __cdecl and friends might be added here as required. */ 99 #define LINKSPEC_H 100 #define LINKSPEC_CPP 101 102 103/** 104 * collate all corresponding compiler specific macros to detect a debug build, and set the DEBUG macro if that is the case. 105 */ 106#if defined(_DEBUG) 107#define DEBUG 108#endif 109 110 111/* for doxygen the following docu parts must be separated */ 112/** \var SCHAR 113 * Data type representing at least 1 byte signed integer on all supported platforms. 114 */ 115/** \var UCHAR 116 * Data type representing at least 1 byte unsigned integer on all supported platforms. 117 */ 118/** \var INT 119 * Data type representing at least 4 byte signed integer on all supported platforms. 120 */ 121/** \var UINT 122 * Data type representing at least 4 byte unsigned integer on all supported platforms. 123 */ 124/** \var LONG 125 * Data type representing 4 byte signed integer on all supported platforms. 126 */ 127/** \var ULONG 128 * Data type representing 4 byte unsigned integer on all supported platforms. 129 */ 130/** \var SHORT 131 * Data type representing 2 byte signed integer on all supported platforms. 132 */ 133/** \var USHORT 134 * Data type representing 2 byte unsigned integer on all supported platforms. 135 */ 136/** \var INT64 137 * Data type representing 8 byte signed integer on all supported platforms. 138 */ 139/** \var UINT64 140 * Data type representing 8 byte unsigned integer on all supported platforms. 141 */ 142/** \def SHORT_BITS 143 * Number of bits the data type short represents. sizeof() is not suited to get this info, 144 * because a byte is not always defined as 8 bits. 145 */ 146/** \def CHAR_BITS 147 * Number of bits the data type char represents. sizeof() is not suited to get this info, 148 * because a byte is not always defined as 8 bits. 149 */ 150/** \var INT_PCM 151 * Data type representing the width of input and output PCM samples. 152 */ 153 154 155 typedef signed int INT; 156 typedef unsigned int UINT; 157#ifdef __LP64__ 158 /* force FDK long-datatypes to 4 byte */ 159 /* jdr: Use defines to avoid type alias problems on 64 bit machines. */ 160 #define LONG INT 161 #define ULONG UINT 162#else /* __LP64__ */ 163 typedef signed long LONG; 164 typedef unsigned long ULONG; 165#endif /* __LP64__ */ 166 typedef signed short SHORT; 167 typedef unsigned short USHORT; 168 typedef signed char SCHAR; 169 typedef unsigned char UCHAR; 170 171 #define SHORT_BITS 16 172 #define CHAR_BITS 8 173 174 175/* Define 64 bit base integer type. */ 176#ifdef _MSC_VER 177 typedef __int64 INT64; 178 typedef unsigned __int64 UINT64; 179#else 180 typedef long long INT64; 181 typedef unsigned long long UINT64; 182#endif 183 184#ifndef NULL 185 #ifdef __cplusplus 186 #define NULL 0 187 #else 188 #define NULL ((void *)0) 189 #endif 190#endif 191 192/* Assert is functional on x86 PC's and also when debugging is turned on. */ 193#if defined(DEBUG) || defined(__i686__) || defined(__i586__) || defined(__i386__) || defined(__x86_64__) || defined(_M_IX86) || defined(FDK_DEBUG) || defined(FDK_ASSERT_ENABLE) 194 #include <assert.h> 195 #define FDK_ASSERT(x) assert(x) 196#else 197 #define FDK_ASSERT(ignore) 198#endif 199 200 typedef SHORT INT_PCM; 201 #define WAV_BITS 16 202 #define SAMPLE_BITS 16 203 #define SAMPLE_MAX (((LONG)1<<(SAMPLE_BITS-1))-1) 204 #define SAMPLE_MIN (~SAMPLE_MAX) 205 206/*! 207* \def RAM_ALIGN 208* Used to align memory as prefix before memory declaration. For example: 209 \code 210 RAM_ALIGN 211 int myArray[16]; 212 \endcode 213 214 Note, that not all platforms support this mechanism. For example with TI compilers 215 a preprocessor pragma is used, but to do something like 216 217 \code 218 #define RAM_ALIGN #pragma DATA_ALIGN(x) 219 \encode 220 221 would require the preprocessor to process this line twice to fully resolve it. Hence, 222 a fully platform-independant way to use alignment is not supported. 223 224* \def ALIGNMENT_DEFAULT 225* Default alignment in bytes. 226*/ 227#if defined(__GNUC__) /* cppp replaced: elif */ 228 #define ALIGNMENT_DEFAULT 8 229 #define RAM_ALIGN __attribute__((aligned(ALIGNMENT_DEFAULT))) 230#else 231 #define ALIGNMENT_DEFAULT 8 232 #define RAM_ALIGN 233#endif 234 235 236/*! 237* \def RESTRICT 238* The restrict keyword is supported by some platforms and RESTRICT maps to 239* either the corresponding keyword on each platform or to void if the 240* compiler does not provide such feature. 241* 242* \def WORD_ALIGNED(x) 243* Tells the compiler that pointer x is WORD aligned. 244* At the moment only supported by TI compilers. 245* 246* \def DWORD_ALIGNED(x) 247* Tells the compiler that pointer x is DWORD aligned. 248* At the moment only supported by TI compilers. 249*/ 250 #define RESTRICT 251 #define WORD_ALIGNED(x) 252 #define DWORD_ALIGNED(x) 253 254 255/*----------------------------------------------------------------------------------- 256 * ALIGN_SIZE 257 *-----------------------------------------------------------------------------------*/ 258/*! 259 * \brief This macro aligns a given value depending on ::ALIGNMENT_DEFAULT. 260 * 261 * For example if #ALIGNMENT_DEFAULT equals 8, then: 262 * - ALIGN_SIZE(3) returns 8 263 * - ALIGN_SIZE(8) returns 8 264 * - ALIGN_SIZE(9) returns 16 265 */ 266#define ALIGN_SIZE(a) ((a)+ (((INT)ALIGNMENT_DEFAULT - ((INT)(a) & (ALIGNMENT_DEFAULT-1)) ) & (ALIGNMENT_DEFAULT-1))) 267 268/*----------------------------------------------------------------------------------- 269 * ALIGN_PTR 270 * cast (a) to width of pointer 271 *-----------------------------------------------------------------------------------*/ 272/*! 273 * \brief This macro aligns a given address depending on ::ALIGNMENT_DEFAULT. 274 */ 275#define ALIGN_PTR(a) ( (unsigned char*)(a) + (((INT)ALIGNMENT_DEFAULT - ((INT)(UINT64)(a) & (ALIGNMENT_DEFAULT-1)) ) & (ALIGNMENT_DEFAULT-1)) ) 276 277 /* Alignment macro for libSYS heap implementation */ 278#define ALIGNMENT_EXTRES ( ALIGNMENT_DEFAULT ) 279#define ALGN_SIZE_EXTRES(a) ((a)+ (((INT)ALIGNMENT_EXTRES - ((INT)(a) & (ALIGNMENT_EXTRES-1)) ) & (ALIGNMENT_EXTRES-1))) 280 281 282/*! 283 * \def FORCEINLINE 284 * Sometimes compiler do not do what they are told to do, and in case of inlining some 285 * additional command might be necessary depending on the platform. 286 * 287 * \def FDK_INLINE 288 * Defines how the compiler is told to inline stuff. 289 */ 290#ifdef DEBUG 291#undef FORCEINLINE 292#define FORCEINLINE 293#else 294#ifndef FORCEINLINE 295 #if defined(__GNUC__) /* cppp replaced: elif */ 296 #define FORCEINLINE __attribute((always_inline)) 297 #else 298 #define FORCEINLINE 299 #endif 300#endif 301#endif 302 303 /* for all other platforms */ 304 #define FDK_INLINE inline 305 306 307/*! 308 * \def LNK_SECTION_DATA_L1 309 * The LNK_SECTION_* defines allow memory to be drawn from specific memory 310 * sections. Used as prefix before variable declaration. 311 * 312 * \def LNK_SECTION_DATA_L2 313 * See ::LNK_SECTION_DATA_L1 314 * \def LNK_SECTION_L1_DATA_A 315 * See ::LNK_SECTION_DATA_L1 316 * \def LNK_SECTION_L1_DATA_B 317 * See ::LNK_SECTION_DATA_L1 318 * \def LNK_SECTION_CONSTDATA_L1 319 * See ::LNK_SECTION_DATA_L1 320 * \def LNK_SECTION_CONSTDATA 321 * See ::LNK_SECTION_DATA_L1 322 * \def LNK_SECTION_CODE_L1 323 * See ::LNK_SECTION_DATA_L1 324 * \def LNK_SECTION_CODE_L2 325 * See ::LNK_SECTION_DATA_L1 326 * \def LNK_SECTION_INITCODE 327 * See ::LNK_SECTION_DATA_L1 328 */ 329/************************************************** 330 * Code Section macros 331 **************************************************/ 332 #define LNK_SECTION_CODE_L1 333 #define LNK_SECTION_CODE_L2 334 #define LNK_SECTION_INITCODE 335 336/* Memory section macros. */ 337 338 /* default fall back */ 339 #define LNK_SECTION_DATA_L1 340 #define LNK_SECTION_DATA_L2 341 #define LNK_SECTION_CONSTDATA 342 #define LNK_SECTION_CONSTDATA_L1 343 344 #define LNK_SECTION_L1_DATA_A 345 #define LNK_SECTION_L1_DATA_B 346 347 348#ifdef _MSC_VER 349 /* 350 * Sometimes certain features are excluded from compilation and therefore the warning 4065 may occur: 351 * "switch statement contains 'default' but no 'case' labels" 352 * We consider this warning irrelevant and disable it. 353 */ 354 #pragma warning( disable : 4065 ) 355#endif 356 357#endif /* __MACHINE_TYPE_H__ */ 358