Commit c03667b7 authored by multrus's avatar multrus
Browse files

[cleanup] accept OPT_MCH_DEC_V1_NBE

parent 4124906b
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -77,7 +77,6 @@
/* Note: each compile switch (FIX_1101_...) is independent from the other ones */
#define OPT_MCT_ENC_V3_BE
#define OPT_BIN_REND_V2_NBE
#define OPT_MCH_DEC_V1_NBE
#define OPT_MASA_DEC_V1_NBE
#define OPT_MASA_DEC_V2_NBE
#define OPT_MCT_ENC_48KB_NBE
+0 −36
Original line number Diff line number Diff line
@@ -886,11 +886,7 @@ Word16 computeMixingMatrices_fx(
    move16();
    FOR( i = 1; i < lengthCx; i++ )
    {
#ifdef OPT_MCH_DEC_V1_NBE
        IF( GT_32( svd_s_buffer_fx[i], L_shl_sat( limit_fx, sub( limit_e, svd_s_buffer_e[i] ) ) ) )
#else  /* OPT_MCH_DEC_V1_NBE */
        IF( BASOP_Util_Cmp_Mant32Exp( svd_s_buffer_fx[i], svd_s_buffer_e[i], limit_fx, limit_e ) > 0 )
#endif /* OPT_MCH_DEC_V1_NBE */
        {
            limit_fx = svd_s_buffer_fx[i];
            move32();
@@ -910,11 +906,7 @@ Word16 computeMixingMatrices_fx(

    FOR( i = 0; i < lengthCx; ++i )
    {
#ifdef OPT_MCH_DEC_V1_NBE
        IF( LT_32( L_shl_sat( svd_s_buffer_fx[i], sub( svd_s_buffer_e[i], limit_e ) ), limit_fx ) )
#else  /* OPT_MCH_DEC_V1_NBE */
        IF( BASOP_Util_Cmp_Mant32Exp( svd_s_buffer_fx[i], svd_s_buffer_e[i], limit_fx, limit_e ) < 0 )
#endif /* OPT_MCH_DEC_V1_NBE */
        {
            svd_s_buffer_fx[i] = limit_fx;
            move32();
@@ -959,16 +951,10 @@ Word16 computeMixingMatrices_fx(
    matrix_product_diag_fx( Q_Cx_fx, Q_Cx_e, lengthCy, lengthCx, 0, Q_fx, Q_e, lengthCy, lengthCx, 1, Cy_hat_diag_fx, &Cy_hat_diag_e );


#ifdef OPT_MCH_DEC_V1_NBE
    Word16 com_e = sub( limit_e, Cy_hat_diag_e );
#endif /* OPT_MCH_DEC_V1_NBE */
    FOR( i = 0; i < lengthCy; ++i )
    {
#ifdef OPT_MCH_DEC_V1_NBE
        IF( GT_32( Cy_hat_diag_fx[i], L_shl_sat( limit_fx, com_e ) ) )
#else  /* OPT_MCH_DEC_V1_NBE */
        IF( BASOP_Util_Cmp_Mant32Exp( Cy_hat_diag_fx[i], Cy_hat_diag_e, limit_fx, limit_e ) > 0 )
#endif /* OPT_MCH_DEC_V1_NBE */
        {
            limit_fx = Cy_hat_diag_fx[i];
            move32();
@@ -984,19 +970,13 @@ Word16 computeMixingMatrices_fx(
#endif                                                          /* OPT_MCH_DEC_V1_BE */
    limit_e = add( limit_e, reg_ghat_e );

#ifdef OPT_MCH_DEC_V1_NBE
    com_e = sub( Cy_hat_diag_e, limit_e );
#endif /* OPT_MCH_DEC_V1_NBE */
    FOR( i = 0; i < lengthCy; ++i )
    {
        Cy_hat_diag_buff_e[i] = Cy_hat_diag_e;
        move16();

#ifdef OPT_MCH_DEC_V1_NBE
        IF( GT_32( limit_fx, L_shl_sat( Cy_hat_diag_fx[i], com_e ) ) )
#else  /* OPT_MCH_DEC_V1_NBE */
        IF( BASOP_Util_Cmp_Mant32Exp( limit_fx, limit_e, Cy_hat_diag_fx[i], Cy_hat_diag_buff_e[i] ) > 0 ) /* Computing Cy_hat_diag = max(Cy_hat_diag,limit) */
#endif /* OPT_MCH_DEC_V1_NBE */
        {
            Cy_hat_diag_fx[i] = limit_fx;
            move32();
@@ -1416,11 +1396,7 @@ Word16 computeMixingMatricesResidual_fx(

    FOR( i = 0; i < lengthCx; ++i )
    {
#ifdef OPT_MCH_DEC_V1_NBE
        IF( GT_32( Kx_fx[i], L_shl_sat( limit_fx, sub( limit_e, Kx_fx_e[i] ) ) ) )
#else  /* OPT_MCH_DEC_V1_NBE */
        IF( BASOP_Util_Cmp_Mant32Exp( Kx_fx[i], Kx_fx_e[i], limit_fx, limit_e ) > 0 )
#endif /* OPT_MCH_DEC_V1_NBE */
        {
            div_tmp = Kx_fx[i];
            move32();
@@ -1461,16 +1437,10 @@ Word16 computeMixingMatricesResidual_fx(
    Cy_hat_diag_e = Cx_e;
    move16();

#ifdef OPT_MCH_DEC_V1_NBE
    Word16 com_e = sub( limit_e, Cy_hat_diag_e );
#endif /* OPT_MCH_DEC_V1_NBE */
    FOR( i = 0; i < lengthCy; ++i )
    {
#ifdef OPT_MCH_DEC_V1_NBE
        IF( GT_32( Cy_hat_diag_fx[i], L_shl_sat( limit_fx, com_e ) ) )
#else  /* OPT_MCH_DEC_V1_NBE */
        IF( BASOP_Util_Cmp_Mant32Exp( Cy_hat_diag_fx[i], Cy_hat_diag_e, limit_fx, limit_e ) > 0 )
#endif /* OPT_MCH_DEC_V1_NBE */
        {
            limit_fx = Cy_hat_diag_fx[i];
            move32();
@@ -1489,18 +1459,12 @@ Word16 computeMixingMatricesResidual_fx(

    /* Computing G_hat */

#ifdef OPT_MCH_DEC_V1_NBE
    com_e = sub( Cy_hat_diag_e, limit_e );
#endif /* OPT_MCH_DEC_V1_NBE */
    FOR( i = 0; i < lengthCy; ++i )
    {
        Cy_hat_diag_fx_e[i] = Cy_hat_diag_e;
        move16();
#ifdef OPT_MCH_DEC_V1_NBE
        IF( GT_32( limit_fx, L_shl_sat( Cy_hat_diag_fx[i], com_e ) ) ) /* Computing Cy_hat_diag = max(Cy_hat_diag,limit) */
#else                                                                  /* OPT_MCH_DEC_V1_NBE */
        IF( BASOP_Util_Cmp_Mant32Exp( limit_fx, limit_e, Cy_hat_diag_fx[i], Cy_hat_diag_e ) > 0 ) /* Computing Cy_hat_diag = max(Cy_hat_diag,limit) */
#endif                                                                 /* OPT_MCH_DEC_V1_NBE */
        {
            Cy_hat_diag_fx[i] = limit_fx;
            move32();
+0 −66
Original line number Diff line number Diff line
@@ -322,11 +322,7 @@ Word16 svd_fx(
        move16();
        FOR( iCh = 0; iCh < lengthSingularValues - 1; iCh++ )
        {
#ifdef OPT_MCH_DEC_V1_NBE
            IF( LT_32( L_shl_sat( singularValues_fx[iCh], sub( singularValues_fx_e[iCh], singularValues_fx_e[iCh + 1] ) ), singularValues_fx[iCh + 1] ) )
#else  /* OPT_MCH_DEC_V1_NBE */
            IF( BASOP_Util_Cmp_Mant32Exp( singularValues_fx[iCh], singularValues_fx_e[iCh], singularValues_fx[iCh + 1], singularValues_fx_e[iCh + 1] ) < 0 )
#endif /* OPT_MCH_DEC_V1_NBE */
            {
                condition = 1;
                move16();
@@ -431,24 +427,15 @@ static Word16 BidagonalDiagonalisation_fx(

            FOR( jCh = iCh; jCh >= 0; jCh-- )
            {
#ifdef OPT_MCH_DEC_V1_NBE
                Word16 com_e = s_max( secDiag_new_e[jCh], eps_x_e );
                IF( LE_32( L_shr( L_abs( secDiag_fx[jCh] ), sub( com_e, secDiag_new_e[jCh] ) ), L_shr( Mpy_32_32( CONVERGENCE_FACTOR_FX, eps_x ), sub( com_e, eps_x_e ) ) ) ) /* is secDiag[ch] vanishing compared to eps_x */
#else
                split = sub( jCh, 1 ); /* Q0 */                                                                                                                                  /* OPT_MCH_DEC_V1_NBE */
                IF( LE_16( BASOP_Util_Cmp_Mant32Exp( L_abs( secDiag_fx[jCh] ), secDiag_new_e[jCh], Mpy_32_32( CONVERGENCE_FACTOR_FX, eps_x ), eps_x_e ), 0 ) )                   /* is secDiag[ch] vanishing compared to eps_x */
#endif /* OPT_MCH_DEC_V1_NBE */
                {
                    found_split = 0;
                    move16();
                    BREAK;
                }
#ifdef OPT_MCH_DEC_V1_NBE
                com_e = s_max( singularValues_new_e[jCh - 1], eps_x_e );
                IF( LE_32( L_shr( L_abs( singularValues_fx[jCh - 1] ), sub( com_e, singularValues_new_e[jCh - 1] ) ), L_shr( Mpy_32_32( CONVERGENCE_FACTOR_FX, eps_x ), sub( com_e, eps_x_e ) ) ) ) /* is singularValues[jCh - 1] vanishing compared to eps_x */
#else                                                                                                                                                                                               /* OPT_MCH_DEC_V1_NBE */
                IF( LE_16( BASOP_Util_Cmp_Mant32Exp( L_abs( singularValues_fx[split] ), singularValues_new_e[split], Mpy_32_32( CONVERGENCE_FACTOR_FX, eps_x ), eps_x_e ), 0 ) ) /* is singularValues[split] vanishing compared to eps_x */
#endif                                                                                                                                                                                              /* OPT_MCH_DEC_V1_NBE */
                {
                    BREAK;
                }
@@ -476,21 +463,15 @@ static Word16 BidagonalDiagonalisation_fx(
                move32();
                c_e = 0;
                move16();
#ifdef OPT_MCH_DEC_V1_NBE
                split = sub( jCh, 1 ); /* Q0 */
#endif                                 /* OPT_MCH_DEC_V1_NBE */
                FOR( kCh = jCh; kCh <= iCh; kCh++ )
                {
                    g = Mpy_32_32( s, secDiag_fx[kCh] ); /* exp(s_e + secDiag_new_e) */
                    g_e = add( s_e, secDiag_new_e[kCh] );
                    secDiag_fx[kCh] = Mpy_32_32( c, secDiag_fx[kCh] ); /* exp(c_e + secDiag_new_e) */
                    secDiag_new_e[kCh] = add( c_e, secDiag_new_e[kCh] );
#ifdef OPT_MCH_DEC_V1_NBE
                    Word16 com_e = s_max( g_e, eps_x_e );
                    IF( LE_32( L_shr( L_abs( g ), sub( com_e, g_e ) ), L_shr( Mpy_32_32( CONVERGENCE_FACTOR_FX, eps_x ), sub( com_e, eps_x_e ) ) ) )
#else  /* OPT_MCH_DEC_V1_NBE */
                    IF( LE_16( BASOP_Util_Cmp_Mant32Exp( L_abs( g ), g_e, Mpy_32_32( CONVERGENCE_FACTOR_FX, eps_x ), eps_x_e ), 0 ) )                                            /* is singularValues[split] vanishing compared to eps_x */
#endif /* OPT_MCH_DEC_V1_NBE */
                    {
                        BREAK;
                    }
@@ -950,15 +931,9 @@ static void biDiagonalReductionLeft_fx(
            Word16 invVal_e;
            Word32 invVal;
            invVal = BASOP_Util_Divide3232_Scale_newton( MAXVAL_WORD32, maxWithSign_fx( *sig_x ), &invVal_e );
#ifdef OPT_MCH_DEC_V1_NBE
            Word64 temp = 0;
            move64();
            Word16 max_e = MIN_16;
#else  /* OPT_MCH_DEC_V1_NBE */
            norm_x = 0;
            move32();
            norm_x_e = 0;
#endif /* OPT_MCH_DEC_V1_NBE */
            move16();
            FOR( jCh = idx; jCh < nChannelsL; jCh++ ) /* nChannelsL */
            {
@@ -967,14 +942,9 @@ static void biDiagonalReductionLeft_fx(
                move32();
                singularVectors2_e[jCh][currChannel] = sub( add( invVal_e, sub( singularVectors2_e[jCh][currChannel], *sig_x_e ) ), temp_e );
                move16();
#ifdef OPT_MCH_DEC_V1_NBE
                max_e = s_max( max_e, singularVectors2_e[jCh][currChannel] );
#else  /* OPT_MCH_DEC_V1_NBE */
                norm_x = BASOP_Util_Add_Mant32Exp( norm_x, norm_x_e, Mpy_32_32( singularVectors[jCh][currChannel], singularVectors[jCh][currChannel] ), shl( singularVectors2_e[jCh][currChannel], 1 ), &norm_x_e ); /* exp(norm_x_e) */
#endif /* OPT_MCH_DEC_V1_NBE */
            }

#ifdef OPT_MCH_DEC_V1_NBE
            FOR( jCh = idx; jCh < nChannelsL; jCh++ ) /* nChannelsL */
            {
                temp = W_add( temp, L_shr( Mpy_32_32( singularVectors[jCh][currChannel], singularVectors[jCh][currChannel] ), shl( sub( max_e, singularVectors2_e[jCh][currChannel] ), 1 ) ) );
@@ -984,7 +954,6 @@ static void biDiagonalReductionLeft_fx(
            nrm = sub( nrm, 32 );
            norm_x = W_shl_sat_l( temp, nrm );
            norm_x_e = sub( add( max_e, max_e ), nrm );
#endif /* OPT_MCH_DEC_V1_NBE */

            IF( GT_16( norm_x_e, 0 ) )
            {
@@ -1013,7 +982,6 @@ static void biDiagonalReductionLeft_fx(

            FOR( iCh = currChannel + 1; iCh < nChannelsC; iCh++ ) /* nChannelsC */
            {
#ifdef OPT_MCH_DEC_V1_NBE
                Word16 max2_e = MIN_16;
                max_e = MIN_16;
                move16();
@@ -1036,16 +1004,6 @@ static void biDiagonalReductionLeft_fx(
                nrm = sub( nrm, 32 );
                norm_x = W_shl_sat_l( temp, nrm );
                norm_x_e = sub( max_e, nrm );
#else  /* OPT_MCH_DEC_V1_NBE */
                norm_x = 0;
                move32();
                norm_x_e = 0;
                move16();
                FOR( jCh = idx; jCh < nChannelsL; jCh++ ) /* nChannelsL */
                {
                    norm_x = BASOP_Util_Add_Mant32Exp( norm_x, norm_x_e, Mpy_32_32( singularVectors[jCh][currChannel], singularVectors[jCh][iCh] ), add( singularVectors2_e[jCh][currChannel], singularVectors2_e[jCh][iCh] ), &norm_x_e ); /* exp(norm_x_e) */
                }
#endif /* OPT_MCH_DEC_V1_NBE */

                f = Mpy_32_32( norm_x, invVal ); /* invVal_e + (norm_x_e - r_e) */
                f_e = add( invVal_e, sub( norm_x_e, r_e ) );
@@ -1297,16 +1255,11 @@ static void singularVectorsAccumulationLeft_fx(
                move32();
            }
        }
#ifdef OPT_MCH_DEC_V1_NBE
        Word16 exp = s_max( singularVectors_Left_e[nCh][nCh], 1 );
        singularVectors_Left[nCh][nCh] = L_sub( L_shr( singularVectors_Left[nCh][nCh], sub( exp, singularVectors_Left_e[nCh][nCh] ) ), L_shr( MINUS_ONE_IN_Q31, exp ) ); /* exp(sing_exp2) */
        move32();
        singularVectors_Left_e[nCh][nCh] = exp;
        move16();
#else  /* OPT_MCH_DEC_V1_NBE */
        singularVectors_Left[nCh][nCh] = BASOP_Util_Add_Mant32Exp( singularVectors_Left[nCh][nCh], singularVectors_Left_e[nCh][nCh], ONE_IN_Q30, 1, &singularVectors_Left_e[nCh][nCh] ); /* exp(sing_exp2) */
        move32();
#endif /* OPT_MCH_DEC_V1_NBE */
    }
    // fclose(fp);
    FOR( nCh = 0; nCh < nChannelsL; nCh++ )
@@ -1369,7 +1322,6 @@ static void singularVectorsAccumulationRight_fx(

                FOR( iCh = nCh + 1; iCh < nChannelsC; iCh++ ) /* nChannelsC */
                {
#ifdef OPT_MCH_DEC_V1_NBE
                    Word64 norm_val = 0;
                    move64();
                    Word16 maxL_e = MIN_16;
@@ -1384,41 +1336,23 @@ static void singularVectorsAccumulationRight_fx(
                        maxR_e = s_max( maxR_e, sing_right_exp[k][iCh] );
                        maxR2_e = s_max( maxR2_e, sing_right_exp[k][nCh] );
                    }
#else  /* OPT_MCH_DEC_V1_NBE */
                    norm_y = 0;
                    move32();
                    norm_y_e = 0;
                    move16();
#endif /* OPT_MCH_DEC_V1_NBE */

                    FOR( k = nCh + 1; k < nChannelsC; k++ ) /* nChannelsC */
                    {
#ifdef OPT_MCH_DEC_V1_NBE
                        norm_val = W_mac_32_32( norm_val, L_shr( singularVectors_Left[nCh][k], sub( maxL_e, singularVectors_Left_e[nCh][k] ) ), L_shr( singularVectors_Right[k][iCh], sub( maxR_e, sing_right_exp[k][iCh] ) ) );
#else  /* OPT_MCH_DEC_V1_NBE */
                        norm_y = BASOP_Util_Add_Mant32Exp( norm_y, norm_y_e, Mpy_32_32( singularVectors_Left[nCh][k], singularVectors_Right[k][iCh] ), add( singularVectors_Left_e[nCh][k], sing_right_exp[k][iCh] ), &norm_y_e );                               /* exp(norm_y_e) */
#endif /* OPT_MCH_DEC_V1_NBE */
                    }
#ifdef OPT_MCH_DEC_V1_NBE
                    norm_y_e = W_norm( norm_val );
                    norm_y = W_extract_h( W_shl( norm_val, norm_y_e ) );
                    norm_y_e = sub( add( maxL_e, maxR_e ), norm_y_e );

                    Word16 max_new = s_max( maxR_e, add( maxR2_e, norm_y_e ) );
#endif                                                      /* OPT_MCH_DEC_V1_NBE */
                    FOR( k = nCh + 1; k < nChannelsC; k++ ) /* nChannelsC */
                    {
#ifdef OPT_MCH_DEC_V1_NBE
                        Word32 temp = Mpy_32_32( norm_y, singularVectors_Right[k][nCh] );
                        Word32 op2 = L_shr( temp, sub( max_new, add( norm_y_e, sing_right_exp[k][nCh] ) ) );
                        singularVectors_Right[k][iCh] = L_add_sat( L_shr( singularVectors_Right[k][iCh], sub( max_new, sing_right_exp[k][iCh] ) ), op2 ); /* exp(sing_right_exp) */
                        move32();
                        singularVectors_Right[k][iCh] = L_shl_sat( singularVectors_Right[k][iCh], max_new ); /* Q31 */
#else                                                                                                        /* OPT_MCH_DEC_V1_NBE */
                        singularVectors_Right[k][iCh] = BASOP_Util_Add_Mant32Exp( singularVectors_Right[k][iCh], sing_right_exp[k][iCh], Mpy_32_32( norm_y, singularVectors_Right[k][nCh] ), add( norm_y_e, sing_right_exp[k][nCh] ), &sing_right_exp[k][iCh] ); /* exp(sing_right_exp) */
                        move32();
                        singularVectors_Right[k][iCh] = L_shl_sat( singularVectors_Right[k][iCh], sing_right_exp[k][iCh] ); /* Q31 */
#endif                                                                                                       /* OPT_MCH_DEC_V1_NBE */
                        move32();
                        sing_right_exp[k][iCh] = 0;
                        move16();
+0 −82
Original line number Diff line number Diff line
@@ -514,9 +514,7 @@ void ivas_dirac_dec_decorr_process_fx(
    max_band_decorr = h_freq_domain_decorr_ap_params->max_band_decorr;
    move16();

#if ( defined OPT_MCH_DEC_V1_NBE || defined OPT_MCH_DEC_V1_BE )
    Word16 decorX2 = shl( max_band_decorr, 1 );
#endif

    set32_fx( onset_filter_fx, ONE_IN_Q31, imult1616( num_protos_diff, num_freq_bands ) );

@@ -869,25 +867,17 @@ void ivas_dirac_dec_decorr_process_fx(
            Word16 max_e = s_max( aux_e, e_reverb_energy_smooth );
            Word16 shr_aux = sub( max_e, aux_e );                  /* Note: headroom is zero */
            Word16 shr_res = sub( max_e, e_reverb_energy_smooth ); /* Note: headroom is zero */
#ifdef OPT_MCH_DEC_V1_NBE
            Word32 temp1 = L_shr( ONE_M_DIRAC_DUCK_ALPHA, shr_aux );
            Word32 temp2 = L_shr( DIRAC_DUCK_ALPHA_FX, shr_res );
#endif /* OPT_MCH_DEC_V1_NBE */

            /* Note: DIRAC_DUCK_ALPHA_FX and ONE_M_DIRAC_DUCK_ALPHA are both in Q31 (e=0) */
            /*       => a multiplication with this values does not change the q/e value.  */

            FOR( Word16 i = 0; i < len; i++ )
            {
#ifdef OPT_MCH_DEC_V1_NBE
                h_freq_domain_decorr_ap_state->reverb_energy_smooth_fx[i] = Madd_32_32(
                    Mpy_32_32( aux_buffer_fx[i], temp1 ),
                    h_freq_domain_decorr_ap_state->reverb_energy_smooth_fx[i], temp2 );
#else  /* OPT_MCH_DEC_V1_NBE */
                h_freq_domain_decorr_ap_state->reverb_energy_smooth_fx[i] = L_add(
                    L_shr( Mpy_32_32( aux_buffer_fx[i], ONE_M_DIRAC_DUCK_ALPHA ), shr_aux ),
                    L_shr( Mpy_32_32( h_freq_domain_decorr_ap_state->reverb_energy_smooth_fx[i], DIRAC_DUCK_ALPHA_FX ), shr_res ) );
#endif /* OPT_MCH_DEC_V1_NBE */
                move32();
            }
            e_reverb_energy_smooth = max_e;
@@ -900,22 +890,14 @@ void ivas_dirac_dec_decorr_process_fx(
            Word16 max_x = s_max( den_e, e_direct_energy_smooth );
            Word16 shr_den = sub( max_x, den_e );                  /* Note: headroom is zero */
            Word16 shr_des = sub( max_x, e_direct_energy_smooth ); /* Note: headroom is zero */
#ifdef OPT_MCH_DEC_V1_NBE
            temp1 = L_shr( ONE_M_DIRAC_DUCK_ALPHA, shr_den );
            temp2 = L_shr( DIRAC_DUCK_ALPHA_FX, shr_des );
#endif /* OPT_MCH_DEC_V1_NBE */

            FOR( Word16 i = 0; i < len; i++ )
            {
#ifdef OPT_MCH_DEC_V1_NBE
                h_freq_domain_decorr_ap_state->direct_energy_smooth_fx[i] = Madd_32_32(
                    Mpy_32_32( direct_energy_fx[i], temp1 ),
                    h_freq_domain_decorr_ap_state->direct_energy_smooth_fx[i], temp2 );
#else  /* OPT_MCH_DEC_V1_NBE */
                h_freq_domain_decorr_ap_state->direct_energy_smooth_fx[i] = L_add(
                    L_shr( Mpy_32_32( direct_energy_fx[i], ONE_M_DIRAC_DUCK_ALPHA ), shr_den ),
                    L_shr( Mpy_32_32( h_freq_domain_decorr_ap_state->direct_energy_smooth_fx[i], DIRAC_DUCK_ALPHA_FX ), shr_des ) );
#endif /* OPT_MCH_DEC_V1_NBE */
                move32();
            }
            e_direct_energy_smooth = max_x;
@@ -924,22 +906,6 @@ void ivas_dirac_dec_decorr_process_fx(
            move16();

            // scaling energy buffers for better precision for higher values//
#ifndef OPT_MCH_DEC_V1_NBE
            q_shift = L_norm_arr( h_freq_domain_decorr_ap_state->direct_energy_smooth_fx, imult1616( num_protos_dir, max_band_decorr ) );
            IF( q_shift != 0 )
            {
                Scale_sig32( h_freq_domain_decorr_ap_state->direct_energy_smooth_fx, imult1616( num_protos_dir, max_band_decorr ), q_shift );
                h_freq_domain_decorr_ap_state->q_direct_energy_smooth = add( h_freq_domain_decorr_ap_state->q_direct_energy_smooth, q_shift );
                move16();
            }
            q_shift = L_norm_arr( h_freq_domain_decorr_ap_state->reverb_energy_smooth_fx, imult1616( num_channels, max_band_decorr ) );
            IF( q_shift != 0 )
            {
                Scale_sig32( h_freq_domain_decorr_ap_state->reverb_energy_smooth_fx, imult1616( num_channels, max_band_decorr ), q_shift );
                h_freq_domain_decorr_ap_state->q_reverb_energy_smooth = add( h_freq_domain_decorr_ap_state->q_reverb_energy_smooth, q_shift );
                move16();
            }
#endif
            h_freq_domain_decorr_ap_state->q_reverb_energy_smooth = s_min( MAX_Q_FX, h_freq_domain_decorr_ap_state->q_reverb_energy_smooth );
            h_freq_domain_decorr_ap_state->q_direct_energy_smooth = s_min( MAX_Q_FX, h_freq_domain_decorr_ap_state->q_direct_energy_smooth );

@@ -951,16 +917,9 @@ void ivas_dirac_dec_decorr_process_fx(
            move16();
            FOR( ch_idx = 0; ch_idx < num_channels; ++ch_idx )
            {
#ifdef OPT_MCH_DEC_V1_NBE
                q_shift = s_min( q_shift,
                                 L_norm_arr( &frame_dec_fx[2 * ch_idx * num_freq_bands], decorX2 ) );
#else  /* OPT_MCH_DEC_V1_NBE */
                q_shift = s_min( q_shift,
                                 sub( L_norm_arr( &frame_dec_fx[2 * ch_idx * num_freq_bands], shl( max_band_decorr, 1 ) ),
                                      Q2 ) );
#endif /* OPT_MCH_DEC_V1_NBE */
            }
#ifdef OPT_MCH_DEC_V1_NBE
            q_shift = sub( q_shift, 2 );
            FOR( ch_idx = 0; ch_idx < num_channels; ++ch_idx )
            {
@@ -970,13 +929,6 @@ void ivas_dirac_dec_decorr_process_fx(
            Word16 diff1 = sub( e_direct_energy_smooth, e_reverb_energy_smooth );
            Word16 diff2 = add( Q30, diff1 );
            diff1 = sub( Q30, diff1 );
#else  /* OPT_MCH_DEC_V1_NBE */
            FOR( ch_idx = 0; ch_idx < num_channels; ++ch_idx )
            {
                Scale_sig32( &frame_dec_fx[shl( imult1616( ch_idx, num_freq_bands ), 1 )], shl( max_band_decorr, 1 ), q_shift );
            }
            q_frame_f = add( q_frame_f, q_shift );
#endif /* OPT_MCH_DEC_V1_NBE */

            FOR( ch_idx = 0; ch_idx < num_channels; ch_idx++ )
            {
@@ -996,22 +948,12 @@ void ivas_dirac_dec_decorr_process_fx(
                    move32();
                    move32();

#ifdef OPT_MCH_DEC_V1_NBE
                    Word64 temp_1 = W_sub( W_shl( reverb_energy_loc, diff1 ), W_mult0_32_32( direct_energy_loc, DIRAC_DUCK_GAMMA_FX ) );
                    Word64 temp_2 = W_sub( W_shl( direct_energy_loc, diff2 ), W_mult0_32_32( reverb_energy_loc, DIRAC_DUCK_GAMMA_FX ) );

                    IF( temp_1 > 0 )
                    {
                        duck_gain = BASOP_Util_Divide3232_Scale( Mpy_32_32( direct_energy_loc, DIRAC_DUCK_GAMMA_FX ), L_add( reverb_energy_loc, EPSILON_FX ), &e_duck_gain );
#else  /* OPT_MCH_DEC_V1_NBE */
                    Word32 temp_1 = Mpy_32_32( direct_energy_loc, DIRAC_DUCK_GAMMA_FX ); // e+1
                    Word32 temp_2 = Mpy_32_32( reverb_energy_loc, DIRAC_DUCK_GAMMA_FX ); // e+1
                    Word16 comp_flag_1 = BASOP_Util_Cmp_Mant32Exp( reverb_energy_loc, e_reverb_energy_smooth, temp_1, add( e_direct_energy_smooth, 1 ) );
                    Word16 comp_flag_2 = BASOP_Util_Cmp_Mant32Exp( direct_energy_loc, e_direct_energy_smooth, temp_2, add( e_reverb_energy_smooth, 1 ) );
                    IF( EQ_16( comp_flag_1, 1 ) )
                    {
                        duck_gain = BASOP_Util_Divide3232_Scale( temp_1, L_add( reverb_energy_loc, EPSILON_FX ), &e_duck_gain );
#endif /* OPT_MCH_DEC_V1_NBE */
                        e_duck_gain = add( e_duck_gain, sub( add( e_direct_energy_smooth, 1 ), e_reverb_energy_smooth ) );

                        duck_gain = Sqrt16( duck_gain, &e_duck_gain );
@@ -1023,17 +965,10 @@ void ivas_dirac_dec_decorr_process_fx(
                        move32();
                        move32();
                    }
#ifdef OPT_MCH_DEC_V1_NBE
                    ELSE IF( temp_2 > 0 )
                    {

                        duck_gain = BASOP_Util_Divide3232_Scale( direct_energy_loc, L_add( Mpy_32_32( reverb_energy_loc, DIRAC_DUCK_GAMMA_FX ), EPSILON_FX ), &e_duck_gain );
#else  /* OPT_MCH_DEC_V1_NBE */
                    ELSE IF( EQ_16( comp_flag_2, 1 ) )
                    {

                        duck_gain = BASOP_Util_Divide3232_Scale( direct_energy_loc, L_add( temp_2, EPSILON_FX ), &e_duck_gain );
#endif /* OPT_MCH_DEC_V1_NBE */
                        e_duck_gain = add( e_duck_gain, sub( e_direct_energy_smooth, add( e_reverb_energy_smooth, 1 ) ) );

                        duck_gain = Sqrt16( duck_gain, &e_duck_gain );
@@ -1104,7 +1039,6 @@ void ivas_dirac_dec_decorr_process_fx(

        IF( EQ_16( h_freq_domain_decorr_ap_params->add_back_onsets_on, 1 ) )
        {
#ifdef OPT_MCH_DEC_V1_NBE
            IF( q_if_local )
            {
                FOR( ch_idx = 0; ch_idx < num_channels; ++ch_idx )
@@ -1141,22 +1075,6 @@ void ivas_dirac_dec_decorr_process_fx(
                    v_add_fx( &frame_dec_fx[2 * ch_idx * num_freq_bands], aux_buffer_fx, &frame_dec_fx[2 * ch_idx * num_freq_bands], decorX2 );
                }
            }
#else  /* OPT_MCH_DEC_V1_NBE */
            FOR( ch_idx = 0; ch_idx < num_channels; ++ch_idx )
            {
                offset = imult1616( proto_index_dir[ch_idx], num_freq_bands );

                FOR( k = 0; k < max_band_decorr; ++k )
                {
                    aux_buffer_fx[2 * k] = Mpy_32_32( L_shr_r( input_frame_fx[2 * ( offset + k )], q_if_local ), L_sub( ONE_IN_Q31, onset_filter_fx[offset + k] ) );
                    aux_buffer_fx[add( shl( k, 1 ), 1 )] = Mpy_32_32( L_shr_r( input_frame_fx[2 * ( offset + k ) + 1], q_if_local ), L_sub( ONE_IN_Q31, onset_filter_fx[offset + k] ) ); // q_frame_f
                    move32();
                    move32();
                }

                v_add_fx( &frame_dec_fx[2 * ch_idx * num_freq_bands], aux_buffer_fx, &frame_dec_fx[2 * ch_idx * num_freq_bands], shl( max_band_decorr, 1 ) );
            }
#endif /* OPT_MCH_DEC_V1_NBE */
        }

        /* avoid decorrelation above maximum frequency -> set to zero the remaining frequencies*/