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 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 */
99extern const FIXP_STB RotVectorReal60[60];
100extern const FIXP_STB RotVectorImag60[60];
101extern const FIXP_STB RotVectorReal240[240];
102extern const FIXP_STB RotVectorImag240[240];
103extern const FIXP_STB RotVectorReal480[480];
104extern const FIXP_STB RotVectorImag480[480];
105
106
107/* Regular sine tables */
108extern const FIXP_STP SineTable512[];
109extern const FIXP_STP SineTable480[];
110
111/* AAC-LC windows */
112extern const FIXP_WTP SineWindow1024[];
113extern const FIXP_WTP KBDWindow1024[];
114extern const FIXP_WTP SineWindow128[];
115extern const FIXP_WTP KBDWindow128[];
116
117extern const FIXP_WTP SineWindow960[];
118extern const FIXP_WTP KBDWindow960[];
119extern const FIXP_WTP SineWindow120[];
120extern const FIXP_WTP KBDWindow120[];
121
122/* AAC-LD windows */
123extern const FIXP_WTP SineWindow512[];
124#define LowOverlapWindow512 SineWindow128
125extern const FIXP_WTP SineWindow480[];
126#define LowOverlapWindow480 SineWindow120
127
128
129
130extern const FIXP_WTP SineWindow64[];
131extern 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 */
138extern 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 */
147const FIXP_WTP * FDKgetWindowSlope(int length, int shape);
148
149extern 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
172extern const FIXP_QTW qmf_phaseshift_cos32[32];
173extern const FIXP_QTW qmf_phaseshift_sin32[32];
174/* Adapted analysis post-twiddles for down-sampled HQ SBR */
175extern const FIXP_QTW qmf_phaseshift_cos_downsamp32[32];
176extern const FIXP_QTW qmf_phaseshift_sin_downsamp32[32];
177extern const FIXP_QTW qmf_phaseshift_cos64[64];
178extern const FIXP_QTW qmf_phaseshift_sin64[64];
179
180extern 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
190extern const FIXP_QTW qmf_phaseshift_cos32_cldfb[32];
191extern const FIXP_QTW qmf_phaseshift_sin32_cldfb[32];
192extern const FIXP_QTW qmf_phaseshift_cos64_cldfb[64];
193extern const FIXP_QTW qmf_phaseshift_sin64_cldfb[64];
194
195extern const FIXP_PFT qmf_cldfb_640[QMF640_CLDFB_PFT_TABLE_SIZE];
196extern const FIXP_PFT qmf_cldfb_320[QMF320_CLDFB_PFT_TABLE_SIZE];
197
198
199
200
201
202/*
203 * Raw Data Block list stuff.
204 */
205typedef 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
252struct element_list {
253  const rbd_id_t *id;
254  const struct element_list *next[2];
255};
256
257typedef 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 */
266const element_list_t * getBitstreamElementList(AUDIO_OBJECT_TYPE aot, SCHAR epConfig, UCHAR nChannels, UCHAR layer);
267
268
269#endif
270
271