Commit 3ababc80 authored by multrus's avatar multrus
Browse files

use saturating operator to avoid assert() at overflow

parent 9b730aed
Loading
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -92,6 +92,7 @@
#define FIX_1995_REVERB_INIT                                 /* VA/Nokia: issue 1995: Fix use-of-uninitialized-value in ivas_binaural_reverb_init() */
#define FIX_1996_MASKING_NOISE                               /* Dlb: Heavy precision loss in ola buffers causing discontinuity*/
#define FIX1998_APA_EXEC_SCALING                             /* FhG: fix scaling of apa_exec_ivas_fx(); avoid continuously worse scaling with previous data */
#define FIX2007_BASSPSFILTER_OVERFLOW                        /* FhG: use saturing operator, to avoid overflow in bass_psfilter_fx() */

/* #################### Start BASOP porting switches ############################ */

+4 −0
Original line number Diff line number Diff line
@@ -555,7 +555,11 @@ void bass_psfilter_fx(
            FOR( i = 0; i < subfr_len; i++ )
            {
                /* err[i] = syn_fx[i] - gain*syn2_fx[i] */
#ifdef FIX2007_BASSPSFILTER_OVERFLOW
                err[i] = msu_r( L_shr_sat( L_mult0( gain, syn2_fx[i] ), exp2 ), syn_fx[i], 16384 ); /* Q15 */
#else
                err[i] = msu_r( L_shr( L_mult0( gain, syn2_fx[i] ), exp2 ), syn_fx[i], 16384 ); /* Q15 */
#endif
                move16();
                /* the sign is inverted but it is not important because
                we calculate energy with 'err[i]' x 'err[i]'