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