Commit 67c66d50 authored by malenov's avatar malenov
Browse files

prevent division by extremely low energy value in SWB TBE

parent 494a317a
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -179,6 +179,7 @@
#define NONBE_FIX_1128_OSBA_EXT_OUTPUT_ORDER                  /* FhG: issue 1128: set output ambisonics order to input order for EXT output */
#define NONBE_FIX_1052_SBA_EXT_FIX                            /* VA: SBA external output support fix - do not overwrite "output_config" parameter */
#define NONBE_FIX_1130_DIV_ZERO_LEV_DUR                       /* VA: issue 1130: avoid div by zero in L-D by thresholding R[0] to a min value of 100.0 */
#define NONBE_FIX_1132_THRESHOLD_POW_IN_SWB_TBE               /* VA: issue 1132: prevent division by extremely low energy value in SWB TBE */

/* ##################### End NON-BE switches ########################### */

+10 −1
Original line number Diff line number Diff line
@@ -1059,6 +1059,7 @@ void swb_tbe_dec(
        }

        mvr2r( shaped_shb_excitationTemp, &shaped_shb_excitation[L_SHB_LAHEAD], L_FRAME16k );

        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 );

@@ -1067,6 +1068,14 @@ void swb_tbe_dec(
            curr_pow *= 0.25;
        }

#ifdef NONBE_FIX_1132_THRESHOLD_POW_IN_SWB_TBE
        if ( st->element_mode > EVS_MONO )
        {
            /* prevent too low values of energy */
            prev_pow += 1.0f;
            curr_pow += 1.0f;
        }
#endif
        if ( prev_pow == 0 ) 
        {
            scale = 0;