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