Commit ef8dc8e6 authored by Shikha Shetgeri's avatar Shikha Shetgeri
Browse files

moved the tables to ivas_lcld_tables.c

parent 29e1af81
Loading
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -199,20 +199,18 @@
  <ItemGroup>
    <ClCompile Include="..\lib_rend\ivas_dirac_dec_binaural_functions.c" />
    <ClCompile Include="..\lib_rend\ivas_hrtf.c" />
    <ClCompile Include="..\lib_rend\ivas_lcld_tables.c" />
    <ClCompile Include="..\lib_rend\ivas_sba_rendering.c" />
    <ClCompile Include="..\lib_rend\ivas_allrad_dec.c" />
    <ClCompile Include="..\lib_rend\ivas_cldfb_codec_bitstream.c" />
    <ClCompile Include="..\lib_rend\ivas_CQMFDecoder.c" />
    <ClCompile Include="..\lib_rend\ivas_CQMFEncoder.c" />
    <ClCompile Include="..\lib_rend\ivas_CQMFHuff.c" />
    <ClCompile Include="..\lib_rend\ivas_MSPred.c" />
    <ClCompile Include="..\lib_rend\ivas_NoiseGen.c" />
    <ClCompile Include="..\lib_rend\ivas_PerceptualModel.c" />
    <ClCompile Include="..\lib_rend\ivas_PredDecoder.c" />
    <ClCompile Include="..\lib_rend\ivas_PredEncoder.c" />
    <ClCompile Include="..\lib_rend\ivas_RMSEnvDeltaHuff.c" />
    <ClCompile Include="..\lib_rend\ivas_RMSEnvGrouping.c" />
    <ClCompile Include="..\lib_rend\ivas_Tables.c" />
    <ClCompile Include="..\lib_rend\ivas_splitRendererPre.c" />
    <ClCompile Include="..\lib_rend\ivas_splitRendererPost.c" />
    <ClCompile Include="..\lib_rend\ivas_splitRenderer_utils.c" />
@@ -245,6 +243,7 @@
    <ClCompile Include="..\lib_rend\lib_rend.c" />
  </ItemGroup>
  <ItemGroup>
    <ClInclude Include="..\lib_rend\ivas_lcld_tables.h" />
    <ClInclude Include="..\lib_rend\ivas_prot_rend.h" />
    <ClInclude Include="..\lib_rend\ivas_rom_binauralRenderer.h" />
    <ClInclude Include="..\lib_rend\ivas_rom_binaural_crend_head.h" />
+6 −10
Original line number Diff line number Diff line
@@ -39,11 +39,8 @@ Nations Convention on Contracts on the International Sales of Goods.
#include "options.h"
#ifdef SPLIT_REND_WITH_HEAD_ROT

#include "ivas_CQMFHuff.h"
#include "ivas_NoiseGen.h"
#include "ivas_PerceptualModel.h"
#include "ivas_RMSEnvDeltaHuff.h"
#include "ivas_Tables.h"
#include "ivas_lcld_tables.h"
#include "ivas_cldfb_codec_bitstream.h"
#include "prot.h"
#include <assert.h>
@@ -122,7 +119,7 @@ struct CQMF_DECODER
    int32_t iLastError;
};
#ifdef ROM_TO_RAM
static void CreateDecodeTable( CQMFDecoder *psCQMFDecoder, int32_t num, const uint32_t ( *ppuiEncTable )[2], int32_t iSize, int32_t iReadLength, uint32_t *iTables );
static void CreateDecodeTable( CQMFDecoder *psCQMFDecoder, int32_t num, const uint16_t ( *ppuiEncTable )[2], int32_t iSize, int32_t iReadLength, uint32_t *iTables );
static TableNode *CreateTableList( int32_t iReadLength );
static void DeleteTableList( TableList *ptable_list, int32_t iTables );
static TableNode *GetNextTable( int32_t iIndex, TableList *table_list, TableNode *poParent, int32_t iReadLength, uint32_t *iTablesCreated );
@@ -276,7 +273,7 @@ static void AddcodeTableList( TableList *ptable_list, int32_t iLength, int32_t i
    }
}

static void CreateDecodeTable( CQMFDecoder *psCQMFDecoder, int32_t num, const uint32_t ( *ppuiEncTable )[2], int32_t iSize, int32_t iReadLength, uint32_t *iTables )
static void CreateDecodeTable( CQMFDecoder *psCQMFDecoder, int32_t num, const uint16_t ( *ppuiEncTable )[2], int32_t iSize, int32_t iReadLength, uint32_t *iTables )
{
    int32_t n;
    uint32_t **ppsort_enc_table;
@@ -288,8 +285,8 @@ static void CreateDecodeTable( CQMFDecoder *psCQMFDecoder, int32_t num, const ui
    {

        ppsort_enc_table[n] = (uint32_t *) malloc( 3 * sizeof( int32_t ) );
        ppsort_enc_table[n][0] = ppuiEncTable[n][0];
        ppsort_enc_table[n][1] = ppuiEncTable[n][1];
        ppsort_enc_table[n][0] = (uint32_t)ppuiEncTable[n][0];
        ppsort_enc_table[n][1] = (uint32_t)ppuiEncTable[n][1];
        ppsort_enc_table[n][2] = (uint32_t) n;
    }

@@ -1556,8 +1553,7 @@ ReadCQMFData( const int32_t iNumGroups, const int32_t *piGroupLengths, const int
                    pauiHuffmanTableDPCM = (const uint32_t( * )[HUFF_DEC_TABLE_SIZE]) c_apauiHuffDecTables[ALLOC_TABLE_SIZE + iAlloc];
#else
                    pauiHuffmanTable = c_apauiHuffDecTables[iAlloc];
                    pauiHuffmanTableDPCM =
                        c_apauiHuffDecTables[ALLOC_TABLE_SIZE + iAlloc];
                    pauiHuffmanTableDPCM = c_apauiHuffDecTables[ALLOC_TABLE_SIZE + iAlloc];
#endif
#ifdef USE_DEMOD_TABLES
                    paiDemodTable = c_apaiDemodTables[iAlloc];
+25 −20
Original line number Diff line number Diff line
@@ -37,12 +37,9 @@
#include <math.h>
#include <stdlib.h>
#include <assert.h>
#include "ivas_Tables.h"
#include "ivas_lcld_tables.h"
#include "prot.h"
#include "ivas_RMSEnvGrouping.h"
#include "ivas_PerceptualModel.h"
#include "ivas_RMSEnvDeltaHuff.h"
#include "ivas_CQMFHuff.h"
#include "ivas_cldfb_codec_bitstream.h"
#include "ivas_prot_rend.h"
#ifdef ENABLE_MS_PRED
@@ -1357,9 +1354,13 @@ static int32_t CountCQMFBits( const int32_t iNumGroups,

                if ( iAlloc > 0 )
                {
#ifndef ROM_TO_RAM
                    const uint32_t( *pauiHuffmanTable )[2] = NULL;
                    const uint32_t( *pauiHuffmanTableDPCM )[2] = NULL;

#else
                    const uint16_t( *pauiHuffmanTable )[2] = NULL;
                    const uint16_t( *pauiHuffmanTableDPCM )[2] = NULL;
#endif
                    // pauiHuffmanTable = GetHuffEncTable(iAlloc);
                    pauiHuffmanTable = c_apauiHuffEncTabels[iAlloc];
                    pauiHuffmanTableDPCM = c_apauiHuffEncTabels[ALLOC_TABLE_SIZE + iAlloc];
@@ -1805,9 +1806,13 @@ static int32_t WriteCQMFData( const int32_t iNumGroups,

                if ( iAlloc > 0 )
                {
#ifndef ROM_TO_RAM
                    const uint32_t(*pauiHuffmanTable)[2] = NULL;
                    const uint32_t(*pauiHuffmanTableDPCM)[2] = NULL;

#else
                    const uint16_t(*pauiHuffmanTable)[2] = NULL;
                    const uint16_t(*pauiHuffmanTableDPCM)[2] = NULL;
#endif
                    // pauiHuffmanTable = GetHuffEncTable(iAlloc);
                    pauiHuffmanTable = c_apauiHuffEncTabels[iAlloc];
                    pauiHuffmanTableDPCM = c_apauiHuffEncTabels[ALLOC_TABLE_SIZE + iAlloc];
+1 −2
Original line number Diff line number Diff line
@@ -33,8 +33,7 @@
#include "ivas_MSPred.h"
#include "options.h"
#ifdef SPLIT_REND_WITH_HEAD_ROT
#include "ivas_Tables.h"
#include "ivas_RMSEnvDeltaHuff.h"
#include "ivas_lcld_tables.h"
#include <stdlib.h>
#include <stdio.h>
#include "prot.h"
+1 −113
Original line number Diff line number Diff line
@@ -29,11 +29,9 @@
   the United Nations Convention on Contracts on the International Sales of Goods.

*******************************************************************************************************/

#include "ivas_PerceptualModel.h"
#include "options.h"
#ifdef SPLIT_REND_WITH_HEAD_ROT
#include "ivas_Tables.h"
#include "ivas_lcld_tables.h"
#include "prot.h"
#include "ivas_prot_rend.h"
#include <stdio.h>
@@ -41,43 +39,6 @@


/* clang-format off */
#define LOG_ADD_TABLE_LENGTH    (512)

/*TODO : rtyag : move this to tables.c*/
const int32_t c_aiLogAddTable[LOG_ADD_TABLE_LENGTH] = {
    0x40, 0x40, 0x3F, 0x3F, 0x3E, 0x3E, 0x3D, 0x3D, 0x3C, 0x3C, 0x3B, 0x3B, 0x3A, 0x3A, 0x39, 0x39,
    0x38, 0x38, 0x37, 0x37, 0x37, 0x36, 0x36, 0x35, 0x35, 0x34, 0x34, 0x33, 0x33, 0x33, 0x32, 0x32,
    0x31, 0x31, 0x31, 0x30, 0x30, 0x2F, 0x2F, 0x2F, 0x2E, 0x2E, 0x2D, 0x2D, 0x2D, 0x2C, 0x2C, 0x2B,
    0x2B, 0x2B, 0x2A, 0x2A, 0x2A, 0x29, 0x29, 0x29, 0x28, 0x28, 0x27, 0x27, 0x27, 0x26, 0x26, 0x26,
    0x25, 0x25, 0x25, 0x24, 0x24, 0x24, 0x23, 0x23, 0x23, 0x23, 0x22, 0x22, 0x22, 0x21, 0x21, 0x21,
    0x20, 0x20, 0x20, 0x20, 0x1F, 0x1F, 0x1F, 0x1E, 0x1E, 0x1E, 0x1E, 0x1D, 0x1D, 0x1D, 0x1C, 0x1C,
    0x1C, 0x1C, 0x1B, 0x1B, 0x1B, 0x1B, 0x1A, 0x1A, 0x1A, 0x1A, 0x19, 0x19, 0x19, 0x19, 0x18, 0x18,
    0x18, 0x18, 0x18, 0x17, 0x17, 0x17, 0x17, 0x16, 0x16, 0x16, 0x16, 0x16, 0x15, 0x15, 0x15, 0x15,
    0x15, 0x14, 0x14, 0x14, 0x14, 0x14, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x12, 0x12, 0x12, 0x12,
    0x12, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x0F, 0x0F, 0x0F,
    0x0F, 0x0F, 0x0F, 0x0F, 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D,
    0x0D, 0x0D, 0x0D, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B,
    0x0B, 0x0B, 0x0B, 0x0B, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x09, 0x09,
    0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
    0x08, 0x08, 0x08, 0x08, 0x08, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
    0x07, 0x07, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06,
    0x06, 0x06, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05,
    0x05, 0x05, 0x05, 0x05, 0x05, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
    0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x03, 0x03, 0x03,
    0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
    0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x02, 0x02, 0x02, 0x02,
    0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
    0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
    0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01,
    0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
    0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
    0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
    0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
    0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
    0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
    0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};

static inline int32_t LogAdd(int32_t iVal1,int32_t iVal2)
{
@@ -97,79 +58,6 @@ static inline int32_t LogAdd(int32_t iVal1,int32_t iVal2)
    return iRetVal;
}

#define PERCEPTUAL_MODEL_SCALE              (64)

#define PERCEPTUAL_MODEL_SCALE_SHIFT        (6)

#define PERCEPTUAL_MODEL_ALPHA_SCALE        (614)

#define PERCEPTUAL_MODEL_ALPHA_INV_SCALE    (6827)

#define PERCEPTUAL_MODEL_ALPHA_SHIFT        (11)

#define PERCEPTUAL_MODEL_SLGAIN_SHIFT       (8)//(4)

const int32_t c_aiBandwidthAdjust48[MAX_BANDS_48] = {
    0,0,0,0,0,0,0,0,0,0,0,64,64,64,64,64,
    101,101,128,165,165,180,213,};

const int32_t c_aiAbsoluteThresh48[MAX_BANDS_48] = {
    -1787,-1787,-1787,-1787,-1787,-1787,-1787,-1787,-1782,-1761,-1737,-1679,-1638,-1613,-1590,-1568,
    -1516,-1459,-1395,-1289,-671,-409,-401,};


#if PERCEPTUAL_MODEL_SLGAIN_SHIFT == 4
const int32_t c_aiDefaultTheta48[MAX_BANDS_48] = {
    7,7,6,5,5,4,4,4,4,4,4,4,4,4,4,4,
    4,4,4,4,4,4,4,
};
#elif PERCEPTUAL_MODEL_SLGAIN_SHIFT == 8
const int32_t c_aiDefaultTheta48[MAX_BANDS_48] = {
    112,112,96,80,80,64,64,64,64,64,64,64,64,64,64,64,
    64,64,64,64,64,64,64,
};
#endif
 
const int32_t c_aaiSpreadFunction48[MAX_BANDS_48*MAX_BANDS_48] = {
    0,-1561,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,
    -2552,-2552,-2552,-2552,-2552,-2552,-2552,-289,-4,-1234,-2295,-2552,-2552,-2552,-2552,-2552,
    -2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-569,-229,
    -8,-905,-1705,-2324,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,
    -2552,-2552,-2552,-2552,-2552,-789,-445,-173,-16,-656,-1271,-1765,-2172,-2520,-2552,-2552,
    -2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-961,-616,-340,-136,
    -28,-488,-976,-1382,-1729,-2032,-2305,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,
    -2552,-2552,-2552,-1088,-743,-465,-257,-148,-31,-371,-769,-1114,-1417,-1689,-2054,-2483,
    -2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-1198,-852,-574,-364,-209,-148,
    -42,-300,-635,-936,-1207,-1572,-2000,-2376,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,
    -2552,-1293,-948,-669,-458,-301,-183,-145,-56,-258,-547,-816,-1179,-1606,-1982,-2311,
    -2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-1375,-1029,-750,-539,-381,-260,-180,-142,
    -68,-231,-487,-846,-1272,-1647,-1976,-2261,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-1444,
    -1099,-820,-608,-449,-328,-233,-194,-138,-77,-213,-555,-978,-1352,-1681,-1966,-2268,
    -2552,-2552,-2552,-2552,-2552,-2552,-1501,-1155,-876,-665,-505,-383,-287,-210,-193,-130,
    -79,-298,-711,-1083,-1411,-1696,-1997,-2288,-2550,-2552,-2552,-2552,-2552,-1567,-1221,-942,
    -730,-570,-448,-351,-272,-206,-189,-151,-72,-349,-713,-1039,-1324,-1625,-1915,-2177,
    -2448,-2552,-2552,-2552,-1650,-1304,-1025,-813,-653,-530,-432,-352,-285,-227,-177,-163,
    -69,-297,-613,-895,-1195,-1485,-1746,-2017,-2238,-2401,-2545,-1727,-1381,-1102,-890,-730,
    -607,-509,-428,-360,-301,-249,-180,-153,-72,-257,-527,-824,-1112,-1373,-1643,-1865,
    -2028,-2171,-1798,-1452,-1173,-960,-800,-677,-579,-498,-430,-370,-317,-246,-192,-145,
    -76,-224,-505,-790,-1050,-1320,-1540,-1703,-1847,-1860,-1514,-1234,-1022,-862,-738,-640,
    -559,-490,-430,-377,-306,-224,-197,-136,-81,-242,-515,-771,-1040,-1260,-1422,-1566,
    -1923,-1577,-1297,-1085,-925,-801,-703,-621,-553,-492,-439,-367,-284,-213,-198,-144,
    -83,-235,-479,-744,-963,-1125,-1268,-1986,-1640,-1360,-1148,-988,-864,-766,-684,-615,
    -555,-501,-429,-345,-273,-211,-204,-146,-89,-216,-465,-680,-841,-984,-2043,-1697,
    -1417,-1205,-1044,-921,-822,-741,-672,-611,-557,-485,-401,-328,-264,-211,-205,-140,
    -93,-227,-430,-588,-729,-2104,-1758,-1479,-1266,-1106,-982,-884,-802,-733,-673,-619,
    -546,-461,-388,-324,-269,-212,-211,-151,-100,-195,-336,-472,-2163,-1817,-1537,-1324,
    -1164,-1040,-942,-860,-791,-731,-676,-604,-519,-445,-380,-325,-268,-226,-219,-147,
    -114,-167,-280,-2203,-1857,-1577,-1365,-1205,-1081,-982,-901,-831,-771,-717,-644,-559,
    -485,-420,-364,-306,-252,-239,-206,-132,-122,-163,-2224,-1878,-1598,-1386,-1225,-1102,
    -1003,-921,-852,-792,-737,-665,-580,-505,-441,-385,-326,-271,-222,-224,-176,-121,-114,
};


/* clang-format on */


void PerceptualModel( const int32_t iMaxQuantBands,
                      const int32_t *piRMSEnvelope,
                      int32_t *piExcitation,
Loading