FDK_tools_rom.h 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  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): Oliver Moser
  64. Description: ROM tables used by FDK tools
  65. ******************************************************************************/
  66. #ifndef __FDK_TOOLS_ROM_H__
  67. #define __FDK_TOOLS_ROM_H__
  68. #include "common_fix.h"
  69. #include "FDK_audio.h"
  70. /* None radix2 rotation vectors */
  71. extern const FIXP_STB RotVectorReal60[60];
  72. extern const FIXP_STB RotVectorImag60[60];
  73. extern const FIXP_STB RotVectorReal240[240];
  74. extern const FIXP_STB RotVectorImag240[240];
  75. extern const FIXP_STB RotVectorReal480[480];
  76. extern const FIXP_STB RotVectorImag480[480];
  77. /* Regular sine tables */
  78. extern const FIXP_STP SineTable512[];
  79. extern const FIXP_STP SineTable480[];
  80. /* AAC-LC windows */
  81. extern const FIXP_WTP SineWindow1024[];
  82. extern const FIXP_WTP KBDWindow1024[];
  83. extern const FIXP_WTP SineWindow128[];
  84. extern const FIXP_WTP KBDWindow128[];
  85. extern const FIXP_WTP SineWindow960[];
  86. extern const FIXP_WTP KBDWindow960[];
  87. extern const FIXP_WTP SineWindow120[];
  88. extern const FIXP_WTP KBDWindow120[];
  89. /* AAC-LD windows */
  90. extern const FIXP_WTP SineWindow512[];
  91. #define LowOverlapWindow512 SineWindow128
  92. extern const FIXP_WTP SineWindow480[];
  93. #define LowOverlapWindow480 SineWindow120
  94. extern const FIXP_WTP SineWindow64[];
  95. extern const FIXP_WTP SineWindow32[];
  96. /**
  97. * \brief Helper table for window slope mapping. You should prefer the usage of the
  98. * function FDKgetWindowSlope(), this table is only made public for some optimized
  99. * access inside dct.cpp.
  100. */
  101. extern const FIXP_WTP *const windowSlopes[2][3][9];
  102. /**
  103. * \brief Window slope access helper. Obtain a window of given length and shape.
  104. * \param length Length of the window slope.
  105. * \param shape Shape index of the window slope. 0: sine window, 1: Kaiser-Bessel. Any other
  106. * value is applied a mask of 1 to, mapping it to either 0 or 1.
  107. * \param Pointer to window slope or NULL if the requested window slope is not available.
  108. */
  109. const FIXP_WTP * FDKgetWindowSlope(int length, int shape);
  110. extern const FIXP_WTP sin_twiddle_L64[];
  111. /*
  112. * Filter coefficient type definition
  113. */
  114. #if defined(ARCH_PREFER_MULT_16x16) || defined(ARCH_PREFER_MULT_32x16)
  115. #define QMF_COEFF_16BIT
  116. #endif
  117. #define QMF_FILTER_PROTOTYPE_SIZE 640
  118. #define QMF_NO_POLY 5
  119. #ifdef QMF_COEFF_16BIT
  120. #define FIXP_PFT FIXP_SGL
  121. #define FIXP_QTW FIXP_SGL
  122. #else
  123. #define FIXP_PFT FIXP_DBL
  124. #define FIXP_QTW FIXP_DBL
  125. #endif
  126. #define QMF640_PFT_TABLE_SIZE (640/2 + QMF_NO_POLY)
  127. extern const FIXP_QTW qmf_phaseshift_cos32[32];
  128. extern const FIXP_QTW qmf_phaseshift_sin32[32];
  129. /* Adapted analysis post-twiddles for down-sampled HQ SBR */
  130. extern const FIXP_QTW qmf_phaseshift_cos_downsamp32[32];
  131. extern const FIXP_QTW qmf_phaseshift_sin_downsamp32[32];
  132. extern const FIXP_QTW qmf_phaseshift_cos64[64];
  133. extern const FIXP_QTW qmf_phaseshift_sin64[64];
  134. extern const FIXP_PFT qmf_64[QMF640_PFT_TABLE_SIZE+QMF_NO_POLY];
  135. #define QMF640_CLDFB_PFT_TABLE_SIZE (640)
  136. #define QMF320_CLDFB_PFT_TABLE_SIZE (320)
  137. #define QMF_CLDFB_PFT_SCALE 1
  138. extern const FIXP_QTW qmf_phaseshift_cos32_cldfb[32];
  139. extern const FIXP_QTW qmf_phaseshift_sin32_cldfb[32];
  140. extern const FIXP_QTW qmf_phaseshift_cos64_cldfb[64];
  141. extern const FIXP_QTW qmf_phaseshift_sin64_cldfb[64];
  142. extern const FIXP_PFT qmf_cldfb_640[QMF640_CLDFB_PFT_TABLE_SIZE];
  143. extern const FIXP_PFT qmf_cldfb_320[QMF320_CLDFB_PFT_TABLE_SIZE];
  144. /*
  145. * Raw Data Block list stuff.
  146. */
  147. typedef enum {
  148. element_instance_tag,
  149. common_window,
  150. global_gain,
  151. ics_info, /* ics_reserved_bit, window_sequence, window_shape, max_sfb, scale_factor_grouping, predictor_data_present, ltp_data_present, ltp_data */
  152. max_sfb,
  153. ms, /* ms_mask_present, ms_used */
  154. /*predictor_data_present,*/ /* part of ics_info */
  155. ltp_data_present,
  156. ltp_data,
  157. section_data,
  158. scale_factor_data,
  159. pulse, /* pulse_data_present, pulse_data */
  160. tns_data_present,
  161. tns_data,
  162. gain_control_data_present,
  163. gain_control_data,
  164. esc1_hcr,
  165. esc2_rvlc,
  166. spectral_data,
  167. scale_factor_data_usac,
  168. core_mode,
  169. common_tw,
  170. lpd_channel_stream,
  171. tw_data,
  172. noise,
  173. ac_spectral_data,
  174. fac_data,
  175. tns_active, /* introduced in MPEG-D usac CD */
  176. tns_data_present_usac,
  177. common_max_sfb,
  178. /* Non data list items */
  179. adtscrc_start_reg1,
  180. adtscrc_start_reg2,
  181. adtscrc_end_reg1,
  182. adtscrc_end_reg2,
  183. drmcrc_start_reg,
  184. drmcrc_end_reg,
  185. next_channel,
  186. next_channel_loop,
  187. link_sequence,
  188. end_of_sequence
  189. } rbd_id_t;
  190. struct element_list {
  191. const rbd_id_t *id;
  192. const struct element_list *next[2];
  193. };
  194. typedef struct element_list element_list_t;
  195. /**
  196. * \brief get elementary stream pieces list for given parameters.
  197. * \param aot audio object type
  198. * \param epConfig the epConfig value from the current Audio Specific Config
  199. * \param nChannels amount of channels contained in the current element.
  200. * \param layer the layer of the current element.
  201. * \return element_list_t parser guidance structure.
  202. */
  203. const element_list_t * getBitstreamElementList(AUDIO_OBJECT_TYPE aot, SCHAR epConfig, UCHAR nChannels, UCHAR layer);
  204. #endif