FDK_archdef.h 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  1. /* -----------------------------------------------------------------------------------------------------------
  2. Software License for The Fraunhofer FDK AAC Codec Library for Android
  3. © Copyright 1995 - 2013 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V.
  4. All rights reserved.
  5. 1. INTRODUCTION
  6. The Fraunhofer FDK AAC Codec Library for Android ("FDK AAC Codec") is software that implements
  7. the MPEG Advanced Audio Coding ("AAC") encoding and decoding scheme for digital audio.
  8. This FDK AAC Codec software is intended to be used on a wide variety of Android devices.
  9. AAC's HE-AAC and HE-AAC v2 versions are regarded as today's most efficient general perceptual
  10. audio codecs. AAC-ELD is considered the best-performing full-bandwidth communications codec by
  11. independent studies and is widely deployed. AAC has been standardized by ISO and IEC as part
  12. of the MPEG specifications.
  13. Patent licenses for necessary patent claims for the FDK AAC Codec (including those of Fraunhofer)
  14. may be obtained through Via Licensing (www.vialicensing.com) or through the respective patent owners
  15. individually for the purpose of encoding or decoding bit streams in products that are compliant with
  16. the ISO/IEC MPEG audio standards. Please note that most manufacturers of Android devices already license
  17. these patent claims through Via Licensing or directly from the patent owners, and therefore FDK AAC Codec
  18. software may already be covered under those patent licenses when it is used for those licensed purposes only.
  19. Commercially-licensed AAC software libraries, including floating-point versions with enhanced sound quality,
  20. are also available from Fraunhofer. Users are encouraged to check the Fraunhofer website for additional
  21. applications information and documentation.
  22. 2. COPYRIGHT LICENSE
  23. Redistribution and use in source and binary forms, with or without modification, are permitted without
  24. payment of copyright license fees provided that you satisfy the following conditions:
  25. You must retain the complete text of this software license in redistributions of the FDK AAC Codec or
  26. your modifications thereto in source code form.
  27. You must retain the complete text of this software license in the documentation and/or other materials
  28. provided with redistributions of the FDK AAC Codec or your modifications thereto in binary form.
  29. You must make available free of charge copies of the complete source code of the FDK AAC Codec and your
  30. modifications thereto to recipients of copies in binary form.
  31. The name of Fraunhofer may not be used to endorse or promote products derived from this library without
  32. prior written permission.
  33. You may not charge copyright license fees for anyone to use, copy or distribute the FDK AAC Codec
  34. software or your modifications thereto.
  35. Your modified versions of the FDK AAC Codec must carry prominent notices stating that you changed the software
  36. and the date of any change. For modified versions of the FDK AAC Codec, the term
  37. "Fraunhofer FDK AAC Codec Library for Android" must be replaced by the term
  38. "Third-Party Modified Version of the Fraunhofer FDK AAC Codec Library for Android."
  39. 3. NO PATENT LICENSE
  40. NO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without limitation the patents of Fraunhofer,
  41. ARE GRANTED BY THIS SOFTWARE LICENSE. Fraunhofer provides no warranty of patent non-infringement with
  42. respect to this software.
  43. You may use this FDK AAC Codec software or modifications thereto only for purposes that are authorized
  44. by appropriate patent licenses.
  45. 4. DISCLAIMER
  46. This FDK AAC Codec software is provided by Fraunhofer on behalf of the copyright holders and contributors
  47. "AS IS" and WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, including but not limited to the implied warranties
  48. of merchantability and fitness for a particular purpose. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
  49. CONTRIBUTORS BE LIABLE for any direct, indirect, incidental, special, exemplary, or consequential damages,
  50. including but not limited to procurement of substitute goods or services; loss of use, data, or profits,
  51. or business interruption, however caused and on any theory of liability, whether in contract, strict
  52. liability, or tort (including negligence), arising in any way out of the use of this software, even if
  53. advised of the possibility of such damage.
  54. 5. CONTACT INFORMATION
  55. Fraunhofer Institute for Integrated Circuits IIS
  56. Attention: Audio and Multimedia Departments - FDK AAC LL
  57. Am Wolfsmantel 33
  58. 91058 Erlangen, Germany
  59. www.iis.fraunhofer.de/amm
  60. [email protected]
  61. ----------------------------------------------------------------------------------------------------------- */
  62. /*************************** Fraunhofer IIS FDK Tools ***********************
  63. Author(s):
  64. Description:
  65. ******************************************************************************/
  66. #ifndef __ARCH_H__
  67. #define __ARCH_H__
  68. /* Performance / Quality profile selector */
  69. #define FDK_HIGH_PERFORMANCE
  70. /* Unify some few toolchain specific defines to avoid having large "or" macro contraptions all over the source code. */
  71. /* Take action against VisualStudio 2005 crosscompile problems. */
  72. /* Use single macro (the GCC built in macro) for architecture identification independent of the particular toolchain */
  73. #if defined(__i386__) || defined(__i486__) || defined(__i586__) || defined(__i686__) || (defined(_MSC_VER) && defined(_M_IX86)) || defined (__x86_64__) || (defined(_MSC_VER) && defined(_M_X64))
  74. #define __x86__
  75. #endif
  76. #if (defined(_M_ARM) || defined(__CC_ARM)) && !defined(__arm__) || defined(__TI_TMS470_V5__) && !defined(__arm__)
  77. #define __arm__
  78. #endif
  79. #if defined(_ARCH_PPC) && !defined(__powerpc__)
  80. #define __powerpc__ 1
  81. #endif
  82. /* Define __ARM_ARCH_5TE__ if armv5te features are supported */
  83. #if (__TARGET_ARCH_ARM == 5) || defined(__TARGET_FEATURE_DSPMUL) || (_M_ARM == 5) || defined(__ARM_ARCH_5TEJ__) || defined(__TI_TMS470_V5__) || defined(__ARM_ARCH_7EM__)
  84. #define __ARM_ARCH_5TE__
  85. #endif
  86. /* Define __ARM_ARCH_6__ if the armv6 intructions are being supported. */
  87. #if (__TARGET_ARCH_ARM == 6) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6ZK__)
  88. #define __ARM_ARCH_5TE__
  89. #define __ARM_ARCH_6__
  90. #endif
  91. /* Define __ARM_ARCH_7_A__ if the armv7 intructions are being supported. */
  92. #if defined(__TARGET_ARCH_7_R) || defined(__ARM_ARCH_7R__)
  93. #define __ARM_ARCH_5TE__
  94. #define __ARM_ARCH_6__
  95. #define __ARM_ARCH_7_R__
  96. #endif
  97. /* Define __ARM_ARCH_7_A__ if the armv7 intructions are being supported. */
  98. #if defined(__TARGET_ARCH_7_A) || defined(__ARM_ARCH_7A__)
  99. #define __ARM_ARCH_5TE__
  100. #define __ARM_ARCH_6__
  101. #define __ARM_ARCH_7_A__
  102. #endif
  103. /* Define __ARM_ARCH_7M__ if the ARMv7-M instructions are being supported, e.g. Cortex-M3. */
  104. #if defined(__TARGET_ARCH_7_M) || defined(__ARM_ARCH_7_M__)
  105. #define __ARM_ARCH_7M__
  106. #endif
  107. /* Define __ARM_ARCH_7EM__ if the ARMv7-ME instructions are being supported, e.g. Cortex-M4. */
  108. #if defined(__TARGET_ARCH_7E_M) || defined(__ARM_ARCH_7E_M__)
  109. #define __ARM_ARCH_7EM__
  110. #endif
  111. /* Detect and unify macros for neon feature. */
  112. #if defined(__TARGET_FEATURE_NEON) && !defined(__ARM_NEON__)
  113. #define __ARM_NEON__
  114. #endif
  115. #ifdef _M_ARM
  116. #include "armintr.h"
  117. #endif
  118. /* Define preferred Multiplication type */
  119. #if defined(FDK_HIGH_PERFORMANCE) && !defined(FDK_HIGH_QUALITY) /* FDK_HIGH_PERFORMANCE */
  120. #if defined(__mips__) || defined(__sh__)
  121. #define ARCH_PREFER_MULT_16x16
  122. #undef SINETABLE_16BIT
  123. #undef POW2COEFF_16BIT
  124. #undef LDCOEFF_16BIT
  125. #undef WINDOWTABLE_16BIT
  126. #elif defined(__arm__) && defined(__ARM_ARCH_5TE__) /* cppp replaced: elif */ /* cppp replaced: elif */
  127. #define ARCH_PREFER_MULT_32x16
  128. #define SINETABLE_16BIT
  129. #define POW2COEFF_16BIT
  130. #define LDCOEFF_16BIT
  131. #define WINDOWTABLE_16BIT
  132. #elif defined(__arm__) && defined(__ARM_ARCH_7M__)
  133. #define ARCH_PREFER_MULT_32x16
  134. #define SINETABLE_16BIT
  135. #define POW2COEFF_16BIT
  136. #define LDCOEFF_16BIT
  137. #define WINDOWTABLE_16BIT
  138. #elif defined(__arm__) && defined(__ARM_ARCH_7EM__)
  139. #define ARCH_PREFER_MULT_32x32
  140. #define ARCH_PREFER_MULT_32x16
  141. #define SINETABLE_16BIT
  142. #define POW2COEFF_16BIT
  143. #define LDCOEFF_16BIT
  144. #define WINDOWTABLE_16BIT
  145. #elif defined(__arm__) && !defined(__ARM_ARCH_5TE__)
  146. #define ARCH_PREFER_MULT_16x16
  147. #undef SINETABLE_16BIT
  148. #undef WINDOWTABLE_16BIT
  149. #undef POW2COEFF_16BIT
  150. #undef LDCOEFF_16BIT
  151. #elif defined(__aarch64__) || defined(__AARCH64EL__)
  152. #define ARCH_PREFER_MULT_32x32
  153. #define ARCH_PREFER_MULT_32x16
  154. #define SINETABLE_16BIT
  155. #define POW2COEFF_16BIT
  156. #define LDCOEFF_16BIT
  157. #define WINDOWTABLE_16BIT
  158. #elif defined(__x86__) /* cppp replaced: elif */
  159. #define ARCH_PREFER_MULT_32x16
  160. #define SINETABLE_16BIT
  161. #define WINDOWTABLE_16BIT
  162. #define POW2COEFF_16BIT
  163. #define LDCOEFF_16BIT
  164. #elif defined(__powerpc__)
  165. #define ARCH_PREFER_MULT_32x32
  166. #define ARCH_PREFER_MULT_32x16
  167. #define SINETABLE_16BIT
  168. #define POW2COEFF_16BIT
  169. #define LDCOEFF_16BIT
  170. #define WINDOWTABLE_16BIT
  171. #else
  172. #warning >>>> Please set architecture characterization defines for your platform (FDK_HIGH_PERFORMANCE)! <<<<
  173. #endif /* Architecture switches */
  174. #else /* neither FDK_HIGH_QUALITY or FDK_HIGH_PERFORMANCE */
  175. #error Either set FDK_HIGH_QUALITY or FDK_HIGH_PERFORMANCE, but not both nor none of them.
  176. #endif /* End of quality/complexity tradeoff */
  177. #define FDKTOOLS_PACKED_TABLES
  178. #ifdef SINETABLE_16BIT
  179. #define FIXP_STB FIXP_SGL /* STB sinus Tab used in transformation */
  180. #define FIXP_STP FIXP_SPK
  181. #define STC(a) (FX_DBL2FXCONST_SGL(a))
  182. #else
  183. #define FIXP_STB FIXP_DBL
  184. #define FIXP_STP FIXP_DPK
  185. #define STC(a) ((FIXP_DBL)(LONG)(a))
  186. #endif /* defined(SINETABLE_16BIT) */
  187. #define STCP(cos,sin) { { STC(cos), STC(sin) } }
  188. #ifdef WINDOWTABLE_16BIT
  189. #define FIXP_WTB FIXP_SGL /* single FIXP_SGL values */
  190. #define FIXP_WTP FIXP_SPK /* packed FIXP_SGL values */
  191. #define WTC(a) FX_DBL2FXCONST_SGL(a)
  192. #else /* SINETABLE_16BIT */
  193. #define FIXP_WTB FIXP_DBL
  194. #define FIXP_WTP FIXP_DPK
  195. #define WTC(a) (FIXP_DBL)(a)
  196. #endif /* SINETABLE_16BIT */
  197. #define WTCP(a,b) { { WTC(a), WTC(b) } }
  198. #endif /* __ARCH_H__ */