Commit 15fc6418 authored by vaillancour's avatar vaillancour
Browse files

proposed fix for 2584

parent 06686cc2
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -133,7 +133,7 @@
#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_1521_SBA_LOUDNESS_STEREO                    /* FhG: issue 1521: Fix loudness for SBA to stereo rendering */
#define FIX_1559                                        /* Eri/FhG: fix for Issue 1559 in FD CNG with bitrate/bw switching */

#define FIX_2584_TD_SM_ISSUE                            /* VA: Fix inconsistencies in the SM part of the TD stereo */
/* ##################### End NON-BE switches ########################### */

/* ################## End MAINTENANCE switches ######################### */
+23 −0
Original line number Diff line number Diff line
@@ -971,7 +971,11 @@ static Word16 Get_dt_lt_ener_fx(
        test();
        IF( GE_16( *tdm_hyst_cnt, 2 ) && EQ_16( tmp_SM_flag, 1 ) && ( GT_16( sts[0]->tdm_pc, PC_LIMIT ) || GT_16( sts[1]->tdm_pc, PC_LIMIT ) ) )
        {
#ifndef FIX_2584_TD_SM_ISSUE            
            tdm_hyst_cnt++;
#else            
            *tdm_hyst_cnt = add( *tdm_hyst_cnt, 1 );
#endif            
            *tdm_NOOP_SM_flag_loc = tmp_SM_flag;
            move16();
            *tdm_hyst_cnt = 0;
@@ -980,7 +984,11 @@ static Word16 Get_dt_lt_ener_fx(
        ELSE IF( GE_16( *tdm_hyst_cnt, 20 ) && tmp_SM_flag == 0 &&
                 ( GT_16( sts[0]->tdm_pc, PC_LIMIT ) || GT_16( sts[1]->tdm_pc, PC_LIMIT ) ) && ( LE_32( *tdm_LT_es_em, ONE_IN_Q20 /* 0.5f in Q21 */ ) || LT_32( es_em_fx, -20971520 /* -10.0f in Q21 */ ) ) )
        {
#ifndef FIX_2584_TD_SM_ISSUE            
            tdm_hyst_cnt++;
#else            
            *tdm_hyst_cnt = add( *tdm_hyst_cnt, 1 );
#endif            
            *tdm_NOOP_SM_flag_loc = tmp_SM_flag;
            move16();
            *tdm_hyst_cnt = 0;
@@ -1573,14 +1581,24 @@ static Word16 stereo_tdm_ener_analysis_SM_fx(
    test();
    test();
    test();
#ifndef FIX_2584_TD_SM_ISSUE  
    IF( ( LE_32( L_shl( hStereoTD->tdm_lt_rms_L_SM_fx, Q20 - Q24 ), RMS_MIN_FX_Q20 ) && LE_32( L_shl( hStereoTD->tdm_lt_rms_R_SM_fx, Q19 /* adjusted for 2 in RHS */ - Q24 ), RMS_MIN_FX_Q20 ) ) ||
        ( LE_32( L_shl( hStereoTD->tdm_lt_rms_R_SM_fx, Q20 - Q24 ), RMS_MIN_FX_Q20 ) && LE_32( L_shl( hStereoTD->tdm_lt_rms_L_SM_fx, Q19 /* adjusted for 2 in RHS */ - Q24 ), RMS_MIN_FX_Q20 ) ) ) /* Q20 */
#else
    IF( ( LE_32( L_shl( hStereoTD->tdm_lt_rms_L_SM_fx, Q20 - Q16 ), RMS_MIN_FX_Q20 ) && LE_32( L_shl( hStereoTD->tdm_lt_rms_R_SM_fx, Q19 /* adjusted for 2 in RHS */ - Q16 ), RMS_MIN_FX_Q20 ) ) ||
        ( LE_32( L_shl( hStereoTD->tdm_lt_rms_R_SM_fx, Q20 - Q16 ), RMS_MIN_FX_Q20 ) && LE_32( L_shl( hStereoTD->tdm_lt_rms_L_SM_fx, Q19 /* adjusted for 2 in RHS */ - Q16 ), RMS_MIN_FX_Q20 ) ) ) /* Q20 */
#endif        
    {
        test();
        test();
        test();
#ifndef FIX_2584_TD_SM_ISSUE            
        IF( ( LT_16( sts[0]->old_corr_fx, CORR_THRES_FX_Q15 ) && LT_16( sts[1]->old_corr_fx, CORR_THRES_FX_Q15 ) ) ||
            ( LE_32( L_shl( hStereoTD->tdm_lt_rms_L_SM_fx, Q21 - Q24 ), RMS_MIN2_FX_Q21 ) && LE_32( L_shl( hStereoTD->tdm_lt_rms_R_SM_fx, Q21 - Q24 ), RMS_MIN2_FX_Q21 ) ) )
#else
        IF( ( LT_16( sts[0]->old_corr_fx, CORR_THRES_FX_Q15 ) && LT_16( sts[1]->old_corr_fx, CORR_THRES_FX_Q15 ) ) ||
            ( LE_32( L_shl( hStereoTD->tdm_lt_rms_L_SM_fx, Q21 - Q16 ), RMS_MIN2_FX_Q21 ) && LE_32( L_shl( hStereoTD->tdm_lt_rms_R_SM_fx, Q21 - Q16 ), RMS_MIN2_FX_Q21 ) ) )
#endif            
        {
            side_can_change = 1;
            move16();
@@ -1590,8 +1608,13 @@ static Word16 stereo_tdm_ener_analysis_SM_fx(
    test();
    test();
    test();
#ifndef FIX_2584_TD_SM_ISSUE 
    IF( ( LE_32( L_shl( hStereoTD->tdm_lt_rms_L_SM_fx, Q21 - Q24 ), RMS_MIN2_FX_Q21 ) && LE_32( L_shl( hStereoTD->tdm_lt_rms_R_SM_fx, Q20 /* adjusted for 2 in RHS */ - Q24 ), RMS_MIN2_FX_Q21 ) ) ||
        ( LE_32( L_shl( hStereoTD->tdm_lt_rms_R_SM_fx, Q21 - Q24 ), RMS_MIN2_FX_Q21 ) && LE_32( L_shl( hStereoTD->tdm_lt_rms_L_SM_fx, Q20 /* adjusted for 2 in RHS */ - Q24 ), RMS_MIN2_FX_Q21 ) ) ) /* Q21 */
#else
    IF( ( LE_32( L_shl( hStereoTD->tdm_lt_rms_L_SM_fx, Q21 - Q16 ), RMS_MIN2_FX_Q21 ) && LE_32( L_shl( hStereoTD->tdm_lt_rms_R_SM_fx, Q20 /* adjusted for 2 in RHS */ - Q16 ), RMS_MIN2_FX_Q21 ) ) ||
        ( LE_32( L_shl( hStereoTD->tdm_lt_rms_R_SM_fx, Q21 - Q16 ), RMS_MIN2_FX_Q21 ) && LE_32( L_shl( hStereoTD->tdm_lt_rms_L_SM_fx, Q20 /* adjusted for 2 in RHS */ - Q16 ), RMS_MIN2_FX_Q21 ) ) ) /* Q21 */
#endif        
    {
        test();
        test();