• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 /************************* MPEG-D DRC decoder library **************************
96 
97    Author(s):   Bernhard Neugebauer
98 
99    Description: MPEG-D DRC Decoder
100 
101 *******************************************************************************/
102 
103 #ifndef FDK_DRCDECLIB_H
104 #define FDK_DRCDECLIB_H
105 
106 #include "FDK_bitstream.h"
107 #include "FDK_audio.h"
108 #include "common_fix.h"
109 
110 /* DRC decoder according to ISO/IEC 23003-4 (MPEG-D DRC) */
111 /* including ISO/IEC 23003-4/AMD1 (Amendment 1) */
112 
113 #ifdef __cplusplus
114 extern "C" {
115 #endif
116 
117 typedef struct s_drc_decoder* HANDLE_DRC_DECODER;
118 typedef struct s_uni_drc_interface* HANDLE_UNI_DRC_INTERFACE;
119 typedef struct s_selection_process_output* HANDLE_SEL_PROC_OUTPUT;
120 
121 typedef enum {
122   DRC_DEC_SELECTION = 0x1, /* DRC decoder instance for DRC set selection only */
123   DRC_DEC_GAIN = 0x2,      /* DRC decoder instance for applying DRC only */
124   DRC_DEC_ALL = 0x3        /* DRC decoder with full functionality */
125 } DRC_DEC_FUNCTIONAL_RANGE;
126 
127 typedef enum {
128   /* get and set userparams */
129   DRC_DEC_BOOST,
130   DRC_DEC_COMPRESS,
131   /* set only userparams */
132   DRC_DEC_LOUDNESS_NORMALIZATION_ON,
133   DRC_DEC_TARGET_LOUDNESS, /**< target loudness in dB, with exponent e = 7 */
134   DRC_DEC_EFFECT_TYPE,
135   DRC_DEC_EFFECT_TYPE_FALLBACK_CODE,
136   DRC_DEC_LOUDNESS_MEASUREMENT_METHOD,
137   DRC_DEC_ALBUM_MODE,
138   /* set only system (not user) parameters */
139   DRC_DEC_DOWNMIX_ID,
140   DRC_DEC_TARGET_CHANNEL_COUNT_REQUESTED, /**< number of output channels
141                                              notified to FDK_drcDecLib for
142                                              choosing an appropriate
143                                              downmixInstruction */
144   DRC_DEC_BASE_CHANNEL_COUNT,
145   DRC_DEC_FRAME_SIZE,
146   DRC_DEC_SAMPLE_RATE,
147   /* get only system parameters */
148   DRC_DEC_IS_MULTIBAND_DRC_1,
149   DRC_DEC_IS_MULTIBAND_DRC_2,
150   DRC_DEC_IS_ACTIVE, /**< MPEG-D DRC payload is present and at least one of
151                         Dynamic Range Control (DRC) or Loudness Normalization
152                         (LN) is activated */
153   DRC_DEC_TARGET_CHANNEL_COUNT_SELECTED /**< number of output channels if
154                                            appropriate downmixInstruction exists
155                                          */
156 } DRC_DEC_USERPARAM;
157 
158 typedef enum {
159   DRC_DEC_OK = 0,
160 
161   DRC_DEC_NOT_OK = -10000,
162   DRC_DEC_OUT_OF_MEMORY,
163   DRC_DEC_NOT_OPENED,
164   DRC_DEC_NOT_READY,
165   DRC_DEC_PARAM_OUT_OF_RANGE,
166   DRC_DEC_INVALID_PARAM,
167   DRC_DEC_UNSUPPORTED_FUNCTION
168 } DRC_DEC_ERROR;
169 
170 typedef enum {
171   DRC_DEC_TEST_TIME_DOMAIN = -100,
172   DRC_DEC_TEST_QMF_DOMAIN,
173   DRC_DEC_TEST_STFT_DOMAIN,
174   DRC_DEC_CODEC_MODE_UNDEFINED = -1,
175   DRC_DEC_MPEG_4_AAC,
176   DRC_DEC_MPEG_D_USAC,
177   DRC_DEC_MPEG_H_3DA
178 } DRC_DEC_CODEC_MODE;
179 
180 /* Apply only DRC sets dedicated to processing location.
181    DRC1: before downmix
182    DRC2: before or after downmix (AMD1: only after downmix)
183    DRC3: after downmix */
184 typedef enum {
185   DRC_DEC_DRC1,
186   DRC_DEC_DRC1_DRC2,
187   DRC_DEC_DRC2,
188   DRC_DEC_DRC3,
189   DRC_DEC_DRC2_DRC3
190 } DRC_DEC_LOCATION;
191 
192 DRC_DEC_ERROR
193 FDK_drcDec_Open(HANDLE_DRC_DECODER* phDrcDec,
194                 const DRC_DEC_FUNCTIONAL_RANGE functionalRange);
195 
196 DRC_DEC_ERROR
197 FDK_drcDec_SetCodecMode(HANDLE_DRC_DECODER hDrcDec,
198                         const DRC_DEC_CODEC_MODE codecMode);
199 
200 DRC_DEC_ERROR
201 FDK_drcDec_Init(HANDLE_DRC_DECODER hDrcDec, const int frameSize,
202                 const int sampleRate, const int baseChannelCount);
203 
204 DRC_DEC_ERROR
205 FDK_drcDec_Close(HANDLE_DRC_DECODER* phDrcDec);
206 
207 /* set single user request */
208 DRC_DEC_ERROR
209 FDK_drcDec_SetParam(HANDLE_DRC_DECODER hDrcDec,
210                     const DRC_DEC_USERPARAM requestType,
211                     const FIXP_DBL requestValue);
212 
213 LONG FDK_drcDec_GetParam(HANDLE_DRC_DECODER hDrcDec,
214                          const DRC_DEC_USERPARAM requestType);
215 
216 DRC_DEC_ERROR
217 FDK_drcDec_SetInterfaceParameters(HANDLE_DRC_DECODER hDrcDec,
218                                   HANDLE_UNI_DRC_INTERFACE uniDrcInterface);
219 
220 DRC_DEC_ERROR
221 FDK_drcDec_SetSelectionProcessMpeghParameters_simple(
222     HANDLE_DRC_DECODER hDrcDec, const int groupPresetIdRequested,
223     const int numGroupIdsRequested, const int* groupIdsRequested);
224 
225 DRC_DEC_ERROR
226 FDK_drcDec_SetDownmixInstructions(HANDLE_DRC_DECODER hDrcDec,
227                                   const int numDowmixId, const int* downmixId,
228                                   const int* targetLayout,
229                                   const int* targetChannelCount);
230 
231 void FDK_drcDec_SetSelectionProcessOutput(
232     HANDLE_DRC_DECODER hDrcDec, HANDLE_SEL_PROC_OUTPUT hSelProcOutput);
233 
234 HANDLE_SEL_PROC_OUTPUT
235 FDK_drcDec_GetSelectionProcessOutput(HANDLE_DRC_DECODER hDrcDec);
236 
237 LONG /* FIXP_DBL, e = 7 */
238 FDK_drcDec_GetGroupLoudness(HANDLE_SEL_PROC_OUTPUT hSelProcOutput,
239                             const int groupID, int* groupLoudnessAvailable);
240 
241 void FDK_drcDec_SetChannelGains(HANDLE_DRC_DECODER hDrcDec,
242                                 const int numChannels, const int frameSize,
243                                 FIXP_DBL* channelGainDb, FIXP_DBL* audioBuffer,
244                                 const int audioBufferChannelOffset);
245 
246 DRC_DEC_ERROR
247 FDK_drcDec_ReadUniDrcConfig(HANDLE_DRC_DECODER hDrcDec,
248                             HANDLE_FDK_BITSTREAM hBitstream);
249 
250 DRC_DEC_ERROR
251 FDK_drcDec_ReadLoudnessInfoSet(HANDLE_DRC_DECODER hDrcDec,
252                                HANDLE_FDK_BITSTREAM hBitstream);
253 
254 DRC_DEC_ERROR
255 FDK_drcDec_ReadLoudnessBox(HANDLE_DRC_DECODER hDrcDec,
256                            HANDLE_FDK_BITSTREAM hBitstream);
257 
258 DRC_DEC_ERROR
259 FDK_drcDec_ReadDownmixInstructions_Box(HANDLE_DRC_DECODER hDrcDec,
260                                        HANDLE_FDK_BITSTREAM hBitstream);
261 
262 DRC_DEC_ERROR
263 FDK_drcDec_ReadUniDrcInstructions_Box(HANDLE_DRC_DECODER hDrcDec,
264                                       HANDLE_FDK_BITSTREAM hBitstream);
265 
266 DRC_DEC_ERROR
267 FDK_drcDec_ReadUniDrcCoefficients_Box(HANDLE_DRC_DECODER hDrcDec,
268                                       HANDLE_FDK_BITSTREAM hBitstream);
269 
270 DRC_DEC_ERROR
271 FDK_drcDec_ReadUniDrcGain(HANDLE_DRC_DECODER hDrcDec,
272                           HANDLE_FDK_BITSTREAM hBitstream);
273 
274 /* either call FDK_drcDec_ReadUniDrcConfig, FDK_drcDec_ReadLoudnessInfoSet and
275    FDK_drcDec_ReadUniDrcGain separately, or call FDK_drcDec_ReadUniDrc */
276 DRC_DEC_ERROR
277 FDK_drcDec_ReadUniDrc(HANDLE_DRC_DECODER hDrcDec,
278                       HANDLE_FDK_BITSTREAM hBitstream);
279 
280 /* calling sequence:
281    FDK_drcDec_Read...()
282    FDK_drcDec_SetChannelGains()
283    FDK_drcDec_Preprocess()
284    FDK_drcDec_Process...() */
285 
286 DRC_DEC_ERROR
287 FDK_drcDec_Preprocess(HANDLE_DRC_DECODER hDrcDec);
288 
289 DRC_DEC_ERROR
290 FDK_drcDec_ProcessTime(HANDLE_DRC_DECODER hDrcDec, const int delaySamples,
291                        const DRC_DEC_LOCATION drcLocation,
292                        const int channelOffset, const int drcChannelOffset,
293                        const int numChannelsProcessed, FIXP_DBL* realBuffer,
294                        const int timeDataChannelOffset);
295 
296 DRC_DEC_ERROR
297 FDK_drcDec_ProcessFreq(HANDLE_DRC_DECODER hDrcDec, const int delaySamples,
298                        const DRC_DEC_LOCATION drcLocation,
299                        const int channelOffset, const int drcChannelOffset,
300                        const int numChannelsProcessed,
301                        const int processSingleTimeslot, FIXP_DBL** realBuffer,
302                        FIXP_DBL** imagBuffer);
303 
304 DRC_DEC_ERROR
305 FDK_drcDec_ApplyDownmix(HANDLE_DRC_DECODER hDrcDec, int* reverseInChannelMap,
306                         int* reverseOutChannelMap, FIXP_DBL* realBuffer,
307                         int* pNChannels);
308 
309 /* Get library info for this module. */
310 DRC_DEC_ERROR
311 FDK_drcDec_GetLibInfo(LIB_INFO* info);
312 
313 #ifdef __cplusplus
314 }
315 #endif
316 #endif
317