Commit c084b0b1 authored by Sandesh Venkatesh's avatar Sandesh Venkatesh
Browse files

Merge branch '3gpp_issue_790_fix' into 'main'

Fix for 3GPP issue 790

See merge request !476
parents 244a96ac ed402def
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -78,6 +78,7 @@
#define NONBE_FIX_1096_NAN_VALUES_IN_DIRAC_TO_STEREO    /* FhG: avoid sidegain DFT-Stereo param to be larger than 1 when converting from Dirac parameters */
#define NON_BE_1055_RESET_LP_MEMORIES                   /* VA: issue 1055: Correctly reset LP filter MA and AR memories in bitrate switching */
#define NON_BE_FIX_1137_GSC_IVAS_FXFLT_DECODING         /* VA: Add fix point bit allocation for special GSC mode such that float and fixed point have the same final bit allocation */
#define NONBE_FIX_1132_THRESHOLD_POW_IN_SWB_TBE         /* VA: issue 1132: prevent division by extremely low energy value in SWB TBE */

/* #################### End FIXES switches ############################ */

+18 −0
Original line number Diff line number Diff line
@@ -337,6 +337,15 @@ void wb_tbe_dec(
        prev_pow = sum2_f( shaped_wb_excitation, L_SHB_LAHEAD / 4 );
        curr_pow = sum2_f( shaped_wb_excitation + L_SHB_LAHEAD / 4, L_SHB_LAHEAD / 4 );

#ifdef NONBE_FIX_1132_THRESHOLD_POW_IN_SWB_TBE
        if ( st->element_mode > EVS_MONO )
        {
            /* prevent too low values of energy */
            prev_pow = max( 0.00001f, prev_pow );
            curr_pow = max( 0.00001f, curr_pow );
        }
#endif

        if ( voice_factors[0] > 0.75f )
        {
            curr_pow *= 0.25;
@@ -3448,6 +3457,15 @@ void swb_tbe_dec(
        prev_pow = sum2_f( shaped_shb_excitation, L_SHB_LAHEAD + 10 );
        curr_pow = sum2_f( shaped_shb_excitation + L_SHB_LAHEAD + 10, L_SHB_LAHEAD + 10 );

#ifdef NONBE_FIX_1132_THRESHOLD_POW_IN_SWB_TBE
        if ( st->element_mode > EVS_MONO )
        {
            /* prevent too low values of energy */
            prev_pow = max( 0.00001f, prev_pow );
            curr_pow = max( 0.00001f, curr_pow );
        }
#endif

        if ( voice_factors[0] > 0.75f )
        {
            curr_pow *= 0.25;
+44 −0
Original line number Diff line number Diff line
@@ -908,6 +908,17 @@ void ivas_wb_tbe_dec_fx(

        prev_pow = 0;
        move32();
#ifdef NONBE_FIX_1132_THRESHOLD_POW_IN_SWB_TBE
        IF( st_fx->element_mode > EVS_MONO )
        {
            tmp = sub( shl( sub( st_fx->prev_Q_bwe_exc, 16 ), 1 ), 31 + 16 );
#ifdef BASOP_NOGLOB
            prev_pow = L_shl_sat( 1407374848l /*0.00001f Q47*/, tmp ); /*Q(2*(st_fx->prev_Q_bwe_exc-16))*/
#else
            prev_pow = L_shl( 1407374848l /*0.00001f Q47*/, tmp ); /*Q(2*(st_fx->prev_Q_bwe_exc-16))*/
#endif
        }
#endif
        FOR( i = 0; i < L_SHB_LAHEAD / 4; i++ )
        {
            prev_pow = L_mac0( prev_pow, hBWE_TD->state_syn_shbexc_fx[i], hBWE_TD->state_syn_shbexc_fx[i] ); /*Q(2*(st_fx->prev_Q_bwe_exc-16))*/
@@ -933,6 +944,17 @@ void ivas_wb_tbe_dec_fx(

        curr_pow = 0;
        move32();
#ifdef NONBE_FIX_1132_THRESHOLD_POW_IN_SWB_TBE
        IF( st_fx->element_mode > EVS_MONO )
        {
            tmp = sub( shl( Q_bwe_exc_ext, 1 ), 31 + 16 );
#ifdef BASOP_NOGLOB
            curr_pow = L_shl_sat( 1407374848l /*0.00001f Q47*/, tmp ); /*Q(2*(Q_bwe_exc_ext))*/
#else
            curr_pow = L_shl( 1407374848l /*0.00001f Q47*/, tmp ); /* 2*(Q_bwe_exc_ext) */
#endif
        }
#endif
        FOR( i = 0; i < L_SHB_LAHEAD / 4; i++ )
        {
            curr_pow = L_mac0( curr_pow, shaped_wb_excitation[i + L_SHB_LAHEAD / 4], shaped_wb_excitation[i + L_SHB_LAHEAD / 4] ); /* Q(2*Q_bwe_exc_ext) */
@@ -1554,6 +1576,17 @@ void wb_tbe_dec_fx(

        prev_pow = 0;
        move32();
#ifdef NONBE_FIX_1132_THRESHOLD_POW_IN_SWB_TBE
        IF( st_fx->element_mode > EVS_MONO )
        {
            tmp = sub( shl( sub( st_fx->prev_Q_bwe_exc, 16 ), 1 ), 31 + 16 );
#ifdef BASOP_NOGLOB
            prev_pow = L_shl_sat( 1407374848l /*0.00001f Q47*/, tmp ); /*Q(2*(st_fx->prev_Q_bwe_exc-16))*/
#else
            prev_pow = L_shl( 1407374848l /*0.00001f Q47*/, tmp ); /*Q(2*(st_fx->prev_Q_bwe_exc-16))*/
#endif
        }
#endif
        FOR( i = 0; i < L_SHB_LAHEAD / 4; i++ )
        {
#ifdef BASOP_NOGLOB
@@ -1588,6 +1621,17 @@ void wb_tbe_dec_fx(

        curr_pow = 0;
        move32();
#ifdef NONBE_FIX_1132_THRESHOLD_POW_IN_SWB_TBE
        IF( st_fx->element_mode > EVS_MONO )
        {
            tmp = sub( shl( Q_bwe_exc_ext, 1 ), 31 + 16 );
#ifdef BASOP_NOGLOB
            curr_pow = L_shl_sat( 1407374848l /*0.00001f Q47*/, tmp ); /*Q(2*(Q_bwe_exc_ext))*/
#else
            curr_pow = L_shl( 1407374848l /*0.00001f Q47*/, tmp ); /* 2*(Q_bwe_exc_ext) */
#endif
        }
#endif
        FOR( i = 0; i < L_SHB_LAHEAD / 4; i++ )
        {
#ifdef BASOP_NOGLOB
+18 −0
Original line number Diff line number Diff line
@@ -373,6 +373,15 @@ void wb_tbe_enc(
    prev_pow = sum2_f( shaped_wb_excitation, L_SHB_LAHEAD / 4 );
    curr_pow = sum2_f( shaped_wb_excitation + L_SHB_LAHEAD / 4, L_SHB_LAHEAD / 4 );

#ifdef NONBE_FIX_1132_THRESHOLD_POW_IN_SWB_TBE
    if ( st->element_mode > EVS_MONO )
    {
        /* prevent too low values of energy */
        prev_pow = max( 0.00001f, prev_pow );
        curr_pow = max( 0.00001f, curr_pow );
    }
#endif

    if ( voice_factors[0] > 0.75f )
    {
        curr_pow = (float) ( curr_pow * 0.25 );
@@ -1050,6 +1059,15 @@ void swb_tbe_enc(
        prev_pow = sum2_f( shaped_shb_excitation, L_SHB_LAHEAD + 10 );
        curr_pow = sum2_f( shaped_shb_excitation + L_SHB_LAHEAD + 10, L_SHB_LAHEAD + 10 );

#ifdef NONBE_FIX_1132_THRESHOLD_POW_IN_SWB_TBE
        if ( st->element_mode > EVS_MONO )
        {
            /* prevent too low values of energy */
            prev_pow = max( 0.00001f, prev_pow );
            curr_pow = max( 0.00001f, curr_pow );
        }
#endif

        if ( voice_factors[0] > 0.75f )
        {
            curr_pow = (float) ( curr_pow * 0.25 );
+23 −1
Original line number Diff line number Diff line
@@ -843,7 +843,18 @@ void wb_tbe_enc_fx(
    }

    prev_pow = 0;
    move16();
    move32();
#ifdef NONBE_FIX_1132_THRESHOLD_POW_IN_SWB_TBE
    IF( st_fx->element_mode > EVS_MONO )
    {
        tmp = sub( shl( sub( st_fx->prev_Q_bwe_exc, 16 ), 1 ), 31 + 16 );
#ifdef BASOP_NOGLOB
        prev_pow = L_shl_sat( 1407374848l /*0.00001f Q47*/, tmp ); /*Q(2*(st_fx->prev_Q_bwe_exc-16))*/
#else
        prev_pow = L_shl( 1407374848l /*0.00001f Q47*/, tmp ); /*Q(2*(st_fx->prev_Q_bwe_exc-16))*/
#endif
    }
#endif
    FOR( i = 0; i < L_SHB_LAHEAD / 4; i++ )
    {
        prev_pow = L_mac0( prev_pow, hBWE_TD->state_syn_shbexc_fx[i], hBWE_TD->state_syn_shbexc_fx[i] ); /* Q(2*st_fx->prev_Q_bwe_exc) */
@@ -871,6 +882,17 @@ void wb_tbe_enc_fx(

    curr_pow = 0;
    move16();
#ifdef NONBE_FIX_1132_THRESHOLD_POW_IN_SWB_TBE
    IF( st_fx->element_mode > EVS_MONO )
    {
        tmp = sub( shl( Q_bwe_exc_ext, 1 ), 31 + 16 );
#ifdef BASOP_NOGLOB
        curr_pow = L_shl_sat( 1407374848l /*0.00001f Q47*/, tmp ); /*Q(2*(Q_bwe_exc_ext))*/
#else
        curr_pow = L_shl( 1407374848l /*0.00001f Q47*/, tmp ); /* 2*(Q_bwe_exc_ext) */
#endif
    }
#endif
    FOR( i = 0; i < L_SHB_LAHEAD / 4; i++ )
    {
        curr_pow = L_mac0( curr_pow, shaped_wb_excitation[i + L_SHB_LAHEAD / 4], shaped_wb_excitation[i + L_SHB_LAHEAD / 4] ); /* Q(2*Q_bwe_exc_ext) */