Commit 9a72bbcd authored by Tapani Pihlajakuja's avatar Tapani Pihlajakuja
Browse files

Merge branch 'basop-2442-masa-2tc-rendering-to-mono-large-diff-signal-12-khz' into 'main'

[non-be][rend-non-be][split-non-be] Match algorithm for BASOP MR 3028

See merge request !2636
parents a694b700 cb2a3e7a
Loading
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -172,6 +172,7 @@

#define FIX_1576_LCLD_CRASH_DIFFERENT_CODEC_ISAR_FRAME_SIZE  /* Dolby: float issue 1576: fix for crash in LCLD mode when codec frame size is less than isar frame size */
#define FIX_2585_BIT_ALLOCATION_DIFF                    /* VA : issue 2585, bit allocation different behaviors between float and fixed-point for corner cases */
#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++;
        }