Commit befd5828 authored by Sandesh Venkatesh's avatar Sandesh Venkatesh
Browse files

Merge branch 'EVS_code_changes' into 'main'

EVS code changes pulled in

See merge request !3
parents 11d43db3 8deb1923
Loading
Loading
Loading
Loading
+22 −1
Original line number Diff line number Diff line
@@ -176,8 +176,11 @@
    <ClCompile Include="..\lib_com\guided_plc_util.c" />
    <ClCompile Include="..\lib_com\hp50.c" />
    <ClCompile Include="..\lib_com\hq2_bit_alloc.c" />
    <ClCompile Include="..\lib_com\hq2_bit_alloc_fx.c" />
    <ClCompile Include="..\lib_com\hq2_core_com.c" />
    <ClCompile Include="..\lib_com\hq2_core_com_fx.c" />
    <ClCompile Include="..\lib_com\hq2_noise_inject.c" />
    <ClCompile Include="..\lib_com\hq2_noise_inject_fx.c" />
    <ClCompile Include="..\lib_com\hq_bit_allocation.c" />
    <ClCompile Include="..\lib_com\hq_conf.c" />
    <ClCompile Include="..\lib_com\hq_tools.c" />
@@ -186,10 +189,12 @@
    <ClCompile Include="..\lib_com\ifft_rel.c" />
    <ClCompile Include="..\lib_com\igf_base.c" />
    <ClCompile Include="..\lib_com\index_pvq_opt.c" />
    <ClCompile Include="..\lib_com\index_pvq_opt_fx.c" />
    <ClCompile Include="..\lib_com\interleave_spectrum.c" />
    <ClCompile Include="..\lib_com\interpol.c" />
    <ClCompile Include="..\lib_com\int_lsp.c" />
    <ClCompile Include="..\lib_com\isf_dec_amr_wb.c" />
    <ClCompile Include="..\lib_com\isf_dec_amr_wb_fx.c" />
    <ClCompile Include="..\lib_com\ivas_agc_com.c" />
    <ClCompile Include="..\lib_com\ivas_arith.c" />
    <ClCompile Include="..\lib_com\ivas_avq_pos_reorder_com.c" />
@@ -229,6 +234,7 @@
    <ClCompile Include="..\lib_com\lag_wind.c" />
    <ClCompile Include="..\lib_com\lerp.c" />
    <ClCompile Include="..\lib_com\limit_t0.c" />
    <ClCompile Include="..\lib_com\log2.c" />
    <ClCompile Include="..\lib_com\logqnorm.c" />
    <ClCompile Include="..\lib_com\logqnorm_fx.c" />
    <ClCompile Include="..\lib_com\longarith.c" />
@@ -241,23 +247,32 @@
    <ClCompile Include="..\lib_com\lsf_tools_fx.c" />
    <ClCompile Include="..\lib_com\lsp_conv_poly.c" />
    <ClCompile Include="..\lib_com\modif_fs.c" />
    <ClCompile Include="..\lib_com\modif_fs_fx.c" />
    <ClCompile Include="..\lib_com\mslvq_com.c" />
    <ClCompile Include="..\lib_com\mslvq_com_fx.c" />
    <ClCompile Include="..\lib_com\nelp.c" />
    <ClCompile Include="..\lib_com\nelp_fx.c" />
    <ClCompile Include="..\lib_com\oper_32b.c" />
    <ClCompile Include="..\lib_com\parameter_bitmaping.c" />
    <ClCompile Include="..\lib_com\phase_dispersion.c" />
    <ClCompile Include="..\lib_com\ppp.c" />
    <ClCompile Include="..\lib_com\ppp_fx.c" />
    <ClCompile Include="..\lib_com\pred_lt4.c" />
    <ClCompile Include="..\lib_com\preemph.c" />
    <ClCompile Include="..\lib_com\preemph_fx.c" />
    <ClCompile Include="..\lib_com\pvq_com.c" />
    <ClCompile Include="..\lib_com\pvq_com_fx.c" />
    <ClCompile Include="..\lib_com\range_com.c" />
    <ClCompile Include="..\lib_com\range_com_fx.c" />
    <ClCompile Include="..\lib_com\re8_ppv.c" />
    <ClCompile Include="..\lib_com\re8_util.c" />
    <ClCompile Include="..\lib_com\realft.c" />
    <ClCompile Include="..\lib_com\recovernorm.c" />
    <ClCompile Include="..\lib_com\reordvct.c" />
    <ClCompile Include="..\lib_com\reordvct_fx.c" />
    <ClCompile Include="..\lib_com\residu.c" />
    <ClCompile Include="..\lib_com\residu_fx.c" />
    <ClCompile Include="..\lib_com\rom_basic_math.c" />
    <ClCompile Include="..\lib_com\rom_basop_util.c" />
    <ClCompile Include="..\lib_com\rom_com.c" />
    <ClCompile Include="..\lib_com\ivas_sns_com.c" />
@@ -269,9 +284,12 @@
    <ClCompile Include="..\lib_com\swb_bwe_com_fx.c" />
    <ClCompile Include="..\lib_com\swb_bwe_com_hr.c" />
    <ClCompile Include="..\lib_com\swb_bwe_com_lr.c" />
    <ClCompile Include="..\lib_com\swb_bwe_com_lr_fx.c" />
    <ClCompile Include="..\lib_com\swb_tbe_com.c" />
    <ClCompile Include="..\lib_com\swb_tbe_com_fx.c" />
    <ClCompile Include="..\lib_com\syn_12k8.c" />
    <ClCompile Include="..\lib_com\syn_filt.c" />
    <ClCompile Include="..\lib_com\syn_filt_fx.c" />
    <ClCompile Include="..\lib_com\tcq_position_arith.c" />
    <ClCompile Include="..\lib_com\tcx_ltp.c" />
    <ClCompile Include="..\lib_com\tcx_mdct.c" />
@@ -286,9 +304,11 @@
    <ClCompile Include="..\lib_com\vlpc_2st_com.c" />
    <ClCompile Include="..\lib_com\weight.c" />
    <ClCompile Include="..\lib_com\weight_a.c" />
    <ClCompile Include="..\lib_com\weight_a_fx.c" />
    <ClCompile Include="..\lib_com\wi.c" />
    <ClCompile Include="..\lib_com\window.c" />
    <ClCompile Include="..\lib_com\window_ola.c" />
    <ClCompile Include="..\lib_com\wi_fx.c" />
    <ClCompile Include="..\lib_com\wtda.c" />
  </ItemGroup>
  <ItemGroup>
@@ -310,7 +330,8 @@
    <ClInclude Include="..\lib_com\move.h" />
    <ClInclude Include="..\lib_com\options.h" />
    <ClInclude Include="..\lib_com\prot.h" />
    <ClInclude Include="..\lib_com\prot_fx_2.h" />
    <ClInclude Include="..\lib_com\prot_fx2.h" />
    <ClInclude Include="..\lib_com\prot_fx1.h" />
    <ClInclude Include="..\lib_com\rom_basop_util.h" />
    <ClInclude Include="..\lib_com\rom_com.h" />
    <ClInclude Include="..\lib_com\stat_com.h" />
+61 −4
Original line number Diff line number Diff line
@@ -518,6 +518,64 @@
    <ClCompile Include="..\lib_com\enh32.c">
      <Filter>common_all_c</Filter>
    </ClCompile>
    <ClCompile Include="..\lib_com\syn_filt_fx.c">
      <Filter>common_all_c</Filter>
    </ClCompile>
    <ClCompile Include="..\lib_com\index_pvq_opt_fx.c">
      <Filter>common_all_c</Filter>
    </ClCompile>
    <ClCompile Include="..\lib_com\swb_tbe_com_fx.c">
      <Filter>common_all_c</Filter>
    </ClCompile>
    <ClCompile Include="..\lib_com\weight_a_fx.c">
      <Filter>common_all_c</Filter>
    </ClCompile>
    <ClCompile Include="..\lib_com\residu_fx.c">
      <Filter>common_all_c</Filter>
    </ClCompile>
    <ClCompile Include="..\lib_com\modif_fs_fx.c">
      <Filter>common_all_c</Filter>
    </ClCompile>
    <ClCompile Include="..\lib_com\preemph_fx.c">
      <Filter>common_all_c</Filter>
    </ClCompile>
    <ClCompile Include="..\lib_com\pvq_com_fx.c">
      <Filter>common_all_c</Filter>
    </ClCompile>
    <ClCompile Include="..\lib_com\range_com_fx.c">
      <Filter>common_all_c</Filter>
    </ClCompile>
    <ClCompile Include="..\lib_com\wi_fx.c">
      <Filter>common_evs_c</Filter>
    </ClCompile>
    <ClCompile Include="..\lib_com\log2.c">
      <Filter>common_all_c</Filter>
    </ClCompile>
    <ClCompile Include="..\lib_com\rom_basic_math.c" />
    <ClCompile Include="..\lib_com\swb_bwe_com_lr_fx.c">
      <Filter>common_evs_c</Filter>
    </ClCompile>
    <ClCompile Include="..\lib_com\hq2_bit_alloc_fx.c">
      <Filter>common_evs_c</Filter>
    </ClCompile>
    <ClCompile Include="..\lib_com\isf_dec_amr_wb_fx.c">
      <Filter>common_evs_c</Filter>
    </ClCompile>
    <ClCompile Include="..\lib_com\nelp_fx.c">
      <Filter>common_evs_c</Filter>
    </ClCompile>
    <ClCompile Include="..\lib_com\ppp_fx.c">
      <Filter>common_evs_c</Filter>
    </ClCompile>
    <ClCompile Include="..\lib_com\hq2_core_com_fx.c">
      <Filter>common_evs_c</Filter>
    </ClCompile>
    <ClCompile Include="..\lib_com\hq2_noise_inject_fx.c">
      <Filter>common_evs_c</Filter>
    </ClCompile>
    <ClCompile Include="..\lib_com\reordvct_fx.c">
      <Filter>common_all_c</Filter>
    </ClCompile>
  </ItemGroup>
  <ItemGroup>
    <ClInclude Include="..\lib_com\basop_proto_func.h">
@@ -582,15 +640,14 @@
      <Filter>common_h</Filter>
    </ClInclude>
    <ClInclude Include="..\lib_com\common_api_types.h" />
    <ClInclude Include="..\lib_com\prot_fx_2.h">
      <Filter>common_h</Filter>
    </ClInclude>
    <ClInclude Include="..\lib_com\stat_com_fx_2.h">
      <Filter>common_h</Filter>
    </ClInclude>
    <ClInclude Include="..\lib_com\rom_basop_util.h">
      <Filter>common_h</Filter>
    </ClInclude>
    <ClInclude Include="..\lib_com\prot_fx2.h" />
    <ClInclude Include="..\lib_com\prot_fx1.h" />
  </ItemGroup>
  <ItemGroup>
    <Filter Include="common_evs_c">
+2 −91
Original line number Diff line number Diff line
@@ -40,10 +40,12 @@
#include "complex_basop.h"
#include "basop_util.h"
#include "rom_com.h"
#include "rom_basic_math.h"
#include "basop_settings.h"
#include "control.h"
#include "cnst.h"


#define WMC_TOOL_SKIP

extern const Word32 SqrtTable[32];
@@ -54,12 +56,6 @@ extern const Word16 ISqrtDiffTable[32];

extern const Word32 InvTable[32];
extern const Word16 InvDiffTable[32];
static __inline Word16 L_Extract_lc(const Word32 L_32, Word16 *p_hi)
{
  *p_hi = extract_h(L_32);
  return lshr(extract_l(L_32), 1);

}

Word32 BASOP_Util_Log2(
    Word32 x )
@@ -1740,20 +1736,6 @@ Word16 BASOP_Util_Divide3216_Scale(
}


static const Word16 table_pow2[32] = {
    16384, 16743, 17109, 17484, 17867, 18258, 18658, 19066, 19484, 19911,
    20347, 20792, 21247, 21713, 22188, 22674, 23170, 23678, 24196, 24726,
    25268, 25821, 26386, 26964, 27554, 28158, 28774, 29405, 30048, 30706,
    31379, 32066
};
/* table of table_pow2[i+1] - table_pow2[i] */
static const Word16 table_pow2_diff_x32[32] = {
    11488, 11712, 12000, 12256, 12512, 12800, 13056, 13376, 13664, 13952,
    14240, 14560, 14912, 15200, 15552, 15872, 16256, 16576, 16960, 17344,
    17696, 18080, 18496, 18880, 19328, 19712, 20192, 20576, 21056, 21536,
    21984, 22432
};

Word32 Pow2(                  /* o Q0  : result       (range: 0<=val<=0x7fffffff) */
             Word16 exponant, /* i Q0  : Integer part.      (range: 0<=val<=30)   */
             Word16 fraction  /* i Q15 : Fractional part.   (range: 0.0<=val<1.0) */
@@ -1795,45 +1777,6 @@ Word32 Pow2( /* o Q0 : result (range: 0<=val<=0x7fffffff
 *
 *************************************************************************/

static const Word32 L_table[32] = {
    -32768L, 95322112L, 187793408L, 277577728L,
    364871680L, 449740800L, 532381696L, 612859904L,
    691306496L, 767787008L, 842432512L, 915308544L,
    986546176L, 1056210944L, 1124302848L, 1190887424L,
    1256095744L, 1319993344L, 1382580224L, 1443921920L,
    1504083968L, 1563131904L, 1621000192L, 1677885440L,
    1733722112L, 1788510208L, 1842380800L, 1895399424L,
    1947435008L, 1998618624L, 2049015808L, 2098626560L
};

static const Word16 table_diff[32] = {
    1455, 1411, 1370, 1332, 1295, 1261, 1228, 1197,
    1167, 1139, 1112, 1087, 1063, 1039, 1016, 995,
    975, 955, 936, 918, 901, 883, 868, 852,
    836, 822, 809, 794, 781, 769, 757, 744
};

Word16 Log2_norm_lc(            /* o  : Fractional part of Log2. (range: 0<=val<1)  */
                     Word32 L_x /* i  : input value (normalized)                    */
)
{
    Word16 i, a;
    Word16 y;


    L_x = L_shr( L_x, 9 );
    a = extract_l( L_x ); /* Extract b10-b24 of fraction */
    a = lshr( a, 1 );

    i = mac_r( L_x, -32 * 2 - 1, 16384 ); /* Extract b25-b31 minus 32 */

    y = mac_r( L_table[i], table_diff[i], a ); /* table[i] << 16 - diff*a*2 */


    return y;
}


Word32 BASOP_Util_fPow(
    Word32 base_m,
    Word16 base_e,
@@ -2133,29 +2076,6 @@ Word32 BASOP_Util_Add_Mant32Exp /* o : normalized result mantissa */
    return ( L_tmp );
}

static const Word32 L_table_isqrt[48] = {
    2147418112L, 2083389440L, 2024669184L, 1970667520L,
    1920794624L, 1874460672L, 1831403520L, 1791098880L,
    1753415680L, 1717960704L, 1684602880L, 1653145600L,
    1623326720L, 1595080704L, 1568276480L, 1542782976L,
    1518469120L, 1495334912L, 1473183744L, 1451950080L,
    1431633920L, 1412169728L, 1393491968L, 1375469568L,
    1358168064L, 1341521920L, 1325465600L, 1309933568L,
    1294991360L, 1280507904L, 1266548736L, 1252982784L,
    1239875584L, 1227161600L, 1214775296L, 1202847744L,
    1191182336L, 1179910144L, 1168965632L, 1158283264L,
    1147863040L, 1137770496L, 1127940096L, 1118306304L,
    1108934656L, 1099825152L, 1090912256L, 1082261504L
};
/* table of table_isqrt[i] - table_isqrt[i+1] */
static const Word16 table_isqrt_diff[48] = {
    977, 896, 824, 761, 707, 657, 615, 575,
    541, 509, 480, 455, 431, 409, 389, 371,
    353, 338, 324, 310, 297, 285, 275, 264,
    254, 245, 237, 228, 221, 213, 207, 200,
    194, 189, 182, 178, 172, 167, 163, 159,
    154, 150, 147, 143, 139, 136, 132, 130
};

static const Word16 shift_lc[] = { 9, 10 };

@@ -2197,15 +2117,6 @@ Word32 Isqrt_lc1(
    return L_tmp;
}

static const Word16 sqrt_table[49] = {
    16384, 16888, 17378, 17854, 18318, 18770, 19212,
    19644, 20066, 20480, 20886, 21283, 21674, 22058,
    22435, 22806, 23170, 23530, 23884, 24232, 24576,
    24915, 25249, 25580, 25905, 26227, 26545, 26859,
    27170, 27477, 27780, 28081, 28378, 28672, 28963,
    29251, 29537, 29819, 30099, 30377, 30652, 30924,
    31194, 31462, 31727, 31991, 32252, 32511, 32767
};

/*! r: output value,                          Q31 */
Word32 Sqrt_l(
+1 −24
Original line number Diff line number Diff line
@@ -43,6 +43,7 @@
#include "typedef.h"
#include "basop32.h"
#include "math_32.h"
#include "log2.h"

#define LD_DATA_SCALE ( 6 )

@@ -695,30 +696,6 @@ Word32 Pow2( /* o : Q0 : result (range: 0<=val<=0x7ffff
             Word16 fraction  /* i  : Q15 : Fractionnal part.  (range: 0.0<=val<1.0) */
);

/*************************************************************************
 *
 *   FUNCTION:   Log2_norm()
 *
 *   PURPOSE:   Computes log2(L_x, exp),  where   L_x is positive and
 *              normalized, and exp is the normalisation exponent
 *              If L_x is negative or zero, the result is 0.
 *
 *   DESCRIPTION:
 *        The function Log2(L_x) is approximated by a table and linear
 *        interpolation. The following steps are used to compute Log2(L_x)
 *
 *           1- exponent = 30-norm_exponent
 *           2- i = bit25-b31 of L_x;  32<=i<=63  (because of normalization).
 *           3- a = bit10-b24
 *           4- i -=32
 *           5- fraction = table[i]<<16 - (table[i] - table[i+1]) * a * 2
 *
 *************************************************************************/

Word16 Log2_norm_lc(            /* o  : Fractional part of Log2. (range: 0<=val<1)  */
                     Word32 L_x /* i  : input value (normalized)                    */
);

/*************************************************************************
 *
 *   FUNCTION:   BASOP_Util_fPow()
+1 −1
Original line number Diff line number Diff line
@@ -2714,7 +2714,7 @@ void evs_dec_previewFrame_float(


void dtx_read_padding_bits(
    DEC_CORE_HANDLE_FLOAT st,
    DEC_CORE_HANDLE st,
    const int16_t num_bits )
{
    /* TODO: temporary hack, need to decide what to do with core-coder bitrate */
Loading