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

LTV mch nbe - 29062025

parent 433b9a91
Loading
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -77,6 +77,7 @@


/* Note: each compile switch (FIX_1101_...) is independent from the other ones */
#define OPT_MCH_DEC_V1_NBE
#define OPT_MCT_ENC_V1_NBE
#define OPT_SBA_REND_V1_BE
#define OPT_HEAD_ROT_REND_V1_BE
+48 −1
Original line number Diff line number Diff line
@@ -877,7 +877,12 @@ Word16 computeMixingMatrices_fx(
    move16();
    FOR( i = 1; i < lengthCx; i++ )
    {
#ifdef OPT_MCH_DEC_V1_NBE
      Word16 com_e = s_max(limit_e, svd_s_buffer_e[i]);
      IF( GT_32( L_shr(svd_s_buffer_fx[i], sub(com_e, svd_s_buffer_e[i])), L_shr(limit_fx, sub(com_e, limit_e ))) )
#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();
@@ -886,13 +891,19 @@ Word16 computeMixingMatrices_fx(
        }
    }

    L_tmp = Mpy_32_32( limit_fx, reg_Sx_fx );
    limit_e = add( limit_e, reg_Sx_e );

    L_tmp = Mpy_32_32( limit_fx, reg_Sx_fx );
    limit_fx = L_add( L_tmp, EPSILON_FX );

    FOR( i = 0; i < lengthCx; ++i )
    {
#ifdef OPT_MCH_DEC_V1_NBE
        Word16 com_e = s_max(limit_e, svd_s_buffer_e[i]);
        IF(LT_32(L_shr(svd_s_buffer_fx[i], sub(com_e, svd_s_buffer_e[i])), L_shr(limit_fx, sub(com_e, limit_e))))
#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();
@@ -937,9 +948,16 @@ 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 = s_max(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(L_shr(Cy_hat_diag_fx[i], sub(com_e, Cy_hat_diag_e)), L_shr(limit_fx, sub(com_e, limit_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();
@@ -947,15 +965,24 @@ Word16 computeMixingMatrices_fx(
            move16();
        }
    }

    L_tmp = Mpy_32_32( limit_fx, reg_ghat_fx ); // limit_e+ reg_ghat_e
    limit_fx = L_add( L_tmp, EPSILON_FX );
    limit_e = add( limit_e, reg_ghat_e );

#ifdef OPT_MCH_DEC_V1_NBE
    com_e = s_max(limit_e, Cy_hat_diag_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(L_shr(limit_fx, sub(com_e, limit_e)), L_shr(Cy_hat_diag_fx[i], sub(com_e, Cy_hat_diag_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();
@@ -1375,7 +1402,12 @@ Word16 computeMixingMatricesResidual_fx(

    FOR( i = 0; i < lengthCx; ++i )
    {
#ifdef OPT_MCH_DEC_V1_NBE
        Word16 com_e = s_max(limit_e, Kx_fx_e[i]);
       IF(GT_32(L_shr(Kx_fx[i], sub(com_e, Kx_fx_e[i])), L_shr(limit_fx, sub(com_e, limit_e))))
#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();
@@ -1416,9 +1448,16 @@ Word16 computeMixingMatricesResidual_fx(
    Cy_hat_diag_e = Cx_e;
    move16();

#ifdef OPT_MCH_DEC_V1_NBE
    Word16 com_e = s_max(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(L_shr(Cy_hat_diag_fx[i], sub(com_e, Cy_hat_diag_e)), L_shr(limit_fx, sub(com_e, limit_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();
@@ -1432,11 +1471,19 @@ Word16 computeMixingMatricesResidual_fx(
    limit_e = add( limit_e, reg_ghat_e );

    /* Computing G_hat */

#ifdef OPT_MCH_DEC_V1_NBE
    com_e = s_max(limit_e, Cy_hat_diag_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(L_shr(limit_fx, sub(com_e, limit_e)), L_shr(Cy_hat_diag_fx[i], sub(com_e, Cy_hat_diag_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();
+111 −2
Original line number Diff line number Diff line
@@ -322,7 +322,13 @@ Word16 svd_fx(
        move16();
        FOR( iCh = 0; iCh < lengthSingularValues - 1; iCh++ )
        {
#ifdef OPT_MCH_DEC_V1_NBE		
            Word16 com_e = s_max( singularValues_fx_e[iCh], singularValues_fx_e[iCh + 1] );

            IF( LT_32( L_shr( singularValues_fx[iCh], sub( com_e, singularValues_fx_e[iCh] ) ), L_shr( singularValues_fx[iCh + 1], sub( com_e, singularValues_fx_e[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();
@@ -428,13 +434,23 @@ static Word16 BidagonalDiagonalisation_fx(
            FOR( jCh = iCh; jCh >= 0; jCh-- )
            {
                split = sub( jCh, 1 );                                                                                                                         /* Q0 */
#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 /* 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[split], eps_x_e );
                IF( LE_32( L_shr( L_abs( singularValues_fx[split] ), sub( com_e, singularValues_new_e[split] ) ), L_shr( Mpy_32_32( CONVERGENCE_FACTOR_FX, eps_x ), sub( com_e, eps_x_e ) ) ) ) /* is singularValues[split] 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;
                }
@@ -469,7 +485,12 @@ static Word16 BidagonalDiagonalisation_fx(
                    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;
                    }
@@ -918,9 +939,15 @@ 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 */
            {
@@ -929,8 +956,25 @@ 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 ) ) );
            }

            Word16 nrm = W_norm( temp );
            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 ) )
            {
                norm_x = MAX_32;
@@ -958,6 +1002,28 @@ 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;
                temp = 0;
                move64();

                FOR( jCh = idx; jCh < nChannelsL; jCh++ ) /* nChannelsL */
                {
                    max_e = s_max( max_e, singularVectors2_e[jCh][currChannel] ); /* exp(norm_x_e) */
                    max2_e = s_max( max2_e, singularVectors2_e[jCh][iCh] );       /* exp(norm_x_e) */
                }
                max_e = add( max_e, max2_e );

                FOR( jCh = idx; jCh < nChannelsL; jCh++ ) /* nChannelsL */
                {
                    temp = W_add( temp, L_shr( Mpy_32_32( singularVectors[jCh][currChannel], singularVectors[jCh][iCh] ), sub( max_e, add( singularVectors2_e[jCh][currChannel], singularVectors2_e[jCh][iCh] ) ) ) );
                }
                nrm = W_norm( temp );
                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;
@@ -966,6 +1032,7 @@ static void biDiagonalReductionLeft_fx(
                {
                    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 ) );
@@ -1217,8 +1284,16 @@ 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_add( L_shr( singularVectors_Left[nCh][nCh], sub( exp, singularVectors_Left_e[nCh][nCh] ) ), L_shl( 1, sub( 31, 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++ )
@@ -1281,21 +1356,55 @@ 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;
                    Word16 maxR_e = MIN_16;
                    Word16 maxR2_e = MIN_16;
                    move16();
                    move16();
                    FOR( k = nCh + 1; k < nChannelsC; k++ ) /* nChannelsC */
                    {
                        maxL_e = s_max( maxL_e, singularVectors_Left_e[nCh][k] );
                        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( sub( add( maxL_e, maxR_e ), 0 ), 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();
+4 −21
Original line number Diff line number Diff line
@@ -1228,16 +1228,7 @@ ivas_error pre_proc_front_ivas_fx(
    /*------------------------------------------------------------------*
     * Update estimated noise energy and voicing cut-off frequency
     *-----------------------------------------------------------------*/

    Word16 scale = s_min( Q31, s_min( add( q_tmpN, L_norm_arr( tmpN_fx, NB_BANDS ) ), add( st->hNoiseEst->q_bckr, L_norm_arr( st->hNoiseEst->bckr_fx, NB_BANDS ) ) ) );
    scale = sub( scale, 1 ); // guard bits
    scale_sig32( st->hNoiseEst->bckr_fx, NB_BANDS, sub( scale, st->hNoiseEst->q_bckr ) );
    scale_sig32( tmpN_fx, NB_BANDS, sub( scale, q_tmpN ) );
    st->hNoiseEst->q_bckr = q_tmpN = scale;
    move16();
    move16();

    scale = s_min( Q31, add( st->hNoiseEst->ave_enr_q, s_min( L_norm_arr( st->hNoiseEst->ave_enr_fx, NB_BANDS ), L_norm_arr( st->hNoiseEst->ave_enr2_fx, NB_BANDS ) ) ) );
    Word16 scale = s_min( Q31, add( st->hNoiseEst->ave_enr_q, s_min( L_norm_arr( st->hNoiseEst->ave_enr_fx, NB_BANDS ), L_norm_arr( st->hNoiseEst->ave_enr2_fx, NB_BANDS ) ) ) );
    scale = s_min( scale, add( q_tmpE, L_norm_arr( tmpE_fx, NB_BANDS ) ) );
    scale = sub( scale, 1 ); // guard bits
    scale_sig32( tmpE_fx, NB_BANDS, sub( scale, q_tmpE ) );
@@ -1256,7 +1247,7 @@ ivas_error pre_proc_front_ivas_fx(
    move16();
    move16();

    noise_est_ivas_fx( st, old_pitch1, tmpN_fx, epsP_fx, extract_h( Etot_fx ), *relE_fx, corr_shift_fx, tmpE_fx, q_tmpE, fr_bands_fx, fr_bands_fx_q, cor_map_sum_fx,
    noise_est_ivas_fx( st, old_pitch1, tmpN_fx, q_tmpN, epsP_fx, extract_h( Etot_fx ), *relE_fx, corr_shift_fx, tmpE_fx, q_tmpE, fr_bands_fx, fr_bands_fx_q, cor_map_sum_fx,
                       &ncharX_fx, &sp_div_fx, &q_sp_div, &non_staX_fx, loc_harm, lf_E_fx, q_lf_E_fx, &st->hNoiseEst->harm_cor_cnt, extract_h( st->hNoiseEst->Etot_l_lp_32fx ),
                       st->hNoiseEst->Etot_v_h2_32fx, &st->hNoiseEst->bg_cnt, st->lgBin_E_fx, &dummy_fx, S_map_fx, hStereoClassif, NULL, st->ini_frame );

@@ -1265,14 +1256,6 @@ ivas_error pre_proc_front_ivas_fx(
    {
        FOR( Word16 j = 0; j < 2; j++ )
        {
            scale = s_min( add( q_tmpN_LR[j], L_norm_arr( tmpN_LR_fx[j], NB_BANDS ) ), add( hCPE->hFrontVad[j]->hNoiseEst->q_bckr, L_norm_arr( hCPE->hFrontVad[j]->hNoiseEst->bckr_fx, NB_BANDS ) ) );
            scale = sub( s_min( Q31, scale ), 1 );
            scale_sig32( hCPE->hFrontVad[j]->hNoiseEst->bckr_fx, NB_BANDS, sub( scale, hCPE->hFrontVad[j]->hNoiseEst->q_bckr ) );
            scale_sig32( tmpN_LR_fx[j], NB_BANDS, sub( scale, q_tmpN_LR[j] ) );
            hCPE->hFrontVad[j]->hNoiseEst->q_bckr = q_tmpN_LR[j] = scale;
            move16();
            move16();

            scale = add( hCPE->hFrontVad[j]->hNoiseEst->ave_enr_q, s_min( L_norm_arr( hCPE->hFrontVad[j]->hNoiseEst->ave_enr_fx, NB_BANDS ), L_norm_arr( hCPE->hFrontVad[j]->hNoiseEst->ave_enr2_fx, NB_BANDS ) ) );
            scale = s_min( scale, add( q_tmpE_LR[j], L_norm_arr( tmpE_LR_fx[j], NB_BANDS ) ) );
            scale = sub( s_min( Q31, scale ), 1 );
@@ -1297,14 +1280,14 @@ ivas_error pre_proc_front_ivas_fx(
        move16();

        /* Run noise_est for Left and Right channel */
        noise_est_ivas_fx( st, old_pitch1, tmpN_LR_fx[0], epsP_fx, Etot_LR_fx[0], sub( Etot_LR_fx[0], hCPE->hFrontVad[0]->lp_speech_fx ), corr_shiftL_fx,
        noise_est_ivas_fx( st, old_pitch1, tmpN_LR_fx[0], q_tmpN_LR[0], epsP_fx, Etot_LR_fx[0], sub( Etot_LR_fx[0], hCPE->hFrontVad[0]->lp_speech_fx ), corr_shiftL_fx,
                           tmpE_LR_fx[0], q_tmpE_LR[0], fr_bands_LR_fx[0], fr_bands_LR_fx_q[0], &cor_map_sum_LR_fx[0], &ncharX_LR_fx, &sp_div_LR_fx, &q_sp_div_LR,
                           &non_staX_LR_fx, loc_harmLR_fx, lf_E_LR_fx[0], lf_E_LR_fx_q, &hCPE->hFrontVad[0]->hNoiseEst->harm_cor_cnt,
                           extract_h( hCPE->hFrontVad[0]->hNoiseEst->Etot_l_lp_32fx ), hCPE->hFrontVad[0]->hNoiseEst->Etot_v_h2_32fx, &hCPE->hFrontVad[0]->hNoiseEst->bg_cnt,
                           st->lgBin_E_fx, &dummy_fx, S_map_LR_fx, NULL, hCPE->hFrontVad[0], hCPE->hFrontVad[0]->ini_frame );

        /* Note: the index [0] in the last argument is intended, the ini_frame counter is only maintained in the zero-th channel's VAD handle */
        noise_est_ivas_fx( st, old_pitch1, tmpN_LR_fx[1], epsP_fx, Etot_LR_fx[1], sub( Etot_LR_fx[1], hCPE->hFrontVad[1]->lp_speech_fx ), corr_shiftR_fx,
        noise_est_ivas_fx( st, old_pitch1, tmpN_LR_fx[1], q_tmpN_LR[1], epsP_fx, Etot_LR_fx[1], sub( Etot_LR_fx[1], hCPE->hFrontVad[1]->lp_speech_fx ), corr_shiftR_fx,
                           tmpE_LR_fx[1], q_tmpE_LR[1], fr_bands_LR_fx[1], fr_bands_LR_fx_q[1], &cor_map_sum_LR_fx[1], &ncharX_LR_fx, &sp_div_LR_fx, &q_sp_div_LR,
                           &non_staX_LR_fx, loc_harmLR_fx, lf_E_LR_fx[1], lf_E_LR_fx_q, &hCPE->hFrontVad[1]->hNoiseEst->harm_cor_cnt,
                           extract_h( hCPE->hFrontVad[1]->hNoiseEst->Etot_l_lp_32fx ), hCPE->hFrontVad[1]->hNoiseEst->Etot_v_h2_32fx, &hCPE->hFrontVad[1]->hNoiseEst->bg_cnt,
+3 −9
Original line number Diff line number Diff line
@@ -720,13 +720,6 @@ ivas_error front_vad_spar_fx(
        hFrontVad->hNoiseEst->ave_enr_q = scale;
        move16();

        scale = s_min( add( hFrontVad->hNoiseEst->q_bckr, L_norm_arr( hFrontVad->hNoiseEst->bckr_fx, NB_BANDS ) ), add( q_tmpN, L_norm_arr( tmpN_fx, NB_BANDS ) ) );
        scale = sub( s_min( Q31, scale ), 1 ); // guard bits
        scale_sig32( hFrontVad->hNoiseEst->bckr_fx, NB_BANDS, sub( scale, hFrontVad->hNoiseEst->q_bckr ) );
        scale_sig32( tmpN_fx, NB_BANDS, sub( scale, q_tmpN ) );
        hFrontVad->hNoiseEst->q_bckr = scale;
        move16();

        scale = add( hFrontVad->hNoiseEst->fr_bands_fx_q, s_min( L_norm_arr( hFrontVad->hNoiseEst->fr_bands1_fx, NB_BANDS ), L_norm_arr( hFrontVad->hNoiseEst->fr_bands2_fx, NB_BANDS ) ) );
        scale = s_min( scale, add( q_fr_bands[0], L_norm_arr( fr_bands_fx[0], 2 * NB_BANDS ) ) );
        scale = s_min( Q31, scale );
@@ -737,7 +730,7 @@ ivas_error front_vad_spar_fx(
        move16();
        move16();

        noise_est_ivas_fx( st, old_pitch, tmpN_fx, epsP_fx, Etot_fx[0], sub( Etot_fx[0], hFrontVad->lp_speech_fx ), corr_shift_fx, tmpE_fx,
        noise_est_ivas_fx( st, old_pitch, tmpN_fx, q_tmpN, epsP_fx, Etot_fx[0], sub( Etot_fx[0], hFrontVad->lp_speech_fx ), corr_shift_fx, tmpE_fx,
                           hFrontVad->hNoiseEst->ave_enr_q, fr_bands_fx[0], q_fr_bands[0], &cor_map_sum_fx, NULL, &sp_div_fx, &Q_sp_div, &non_staX_fx, &loc_harm,
                           lf_E_fx[0], q_lf_E[0], &hFrontVad->hNoiseEst->harm_cor_cnt, extract_h( hFrontVad->hNoiseEst->Etot_l_lp_32fx ), hFrontVad->hNoiseEst->Etot_v_h2_32fx,
                           &hFrontVad->hNoiseEst->bg_cnt, st->lgBin_E_fx, &sp_floor, S_map_fx, NULL, hFrontVad, hFrontVad->ini_frame );
@@ -765,7 +758,8 @@ ivas_error front_vad_spar_fx(
        move16();
        hSpar->front_vad_dtx_flag = 1;
        move16();
        if ( st->core_brate == SID_2k40 || st->core_brate == FRAME_NO_DATA )
        test();
        if ( EQ_32( st->core_brate, SID_2k40 ) || st->core_brate == FRAME_NO_DATA )
        {
            hSpar->front_vad_dtx_flag = 0;
            move16();
Loading