2
0

cplx_mul.h 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269
  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: fixed point intrinsics
  65. ******************************************************************************/
  66. #include "common_fix.h"
  67. #if !defined(__CPLX_Mult_H__)
  68. #define __CPLX_Mult_H__
  69. #if defined(__CC_ARM) || defined(__arm__) || defined(_M_ARM) /* cppp replaced: elif */
  70. #include "arm/cplx_mul.h"
  71. #elif defined(__GNUC__) && defined(__mips__) && __mips_isa_rev < 6
  72. #include "mips/cplx_mul.h"
  73. #endif /* #if defined all cores: bfin, arm, etc. */
  74. /* ############################################################################# */
  75. /* Fallback generic implementations */
  76. #if !defined(FUNCTION_cplxMultDiv2_32x16X2)
  77. #define FUNCTION_cplxMultDiv2_32x16X2
  78. inline void cplxMultDiv2( FIXP_DBL *c_Re,
  79. FIXP_DBL *c_Im,
  80. const FIXP_DBL a_Re,
  81. const FIXP_DBL a_Im,
  82. const FIXP_SGL b_Re,
  83. const FIXP_SGL b_Im)
  84. {
  85. *c_Re = fMultDiv2(a_Re,b_Re) - fMultDiv2(a_Im,b_Im);
  86. *c_Im = fMultDiv2(a_Re,b_Im) + fMultDiv2(a_Im,b_Re);
  87. }
  88. #endif
  89. #if !defined(FUNCTION_cplxMultDiv2_32x16)
  90. #define FUNCTION_cplxMultDiv2_32x16
  91. inline void cplxMultDiv2( FIXP_DBL *c_Re,
  92. FIXP_DBL *c_Im,
  93. const FIXP_DBL a_Re,
  94. const FIXP_DBL a_Im,
  95. const FIXP_SPK w )
  96. {
  97. cplxMultDiv2(c_Re, c_Im, a_Re, a_Im, w.v.re, w.v.im);
  98. }
  99. #endif
  100. #if !defined(FUNCTION_cplxMultAddDiv2_32x16X2)
  101. #define FUNCTION_cplxMultAddDiv2_32x16X2
  102. inline void cplxMultAddDiv2( FIXP_DBL *c_Re,
  103. FIXP_DBL *c_Im,
  104. const FIXP_DBL a_Re,
  105. const FIXP_DBL a_Im,
  106. const FIXP_SGL b_Re,
  107. const FIXP_SGL b_Im)
  108. {
  109. *c_Re += fMultDiv2(a_Re,b_Re) - fMultDiv2(a_Im,b_Im);
  110. *c_Im += fMultDiv2(a_Re,b_Im) + fMultDiv2(a_Im,b_Re);
  111. }
  112. #endif
  113. #if !defined(FUNCTION_cplxMultSubDiv2_32x16X2)
  114. #define FUNCTION_cplxMultSubDiv2_32x16X2
  115. inline void cplxMultSubDiv2( FIXP_DBL *c_Re,
  116. FIXP_DBL *c_Im,
  117. const FIXP_DBL a_Re,
  118. const FIXP_DBL a_Im,
  119. const FIXP_SGL b_Re,
  120. const FIXP_SGL b_Im)
  121. {
  122. *c_Re -= fMultDiv2(a_Re,b_Re) - fMultDiv2(a_Im,b_Im);
  123. *c_Im -= fMultDiv2(a_Re,b_Im) + fMultDiv2(a_Im,b_Re);
  124. }
  125. #endif
  126. #if !defined(FUNCTION_cplxMultDiv2_32x32X2)
  127. #define FUNCTION_cplxMultDiv2_32x32X2
  128. inline void cplxMultDiv2( FIXP_DBL *c_Re,
  129. FIXP_DBL *c_Im,
  130. const FIXP_DBL a_Re,
  131. const FIXP_DBL a_Im,
  132. const FIXP_DBL b_Re,
  133. const FIXP_DBL b_Im)
  134. {
  135. *c_Re = fMultDiv2(a_Re,b_Re) - fMultDiv2(a_Im,b_Im);
  136. *c_Im = fMultDiv2(a_Re,b_Im) + fMultDiv2(a_Im,b_Re);
  137. }
  138. #endif
  139. #if !defined(FUNCTION_cplxMultDiv2_32x32)
  140. #define FUNCTION_cplxMultDiv2_32x32
  141. inline void cplxMultDiv2( FIXP_DBL *c_Re,
  142. FIXP_DBL *c_Im,
  143. const FIXP_DBL a_Re,
  144. const FIXP_DBL a_Im,
  145. const FIXP_DPK w)
  146. {
  147. cplxMultDiv2(c_Re, c_Im, a_Re, a_Im, w.v.re, w.v.im);
  148. }
  149. #endif
  150. #if !defined(FUNCTION_cplxMultSubDiv2_32x32X2)
  151. #define FUNCTION_cplxMultSubDiv2_32x32X2
  152. inline void cplxMultSubDiv2( FIXP_DBL *c_Re,
  153. FIXP_DBL *c_Im,
  154. const FIXP_DBL a_Re,
  155. const FIXP_DBL a_Im,
  156. const FIXP_DBL b_Re,
  157. const FIXP_DBL b_Im)
  158. {
  159. *c_Re -= fMultDiv2(a_Re,b_Re) - fMultDiv2(a_Im,b_Im);
  160. *c_Im -= fMultDiv2(a_Re,b_Im) + fMultDiv2(a_Im,b_Re);
  161. }
  162. #endif
  163. /* ############################################################################# */
  164. #if !defined(FUNCTION_cplxMult_32x16X2)
  165. #define FUNCTION_cplxMult_32x16X2
  166. inline void cplxMult( FIXP_DBL *c_Re,
  167. FIXP_DBL *c_Im,
  168. const FIXP_DBL a_Re,
  169. const FIXP_DBL a_Im,
  170. const FIXP_SGL b_Re,
  171. const FIXP_SGL b_Im)
  172. {
  173. *c_Re = fMult(a_Re,b_Re) - fMult(a_Im,b_Im);
  174. *c_Im = fMult(a_Re,b_Im) + fMult(a_Im,b_Re);
  175. }
  176. #endif
  177. #if !defined(FUNCTION_cplxMult_32x16)
  178. #define FUNCTION_cplxMult_32x16
  179. inline void cplxMult( FIXP_DBL *c_Re,
  180. FIXP_DBL *c_Im,
  181. const FIXP_DBL a_Re,
  182. const FIXP_DBL a_Im,
  183. const FIXP_SPK w )
  184. {
  185. cplxMult(c_Re, c_Im, a_Re, a_Im, w.v.re, w.v.im);
  186. }
  187. #endif
  188. #if !defined(FUNCTION_cplxMult_32x32X2)
  189. #define FUNCTION_cplxMult_32x32X2
  190. inline void cplxMult( FIXP_DBL *c_Re,
  191. FIXP_DBL *c_Im,
  192. const FIXP_DBL a_Re,
  193. const FIXP_DBL a_Im,
  194. const FIXP_DBL b_Re,
  195. const FIXP_DBL b_Im)
  196. {
  197. *c_Re = fMult(a_Re,b_Re) - fMult(a_Im,b_Im);
  198. *c_Im = fMult(a_Re,b_Im) + fMult(a_Im,b_Re);
  199. }
  200. #endif
  201. #if !defined(FUNCTION_cplxMult_32x32)
  202. #define FUNCTION_cplxMult_32x32
  203. inline void cplxMult( FIXP_DBL *c_Re,
  204. FIXP_DBL *c_Im,
  205. const FIXP_DBL a_Re,
  206. const FIXP_DBL a_Im,
  207. const FIXP_DPK w)
  208. {
  209. cplxMult(c_Re, c_Im, a_Re, a_Im, w.v.re, w.v.im);
  210. }
  211. #endif
  212. /* ############################################################################# */
  213. #endif /* __CPLX_Mult_H__ */