Commit 79a7aea7 authored by Sandesh Venkatesh's avatar Sandesh Venkatesh
Browse files

LTV mch be 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_BE
#define OPT_MCT_ENC_V1_NBE
#define OPT_SBA_REND_V1_BE
#define OPT_HEAD_ROT_REND_V1_BE
+31 −1
Original line number Diff line number Diff line
@@ -886,9 +886,13 @@ Word16 computeMixingMatrices_fx(
        }
    }

    L_tmp = Mpy_32_32( limit_fx, reg_Sx_fx );
    limit_e = add( limit_e, reg_Sx_e );
#ifdef OPT_MCH_DEC_V1_BE
    limit_fx = Madd_32_32( EPSILON_FX, limit_fx, reg_Sx_fx);
#else /* OPT_MCH_DEC_V1_BE */
    L_tmp = Mpy_32_32( limit_fx, reg_Sx_fx );
    limit_fx = L_add( L_tmp, EPSILON_FX );
#endif /* OPT_MCH_DEC_V1_BE */

    FOR( i = 0; i < lengthCx; ++i )
    {
@@ -947,14 +951,19 @@ Word16 computeMixingMatrices_fx(
            move16();
        }
    }
#ifdef OPT_MCH_DEC_V1_BE
    limit_fx = Madd_32_32( EPSILON_FX, limit_fx, reg_ghat_fx); // limit_e+ reg_ghat_e
#else /* OPT_MCH_DEC_V1_BE */
    L_tmp = Mpy_32_32( limit_fx, reg_ghat_fx ); // limit_e+ reg_ghat_e
    limit_fx = L_add( L_tmp, EPSILON_FX );
#endif /* OPT_MCH_DEC_V1_BE */
    limit_e = add( limit_e, reg_ghat_e );

    FOR( i = 0; i < lengthCy; ++i )
    {
        Cy_hat_diag_buff_e[i] = Cy_hat_diag_e;
        move16();

        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) */
        {
            Cy_hat_diag_fx[i] = limit_fx;
@@ -1427,11 +1436,16 @@ Word16 computeMixingMatricesResidual_fx(
        }
    }

#ifdef OPT_MCH_DEC_V1_BE
    limit_fx = Madd_32_32(EPSILON_FX, limit_fx, reg_ghat_fx ); // Q(limit_e+reg_ghat_e)
#else /* OPT_MCH_DEC_V1_BE */
    L_tmp = Mpy_32_32( limit_fx, reg_ghat_fx ); // Q(limit_e+reg_ghat_e)
    limit_fx = L_add( L_tmp, EPSILON_FX );
#endif /* OPT_MCH_DEC_V1_BE */
    limit_e = add( limit_e, reg_ghat_e );

    /* Computing G_hat */

    FOR( i = 0; i < lengthCy; ++i )
    {
        Cy_hat_diag_fx_e[i] = Cy_hat_diag_e;
@@ -1459,8 +1473,12 @@ Word16 computeMixingMatricesResidual_fx(

    FOR( i = 0; i < num_outputs; i++ )
    {
#ifdef OPT_MCH_DEC_V1_BE
        Kx_fx[i] = Mpy_32_32(Kx_fx[i], G_hat_fx[i]); // Q(31-(Kx_fx_e+G_hag_e))
#else /* OPT_MCH_DEC_V1_BE */
        L_tmp = Mpy_32_32( Kx_fx[i], G_hat_fx[i] ); // Q(31-(Kx_fx_e+G_hag_e))
        Kx_fx[i] = L_tmp;
#endif /* OPT_MCH_DEC_V1_BE */
        move32();
        Kx_fx_e[i] = add( Kx_fx_e[i], G_hat_e[i] );
        move16();
@@ -1474,11 +1492,18 @@ Word16 computeMixingMatricesResidual_fx(

        FOR( j = 0; j < num_outputs; j++ )
        {
#ifdef OPT_MCH_DEC_V1_BE
            mat_mult_buffer1_fx[i + j * num_outputs] = Mpy_32_32(Ky_fx[i + j * num_outputs], fac_fx); // Q(31-(Ky_fx_e+Kx_fx_e));
            move32();
            mat_mult_buffer1_buff_e[i + j * num_outputs] = add( Ky_fx_e[i + j * num_outputs], Kx_fx_e[i] ) ;
            move16();
#else /* OPT_MCH_DEC_V1_BE */
            L_tmp = Mpy_32_32( Ky_fx[i + j * num_outputs], fac_fx ); // Q(31-(Ky_fx_e+Kx_fx_e))
            mat_mult_buffer1_fx[i + j * num_outputs] = L_tmp;
            move32();
            mat_mult_buffer1_buff_e[i + j * num_outputs] = extract_l( L_add( Ky_fx_e[i + j * num_outputs], Kx_fx_e[i] ) );
            move16();
#endif /* OPT_MCH_DEC_V1_BE */
        }
    }

@@ -1534,9 +1559,14 @@ Word16 computeMixingMatricesResidual_fx(

        FOR( j = 0; j < num_outputs; j++ )
        {
#ifdef OPT_MCH_DEC_V1_BE
            mixing_matrix_fx[j + i * num_outputs] = Mpy_32_32(mat_mult_buffer1_fx[j + i * num_outputs], fac_fx); // Q(31-mat_mult_buffer1_e+Kx_reg_inv_e);
            move32();
#else /* OPT_MCH_DEC_V1_BE */
            L_tmp = Mpy_32_32( mat_mult_buffer1_fx[j + i * num_outputs], fac_fx ); // Q(31-mat_mult_buffer1_e+Kx_reg_inv_e)
            mixing_matrix_fx[j + i * num_outputs] = L_tmp;
            move32();
#endif /* OPT_MCH_DEC_V1_BE */
            mixing_matrix_fx_e[j + i * num_outputs] = add( mat_mult_buffer1_buff_e[j + i * num_outputs], Kx_reg_inv_e[i] );
            move16();
        }
+30 −13
Original line number Diff line number Diff line
@@ -434,6 +434,7 @@ static Word16 BidagonalDiagonalisation_fx(
                    move16();
                    BREAK;
                }

                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 */    
                {
                    BREAK;
@@ -469,6 +470,7 @@ 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] );

                    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 */	    
                    {
                        BREAK;
@@ -779,6 +781,9 @@ static void ApplyRotation_fx(
        move16();
    }
    op_e = add( op_e, 1 ); // 64 bit mac -> +1
#ifdef OPT_MCH_DEC_V1_BE		
    op_e = negate( op_e );
#endif /* OPT_MCH_DEC_V1_BE */		    

    FOR( ch = 0; ch < nChannels; ch++ )
    {
@@ -788,13 +793,21 @@ static void ApplyRotation_fx(
        move32();

        Word64 temp = W_mac_32_32( W_mult_32_32( op1, x11 ), op2, x12 ); // Q(singularVector) + op_e
#ifdef OPT_MCH_DEC_V1_BE		
        singularVector[ch][currentIndex2] = W_shl_sat_l( temp, op_e ); // Q(singularVector)
#else /* OPT_MCH_DEC_V1_BE */
        temp = W_shr( temp, op_e );                                      // Q(singularVector)
        singularVector[ch][currentIndex2] = W_sat_l( temp );             // Q(singularVector)
#endif /* OPT_MCH_DEC_V1_BE */		    
        move32();

        temp = W_mac_32_32( W_mult_32_32( op1, x12 ), L_negate( op2 ), x11 ); // Q(singularVector) + op_e
#ifdef OPT_MCH_DEC_V1_BE		
        singularVector[ch][currentIndex1] = W_shl_sat_l( temp, op_e ); // Q(singularVector)
#else /* OPT_MCH_DEC_V1_BE */
        temp = W_shr( temp, op_e );                                           // Q(singularVector)
        singularVector[ch][currentIndex1] = W_sat_l( temp );                  // Q(singularVector)
#endif /* OPT_MCH_DEC_V1_BE */		    
        move32();
    }

@@ -918,6 +931,7 @@ static void biDiagonalReductionLeft_fx(
            Word16 invVal_e;
            Word32 invVal;
            invVal = BASOP_Util_Divide3232_Scale_newton( MAXVAL_WORD32, maxWithSign_fx( *sig_x ), &invVal_e );

            norm_x = 0;
            move32();
            norm_x_e = 0; 
@@ -929,8 +943,10 @@ static void biDiagonalReductionLeft_fx(
                move32();
                singularVectors2_e[jCh][currChannel] = sub( add( invVal_e, sub( singularVectors2_e[jCh][currChannel], *sig_x_e ) ), temp_e );
                move16();

                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) */    
            }		    

            IF( GT_16( norm_x_e, 0 ) )
            {
                norm_x = MAX_32;
@@ -1217,6 +1233,7 @@ static void singularVectorsAccumulationLeft_fx(
                move32();
            }
        }

        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();   
    }
+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