Loading lib_enc/ivas_mcmasa_enc_fx.c +30 −13 Original line number Diff line number Diff line Loading @@ -79,6 +79,7 @@ static void compute_cov_mtx_fx_16( 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 *sf_c, Word16 band_grouping[], int num_freq_bands, int *fb_map ); Loading Loading @@ -947,6 +948,7 @@ void ivas_mcmasa_param_est_enc_fx( #else RAM_ALIGN Word16 Chnl_RealImagBuffer_fx_16[MCMASA_MAX_ANA_CHANS][DIRAC_NO_FB_BANDS_MAX * 2]; Word16 mrange[2]; Word16 sf_c[MCMASA_MAX_ANA_CHANS]; #endif Word16 numSubFramesForRatio; CovarianceMatrix COVls[MASA_FREQUENCY_BANDS]; Loading Loading @@ -1092,9 +1094,19 @@ void ivas_mcmasa_param_est_enc_fx( FOR( i = 0; i < numAnalysisChannels; i++ ) { #ifdef FUNC_compute_cov_mtx_fx_16 Word16 scal_imag, scal_real; scal_imag = L_norm_arr( Chnl_ImagBuffer_fx[i], DIRAC_NO_FB_BANDS_MAX ); scal_real = L_norm_arr( Chnl_RealBuffer_fx[i], DIRAC_NO_FB_BANDS_MAX ); sf_c[i] = sub( s_min( scal_real, scal_imag ), 1 ); pcm_in[i] += l_ts; cr_q = s_min( cr_q, scal_imag ); ci_q = s_min( ci_q, scal_real ); #else pcm_in[i] += l_ts; cr_q = s_min( cr_q, L_norm_arr( Chnl_ImagBuffer_fx[i], DIRAC_NO_FB_BANDS_MAX ) ); ci_q = s_min( ci_q, L_norm_arr( Chnl_RealBuffer_fx[i], DIRAC_NO_FB_BANDS_MAX ) ); #endif } sf = sub( s_min( cr_q, ci_q ), 5 ); Loading @@ -1105,9 +1117,9 @@ void ivas_mcmasa_param_est_enc_fx( Word32 *re = Chnl_RealBuffer_fx[i]; /*in*/ Word32 *im = Chnl_ImagBuffer_fx[i]; /*in*/ Word16 *x = Chnl_RealImagBuffer_fx_16[i]; /*out*/ Word16 k; const Word16 lg = DIRAC_NO_FB_BANDS_MAX; const Word16 exp0 = add( sf, sfCorrection ); int k; const int lg = DIRAC_NO_FB_BANDS_MAX; const Word16 exp0 = add( sf_c[i], 0 ); if ( 0 == exp0 ) { Loading @@ -1127,11 +1139,12 @@ void ivas_mcmasa_param_est_enc_fx( scale_sig32( Chnl_RealBuffer_fx[i], DIRAC_NO_FB_BANDS_MAX, sf ); // Q-> inp_q + sf scale_sig32( Chnl_ImagBuffer_fx[i], DIRAC_NO_FB_BANDS_MAX, sf ); // Q-> inp_q + sf } inp_q = add( inp_q, sf ); /* Compute covariance matrix */ #ifdef FUNC_compute_cov_mtx_fx_16 compute_cov_mtx_fx_16( Chnl_RealImagBuffer_fx_16, numAnalysisChannels, COVls, sub( 31 + sfCorrection, inp_q ), hMcMasa->band_grouping, (int) num_freq_bands, fb_map ); /* Compute covariance matrix */ compute_cov_mtx_fx_16( Chnl_RealImagBuffer_fx_16, numAnalysisChannels, COVls, sub( 31, inp_q ), sf_c, hMcMasa->band_grouping, (int) num_freq_bands, fb_map ); inp_q = add( inp_q, sf ); FOR( i = 0; i < num_freq_bands; i++ ) { Loading Loading @@ -2174,6 +2187,7 @@ static void compute_cov_mtx_fx_16( const Word16 N, /* i : Number of channels */ CovarianceMatrix mCOVls[], /* o : Output matrix pointer, - upper part of cov mtx */ Word16 inp_exp, /*Stores exponent for temp*/ Word16 *sf_c, Word16 band_grouping[], int num_freq_bands, int *fb_map ) Loading @@ -2181,20 +2195,22 @@ static void compute_cov_mtx_fx_16( int i, j; Word32 temp32_1, temp32_2; Word16 tmp_16, max_exp; Word16 temp_exp = shl( inp_exp, 1 ); Word16 temp_exp; int freq; FOR( i = 0; i < N; i++ ) { FOR( j = i; j < N; j++ ) { temp_exp = add( sub( inp_exp, sf_c[i] ), sub( inp_exp, sf_c[j] ) ); FOR( freq = band_grouping[0]; freq < band_grouping[num_freq_bands]; freq++ ) { CovarianceMatrix *COVls = &( mCOVls[fb_map[freq]] ); // Ri(Rsre-Rs[0] *Rj(Rtre-Rt[0] + Ii(Rsim-Rs[1] * Ij(Rtim-Rt[1] temp32_1 = L_mac0( L_mult0( sri[i][freq << 1], sri[j][freq << 1] ), sri[i][( freq << 1 ) + 1], sri[j][( freq << 1 ) + 1] ); // exp:2*inp_exp temp32_2 = COVls->xr_fx[i][j]; // exp:COVls->xr_e[i][j] max_exp = s_max( COVls->xr_e[i][j], temp_exp ); max_exp = add( s_max( COVls->xr_e[i][j], temp_exp ), 1 ); temp32_2 = L_shl( temp32_2, sub( COVls->xr_e[i][j], max_exp ) ); // exp:max_exp temp32_1 = L_shl( temp32_1, sub( temp_exp, max_exp ) ); // exp:max_exp temp32_1 = L_add( temp32_1, temp32_2 ); // exp:max_exp Loading @@ -2205,9 +2221,10 @@ static void compute_cov_mtx_fx_16( move32(); move16(); // Ii(Rsim-Rs[1] * Rj(Rtre-Rt[0] - Ri(Rsre-Rs[0] * Ii(Rtim-Rt[1] temp32_1 = L_msu0( L_mult0( sri[i][( freq << 1 ) + 1], sri[j][freq << 1] ), sri[i][freq << 1], sri[j][( freq << 1 ) + 1] ); // exp :2*inp_exp temp32_2 = COVls->xi_fx[i][j]; // exp:COVls->xi_e[i][j] max_exp = s_max( COVls->xi_e[i][j], temp_exp ); max_exp = add( s_max( COVls->xr_e[i][j], temp_exp ), 1 ); temp32_2 = L_shl( temp32_2, sub( COVls->xi_e[i][j], max_exp ) ); // exp:max_exp temp32_1 = L_shl( temp32_1, sub( temp_exp, max_exp ) ); // exp:max_exp temp32_1 = L_add( temp32_1, temp32_2 ); // exp:max_exp Loading Loading
lib_enc/ivas_mcmasa_enc_fx.c +30 −13 Original line number Diff line number Diff line Loading @@ -79,6 +79,7 @@ static void compute_cov_mtx_fx_16( 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 *sf_c, Word16 band_grouping[], int num_freq_bands, int *fb_map ); Loading Loading @@ -947,6 +948,7 @@ void ivas_mcmasa_param_est_enc_fx( #else RAM_ALIGN Word16 Chnl_RealImagBuffer_fx_16[MCMASA_MAX_ANA_CHANS][DIRAC_NO_FB_BANDS_MAX * 2]; Word16 mrange[2]; Word16 sf_c[MCMASA_MAX_ANA_CHANS]; #endif Word16 numSubFramesForRatio; CovarianceMatrix COVls[MASA_FREQUENCY_BANDS]; Loading Loading @@ -1092,9 +1094,19 @@ void ivas_mcmasa_param_est_enc_fx( FOR( i = 0; i < numAnalysisChannels; i++ ) { #ifdef FUNC_compute_cov_mtx_fx_16 Word16 scal_imag, scal_real; scal_imag = L_norm_arr( Chnl_ImagBuffer_fx[i], DIRAC_NO_FB_BANDS_MAX ); scal_real = L_norm_arr( Chnl_RealBuffer_fx[i], DIRAC_NO_FB_BANDS_MAX ); sf_c[i] = sub( s_min( scal_real, scal_imag ), 1 ); pcm_in[i] += l_ts; cr_q = s_min( cr_q, scal_imag ); ci_q = s_min( ci_q, scal_real ); #else pcm_in[i] += l_ts; cr_q = s_min( cr_q, L_norm_arr( Chnl_ImagBuffer_fx[i], DIRAC_NO_FB_BANDS_MAX ) ); ci_q = s_min( ci_q, L_norm_arr( Chnl_RealBuffer_fx[i], DIRAC_NO_FB_BANDS_MAX ) ); #endif } sf = sub( s_min( cr_q, ci_q ), 5 ); Loading @@ -1105,9 +1117,9 @@ void ivas_mcmasa_param_est_enc_fx( Word32 *re = Chnl_RealBuffer_fx[i]; /*in*/ Word32 *im = Chnl_ImagBuffer_fx[i]; /*in*/ Word16 *x = Chnl_RealImagBuffer_fx_16[i]; /*out*/ Word16 k; const Word16 lg = DIRAC_NO_FB_BANDS_MAX; const Word16 exp0 = add( sf, sfCorrection ); int k; const int lg = DIRAC_NO_FB_BANDS_MAX; const Word16 exp0 = add( sf_c[i], 0 ); if ( 0 == exp0 ) { Loading @@ -1127,11 +1139,12 @@ void ivas_mcmasa_param_est_enc_fx( scale_sig32( Chnl_RealBuffer_fx[i], DIRAC_NO_FB_BANDS_MAX, sf ); // Q-> inp_q + sf scale_sig32( Chnl_ImagBuffer_fx[i], DIRAC_NO_FB_BANDS_MAX, sf ); // Q-> inp_q + sf } inp_q = add( inp_q, sf ); /* Compute covariance matrix */ #ifdef FUNC_compute_cov_mtx_fx_16 compute_cov_mtx_fx_16( Chnl_RealImagBuffer_fx_16, numAnalysisChannels, COVls, sub( 31 + sfCorrection, inp_q ), hMcMasa->band_grouping, (int) num_freq_bands, fb_map ); /* Compute covariance matrix */ compute_cov_mtx_fx_16( Chnl_RealImagBuffer_fx_16, numAnalysisChannels, COVls, sub( 31, inp_q ), sf_c, hMcMasa->band_grouping, (int) num_freq_bands, fb_map ); inp_q = add( inp_q, sf ); FOR( i = 0; i < num_freq_bands; i++ ) { Loading Loading @@ -2174,6 +2187,7 @@ static void compute_cov_mtx_fx_16( const Word16 N, /* i : Number of channels */ CovarianceMatrix mCOVls[], /* o : Output matrix pointer, - upper part of cov mtx */ Word16 inp_exp, /*Stores exponent for temp*/ Word16 *sf_c, Word16 band_grouping[], int num_freq_bands, int *fb_map ) Loading @@ -2181,20 +2195,22 @@ static void compute_cov_mtx_fx_16( int i, j; Word32 temp32_1, temp32_2; Word16 tmp_16, max_exp; Word16 temp_exp = shl( inp_exp, 1 ); Word16 temp_exp; int freq; FOR( i = 0; i < N; i++ ) { FOR( j = i; j < N; j++ ) { temp_exp = add( sub( inp_exp, sf_c[i] ), sub( inp_exp, sf_c[j] ) ); FOR( freq = band_grouping[0]; freq < band_grouping[num_freq_bands]; freq++ ) { CovarianceMatrix *COVls = &( mCOVls[fb_map[freq]] ); // Ri(Rsre-Rs[0] *Rj(Rtre-Rt[0] + Ii(Rsim-Rs[1] * Ij(Rtim-Rt[1] temp32_1 = L_mac0( L_mult0( sri[i][freq << 1], sri[j][freq << 1] ), sri[i][( freq << 1 ) + 1], sri[j][( freq << 1 ) + 1] ); // exp:2*inp_exp temp32_2 = COVls->xr_fx[i][j]; // exp:COVls->xr_e[i][j] max_exp = s_max( COVls->xr_e[i][j], temp_exp ); max_exp = add( s_max( COVls->xr_e[i][j], temp_exp ), 1 ); temp32_2 = L_shl( temp32_2, sub( COVls->xr_e[i][j], max_exp ) ); // exp:max_exp temp32_1 = L_shl( temp32_1, sub( temp_exp, max_exp ) ); // exp:max_exp temp32_1 = L_add( temp32_1, temp32_2 ); // exp:max_exp Loading @@ -2205,9 +2221,10 @@ static void compute_cov_mtx_fx_16( move32(); move16(); // Ii(Rsim-Rs[1] * Rj(Rtre-Rt[0] - Ri(Rsre-Rs[0] * Ii(Rtim-Rt[1] temp32_1 = L_msu0( L_mult0( sri[i][( freq << 1 ) + 1], sri[j][freq << 1] ), sri[i][freq << 1], sri[j][( freq << 1 ) + 1] ); // exp :2*inp_exp temp32_2 = COVls->xi_fx[i][j]; // exp:COVls->xi_e[i][j] max_exp = s_max( COVls->xi_e[i][j], temp_exp ); max_exp = add( s_max( COVls->xr_e[i][j], temp_exp ), 1 ); temp32_2 = L_shl( temp32_2, sub( COVls->xi_e[i][j], max_exp ) ); // exp:max_exp temp32_1 = L_shl( temp32_1, sub( temp_exp, max_exp ) ); // exp:max_exp temp32_1 = L_add( temp32_1, temp32_2 ); // exp:max_exp Loading