From 6cfabd35363c3ef5e3b209b867169a500b3ccc3c Mon Sep 17 00:00:00 2001 From: Fraunhofer IIS FDK Date: Mon, 26 Feb 2018 20:17:00 +0100 Subject: Upgrade to FDKv2 Bug: 71430241 Test: CTS DecoderTest and DecoderTestAacDrc original-Change-Id: Iaa20f749b8a04d553b20247cfe1a8930ebbabe30 Apply clang-format also on header files. original-Change-Id: I14de1ef16bbc79ec0283e745f98356a10efeb2e4 Fixes for MPEG-D DRC original-Change-Id: If1de2d74bbbac84b3f67de3b88b83f6a23b8a15c Catch unsupported tw_mdct at an early stage original-Change-Id: Ied9dd00d754162a0e3ca1ae3e6b854315d818afe Fixing PVC transition frames original-Change-Id: Ib75725abe39252806c32d71176308f2c03547a4e Move qmf bands sanity check original-Change-Id: Iab540c3013c174d9490d2ae100a4576f51d8dbc4 Initialize scaling variable original-Change-Id: I3c4087101b70e998c71c1689b122b0d7762e0f9e Add 16 qmf band configuration to getSlotNrgHQ() original-Change-Id: I49a5d30f703a1b126ff163df9656db2540df21f1 Always apply byte alignment at the end of the AudioMuxElement original-Change-Id: I42d560287506d65d4c3de8bfe3eb9a4ebeb4efc7 Setup SBR element only if no parse error exists original-Change-Id: I1915b73704bc80ab882b9173d6bec59cbd073676 Additional array index check in HCR original-Change-Id: I18cc6e501ea683b5009f1bbee26de8ddd04d8267 Fix fade-in index selection in concealment module original-Change-Id: Ibf802ed6ed8c05e9257e1f3b6d0ac1162e9b81c1 Enable explicit backward compatible parser for AAC_LD original-Change-Id: I27e9c678dcb5d40ed760a6d1e06609563d02482d Skip spatial specific config in explicit backward compatible ASC original-Change-Id: Iff7cc365561319e886090cedf30533f562ea4d6e Update flags description in decoder API original-Change-Id: I9a5b4f8da76bb652f5580cbd3ba9760425c43830 Add QMF domain reset function original-Change-Id: I4f89a8a2c0277d18103380134e4ed86996e9d8d6 DRC upgrade v2.1.0 original-Change-Id: I5731c0540139dab220094cd978ef42099fc45b74 Fix integer overflow in sqrtFixp_lookup() original-Change-Id: I429a6f0d19aa2cc957e0f181066f0ca73968c914 Fix integer overflow in invSqrtNorm2() original-Change-Id: I84de5cbf9fb3adeb611db203fe492fabf4eb6155 Fix integer overflow in GenerateRandomVector() original-Change-Id: I3118a641008bd9484d479e5b0b1ee2b5d7d44d74 Fix integer overflow in adjustTimeSlot_EldGrid() original-Change-Id: I29d503c247c5c8282349b79df940416a512fb9d5 Fix integer overflow in FDKsbrEnc_codeEnvelope() original-Change-Id: I6b34b61ebb9d525b0c651ed08de2befc1f801449 Follow-up on: Fix integer overflow in adjustTimeSlot_EldGrid() original-Change-Id: I6f8f578cc7089e5eb7c7b93e580b72ca35ad689a Fix integer overflow in get_pk_v2() original-Change-Id: I63375bed40d45867f6eeaa72b20b1f33e815938c Fix integer overflow in Syn_filt_zero() original-Change-Id: Ie0c02fdfbe03988f9d3b20d10cd9fe4c002d1279 Fix integer overflow in CFac_CalcFacSignal() original-Change-Id: Id2d767c40066c591b51768e978eb8af3b803f0c5 Fix integer overflow in FDKaacEnc_FDKaacEnc_calcPeNoAH() original-Change-Id: Idcbd0f4a51ae2550ed106aa6f3d678d1f9724841 Fix integer overflow in sbrDecoder_calculateGainVec() original-Change-Id: I7081bcbe29c5cede9821b38d93de07c7add2d507 Fix integer overflow in CLpc_SynthesisLattice() original-Change-Id: I4a95ddc18de150102352d4a1845f06094764c881 Fix integer overflow in Pred_Lt4() original-Change-Id: I4dbd012b2de7d07c3e70a47b92e3bfae8dbc750a Fix integer overflow in FDKsbrEnc_InitSbrFastTransientDetector() original-Change-Id: I788cbec1a4a00f44c2f3a72ad7a4afa219807d04 Fix unsigned integer overflow in FDKaacEnc_WriteBitstream() original-Change-Id: I68fc75166e7d2cd5cd45b18dbe3d8c2a92f1822a Fix unsigned integer overflow in FDK_MetadataEnc_Init() original-Change-Id: Ie8d025f9bcdb2442c704bd196e61065c03c10af4 Fix overflow in pseudo random number generators original-Change-Id: I3e2551ee01356297ca14e3788436ede80bd5513c Fix unsigned integer overflow in sbrDecoder_Parse() original-Change-Id: I3f231b2f437e9c37db4d5b964164686710eee971 Fix unsigned integer overflow in longsub() original-Change-Id: I73c2bc50415cac26f1f5a29e125bbe75f9180a6e Fix unsigned integer overflow in CAacDecoder_DecodeFrame() original-Change-Id: Ifce2db4b1454b46fa5f887e9d383f1cc43b291e4 Fix overflow at CLpdChannelStream_Read() original-Change-Id: Idb9d822ce3a4272e4794b643644f5434e2d4bf3f Fix unsigned integer overflow in Hcr_State_BODY_SIGN_ESC__ESC_WORD() original-Change-Id: I1ccf77c0015684b85534c5eb97162740a870b71c Fix unsigned integer overflow in UsacConfig_Parse() original-Change-Id: Ie6d27f84b6ae7eef092ecbff4447941c77864d9f Fix unsigned integer overflow in aacDecoder_drcParse() original-Change-Id: I713f28e883eea3d70b6fa56a7b8f8c22bcf66ca0 Fix unsigned integer overflow in aacDecoder_drcReadCompression() original-Change-Id: Ia34dfeb88c4705c558bce34314f584965cafcf7a Fix unsigned integer overflow in CDataStreamElement_Read() original-Change-Id: Iae896cc1d11f0a893d21be6aa90bd3e60a2c25f0 Fix unsigned integer overflow in transportDec_AdjustEndOfAccessUnit() original-Change-Id: I64cf29a153ee784bb4a16fdc088baabebc0007dc Fix unsigned integer overflow in transportDec_GetAuBitsRemaining() original-Change-Id: I975b3420faa9c16a041874ba0db82e92035962e4 Fix unsigned integer overflow in extractExtendedData() original-Change-Id: I2a59eb09e2053cfb58dfb75fcecfad6b85a80a8f Fix signed integer overflow in CAacDecoder_ExtPayloadParse() original-Change-Id: I4ad5ca4e3b83b5d964f1c2f8c5e7b17c477c7929 Fix unsigned integer overflow in CAacDecoder_DecodeFrame() original-Change-Id: I29a39df77d45c52a0c9c5c83c1ba81f8d0f25090 Follow-up on: Fix integer overflow in CLpc_SynthesisLattice() original-Change-Id: I8fb194ffc073a3432a380845be71036a272d388f Fix signed integer overflow in _interpolateDrcGain() original-Change-Id: I879ec9ab14005069a7c47faf80e8bc6e03d22e60 Fix unsigned integer overflow in FDKreadBits() original-Change-Id: I1f47a6a8037ff70375aa8844947d5681bb4287ad Fix unsigned integer overflow in FDKbyteAlign() original-Change-Id: Id5f3a11a0c9e50fc6f76ed6c572dbd4e9f2af766 Fix unsigned integer overflow in FDK_get32() original-Change-Id: I9d33b8e97e3d38cbb80629cb859266ca0acdce96 Fix unsigned integer overflow in FDK_pushBack() original-Change-Id: Ic87f899bc8c6acf7a377a8ca7f3ba74c3a1e1c19 Fix unsigned integer overflow in FDK_pushForward() original-Change-Id: I3b754382f6776a34be1602e66694ede8e0b8effc Fix unsigned integer overflow in ReadPsData() original-Change-Id: I25361664ba8139e32bbbef2ca8c106a606ce9c37 Fix signed integer overflow in E_UTIL_residu() original-Change-Id: I8c3abd1f437ee869caa8fb5903ce7d3d641b6aad REVERT: Follow-up on: Integer overflow in CLpc_SynthesisLattice(). original-Change-Id: I3d340099acb0414795c8dfbe6362bc0a8f045f9b Follow-up on: Fix integer overflow in CLpc_SynthesisLattice() original-Change-Id: I4aedb8b3a187064e9f4d985175aa55bb99cc7590 Follow-up on: Fix unsigned integer overflow in aacDecoder_drcParse() original-Change-Id: I2aa2e13916213bf52a67e8b0518e7bf7e57fb37d Fix integer overflow in acelp original-Change-Id: Ie6390c136d84055f8b728aefbe4ebef6e029dc77 Fix unsigned integer overflow in aacDecoder_UpdateBitStreamCounters() original-Change-Id: I391ffd97ddb0b2c184cba76139bfb356a3b4d2e2 Adjust concealment default settings original-Change-Id: I6a95db935a327c47df348030bcceafcb29f54b21 Saturate estimatedStartPos original-Change-Id: I27be2085e0ae83ec9501409f65e003f6bcba1ab6 Negative shift exponent in _interpolateDrcGain() original-Change-Id: I18edb26b26d002aafd5e633d4914960f7a359c29 Negative shift exponent in calculateICC() original-Change-Id: I3dcd2ae98d2eb70ee0d59750863cbb2a6f4f8aba Too large shift exponent in FDK_put() original-Change-Id: Ib7d9aaa434d2d8de4a13b720ca0464b31ca9b671 Too large shift exponent in CalcInvLdData() original-Change-Id: I43e6e78d4cd12daeb1dcd5d82d1798bdc2550262 Member access within null pointer of type SBR_CHANNEL original-Change-Id: Idc5e4ea8997810376d2f36bbdf628923b135b097 Member access within null pointer of type CpePersistentData original-Change-Id: Ib6c91cb0d37882768e5baf63324e429589de0d9d Member access within null pointer FDKaacEnc_psyMain() original-Change-Id: I7729b7f4479970531d9dc823abff63ca52e01997 Member access within null pointer FDKaacEnc_GetPnsParam() original-Change-Id: I9aa3b9f3456ae2e0f7483dbd5b3dde95fc62da39 Member access within null pointer FDKsbrEnc_EnvEncodeFrame() original-Change-Id: I67936f90ea714e90b3e81bc0dd1472cc713eb23a Add HCR sanity check original-Change-Id: I6c1d9732ebcf6af12f50b7641400752f74be39f7 Fix memory issue for HBE edge case with 8:3 SBR original-Change-Id: I11ea58a61e69fbe8bf75034b640baee3011e63e9 Additional SBR parametrization sanity check for ELD original-Change-Id: Ie26026fbfe174c2c7b3691f6218b5ce63e322140 Add MPEG-D DRC channel layout check original-Change-Id: Iea70a74f171b227cce636a9eac4ba662777a2f72 Additional out-of-bounds checks in MPEG-D DRC original-Change-Id: Ife4a8c3452c6fde8a0a09e941154a39a769777d4 Change-Id: Ic63cb2f628720f54fe9b572b0cb528e2599c624e --- libSACdec/src/sac_rom.cpp | 709 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 709 insertions(+) create mode 100644 libSACdec/src/sac_rom.cpp (limited to 'libSACdec/src/sac_rom.cpp') diff --git a/libSACdec/src/sac_rom.cpp b/libSACdec/src/sac_rom.cpp new file mode 100644 index 0000000..4285b65 --- /dev/null +++ b/libSACdec/src/sac_rom.cpp @@ -0,0 +1,709 @@ +/* ----------------------------------------------------------------------------- +Software License for The Fraunhofer FDK AAC Codec Library for Android + +© Copyright 1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten +Forschung e.V. All rights reserved. + + 1. INTRODUCTION +The Fraunhofer FDK AAC Codec Library for Android ("FDK AAC Codec") is software +that implements the MPEG Advanced Audio Coding ("AAC") encoding and decoding +scheme for digital audio. This FDK AAC Codec software is intended to be used on +a wide variety of Android devices. + +AAC's HE-AAC and HE-AAC v2 versions are regarded as today's most efficient +general perceptual audio codecs. AAC-ELD is considered the best-performing +full-bandwidth communications codec by independent studies and is widely +deployed. AAC has been standardized by ISO and IEC as part of the MPEG +specifications. + +Patent licenses for necessary patent claims for the FDK AAC Codec (including +those of Fraunhofer) may be obtained through Via Licensing +(www.vialicensing.com) or through the respective patent owners individually for +the purpose of encoding or decoding bit streams in products that are compliant +with the ISO/IEC MPEG audio standards. Please note that most manufacturers of +Android devices already license these patent claims through Via Licensing or +directly from the patent owners, and therefore FDK AAC Codec software may +already be covered under those patent licenses when it is used for those +licensed purposes only. + +Commercially-licensed AAC software libraries, including floating-point versions +with enhanced sound quality, are also available from Fraunhofer. Users are +encouraged to check the Fraunhofer website for additional applications +information and documentation. + +2. COPYRIGHT LICENSE + +Redistribution and use in source and binary forms, with or without modification, +are permitted without payment of copyright license fees provided that you +satisfy the following conditions: + +You must retain the complete text of this software license in redistributions of +the FDK AAC Codec or your modifications thereto in source code form. + +You must retain the complete text of this software license in the documentation +and/or other materials provided with redistributions of the FDK AAC Codec or +your modifications thereto in binary form. You must make available free of +charge copies of the complete source code of the FDK AAC Codec and your +modifications thereto to recipients of copies in binary form. + +The name of Fraunhofer may not be used to endorse or promote products derived +from this library without prior written permission. + +You may not charge copyright license fees for anyone to use, copy or distribute +the FDK AAC Codec software or your modifications thereto. + +Your modified versions of the FDK AAC Codec must carry prominent notices stating +that you changed the software and the date of any change. For modified versions +of the FDK AAC Codec, the term "Fraunhofer FDK AAC Codec Library for Android" +must be replaced by the term "Third-Party Modified Version of the Fraunhofer FDK +AAC Codec Library for Android." + +3. NO PATENT LICENSE + +NO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without +limitation the patents of Fraunhofer, ARE GRANTED BY THIS SOFTWARE LICENSE. +Fraunhofer provides no warranty of patent non-infringement with respect to this +software. + +You may use this FDK AAC Codec software or modifications thereto only for +purposes that are authorized by appropriate patent licenses. + +4. DISCLAIMER + +This FDK AAC Codec software is provided by Fraunhofer on behalf of the copyright +holders and contributors "AS IS" and WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, +including but not limited to the implied warranties of merchantability and +fitness for a particular purpose. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +CONTRIBUTORS BE LIABLE for any direct, indirect, incidental, special, exemplary, +or consequential damages, including but not limited to procurement of substitute +goods or services; loss of use, data, or profits, or business interruption, +however caused and on any theory of liability, whether in contract, strict +liability, or tort (including negligence), arising in any way out of the use of +this software, even if advised of the possibility of such damage. + +5. CONTACT INFORMATION + +Fraunhofer Institute for Integrated Circuits IIS +Attention: Audio and Multimedia Departments - FDK AAC LL +Am Wolfsmantel 33 +91058 Erlangen, Germany + +www.iis.fraunhofer.de/amm +amm-info@iis.fraunhofer.de +----------------------------------------------------------------------------- */ + +/*********************** MPEG surround decoder library ************************* + + Author(s): + + Description: SAC Dec tables + +*******************************************************************************/ + +#include "sac_rom.h" +#include "sac_calcM1andM2.h" + +#define SCALE_CPC(a) (FL2FXCONST_CFG(a / (float)(1 << SCALE_PARAM_M1))) +const FIXP_CFG dequantCPC__FDK[] = { + SCALE_CPC(-2.0f), SCALE_CPC(-1.9f), SCALE_CPC(-1.8f), SCALE_CPC(-1.7f), + SCALE_CPC(-1.6f), SCALE_CPC(-1.5f), SCALE_CPC(-1.4f), SCALE_CPC(-1.3f), + SCALE_CPC(-1.2f), SCALE_CPC(-1.1f), SCALE_CPC(-1.0f), SCALE_CPC(-0.9f), + SCALE_CPC(-0.8f), SCALE_CPC(-0.7f), SCALE_CPC(-0.6f), SCALE_CPC(-0.5f), + SCALE_CPC(-0.4f), SCALE_CPC(-0.3f), SCALE_CPC(-0.2f), SCALE_CPC(-0.1f), + SCALE_CPC(0.0f), SCALE_CPC(0.1f), SCALE_CPC(0.2f), SCALE_CPC(0.3f), + SCALE_CPC(0.4f), SCALE_CPC(0.5f), SCALE_CPC(0.6f), SCALE_CPC(0.7f), + SCALE_CPC(0.8f), SCALE_CPC(0.9f), SCALE_CPC(1.0f), SCALE_CPC(1.1f), + SCALE_CPC(1.2f), SCALE_CPC(1.3f), SCALE_CPC(1.4f), SCALE_CPC(1.5f), + SCALE_CPC(1.6f), SCALE_CPC(1.7f), SCALE_CPC(1.8f), SCALE_CPC(1.9f), + SCALE_CPC(2.0f), SCALE_CPC(2.1f), SCALE_CPC(2.2f), SCALE_CPC(2.3f), + SCALE_CPC(2.4f), SCALE_CPC(2.5f), SCALE_CPC(2.6f), SCALE_CPC(2.7f), + SCALE_CPC(2.8f), SCALE_CPC(2.9f), SCALE_CPC(3.0f)}; + +#define SCALE_ICC(a) (FL2FXCONST_CFG(a)) +const FIXP_CFG dequantICC__FDK[8] = { + /*SCALE_ICC(1.00000f)*/ FX_DBL2FX_CFG(MAXVAL_DBL), + SCALE_ICC(0.9370f), + SCALE_ICC(0.84118f), + SCALE_ICC(0.60092f), + SCALE_ICC(0.36764f), + SCALE_ICC(0.0000f), + SCALE_ICC(-0.58900f), + SCALE_ICC(-0.9900f)}; + +#define SCALE_CLD2(a) (FL2FXCONST_CFG(a / (float)(1 << 8))) +const FIXP_CFG dequantCLD__FDK[31] = { + SCALE_CLD2(-150.0f), SCALE_CLD2(-45.0f), SCALE_CLD2(-40.0f), + SCALE_CLD2(-35.0f), SCALE_CLD2(-30.0f), SCALE_CLD2(-25.0f), + SCALE_CLD2(-22.0f), SCALE_CLD2(-19.0f), SCALE_CLD2(-16.0f), + SCALE_CLD2(-13.0f), SCALE_CLD2(-10.0f), SCALE_CLD2(-8.0f), + SCALE_CLD2(-6.0f), SCALE_CLD2(-4.0f), SCALE_CLD2(-2.0f), + SCALE_CLD2(0.0f), SCALE_CLD2(2.0f), SCALE_CLD2(4.0f), + SCALE_CLD2(6.0f), SCALE_CLD2(8.0f), SCALE_CLD2(10.0f), + SCALE_CLD2(13.0f), SCALE_CLD2(16.0f), SCALE_CLD2(19.0f), + SCALE_CLD2(22.0f), SCALE_CLD2(25.0f), SCALE_CLD2(30.0f), + SCALE_CLD2(35.0f), SCALE_CLD2(40.0f), SCALE_CLD2(45.0f), + SCALE_CLD2(150.0f)}; + +#define SCALE_IPD(a) (FL2FXCONST_CFG(a / (float)(1 << IPD_SCALE))) +const FIXP_CFG dequantIPD__FDK[16] = { + /* SCALE_IPD(0.000000000f), SCALE_IPD(0.392699082f), + SCALE_IPD(0.785398163f), SCALE_IPD(1.178097245f), + SCALE_IPD(1.570796327f), SCALE_IPD(1.963495408f), + SCALE_IPD(2.356194490f), SCALE_IPD(2.748893572f), + SCALE_IPD(3.141592654f), SCALE_IPD(3.534291735f), + SCALE_IPD(3.926990817f), SCALE_IPD(4.319689899f), + SCALE_IPD(4.712388980f), SCALE_IPD(5.105088062f), + SCALE_IPD(5.497787144f), SCALE_IPD(5.890486225f) */ + SCALE_IPD(0.00000000000000f), SCALE_IPD(0.392699082f), + SCALE_IPD(0.78539816339745f), SCALE_IPD(1.178097245f), + SCALE_IPD(1.57079632679490f), SCALE_IPD(1.963495408f), + SCALE_IPD(2.35619449019234f), SCALE_IPD(2.748893572f), + SCALE_IPD(3.14159265358979f), SCALE_IPD(3.534291735f), + SCALE_IPD(3.92699081698724f), SCALE_IPD(4.319689899f), + SCALE_IPD(4.71238898038469f), SCALE_IPD(5.105088062f), + SCALE_IPD(5.49778714378214f), SCALE_IPD(5.890486225f)}; + +#define SCALE_SPLIT_ANGLE(a) (FL2FXCONST_CFG(a / (float)(1 << IPD_SCALE))) +/* + Generate table dequantIPD_CLD_ICC_splitAngle__FDK[16][31][8]: + + #define ABS_THR ( 1e-9f * 32768 * 32768 ) + + float dequantICC[] = + {1.0000f,0.9370f,0.84118f,0.60092f,0.36764f,0.0f,-0.5890f,-0.9900f}; float + dequantCLD[] = + {-150.0,-45.0,-40.0,-35.0,-30.0,-25.0,-22.0,-19.0,-16.0,-13.0,-10.0, -8.0, + -6.0, -4.0, -2.0, 0.0, 2.0, 4.0, 6.0, 8.0, + 10.0, 13.0, 16.0, 19.0, 22.0, 25.0, 30.0, 35.0, 40.0, 45.0, 150.0 }; float + dequantIPD[] = + {0.f,0.392699082f,0.785398163f,1.178097245f,1.570796327f,1.963495408f, + 2.35619449f,2.748893572f,3.141592654f,3.534291735f,3.926990817f, + 4.319689899f,4.71238898f,5.105088062f,5.497787144f,5.890486225f}; + + for (ipdIdx=0; ipdIdx<16; ipdIdx++) + for (cldIdx=0; cldIdx<31; cldIdx++) + for (iccIdx=0; iccIdx<8; iccIdx++) { + ipd = dequantIPD[ipdIdx]; + cld = dequantCLD[cldIdx]; + icc = dequantICC[iccIdx]; + iidLin = (float) pow(10.0f, cld / 20.0f); + iidLin2 = iidLin * iidLin; + iidLin21 = iidLin2 + 1.0f; + sinIpd = (float) sin(ipd); + cosIpd = (float) cos(ipd); + temp1 = 2.0f * icc * iidLin; + temp1c = temp1 * cosIpd; + ratio = (iidLin21 + temp1c) / (iidLin21 + temp1) + ABS_THR; + w2 = (float) pow(ratio, 0.25f); + w1 = 2.0f - w2; + dequantIPD_CLD_ICC_splitAngle__FDK[ipdIdx][cldIdx][iccIdx] = (float) + atan2(w2 * sinIpd, w1 * iidLin + w2 * cosIpd); + } +*/ + +#define SCALE_CLD(a) (FL2FXCONST_CFG(a)) + +const FIXP_CFG dequantCLD_c_l[31] = { + SCALE_CLD(0.0000000316f), + SCALE_CLD(0.0056233243f), + SCALE_CLD(0.0099994997f), + SCALE_CLD(0.0177799836f), + SCALE_CLD(0.0316069759f), + SCALE_CLD(0.0561454296f), + SCALE_CLD(0.0791834071f), + SCALE_CLD(0.1115021780f), + SCALE_CLD(0.1565355062f), + SCALE_CLD(0.2184644639f), + SCALE_CLD(0.3015113473f), + SCALE_CLD(0.3698741496f), + SCALE_CLD(0.4480624795f), + SCALE_CLD(0.5336171389f), + SCALE_CLD(0.6219832301f), + SCALE_CLD(0.7071067691f), + SCALE_CLD(0.7830305696f), + SCALE_CLD(0.8457261920f), + SCALE_CLD(0.8940021992f), + SCALE_CLD(0.9290818572f), + SCALE_CLD(0.9534626007f), + SCALE_CLD(0.9758449197f), + SCALE_CLD(0.9876723289f), + SCALE_CLD(0.9937641621f), + SCALE_CLD(0.9968600869f), + SCALE_CLD(0.9984226227f), + SCALE_CLD(0.9995003939f), + SCALE_CLD(0.9998419285f), + SCALE_CLD(0.9999499917f), + SCALE_CLD(0.9999842048f), + /*SCALE_CLD(1.0000000000f)*/ FX_DBL2FX_CFG(MAXVAL_DBL)}; + +#define SC_H(a) (FL2FXCONST_CFG(a)) +#define DATA_TYPE_H FIXP_CFG + +/* not correlated tables */ +const DATA_TYPE_H H11_nc[31][8] = { + {SC_H(0.0000000316f), SC_H(0.0000000296f), SC_H(0.0000000266f), + SC_H(0.0000000190f), SC_H(0.0000000116f), SC_H(0.0000000000f), + SC_H(-0.0000000186f), SC_H(-0.0000000313f)}, + {SC_H(0.0056233243f), SC_H(0.0052728835f), SC_H(0.0047394098f), + SC_H(0.0033992692f), SC_H(0.0020946222f), SC_H(0.0000316215f), + SC_H(-0.0032913829f), SC_H(-0.0055664564f)}, + {SC_H(0.0099994997f), SC_H(0.0093815643f), SC_H(0.0084402543f), + SC_H(0.0060722125f), SC_H(0.0037622179f), SC_H(0.0000999898f), + SC_H(-0.0058238208f), SC_H(-0.0098974844f)}, + {SC_H(0.0177799836f), SC_H(0.0166974831f), SC_H(0.0150465844f), + SC_H(0.0108831404f), SC_H(0.0068073822f), SC_H(0.0003161267f), + SC_H(-0.0102626514f), SC_H(-0.0175957214f)}, + {SC_H(0.0316069759f), SC_H(0.0297324844f), SC_H(0.0268681273f), + SC_H(0.0196138974f), SC_H(0.0124691967f), SC_H(0.0009989988f), + SC_H(-0.0179452803f), SC_H(-0.0312700421f)}, + {SC_H(0.0561454296f), SC_H(0.0529650487f), SC_H(0.0480896905f), + SC_H(0.0356564634f), SC_H(0.0232860073f), SC_H(0.0031523081f), + SC_H(-0.0309029408f), SC_H(-0.0555154830f)}, + {SC_H(0.0791834071f), SC_H(0.0748842582f), SC_H(0.0682762116f), + SC_H(0.0513241664f), SC_H(0.0343080349f), SC_H(0.0062700072f), + SC_H(-0.0422340371f), SC_H(-0.0782499388f)}, + {SC_H(0.1115021780f), SC_H(0.1057924852f), SC_H(0.0969873071f), + SC_H(0.0742305145f), SC_H(0.0511277616f), SC_H(0.0124327289f), + SC_H(-0.0566596612f), SC_H(-0.1100896299f)}, + {SC_H(0.1565355062f), SC_H(0.1491366178f), SC_H(0.1376826316f), + SC_H(0.1078186408f), SC_H(0.0770794004f), SC_H(0.0245033558f), + SC_H(-0.0735980421f), SC_H(-0.1543303132f)}, + {SC_H(0.2184644639f), SC_H(0.2091979682f), SC_H(0.1947948188f), + SC_H(0.1568822265f), SC_H(0.1172478944f), SC_H(0.0477267131f), + SC_H(-0.0899507254f), SC_H(-0.2148526460f)}, + {SC_H(0.3015113473f), SC_H(0.2904391289f), SC_H(0.2731673419f), + SC_H(0.2273024023f), SC_H(0.1786239147f), SC_H(0.0909090787f), + SC_H(-0.0964255333f), SC_H(-0.2951124907f)}, + {SC_H(0.3698741496f), SC_H(0.3578284085f), SC_H(0.3390066922f), + SC_H(0.2888108492f), SC_H(0.2351117432f), SC_H(0.1368068755f), + SC_H(-0.0850296095f), SC_H(-0.3597966135f)}, + {SC_H(0.4480624795f), SC_H(0.4354025424f), SC_H(0.4156077504f), + SC_H(0.3627120256f), SC_H(0.3058823943f), SC_H(0.2007599771f), + SC_H(-0.0484020934f), SC_H(-0.4304940701f)}, + {SC_H(0.5336171389f), SC_H(0.5208471417f), SC_H(0.5008935928f), + SC_H(0.4476420581f), SC_H(0.3905044496f), SC_H(0.2847472429f), + SC_H(0.0276676007f), SC_H(-0.4966579080f)}, + {SC_H(0.6219832301f), SC_H(0.6096963882f), SC_H(0.5905415416f), + SC_H(0.5396950245f), SC_H(0.4856070578f), SC_H(0.3868631124f), + SC_H(0.1531652957f), SC_H(-0.5045361519f)}, + {SC_H(0.7071067691f), SC_H(0.6958807111f), SC_H(0.6784504056f), + SC_H(0.6326373219f), SC_H(0.5847306848f), SC_H(0.4999999702f), + SC_H(0.3205464482f), SC_H(0.0500000045f)}, + {SC_H(0.7830305696f), SC_H(0.7733067870f), SC_H(0.7582961321f), + SC_H(0.7194055915f), SC_H(0.6797705293f), SC_H(0.6131368876f), + SC_H(0.4997332692f), SC_H(0.6934193969f)}, + {SC_H(0.8457261920f), SC_H(0.8377274871f), SC_H(0.8254694939f), + SC_H(0.7942851782f), SC_H(0.7635439038f), SC_H(0.7152527571f), + SC_H(0.6567122936f), SC_H(0.8229061961f)}, + {SC_H(0.8940021992f), SC_H(0.8877248168f), SC_H(0.8781855106f), + SC_H(0.8544237614f), SC_H(0.8318918347f), SC_H(0.7992399335f), + SC_H(0.7751275301f), SC_H(0.8853276968f)}, + {SC_H(0.9290818572f), SC_H(0.9243524075f), SC_H(0.9172304869f), + SC_H(0.8998877406f), SC_H(0.8841174841f), SC_H(0.8631930947f), + SC_H(0.8565139771f), SC_H(0.9251161218f)}, + {SC_H(0.9534626007f), SC_H(0.9500193000f), SC_H(0.9448821545f), + SC_H(0.9326565266f), SC_H(0.9220023751f), SC_H(0.9090909362f), + SC_H(0.9096591473f), SC_H(0.9514584541f)}, + {SC_H(0.9758449197f), SC_H(0.9738122821f), SC_H(0.9708200693f), + SC_H(0.9639287591f), SC_H(0.9582763910f), SC_H(0.9522733092f), + SC_H(0.9553207159f), SC_H(0.9750427008f)}, + {SC_H(0.9876723289f), SC_H(0.9865267277f), SC_H(0.9848603010f), + SC_H(0.9811310172f), SC_H(0.9782302976f), SC_H(0.9754966497f), + SC_H(0.9779621363f), SC_H(0.9873252511f)}, + {SC_H(0.9937641621f), SC_H(0.9931397438f), SC_H(0.9922404289f), + SC_H(0.9902750254f), SC_H(0.9888116717f), SC_H(0.9875672460f), + SC_H(0.9891131520f), SC_H(0.9936066866f)}, + {SC_H(0.9968600869f), SC_H(0.9965277910f), SC_H(0.9960530400f), + SC_H(0.9950347543f), SC_H(0.9943022728f), SC_H(0.9937300086f), + SC_H(0.9946073294f), SC_H(0.9967863560f)}, + {SC_H(0.9984226227f), SC_H(0.9982488155f), SC_H(0.9980020523f), + SC_H(0.9974802136f), SC_H(0.9971146584f), SC_H(0.9968476892f), + SC_H(0.9973216057f), SC_H(0.9983873963f)}, + {SC_H(0.9995003939f), SC_H(0.9994428754f), SC_H(0.9993617535f), + SC_H(0.9991930723f), SC_H(0.9990783334f), SC_H(0.9990010262f), + SC_H(0.9991616607f), SC_H(0.9994897842f)}, + {SC_H(0.9998419285f), SC_H(0.9998232722f), SC_H(0.9997970462f), + SC_H(0.9997430444f), SC_H(0.9997069836f), SC_H(0.9996838570f), + SC_H(0.9997364879f), SC_H(0.9998386502f)}, + {SC_H(0.9999499917f), SC_H(0.9999440312f), SC_H(0.9999356270f), + SC_H(0.9999184012f), SC_H(0.9999070764f), SC_H(0.9998999834f), + SC_H(0.9999169707f), SC_H(0.9999489784f)}, + {SC_H(0.9999842048f), SC_H(0.9999822974f), SC_H(0.9999796152f), + SC_H(0.9999741912f), SC_H(0.9999706149f), SC_H(0.9999684095f), + SC_H(0.9999738336f), SC_H(0.9999839067f)}, + /* { SC_H( 1.0000000000f), SC_H( 1.0000000000f), SC_H( 1.0000000000f), + SC_H( 1.0000000000f), SC_H( 1.0000000000f), SC_H( 1.0000000000f), + SC_H( 1.0000000000f), SC_H( 1.0000000000f)} */ + {FX_DBL2FX_CFG(MAXVAL_DBL), FX_DBL2FX_CFG(MAXVAL_DBL), + FX_DBL2FX_CFG(MAXVAL_DBL), FX_DBL2FX_CFG(MAXVAL_DBL), + FX_DBL2FX_CFG(MAXVAL_DBL), FX_DBL2FX_CFG(MAXVAL_DBL), + FX_DBL2FX_CFG(MAXVAL_DBL), FX_DBL2FX_CFG(MAXVAL_DBL)}}; +const DATA_TYPE_H H12_nc[31][8] = { + {SC_H(0.0000000000f), SC_H(0.0000000110f), SC_H(0.0000000171f), + SC_H(0.0000000253f), SC_H(0.0000000294f), SC_H(0.0000000316f), + SC_H(0.0000000256f), SC_H(0.0000000045f)}, + {SC_H(0.0000000000f), SC_H(0.0019540924f), SC_H(0.0030265113f), + SC_H(0.0044795922f), SC_H(0.0052186525f), SC_H(0.0056232354f), + SC_H(0.0045594489f), SC_H(0.0007977085f)}, + {SC_H(0.0000000000f), SC_H(0.0034606720f), SC_H(0.0053620986f), + SC_H(0.0079446984f), SC_H(0.0092647560f), SC_H(0.0099989995f), + SC_H(0.0081285369f), SC_H(0.0014247064f)}, + {SC_H(0.0000000000f), SC_H(0.0061091618f), SC_H(0.0094724922f), + SC_H(0.0140600521f), SC_H(0.0164252054f), SC_H(0.0177771728f), + SC_H(0.0145191532f), SC_H(0.0025531140f)}, + {SC_H(0.0000000000f), SC_H(0.0107228858f), SC_H(0.0166464616f), + SC_H(0.0247849934f), SC_H(0.0290434174f), SC_H(0.0315911844f), + SC_H(0.0260186065f), SC_H(0.0046027615f)}, + {SC_H(0.0000000000f), SC_H(0.0186282862f), SC_H(0.0289774220f), + SC_H(0.0433696397f), SC_H(0.0510888547f), SC_H(0.0560568646f), + SC_H(0.0468755551f), SC_H(0.0083869267f)}, + {SC_H(0.0000000000f), SC_H(0.0257363543f), SC_H(0.0401044972f), + SC_H(0.0602979437f), SC_H(0.0713650510f), SC_H(0.0789347738f), + SC_H(0.0669798329f), SC_H(0.0121226767f)}, + {SC_H(0.0000000000f), SC_H(0.0352233723f), SC_H(0.0550108925f), + SC_H(0.0832019597f), SC_H(0.0990892947f), SC_H(0.1108068749f), + SC_H(0.0960334241f), SC_H(0.0176920593f)}, + {SC_H(0.0000000000f), SC_H(0.0475566536f), SC_H(0.0744772255f), + SC_H(0.1134835035f), SC_H(0.1362429112f), SC_H(0.1546057910f), + SC_H(0.1381545961f), SC_H(0.0261824392f)}, + {SC_H(0.0000000000f), SC_H(0.0629518181f), SC_H(0.0989024863f), + SC_H(0.1520351619f), SC_H(0.1843357086f), SC_H(0.2131874412f), + SC_H(0.1990868896f), SC_H(0.0395608991f)}, + {SC_H(0.0000000000f), SC_H(0.0809580907f), SC_H(0.1276271492f), + SC_H(0.1980977356f), SC_H(0.2429044843f), SC_H(0.2874797881f), + SC_H(0.2856767476f), SC_H(0.0617875643f)}, + {SC_H(0.0000000000f), SC_H(0.0936254337f), SC_H(0.1479234397f), + SC_H(0.2310739607f), SC_H(0.2855334580f), SC_H(0.3436433673f), + SC_H(0.3599678576f), SC_H(0.0857512727f)}, + {SC_H(0.0000000000f), SC_H(0.1057573780f), SC_H(0.1674221754f), + SC_H(0.2630588412f), SC_H(0.3274079263f), SC_H(0.4005688727f), + SC_H(0.4454404712f), SC_H(0.1242370531f)}, + {SC_H(0.0000000000f), SC_H(0.1160409302f), SC_H(0.1839915067f), + SC_H(0.2904545665f), SC_H(0.3636667728f), SC_H(0.4512939751f), + SC_H(0.5328993797f), SC_H(0.1951362640f)}, + {SC_H(0.0000000000f), SC_H(0.1230182052f), SC_H(0.1952532977f), + SC_H(0.3091802597f), SC_H(0.3886501491f), SC_H(0.4870318770f), + SC_H(0.6028295755f), SC_H(0.3637395203f)}, + {SC_H(0.0000000000f), SC_H(0.1254990250f), SC_H(0.1992611140f), + SC_H(0.3158638775f), SC_H(0.3976053298f), SC_H(0.5000000000f), + SC_H(0.6302776933f), SC_H(0.7053368092f)}, + {SC_H(0.0000000000f), SC_H(0.1230182052f), SC_H(0.1952533126f), + SC_H(0.3091802597f), SC_H(0.3886501491f), SC_H(0.4870319068f), + SC_H(0.6028295755f), SC_H(0.3637394905f)}, + {SC_H(0.0000000000f), SC_H(0.1160409302f), SC_H(0.1839915216f), + SC_H(0.2904545665f), SC_H(0.3636668026f), SC_H(0.4512939751f), + SC_H(0.5328993797f), SC_H(0.1951362044f)}, + {SC_H(0.0000000000f), SC_H(0.1057573855f), SC_H(0.1674221754f), + SC_H(0.2630588710f), SC_H(0.3274079263f), SC_H(0.4005688727f), + SC_H(0.4454405010f), SC_H(0.1242370382f)}, + {SC_H(0.0000000000f), SC_H(0.0936254337f), SC_H(0.1479234397f), + SC_H(0.2310739607f), SC_H(0.2855334580f), SC_H(0.3436433673f), + SC_H(0.3599678576f), SC_H(0.0857512653f)}, + {SC_H(0.0000000000f), SC_H(0.0809580907f), SC_H(0.1276271492f), + SC_H(0.1980977207f), SC_H(0.2429044843f), SC_H(0.2874797881f), + SC_H(0.2856767476f), SC_H(0.0617875606f)}, + {SC_H(0.0000000000f), SC_H(0.0629518107f), SC_H(0.0989024863f), + SC_H(0.1520351619f), SC_H(0.1843357235f), SC_H(0.2131874412f), + SC_H(0.1990868896f), SC_H(0.0395609401f)}, + {SC_H(0.0000000000f), SC_H(0.0475566462f), SC_H(0.0744772255f), + SC_H(0.1134835184f), SC_H(0.1362429112f), SC_H(0.1546057761f), + SC_H(0.1381545961f), SC_H(0.0261824802f)}, + {SC_H(0.0000000000f), SC_H(0.0352233797f), SC_H(0.0550108962f), + SC_H(0.0832019448f), SC_H(0.0990892798f), SC_H(0.1108068526f), + SC_H(0.0960334465f), SC_H(0.0176920686f)}, + {SC_H(0.0000000000f), SC_H(0.0257363524f), SC_H(0.0401044935f), + SC_H(0.0602979474f), SC_H(0.0713650808f), SC_H(0.0789347589f), + SC_H(0.0669797957f), SC_H(0.0121226516f)}, + {SC_H(0.0000000000f), SC_H(0.0186282881f), SC_H(0.0289774258f), + SC_H(0.0433696248f), SC_H(0.0510888547f), SC_H(0.0560568906f), + SC_H(0.0468755886f), SC_H(0.0083869714f)}, + {SC_H(0.0000000000f), SC_H(0.0107228830f), SC_H(0.0166464727f), + SC_H(0.0247849822f), SC_H(0.0290434249f), SC_H(0.0315911621f), + SC_H(0.0260186475f), SC_H(0.0046027377f)}, + {SC_H(0.0000000000f), SC_H(0.0061091576f), SC_H(0.0094724894f), + SC_H(0.0140600465f), SC_H(0.0164251942f), SC_H(0.0177771524f), + SC_H(0.0145191504f), SC_H(0.0025530567f)}, + {SC_H(0.0000000000f), SC_H(0.0034606743f), SC_H(0.0053620976f), + SC_H(0.0079446994f), SC_H(0.0092647672f), SC_H(0.0099990256f), + SC_H(0.0081285043f), SC_H(0.0014247177f)}, + {SC_H(0.0000000000f), SC_H(0.0019540912f), SC_H(0.0030265225f), + SC_H(0.0044795908f), SC_H(0.0052186381f), SC_H(0.0056232223f), + SC_H(0.0045594289f), SC_H(0.0007977359f)}, + {SC_H(0.0000000000f), SC_H(0.0000000149f), SC_H(0.0000000298f), + SC_H(0.0000000298f), SC_H(0.0000000000f), SC_H(0.0000000596f), + SC_H(0.0000000000f), SC_H(0.0000000000f)}}; + +/* + for (i=0; i<31; i++) { + cld = dequantCLD[i]; + val = (float)(FDKexp(cld/dbe)/(1+FDKexp(cld/dbe))); + val = (float)(dbe*FDKlog(val)); + } +*/ +#define SCALE_CLD_C1C2(a) (FL2FXCONST_DBL(a / (float)(1 << SF_CLD_C1C2))) +const FIXP_DBL dequantCLD_c1[31] = {SCALE_CLD_C1C2(-1.5000000000000000e+002f), + SCALE_CLD_C1C2(-4.5000137329101563e+001f), + SCALE_CLD_C1C2(-4.0000434875488281e+001f), + SCALE_CLD_C1C2(-3.5001373291015625e+001f), + SCALE_CLD_C1C2(-3.0004341125488281e+001f), + SCALE_CLD_C1C2(-2.5013711929321289e+001f), + SCALE_CLD_C1C2(-2.2027315139770508e+001f), + SCALE_CLD_C1C2(-1.9054332733154297e+001f), + SCALE_CLD_C1C2(-1.6107742309570313e+001f), + SCALE_CLD_C1C2(-1.3212384223937988e+001f), + SCALE_CLD_C1C2(-1.0413927078247070e+001f), + SCALE_CLD_C1C2(-8.6389207839965820e+000f), + SCALE_CLD_C1C2(-6.9732279777526855e+000f), + SCALE_CLD_C1C2(-5.4554042816162109e+000f), + SCALE_CLD_C1C2(-4.1244258880615234e+000f), + SCALE_CLD_C1C2(-3.0102999210357666e+000f), + SCALE_CLD_C1C2(-2.1244258880615234e+000f), + SCALE_CLD_C1C2(-1.4554045200347900e+000f), + SCALE_CLD_C1C2(-9.7322785854339600e-001f), + SCALE_CLD_C1C2(-6.3892036676406860e-001f), + SCALE_CLD_C1C2(-4.1392669081687927e-001f), + SCALE_CLD_C1C2(-2.1238386631011963e-001f), + SCALE_CLD_C1C2(-1.0774217545986176e-001f), + SCALE_CLD_C1C2(-5.4333221167325974e-002f), + SCALE_CLD_C1C2(-2.7315950021147728e-002f), + SCALE_CLD_C1C2(-1.3711934909224510e-002f), + SCALE_CLD_C1C2(-4.3406565673649311e-003f), + SCALE_CLD_C1C2(-1.3732088264077902e-003f), + SCALE_CLD_C1C2(-4.3438826105557382e-004f), + SCALE_CLD_C1C2(-1.3745666365139186e-004f), + SCALE_CLD_C1C2(0.0000000000000000e+000f)}; + +/* sac_stp */ +/* none scaled */ +const FIXP_CFG BP__FDK[] = {FL2FXCONST_CFG(0.73919999599457), + FL2FXCONST_CFG(0.97909998893738), + FL2FXCONST_CFG(0.99930000305176)}; + +/* scaled with 26 bits */ +const FIXP_CFG BP_GF__FDK[] = { + FL2FXCONST_CFG(0.00000000643330), FL2FXCONST_CFG(0.00004396850232), + FL2FXCONST_CFG(0.00087456948552), FL2FXCONST_CFG(0.00474648220243), + FL2FXCONST_CFG(0.01717987244800), FL2FXCONST_CFG(0.04906742491073), + FL2FXCONST_CFG(0.10569518656729), FL2FXCONST_CFG(0.21165767592653), + FL2FXCONST_CFG(0.36036762478024), FL2FXCONST_CFG(0.59894182766948), + FL2FXCONST_CFG(0.81641678929129), FL2FXCONST_CFG(0.97418481133397), + FL2FXCONST_CFG(0.99575411610845), FL2FXCONST_CFG(0.88842666281361), + FL2FXCONST_CFG(0.79222317063736), FL2FXCONST_CFG(0.70828604318604), + FL2FXCONST_CFG(0.66395054816338), FL2FXCONST_CFG(0.64633739516952), + FL2FXCONST_CFG(0.66098278185255)}; + +/* sac_bitdec */ +const INT samplingFreqTable[16] = {96000, 88200, 64000, 48000, 44100, 32000, + 24000, 22050, 16000, 12000, 11025, 8000, + 7350, 0, 0, 0}; + +const UCHAR freqResTable[] = {0, 28, 20, 14, 10, 7, 5, 4}; + +const UCHAR freqResTable_LD[] = {0, 23, 15, 12, 9, 7, 5, 4}; + +const UCHAR tempShap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9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9}; + +const SCHAR kernels_14_to_71[MAX_HYBRID_BANDS] = { + 0, 0, 0, 0, 1, 1, 2, 3, 4, 4, 5, 6, 6, 7, 7, 8, 8, + 8, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11, 11, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13}; + +const SCHAR kernels_20_to_71[MAX_HYBRID_BANDS] = { + 0, 0, 1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, + 14, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17, 17, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19}; + +const SCHAR kernels_28_to_71[MAX_HYBRID_BANDS] = { + 0, 0, 1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, + 15, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 21, 22, 22, 22, 23, + 23, 23, 23, 24, 24, 24, 24, 24, 25, 25, 25, 25, 25, 25, 26, 26, 26, + 26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, + 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, + 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, + 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, + 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27}; + +const SCHAR kernels_4_to_64[MAX_HYBRID_BANDS] = { + 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}; + +const SCHAR kernels_5_to_64[MAX_HYBRID_BANDS] = { + 0, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4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 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8}; + +const SCHAR kernels_12_to_64[MAX_HYBRID_BANDS] = { + 0, 1, 2, 3, 4, 4, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 8, 9, + 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11}; + +const SCHAR kernels_15_to_64[MAX_HYBRID_BANDS] = { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 9, 10, 10, 10, 11, 11, 11, 11, 12, + 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14}; + +const SCHAR kernels_23_to_64[MAX_HYBRID_BANDS] = { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 12, 13, 13, 14, 14, 15, + 15, 16, 16, 16, 17, 17, 17, 18, 18, 18, 18, 19, 19, 19, 19, 19, 20, 20, 20, + 20, 20, 20, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 22, 22, + 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, + 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, + 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, + 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22}; + +const UCHAR mapping_15_to_23[MAX_PARAMETER_BANDS_LD] = { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 9, 10, + 10, 11, 11, 12, 12, 13, 13, 13, 14, 14, 14}; + +const UCHAR mapping_12_to_23[MAX_PARAMETER_BANDS_LD] = { + 0, 1, 2, 3, 4, 4, 5, 5, 6, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 10, 11, 11, 11}; + +const UCHAR mapping_9_to_23[MAX_PARAMETER_BANDS_LD] = { + 0, 1, 2, 3, 3, 4, 4, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8}; + +const UCHAR mapping_7_to_23[MAX_PARAMETER_BANDS_LD] = { + 0, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6}; + +const UCHAR mapping_5_to_23[MAX_PARAMETER_BANDS_LD] = { + 0, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4}; + +const UCHAR mapping_4_to_23[MAX_PARAMETER_BANDS_LD] = { + 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3}; + +const FIXP_CFG clipGainTable__FDK[] = { + /*CLIP_PROTECT_GAIN_0(1.000000f)*/ FX_DBL2FX_CFG(MAXVAL_DBL), + CLIP_PROTECT_GAIN_1(1.189207f), + CLIP_PROTECT_GAIN_1(1.414213f), + CLIP_PROTECT_GAIN_1(1.681792f), + /*CLIP_PROTECT_GAIN_1(2.000000f)*/ FX_DBL2FX_CFG(MAXVAL_DBL), + CLIP_PROTECT_GAIN_2(2.378414f), + CLIP_PROTECT_GAIN_2(2.828427f), + /*CLIP_PROTECT_GAIN_2(4.000000f)*/ FX_DBL2FX_CFG(MAXVAL_DBL)}; + +const UCHAR clipGainSFTable__FDK[] = {0, 1, 1, 1, 1, 2, 2, 2}; + +const UCHAR pbStrideTable[] = {1, 2, 5, 28}; + +const int smgTimeTable[] = {64, 128, 256, 512}; + +/* table is scaled by factor 0.5 */ +const FIXP_CFG envShapeDataTable__FDK[5][2] = { + {FL2FXCONST_CFG(0.25000000000000f), FL2FXCONST_CFG(0.25000000000000f)}, + {FL2FXCONST_CFG(0.35355339059327f), FL2FXCONST_CFG(0.31498026247372f)}, + {FL2FXCONST_CFG(0.50000000000000f), FL2FXCONST_CFG(0.39685026299205f)}, + {FL2FXCONST_CFG(0.70710678118655f), FL2FXCONST_CFG(0.50000000000000f)}, + {/*FL2FXCONST_CFG( 1.00000000000000f)*/ FX_DBL2FX_CFG(MAXVAL_DBL), + FL2FXCONST_CFG(0.62996052494744f)}}; + +/* sac_calcM1andM2 */ +const SCHAR row2channelSTP[][MAX_M2_INPUT] = {{0, 1}, {0, 3}, {0, 2}, {0, 4}, + {0, 4}, {0, 2}, {-1, 2}, {0, 1}}; + +const SCHAR row2channelGES[][MAX_M2_INPUT] = {{0, 1}, {0, 3}, {0, 3}, {0, 5}, + {0, 5}, {0, 2}, {-1, 2}, {0, 1}}; + +const SCHAR row2residual[][MAX_M2_INPUT] = {{-1, 0}, {-1, 0}, {-1, -1}, + {-1, -1}, {-1, -1}, {-1, -1}, + {-1, -1}, {-1, 0}}; + +/******************************************************************************* + Functionname: sac_getCLDValues + ******************************************************************************* + + Description: Get CLD values from table index. + + Arguments: + index: Table index + *cu, *cl : Pointer to locations where resulting values will be written to. + + Return: nothing + +*******************************************************************************/ +void SpatialDequantGetCLDValues(int index, FIXP_DBL* cu, FIXP_DBL* cl) { + *cu = FX_CFG2FX_DBL(dequantCLD_c_l[index]); + *cl = FX_CFG2FX_DBL(dequantCLD_c_l[31 - 1 - index]); +} + +void SpatialDequantGetCLD2Values(int idx, FIXP_DBL* x) { + *x = FX_CFG2FX_DBL(dequantCLD__FDK[idx]); +} -- cgit v1.2.3