Commit 7a730c21 authored by Sandesh Venkatesh's avatar Sandesh Venkatesh
Browse files

ivas_mcmasa_enc_fx bug fixes

parent 355a9b30
Loading
Loading
Loading
Loading
Loading
+14 −10
Original line number Diff line number Diff line
@@ -713,7 +713,7 @@ void ivas_mcmasa_enc_fx(
    /* Determine LFE-to-total energy ratio */
    FOR( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ )
    {
        hMasa->data.lfeToTotalEnergyRatio_fx[i] = BASOP_Util_Divide3232_Scale( hMcMasa->lfeLfEne[i], L_add( EPSILON_FX, hMcMasa->totalLfEne[i] ), &hMasa->data.lfeToTotalEnergyRatio_e[i] );
        hMasa->data.lfeToTotalEnergyRatio_fx[i] = L_deposit_h( BASOP_Util_Divide3232_Scale( hMcMasa->lfeLfEne[i], L_add( EPSILON_FX, hMcMasa->totalLfEne[i] ), &hMasa->data.lfeToTotalEnergyRatio_e[i] ) );
        hMasa->data.lfeToTotalEnergyRatio_e[i] = add( sub( hMcMasa->lfeLfEne_e[i], hMcMasa->totalLfEne_e[i] ), hMasa->data.lfeToTotalEnergyRatio_e[i] );
        move32();
        move16();
@@ -1220,8 +1220,12 @@ void ivas_mcmasa_param_est_enc_fx(
            hMcMasa->buffer_energy_q[index - 1] = sub( Q31, ref_e );
            move16();

            computeDiffuseness_mdft_fx( hMcMasa->buffer_intensity_real_fx, hMcMasa->buffer_energy_fx, num_freq_bands, hMcMasa->no_col_avg_diff, diffuseness_vector_fx, hMcMasa->buffer_intensity_real_q, hMcMasa->buffer_energy_q, out_exp );

            computeDiffuseness_mdft_fx( hMcMasa->buffer_intensity_real_fx, hMcMasa->buffer_energy_fx, num_freq_bands, hMcMasa->no_col_avg_diff, diffuseness_vector_fx, hMcMasa->buffer_intensity_real_q, hMcMasa->buffer_energy_q, &out_exp[0] );
            FOR( i = 1; i < num_freq_bands; i++ )
            {
                out_exp[i] = out_exp[0];
                move16();
            }
            /* Compute vertical diffuseness, and tune original diffuseness if needed */
            IF( !hMcMasa->isHorizontalSetup )
            {
@@ -1243,9 +1247,9 @@ void ivas_mcmasa_param_est_enc_fx(
                move32();
                IF( hMcMasa->combineRatios )
                {
                    diffuseness_m_fx[0][band_m_idx] = BASOP_Util_Add_Mant32Exp( diffuseness_m_fx[0][band_m_idx], diffuseness_e[0][band_m_idx], Mult_32_32( reference_power_fx[ts][band_m_idx], diffuseness_vector_fx[band_m_idx] ), sub( 31, sub( shl( inp_q, 1 ), 31 ) ), &diffuseness_e[0][band_m_idx] );
                    diffuseness_m_fx[0][band_m_idx] = BASOP_Util_Add_Mant32Exp( diffuseness_m_fx[0][band_m_idx], diffuseness_e[0][band_m_idx], Mult_32_32( reference_power_fx[ts][band_m_idx], diffuseness_vector_fx[band_m_idx] ), ref_e, &diffuseness_e[0][band_m_idx] );
                    move32();
                    renormalization_factor_diff_fx[band_m_idx] = BASOP_Util_Add_Mant32Exp( renormalization_factor_diff_fx[band_m_idx], renormalization_factor_diff_e[band_m_idx], reference_power_fx[ts][band_m_idx], sub( 31, sub( shl( inp_q, 1 ), 31 ) ), &renormalization_factor_diff_e[band_m_idx] );
                    renormalization_factor_diff_fx[band_m_idx] = BASOP_Util_Add_Mant32Exp( renormalization_factor_diff_fx[band_m_idx], renormalization_factor_diff_e[band_m_idx], reference_power_fx[ts][band_m_idx], ref_e, &renormalization_factor_diff_e[band_m_idx] );
                    move32();
                }
                ELSE
@@ -1458,11 +1462,11 @@ void ivas_mcmasa_param_est_enc_fx(
                    cohPanCoh_e = tempCoh2_e;
                    move16();
                }
                IF( GT_32( cohPanCoh_fx, ONE_IN_Q30 ) )
                /* IF( GT_32( cohPanCoh_fx, ONE_IN_Q30 ) )
                 {
                     cohPanCoh_fx = ONE_IN_Q30;
                     move32();
                }
                 }*/
                cohPanCoh_fx = L_shl_sat( cohPanCoh_fx, cohPanCoh_e ); /*Q31*/
                cohPanCoh_e = 0;
                move16();