Commit f2fc635b authored by multrus's avatar multrus
Browse files

[cleanup] accept BE_FIX_2240_COMPUTE_COV_MTC_FX_FAST

parent 537a1baf
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -120,7 +120,6 @@

#define NONBE_OPT_2239_IVAS_FILTER_PROCESS  /* Dolby: Issue 2239, optimize ivas_filter_process_fx. */
#define NONBE_OPT_2193_EIG2X2               /* Dolby: Issue 2193, optimize eig2x2_fx. */
#define BE_FIX_2240_COMPUTE_COV_MTC_FX_FAST /* FhG: Speeds up covariance calculation e.g. 60 WMOPS for encoding -mc 7_1_4 24400 48 */
#define OPT_2308_FIND_TARGET                /* VA: Issue 2308, Speeds up computation and improve accuracy of the impulse response */

/* #################### End BASOP optimization switches ############################ */
+0 −87
Original line number Diff line number Diff line
@@ -69,7 +69,6 @@ static void ivas_mcmasa_dmx_fx(
    const Word16 nchan_transport,
    const Word16 nchan_inp );

#ifdef BE_FIX_2240_COMPUTE_COV_MTC_FX_FAST
/* Compute covariance matrix, i.e., xT * conj(x), and accumulate to the output */
static void compute_cov_mtx_fx(
    Word32 sr[MCMASA_MAX_ANA_CHANS][DIRAC_NO_FB_BANDS_MAX], /* i  : Input matrix, real, s[ch][freq]               (inp_exp) */
@@ -79,16 +78,6 @@ static void compute_cov_mtx_fx(
    CovarianceMatrix pCOVls[MASA_FREQUENCY_BANDS], /* o  : Output matrix, contains upper part of cov mtx           */
    Word16 inp_exp,                                /*Stores exponent for temp*/
    Word16 *band_grouping );
#else
static void compute_cov_mtx_fx(
    Word32 sr[MCMASA_MAX_ANA_CHANS][DIRAC_NO_FB_BANDS_MAX], /* i  : Input matrix, real, s[ch][freq]                         */
    Word32 si[MCMASA_MAX_ANA_CHANS][DIRAC_NO_FB_BANDS_MAX], /* i  : Input matrix, imag, s[ch][freq]                         */
    const Word16 freq,                                      /* i  : Freq to process                                         */
    const Word16 N,                                         /* i  : Number of channels                                      */
    CovarianceMatrix *COVls,                                /* o  : Output matrix, contains upper part of cov mtx           */
    Word16 inp_exp                                          /*Stores exponent for temp*/
);
#endif

static void computeIntensityVector_enc_fx(
    const Word16 *band_grouping,
@@ -928,11 +917,7 @@ void ivas_mcmasa_param_est_enc_fx(
    Word32 renormalization_factor_diff_fx[MASA_FREQUENCY_BANDS]; // renormalization_factor_diff_e
    Word16 renormalization_factor_diff_e[MASA_FREQUENCY_BANDS];
    Word32 norm_tmp_fx;
#ifdef BE_FIX_2240_COMPUTE_COV_MTC_FX_FAST
    Word16 mrange[2];
#else
    Word16 mrange[2], brange[2];
#endif
    Word16 numSubFramesForRatio;
    CovarianceMatrix COVls[MASA_FREQUENCY_BANDS];
    Word32 absCOVls_fx[MCMASA_MAX_ANA_CHANS][MCMASA_MAX_ANA_CHANS];
@@ -1077,7 +1062,6 @@ void ivas_mcmasa_param_est_enc_fx(
            }
            inp_q = add( inp_q, sf );

#ifdef BE_FIX_2240_COMPUTE_COV_MTC_FX_FAST
            /* Compute covariance matrix */

            assert( mrange[1] - mrange[0] == 1 );
@@ -1099,28 +1083,6 @@ void ivas_mcmasa_param_est_enc_fx(
                    hMasa->data.energy_fx[block_m_idx][i] = BASOP_Util_Add_Mant32Exp( hMasa->data.energy_fx[block_m_idx][i], hMasa->data.energy_e[block_m_idx][i], COVls[i].xr_fx[j][j], COVls[i].xr_e[j][j], &hMasa->data.energy_e[block_m_idx][i] );
                }
            }
#else
            /* Compute covariance matrix */
            FOR( i = 0; i < num_freq_bands; i++ )
            {
                brange[0] = hMcMasa->band_grouping[i];
                move16();
                brange[1] = hMcMasa->band_grouping[i + 1];
                move16();
                FOR( j = brange[0]; j < brange[1]; j++ )
                {
                    compute_cov_mtx_fx( Chnl_RealBuffer_fx, Chnl_ImagBuffer_fx, j, numAnalysisChannels, &( COVls[i] ), sub( 31, inp_q ) );
                }


                /* Store energies for guiding metadata encoding */
                FOR( j = 0; j < numAnalysisChannels; j++ )
                {
                    move32();
                    hMasa->data.energy_fx[block_m_idx][i] = BASOP_Util_Add_Mant32Exp( hMasa->data.energy_fx[block_m_idx][i], hMasa->data.energy_e[block_m_idx][i], COVls[i].xr_fx[j][j], COVls[i].xr_e[j][j], &hMasa->data.energy_e[block_m_idx][i] );
                }
            }
#endif

            IF( !hMcMasa->separateChannelEnabled )
            {
@@ -2126,7 +2088,6 @@ static void ivas_mcmasa_dmx_fx(
    return;
}

#ifdef BE_FIX_2240_COMPUTE_COV_MTC_FX_FAST

/* Compute covariance matrix, i.e., xT * conj(x), and accumulate to the output */
static void compute_cov_mtx_fx(
@@ -2192,54 +2153,6 @@ static void compute_cov_mtx_fx(
}


#else
/* Compute covariance matrix, i.e., xT * conj(x), and accumulate to the output */
static void compute_cov_mtx_fx(
    Word32 sr[MCMASA_MAX_ANA_CHANS][DIRAC_NO_FB_BANDS_MAX], /* i  : Input matrix, real, s[ch][freq]               (inp_exp) */
    Word32 si[MCMASA_MAX_ANA_CHANS][DIRAC_NO_FB_BANDS_MAX], /* i  : Input matrix, imag, s[ch][freq]               (inp_exp) */
    const Word16 freq,                                      /* i  : Freq to process                                         */
    const Word16 N,                                         /* i  : Number of channels                                      */
    CovarianceMatrix *COVls,                                /* o  : Output matrix, contains upper part of cov mtx           */
    Word16 inp_exp                                          /*Stores exponent for temp*/
)
{
    Word16 i, j;
    Word64 temp64_1, temp64_2;
    Word16 tmp_16, max_exp;
    Word16 temp_exp = shl( inp_exp, 1 );
    FOR( i = 0; i < N; i++ )
    {
        FOR( j = i; j < N; j++ )
        {
            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_2 = W_deposit32_h( COVls->xr_fx[i][j] );                                               // exp:COVls->xr_e[i][j]
            max_exp = s_max( COVls->xr_e[i][j], temp_exp );
            temp64_2 = W_shl( temp64_2, sub( COVls->xr_e[i][j], max_exp ) ); // exp:max_exp
            temp64_1 = W_shl( temp64_1, sub( temp_exp, max_exp ) );          // exp:max_exp
            temp64_1 = W_add( temp64_1, temp64_2 );                          // exp:max_exp
            tmp_16 = W_norm( temp64_1 );

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

            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_2 = W_deposit32_h( COVls->xi_fx[i][j] );                                                         // exp:COVls->xi_e[i][j]
            max_exp = s_max( COVls->xi_e[i][j], temp_exp );
            temp64_2 = W_shl( temp64_2, sub( COVls->xi_e[i][j], max_exp ) ); // exp:max_exp
            temp64_1 = W_shl( temp64_1, sub( temp_exp, max_exp ) );          // exp:max_exp
            temp64_1 = W_add( temp64_1, temp64_2 );                          // exp:max_exp
            tmp_16 = W_norm( temp64_1 );

            COVls->xi_fx[i][j] = W_extract_h( W_shl( temp64_1, tmp_16 ) ); // exp:max_exp-tmp_16
            COVls->xi_e[i][j] = sub( max_exp, tmp_16 );
            move32();
        }
    }
    return;
}
#endif

static void computeIntensityVector_enc_fx(
    const Word16 *band_grouping,