Commit ba0ed74f authored by norvell's avatar norvell
Browse files

Merge branch 'main' into ci/mld-jobs-with-level-scaling

parents bd8bc747 f9bb27c1
Loading
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -253,10 +253,12 @@
    <ClCompile Include="..\lib_com\ivas_rom_com.c" />
    <ClCompile Include="..\lib_com\ivas_rom_com_fx.c" />
    <ClCompile Include="..\lib_com\ivas_sba_config.c" />
    <ClCompile Include="..\lib_com\ivas_sns_com_fx.c" />
    <ClCompile Include="..\lib_com\ivas_spar_com.c" />
    <ClCompile Include="..\lib_com\ivas_spar_com_quant_util.c" />
    <ClCompile Include="..\lib_com\ivas_stereo_dft_com.c" />
    <ClCompile Include="..\lib_com\ivas_stereo_eclvq_com.c" />
    <ClCompile Include="..\lib_com\ivas_stereo_eclvq_com_fx.c" />
    <ClCompile Include="..\lib_com\ivas_stereo_ica_com.c" />
    <ClCompile Include="..\lib_com\ivas_stereo_mdct_bands_com.c" />
    <ClCompile Include="..\lib_com\ivas_stereo_mdct_stereo_com.c" />
+43 −0
Original line number Diff line number Diff line
@@ -720,6 +720,49 @@
    <ClCompile Include="..\lib_com\math_op.c" />
    <ClCompile Include="..\lib_com\bits_alloc_fx.c" />
    <ClCompile Include="..\lib_com\hq_conf_fx.c" />
    <ClCompile Include="..\lib_com\ivas_stereo_eclvq_com_fx.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>
    <ClCompile Include="..\lib_com\lsp_conv_poly_fx.c">
      <Filter>common_all_c</Filter>
    </ClCompile>
    <ClCompile Include="..\lib_com\tns_base_flt.c">
      <Filter>common_all_c</Filter>
    </ClCompile>
    <ClCompile Include="..\lib_com\tns_base.c">
      <Filter>common_all_c</Filter>
    </ClCompile>
    <ClCompile Include="..\lib_com\codec_tcx_common_flt.c">
      <Filter>common_all_c</Filter>
    </ClCompile>
    <ClCompile Include="..\lib_com\codec_tcx_common.c">
      <Filter>common_all_c</Filter>
    </ClCompile>
    <ClCompile Include="..\lib_com\ivas_sns_com_fx.c">
      <Filter>common_ivas_c</Filter>
    </ClCompile>
  </ItemGroup>
  <ItemGroup>
    <ClInclude Include="..\lib_com\basop32.h" />
+1 −1
Original line number Diff line number Diff line
@@ -175,7 +175,7 @@ int main(
    {
      run_fft_unit_test();
      run_mdct_unit_test();
      return;
      return 0;
    }

    if ( !parseCmdlIVAS_dec( (int16_t) argc, argv, &arg ) )
+178 −0
Original line number Diff line number Diff line
@@ -4,7 +4,9 @@

#include <stdint.h>
#include <assert.h>
#include <math.h>
#include "options.h"
#include "prot.h"
#include "prot_fx2.h"
#include "prot_fx1.h"
#include "basop_util.h"
@@ -215,6 +217,182 @@ void tcxFormantEnhancement(

}

void tcxFormantEnhancement_with_shift(
    Word16 xn_buf[],
    Word16 *xn_buf_e_out,
    const Word16 gainlpc[],
    const Word16 gainlpc_e[],
    Word32 spectrum[],
    Word16 *spectrum_e,
    const Word16 L_frame,
    const Word16 L_frameTCX )
{
    Word16 i, j, k, l, n;
    Word16 fac, fac0, fac1, fac_e, d, tmp;
    Word16 xn_buf_e, xn_one, m, e;
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
    Flag Overflow = 0;
#endif

    k = shr( L_frame, 6 ); /* FDNS_NPTS = 64 */
    l = 0;
    move16();

    /* get exponent */
    xn_buf_e = 0;
    move16();
    FOR( i = 0; i < FDNS_NPTS; i++ )
    {
        xn_buf_e = s_max( xn_buf_e, gainlpc_e[i] );
    }
    xn_buf_e = shr( add( xn_buf_e, 1 ), 1 );    /* max exponent after sqrt */
    xn_one = shr( 0x4000, sub( xn_buf_e, 1 ) ); /* 1.0 scaled to xn_buf_e */

    /* Formant enhancement via square root of the LPC gains */
    e = gainlpc_e[0];
    move16();
    m = Sqrt16( gainlpc[0], &e );
    xn_buf[0] = shl( m, sub( e, xn_buf_e ) );
    move16();

    e = gainlpc_e[1];
    move16();
    m = Sqrt16( gainlpc[1], &e );
    xn_buf[1] = shl( m, sub( e, xn_buf_e ) );
    move16();

    fac0 = s_min( xn_buf[0], xn_buf[1] );
    fac_e = xn_buf_e;
    move16();
    fac0 = Inv16( fac0, &fac_e );

    FOR( i = 1; i < FDNS_NPTS - 1; i++ )
    {
        e = gainlpc_e[i + 1];
        move16();
        m = Sqrt16( gainlpc[i + 1], &e );
        xn_buf[i + 1] = shl( m, sub( e, xn_buf_e ) );
        move16();

        test();
        IF( ( LE_16( xn_buf[i - 1], xn_buf[i] ) ) && ( LE_16( xn_buf[i + 1], xn_buf[i] ) ) )
        {
            m = s_max( xn_buf[i - 1], xn_buf[i + 1] );
            e = xn_buf_e;
            move16();
            m = Inv16( m, &e );

            fac1 = m;
            move16();
            tmp = sub( e, fac_e );

            IF( GT_16( tmp, 0 ) )
            {
                fac0 = shr( fac0, tmp );
            }
            IF ( LT_16( tmp, 0 ) )
            {
                fac1 = shl( fac1, tmp );
            }

            IF ( GT_16( tmp, 0 ) )
            {
                fac_e = e;
                move16();
            }

            d = sub( fac1, fac0 );
            n = sub( i, l );
            assert( n <= 64 );

            xn_buf[l] = xn_one;
            move16();
            FOR( j = 1; j < n; j++ )
            {
                fac = add( fac0, mult( d, extract_l( L_mult0( j, inv_int[n] ) ) ) );
                BASOP_SATURATE_WARNING_OFF_EVS;
#ifdef BASOP_NOGLOB
                xn_buf[l + j] = s_min( xn_one, shl_o( mult( xn_buf[l + j], fac ), fac_e, &Overflow ) );
#else
                xn_buf[l + j] = s_min( xn_one, shl( mult( xn_buf[l + j], fac ), fac_e ) );
#endif
                move16();
                BASOP_SATURATE_WARNING_ON_EVS;
            }

            l = i;
            move16();

            fac0 = m;
            move16();
            fac_e = e;
            move16();
        }
    }
    /* i = FDNS_NPTS - 1; Completing changes to gains */
    m = s_min( xn_buf[i - 1], xn_buf[i] );
    e = xn_buf_e;
    move16();
    m = Inv16( m, &e );

    fac1 = m;
    move16();
    tmp = sub( e, fac_e );

    if ( tmp > 0 )
        fac0 = shr( fac0, tmp );
    if ( tmp < 0 )
        fac1 = shl( fac1, tmp );

    if ( tmp > 0 )
    {
        fac_e = e;
        move16();
    }

    d = sub( fac1, fac0 );
    n = sub( i, l );
    assert( n <= 64 );

    xn_buf[l] = xn_one;
    move16();
    FOR( j = 1; j < n; j++ )
    {
        fac = add( fac0, mult( d, extract_l( L_mult0( j, inv_int[n] ) ) ) );
        BASOP_SATURATE_WARNING_OFF_EVS;
        xn_buf[l + j] = s_min( xn_one, shl( mult( xn_buf[l + j], fac ), fac_e ) );
        move16();
        BASOP_SATURATE_WARNING_ON_EVS;
    }

    xn_buf[i] = xn_one;
    move16();

    /* Application of changed gains onto decoded MDCT lines */
    FOR( i = 0; i < L_frame; i += k )
    {
        FOR( l = 0; l < k; l++ )
        {
            *spectrum = Mpy_32_16_1( *spectrum, *xn_buf );
            move32();
            spectrum++;
        }
        xn_buf++;
    }

    tmp = sub( L_frameTCX, L_frame );
    FOR( i = 0; i < tmp; i++ )
    {
        spectrum[i] = L_shr( spectrum[i], xn_buf_e );
        move32();
    }
    *spectrum_e = add( *spectrum_e, xn_buf_e );
    move16();

    *xn_buf_e_out = xn_buf_e;
    move16();
}

void tcxInvertWindowGrouping(
	TCX_CONFIG_HANDLE hTcxCfg, /* i  : configuration of TCX               */
	Word32 xn_buf[],
+2 −2
Original line number Diff line number Diff line
@@ -37,7 +37,7 @@
#include <stdint.h>
#include "options.h"
#include <assert.h>
#include "prot.h"
#include "prot_fx2.h"
#include "ivas_cnst.h"
#include "wmc_auto.h"
#include "basop_util.h"
@@ -1030,7 +1030,7 @@ static void fft30_with_cmplx_data(cmplx * inp)
}

/*-------------------------------------------------------------------*
 * fft_cldfb()
 * fft_cldfb_fx()
 *
 * Interface functions FFT subroutines
 *--------------------------------------------------------------------*/
Loading