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 /************************* MPEG-D DRC decoder library **************************
     96 
     97    Author(s):
     98 
     99    Description:
    100 
    101 *******************************************************************************/
    102 
    103 #include "drcDec_types.h"
    104 #include "drcDec_rom.h"
    105 
    106 const SCHAR deltaGain_codingProfile_0_1_huffman[24][2] = {
    107     {1, 2},    {3, 4},     {-63, -65}, {5, -66},   {-64, 6},   {-80, 7},
    108     {8, 9},    {-68, 10},  {11, 12},   {-56, -67}, {-61, 13},  {-62, -69},
    109     {14, 15},  {16, -72},  {-71, 17},  {-70, -60}, {18, -59},  {19, 20},
    110     {21, -79}, {-57, -73}, {22, -58},  {-76, 23},  {-75, -74}, {-78, -77}};
    111 
    112 const SCHAR deltaGain_codingProfile_2_huffman[48][2] = {
    113     {1, 2},     {3, 4},     {5, 6},     {7, 8},     {9, 10},    {11, 12},
    114     {13, -65},  {14, -64},  {15, -66},  {16, -67},  {17, 18},   {19, -68},
    115     {20, -63},  {-69, 21},  {-59, 22},  {-61, -62}, {-60, 23},  {24, -58},
    116     {-70, -57}, {-56, -71}, {25, 26},   {27, -55},  {-72, 28},  {-54, 29},
    117     {-53, 30},  {-73, -52}, {31, -74},  {32, 33},   {-75, 34},  {-76, 35},
    118     {-51, 36},  {-78, 37},  {-77, 38},  {-96, 39},  {-48, 40},  {-50, -79},
    119     {41, 42},   {-80, -81}, {-82, 43},  {44, -49},  {45, -84},  {-83, -89},
    120     {-86, 46},  {-90, -85}, {-91, -93}, {-92, 47},  {-88, -87}, {-95, -94}};
    121 
    122 const FIXP_SGL slopeSteepness[] = {FL2FXCONST_SGL(-3.0518f / (float)(1 << 2)),
    123                                    FL2FXCONST_SGL(-1.2207f / (float)(1 << 2)),
    124                                    FL2FXCONST_SGL(-0.4883f / (float)(1 << 2)),
    125                                    FL2FXCONST_SGL(-0.1953f / (float)(1 << 2)),
    126                                    FL2FXCONST_SGL(-0.0781f / (float)(1 << 2)),
    127                                    FL2FXCONST_SGL(-0.0312f / (float)(1 << 2)),
    128                                    FL2FXCONST_SGL(-0.005f / (float)(1 << 2)),
    129                                    FL2FXCONST_SGL(0.0f / (float)(1 << 2)),
    130                                    FL2FXCONST_SGL(0.005f / (float)(1 << 2)),
    131                                    FL2FXCONST_SGL(0.0312f / (float)(1 << 2)),
    132                                    FL2FXCONST_SGL(0.0781f / (float)(1 << 2)),
    133                                    FL2FXCONST_SGL(0.1953f / (float)(1 << 2)),
    134                                    FL2FXCONST_SGL(0.4883f / (float)(1 << 2)),
    135                                    FL2FXCONST_SGL(1.2207f / (float)(1 << 2)),
    136                                    FL2FXCONST_SGL(3.0518f / (float)(1 << 2))};
    137 
    138 const SCHAR slopeSteepness_huffman[14][2] = {
    139     {1, -57},  {-58, 2},   {3, 4},    {5, 6},    {7, -56},
    140     {8, -60},  {-61, -55}, {9, -59},  {10, -54}, {-64, 11},
    141     {-51, 12}, {-62, -50}, {-63, 13}, {-52, -53}};
    142 
    143 const FIXP_DBL downmixCoeff[] = {
    144     FL2FXCONST_DBL(1.0000000000 / (float)(1 << 2)),
    145     FL2FXCONST_DBL(0.9440608763 / (float)(1 << 2)),
    146     FL2FXCONST_DBL(0.8912509381 / (float)(1 << 2)),
    147     FL2FXCONST_DBL(0.8413951416 / (float)(1 << 2)),
    148     FL2FXCONST_DBL(0.7943282347 / (float)(1 << 2)),
    149     FL2FXCONST_DBL(0.7498942093 / (float)(1 << 2)),
    150     FL2FXCONST_DBL(0.7079457844 / (float)(1 << 2)),
    151     FL2FXCONST_DBL(0.6683439176 / (float)(1 << 2)),
    152     FL2FXCONST_DBL(0.6309573445 / (float)(1 << 2)),
    153     FL2FXCONST_DBL(0.5956621435 / (float)(1 << 2)),
    154     FL2FXCONST_DBL(0.5623413252 / (float)(1 << 2)),
    155     FL2FXCONST_DBL(0.5308844442 / (float)(1 << 2)),
    156     FL2FXCONST_DBL(0.5011872336 / (float)(1 << 2)),
    157     FL2FXCONST_DBL(0.4216965034 / (float)(1 << 2)),
    158     FL2FXCONST_DBL(0.3548133892 / (float)(1 << 2)),
    159     FL2FXCONST_DBL(0.0000000000 / (float)(1 << 2))};
    160 
    161 const FIXP_DBL downmixCoeffV1[] = {
    162     FL2FXCONST_DBL(3.1622776602 / (float)(1 << 2)),
    163     FL2FXCONST_DBL(1.9952623150 / (float)(1 << 2)),
    164     FL2FXCONST_DBL(1.6788040181 / (float)(1 << 2)),
    165     FL2FXCONST_DBL(1.4125375446 / (float)(1 << 2)),
    166     FL2FXCONST_DBL(1.1885022274 / (float)(1 << 2)),
    167     FL2FXCONST_DBL(1.0000000000 / (float)(1 << 2)),
    168     FL2FXCONST_DBL(0.9440608763 / (float)(1 << 2)),
    169     FL2FXCONST_DBL(0.8912509381 / (float)(1 << 2)),
    170     FL2FXCONST_DBL(0.8413951416 / (float)(1 << 2)),
    171     FL2FXCONST_DBL(0.7943282347 / (float)(1 << 2)),
    172     FL2FXCONST_DBL(0.7498942093 / (float)(1 << 2)),
    173     FL2FXCONST_DBL(0.7079457844 / (float)(1 << 2)),
    174     FL2FXCONST_DBL(0.6683439176 / (float)(1 << 2)),
    175     FL2FXCONST_DBL(0.6309573445 / (float)(1 << 2)),
    176     FL2FXCONST_DBL(0.5956621435 / (float)(1 << 2)),
    177     FL2FXCONST_DBL(0.5623413252 / (float)(1 << 2)),
    178     FL2FXCONST_DBL(0.5308844442 / (float)(1 << 2)),
    179     FL2FXCONST_DBL(0.5011872336 / (float)(1 << 2)),
    180     FL2FXCONST_DBL(0.4731512590 / (float)(1 << 2)),
    181     FL2FXCONST_DBL(0.4466835922 / (float)(1 << 2)),
    182     FL2FXCONST_DBL(0.4216965034 / (float)(1 << 2)),
    183     FL2FXCONST_DBL(0.3981071706 / (float)(1 << 2)),
    184     FL2FXCONST_DBL(0.3548133892 / (float)(1 << 2)),
    185     FL2FXCONST_DBL(0.3162277660 / (float)(1 << 2)),
    186     FL2FXCONST_DBL(0.2818382931 / (float)(1 << 2)),
    187     FL2FXCONST_DBL(0.2511886432 / (float)(1 << 2)),
    188     FL2FXCONST_DBL(0.1778279410 / (float)(1 << 2)),
    189     FL2FXCONST_DBL(0.1000000000 / (float)(1 << 2)),
    190     FL2FXCONST_DBL(0.0562341325 / (float)(1 << 2)),
    191     FL2FXCONST_DBL(0.0316227766 / (float)(1 << 2)),
    192     FL2FXCONST_DBL(0.0100000000 / (float)(1 << 2)),
    193     FL2FXCONST_DBL(0.0000000000 / (float)(1 << 2))};
    194 
    195 const CUSTOM_DRC_CHAR_SIGMOID cicpDrcCharSigmoidLeft[] = {
    196     {FL2FXCONST_SGL(32.0f / (float)(1 << 6)),
    197      FL2FXCONST_SGL(0.0f / (float)(1 << 2)),
    198      FL2FXCONST_SGL(9.0f / (float)(1 << 5)), 0}, /* 1 */
    199     {FL2FXCONST_SGL(32.0f / (float)(1 << 6)),
    200      FL2FXCONST_SGL(0.2f / (float)(1 << 2)),
    201      FL2FXCONST_SGL(9.0f / (float)(1 << 5)), 0}, /* 2 */
    202     {FL2FXCONST_SGL(32.0f / (float)(1 << 6)),
    203      FL2FXCONST_SGL(0.4f / (float)(1 << 2)),
    204      FL2FXCONST_SGL(9.0f / (float)(1 << 5)), 0}, /* 3 */
    205     {FL2FXCONST_SGL(32.0f / (float)(1 << 6)),
    206      FL2FXCONST_SGL(0.6f / (float)(1 << 2)),
    207      FL2FXCONST_SGL(9.0f / (float)(1 << 5)), 0}, /* 4 */
    208     {FL2FXCONST_SGL(32.0f / (float)(1 << 6)),
    209      FL2FXCONST_SGL(0.8f / (float)(1 << 2)),
    210      FL2FXCONST_SGL(6.0f / (float)(1 << 5)), 0}, /* 5 */
    211     {FL2FXCONST_SGL(32.0f / (float)(1 << 6)),
    212      FL2FXCONST_SGL(1.0f / (float)(1 << 2)),
    213      FL2FXCONST_SGL(5.0f / (float)(1 << 5)), 0}, /* 6 */
    214 };
    215 
    216 const CUSTOM_DRC_CHAR_SIGMOID cicpDrcCharSigmoidRight[] = {
    217     {FL2FXCONST_SGL(-32.0f / (float)(1 << 6)),
    218      FL2FXCONST_SGL(0.0f / (float)(1 << 2)),
    219      FL2FXCONST_SGL(12.0f / (float)(1 << 5)), 0}, /* 1 */
    220     {FL2FXCONST_SGL(-32.0f / (float)(1 << 6)),
    221      FL2FXCONST_SGL(0.2f / (float)(1 << 2)),
    222      FL2FXCONST_SGL(12.0f / (float)(1 << 5)), 0}, /* 2 */
    223     {FL2FXCONST_SGL(-32.0f / (float)(1 << 6)),
    224      FL2FXCONST_SGL(0.4f / (float)(1 << 2)),
    225      FL2FXCONST_SGL(12.0f / (float)(1 << 5)), 0}, /* 3 */
    226     {FL2FXCONST_SGL(-32.0f / (float)(1 << 6)),
    227      FL2FXCONST_SGL(0.6f / (float)(1 << 2)),
    228      FL2FXCONST_SGL(10.0f / (float)(1 << 5)), 0}, /* 4 */
    229     {FL2FXCONST_SGL(-32.0f / (float)(1 << 6)),
    230      FL2FXCONST_SGL(0.8f / (float)(1 << 2)),
    231      FL2FXCONST_SGL(8.0f / (float)(1 << 5)), 0}, /* 5 */
    232     {FL2FXCONST_SGL(-32.0f / (float)(1 << 6)),
    233      FL2FXCONST_SGL(1.0f / (float)(1 << 2)),
    234      FL2FXCONST_SGL(6.0f / (float)(1 << 5)), 0}, /* 6 */
    235 };
    236 
    237 const CUSTOM_DRC_CHAR_NODES cicpDrcCharNodesLeft[] = {
    238     {2,
    239      {FL2FXCONST_SGL(-31.0f / (float)(1 << 7)),
    240       FL2FXCONST_SGL(-41.0f / (float)(1 << 7)),
    241       FL2FXCONST_SGL(-53.0f / (float)(1 << 7))},
    242      {FL2FXCONST_SGL(0.0f / (float)(1 << 7)),
    243       FL2FXCONST_SGL(0.0f / (float)(1 << 7)),
    244       FL2FXCONST_SGL(6.0f / (float)(1 << 7))}}, /* 7 */
    245     {1,
    246      {FL2FXCONST_SGL(-31.0f / (float)(1 << 7)),
    247       FL2FXCONST_SGL(-43.0f / (float)(1 << 7))},
    248      {FL2FXCONST_SGL(0.0f / (float)(1 << 7)),
    249       FL2FXCONST_SGL(6.0f / (float)(1 << 7))}}, /* 8 */
    250     {2,
    251      {FL2FXCONST_SGL(-31.0f / (float)(1 << 7)),
    252       FL2FXCONST_SGL(-41.0f / (float)(1 << 7)),
    253       FL2FXCONST_SGL(-65.0f / (float)(1 << 7))},
    254      {FL2FXCONST_SGL(0.0f / (float)(1 << 7)),
    255       FL2FXCONST_SGL(0.0f / (float)(1 << 7)),
    256       FL2FXCONST_SGL(12.0f / (float)(1 << 7))}}, /* 9 */
    257     {1,
    258      {FL2FXCONST_SGL(-31.0f / (float)(1 << 7)),
    259       FL2FXCONST_SGL(-55.0f / (float)(1 << 7))},
    260      {FL2FXCONST_SGL(0.0f / (float)(1 << 7)),
    261       FL2FXCONST_SGL(12.0f / (float)(1 << 7))}}, /* 10 */
    262     {1,
    263      {FL2FXCONST_SGL(-31.0f / (float)(1 << 7)),
    264       FL2FXCONST_SGL(-50.0f / (float)(1 << 7))},
    265      {FL2FXCONST_SGL(0.0f / (float)(1 << 7)),
    266       FL2FXCONST_SGL(15.0f / (float)(1 << 7))}} /* 11 */
    267 };
    268 
    269 const CUSTOM_DRC_CHAR_NODES cicpDrcCharNodesRight[] = {
    270     {4,
    271      {FL2FXCONST_SGL(-31.0f / (float)(1 << 7)),
    272       FL2FXCONST_SGL(-21.0f / (float)(1 << 7)),
    273       FL2FXCONST_SGL(-11.0f / (float)(1 << 7)),
    274       FL2FXCONST_SGL(9.0f / (float)(1 << 7)),
    275       FL2FXCONST_SGL(19.0f / (float)(1 << 7))},
    276      {FL2FXCONST_SGL(0.0f / (float)(1 << 7)),
    277       FL2FXCONST_SGL(0.0f / (float)(1 << 7)),
    278       FL2FXCONST_SGL(-5.0f / (float)(1 << 7)),
    279       FL2FXCONST_SGL(-24.0f / (float)(1 << 7)),
    280       FL2FXCONST_SGL(-34.0f / (float)(1 << 7))}}, /* 7 */
    281     {4,
    282      {FL2FXCONST_SGL(-31.0f / (float)(1 << 7)),
    283       FL2FXCONST_SGL(-26.0f / (float)(1 << 7)),
    284       FL2FXCONST_SGL(-16.0f / (float)(1 << 7)),
    285       FL2FXCONST_SGL(4.0f / (float)(1 << 7)),
    286       FL2FXCONST_SGL(14.0f / (float)(1 << 7))},
    287      {FL2FXCONST_SGL(0.0f / (float)(1 << 7)),
    288       FL2FXCONST_SGL(0.0f / (float)(1 << 7)),
    289       FL2FXCONST_SGL(-5.0f / (float)(1 << 7)),
    290       FL2FXCONST_SGL(-24.0f / (float)(1 << 7)),
    291       FL2FXCONST_SGL(-34.0f / (float)(1 << 7))}}, /* 8 */
    292     {3,
    293      {FL2FXCONST_SGL(-31.0f / (float)(1 << 7)),
    294       FL2FXCONST_SGL(-21.0f / (float)(1 << 7)),
    295       FL2FXCONST_SGL(9.0f / (float)(1 << 7)),
    296       FL2FXCONST_SGL(29.0f / (float)(1 << 7))},
    297      {FL2FXCONST_SGL(0.0f / (float)(1 << 7)),
    298       FL2FXCONST_SGL(0.0f / (float)(1 << 7)),
    299       FL2FXCONST_SGL(-15.0f / (float)(1 << 7)),
    300       FL2FXCONST_SGL(-35.0f / (float)(1 << 7))}}, /* 9 */
    301     {4,
    302      {FL2FXCONST_SGL(-31.0f / (float)(1 << 7)),
    303       FL2FXCONST_SGL(-26.0f / (float)(1 << 7)),
    304       FL2FXCONST_SGL(-16.0f / (float)(1 << 7)),
    305       FL2FXCONST_SGL(4.0f / (float)(1 << 7)),
    306       FL2FXCONST_SGL(14.0f / (float)(1 << 7))},
    307      {FL2FXCONST_SGL(0.0f / (float)(1 << 7)),
    308       FL2FXCONST_SGL(0.0f / (float)(1 << 7)),
    309       FL2FXCONST_SGL(-5.0f / (float)(1 << 7)),
    310       FL2FXCONST_SGL(-24.0f / (float)(1 << 7)),
    311       FL2FXCONST_SGL(-34.0f / (float)(1 << 7))}}, /* 10 */
    312     {4,
    313      {FL2FXCONST_SGL(-31.0f / (float)(1 << 7)),
    314       FL2FXCONST_SGL(-26.0f / (float)(1 << 7)),
    315       FL2FXCONST_SGL(-16.0f / (float)(1 << 7)),
    316       FL2FXCONST_SGL(4.0f / (float)(1 << 7)),
    317       FL2FXCONST_SGL(14.0f / (float)(1 << 7))},
    318      {FL2FXCONST_SGL(0.0f / (float)(1 << 7)),
    319       FL2FXCONST_SGL(0.0f / (float)(1 << 7)),
    320       FL2FXCONST_SGL(-5.0f / (float)(1 << 7)),
    321       FL2FXCONST_SGL(-24.0f / (float)(1 << 7)),
    322       FL2FXCONST_SGL(-34.0f / (float)(1 << 7))}} /* 11 */
    323 };
    324