Imported Debian version 0.1.3.1
[deb_fdk-aac.git] / libFDK / include / FDK_tools_rom.h
1
2 /* -----------------------------------------------------------------------------------------------------------
3 Software 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
9 The Fraunhofer FDK AAC Codec Library for Android ("FDK AAC Codec") is software that implements
10 the MPEG Advanced Audio Coding ("AAC") encoding and decoding scheme for digital audio.
11 This FDK AAC Codec software is intended to be used on a wide variety of Android devices.
12
13 AAC's HE-AAC and HE-AAC v2 versions are regarded as today's most efficient general perceptual
14 audio codecs. AAC-ELD is considered the best-performing full-bandwidth communications codec by
15 independent studies and is widely deployed. AAC has been standardized by ISO and IEC as part
16 of the MPEG specifications.
17
18 Patent licenses for necessary patent claims for the FDK AAC Codec (including those of Fraunhofer)
19 may be obtained through Via Licensing (www.vialicensing.com) or through the respective patent owners
20 individually for the purpose of encoding or decoding bit streams in products that are compliant with
21 the ISO/IEC MPEG audio standards. Please note that most manufacturers of Android devices already license
22 these patent claims through Via Licensing or directly from the patent owners, and therefore FDK AAC Codec
23 software may already be covered under those patent licenses when it is used for those licensed purposes only.
24
25 Commercially-licensed AAC software libraries, including floating-point versions with enhanced sound quality,
26 are also available from Fraunhofer. Users are encouraged to check the Fraunhofer website for additional
27 applications information and documentation.
28
29 2. COPYRIGHT LICENSE
30
31 Redistribution and use in source and binary forms, with or without modification, are permitted without
32 payment of copyright license fees provided that you satisfy the following conditions:
33
34 You must retain the complete text of this software license in redistributions of the FDK AAC Codec or
35 your modifications thereto in source code form.
36
37 You must retain the complete text of this software license in the documentation and/or other materials
38 provided with redistributions of the FDK AAC Codec or your modifications thereto in binary form.
39 You must make available free of charge copies of the complete source code of the FDK AAC Codec and your
40 modifications thereto to recipients of copies in binary form.
41
42 The name of Fraunhofer may not be used to endorse or promote products derived from this library without
43 prior written permission.
44
45 You may not charge copyright license fees for anyone to use, copy or distribute the FDK AAC Codec
46 software or your modifications thereto.
47
48 Your modified versions of the FDK AAC Codec must carry prominent notices stating that you changed the software
49 and 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
53 3. NO PATENT LICENSE
54
55 NO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without limitation the patents of Fraunhofer,
56 ARE GRANTED BY THIS SOFTWARE LICENSE. Fraunhofer provides no warranty of patent non-infringement with
57 respect to this software.
58
59 You may use this FDK AAC Codec software or modifications thereto only for purposes that are authorized
60 by appropriate patent licenses.
61
62 4. DISCLAIMER
63
64 This 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
66 of merchantability and fitness for a particular purpose. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
67 CONTRIBUTORS BE LIABLE for any direct, indirect, incidental, special, exemplary, or consequential damages,
68 including but not limited to procurement of substitute goods or services; loss of use, data, or profits,
69 or business interruption, however caused and on any theory of liability, whether in contract, strict
70 liability, or tort (including negligence), arising in any way out of the use of this software, even if
71 advised of the possibility of such damage.
72
73 5. CONTACT INFORMATION
74
75 Fraunhofer Institute for Integrated Circuits IIS
76 Attention: Audio and Multimedia Departments - FDK AAC LL
77 Am Wolfsmantel 33
78 91058 Erlangen, Germany
79
80 www.iis.fraunhofer.de/amm
81 amm-info@iis.fraunhofer.de
82 ----------------------------------------------------------------------------------------------------------- */
83
84 /*************************** Fraunhofer IIS FDK Tools ***********************
85
86 Author(s): Oliver Moser
87 Description: ROM tables used by FDK tools
88
89 ******************************************************************************/
90
91 #ifndef __FDK_TOOLS_ROM_H__
92 #define __FDK_TOOLS_ROM_H__
93
94 #include "common_fix.h"
95 #include "FDK_audio.h"
96
97
98 /* None radix2 rotation vectors */
99 extern const FIXP_STB RotVectorReal60[60];
100 extern const FIXP_STB RotVectorImag60[60];
101 extern const FIXP_STB RotVectorReal240[240];
102 extern const FIXP_STB RotVectorImag240[240];
103 extern const FIXP_STB RotVectorReal480[480];
104 extern const FIXP_STB RotVectorImag480[480];
105
106
107 /* Regular sine tables */
108 extern const FIXP_STP SineTable512[];
109 extern const FIXP_STP SineTable480[];
110
111 /* AAC-LC windows */
112 extern const FIXP_WTP SineWindow1024[];
113 extern const FIXP_WTP KBDWindow1024[];
114 extern const FIXP_WTP SineWindow128[];
115 extern const FIXP_WTP KBDWindow128[];
116
117 extern const FIXP_WTP SineWindow960[];
118 extern const FIXP_WTP KBDWindow960[];
119 extern const FIXP_WTP SineWindow120[];
120 extern const FIXP_WTP KBDWindow120[];
121
122 /* AAC-LD windows */
123 extern const FIXP_WTP SineWindow512[];
124 #define LowOverlapWindow512 SineWindow128
125 extern const FIXP_WTP SineWindow480[];
126 #define LowOverlapWindow480 SineWindow120
127
128
129
130 extern const FIXP_WTP SineWindow64[];
131 extern const FIXP_WTP SineWindow32[];
132
133 /**
134 * \brief Helper table for window slope mapping. You should prefer the usage of the
135 * function FDKgetWindowSlope(), this table is only made public for some optimized
136 * access inside dct.cpp.
137 */
138 extern const FIXP_WTP *const windowSlopes[2][3][9];
139
140 /**
141 * \brief Window slope access helper. Obtain a window of given length and shape.
142 * \param length Length of the window slope.
143 * \param shape Shape index of the window slope. 0: sine window, 1: Kaiser-Bessel. Any other
144 * value is applied a mask of 1 to, mapping it to either 0 or 1.
145 * \param Pointer to window slope or NULL if the requested window slope is not available.
146 */
147 const FIXP_WTP * FDKgetWindowSlope(int length, int shape);
148
149 extern const FIXP_WTP sin_twiddle_L64[];
150
151 /*
152 * Filter coefficient type definition
153 */
154
155 #if defined(ARCH_PREFER_MULT_16x16) || defined(ARCH_PREFER_MULT_32x16)
156 #define QMF_COEFF_16BIT
157 #endif
158
159 #define QMF_FILTER_PROTOTYPE_SIZE 640
160 #define QMF_NO_POLY 5
161
162 #ifdef QMF_COEFF_16BIT
163 #define FIXP_PFT FIXP_SGL
164 #define FIXP_QTW FIXP_SGL
165 #else
166 #define FIXP_PFT FIXP_DBL
167 #define FIXP_QTW FIXP_DBL
168 #endif
169
170 #define QMF640_PFT_TABLE_SIZE (640/2 + QMF_NO_POLY)
171
172 extern const FIXP_QTW qmf_phaseshift_cos32[32];
173 extern const FIXP_QTW qmf_phaseshift_sin32[32];
174 /* Adapted analysis post-twiddles for down-sampled HQ SBR */
175 extern const FIXP_QTW qmf_phaseshift_cos_downsamp32[32];
176 extern const FIXP_QTW qmf_phaseshift_sin_downsamp32[32];
177 extern const FIXP_QTW qmf_phaseshift_cos64[64];
178 extern const FIXP_QTW qmf_phaseshift_sin64[64];
179
180 extern const FIXP_PFT qmf_64[QMF640_PFT_TABLE_SIZE+QMF_NO_POLY];
181
182
183
184
185
186 #define QMF640_CLDFB_PFT_TABLE_SIZE (640)
187 #define QMF320_CLDFB_PFT_TABLE_SIZE (320)
188 #define QMF_CLDFB_PFT_SCALE 1
189
190 extern const FIXP_QTW qmf_phaseshift_cos32_cldfb[32];
191 extern const FIXP_QTW qmf_phaseshift_sin32_cldfb[32];
192 extern const FIXP_QTW qmf_phaseshift_cos64_cldfb[64];
193 extern const FIXP_QTW qmf_phaseshift_sin64_cldfb[64];
194
195 extern const FIXP_PFT qmf_cldfb_640[QMF640_CLDFB_PFT_TABLE_SIZE];
196 extern const FIXP_PFT qmf_cldfb_320[QMF320_CLDFB_PFT_TABLE_SIZE];
197
198
199
200
201
202 /*
203 * Raw Data Block list stuff.
204 */
205 typedef enum {
206 element_instance_tag,
207 common_window,
208 global_gain,
209 ics_info, /* ics_reserved_bit, window_sequence, window_shape, max_sfb, scale_factor_grouping, predictor_data_present, ltp_data_present, ltp_data */
210 max_sfb,
211 ms, /* ms_mask_present, ms_used */
212 /*predictor_data_present,*/ /* part of ics_info */
213 ltp_data_present,
214 ltp_data,
215 section_data,
216 scale_factor_data,
217 pulse, /* pulse_data_present, pulse_data */
218 tns_data_present,
219 tns_data,
220 gain_control_data_present,
221 gain_control_data,
222 esc1_hcr,
223 esc2_rvlc,
224 spectral_data,
225
226 scale_factor_data_usac,
227 core_mode,
228 common_tw,
229 lpd_channel_stream,
230 tw_data,
231 noise,
232 ac_spectral_data,
233 fac_data,
234 tns_active, /* introduced in MPEG-D usac CD */
235 tns_data_present_usac,
236 common_max_sfb,
237
238
239 /* Non data list items */
240 adtscrc_start_reg1,
241 adtscrc_start_reg2,
242 adtscrc_end_reg1,
243 adtscrc_end_reg2,
244 drmcrc_start_reg,
245 drmcrc_end_reg,
246 next_channel,
247 next_channel_loop,
248 link_sequence,
249 end_of_sequence
250 } rbd_id_t;
251
252 struct element_list {
253 const rbd_id_t *id;
254 const struct element_list *next[2];
255 };
256
257 typedef struct element_list element_list_t;
258 /**
259 * \brief get elementary stream pieces list for given parameters.
260 * \param aot audio object type
261 * \param epConfig the epConfig value from the current Audio Specific Config
262 * \param nChannels amount of channels contained in the current element.
263 * \param layer the layer of the current element.
264 * \return element_list_t parser guidance structure.
265 */
266 const element_list_t * getBitstreamElementList(AUDIO_OBJECT_TYPE aot, SCHAR epConfig, UCHAR nChannels, UCHAR layer);
267
268
269 #endif
270