Commit 1f0b5316 authored by Fabian Bauer's avatar Fabian Bauer Committed by Manuel Jander
Browse files

fastest version bit with no msub

parent 8febb91c
Loading
Loading
Loading
Loading
+17 −17
Original line number Diff line number Diff line
@@ -1081,6 +1081,15 @@ void ivas_mcmasa_param_est_enc_fx(

#ifdef BE_FIX_2240_COMPUTE_COV_MTC_FX_FAST
            /* Compute covariance matrix */
            
            assert( mrange[1] - mrange[0] == 1 ); 
            /*if this ever comes up, 
              1. backup COVls to COVls_old
              2. reinitialize COVls (setzero)
              3. call compute_cov_mtx_fx(..,COVls,...)
              4. Add COVls_old to COVls 
              */

            compute_cov_mtx_fx( Chnl_RealBuffer_fx, Chnl_ImagBuffer_fx, num_freq_bands, numAnalysisChannels, COVls, sub( 31, inp_q ), hMcMasa->band_grouping );

            FOR( i = 0; i < num_freq_bands; i++ )
@@ -2135,9 +2144,7 @@ static void compute_cov_mtx_fx(
    Word16 freq;
    int k;
    int i, j;
    Word16 max_exp_r, max_exp_i;
    Word64 temp64_1_r_acc, temp64_1_i_acc;
    Word64 temp64_1;
    Word16 tmp_16;
    Word16 temp_exp = shl( inp_exp, 1 );

@@ -2154,36 +2161,29 @@ static void compute_cov_mtx_fx(
                move16();
                CovarianceMatrix *COVls = &( pCOVls[k] );

                temp64_1_r_acc = W_deposit32_h( COVls->xr_fx[i][j] );
                max_exp_r = s_max( COVls->xr_e[i][j], temp_exp );
                temp64_1_r_acc = W_shl( temp64_1_r_acc, sub( COVls->xr_e[i][j], max_exp_r ) ); // exp:max_exp_r

                temp64_1_i_acc = W_deposit32_h( COVls->xi_fx[i][j] ); // exp:COVls->xi_e[i][j]
                max_exp_i = s_max( COVls->xi_e[i][j], temp_exp );
                temp64_1_i_acc = W_shl( temp64_1_i_acc, sub( COVls->xi_e[i][j], max_exp_i ) ); // exp:max_exp_i
                temp64_1_r_acc = 0;
                temp64_1_i_acc = 0;

                FOR( freq = brange[0]; freq < brange[1]; freq++ )
                {
                    temp64_1 = W_mac_32_32( W_mult_32_32( sr[i][freq], sr[j][freq] ), si[i][freq], si[j][freq] ); // exp:2*inp_exp
                    temp64_1 = W_shl( temp64_1, sub( temp_exp, max_exp_r ) );                                     // exp:max_exp_r
                    temp64_1_r_acc = W_add( temp64_1, temp64_1_r_acc );                                           // exp:max_exp_r
                    temp64_1_r_acc = W_mac_32_32( temp64_1_r_acc, si[i][freq], si[j][freq] ); // exp:2*inp_exp
                    temp64_1_r_acc = W_mac_32_32( temp64_1_r_acc, sr[i][freq], sr[j][freq] ); // exp:2*inp_exp

                    temp64_1 = W_sub( W_mult_32_32( si[i][freq], sr[j][freq] ), W_mult_32_32( sr[i][freq], si[j][freq] ) ); // exp :2*inp_exp
                    temp64_1 = W_shl( temp64_1, sub( temp_exp, max_exp_i ) );                                               // exp:max_exp_i
                    temp64_1_i_acc = W_add( temp64_1, temp64_1_i_acc );                                                     // exp:max_exp_i
                    temp64_1_i_acc = W_mac_32_32( temp64_1_i_acc, si[i][freq], sr[j][freq] );
                    temp64_1_i_acc = W_sub( temp64_1_i_acc, W_mult_32_32(sr[i][freq], si[j][freq]) );
                }

                tmp_16 = W_norm( temp64_1_r_acc );

                COVls->xr_fx[i][j] = W_extract_h( W_shl( temp64_1_r_acc, tmp_16 ) ); // exp:max_exp-tmp_16
                COVls->xr_e[i][j] = sub( max_exp_r, tmp_16 );
                COVls->xr_e[i][j] = sub( temp_exp, tmp_16 );
                move32();
                move16();

                tmp_16 = W_norm( temp64_1_i_acc );

                COVls->xi_fx[i][j] = W_extract_h( W_shl( temp64_1_i_acc, tmp_16 ) ); // exp:max_exp-tmp_16
                COVls->xi_e[i][j] = sub( max_exp_i, tmp_16 );
                COVls->xi_e[i][j] = sub( temp_exp, tmp_16 );
                move32();
                move16();
            }