Home | History | Annotate | Download | only in src
      1 /* -----------------------------------------------------------------------------
      2 Software License for The Fraunhofer FDK AAC Codec Library for Android
      3 
      4  Copyright  1995 - 2018 Fraunhofer-Gesellschaft zur Frderung 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 (at) 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 
    128 extern const FIXP_DBL InverseQuantTable[INV_QUANT_TABLESIZE + 1];
    129 extern const FIXP_DBL MantissaTable[4][14];
    130 extern 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)
    138 extern const FIXP_WTB LowDelaySynthesis512[1536];
    139 extern const FIXP_WTB LowDelaySynthesis480[1440];
    140 extern const FIXP_WTB LowDelaySynthesis256[768];
    141 extern const FIXP_WTB LowDelaySynthesis240[720];
    142 extern const FIXP_WTB LowDelaySynthesis160[480];
    143 extern const FIXP_WTB LowDelaySynthesis128[384];
    144 extern const FIXP_WTB LowDelaySynthesis120[360];
    145 
    146 typedef struct {
    147   const SHORT *sfbOffsetLong;
    148   const SHORT *sfbOffsetShort;
    149   UCHAR numberOfSfbLong;
    150   UCHAR numberOfSfbShort;
    151 } SFB_INFO;
    152 
    153 extern const SFB_INFO sfbOffsetTables[5][16];
    154 
    155 /* Huffman tables */
    156 enum { HuffmanBits = 2, HuffmanEntries = (1 << HuffmanBits) };
    157 
    158 typedef struct {
    159   const USHORT (*CodeBook)[HuffmanEntries];
    160   UCHAR Dimension;
    161   UCHAR numBits;
    162   UCHAR Offset;
    163 } CodeBookDescription;
    164 
    165 extern const CodeBookDescription AACcodeBookDescriptionTable[13];
    166 extern const CodeBookDescription AACcodeBookDescriptionSCL;
    167 
    168 extern const STATEFUNC aStateConstant2State[];
    169 
    170 extern const SCHAR aCodebook2StartInt[];
    171 
    172 extern const UCHAR aMinOfCbPair[];
    173 extern const UCHAR aMaxOfCbPair[];
    174 
    175 extern const UCHAR aMaxCwLen[];
    176 extern const UCHAR aDimCb[];
    177 extern const UCHAR aDimCbShift[];
    178 extern const UCHAR aSignCb[];
    179 extern const UCHAR aCbPriority[];
    180 
    181 extern const UINT *aHuffTable[];
    182 extern const SCHAR *aQuantTable[];
    183 
    184 extern const USHORT aLargestAbsoluteValue[];
    185 
    186 extern const UINT aHuffTreeRvlcEscape[];
    187 extern const UINT aHuffTreeRvlCodewds[];
    188 
    189 extern const UCHAR tns_max_bands_tbl[13][2];
    190 
    191 extern const UCHAR tns_max_bands_tbl_480[13];
    192 extern const UCHAR tns_max_bands_tbl_512[13];
    193 
    194 #define FIXP_TCC FIXP_DBL
    195 
    196 extern const FIXP_TCC FDKaacDec_tnsCoeff3[8];
    197 extern const FIXP_TCC FDKaacDec_tnsCoeff4[16];
    198 
    199 extern const UCHAR FDKaacDec_tnsCoeff3_gain_ld[];
    200 extern const UCHAR FDKaacDec_tnsCoeff4_gain_ld[];
    201 
    202 extern const USHORT AacDec_randomSign[AAC_NF_NO_RANDOM_VAL / 16];
    203 
    204 extern const FIXP_DBL pow2_div24minus1[47];
    205 extern const int offsetTab[2][16];
    206 
    207 /* Channel mapping indices for time domain I/O.
    208    The first dimension is the channel configuration index. */
    209 extern const UCHAR channelMappingTablePassthrough[15][8];
    210 extern const UCHAR channelMappingTableWAV[15][8];
    211 
    212 /* Lookup tables for elements in ER bitstream */
    213 extern 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 
    230 extern const FIXP_FILT mdst_filt_coef_curr[20][3]; /* MDST-filter coefficient
    231                                                       tables used for current
    232                                                       window  */
    233 extern 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