Commit 2afc0761 authored by vaclav's avatar vaclav
Browse files

accept REMOVE_EVS_DUPLICATES

parent 291c48d3
Loading
Loading
Loading
Loading
+0 −3
Original line number Diff line number Diff line
@@ -139,9 +139,6 @@
    <ClCompile Include="..\lib_dec\ACcontextMapping_dec_fx.c">
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="..\lib_dec\acelp_core_dec_fx.c">
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="..\lib_dec\acelp_core_dec_ivas_fx.c" />
    <ClCompile Include="..\lib_dec\acelp_core_switch_dec_fx.c" />
    <ClCompile Include="..\lib_dec\amr_wb_dec_fx.c" />
+0 −3
Original line number Diff line number Diff line
@@ -119,9 +119,6 @@
    <ClCompile Include="..\lib_dec\ACcontextMapping_dec_fx.c">
      <Filter>decoder_all_c</Filter>
    </ClCompile>
    <ClCompile Include="..\lib_dec\acelp_core_dec_fx.c">
      <Filter>decoder_all_c</Filter>
    </ClCompile>
    <ClCompile Include="..\lib_dec\acelp_core_dec_ivas_fx.c">
      <Filter>decoder_all_c</Filter>
    </ClCompile>
+13 −1300

File changed.

Preview size limit exceeded, changes collapsed.

+4 −130
Original line number Diff line number Diff line
@@ -33,132 +33,12 @@
/*------------------------------------------------------------------------*/
/* OUTPUT ARGUMENTS :													  */
/*------------------------------------------------------------------------*/

/*------------------------------------------------------------------------*/
/* RETURN ARGUMENTS :													  */
/* _ None																  */
/*========================================================================*/

#ifndef REMOVE_EVS_DUPLICATES
void Inac_swtch_ematch_fx(
    Word16 exc2[],             /* i/o: CELP/GSC excitation buffer       Q_exc*/
    Word16 dct_exc_tmp[],      /* i  : GSC excitation in DCT domain          */
    Word16 lt_ener_per_band[], /* i/o: Long term energy per band        Q12  */
    const Word16 coder_type,   /* i  : Coding mode                           */
    const Word16 L_frame,      /* i  : Frame lenght                          */
    const Word32 core_brate,   /* i  : Core bit rate					     */
    const Word16 Q_exc         /* i  : input and output format of exc2       */
    ,
    const Word16 bfi /* i  : frame lost indicator                  */
    ,
    const Word16 last_core,      /* i  : Last core used                        */
    const Word16 last_codec_mode /* i  : Last codec mode                       */
)
{
    Word16 Ener_per_bd[MBANDS_GN];
    Word16 ftmp;
    Word16 *pt_exc;
    Word16 j, i;

    Word16 exp, frac;
    Word32 L_tmp;

    /*--------------------------------------------------------------------------
     * average energy per band
     *--------------------------------------------------------------------------*/

    test();
    test();
    test();
    test();
    test();
    test();
    IF( EQ_16( coder_type, AUDIO ) && bfi == 0 )
    {
        Ener_per_band_comp_fx( dct_exc_tmp, Ener_per_bd, Q_exc, MBANDS_GN, 1 );

        /* reset long-term energy per band */
        FOR( i = 0; i < MBANDS_GN; i++ )
        {
            lt_ener_per_band[i] = Ener_per_bd[i];
            move16();
        }
    }
    ELSE IF( EQ_16( coder_type, VOICED ) || EQ_16( coder_type, GENERIC ) || EQ_16( coder_type, TRANSITION ) || ( last_core != ACELP_CORE ) || NE_16( last_codec_mode, MODE1 ) )
    {
        /* Find spectrum and energy per band for GC and VC frames */
        edct_16fx( exc2, dct_exc_tmp, L_frame, 5, EVS_MONO );

        Ener_per_band_comp_fx( dct_exc_tmp, Ener_per_bd, Q_exc, MBANDS_GN, 1 );

        /* reset long-term energy per band */
        FOR( i = 0; i < MBANDS_GN; i++ )
        {
            lt_ener_per_band[i] = Ener_per_bd[i];
            move16();
        }
    }
    ELSE IF( ( coder_type == INACTIVE ) && LE_32( core_brate, ACELP_24k40 ) )
    {
        /* Find spectrum and energy per band for inactive frames */
        edct_16fx( exc2, dct_exc_tmp, L_frame, 5, EVS_MONO );
        Ener_per_band_comp_fx( dct_exc_tmp, Ener_per_bd, Q_exc, MBANDS_GN, 1 );

        /* More agressive smoothing in the first 50 frames */
        pt_exc = dct_exc_tmp;
        move16();
        FOR( i = 0; i < MBANDS_GN; i++ )
        {
            /* Compute smoothing gain to apply with gain limitation */
            L_tmp = L_mult( ALPHA0_FX, lt_ener_per_band[i] ); /*Q(15+12+1)=Q(28) */
            L_tmp = L_mac( L_tmp, BETA0_FX, Ener_per_bd[i] ); /*Q28 */
            lt_ener_per_band[i] = round_fx( L_tmp );          /*Q12 */
            move16();

            ftmp = sub( lt_ener_per_band[i], Ener_per_bd[i] ); /*Q12 */

            /* ftmp = (float)pow(10, ftmp);= pow(2,3.321928*ftmp);*/

            L_tmp = L_mult( 27213, ftmp );        /*Q(13+12+1)=Q26 ; 27213=3.321928 in Q13 */
            L_tmp = L_shr( L_tmp, 10 );           /* From Q26 to Q16 */
            frac = L_Extract_lc( L_tmp, &exp );   /* Extract exponent of ftmp */
            ftmp = extract_l( Pow2( 14, frac ) ); /* Put 14 as exponent so that */
            /* output of Pow2() will be: */
            /* 16384 < Pow2() <= 32767 */

            exp = sub( exp, 14 );
            IF( LT_16( i, 2 ) )
            {
                FOR( j = 0; j < 8; j++ )
                {
                    L_tmp = L_mult( *pt_exc, ftmp );            /* Q_exc*Q0 -> Q(Q_exc+1) */
                    L_tmp = L_shl_sat( L_tmp, add( exp, 15 ) ); /* Q(Q_exc+1) -> Q(16+Q_exc)*/
                    *pt_exc = round_fx_sat( L_tmp );
                    move16();
                    pt_exc++;
                }
            }
            ELSE
            {
                FOR( j = 0; j < 16; j++ )
                {
                    L_tmp = L_mult( *pt_exc, ftmp );            /* Q_exc*Q0 -> Q(Q_exc+1) */
                    L_tmp = L_shl_sat( L_tmp, add( exp, 15 ) ); /* Q(Q_exc+1) -> Q(16+Q_exc)*/
                    *pt_exc = round_fx_sat( L_tmp );            /*Q_exc*/
                    move16();
                    pt_exc++;
                }
            }
        }

        /* Going back to time */
        edct_16fx( dct_exc_tmp, exc2, L_frame, 5, EVS_MONO );
    }

    return;
}
#endif
void Inac_switch_ematch_ivas_fx(
void Inac_switch_ematch_fx(
    Word16 exc2[],                         /* i/o: CELP/GSC excitation buffer       Q_exc*/
    Word16 dct_exc_tmp[],                  /* i  : GSC excitation in DCT domain          */
    Word16 lt_ener_per_band[],             /* i/o: Long term energy per band        Q12  */
@@ -251,7 +131,6 @@ void Inac_switch_ematch_ivas_fx(
            exp = sub( exp, 14 );
            IF( LT_16( i, 2 ) )
            {
#ifdef REMOVE_EVS_DUPLICATES
                IF( EQ_16( element_mode, EVS_MONO ) )
                {
                    FOR( j = 0; j < 8; j++ )
@@ -264,7 +143,6 @@ void Inac_switch_ematch_ivas_fx(
                    }
                }
                ELSE
#endif
                {
                    FOR( j = 0; j < 8; j++ )
                    {
@@ -278,7 +156,6 @@ void Inac_switch_ematch_ivas_fx(
            }
            ELSE
            {
#ifdef REMOVE_EVS_DUPLICATES
                IF( EQ_16( element_mode, EVS_MONO ) )
                {
                    FOR( j = 0; j < 16; j++ )
@@ -291,7 +168,6 @@ void Inac_switch_ematch_ivas_fx(
                    }
                }
                ELSE
#endif
                {
                    FOR( j = 0; j < 16; j++ )
                    {
@@ -306,9 +182,7 @@ void Inac_switch_ematch_ivas_fx(
        }

        /* Going back to time */
#ifdef REMOVE_EVS_DUPLICATES
        IF( GT_16( element_mode, EVS_MONO ) )
#endif
        {
            Scale_sig( dct_exc_tmp, 240, 1 ); // Q_exc
            Scale_sig( exc2, 240, 1 );        // Q_exc
+1 −9
Original line number Diff line number Diff line
@@ -1332,8 +1332,6 @@ void highband_exc_dct_in_ivas_fx(
        }
    }


#ifdef REMOVE_EVS_DUPLICATES
    IF( EQ_16( element_mode, EVS_MONO ) )
    {
        Comp_and_apply_gain_fx( exc_diffQ, Ener_per_bd_iQ, Ener_per_bd_yQ, last_bin, 0, Qexc_diffQ, *Q_exc );
@@ -1346,7 +1344,6 @@ void highband_exc_dct_in_ivas_fx(
    }
    ELSE
    {
#endif
        Word16 Q_tmp = *Q_exc;
        move16();
        Word16 Q_old = *Q_exc;
@@ -1373,9 +1370,7 @@ void highband_exc_dct_in_ivas_fx(
        {
            Scale_sig( exc_dct_in, L_frame, sub( *Q_exc, Q_old ) );
        }
#ifdef REMOVE_EVS_DUPLICATES
    }
#endif

    /*--------------------------------------------------------------------------------------*
     * add the correction layer to the LF bins,
@@ -1416,12 +1411,9 @@ void highband_exc_dct_in_ivas_fx(
            Q_hb_exc = 0;
            move16();
            envelop_modify_fx( exc_diffQ, seed_tcx, last_bin, Ener_per_bd_iQ, *Q_exc, &Q_hb_exc );
#ifdef REMOVE_EVS_DUPLICATES

            test();
            IF( GT_16( *Q_exc, Q_hb_exc ) && GT_16( element_mode, EVS_MONO ) )
#else
            IF( GT_16( *Q_exc, Q_hb_exc ) )
#endif
            {
                Scale_sig( exc_wo_nf, L_frame, sub( Q_hb_exc, *Q_exc ) );
                *Q_exc = Q_hb_exc;
Loading