Commit da5e41e6 authored by Sandesh Venkatesh's avatar Sandesh Venkatesh
Browse files

Merge branch '3gpp_issue_1752_fix' into 'main'

Fix for 3GPP issue 1752: Renderer crash for MC in META input in ivas_mcmasa_param_est_ana_fx

See merge request !1807
parents f42d6ee1 66084229
Loading
Loading
Loading
Loading
+25 −16
Original line number Diff line number Diff line
@@ -952,7 +952,7 @@ void ivas_mcmasa_param_est_ana_fx(
                temp2 = L_add( temp2, EPSILON_FX );
                lsEnergyRelation_fx = BASOP_Util_Divide3232_Scale( temp1, temp2, &lsEnergyRelation_e );
                lsEnergyRelation_e = add( lsEnergyRelation_e, sub( temp1_e, temp2_e ) );
                lsEnergyRelation_fx = L_shl( lsEnergyRelation_fx, add( 16, lsEnergyRelation_e ) ); // Q31
                lsEnergyRelation_fx = L_shl_sat( lsEnergyRelation_fx, add( 16, lsEnergyRelation_e ) ); // Q31
                stereoness_fx = Mult_32_32( stereoCoh_fx, lsEnergyRelation_fx );
                stereoness_e = stereoCoh_e;
                move16();
@@ -1105,12 +1105,12 @@ void ivas_mcmasa_param_est_ana_fx(
                lsEnergySum_fx = L_add_sat( lsEnergySum_fx, EPSILON_FX );
                lsEnergyRelation_fx = BASOP_Util_Divide3232_Scale( temp1, lsEnergySum_fx, &lsEnergyRelation_e );
                lsEnergyRelation_e = add( lsEnergyRelation_e, sub( temp1_e, lsEnergySum_e ) );
                lsEnergyRelation_fx = L_shl( lsEnergyRelation_fx, add( 16, lsEnergyRelation_e ) );                               // Q31
                lsEnergyRelation_fx = L_shl_sat( lsEnergyRelation_fx, add( 16, lsEnergyRelation_e ) );                           // Q31
                stereoRatio_fx = L_sub( Mult_32_32( L_shl_sat( stereoCoh_fx, stereoCoh_e ), lsEnergyRelation_fx ), surrCoh_fx ); // Q31

                temp2 = L_sub( temp2, EPSILON_FX );
                lsEnergyRelation_fx = BASOP_Util_Divide3232_Scale( temp2, lsEnergySum_fx, &lsEnergyRelation_e );
                lsEnergyRelation_e = add( lsEnergyRelation_e, sub( temp2_e, lsEnergySum_e ) );
                lsEnergyRelation_fx = L_shl( lsEnergyRelation_fx, add( 16, lsEnergyRelation_e ) );     // Q31
                lsEnergyRelation_fx = L_shl_sat( lsEnergyRelation_fx, add( 16, lsEnergyRelation_e ) ); // Q31
                cohPanRatio_fx = L_sub( Mult_32_32( cohPanCoh_fx, lsEnergyRelation_fx ), surrCoh_fx ); // Q31

                IF( GT_32( stereoRatio_fx, cohPanRatio_fx ) )
@@ -1436,6 +1436,8 @@ static void computeVerticalDiffuseness_fx(
    {
        Word16 tmp_e1, tmp_e2;
        tmp = BASOP_Util_Divide3232_Scale( intensity_slow_abs[i], L_add( energy_slow[i], EPSILON_FX_SMALL ), &tmp_e1 );
        IF( tmp != 0 )
        {
            tmp_e1 = add( tmp_e1, sub( intensity_slow_e[i], energy_slow_e[i] ) );
            tmp = BASOP_Util_Divide3232_Scale( L_sub( tmp, L_shr( VERTICAL_ENERGY_RATIO_OFFSET_FX, tmp_e1 ) ), L_sub( ONE_IN_Q15, VERTICAL_ENERGY_RATIO_OFFSET_FX ), &tmp_e2 ); /* Tuned to avoid effect due to ambience of vertically un-even setups */
            tmp_e2 = add( tmp_e2, tmp_e1 );
@@ -1454,6 +1456,13 @@ static void computeVerticalDiffuseness_fx(
            {
                tmp = L_shl( tmp, add( 16, tmp_e2 ) ); // Q31
            }
        }
        ELSE
        {
            tmp = ONE_IN_Q31; // Q31
            move32();
        }

        diffuseness[i] = tmp; // Q31
        move32();
    }