Commit 4045a199 authored by Tapani Pihlajakuja's avatar Tapani Pihlajakuja
Browse files

Fix BASOP issue 2442: float counterpart changes to match BASOP algorithm change.

parent 0688c396
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -182,6 +182,7 @@
#define FIX_FMSW_DEC_2                                  /* float issue 1575: fix crash for format switching when bitsream starts with EVS */
#define FIX_1548_HARMONIZE_NON_DIEGETIC_PANNING_LAW     /* Orange: float issue 1548: Harmonize non diegetic panning law in ISM and renderers */
#define FIX_FLOAT_1578_OMASA_REND_SPIKES                /* Nokia: Float issue 1578: Fix spikes and collapsed perception in OMASA/MASA rendering to FOA/HOA */
#define FIX_BASOP_2442_MASA2TC_TO_MONO_AND_AMBI         /* Nokia: BASOP issue 2442: Aligns float with identical diffuse gain limitation to minimize diff */

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

+17 −1
Original line number Diff line number Diff line
@@ -56,6 +56,10 @@
#define DIRAC_AVG_LENGTH_SYNTH_MS_FAST 10
#define DIRAC_ALPHA_MAX_FAST           0.12f
#define DIRECTION_SMOOTHNESS_ALPHA     0.01f
#ifdef FIX_BASOP_2442_MASA2TC_TO_MONO_AND_AMBI
#define DIRAC_SMALL_DIFF_POW_LIM       65536.0f
#define DIRAC_SMALL_DIFF_POW_MAX_GAIN  2.0f
#endif


/*-------------------------------------------------------------------------
@@ -1250,6 +1254,9 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls(
    float *alpha_synthesis_fast;
    int16_t alphaMaxBin;
    int16_t alphaMaxBinFast;
#ifdef FIX_BASOP_2442_MASA2TC_TO_MONO_AND_AMBI
    float diff_gain_limit;
#endif

    push_wmops( "dirac_out_synth_sfr" );

@@ -1434,17 +1441,26 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls(
            /*diffuse*/
            *p_power_diff_smooth_prev = g1 * ( *p_power_smooth_diff++ ) + g2 * ( *p_power_diff_smooth_prev ) + EPSILON;
            *( p_cy_auto_diff_smooth_prev ) = g1 * ( *( p_cy_auto_diff_smooth++ ) ) + g2 * ( *( p_cy_auto_diff_smooth_prev ) );

#ifdef FIX_BASOP_2442_MASA2TC_TO_MONO_AND_AMBI
            diff_gain_limit = *p_power_diff_smooth_prev < DIRAC_SMALL_DIFF_POW_LIM ? DIRAC_SMALL_DIFF_POW_MAX_GAIN : DIRAC_GAIN_LIMIT;
#endif
            *( p_gains_diff ) = sqrtf( *( p_cy_auto_diff_smooth_prev++ ) / ( *( p_power_diff_smooth_prev++ ) ) );

            if ( *( p_gains_diff ) < 0.f )
            {
                *( p_gains_diff ) = 0.f;
            }
#ifdef FIX_BASOP_2442_MASA2TC_TO_MONO_AND_AMBI
            else if ( *( p_gains_diff ) > diff_gain_limit )
            {
                *( p_gains_diff ) = diff_gain_limit;
            }
#else
            else if ( *( p_gains_diff ) > DIRAC_GAIN_LIMIT )
            {
                *( p_gains_diff ) = DIRAC_GAIN_LIMIT;
            }
#endif
            p_gains_diff++;
        }