1/* ----------------------------------------------------------------------------- 2Software License for The Fraunhofer FDK AAC Codec Library for Android 3 4© Copyright 1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten 5Forschung e.V. All rights reserved. 6 7 1. INTRODUCTION 8The Fraunhofer FDK AAC Codec Library for Android ("FDK AAC Codec") is software 9that implements the MPEG Advanced Audio Coding ("AAC") encoding and decoding 10scheme for digital audio. This FDK AAC Codec software is intended to be used on 11a wide variety of Android devices. 12 13AAC's HE-AAC and HE-AAC v2 versions are regarded as today's most efficient 14general perceptual audio codecs. AAC-ELD is considered the best-performing 15full-bandwidth communications codec by independent studies and is widely 16deployed. AAC has been standardized by ISO and IEC as part of the MPEG 17specifications. 18 19Patent licenses for necessary patent claims for the FDK AAC Codec (including 20those of Fraunhofer) may be obtained through Via Licensing 21(www.vialicensing.com) or through the respective patent owners individually for 22the purpose of encoding or decoding bit streams in products that are compliant 23with the ISO/IEC MPEG audio standards. Please note that most manufacturers of 24Android devices already license these patent claims through Via Licensing or 25directly from the patent owners, and therefore FDK AAC Codec software may 26already be covered under those patent licenses when it is used for those 27licensed purposes only. 28 29Commercially-licensed AAC software libraries, including floating-point versions 30with enhanced sound quality, are also available from Fraunhofer. Users are 31encouraged to check the Fraunhofer website for additional applications 32information and documentation. 33 342. COPYRIGHT LICENSE 35 36Redistribution and use in source and binary forms, with or without modification, 37are permitted without payment of copyright license fees provided that you 38satisfy the following conditions: 39 40You must retain the complete text of this software license in redistributions of 41the FDK AAC Codec or your modifications thereto in source code form. 42 43You must retain the complete text of this software license in the documentation 44and/or other materials provided with redistributions of the FDK AAC Codec or 45your modifications thereto in binary form. You must make available free of 46charge copies of the complete source code of the FDK AAC Codec and your 47modifications thereto to recipients of copies in binary form. 48 49The name of Fraunhofer may not be used to endorse or promote products derived 50from this library without prior written permission. 51 52You may not charge copyright license fees for anyone to use, copy or distribute 53the FDK AAC Codec software or your modifications thereto. 54 55Your modified versions of the FDK AAC Codec must carry prominent notices stating 56that you changed the software and the date of any change. For modified versions 57of the FDK AAC Codec, the term "Fraunhofer FDK AAC Codec Library for Android" 58must be replaced by the term "Third-Party Modified Version of the Fraunhofer FDK 59AAC Codec Library for Android." 60 613. NO PATENT LICENSE 62 63NO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without 64limitation the patents of Fraunhofer, ARE GRANTED BY THIS SOFTWARE LICENSE. 65Fraunhofer provides no warranty of patent non-infringement with respect to this 66software. 67 68You may use this FDK AAC Codec software or modifications thereto only for 69purposes that are authorized by appropriate patent licenses. 70 714. DISCLAIMER 72 73This FDK AAC Codec software is provided by Fraunhofer on behalf of the copyright 74holders and contributors "AS IS" and WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, 75including but not limited to the implied warranties of merchantability and 76fitness for a particular purpose. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 77CONTRIBUTORS BE LIABLE for any direct, indirect, incidental, special, exemplary, 78or consequential damages, including but not limited to procurement of substitute 79goods or services; loss of use, data, or profits, or business interruption, 80however caused and on any theory of liability, whether in contract, strict 81liability, or tort (including negligence), arising in any way out of the use of 82this software, even if advised of the possibility of such damage. 83 845. CONTACT INFORMATION 85 86Fraunhofer Institute for Integrated Circuits IIS 87Attention: Audio and Multimedia Departments - FDK AAC LL 88Am Wolfsmantel 33 8991058 Erlangen, Germany 90 91www.iis.fraunhofer.de/amm 92amm-info@iis.fraunhofer.de 93----------------------------------------------------------------------------- */ 94 95/**************************** AAC decoder library ****************************** 96 97 Author(s): Josef Hoepfl 98 99 Description: Definition of constant tables 100 101*******************************************************************************/ 102 103#ifndef AAC_ROM_H 104#define AAC_ROM_H 105 106#include "common_fix.h" 107#include "FDK_audio.h" 108#include "aacdec_hcr_types.h" 109#include "aacdec_hcrs.h" 110 111#define PCM_DEC FIXP_DBL 112#define MAXVAL_PCM_DEC MAXVAL_DBL 113#define MINVAL_PCM_DEC MINVAL_DBL 114#define FIXP_DBL2PCM_DEC(x) (x) 115#define PCM_DEC2FIXP_DBL(x) (x) 116#define PCM_DEC_BITS DFRACT_BITS 117#define PCM_DEC2FX_PCM(x) FX_DBL2FX_PCM(x) 118#define FX_PCM2PCM_DEC(x) FX_PCM2FX_DBL(x) 119 120#define AACDEC_MAX_CH_CONF 14 121#define AACDEC_CH_ELEMENTS_TAB_SIZE 7 /*!< Size of element tables */ 122 123#define AAC_NF_NO_RANDOM_VAL \ 124 512 /*!< Size of random number array for noise floor */ 125 126#define INV_QUANT_TABLESIZE 256 127 128extern const FIXP_DBL InverseQuantTable[INV_QUANT_TABLESIZE + 1]; 129extern const FIXP_DBL MantissaTable[4][14]; 130extern const SCHAR ExponentTable[4][14]; 131 132#define NUM_LD_COEF_512 1536 133#define NUM_LD_COEF_480 1440 134/* Window table partition exponents. */ 135#define WTS0 (1) 136#define WTS1 (0) 137#define WTS2 (-2) 138extern const FIXP_WTB LowDelaySynthesis512[1536]; 139extern const FIXP_WTB LowDelaySynthesis480[1440]; 140extern const FIXP_WTB LowDelaySynthesis256[768]; 141extern const FIXP_WTB LowDelaySynthesis240[720]; 142extern const FIXP_WTB LowDelaySynthesis160[480]; 143extern const FIXP_WTB LowDelaySynthesis128[384]; 144extern const FIXP_WTB LowDelaySynthesis120[360]; 145 146typedef struct { 147 const SHORT *sfbOffsetLong; 148 const SHORT *sfbOffsetShort; 149 UCHAR numberOfSfbLong; 150 UCHAR numberOfSfbShort; 151} SFB_INFO; 152 153extern const SFB_INFO sfbOffsetTables[5][16]; 154 155/* Huffman tables */ 156enum { HuffmanBits = 2, HuffmanEntries = (1 << HuffmanBits) }; 157 158typedef struct { 159 const USHORT (*CodeBook)[HuffmanEntries]; 160 UCHAR Dimension; 161 UCHAR numBits; 162 UCHAR Offset; 163} CodeBookDescription; 164 165extern const CodeBookDescription AACcodeBookDescriptionTable[13]; 166extern const CodeBookDescription AACcodeBookDescriptionSCL; 167 168extern const STATEFUNC aStateConstant2State[]; 169 170extern const SCHAR aCodebook2StartInt[]; 171 172extern const UCHAR aMinOfCbPair[]; 173extern const UCHAR aMaxOfCbPair[]; 174 175extern const UCHAR aMaxCwLen[]; 176extern const UCHAR aDimCb[]; 177extern const UCHAR aDimCbShift[]; 178extern const UCHAR aSignCb[]; 179extern const UCHAR aCbPriority[]; 180 181extern const UINT *aHuffTable[]; 182extern const SCHAR *aQuantTable[]; 183 184extern const USHORT aLargestAbsoluteValue[]; 185 186extern const UINT aHuffTreeRvlcEscape[]; 187extern const UINT aHuffTreeRvlCodewds[]; 188 189extern const UCHAR tns_max_bands_tbl[13][2]; 190 191extern const UCHAR tns_max_bands_tbl_480[13]; 192extern const UCHAR tns_max_bands_tbl_512[13]; 193 194#define FIXP_TCC FIXP_DBL 195 196extern const FIXP_TCC FDKaacDec_tnsCoeff3[8]; 197extern const FIXP_TCC FDKaacDec_tnsCoeff4[16]; 198 199extern const UCHAR FDKaacDec_tnsCoeff3_gain_ld[]; 200extern const UCHAR FDKaacDec_tnsCoeff4_gain_ld[]; 201 202extern const USHORT AacDec_randomSign[AAC_NF_NO_RANDOM_VAL / 16]; 203 204extern const FIXP_DBL pow2_div24minus1[47]; 205extern const int offsetTab[2][16]; 206 207/* Channel mapping indices for time domain I/O. 208 The first dimension is the channel configuration index. */ 209extern const UCHAR channelMappingTablePassthrough[15][8]; 210extern const UCHAR channelMappingTableWAV[15][8]; 211 212/* Lookup tables for elements in ER bitstream */ 213extern const MP4_ELEMENT_ID elementsTab[AACDEC_MAX_CH_CONF] 214 [AACDEC_CH_ELEMENTS_TAB_SIZE]; 215 216#define SF_FNA_COEFFS \ 217 1 /* Compile-time prescaler for MDST-filter coefficients. */ 218/* SF_FNA_COEFFS > 0 should only be considered for FIXP_DBL-coefficients */ 219/* (i.e. if CPLX_PRED_FILTER_16BIT is not defined). */ 220/* With FIXP_DBL loss of precision is possible for SF_FNA_COEFFS > 11. */ 221 222#ifdef CPLX_PRED_FILTER_16BIT 223#define FIXP_FILT FIXP_SGL 224#define FILT(a) ((FL2FXCONST_SGL(a)) >> SF_FNA_COEFFS) 225#else 226#define FIXP_FILT FIXP_DBL 227#define FILT(a) ((FL2FXCONST_DBL(a)) >> SF_FNA_COEFFS) 228#endif 229 230extern const FIXP_FILT mdst_filt_coef_curr[20][3]; /* MDST-filter coefficient 231 tables used for current 232 window */ 233extern const FIXP_FILT mdst_filt_coef_prev[6][4]; /* MDST-filter coefficient 234 tables used for previous 235 window */ 236 237#endif /* #ifndef AAC_ROM_H */ 238