diff --git a/lib_com/options.h b/lib_com/options.h index ea5fad27e23e96688cce2aedff3efa67053b5b3c..7a6d1adad0509d9dcb606402a32e2ce7cc2939a1 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -81,6 +81,7 @@ #define FIX_2141_ASSERT_IN_OMASA_BITRATE_SWITSCHING /* FhG: Replace L_shl with L_shl_sat to prevent overflow when calculating scale factors for very small numbers in the logarithmic domain */ #define FIX_APA_EXECS_SCALING /* VA: fix scaling of JBM APA buffer */ #define FIX_2164_ASSERT_IN_OMASA_PREPROC_FOR_EDIT /* Nokia: Issue 2164: Prevent overflow when calculating equalization coefficient for editing before clamping to safe range */ +#define FIX_BASOP_ASSERT_IN_TONAL_MDCT_PLC /* FhG: fix for issue 2165 - using saturating addition in tonal MDCT PLC function */ /* ################### End FIXES switches ########################### */ diff --git a/lib_dec/TonalComponentDetection_fx.c b/lib_dec/TonalComponentDetection_fx.c index 409b975f5c18312785f64650e5bfda0631cb6d75..bfb0b0428e6dd9b3d5413d014e0c7b08dea19ae4 100644 --- a/lib_dec/TonalComponentDetection_fx.c +++ b/lib_dec/TonalComponentDetection_fx.c @@ -454,7 +454,11 @@ static void getEnvelope( FOR( i = 0; i < n2; i++ ) { +#ifdef FIX_BASOP_ASSERT_IN_TONAL_MDCT_PLC + sum = L_add_sat( sum, powerSpec[i] ); /*powerSpec_exp*/ +#else sum = L_add( sum, powerSpec[i] ); /*powerSpec_exp*/ +#endif } /* No need for PTR_INIT for powerSpec[i+n2] as we continue from the previous loop */ FOR( i = 0; i < n1; i++ )