1 /* -----------------------------------------------------------------------------
2 Software License for The Fraunhofer FDK AAC Codec Library for Android
3 
4 © Copyright  1995 - 2018 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):   Manuel Jander
98 
99    Description: USAC related constants
100 
101 *******************************************************************************/
102 
103 #ifndef USACDEC_CONST_H
104 #define USACDEC_CONST_H
105 
106 /* scale factors */
107 #define SF_CODE 6       /* exponent of code[], fixed codebook vector */
108 #define SF_GAIN_C 16    /* exponent of gain code and smoothed gain code */
109 #define SF_EXC 16       /* exponent of exc[] and exc2[], excitation buffer */
110 #define SF_GAIN_P 1     /* exponent of gain_pit */
111 #define SF_PFAC 0       /* exponent of period/voicing factor */
112 #define SF_SYNTH SF_EXC /* exponent of synthesis buffer */
113 #define SF_A_COEFFS 3   /* exponent of LP domain synthesis filter coefficient */
114 #define SF_STAB 1       /* exponent of stability factor */
115 
116 /* definitions which are independent of coreCoderFrameLength */
117 #define M_LP_FILTER_ORDER 16 /* LP filter order */
118 
119 #define PIT_MIN_12k8 34    /* Minimum pitch lag with resolution 1/4 */
120 #define PIT_MAX_12k8 231   /* Maximum pitch lag for fs=12.8kHz */
121 #define FSCALE_DENOM 12800 /* Frequency scale denominator */
122 #define FAC_FSCALE_MIN \
123   6000 /* Minimum allowed frequency scale for acelp decoder */
124 
125 #if !defined(LPD_MAX_CORE_SR)
126 #define LPD_MAX_CORE_SR 24000 /* Default value from ref soft */
127 #endif
128 #define FAC_FSCALE_MAX \
129   LPD_MAX_CORE_SR /* Maximum allowed frequency scale for acelp decoder */
130 
131 /* Maximum pitch lag (= 411 for fs_max = 24000) */
132 #define PIT_MAX_TMP                                                            \
133   (PIT_MAX_12k8 +                                                              \
134    (6 *                                                                        \
135     ((((FAC_FSCALE_MAX * PIT_MIN_12k8) + (FSCALE_DENOM / 2)) / FSCALE_DENOM) - \
136      PIT_MIN_12k8)))
137 #if (PIT_MAX_TMP < \
138      256) /* cannot be smaller because of tcx time domain concealment */
139 #define PIT_MAX_MAX 256
140 #else
141 #define PIT_MAX_MAX PIT_MAX_TMP
142 #endif
143 
144 #define NB_DIV 4   /* number of division (20ms) per 80ms frame */
145 #define L_SUBFR 64 /* subframe size (5ms) */
146 #define BPF_SFD 1  /* bass postfilter delay (subframe) */
147 #define BPF_DELAY (BPF_SFD * L_SUBFR) /* bass postfilter delay (samples) */
148 
149 #define L_FILT 12  /* Delay of up-sampling filter (bass post-filter) */
150 #define L_EXTRA 96 /* for bass post-filter */
151 #define L_INTERPOL \
152   (16 + 1) /* Length of filter for interpolation (acelp decoder) */
153 
154 /* definitions for coreCoderFrameLength = 1024 */
155 #define L_FRAME_PLUS_1024 1024 /* length of one 80ms superframe */
156 #define L_DIV_1024 \
157   (L_FRAME_PLUS_1024 / NB_DIV) /* length of one acelp or tcx20 frame */
158 #define NB_SUBFR_1024 \
159   (L_DIV_1024 / L_SUBFR) /* number of 5ms subframe per division */
160 #define NB_SUBFR_SUPERFR_1024 \
161   (L_FRAME_PLUS_1024 / L_SUBFR) /* number of 5ms subframe per 80ms frame */
162 #define AAC_SFD_1024 (NB_SUBFR_SUPERFR_1024 / 2) /* AAC delay (subframe) */
163 #define AAC_DELAY_1024 (AAC_SFD_1024 * L_SUBFR)  /* AAC delay (samples) */
164 #define SYN_SFD_1024 (AAC_SFD_1024 - BPF_SFD) /* synthesis delay (subframe) */
165 #define SYN_DELAY_1024                                          \
166   (SYN_SFD_1024 * L_SUBFR)         /* synthesis delay (samples) \
167                                     */
168 #define LFAC_1024 (L_DIV_1024 / 2) /* FAC frame length */
169 #define LFAC_SHORT_1024 \
170   (L_DIV_1024 / 4)        /* for transitions EIGHT_SHORT FD->LPD and vv. */
171 #define FDNS_NPTS_1024 64 /* FD noise shaping resolution (64=100Hz/point) */
172 
173 /* definitions for coreCoderFrameLength = 768 */
174 #define L_FRAME_PLUS_768 768
175 #define L_DIV_768 \
176   (L_FRAME_PLUS_768 / NB_DIV) /* length of one acelp or tcx20 frame */
177 #define NB_SUBFR_768 \
178   (L_DIV_768 / L_SUBFR) /* number of 5ms subframe per division */
179 #define NB_SUBFR_SUPERFR_768 \
180   (L_FRAME_PLUS_768 / L_SUBFR) /* number of 5ms subframe per 80ms frame */
181 #define AAC_SFD_768 (NB_SUBFR_SUPERFR_768 / 2) /* AAC delay (subframe) */
182 #define AAC_DELAY_768 (AAC_SFD_768 * L_SUBFR)  /* AAC delay (samples) */
183 #define SYN_SFD_768 (AAC_SFD_768 - BPF_SFD)    /* synthesis delay (subframe) */
184 #define SYN_DELAY_768 (SYN_SFD_768 * L_SUBFR)  /* synthesis delay (samples) */
185 #define LFAC_768 (L_DIV_768 / 2)               /* FAC frame length */
186 #define LFAC_SHORT_768 \
187   (L_DIV_768 / 4) /* for transitions EIGHT_SHORT FD->LPD and vv. */
188 
189 /* maximum (used for memory allocation) */
190 #define L_FRAME_PLUS L_FRAME_PLUS_1024
191 #define L_DIV L_DIV_1024
192 #define NB_SUBFR NB_SUBFR_1024
193 #define NB_SUBFR_SUPERFR NB_SUBFR_SUPERFR_1024
194 #define AAC_SFD AAC_SFD_1024
195 #define AAC_DELAY AAC_DELAY_1024
196 #define SYN_SFD SYN_SFD_1024
197 #define SYN_DELAY SYN_DELAY_1024
198 #define LFAC LFAC_1024
199 #define LFAC_SHORT LFAC_SHORT_1024
200 #define FDNS_NPTS FDNS_NPTS_1024
201 
202 #endif /* USACDEC_CONST_H */
203