Commit 60690748 authored by vaclav's avatar vaclav
Browse files

Merge branch '1328-issue-when-computing-bwe_exc_extended' into 'main'

Fix issue when computing bwe_exc_extended [non-BE][split-non-be]

See merge request !2133
parents 8740438c 2f2ab800
Loading
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -179,6 +179,7 @@
#define NONBE_1122_KEEP_EVS_MODE_UNCHANGED              /* FhG: Disables fix for issue 1122 in EVS mode to keep BE tests green. This switch should be removed once the 1122 fix is added to EVS via a CR.  */
#define	NONBE_SVD_OPTIMIZATION

#define NONBE_1328_FIX_NON_LINEARITY                    /* VA: Fix possible issue when computing bwe_exc_extended and previous frame were almost 0  */
/* ##################### End NON-BE switches ########################### */

/* ################## End DEVELOPMENT switches ######################### */
+4 −0
Original line number Diff line number Diff line
@@ -2653,6 +2653,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
);

void interp_code_5over2(
+27 −3
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;
@@ -1365,7 +1369,9 @@ void non_linearity(
    int16_t en_abs = 0;
    float v_fac = 0, ths;
    int16_t nframes;

#ifdef NONBE_1328_FIX_NON_LINEARITY
    float sc_factor;
#endif
    if ( L_frame == L_FRAME16k )
    {
        nframes = 5;
@@ -1410,8 +1416,17 @@ void non_linearity(
        scale = 0.67f;
    }


#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 )
#endif
    {
        scale_step = 1.0;
        *prev_scale = scale;
@@ -1468,8 +1483,17 @@ void non_linearity(
        scale = 0.67f;
    }


#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 )
#endif
    {
        scale_step = 1.0;
        *prev_scale = scale;
+6 −1
Original line number Diff line number Diff line
@@ -1414,7 +1414,12 @@ 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 );
Loading