• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 /************************* MPEG-D DRC decoder library **************************
96 
97    Author(s):
98 
99    Description:
100 
101 *******************************************************************************/
102 
103 #ifndef DRCDEC_TYPES_H
104 #define DRCDEC_TYPES_H
105 
106 #include "common_fix.h"
107 
108 /* Data structures corresponding to static and dynamic DRC/Loudness payload
109    as defined in section 7 of MPEG-D DRC standard, ISO/IEC 23003-4 */
110 
111 /**************/
112 /* uniDrcGain */
113 /**************/
114 
115 typedef struct {
116   FIXP_SGL gainDb; /* e = 7 */
117   SHORT time;
118 } GAIN_NODE;
119 
120 /* uniDrcGainExtension() (Table 56) */
121 typedef struct {
122   UCHAR uniDrcGainExtType[8];
123   ULONG extBitSize[8 - 1];
124 } UNI_DRC_GAIN_EXTENSION;
125 
126 /* uniDrcGain() (Table 55) */
127 typedef struct {
128   UCHAR nNodes[12]; /* unsaturated value, i.e. as provided in bitstream */
129   GAIN_NODE gainNode[12][16];
130 
131   UCHAR uniDrcGainExtPresent;
132   UNI_DRC_GAIN_EXTENSION uniDrcGainExtension;
133 } UNI_DRC_GAIN, *HANDLE_UNI_DRC_GAIN;
134 
135 /****************/
136 /* uniDrcConfig */
137 /****************/
138 
139 typedef enum {
140   EB_NIGHT = 0x0001,
141   EB_NOISY = 0x0002,
142   EB_LIMITED = 0x0004,
143   EB_LOWLEVEL = 0x0008,
144   EB_DIALOG = 0x0010,
145   EB_GENERAL_COMPR = 0x0020,
146   EB_EXPAND = 0x0040,
147   EB_ARTISTIC = 0x0080,
148   EB_CLIPPING = 0x0100,
149   EB_FADE = 0x0200,
150   EB_DUCK_OTHER = 0x0400,
151   EB_DUCK_SELF = 0x0800
152 } EFFECT_BIT;
153 
154 typedef enum {
155   GCP_REGULAR = 0,
156   GCP_FADING = 1,
157   GCP_CLIPPING_DUCKING = 2,
158   GCP_CONSTANT = 3
159 } GAIN_CODING_PROFILE;
160 
161 typedef enum { GIT_SPLINE = 0, GIT_LINEAR = 1 } GAIN_INTERPOLATION_TYPE;
162 
163 typedef enum { CS_LEFT = 0, CS_RIGHT = 1 } CHARACTERISTIC_SIDE;
164 
165 typedef enum { CF_SIGMOID = 0, CF_NODES = 1 } CHARACTERISTIC_FORMAT;
166 
167 typedef enum {
168   GF_QMF32 = 0x1,
169   GF_QMFHYBRID39 = 0x2,
170   GF_QMF64 = 0x3,
171   GF_QMFHYBRID71 = 0x4,
172   GF_QMF128 = 0x5,
173   GF_QMFHYBRID135 = 0x6,
174   GF_UNIFORM = 0x7
175 } EQ_SUBBAND_GAIN_FORMAT;
176 
177 typedef struct {
178   UCHAR duckingScalingPresent;
179   FIXP_SGL duckingScaling; /* e = 2 */
180 } DUCKING_MODIFICATION;
181 
182 typedef struct {
183   UCHAR targetCharacteristicLeftPresent;
184   UCHAR targetCharacteristicLeftIndex;
185   UCHAR targetCharacteristicRightPresent;
186   UCHAR targetCharacteristicRightIndex;
187   UCHAR gainScalingPresent;
188   FIXP_SGL attenuationScaling;   /* e = 2 */
189   FIXP_SGL amplificationScaling; /* e = 2 */
190   UCHAR gainOffsetPresent;
191   FIXP_SGL gainOffset; /* e = 4 */
192 } GAIN_MODIFICATION;
193 
194 typedef union {
195   UCHAR crossoverFreqIndex;
196   USHORT startSubBandIndex;
197 } BAND_BORDER;
198 
199 typedef struct {
200   UCHAR left;
201   UCHAR right;
202 } CUSTOM_INDEX;
203 
204 typedef struct {
205   UCHAR present;
206   UCHAR isCICP;
207   union {
208     UCHAR cicpIndex;
209     CUSTOM_INDEX custom;
210   };
211 } DRC_CHARACTERISTIC;
212 
213 typedef struct {
214   UCHAR gainCodingProfile;
215   UCHAR gainInterpolationType;
216   UCHAR fullFrame;
217   UCHAR timeAlignment;
218   UCHAR timeDeltaMinPresent;
219   USHORT timeDeltaMin;
220   UCHAR bandCount;
221   UCHAR drcBandType;
222   UCHAR gainSequenceIndex[4];
223   DRC_CHARACTERISTIC drcCharacteristic[4];
224   BAND_BORDER bandBorder[4];
225 } GAIN_SET;
226 
227 typedef struct {
228   FIXP_SGL gain;    /* e = 6 */
229   FIXP_SGL ioRatio; /* e = 2 */
230   FIXP_SGL exp;     /* e = 5 */
231   UCHAR flipSign;
232 } CUSTOM_DRC_CHAR_SIGMOID;
233 
234 typedef struct {
235   UCHAR characteristicNodeCount;
236   FIXP_SGL nodeLevel[4 + 1]; /* e = 7 */
237   FIXP_SGL nodeGain[4 + 1];  /* e = 7 */
238 } CUSTOM_DRC_CHAR_NODES;
239 
240 typedef shouldBeUnion {
241   CUSTOM_DRC_CHAR_SIGMOID sigmoid;
242   CUSTOM_DRC_CHAR_NODES nodes;
243 }
244 CUSTOM_DRC_CHAR;
245 
246 /* drcCoefficientsUniDrc() (Table 67) */
247 typedef struct {
248   UCHAR drcLocation;
249   UCHAR drcFrameSizePresent;
250   USHORT drcFrameSize;
251   UCHAR characteristicLeftCount;
252   UCHAR characteristicLeftFormat[16];
253   CUSTOM_DRC_CHAR customCharacteristicLeft[16];
254   UCHAR characteristicRightCount;
255   UCHAR characteristicRightFormat[16];
256   CUSTOM_DRC_CHAR customCharacteristicRight[16];
257   UCHAR
258   gainSequenceCount;  /* unsaturated value, i.e. as provided in bitstream */
259   UCHAR gainSetCount; /* saturated to 12 */
260   GAIN_SET gainSet[12];
261   /* derived data */
262   UCHAR gainSetIndexForGainSequence[12];
263 } DRC_COEFFICIENTS_UNI_DRC;
264 
265 /* drcInstructionsUniDrc() (Table 72) */
266 typedef struct {
267   SCHAR drcSetId;
268   UCHAR drcSetComplexityLevel;
269   UCHAR drcLocation;
270   UCHAR drcApplyToDownmix;
271   UCHAR downmixIdCount;
272   UCHAR downmixId[8];
273   USHORT drcSetEffect;
274   UCHAR limiterPeakTargetPresent;
275   FIXP_SGL limiterPeakTarget; /* e = 5 */
276   UCHAR drcSetTargetLoudnessPresent;
277   SCHAR drcSetTargetLoudnessValueUpper;
278   SCHAR drcSetTargetLoudnessValueLower;
279   UCHAR dependsOnDrcSetPresent;
280   union {
281     SCHAR dependsOnDrcSet;
282     UCHAR noIndependentUse;
283   };
284   UCHAR requiresEq;
285   shouldBeUnion {
286     GAIN_MODIFICATION gainModificationForChannelGroup[8][4];
287     DUCKING_MODIFICATION duckingModificationForChannel[8];
288   };
289   SCHAR gainSetIndex[8];
290 
291   /* derived data */
292   UCHAR drcChannelCount;
293   UCHAR nDrcChannelGroups;
294   SCHAR gainSetIndexForChannelGroup[8];
295 } DRC_INSTRUCTIONS_UNI_DRC;
296 
297 /* channelLayout() (Table 62) */
298 typedef struct {
299   UCHAR baseChannelCount;
300   UCHAR layoutSignalingPresent;
301   UCHAR definedLayout;
302   UCHAR speakerPosition[8];
303 } CHANNEL_LAYOUT;
304 
305 /* downmixInstructions() (Table 63) */
306 typedef struct {
307   UCHAR downmixId;
308   UCHAR targetChannelCount;
309   UCHAR targetLayout;
310   UCHAR downmixCoefficientsPresent;
311   UCHAR bsDownmixOffset;
312   FIXP_DBL downmixCoefficient[8 * 8]; /* e = 2 */
313 } DOWNMIX_INSTRUCTIONS;
314 
315 typedef struct {
316   UCHAR uniDrcConfigExtType[8];
317   ULONG extBitSize[8 - 1];
318 } UNI_DRC_CONFIG_EXTENSION;
319 
320 /* uniDrcConfig() (Table 57) */
321 typedef struct {
322   UCHAR sampleRatePresent;
323   ULONG sampleRate;
324   UCHAR downmixInstructionsCountV0;
325   UCHAR downmixInstructionsCountV1;
326   UCHAR downmixInstructionsCount; /* saturated to 6 */
327   UCHAR drcCoefficientsUniDrcCountV0;
328   UCHAR drcCoefficientsUniDrcCountV1;
329   UCHAR drcCoefficientsUniDrcCount; /* saturated to 2 */
330   UCHAR drcInstructionsUniDrcCountV0;
331   UCHAR drcInstructionsUniDrcCountV1;
332   UCHAR drcInstructionsUniDrcCount; /* saturated to (12 + 1 + 6) */
333   CHANNEL_LAYOUT channelLayout;
334   DOWNMIX_INSTRUCTIONS downmixInstructions[6];
335   DRC_COEFFICIENTS_UNI_DRC drcCoefficientsUniDrc[2];
336   DRC_INSTRUCTIONS_UNI_DRC drcInstructionsUniDrc[(12 + 1 + 6)];
337   UCHAR uniDrcConfigExtPresent;
338   UNI_DRC_CONFIG_EXTENSION uniDrcConfigExt;
339 
340   /* derived data */
341   UCHAR drcInstructionsCountInclVirtual;
342   UCHAR diff;
343 } UNI_DRC_CONFIG, *HANDLE_UNI_DRC_CONFIG;
344 
345 /*******************/
346 /* loudnessInfoSet */
347 /*******************/
348 
349 typedef enum {
350   MD_UNKNOWN_OTHER = 0,
351   MD_PROGRAM_LOUDNESS = 1,
352   MD_ANCHOR_LOUDNESS = 2,
353   MD_MAX_OF_LOUDNESS_RANGE = 3,
354   MD_MOMENTARY_LOUDNESS_MAX = 4,
355   MD_SHORT_TERM_LOUDNESS_MAX = 5,
356   MD_LOUDNESS_RANGE = 6,
357   MD_MIXING_LEVEL = 7,
358   MD_ROOM_TYPE = 8,
359   MD_SHORT_TERM_LOUDNESS = 9
360 } METHOD_DEFINITION;
361 
362 typedef enum {
363   MS_UNKNOWN_OTHER = 0,
364   MS_EBU_R_128 = 1,
365   MS_BS_1770_4 = 2,
366   MS_BS_1770_4_PRE_PROCESSING = 3,
367   MS_USER = 4,
368   MS_EXPERT_PANEL = 5,
369   MS_BS_1771_1 = 6,
370   MS_RESERVED_A = 7,
371   MS_RESERVED_B = 8,
372   MS_RESERVED_C = 9,
373   MS_RESERVED_D = 10,
374   MS_RESERVED_E = 11
375 } MEASUREMENT_SYSTEM;
376 
377 typedef enum {
378   R_UKNOWN = 0,
379   R_UNVERIFIED = 1,
380   R_CEILING = 2,
381   R_ACCURATE = 3
382 } RELIABILITY;
383 
384 typedef struct {
385   UCHAR methodDefinition;
386   FIXP_DBL methodValue; /* e = 7 for all methodDefinitions */
387   UCHAR measurementSystem;
388   UCHAR reliability;
389 } LOUDNESS_MEASUREMENT;
390 
391 /* loudnessInfo() (Table 59) */
392 typedef struct {
393   SCHAR drcSetId;
394   UCHAR eqSetId;
395   UCHAR downmixId;
396   UCHAR samplePeakLevelPresent;
397   FIXP_DBL samplePeakLevel; /* e = 7 */
398   UCHAR truePeakLevelPresent;
399   FIXP_DBL truePeakLevel; /* e = 7 */
400   UCHAR truePeakLevelMeasurementSystem;
401   UCHAR truePeakLevelReliability;
402   UCHAR measurementCount; /* saturated to 8 */
403   LOUDNESS_MEASUREMENT loudnessMeasurement[8];
404 } LOUDNESS_INFO;
405 
406 /* loudnessInfoSetExtension() (Table 61) */
407 typedef struct {
408   UCHAR loudnessInfoSetExtType[8];
409   ULONG extBitSize[8 - 1];
410 } LOUDNESS_INFO_SET_EXTENSION;
411 
412 /* loudnessInfoSet() (Table 58) */
413 typedef struct {
414   UCHAR loudnessInfoAlbumCountV0;
415   UCHAR loudnessInfoAlbumCountV1;
416   UCHAR loudnessInfoAlbumCount; /* saturated to 12 */
417   UCHAR loudnessInfoCountV0;
418   UCHAR loudnessInfoCountV1;
419   UCHAR loudnessInfoCount; /* saturated to 12 */
420   LOUDNESS_INFO loudnessInfoAlbum[12];
421   LOUDNESS_INFO loudnessInfo[12];
422   UCHAR loudnessInfoSetExtPresent;
423   LOUDNESS_INFO_SET_EXTENSION loudnessInfoSetExt;
424   /* derived data */
425   UCHAR diff;
426 } LOUDNESS_INFO_SET, *HANDLE_LOUDNESS_INFO_SET;
427 
428 #endif
429