Commit c8103a53 authored by Mohammadreza Naghibzadeh's avatar Mohammadreza Naghibzadeh
Browse files

Replace L_shl with L_shl_sat to clamp small rounding error that push value...

Replace L_shl with L_shl_sat to clamp small rounding error that push value above 1.0 in PsychAdaptLowFreqDeemph()
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_1984_CRASH_ENC_ISM4                              /* FhG: Replace L_shl with L_shl_sat to clamp small rounding error that push value above 1.0 */
/* #################### 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 */
+5 −1
Original line number Diff line number Diff line
@@ -1446,7 +1446,11 @@ void PsychAdaptLowFreqDeemph(
        tmp_e = min_e;
        move16();
        tmp = Inv16( min, &tmp_e );                                   /*Q15 - tmp_e*/
#ifdef FIX_1984_CRASH_ENC_ISM4
        L_tmp = L_shl_sat( L_mult( tmp, max_val ), add( tmp_e, max_e ) ); /* Q31, use L_shl_sat() to clamp small error that push L_tmp above 1.0 */
#else
        L_tmp = L_shl( L_mult( tmp, max_val ), add( tmp_e, max_e ) );                     /* Q31 */
#endif
        L_tmp = BASOP_Util_Log2( L_tmp );                             /* Q25 */
        L_tmp = L_shr( L_tmp, 7 );                                    /* 0.0078125f = 1.f/(1<<7) */
        L_tmp = BASOP_Util_InvLog2( L_tmp );                          /* Q31 */