Commit 92ef3139 authored by Mohammadreza Naghibzadeh's avatar Mohammadreza Naghibzadeh
Browse files

Add one bit of headroom in e_fx calculation in FdCng_encodeSID_ivas_fx()

parent 8d974424
Loading
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -81,6 +81,7 @@

#define FIX_1979_SAT_MISSING_IN_LSF_ENC                      /* VA: Proposal to fix 1979, saturation in lsf_enc, NOkia to review */
#define FIX_1946_CRASH_JBM_PROCESSING                        /* FhG: Increased guard bits of DFT_fx */
#define FIX_1980_CRASH_FDCNG_ENCODESID                       /* FhG: Add one bit of headroom in e_fx calculation in FdCng_encodeSID_ivas_fx() */
/* #################### Start BASOP porting switches ############################ */

#define NONBE_1244_FIX_SWB_BWE_MEMORY                   /* VA: issue 1244: fix to SWB BWE memory in case of switching from FB coding - pending a review by Huawei */
+10 −3
Original line number Diff line number Diff line
@@ -2469,7 +2469,11 @@ void FdCng_encodeSID_ivas_fx(
            v_fx[i] = Mpy_32_32( 671088640 /*10 in Q26*/, BASOP_Util_Log10( E_fx[i], hFdCngEnc->msNoiseEst_fx_exp ) ); // Q20 = 26+25-31
            move32();
        }
#ifdef FIX_1980_CRASH_FDCNG_ENCODESID
        e_fx = L_add( e_fx, L_shr( v_fx[i], 1 ) ); // Q19, add one bit headroom
#else
        e_fx = L_add( e_fx, v_fx[i] );    // Q20
#endif
    }

    /* Normalize MSVQ input */
@@ -2538,8 +2542,11 @@ void FdCng_encodeSID_ivas_fx(
    {
        gain_fx = L_add( gain_fx, v_fx[i] ); // Q = 31 - v_e
    }

#ifdef FIX_1980_CRASH_FDCNG_ENCODESID
    e_fx = L_shl( e_fx, sub( 12, v_e ) ); // Q = 31 - v_e
#else
    e_fx = L_shl( e_fx, sub( 11, v_e ) ); // Q = 31 - v_e
#endif
    gain_fx = Mpy_32_16_1( L_sub( e_fx, gain_fx ), div_s( 1, N ) ); // Q = 31 - v_e
    gain_fx = L_shl( gain_fx, sub( v_e, 8 ) );                      // Q23