Commit 211eb37b authored by vaillancour's avatar vaillancour
Browse files

adding a condition to differentiate EVS and IVAS

parent 39877e6d
Loading
Loading
Loading
Loading
+16 −6
Original line number Diff line number Diff line
@@ -1353,6 +1353,10 @@ void non_linearity(
    const int16_t coder_type,     /* i  : Coder Type          */
    const float *voice_factors,   /* i  : Voice Factors       */
    const int16_t L_frame         /* i  : ACELP frame length  */
#ifdef NONBE_1328_FIX_NON_LINEARITY
    ,
    const int16_t element_mode  /* i  : element_mode to differentiate EVS and IVAS */
#endif
)
{
    int16_t i, j;
@@ -1413,9 +1417,12 @@ void non_linearity(
    }

#ifdef NONBE_1328_FIX_NON_LINEARITY
    sc_factor = 1024.0f;
    if ( element_mode > EVS_MONO )
    {
        sc_factor = (float) ( 1 << max( 13 - norm_s( j + 1 ), 0 ) ); /* Adapt the scaling factor allowed depending of max position  */
        sc_factor = max( sc_factor, 2.0f );

    }
    if ( *prev_scale <= 0.0 || *prev_scale > sc_factor * scale )
#else
    if ( *prev_scale <= 0.0 || *prev_scale > 1024.0f * scale )
@@ -1477,9 +1484,12 @@ void non_linearity(
    }

#ifdef NONBE_1328_FIX_NON_LINEARITY
    sc_factor = 1024.0f;
    if ( element_mode > EVS_MONO )
    {
        sc_factor = (float) ( 1 << max( 12 - norm_s( j - length / 2 + 1 ), 0 ) ); /* allowed intra frame jump is smaller */
        sc_factor = max( sc_factor, 2.0f );

    }
    if ( *prev_scale <= 0.0 || *prev_scale > sc_factor * scale )
#else
    if ( *prev_scale <= 0.0 || *prev_scale > 1024.0f * scale )
+5 −1
Original line number Diff line number Diff line
@@ -1414,7 +1414,11 @@ ivas_error acelp_core_dec(

        if ( !st->ppp_mode_dec && ( st->idchan == 0 || st->element_mode != IVAS_CPE_TD || ( st->idchan == 1 && st->element_mode == IVAS_CPE_TD && st->tdm_LRTD_flag ) ) )
        {
            non_linearity( bwe_exc, bwe_exc_extended, st->hBWE_TD->old_bwe_exc_extended, L_FRAME32k, &st->hBWE_TD->bwe_non_lin_prev_scale, st->coder_type, voice_factors, st->L_frame );
            non_linearity( bwe_exc, bwe_exc_extended, st->hBWE_TD->old_bwe_exc_extended, L_FRAME32k, &st->hBWE_TD->bwe_non_lin_prev_scale, st->coder_type, voice_factors, st->L_frame 
#ifdef NONBE_1328_FIX_NON_LINEARITY
                            , st->element_mode
#endif
            );
        }

        if ( st->core_brate == FRAME_NO_DATA || st->core_brate == SID_2k40 )
+6 −1
Original line number Diff line number Diff line
@@ -425,7 +425,12 @@ void dec_acelp_tcx_frame(

            if ( st->core == ACELP_CORE && st->igf && st->con_tcx == 0 )
            {
                non_linearity( ptr_bwe_exc, bwe_exc_extended, st->hBWE_TD->old_bwe_exc_extended, L_FRAME32k, &st->hBWE_TD->bwe_non_lin_prev_scale, st->coder_type, voice_factors, st->L_frame );
                non_linearity( ptr_bwe_exc, bwe_exc_extended, st->hBWE_TD->old_bwe_exc_extended, L_FRAME32k, &st->hBWE_TD->bwe_non_lin_prev_scale, st->coder_type, voice_factors, st->L_frame
#ifdef NONBE_1328_FIX_NON_LINEARITY
                               ,
                               st->element_mode
#endif
                    );

                /* update the old BWE exe memory */
                mvr2r( &old_bwe_exc[L_FRAME32k], st->hBWE_TD->old_bwe_exc, PIT16k_MAX * 2 );
+5 −1
Original line number Diff line number Diff line
@@ -695,7 +695,11 @@ ivas_error acelp_core_enc(
        if ( !st->Opt_SC_VBR && ( st->idchan == 0 || st->element_mode != IVAS_CPE_TD || ( st->idchan == 1 && st->element_mode == IVAS_CPE_TD && st->tdm_LRTD_flag ) ) )
        {
            /* Apply a non linearity to the SHB excitation */
            non_linearity( bwe_exc, bwe_exc_extended, st->hBWE_TD->old_bwe_exc_extended, L_FRAME32k, &st->hBWE_TD->bwe_non_lin_prev_scale, st->coder_type, voice_factors, st->L_frame );
            non_linearity( bwe_exc, bwe_exc_extended, st->hBWE_TD->old_bwe_exc_extended, L_FRAME32k, &st->hBWE_TD->bwe_non_lin_prev_scale, st->coder_type, voice_factors, st->L_frame
#ifdef NONBE_1328_FIX_NON_LINEARITY
                           , st->element_mode
#endif
            );
        }

        if ( st->core_brate == SID_2k40 || st->core_brate == FRAME_NO_DATA )
+5 −1
Original line number Diff line number Diff line
@@ -99,7 +99,11 @@ void enc_acelp_tcx_main(
        /* Apply non linearity to the SHB excitation */
        if ( st->core == ACELP_CORE && st->igf )
        {
            non_linearity( ptr_bwe_exc, bwe_exc_extended, st->hBWE_TD->old_bwe_exc_extended, L_FRAME32k, &st->hBWE_TD->bwe_non_lin_prev_scale, st->coder_type, voice_factors, st->L_frame );
            non_linearity( ptr_bwe_exc, bwe_exc_extended, st->hBWE_TD->old_bwe_exc_extended, L_FRAME32k, &st->hBWE_TD->bwe_non_lin_prev_scale, st->coder_type, voice_factors, st->L_frame
#ifdef NONBE_1328_FIX_NON_LINEARITY
                           , st->element_mode
#endif
            );

            /* update the old_BWE_exc memory */
            mvr2r( &old_bwe_exc[L_FRAME32k], st->hBWE_TD->old_bwe_exc, PIT16k_MAX * 2 );