Commit 545f05d1 authored by vaclav's avatar vaclav
Browse files

Merge branch '1936-ref-PortFlpMr2133' into 'ivas-float-update'

[non-BE][split-non-be] porting MR2133 from float to FLP-ref

See merge request !2133
parents 957cd45f 369b1a0c
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -222,6 +222,8 @@
#define NONBE_1118_EVS_LR_HQ_BITERROR                   /* VA: issue 1118: fix EVS decoder crash in LR-HQ in case of bit errors */
#define FIX_1139_REV_COLORATION_SHORT_T60               /* Nokia,FhG: Fix issue 1139, prevent sound coloration artefacts at very low reverberation times */

#define NONBE_1328_FIX_NON_LINEARITY                    /* VA: Fix possible issue when computing bwe_exc_extended and previous frame were almost 0  */

/* #################### End BASOP porting switches ############################ */

/* clang-format on */
+4 −0
Original line number Diff line number Diff line
@@ -2638,6 +2638,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
@@ -1442,7 +1442,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