1 /* -----------------------------------------------------------------------------
2 Software License for The Fraunhofer FDK AAC Codec Library for Android
3 
4 © Copyright  1995 - 2019 Fraunhofer-Gesellschaft zur Förderung der angewandten
5 Forschung e.V. All rights reserved.
6 
7  1.    INTRODUCTION
8 The Fraunhofer FDK AAC Codec Library for Android ("FDK AAC Codec") is software
9 that implements the MPEG Advanced Audio Coding ("AAC") encoding and decoding
10 scheme for digital audio. This FDK AAC Codec software is intended to be used on
11 a wide variety of Android devices.
12 
13 AAC's HE-AAC and HE-AAC v2 versions are regarded as today's most efficient
14 general perceptual audio codecs. AAC-ELD is considered the best-performing
15 full-bandwidth communications codec by independent studies and is widely
16 deployed. AAC has been standardized by ISO and IEC as part of the MPEG
17 specifications.
18 
19 Patent licenses for necessary patent claims for the FDK AAC Codec (including
20 those of Fraunhofer) may be obtained through Via Licensing
21 (www.vialicensing.com) or through the respective patent owners individually for
22 the purpose of encoding or decoding bit streams in products that are compliant
23 with the ISO/IEC MPEG audio standards. Please note that most manufacturers of
24 Android devices already license these patent claims through Via Licensing or
25 directly from the patent owners, and therefore FDK AAC Codec software may
26 already be covered under those patent licenses when it is used for those
27 licensed purposes only.
28 
29 Commercially-licensed AAC software libraries, including floating-point versions
30 with enhanced sound quality, are also available from Fraunhofer. Users are
31 encouraged to check the Fraunhofer website for additional applications
32 information and documentation.
33 
34 2.    COPYRIGHT LICENSE
35 
36 Redistribution and use in source and binary forms, with or without modification,
37 are permitted without payment of copyright license fees provided that you
38 satisfy the following conditions:
39 
40 You must retain the complete text of this software license in redistributions of
41 the FDK AAC Codec or your modifications thereto in source code form.
42 
43 You must retain the complete text of this software license in the documentation
44 and/or other materials provided with redistributions of the FDK AAC Codec or
45 your modifications thereto in binary form. You must make available free of
46 charge copies of the complete source code of the FDK AAC Codec and your
47 modifications thereto to recipients of copies in binary form.
48 
49 The name of Fraunhofer may not be used to endorse or promote products derived
50 from this library without prior written permission.
51 
52 You may not charge copyright license fees for anyone to use, copy or distribute
53 the FDK AAC Codec software or your modifications thereto.
54 
55 Your modified versions of the FDK AAC Codec must carry prominent notices stating
56 that you changed the software and the date of any change. For modified versions
57 of the FDK AAC Codec, the term "Fraunhofer FDK AAC Codec Library for Android"
58 must be replaced by the term "Third-Party Modified Version of the Fraunhofer FDK
59 AAC Codec Library for Android."
60 
61 3.    NO PATENT LICENSE
62 
63 NO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without
64 limitation the patents of Fraunhofer, ARE GRANTED BY THIS SOFTWARE LICENSE.
65 Fraunhofer provides no warranty of patent non-infringement with respect to this
66 software.
67 
68 You may use this FDK AAC Codec software or modifications thereto only for
69 purposes that are authorized by appropriate patent licenses.
70 
71 4.    DISCLAIMER
72 
73 This FDK AAC Codec software is provided by Fraunhofer on behalf of the copyright
74 holders and contributors "AS IS" and WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES,
75 including but not limited to the implied warranties of merchantability and
76 fitness for a particular purpose. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
77 CONTRIBUTORS BE LIABLE for any direct, indirect, incidental, special, exemplary,
78 or consequential damages, including but not limited to procurement of substitute
79 goods or services; loss of use, data, or profits, or business interruption,
80 however caused and on any theory of liability, whether in contract, strict
81 liability, or tort (including negligence), arising in any way out of the use of
82 this software, even if advised of the possibility of such damage.
83 
84 5.    CONTACT INFORMATION
85 
86 Fraunhofer Institute for Integrated Circuits IIS
87 Attention: Audio and Multimedia Departments - FDK AAC LL
88 Am Wolfsmantel 33
89 91058 Erlangen, Germany
90 
91 www.iis.fraunhofer.de/amm
92 amm-info@iis.fraunhofer.de
93 ----------------------------------------------------------------------------- */
94 
95 /**************************** AAC decoder library ******************************
96 
97    Author(s):   Josef Hoepfl
98 
99    Description: Definition of constant tables
100 
101 *******************************************************************************/
102 
103 #ifndef AAC_ROM_H
104 #define AAC_ROM_H
105 
106 #include "common_fix.h"
107 #include "FDK_audio.h"
108 #include "aacdec_hcr_types.h"
109 #include "aacdec_hcrs.h"
110 
111 #define PCM_AAC LONG
112 #define PCM_DEC FIXP_DBL
113 #define MAXVAL_PCM_DEC MAXVAL_DBL
114 #define MINVAL_PCM_DEC MINVAL_DBL
115 #define FIXP_DBL2PCM_DEC(x) (x)
116 #define PCM_DEC2FIXP_DBL(x) (x)
117 #define PCM_DEC_BITS DFRACT_BITS
118 #define PCM_DEC2FX_PCM(x) FX_DBL2FX_PCM(x)
119 #define FX_PCM2PCM_DEC(x) FX_PCM2FX_DBL(x)
120 
121 #define AACDEC_MAX_CH_CONF 14
122 #define AACDEC_CH_ELEMENTS_TAB_SIZE 7 /*!< Size of element tables */
123 
124 #define AAC_NF_NO_RANDOM_VAL \
125   512 /*!< Size of random number array for noise floor */
126 
127 #define INV_QUANT_TABLESIZE 256
128 
129 extern const FIXP_DBL InverseQuantTable[INV_QUANT_TABLESIZE + 1];
130 extern const FIXP_DBL MantissaTable[4][14];
131 extern const SCHAR ExponentTable[4][14];
132 
133 #define NUM_LD_COEF_512 1536
134 #define NUM_LD_COEF_480 1440
135 /* Window table partition exponents. */
136 #define WTS0 (1)
137 #define WTS1 (0)
138 #define WTS2 (-2)
139 extern const FIXP_WTB LowDelaySynthesis512[1536];
140 extern const FIXP_WTB LowDelaySynthesis480[1440];
141 extern const FIXP_WTB LowDelaySynthesis256[768];
142 extern const FIXP_WTB LowDelaySynthesis240[720];
143 extern const FIXP_WTB LowDelaySynthesis160[480];
144 extern const FIXP_WTB LowDelaySynthesis128[384];
145 extern const FIXP_WTB LowDelaySynthesis120[360];
146 
147 typedef struct {
148   const SHORT *sfbOffsetLong;
149   const SHORT *sfbOffsetShort;
150   UCHAR numberOfSfbLong;
151   UCHAR numberOfSfbShort;
152 } SFB_INFO;
153 
154 extern const SFB_INFO sfbOffsetTables[5][16];
155 
156 /* Huffman tables */
157 enum { HuffmanBits = 2, HuffmanEntries = (1 << HuffmanBits) };
158 
159 typedef struct {
160   const USHORT (*CodeBook)[HuffmanEntries];
161   UCHAR Dimension;
162   UCHAR numBits;
163   UCHAR Offset;
164 } CodeBookDescription;
165 
166 extern const CodeBookDescription AACcodeBookDescriptionTable[13];
167 extern const CodeBookDescription AACcodeBookDescriptionSCL;
168 
169 extern const STATEFUNC aStateConstant2State[];
170 
171 extern const SCHAR aCodebook2StartInt[];
172 
173 extern const UCHAR aMinOfCbPair[];
174 extern const UCHAR aMaxOfCbPair[];
175 
176 extern const UCHAR aMaxCwLen[];
177 extern const UCHAR aDimCb[];
178 extern const UCHAR aDimCbShift[];
179 extern const UCHAR aSignCb[];
180 extern const UCHAR aCbPriority[];
181 
182 extern const UINT *aHuffTable[];
183 extern const SCHAR *aQuantTable[];
184 
185 extern const USHORT aLargestAbsoluteValue[];
186 
187 extern const UINT aHuffTreeRvlcEscape[];
188 extern const UINT aHuffTreeRvlCodewds[];
189 
190 extern const UCHAR tns_max_bands_tbl[13][2];
191 
192 extern const UCHAR tns_max_bands_tbl_480[13];
193 extern const UCHAR tns_max_bands_tbl_512[13];
194 
195 #define FIXP_TCC FIXP_DBL
196 
197 extern const FIXP_TCC FDKaacDec_tnsCoeff3[8];
198 extern const FIXP_TCC FDKaacDec_tnsCoeff4[16];
199 
200 extern const UCHAR FDKaacDec_tnsCoeff3_gain_ld[];
201 extern const UCHAR FDKaacDec_tnsCoeff4_gain_ld[];
202 
203 extern const USHORT AacDec_randomSign[AAC_NF_NO_RANDOM_VAL / 16];
204 
205 extern const FIXP_DBL pow2_div24minus1[47];
206 extern const int offsetTab[2][16];
207 
208 /* Channel mapping indices for time domain I/O.
209    The first dimension is the channel configuration index. */
210 extern const UCHAR channelMappingTablePassthrough[15][8];
211 extern const UCHAR channelMappingTableWAV[15][8];
212 
213 /* Lookup tables for elements in ER bitstream */
214 extern const MP4_ELEMENT_ID elementsTab[AACDEC_MAX_CH_CONF]
215                                        [AACDEC_CH_ELEMENTS_TAB_SIZE];
216 
217 #define SF_FNA_COEFFS \
218   1 /* Compile-time prescaler for MDST-filter coefficients. */
219 /* SF_FNA_COEFFS > 0 should only be considered for FIXP_DBL-coefficients  */
220 /* (i.e. if CPLX_PRED_FILTER_16BIT is not defined).                       */
221 /* With FIXP_DBL loss of precision is possible for SF_FNA_COEFFS > 11.    */
222 
223 #ifdef CPLX_PRED_FILTER_16BIT
224 #define FIXP_FILT FIXP_SGL
225 #define FILT(a) ((FL2FXCONST_SGL(a)) >> SF_FNA_COEFFS)
226 #else
227 #define FIXP_FILT FIXP_DBL
228 #define FILT(a) ((FL2FXCONST_DBL(a)) >> SF_FNA_COEFFS)
229 #endif
230 
231 extern const FIXP_FILT mdst_filt_coef_curr[20][3]; /* MDST-filter coefficient
232                                                       tables used for current
233                                                       window  */
234 extern const FIXP_FILT mdst_filt_coef_prev[6][4];  /* MDST-filter coefficient
235                                                       tables used for previous
236                                                       window */
237 
238 #endif /* #ifndef AAC_ROM_H */
239