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 surround decoder library *************************
     96 
     97    Author(s):
     98 
     99    Description: SAC Dec tables
    100 
    101 *******************************************************************************/
    102 
    103 #include "sac_rom.h"
    104 #include "sac_calcM1andM2.h"
    105 
    106 #define SCALE_CPC(a) (FL2FXCONST_CFG(a / (float)(1 << SCALE_PARAM_M1)))
    107 const FIXP_CFG dequantCPC__FDK[] = {
    108     SCALE_CPC(-2.0f), SCALE_CPC(-1.9f), SCALE_CPC(-1.8f), SCALE_CPC(-1.7f),
    109     SCALE_CPC(-1.6f), SCALE_CPC(-1.5f), SCALE_CPC(-1.4f), SCALE_CPC(-1.3f),
    110     SCALE_CPC(-1.2f), SCALE_CPC(-1.1f), SCALE_CPC(-1.0f), SCALE_CPC(-0.9f),
    111     SCALE_CPC(-0.8f), SCALE_CPC(-0.7f), SCALE_CPC(-0.6f), SCALE_CPC(-0.5f),
    112     SCALE_CPC(-0.4f), SCALE_CPC(-0.3f), SCALE_CPC(-0.2f), SCALE_CPC(-0.1f),
    113     SCALE_CPC(0.0f),  SCALE_CPC(0.1f),  SCALE_CPC(0.2f),  SCALE_CPC(0.3f),
    114     SCALE_CPC(0.4f),  SCALE_CPC(0.5f),  SCALE_CPC(0.6f),  SCALE_CPC(0.7f),
    115     SCALE_CPC(0.8f),  SCALE_CPC(0.9f),  SCALE_CPC(1.0f),  SCALE_CPC(1.1f),
    116     SCALE_CPC(1.2f),  SCALE_CPC(1.3f),  SCALE_CPC(1.4f),  SCALE_CPC(1.5f),
    117     SCALE_CPC(1.6f),  SCALE_CPC(1.7f),  SCALE_CPC(1.8f),  SCALE_CPC(1.9f),
    118     SCALE_CPC(2.0f),  SCALE_CPC(2.1f),  SCALE_CPC(2.2f),  SCALE_CPC(2.3f),
    119     SCALE_CPC(2.4f),  SCALE_CPC(2.5f),  SCALE_CPC(2.6f),  SCALE_CPC(2.7f),
    120     SCALE_CPC(2.8f),  SCALE_CPC(2.9f),  SCALE_CPC(3.0f)};
    121 
    122 #define SCALE_ICC(a) (FL2FXCONST_CFG(a))
    123 const FIXP_CFG dequantICC__FDK[8] = {
    124     /*SCALE_ICC(1.00000f)*/ FX_DBL2FX_CFG(MAXVAL_DBL),
    125     SCALE_ICC(0.9370f),
    126     SCALE_ICC(0.84118f),
    127     SCALE_ICC(0.60092f),
    128     SCALE_ICC(0.36764f),
    129     SCALE_ICC(0.0000f),
    130     SCALE_ICC(-0.58900f),
    131     SCALE_ICC(-0.9900f)};
    132 
    133 #define SCALE_CLD2(a) (FL2FXCONST_CFG(a / (float)(1 << 8)))
    134 const FIXP_CFG dequantCLD__FDK[31] = {
    135     SCALE_CLD2(-150.0f), SCALE_CLD2(-45.0f), SCALE_CLD2(-40.0f),
    136     SCALE_CLD2(-35.0f),  SCALE_CLD2(-30.0f), SCALE_CLD2(-25.0f),
    137     SCALE_CLD2(-22.0f),  SCALE_CLD2(-19.0f), SCALE_CLD2(-16.0f),
    138     SCALE_CLD2(-13.0f),  SCALE_CLD2(-10.0f), SCALE_CLD2(-8.0f),
    139     SCALE_CLD2(-6.0f),   SCALE_CLD2(-4.0f),  SCALE_CLD2(-2.0f),
    140     SCALE_CLD2(0.0f),    SCALE_CLD2(2.0f),   SCALE_CLD2(4.0f),
    141     SCALE_CLD2(6.0f),    SCALE_CLD2(8.0f),   SCALE_CLD2(10.0f),
    142     SCALE_CLD2(13.0f),   SCALE_CLD2(16.0f),  SCALE_CLD2(19.0f),
    143     SCALE_CLD2(22.0f),   SCALE_CLD2(25.0f),  SCALE_CLD2(30.0f),
    144     SCALE_CLD2(35.0f),   SCALE_CLD2(40.0f),  SCALE_CLD2(45.0f),
    145     SCALE_CLD2(150.0f)};
    146 
    147 #define SCALE_IPD(a) (FL2FXCONST_CFG(a / (float)(1 << IPD_SCALE)))
    148 const FIXP_CFG dequantIPD__FDK[16] = {
    149     /* SCALE_IPD(0.000000000f), SCALE_IPD(0.392699082f),
    150        SCALE_IPD(0.785398163f), SCALE_IPD(1.178097245f),
    151        SCALE_IPD(1.570796327f), SCALE_IPD(1.963495408f),
    152        SCALE_IPD(2.356194490f), SCALE_IPD(2.748893572f),
    153        SCALE_IPD(3.141592654f), SCALE_IPD(3.534291735f),
    154        SCALE_IPD(3.926990817f), SCALE_IPD(4.319689899f),
    155        SCALE_IPD(4.712388980f), SCALE_IPD(5.105088062f),
    156        SCALE_IPD(5.497787144f), SCALE_IPD(5.890486225f) */
    157     SCALE_IPD(0.00000000000000f), SCALE_IPD(0.392699082f),
    158     SCALE_IPD(0.78539816339745f), SCALE_IPD(1.178097245f),
    159     SCALE_IPD(1.57079632679490f), SCALE_IPD(1.963495408f),
    160     SCALE_IPD(2.35619449019234f), SCALE_IPD(2.748893572f),
    161     SCALE_IPD(3.14159265358979f), SCALE_IPD(3.534291735f),
    162     SCALE_IPD(3.92699081698724f), SCALE_IPD(4.319689899f),
    163     SCALE_IPD(4.71238898038469f), SCALE_IPD(5.105088062f),
    164     SCALE_IPD(5.49778714378214f), SCALE_IPD(5.890486225f)};
    165 
    166 #define SCALE_SPLIT_ANGLE(a) (FL2FXCONST_CFG(a / (float)(1 << IPD_SCALE)))
    167 /*
    168   Generate table dequantIPD_CLD_ICC_splitAngle__FDK[16][31][8]:
    169 
    170   #define ABS_THR                         ( 1e-9f * 32768 * 32768 )
    171 
    172   float dequantICC[] =
    173   {1.0000f,0.9370f,0.84118f,0.60092f,0.36764f,0.0f,-0.5890f,-0.9900f}; float
    174   dequantCLD[] =
    175   {-150.0,-45.0,-40.0,-35.0,-30.0,-25.0,-22.0,-19.0,-16.0,-13.0,-10.0, -8.0,
    176                           -6.0, -4.0, -2.0,  0.0,  2.0,  4.0,  6.0,  8.0,
    177   10.0, 13.0, 16.0, 19.0, 22.0, 25.0, 30.0, 35.0, 40.0, 45.0, 150.0 }; float
    178   dequantIPD[] =
    179   {0.f,0.392699082f,0.785398163f,1.178097245f,1.570796327f,1.963495408f,
    180                         2.35619449f,2.748893572f,3.141592654f,3.534291735f,3.926990817f,
    181                         4.319689899f,4.71238898f,5.105088062f,5.497787144f,5.890486225f};
    182 
    183   for (ipdIdx=0; ipdIdx<16; ipdIdx++)
    184     for (cldIdx=0; cldIdx<31; cldIdx++)
    185       for (iccIdx=0; iccIdx<8; iccIdx++) {
    186         ipd = dequantIPD[ipdIdx];
    187         cld = dequantCLD[cldIdx];
    188         icc = dequantICC[iccIdx];
    189         iidLin = (float) pow(10.0f, cld / 20.0f);
    190         iidLin2 = iidLin * iidLin;
    191         iidLin21 = iidLin2 + 1.0f;
    192         sinIpd = (float) sin(ipd);
    193         cosIpd = (float) cos(ipd);
    194         temp1 = 2.0f * icc * iidLin;
    195         temp1c = temp1 * cosIpd;
    196         ratio = (iidLin21 + temp1c) / (iidLin21 + temp1) + ABS_THR;
    197         w2 = (float) pow(ratio, 0.25f);
    198         w1 = 2.0f - w2;
    199         dequantIPD_CLD_ICC_splitAngle__FDK[ipdIdx][cldIdx][iccIdx] = (float)
    200   atan2(w2 * sinIpd, w1 * iidLin + w2 * cosIpd);
    201       }
    202 */
    203 
    204 #define SCALE_CLD(a) (FL2FXCONST_CFG(a))
    205 
    206 const FIXP_CFG dequantCLD_c_l[31] = {
    207     SCALE_CLD(0.0000000316f),
    208     SCALE_CLD(0.0056233243f),
    209     SCALE_CLD(0.0099994997f),
    210     SCALE_CLD(0.0177799836f),
    211     SCALE_CLD(0.0316069759f),
    212     SCALE_CLD(0.0561454296f),
    213     SCALE_CLD(0.0791834071f),
    214     SCALE_CLD(0.1115021780f),
    215     SCALE_CLD(0.1565355062f),
    216     SCALE_CLD(0.2184644639f),
    217     SCALE_CLD(0.3015113473f),
    218     SCALE_CLD(0.3698741496f),
    219     SCALE_CLD(0.4480624795f),
    220     SCALE_CLD(0.5336171389f),
    221     SCALE_CLD(0.6219832301f),
    222     SCALE_CLD(0.7071067691f),
    223     SCALE_CLD(0.7830305696f),
    224     SCALE_CLD(0.8457261920f),
    225     SCALE_CLD(0.8940021992f),
    226     SCALE_CLD(0.9290818572f),
    227     SCALE_CLD(0.9534626007f),
    228     SCALE_CLD(0.9758449197f),
    229     SCALE_CLD(0.9876723289f),
    230     SCALE_CLD(0.9937641621f),
    231     SCALE_CLD(0.9968600869f),
    232     SCALE_CLD(0.9984226227f),
    233     SCALE_CLD(0.9995003939f),
    234     SCALE_CLD(0.9998419285f),
    235     SCALE_CLD(0.9999499917f),
    236     SCALE_CLD(0.9999842048f),
    237     /*SCALE_CLD(1.0000000000f)*/ FX_DBL2FX_CFG(MAXVAL_DBL)};
    238 
    239 #define SC_H(a) (FL2FXCONST_CFG(a))
    240 #define DATA_TYPE_H FIXP_CFG
    241 
    242 /* not correlated  tables */
    243 const DATA_TYPE_H H11_nc[31][8] = {
    244     {SC_H(0.0000000316f), SC_H(0.0000000296f), SC_H(0.0000000266f),
    245      SC_H(0.0000000190f), SC_H(0.0000000116f), SC_H(0.0000000000f),
    246      SC_H(-0.0000000186f), SC_H(-0.0000000313f)},
    247     {SC_H(0.0056233243f), SC_H(0.0052728835f), SC_H(0.0047394098f),
    248      SC_H(0.0033992692f), SC_H(0.0020946222f), SC_H(0.0000316215f),
    249      SC_H(-0.0032913829f), SC_H(-0.0055664564f)},
    250     {SC_H(0.0099994997f), SC_H(0.0093815643f), SC_H(0.0084402543f),
    251      SC_H(0.0060722125f), SC_H(0.0037622179f), SC_H(0.0000999898f),
    252      SC_H(-0.0058238208f), SC_H(-0.0098974844f)},
    253     {SC_H(0.0177799836f), SC_H(0.0166974831f), SC_H(0.0150465844f),
    254      SC_H(0.0108831404f), SC_H(0.0068073822f), SC_H(0.0003161267f),
    255      SC_H(-0.0102626514f), SC_H(-0.0175957214f)},
    256     {SC_H(0.0316069759f), SC_H(0.0297324844f), SC_H(0.0268681273f),
    257      SC_H(0.0196138974f), SC_H(0.0124691967f), SC_H(0.0009989988f),
    258      SC_H(-0.0179452803f), SC_H(-0.0312700421f)},
    259     {SC_H(0.0561454296f), SC_H(0.0529650487f), SC_H(0.0480896905f),
    260      SC_H(0.0356564634f), SC_H(0.0232860073f), SC_H(0.0031523081f),
    261      SC_H(-0.0309029408f), SC_H(-0.0555154830f)},
    262     {SC_H(0.0791834071f), SC_H(0.0748842582f), SC_H(0.0682762116f),
    263      SC_H(0.0513241664f), SC_H(0.0343080349f), SC_H(0.0062700072f),
    264      SC_H(-0.0422340371f), SC_H(-0.0782499388f)},
    265     {SC_H(0.1115021780f), SC_H(0.1057924852f), SC_H(0.0969873071f),
    266      SC_H(0.0742305145f), SC_H(0.0511277616f), SC_H(0.0124327289f),
    267      SC_H(-0.0566596612f), SC_H(-0.1100896299f)},
    268     {SC_H(0.1565355062f), SC_H(0.1491366178f), SC_H(0.1376826316f),
    269      SC_H(0.1078186408f), SC_H(0.0770794004f), SC_H(0.0245033558f),
    270      SC_H(-0.0735980421f), SC_H(-0.1543303132f)},
    271     {SC_H(0.2184644639f), SC_H(0.2091979682f), SC_H(0.1947948188f),
    272      SC_H(0.1568822265f), SC_H(0.1172478944f), SC_H(0.0477267131f),
    273      SC_H(-0.0899507254f), SC_H(-0.2148526460f)},
    274     {SC_H(0.3015113473f), SC_H(0.2904391289f), SC_H(0.2731673419f),
    275      SC_H(0.2273024023f), SC_H(0.1786239147f), SC_H(0.0909090787f),
    276      SC_H(-0.0964255333f), SC_H(-0.2951124907f)},
    277     {SC_H(0.3698741496f), SC_H(0.3578284085f), SC_H(0.3390066922f),
    278      SC_H(0.2888108492f), SC_H(0.2351117432f), SC_H(0.1368068755f),
    279      SC_H(-0.0850296095f), SC_H(-0.3597966135f)},
    280     {SC_H(0.4480624795f), SC_H(0.4354025424f), SC_H(0.4156077504f),
    281      SC_H(0.3627120256f), SC_H(0.3058823943f), SC_H(0.2007599771f),
    282      SC_H(-0.0484020934f), SC_H(-0.4304940701f)},
    283     {SC_H(0.5336171389f), SC_H(0.5208471417f), SC_H(0.5008935928f),
    284      SC_H(0.4476420581f), SC_H(0.3905044496f), SC_H(0.2847472429f),
    285      SC_H(0.0276676007f), SC_H(-0.4966579080f)},
    286     {SC_H(0.6219832301f), SC_H(0.6096963882f), SC_H(0.5905415416f),
    287      SC_H(0.5396950245f), SC_H(0.4856070578f), SC_H(0.3868631124f),
    288      SC_H(0.1531652957f), SC_H(-0.5045361519f)},
    289     {SC_H(0.7071067691f), SC_H(0.6958807111f), SC_H(0.6784504056f),
    290      SC_H(0.6326373219f), SC_H(0.5847306848f), SC_H(0.4999999702f),
    291      SC_H(0.3205464482f), SC_H(0.0500000045f)},
    292     {SC_H(0.7830305696f), SC_H(0.7733067870f), SC_H(0.7582961321f),
    293      SC_H(0.7194055915f), SC_H(0.6797705293f), SC_H(0.6131368876f),
    294      SC_H(0.4997332692f), SC_H(0.6934193969f)},
    295     {SC_H(0.8457261920f), SC_H(0.8377274871f), SC_H(0.8254694939f),
    296      SC_H(0.7942851782f), SC_H(0.7635439038f), SC_H(0.7152527571f),
    297      SC_H(0.6567122936f), SC_H(0.8229061961f)},
    298     {SC_H(0.8940021992f), SC_H(0.8877248168f), SC_H(0.8781855106f),
    299      SC_H(0.8544237614f), SC_H(0.8318918347f), SC_H(0.7992399335f),
    300      SC_H(0.7751275301f), SC_H(0.8853276968f)},
    301     {SC_H(0.9290818572f), SC_H(0.9243524075f), SC_H(0.9172304869f),
    302      SC_H(0.8998877406f), SC_H(0.8841174841f), SC_H(0.8631930947f),
    303      SC_H(0.8565139771f), SC_H(0.9251161218f)},
    304     {SC_H(0.9534626007f), SC_H(0.9500193000f), SC_H(0.9448821545f),
    305      SC_H(0.9326565266f), SC_H(0.9220023751f), SC_H(0.9090909362f),
    306      SC_H(0.9096591473f), SC_H(0.9514584541f)},
    307     {SC_H(0.9758449197f), SC_H(0.9738122821f), SC_H(0.9708200693f),
    308      SC_H(0.9639287591f), SC_H(0.9582763910f), SC_H(0.9522733092f),
    309      SC_H(0.9553207159f), SC_H(0.9750427008f)},
    310     {SC_H(0.9876723289f), SC_H(0.9865267277f), SC_H(0.9848603010f),
    311      SC_H(0.9811310172f), SC_H(0.9782302976f), SC_H(0.9754966497f),
    312      SC_H(0.9779621363f), SC_H(0.9873252511f)},
    313     {SC_H(0.9937641621f), SC_H(0.9931397438f), SC_H(0.9922404289f),
    314      SC_H(0.9902750254f), SC_H(0.9888116717f), SC_H(0.9875672460f),
    315      SC_H(0.9891131520f), SC_H(0.9936066866f)},
    316     {SC_H(0.9968600869f), SC_H(0.9965277910f), SC_H(0.9960530400f),
    317      SC_H(0.9950347543f), SC_H(0.9943022728f), SC_H(0.9937300086f),
    318      SC_H(0.9946073294f), SC_H(0.9967863560f)},
    319     {SC_H(0.9984226227f), SC_H(0.9982488155f), SC_H(0.9980020523f),
    320      SC_H(0.9974802136f), SC_H(0.9971146584f), SC_H(0.9968476892f),
    321      SC_H(0.9973216057f), SC_H(0.9983873963f)},
    322     {SC_H(0.9995003939f), SC_H(0.9994428754f), SC_H(0.9993617535f),
    323      SC_H(0.9991930723f), SC_H(0.9990783334f), SC_H(0.9990010262f),
    324      SC_H(0.9991616607f), SC_H(0.9994897842f)},
    325     {SC_H(0.9998419285f), SC_H(0.9998232722f), SC_H(0.9997970462f),
    326      SC_H(0.9997430444f), SC_H(0.9997069836f), SC_H(0.9996838570f),
    327      SC_H(0.9997364879f), SC_H(0.9998386502f)},
    328     {SC_H(0.9999499917f), SC_H(0.9999440312f), SC_H(0.9999356270f),
    329      SC_H(0.9999184012f), SC_H(0.9999070764f), SC_H(0.9998999834f),
    330      SC_H(0.9999169707f), SC_H(0.9999489784f)},
    331     {SC_H(0.9999842048f), SC_H(0.9999822974f), SC_H(0.9999796152f),
    332      SC_H(0.9999741912f), SC_H(0.9999706149f), SC_H(0.9999684095f),
    333      SC_H(0.9999738336f), SC_H(0.9999839067f)},
    334     /* { SC_H( 1.0000000000f), SC_H( 1.0000000000f), SC_H( 1.0000000000f),
    335        SC_H( 1.0000000000f), SC_H( 1.0000000000f), SC_H( 1.0000000000f),
    336        SC_H( 1.0000000000f), SC_H( 1.0000000000f)} */
    337     {FX_DBL2FX_CFG(MAXVAL_DBL), FX_DBL2FX_CFG(MAXVAL_DBL),
    338      FX_DBL2FX_CFG(MAXVAL_DBL), FX_DBL2FX_CFG(MAXVAL_DBL),
    339      FX_DBL2FX_CFG(MAXVAL_DBL), FX_DBL2FX_CFG(MAXVAL_DBL),
    340      FX_DBL2FX_CFG(MAXVAL_DBL), FX_DBL2FX_CFG(MAXVAL_DBL)}};
    341 const DATA_TYPE_H H12_nc[31][8] = {
    342     {SC_H(0.0000000000f), SC_H(0.0000000110f), SC_H(0.0000000171f),
    343      SC_H(0.0000000253f), SC_H(0.0000000294f), SC_H(0.0000000316f),
    344      SC_H(0.0000000256f), SC_H(0.0000000045f)},
    345     {SC_H(0.0000000000f), SC_H(0.0019540924f), SC_H(0.0030265113f),
    346      SC_H(0.0044795922f), SC_H(0.0052186525f), SC_H(0.0056232354f),
    347      SC_H(0.0045594489f), SC_H(0.0007977085f)},
    348     {SC_H(0.0000000000f), SC_H(0.0034606720f), SC_H(0.0053620986f),
    349      SC_H(0.0079446984f), SC_H(0.0092647560f), SC_H(0.0099989995f),
    350      SC_H(0.0081285369f), SC_H(0.0014247064f)},
    351     {SC_H(0.0000000000f), SC_H(0.0061091618f), SC_H(0.0094724922f),
    352      SC_H(0.0140600521f), SC_H(0.0164252054f), SC_H(0.0177771728f),
    353      SC_H(0.0145191532f), SC_H(0.0025531140f)},
    354     {SC_H(0.0000000000f), SC_H(0.0107228858f), SC_H(0.0166464616f),
    355      SC_H(0.0247849934f), SC_H(0.0290434174f), SC_H(0.0315911844f),
    356      SC_H(0.0260186065f), SC_H(0.0046027615f)},
    357     {SC_H(0.0000000000f), SC_H(0.0186282862f), SC_H(0.0289774220f),
    358      SC_H(0.0433696397f), SC_H(0.0510888547f), SC_H(0.0560568646f),
    359      SC_H(0.0468755551f), SC_H(0.0083869267f)},
    360     {SC_H(0.0000000000f), SC_H(0.0257363543f), SC_H(0.0401044972f),
    361      SC_H(0.0602979437f), SC_H(0.0713650510f), SC_H(0.0789347738f),
    362      SC_H(0.0669798329f), SC_H(0.0121226767f)},
    363     {SC_H(0.0000000000f), SC_H(0.0352233723f), SC_H(0.0550108925f),
    364      SC_H(0.0832019597f), SC_H(0.0990892947f), SC_H(0.1108068749f),
    365      SC_H(0.0960334241f), SC_H(0.0176920593f)},
    366     {SC_H(0.0000000000f), SC_H(0.0475566536f), SC_H(0.0744772255f),
    367      SC_H(0.1134835035f), SC_H(0.1362429112f), SC_H(0.1546057910f),
    368      SC_H(0.1381545961f), SC_H(0.0261824392f)},
    369     {SC_H(0.0000000000f), SC_H(0.0629518181f), SC_H(0.0989024863f),
    370      SC_H(0.1520351619f), SC_H(0.1843357086f), SC_H(0.2131874412f),
    371      SC_H(0.1990868896f), SC_H(0.0395608991f)},
    372     {SC_H(0.0000000000f), SC_H(0.0809580907f), SC_H(0.1276271492f),
    373      SC_H(0.1980977356f), SC_H(0.2429044843f), SC_H(0.2874797881f),
    374      SC_H(0.2856767476f), SC_H(0.0617875643f)},
    375     {SC_H(0.0000000000f), SC_H(0.0936254337f), SC_H(0.1479234397f),
    376      SC_H(0.2310739607f), SC_H(0.2855334580f), SC_H(0.3436433673f),
    377      SC_H(0.3599678576f), SC_H(0.0857512727f)},
    378     {SC_H(0.0000000000f), SC_H(0.1057573780f), SC_H(0.1674221754f),
    379      SC_H(0.2630588412f), SC_H(0.3274079263f), SC_H(0.4005688727f),
    380      SC_H(0.4454404712f), SC_H(0.1242370531f)},
    381     {SC_H(0.0000000000f), SC_H(0.1160409302f), SC_H(0.1839915067f),
    382      SC_H(0.2904545665f), SC_H(0.3636667728f), SC_H(0.4512939751f),
    383      SC_H(0.5328993797f), SC_H(0.1951362640f)},
    384     {SC_H(0.0000000000f), SC_H(0.1230182052f), SC_H(0.1952532977f),
    385      SC_H(0.3091802597f), SC_H(0.3886501491f), SC_H(0.4870318770f),
    386      SC_H(0.6028295755f), SC_H(0.3637395203f)},
    387     {SC_H(0.0000000000f), SC_H(0.1254990250f), SC_H(0.1992611140f),
    388      SC_H(0.3158638775f), SC_H(0.3976053298f), SC_H(0.5000000000f),
    389      SC_H(0.6302776933f), SC_H(0.7053368092f)},
    390     {SC_H(0.0000000000f), SC_H(0.1230182052f), SC_H(0.1952533126f),
    391      SC_H(0.3091802597f), SC_H(0.3886501491f), SC_H(0.4870319068f),
    392      SC_H(0.6028295755f), SC_H(0.3637394905f)},
    393     {SC_H(0.0000000000f), SC_H(0.1160409302f), SC_H(0.1839915216f),
    394      SC_H(0.2904545665f), SC_H(0.3636668026f), SC_H(0.4512939751f),
    395      SC_H(0.5328993797f), SC_H(0.1951362044f)},
    396     {SC_H(0.0000000000f), SC_H(0.1057573855f), SC_H(0.1674221754f),
    397      SC_H(0.2630588710f), SC_H(0.3274079263f), SC_H(0.4005688727f),
    398      SC_H(0.4454405010f), SC_H(0.1242370382f)},
    399     {SC_H(0.0000000000f), SC_H(0.0936254337f), SC_H(0.1479234397f),
    400      SC_H(0.2310739607f), SC_H(0.2855334580f), SC_H(0.3436433673f),
    401      SC_H(0.3599678576f), SC_H(0.0857512653f)},
    402     {SC_H(0.0000000000f), SC_H(0.0809580907f), SC_H(0.1276271492f),
    403      SC_H(0.1980977207f), SC_H(0.2429044843f), SC_H(0.2874797881f),
    404      SC_H(0.2856767476f), SC_H(0.0617875606f)},
    405     {SC_H(0.0000000000f), SC_H(0.0629518107f), SC_H(0.0989024863f),
    406      SC_H(0.1520351619f), SC_H(0.1843357235f), SC_H(0.2131874412f),
    407      SC_H(0.1990868896f), SC_H(0.0395609401f)},
    408     {SC_H(0.0000000000f), SC_H(0.0475566462f), SC_H(0.0744772255f),
    409      SC_H(0.1134835184f), SC_H(0.1362429112f), SC_H(0.1546057761f),
    410      SC_H(0.1381545961f), SC_H(0.0261824802f)},
    411     {SC_H(0.0000000000f), SC_H(0.0352233797f), SC_H(0.0550108962f),
    412      SC_H(0.0832019448f), SC_H(0.0990892798f), SC_H(0.1108068526f),
    413      SC_H(0.0960334465f), SC_H(0.0176920686f)},
    414     {SC_H(0.0000000000f), SC_H(0.0257363524f), SC_H(0.0401044935f),
    415      SC_H(0.0602979474f), SC_H(0.0713650808f), SC_H(0.0789347589f),
    416      SC_H(0.0669797957f), SC_H(0.0121226516f)},
    417     {SC_H(0.0000000000f), SC_H(0.0186282881f), SC_H(0.0289774258f),
    418      SC_H(0.0433696248f), SC_H(0.0510888547f), SC_H(0.0560568906f),
    419      SC_H(0.0468755886f), SC_H(0.0083869714f)},
    420     {SC_H(0.0000000000f), SC_H(0.0107228830f), SC_H(0.0166464727f),
    421      SC_H(0.0247849822f), SC_H(0.0290434249f), SC_H(0.0315911621f),
    422      SC_H(0.0260186475f), SC_H(0.0046027377f)},
    423     {SC_H(0.0000000000f), SC_H(0.0061091576f), SC_H(0.0094724894f),
    424      SC_H(0.0140600465f), SC_H(0.0164251942f), SC_H(0.0177771524f),
    425      SC_H(0.0145191504f), SC_H(0.0025530567f)},
    426     {SC_H(0.0000000000f), SC_H(0.0034606743f), SC_H(0.0053620976f),
    427      SC_H(0.0079446994f), SC_H(0.0092647672f), SC_H(0.0099990256f),
    428      SC_H(0.0081285043f), SC_H(0.0014247177f)},
    429     {SC_H(0.0000000000f), SC_H(0.0019540912f), SC_H(0.0030265225f),
    430      SC_H(0.0044795908f), SC_H(0.0052186381f), SC_H(0.0056232223f),
    431      SC_H(0.0045594289f), SC_H(0.0007977359f)},
    432     {SC_H(0.0000000000f), SC_H(0.0000000149f), SC_H(0.0000000298f),
    433      SC_H(0.0000000298f), SC_H(0.0000000000f), SC_H(0.0000000596f),
    434      SC_H(0.0000000000f), SC_H(0.0000000000f)}};
    435 
    436 /*
    437   for (i=0; i<31; i++) {
    438     cld = dequantCLD[i];
    439     val = (float)(FDKexp(cld/dbe)/(1+FDKexp(cld/dbe)));
    440     val = (float)(dbe*FDKlog(val));
    441   }
    442 */
    443 #define SCALE_CLD_C1C2(a) (FL2FXCONST_DBL(a / (float)(1 << SF_CLD_C1C2)))
    444 const FIXP_DBL dequantCLD_c1[31] = {SCALE_CLD_C1C2(-1.5000000000000000e+002f),
    445                                     SCALE_CLD_C1C2(-4.5000137329101563e+001f),
    446                                     SCALE_CLD_C1C2(-4.0000434875488281e+001f),
    447                                     SCALE_CLD_C1C2(-3.5001373291015625e+001f),
    448                                     SCALE_CLD_C1C2(-3.0004341125488281e+001f),
    449                                     SCALE_CLD_C1C2(-2.5013711929321289e+001f),
    450                                     SCALE_CLD_C1C2(-2.2027315139770508e+001f),
    451                                     SCALE_CLD_C1C2(-1.9054332733154297e+001f),
    452                                     SCALE_CLD_C1C2(-1.6107742309570313e+001f),
    453                                     SCALE_CLD_C1C2(-1.3212384223937988e+001f),
    454                                     SCALE_CLD_C1C2(-1.0413927078247070e+001f),
    455                                     SCALE_CLD_C1C2(-8.6389207839965820e+000f),
    456                                     SCALE_CLD_C1C2(-6.9732279777526855e+000f),
    457                                     SCALE_CLD_C1C2(-5.4554042816162109e+000f),
    458                                     SCALE_CLD_C1C2(-4.1244258880615234e+000f),
    459                                     SCALE_CLD_C1C2(-3.0102999210357666e+000f),
    460                                     SCALE_CLD_C1C2(-2.1244258880615234e+000f),
    461                                     SCALE_CLD_C1C2(-1.4554045200347900e+000f),
    462                                     SCALE_CLD_C1C2(-9.7322785854339600e-001f),
    463                                     SCALE_CLD_C1C2(-6.3892036676406860e-001f),
    464                                     SCALE_CLD_C1C2(-4.1392669081687927e-001f),
    465                                     SCALE_CLD_C1C2(-2.1238386631011963e-001f),
    466                                     SCALE_CLD_C1C2(-1.0774217545986176e-001f),
    467                                     SCALE_CLD_C1C2(-5.4333221167325974e-002f),
    468                                     SCALE_CLD_C1C2(-2.7315950021147728e-002f),
    469                                     SCALE_CLD_C1C2(-1.3711934909224510e-002f),
    470                                     SCALE_CLD_C1C2(-4.3406565673649311e-003f),
    471                                     SCALE_CLD_C1C2(-1.3732088264077902e-003f),
    472                                     SCALE_CLD_C1C2(-4.3438826105557382e-004f),
    473                                     SCALE_CLD_C1C2(-1.3745666365139186e-004f),
    474                                     SCALE_CLD_C1C2(0.0000000000000000e+000f)};
    475 
    476 /* sac_stp */
    477 /* none scaled */
    478 const FIXP_CFG BP__FDK[] = {FL2FXCONST_CFG(0.73919999599457),
    479                             FL2FXCONST_CFG(0.97909998893738),
    480                             FL2FXCONST_CFG(0.99930000305176)};
    481 
    482 /* scaled with 26 bits */
    483 const FIXP_CFG BP_GF__FDK[] = {
    484     FL2FXCONST_CFG(0.00000000643330), FL2FXCONST_CFG(0.00004396850232),
    485     FL2FXCONST_CFG(0.00087456948552), FL2FXCONST_CFG(0.00474648220243),
    486     FL2FXCONST_CFG(0.01717987244800), FL2FXCONST_CFG(0.04906742491073),
    487     FL2FXCONST_CFG(0.10569518656729), FL2FXCONST_CFG(0.21165767592653),
    488     FL2FXCONST_CFG(0.36036762478024), FL2FXCONST_CFG(0.59894182766948),
    489     FL2FXCONST_CFG(0.81641678929129), FL2FXCONST_CFG(0.97418481133397),
    490     FL2FXCONST_CFG(0.99575411610845), FL2FXCONST_CFG(0.88842666281361),
    491     FL2FXCONST_CFG(0.79222317063736), FL2FXCONST_CFG(0.70828604318604),
    492     FL2FXCONST_CFG(0.66395054816338), FL2FXCONST_CFG(0.64633739516952),
    493     FL2FXCONST_CFG(0.66098278185255)};
    494 
    495 /* sac_bitdec */
    496 const INT samplingFreqTable[16] = {96000, 88200, 64000, 48000, 44100, 32000,
    497                                    24000, 22050, 16000, 12000, 11025, 8000,
    498                                    7350,  0,     0,     0};
    499 
    500 const UCHAR freqResTable[] = {0, 28, 20, 14, 10, 7, 5, 4};
    501 
    502 const UCHAR freqResTable_LD[] = {0, 23, 15, 12, 9, 7, 5, 4};
    503 
    504 const UCHAR tempShapeChanTable[][8] = {{5, 5, 4, 6, 6, 4, 4, 2},
    505                                        {5, 5, 5, 7, 7, 4, 4, 2}};
    506 
    507 const TREEPROPERTIES treePropertyTable[] = {
    508     {1, 6, 5, 0, {0, 0, 0, 0, 1}}, {1, 6, 5, 0, {0, 0, 1, 0, 0}},
    509     {2, 6, 3, 1, {1, 0, 0, 0, 0}}, {2, 8, 5, 1, {1, 0, 0, 0, 0}},
    510     {2, 8, 5, 1, {1, 0, 0, 0, 0}}, {6, 8, 2, 0, {0, 0, 0, 0, 0}},
    511     {6, 8, 2, 0, {0, 0, 0, 0, 0}}, {1, 2, 1, 0, {0, 0, 0, 0, 0}}};
    512 
    513 const SCHAR kernels_4_to_71[MAX_HYBRID_BANDS] = {
    514     0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
    515     2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
    516     3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
    517     3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
    518     3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
    519     3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3};
    520 
    521 const SCHAR kernels_5_to_71[MAX_HYBRID_BANDS] = {
    522     0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3,
    523     3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
    524     4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
    525     4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
    526     4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
    527     4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4};
    528 
    529 const SCHAR kernels_7_to_71[MAX_HYBRID_BANDS] = {
    530     0, 0, 0, 0, 0, 0, 1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 5, 5,
    531     5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
    532     6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
    533     6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
    534     6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
    535     6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6};
    536 
    537 const SCHAR kernels_10_to_71[MAX_HYBRID_BANDS] = {
    538     0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 7, 7, 7, 8, 8,
    539     8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
    540     9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
    541     9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
    542     9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
    543     9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9};
    544 
    545 const SCHAR kernels_14_to_71[MAX_HYBRID_BANDS] = {
    546     0,  0,  0,  0,  1,  1,  2,  3,  4,  4,  5,  6,  6,  7,  7,  8,  8,
    547     8,  9,  9,  9,  10, 10, 10, 10, 11, 11, 11, 11, 11, 12, 12, 12, 12,
    548     12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 13, 13,
    549     13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
    550     13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
    551     13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
    552     13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
    553     13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13};
    554 
    555 const SCHAR kernels_20_to_71[MAX_HYBRID_BANDS] = {
    556     0,  0,  1,  1,  2,  3,  4,  5,  6,  7,  8,  9,  10, 11, 12, 13, 14,
    557     14, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17, 17, 18, 18, 18, 18,
    558     18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 19, 19, 19, 19,
    559     19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
    560     19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
    561     19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
    562     19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
    563     19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19};
    564 
    565 const SCHAR kernels_28_to_71[MAX_HYBRID_BANDS] = {
    566     0,  0,  1,  1,  2,  3,  4,  5,  6,  7,  8,  9,  10, 11, 12, 13, 14,
    567     15, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 21, 22, 22, 22, 23,
    568     23, 23, 23, 24, 24, 24, 24, 24, 25, 25, 25, 25, 25, 25, 26, 26, 26,
    569     26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
    570     27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
    571     27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
    572     27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
    573     27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27};
    574 
    575 const SCHAR kernels_4_to_64[MAX_HYBRID_BANDS] = {
    576     0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
    577     2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
    578     3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
    579     3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
    580     3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
    581     3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3};
    582 
    583 const SCHAR kernels_5_to_64[MAX_HYBRID_BANDS] = {
    584     0, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
    585     3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
    586     4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
    587     4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
    588     4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
    589     4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4};
    590 
    591 const SCHAR kernels_7_to_64[MAX_HYBRID_BANDS] = {
    592     0, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5,
    593     5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
    594     6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
    595     6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
    596     6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
    597     6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6};
    598 
    599 const SCHAR kernels_9_to_64[MAX_HYBRID_BANDS] = {
    600     0, 1, 2, 3, 3, 4, 4, 5, 5, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7,
    601     7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
    602     8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
    603     8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
    604     8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
    605     8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8};
    606 
    607 const SCHAR kernels_12_to_64[MAX_HYBRID_BANDS] = {
    608     0,  1,  2,  3,  4,  4,  5,  5,  6,  6,  6,  7,  7,  7,  8,  8,  8,  8,  9,
    609     9,  9,  9,  9,  10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11,
    610     11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
    611     11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
    612     11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
    613     11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
    614     11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11};
    615 
    616 const SCHAR kernels_15_to_64[MAX_HYBRID_BANDS] = {
    617     0,  1,  2,  3,  4,  5,  6,  7,  8,  9,  9,  10, 10, 10, 11, 11, 11, 11, 12,
    618     12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14,
    619     14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
    620     14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
    621     14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
    622     14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
    623     14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14};
    624 
    625 const SCHAR kernels_23_to_64[MAX_HYBRID_BANDS] = {
    626     0,  1,  2,  3,  4,  5,  6,  7,  8,  9,  10, 11, 12, 12, 13, 13, 14, 14, 15,
    627     15, 16, 16, 16, 17, 17, 17, 18, 18, 18, 18, 19, 19, 19, 19, 19, 20, 20, 20,
    628     20, 20, 20, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 22, 22,
    629     22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
    630     22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
    631     22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
    632     22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22};
    633 
    634 const UCHAR mapping_15_to_23[MAX_PARAMETER_BANDS_LD] = {
    635     0,  1,  2,  3,  4,  5,  6,  7,  8,  9,  9, 10,
    636     10, 11, 11, 12, 12, 13, 13, 13, 14, 14, 14};
    637 
    638 const UCHAR mapping_12_to_23[MAX_PARAMETER_BANDS_LD] = {
    639     0, 1, 2, 3, 4, 4, 5, 5, 6, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 10, 11, 11, 11};
    640 
    641 const UCHAR mapping_9_to_23[MAX_PARAMETER_BANDS_LD] = {
    642     0, 1, 2, 3, 3, 4, 4, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8};
    643 
    644 const UCHAR mapping_7_to_23[MAX_PARAMETER_BANDS_LD] = {
    645     0, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6};
    646 
    647 const UCHAR mapping_5_to_23[MAX_PARAMETER_BANDS_LD] = {
    648     0, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4};
    649 
    650 const UCHAR mapping_4_to_23[MAX_PARAMETER_BANDS_LD] = {
    651     0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3};
    652 
    653 const FIXP_CFG clipGainTable__FDK[] = {
    654     /*CLIP_PROTECT_GAIN_0(1.000000f)*/ FX_DBL2FX_CFG(MAXVAL_DBL),
    655     CLIP_PROTECT_GAIN_1(1.189207f),
    656     CLIP_PROTECT_GAIN_1(1.414213f),
    657     CLIP_PROTECT_GAIN_1(1.681792f),
    658     /*CLIP_PROTECT_GAIN_1(2.000000f)*/ FX_DBL2FX_CFG(MAXVAL_DBL),
    659     CLIP_PROTECT_GAIN_2(2.378414f),
    660     CLIP_PROTECT_GAIN_2(2.828427f),
    661     /*CLIP_PROTECT_GAIN_2(4.000000f)*/ FX_DBL2FX_CFG(MAXVAL_DBL)};
    662 
    663 const UCHAR clipGainSFTable__FDK[] = {0, 1, 1, 1, 1, 2, 2, 2};
    664 
    665 const UCHAR pbStrideTable[] = {1, 2, 5, 28};
    666 
    667 const int smgTimeTable[] = {64, 128, 256, 512};
    668 
    669 /* table is scaled by factor 0.5 */
    670 const FIXP_CFG envShapeDataTable__FDK[5][2] = {
    671     {FL2FXCONST_CFG(0.25000000000000f), FL2FXCONST_CFG(0.25000000000000f)},
    672     {FL2FXCONST_CFG(0.35355339059327f), FL2FXCONST_CFG(0.31498026247372f)},
    673     {FL2FXCONST_CFG(0.50000000000000f), FL2FXCONST_CFG(0.39685026299205f)},
    674     {FL2FXCONST_CFG(0.70710678118655f), FL2FXCONST_CFG(0.50000000000000f)},
    675     {/*FL2FXCONST_CFG( 1.00000000000000f)*/ FX_DBL2FX_CFG(MAXVAL_DBL),
    676      FL2FXCONST_CFG(0.62996052494744f)}};
    677 
    678 /* sac_calcM1andM2 */
    679 const SCHAR row2channelSTP[][MAX_M2_INPUT] = {{0, 1}, {0, 3}, {0, 2},  {0, 4},
    680                                               {0, 4}, {0, 2}, {-1, 2}, {0, 1}};
    681 
    682 const SCHAR row2channelGES[][MAX_M2_INPUT] = {{0, 1}, {0, 3}, {0, 3},  {0, 5},
    683                                               {0, 5}, {0, 2}, {-1, 2}, {0, 1}};
    684 
    685 const SCHAR row2residual[][MAX_M2_INPUT] = {{-1, 0},  {-1, 0},  {-1, -1},
    686                                             {-1, -1}, {-1, -1}, {-1, -1},
    687                                             {-1, -1}, {-1, 0}};
    688 
    689 /*******************************************************************************
    690  Functionname: sac_getCLDValues
    691  *******************************************************************************
    692 
    693  Description: Get CLD values from table index.
    694 
    695  Arguments:
    696    index: Table index
    697    *cu, *cl : Pointer to locations where resulting values will be written to.
    698 
    699  Return: nothing
    700 
    701 *******************************************************************************/
    702 void SpatialDequantGetCLDValues(int index, FIXP_DBL* cu, FIXP_DBL* cl) {
    703   *cu = FX_CFG2FX_DBL(dequantCLD_c_l[index]);
    704   *cl = FX_CFG2FX_DBL(dequantCLD_c_l[31 - 1 - index]);
    705 }
    706 
    707 void SpatialDequantGetCLD2Values(int idx, FIXP_DBL* x) {
    708   *x = FX_CFG2FX_DBL(dequantCLD__FDK[idx]);
    709 }
    710