Loading lib_com/ivas_dirac_com_fx.c +23 −66 Original line number Diff line number Diff line Loading @@ -793,109 +793,66 @@ void computeDiffuseness_fixed( ) { Word32 intensity_slow[DIRAC_NUM_DIMS * CLDFB_NO_CHANNELS_MAX]; Word16 intensity_slow_e[DIRAC_NUM_DIMS * CLDFB_NO_CHANNELS_MAX]; Word32 intensity_slow_abs[CLDFB_NO_CHANNELS_MAX]; Word64 intensity_slow_abs_64[CLDFB_NO_CHANNELS_MAX]; Word16 intensity_slow_abs_q[CLDFB_NO_CHANNELS_MAX]; Word32 energy_slow[CLDFB_NO_CHANNELS_MAX]; Word16 energy_slow_e[CLDFB_NO_CHANNELS_MAX]; Word16 i, j, k; Word32 tmp = 0; move32(); Word32 *p_tmp; const Word32 *p_tmp_c; Word16 min_q_shift1, min_q_shift2, exp1, exp2, q_tmp; Word16 exp1, exp2, q_tmp; Word16 q_ene, q_intensity; /* Compute Intensity slow and energy slow buffer_intensity and buffer_energy */ set_zero_fx( intensity_slow, i_mult( DIRAC_NUM_DIMS, CLDFB_NO_CHANNELS_MAX ) ); set_zero_fx( intensity_slow, ( DIRAC_NUM_DIMS * CLDFB_NO_CHANNELS_MAX ) ); set16_fx( intensity_slow_e, 0, ( DIRAC_NUM_DIMS * CLDFB_NO_CHANNELS_MAX ) ); set_zero_fx( intensity_slow_abs, CLDFB_NO_CHANNELS_MAX ); set_zero_fx( energy_slow, CLDFB_NO_CHANNELS_MAX ); /* Calculate max possible shift for the buffer buffer_energy and buffer_intensity */ min_q_shift1 = Q31; move16(); min_q_shift1 = s_min( min_q_shift1, getScaleFactor32( buffer_energy, i_mult( DIRAC_NO_COL_AVG_DIFF, num_freq_bands ) ) ); min_q_shift1 = sub( min_q_shift1, find_guarded_bits_fx( DIRAC_NO_COL_AVG_DIFF ) ); min_q_shift2 = Q31; move16(); FOR( i = 0; i < DIRAC_NUM_DIMS; i++ ) { FOR( j = 0; j < DIRAC_NO_COL_AVG_DIFF; j++ ) { min_q_shift2 = s_min( min_q_shift2, getScaleFactor32( buffer_intensity[i][j], num_freq_bands ) ); } } min_q_shift2 = sub( min_q_shift2, find_guarded_bits_fx( DIRAC_NO_COL_AVG_DIFF ) ); q_ene = add( q_factor_energy[0], min_q_shift1 ); move16(); q_intensity = add( q_factor_intensity[0], min_q_shift2 ); move16(); set16_fx( energy_slow_e, 0, CLDFB_NO_CHANNELS_MAX ); FOR( i = 0; i < DIRAC_NO_COL_AVG_DIFF; ++i ) { /* Energy slow */ p_tmp_c = buffer_energy + i * num_freq_bands; q_tmp = add( q_factor_energy[i], min_q_shift1 ); Word16 shift_q = sub( q_tmp, q_ene ); Word32 shiftEquiv = L_add( 0, 0 ); Word16 shift_qtotal; if ( shift_q < 0 ) { shiftEquiv = L_lshl( (Word32) 0x80000000, shift_q ); } if ( shift_q >= 0 ) { shiftEquiv = L_add( 0x7FFFFFFF, 0 ); } shift_qtotal = sub( min_q_shift1, s_max( shift_q, 0 ) ); FOR( k = 0; k < num_freq_bands; k++ ) { tmp = L_shl( p_tmp_c[k], shift_qtotal ); energy_slow[k] = Madd_32_32_r( tmp, energy_slow[k], shiftEquiv ); energy_slow[k] = BASOP_Util_Add_Mant32Exp( p_tmp_c[k], sub( 31, q_factor_energy[i] ), energy_slow[k], energy_slow_e[k], &energy_slow_e[k] ); move32(); } q_ene = s_min( q_ene, q_tmp ); /* Intensity slow */ q_tmp = add( q_factor_intensity[i], min_q_shift2 ); shift_q = sub( q_tmp, q_intensity ); if ( shift_q < 0 ) { shiftEquiv = L_lshl( (Word32) 0x80000000, shift_q ); } if ( shift_q >= 0 ) { shiftEquiv = L_lshl( 0x7FFFFFFF, 0 ); } shift_qtotal = sub( min_q_shift2, s_max( shift_q, 0 ) ); FOR( j = 0; j < DIRAC_NUM_DIMS; ++j ) { p_tmp = buffer_intensity[j][i]; FOR( k = 0; k < num_freq_bands; k++ ) { tmp = L_shl( p_tmp[k], shift_qtotal ); intensity_slow[j * num_freq_bands + k] = Madd_32_32_r( tmp, intensity_slow[j * num_freq_bands + k], shiftEquiv ); intensity_slow[j * num_freq_bands + k] = BASOP_Util_Add_Mant32Exp( p_tmp[k], sub( 31, q_factor_intensity[i] ), intensity_slow[j * num_freq_bands + k], intensity_slow_e[j * num_freq_bands + k], &intensity_slow_e[j * num_freq_bands + k] ); move32(); } } } Word16 max_e; maximum_fx( energy_slow_e, CLDFB_NO_CHANNELS_MAX, &max_e ); q_ene = sub( 31, max_e ); FOR( i = 0; i < CLDFB_NO_CHANNELS_MAX; i++ ) { energy_slow[i] = L_shr( energy_slow[i], sub( max_e, energy_slow_e[i] ) ); // scaling to q_ene move32(); } q_intensity = s_min( q_intensity, q_tmp ); maximum_fx( intensity_slow_e, DIRAC_NUM_DIMS * CLDFB_NO_CHANNELS_MAX, &max_e ); q_intensity = sub( 31, max_e ); FOR( i = 0; i < DIRAC_NUM_DIMS * num_freq_bands; i++ ) { intensity_slow[i] = L_shr( intensity_slow[i], sub( max_e, intensity_slow_e[i] ) ); // scaling to q_intensity move32(); } min_q_shift1 = getScaleFactor32( intensity_slow, i_mult( DIRAC_NUM_DIMS, num_freq_bands ) ); min_q_shift1 = sub( min_q_shift1, idiv1616( add( find_guarded_bits_fx( DIRAC_NUM_DIMS ), 1 ), 2 ) ); scale_sig32( intensity_slow, i_mult( DIRAC_NUM_DIMS, num_freq_bands ), min_q_shift1 ); q_intensity = add( q_intensity, min_q_shift1 ); FOR( k = 0; k < num_freq_bands; k++ ) { intensity_slow_abs_64[k] = 0; Loading lib_rend/ivas_dirac_ana_fx.c +54 −10 Original line number Diff line number Diff line Loading @@ -293,6 +293,7 @@ static void ivas_dirac_param_est_ana_fx( Word32 Foa_RealBuffer_fx[FOA_CHANNELS][CLDFB_NO_CHANNELS_MAX]; Word32 Foa_ImagBuffer_fx[FOA_CHANNELS][CLDFB_NO_CHANNELS_MAX]; Word32 intensity_real_fx[DIRAC_NUM_DIMS][MASA_FREQUENCY_BANDS]; Word16 intensity_real_q[MASA_FREQUENCY_BANDS]; Word32 direction_vector_fx[DIRAC_NUM_DIMS][MASA_FREQUENCY_BANDS]; Word32 diffuseness_vector_fx[MASA_FREQUENCY_BANDS]; Word32 diffuseness_m_fx[MASA_FREQUENCY_BANDS]; Loading @@ -308,6 +309,10 @@ static void ivas_dirac_param_est_ana_fx( Word16 numAnalysisChannels; Word16 inp_q; Word16 intensity_q, reference_power_q; Word16 temp_e, sf, scaled_data_q, s, shift = 31; move16(); Word32 temp; Word64 W_temp; num_freq_bands = hDirAC->nbands; /* l_ts = input_frame / CLDFB_NO_COL_MAX; */ l_ts = shr( input_frame, 4 ); Loading @@ -320,6 +325,16 @@ static void ivas_dirac_param_est_ana_fx( move16(); move16(); move16(); FOR( i = 0; i < numAnalysisChannels; i++ ) { shift = s_min( shift, L_norm_arr( data_fx[i], input_frame ) ); } shift = sub( shift, find_guarded_bits_fx( l_ts ) ); FOR( i = 0; i < numAnalysisChannels; i++ ) { scale_sig32( data_fx[i], input_frame, shift ); } scaled_data_q = add( data_q, shift ); /* do processing over all CLDFB time slots */ FOR( block_m_idx = 0; block_m_idx < MAX_PARAM_SPATIAL_SUBFRAMES; block_m_idx++ ) Loading Loading @@ -356,14 +371,14 @@ static void ivas_dirac_param_est_ana_fx( FOR( ts = mrange[0]; ts < mrange[1]; ts++ ) { Word16 cr_q = MAX_16, ci_q = MAX_16, sf, c_e; inp_q = data_q; // Input Q of data_fx Word16 cr_q = MAX_16, ci_q = MAX_16, c_e; inp_q = scaled_data_q; // Q of data_fx after scaling move16(); move16(); move16(); FOR( i = 0; i < numAnalysisChannels; i++ ) { inp_q = data_q; inp_q = scaled_data_q; move16(); cldfbAnalysis_ts_fx_var_q( &( data_fx[i][l_ts * ts] ), Foa_RealBuffer_fx[i], Foa_ImagBuffer_fx[i], l_ts, hDirAC->cldfbAnaEnc[i], &inp_q ); cr_q = s_min( cr_q, getScaleFactor32( Foa_RealBuffer_fx[i], l_ts ) ); Loading @@ -386,19 +401,38 @@ static void ivas_dirac_param_est_ana_fx( move16(); FOR( j = brange[0]; j < brange[1]; j++ ) { Word32 temp = L_add( Mult_32_32( Foa_RealBuffer_fx[0][j], Foa_RealBuffer_fx[0][j] ), Mult_32_32( Foa_ImagBuffer_fx[0][j], Foa_ImagBuffer_fx[0][j] ) ); // Q-> 2*inp_q - 31, e = 31 - (2*inp_q - 31) = 62 - 2*inp_q = 2*(31 - inp_q) = 2*c_e hDirAC->energy_fx[block_m_idx][band_m_idx] = BASOP_Util_Add_Mant32Exp( hDirAC->energy_fx[block_m_idx][band_m_idx], hDirAC->energy_e[block_m_idx][band_m_idx], temp, shl( c_e, 1 ), &hDirAC->energy_e[block_m_idx][band_m_idx] ); W_temp = W_mac_32_32( W_mult_32_32( Foa_RealBuffer_fx[0][j], Foa_RealBuffer_fx[0][j] ), Foa_ImagBuffer_fx[0][j], Foa_ImagBuffer_fx[0][j] ); // Q-> 2*inp_q + 1 sf = W_norm( W_temp ); temp = W_extract_h( W_shl( W_temp, sf ) ); // 2*inp_q + 1 + sf - 32 temp_e = sub( 63 - 1, add( shl( inp_q, 1 ), sf ) ); // 31 - ( 2 * inp_q + 1 + sf - 32 ) hDirAC->energy_fx[block_m_idx][band_m_idx] = BASOP_Util_Add_Mant32Exp( hDirAC->energy_fx[block_m_idx][band_m_idx], hDirAC->energy_e[block_m_idx][band_m_idx], temp, temp_e, &hDirAC->energy_e[block_m_idx][band_m_idx] ); move32(); } } /* Direction estimation */ computeIntensityVector_ana_fx( hDirAC->band_grouping, Foa_RealBuffer_fx, Foa_ImagBuffer_fx, num_freq_bands, intensity_real_fx ); /* Q intensity_real_fx = 2*inp_q-31, e = 31 - 2*inp_q + 31 = 62 - 2*inp_q = 2*(31-inp_q)=2*c_e */ intensity_q = sub( 31, shl( c_e, 1 ) ); computeIntensityVector_ana_fx( hDirAC->band_grouping, Foa_RealBuffer_fx, Foa_ImagBuffer_fx, num_freq_bands, intensity_real_fx, intensity_real_q, inp_q ); computeDirectionVectors_fixed( intensity_real_fx[0], intensity_real_fx[1], intensity_real_fx[2], 0, num_freq_bands, direction_vector_fx[0], direction_vector_fx[1], direction_vector_fx[2], 0, intensity_real_q ); computeDirectionVectors_fixed( intensity_real_fx[0], intensity_real_fx[1], intensity_real_fx[2], 0, num_freq_bands, direction_vector_fx[0], direction_vector_fx[1], direction_vector_fx[2], shl( c_e, 1 ), NULL ); /* Power estimation for diffuseness */ computeReferencePower_ana_fx( hDirAC->band_grouping, Foa_RealBuffer_fx, Foa_ImagBuffer_fx, reference_power_fx[ts], num_freq_bands ); //( 2 * ( scale_fact - Q1 ) - 31 - 1 ); // computeReferencePower_ana( hDirAC->band_grouping, Foa_RealBuffer, Foa_ImagBuffer, reference_power[ts], num_freq_bands ); computeReferencePower_ana_fx( hDirAC->band_grouping, Foa_RealBuffer_fx, Foa_ImagBuffer_fx, reference_power_fx[ts], num_freq_bands ); //( 2 * ( scale_fact - Q1 ) - 31 - 1 ); reference_power_q = sub( shl( inp_q, 1 ), 30 ); /* Aligning intensity_real to a common Q-factor */ minimum_fx( intensity_real_q, num_freq_bands, &intensity_q ); Word16 tmp; FOR( i = 0; i < num_freq_bands; i++ ) { tmp = sub( intensity_q, intensity_real_q[i] ); intensity_real_fx[0][i] = L_shl( intensity_real_fx[0][i], tmp ); move32(); intensity_real_fx[1][i] = L_shl( intensity_real_fx[1][i], tmp ); move32(); intensity_real_fx[2][i] = L_shl( intensity_real_fx[2][i], tmp ); move32(); } /* Fill buffers of length "averaging_length" time slots for intensity and energy */ hDirAC->index_buffer_intensity = add( ( hDirAC->index_buffer_intensity % DIRAC_NO_COL_AVG_DIFF ), 1 ); /* averaging_length = 32 */ move16(); Loading Loading @@ -426,7 +460,13 @@ static void ivas_dirac_param_est_ana_fx( move32(); hDirAC->direction_vector_m_fx[2][block_m_idx][band_m_idx] = BASOP_Util_Add_Mant32Exp( hDirAC->direction_vector_m_fx[2][block_m_idx][band_m_idx], hDirAC->direction_vector_e[2][block_m_idx][band_m_idx], Mult_32_32( norm_tmp_fx, direction_vector_fx[2][band_m_idx] ), shl( c_e, 1 ), &hDirAC->direction_vector_e[2][block_m_idx][band_m_idx] ); move32(); diffuseness_m_fx[band_m_idx] = BASOP_Util_Add_Mant32Exp( diffuseness_m_fx[band_m_idx], diffuseness_e[band_m_idx], L_shl( Mult_32_32( reference_power_fx[ts][band_m_idx], diffuseness_vector_fx[band_m_idx] ), 1 ), sub( shl( c_e, 1 ), 1 ), &diffuseness_e[band_m_idx] ); W_temp = W_mult0_32_32( reference_power_fx[ts][band_m_idx], diffuseness_vector_fx[band_m_idx] ); s = W_norm( W_temp ); temp = W_extract_h( W_shl( W_temp, s ) ); temp_e = sub( 63, add( add( reference_power_q, diffuseness_q ), s ) ); // 31 - ( reference_power_q + diffuseness_q + s - 32 ) diffuseness_m_fx[band_m_idx] = BASOP_Util_Add_Mant32Exp( diffuseness_m_fx[band_m_idx], diffuseness_e[band_m_idx], temp, temp_e, &diffuseness_e[band_m_idx] ); move32(); renormalization_factor_diff_fx[band_m_idx] = BASOP_Util_Add_Mant32Exp( renormalization_factor_diff_fx[band_m_idx], renormalization_factor_diff_e[band_m_idx], reference_power_fx[ts][band_m_idx], sub( shl( c_e, 1 ), 1 ), &renormalization_factor_diff_e[band_m_idx] ); Loading Loading @@ -479,6 +519,10 @@ static void ivas_dirac_param_est_ana_fx( } } FOR( i = 0; i < numAnalysisChannels; i++ ) { scale_sig32( data_fx[i], input_frame, negate( shift ) ); } return; } Loading lib_rend/ivas_mcmasa_ana_fx.c +83 −21 File changed.Preview size limit exceeded, changes collapsed. Show changes lib_rend/ivas_omasa_ana_fx.c +68 −19 Original line number Diff line number Diff line Loading @@ -362,6 +362,7 @@ static void ivas_omasa_param_est_ana_fx( Word32 Foa_RealBuffer_fx[FOA_CHANNELS][CLDFB_NO_CHANNELS_MAX]; Word32 Foa_ImagBuffer_fx[FOA_CHANNELS][CLDFB_NO_CHANNELS_MAX]; Word32 intensity_real_fx[DIRAC_NUM_DIMS][MASA_FREQUENCY_BANDS]; Word16 intensity_real_q[MASA_FREQUENCY_BANDS]; Word32 direction_vector_fx[DIRAC_NUM_DIMS][MASA_FREQUENCY_BANDS]; Word32 diffuseness_vector_fx[MASA_FREQUENCY_BANDS]; Word16 diffuseness_q = 0; Loading Loading @@ -523,15 +524,29 @@ static void ivas_omasa_param_est_ana_fx( v_multc_acc_32_32( Chnl_RealBuffer_fx[i], hOMasa->chnlToFoaMtx_fx[3][i], Foa_RealBuffer_fx[3], num_freq_bins ); // Q: Chnl_RealBuffer_q v_multc_acc_32_32( Chnl_ImagBuffer_fx[i], hOMasa->chnlToFoaMtx_fx[3][i], Foa_ImagBuffer_fx[3], num_freq_bins ); // Q: Chnl_ImagBuffer_q } computeIntensityVector_ana_fx( hOMasa->band_grouping, Foa_RealBuffer_fx, Foa_ImagBuffer_fx, num_freq_bands, intensity_real_fx ); /* Q intensity_real_fx = 2*inp_q-31, e = 31 - 2*inp_q + 31 = 62 - 2*inp_q = 2*(31-inp_q)=2*c_e */ intensity_q = sub( 31, shl( c_e, 1 ) ); computeIntensityVector_ana_fx( hOMasa->band_grouping, Foa_RealBuffer_fx, Foa_ImagBuffer_fx, num_freq_bands, intensity_real_fx, intensity_real_q, inp_q ); computeDirectionVectors_fixed( intensity_real_fx[0], intensity_real_fx[1], intensity_real_fx[2], 0, num_freq_bands, direction_vector_fx[0], direction_vector_fx[1], direction_vector_fx[2], shl( c_e, 1 ), NULL ); /* Q direction_vector_fx = Q30*/ computeDirectionVectors_fixed( intensity_real_fx[0], intensity_real_fx[1], intensity_real_fx[2], 0, num_freq_bands, direction_vector_fx[0], direction_vector_fx[1], direction_vector_fx[2], 0, intensity_real_q ); /* Q direction_vector_fx = Q30*/ /* Power estimation for diffuseness */ computeReferencePower_ana_fx( hOMasa->band_grouping, Foa_RealBuffer_fx, Foa_ImagBuffer_fx, reference_power_fx[ts], num_freq_bands ); // 2 * inputq - 30 reference_power_q = sub( shl( inp_q, 1 ), 30 ); /* Aligning intensity_real to a common Q-factor */ minimum_fx( intensity_real_q, num_freq_bands, &intensity_q ); Word16 tmp; FOR( i = 0; i < num_freq_bands; i++ ) { tmp = sub( intensity_q, intensity_real_q[i] ); intensity_real_fx[0][i] = L_shl( intensity_real_fx[0][i], tmp ); move32(); intensity_real_fx[1][i] = L_shl( intensity_real_fx[1][i], tmp ); move32(); intensity_real_fx[2][i] = L_shl( intensity_real_fx[2][i], tmp ); move32(); } /* Fill buffers of length "averaging_length" time slots for intensity and energy */ hOMasa->index_buffer_intensity = add( ( hOMasa->index_buffer_intensity % DIRAC_NO_COL_AVG_DIFF ), 1 ); /* averaging_length = 32 */ move16(); Loading Loading @@ -761,8 +776,9 @@ void computeIntensityVector_ana_fx( Word32 Cldfb_RealBuffer[FOA_CHANNELS][CLDFB_NO_CHANNELS_MAX], /* i : Real part of input signal Qx */ Word32 Cldfb_ImagBuffer[FOA_CHANNELS][CLDFB_NO_CHANNELS_MAX], /* i : Imag part of input sig Qx */ const Word16 num_frequency_bands, /* i : Number of frequency bands */ Word32 intensity_real[DIRAC_NUM_DIMS][MASA_FREQUENCY_BANDS] /* o : Intensity 2 * Qx -31 */ ) Word32 intensity_real[DIRAC_NUM_DIMS][MASA_FREQUENCY_BANDS], /* o : Intensity */ Word16 q_intensity_real[MASA_FREQUENCY_BANDS], Word16 inp_q ) { /* Reminder * X = a + ib; Y = c + id Loading @@ -771,33 +787,66 @@ void computeIntensityVector_ana_fx( Word16 i, j; Word32 real, img; Word16 brange[2]; Word16 shift_value = add( shl( inp_q, 1 ), 1 ); Word16 tmp_norm; FOR( i = 0; i < num_frequency_bands; i++ ) { brange[0] = band_grouping[i]; move16(); brange[1] = band_grouping[i + 1]; move16(); Word16 num_bins = sub( brange[1], brange[0] ); Word16 gb = find_guarded_bits_fx( num_bins ); Word16 norm; intensity_real[0][i] = 0; move32(); intensity_real[1][i] = 0; move32(); intensity_real[2][i] = 0; move32(); Word64 tmp_1 = 0, tmp_2 = 0, tmp_3 = 0; move64(); move64(); move64(); FOR( j = brange[0]; j < brange[1]; j++ ) { real = Cldfb_RealBuffer[0][j]; // Qx img = Cldfb_ImagBuffer[0][j]; // Qx /* Intensity is XYZ order, audio is WYZX order. */ intensity_real[0][i] = L_add( intensity_real[0][i], L_add( Mpy_32_32( Cldfb_RealBuffer[3][j], real ), Mpy_32_32( Cldfb_ImagBuffer[3][j], img ) ) ); // output Q = 2 * Qx -31 move32(); intensity_real[1][i] = L_add( intensity_real[1][i], L_add( Mpy_32_32( Cldfb_RealBuffer[1][j], real ), Mpy_32_32( Cldfb_ImagBuffer[1][j], img ) ) ); // output Q = 2 * Qx -31 real = Cldfb_RealBuffer[0][j]; move32(); intensity_real[2][i] = L_add( intensity_real[2][i], L_add( Mpy_32_32( Cldfb_RealBuffer[2][j], real ), Mpy_32_32( Cldfb_ImagBuffer[2][j], img ) ) ); // output Q = 2 * Qx -31 img = Cldfb_ImagBuffer[0][j]; move32(); Word64 t1, t2, t3; t1 = W_mac_32_32( W_mult_32_32( Cldfb_RealBuffer[3][j], real ), Cldfb_ImagBuffer[3][j], img ); /* 2 * q_cldfb + 1 */ t2 = W_mac_32_32( W_mult_32_32( Cldfb_RealBuffer[1][j], real ), Cldfb_ImagBuffer[1][j], img ); /* 2 * q_cldfb + 1 */ t3 = W_mac_32_32( W_mult_32_32( Cldfb_RealBuffer[2][j], real ), Cldfb_ImagBuffer[2][j], img ); /* 2 * q_cldfb + 1 */ t1 = W_shr( t1, gb ); t2 = W_shr( t2, gb ); t3 = W_shr( t3, gb ); /* Intensity is XYZ order, audio is WYZX order. */ tmp_1 = W_add( tmp_1, t1 ); /* 2 * q_cldfb + 1 */ tmp_2 = W_add( tmp_2, t2 ); /* 2 * q_cldfb + 1 */ tmp_3 = W_add( tmp_3, t3 ); /* 2 * q_cldfb + 1 */ } norm = 63; move16(); IF( tmp_1 != 0 ) { tmp_norm = W_norm( tmp_1 ); norm = s_min( norm, tmp_norm ); } IF( tmp_2 != 0 ) { tmp_norm = W_norm( tmp_2 ); norm = s_min( norm, tmp_norm ); } IF( tmp_3 != 0 ) { tmp_norm = W_norm( tmp_3 ); norm = s_min( norm, tmp_norm ); } norm = sub( norm, 32 ); intensity_real[0][i] = W_shl_sat_l( tmp_1, norm ); // shift_value - (gb - norm) move32(); intensity_real[1][i] = W_shl_sat_l( tmp_2, norm ); // shift_value - (gb - norm) move32(); intensity_real[2][i] = W_shl_sat_l( tmp_3, norm ); // shift_value - (gb - norm) q_intensity_real[i] = sub( shift_value, sub( gb, norm ) ); move16(); } return; Loading lib_rend/ivas_prot_rend_fx.h +7 −6 Original line number Diff line number Diff line Loading @@ -1430,10 +1430,11 @@ void ivas_omasa_ana_close( void computeIntensityVector_ana_fx( const Word16 *band_grouping, /* i : Band grouping for estimation */ Word32 Cldfb_RealBuffer[FOA_CHANNELS][CLDFB_NO_CHANNELS_MAX], /* i : Real part of input signal Qx */ Word32 Cldfb_ImagBuffer[FOA_CHANNELS][CLDFB_NO_CHANNELS_MAX], /* i : Imag part of input signal Qx */ Word32 Cldfb_ImagBuffer[FOA_CHANNELS][CLDFB_NO_CHANNELS_MAX], /* i : Imag part of input sig Qx */ const Word16 num_frequency_bands, /* i : Number of frequency bands */ Word32 intensity_real[DIRAC_NUM_DIMS][MASA_FREQUENCY_BANDS] /* o : Intensity vector 2 * Qx -31 */ ); Word32 intensity_real[DIRAC_NUM_DIMS][MASA_FREQUENCY_BANDS], /* o : Intensity */ Word16 q_intensity_real[MASA_FREQUENCY_BANDS], Word16 inp_q ); void computeReferencePower_ana_fx( const Word16 *band_grouping, /* i : Band grouping for estimation */ Loading Loading
lib_com/ivas_dirac_com_fx.c +23 −66 Original line number Diff line number Diff line Loading @@ -793,109 +793,66 @@ void computeDiffuseness_fixed( ) { Word32 intensity_slow[DIRAC_NUM_DIMS * CLDFB_NO_CHANNELS_MAX]; Word16 intensity_slow_e[DIRAC_NUM_DIMS * CLDFB_NO_CHANNELS_MAX]; Word32 intensity_slow_abs[CLDFB_NO_CHANNELS_MAX]; Word64 intensity_slow_abs_64[CLDFB_NO_CHANNELS_MAX]; Word16 intensity_slow_abs_q[CLDFB_NO_CHANNELS_MAX]; Word32 energy_slow[CLDFB_NO_CHANNELS_MAX]; Word16 energy_slow_e[CLDFB_NO_CHANNELS_MAX]; Word16 i, j, k; Word32 tmp = 0; move32(); Word32 *p_tmp; const Word32 *p_tmp_c; Word16 min_q_shift1, min_q_shift2, exp1, exp2, q_tmp; Word16 exp1, exp2, q_tmp; Word16 q_ene, q_intensity; /* Compute Intensity slow and energy slow buffer_intensity and buffer_energy */ set_zero_fx( intensity_slow, i_mult( DIRAC_NUM_DIMS, CLDFB_NO_CHANNELS_MAX ) ); set_zero_fx( intensity_slow, ( DIRAC_NUM_DIMS * CLDFB_NO_CHANNELS_MAX ) ); set16_fx( intensity_slow_e, 0, ( DIRAC_NUM_DIMS * CLDFB_NO_CHANNELS_MAX ) ); set_zero_fx( intensity_slow_abs, CLDFB_NO_CHANNELS_MAX ); set_zero_fx( energy_slow, CLDFB_NO_CHANNELS_MAX ); /* Calculate max possible shift for the buffer buffer_energy and buffer_intensity */ min_q_shift1 = Q31; move16(); min_q_shift1 = s_min( min_q_shift1, getScaleFactor32( buffer_energy, i_mult( DIRAC_NO_COL_AVG_DIFF, num_freq_bands ) ) ); min_q_shift1 = sub( min_q_shift1, find_guarded_bits_fx( DIRAC_NO_COL_AVG_DIFF ) ); min_q_shift2 = Q31; move16(); FOR( i = 0; i < DIRAC_NUM_DIMS; i++ ) { FOR( j = 0; j < DIRAC_NO_COL_AVG_DIFF; j++ ) { min_q_shift2 = s_min( min_q_shift2, getScaleFactor32( buffer_intensity[i][j], num_freq_bands ) ); } } min_q_shift2 = sub( min_q_shift2, find_guarded_bits_fx( DIRAC_NO_COL_AVG_DIFF ) ); q_ene = add( q_factor_energy[0], min_q_shift1 ); move16(); q_intensity = add( q_factor_intensity[0], min_q_shift2 ); move16(); set16_fx( energy_slow_e, 0, CLDFB_NO_CHANNELS_MAX ); FOR( i = 0; i < DIRAC_NO_COL_AVG_DIFF; ++i ) { /* Energy slow */ p_tmp_c = buffer_energy + i * num_freq_bands; q_tmp = add( q_factor_energy[i], min_q_shift1 ); Word16 shift_q = sub( q_tmp, q_ene ); Word32 shiftEquiv = L_add( 0, 0 ); Word16 shift_qtotal; if ( shift_q < 0 ) { shiftEquiv = L_lshl( (Word32) 0x80000000, shift_q ); } if ( shift_q >= 0 ) { shiftEquiv = L_add( 0x7FFFFFFF, 0 ); } shift_qtotal = sub( min_q_shift1, s_max( shift_q, 0 ) ); FOR( k = 0; k < num_freq_bands; k++ ) { tmp = L_shl( p_tmp_c[k], shift_qtotal ); energy_slow[k] = Madd_32_32_r( tmp, energy_slow[k], shiftEquiv ); energy_slow[k] = BASOP_Util_Add_Mant32Exp( p_tmp_c[k], sub( 31, q_factor_energy[i] ), energy_slow[k], energy_slow_e[k], &energy_slow_e[k] ); move32(); } q_ene = s_min( q_ene, q_tmp ); /* Intensity slow */ q_tmp = add( q_factor_intensity[i], min_q_shift2 ); shift_q = sub( q_tmp, q_intensity ); if ( shift_q < 0 ) { shiftEquiv = L_lshl( (Word32) 0x80000000, shift_q ); } if ( shift_q >= 0 ) { shiftEquiv = L_lshl( 0x7FFFFFFF, 0 ); } shift_qtotal = sub( min_q_shift2, s_max( shift_q, 0 ) ); FOR( j = 0; j < DIRAC_NUM_DIMS; ++j ) { p_tmp = buffer_intensity[j][i]; FOR( k = 0; k < num_freq_bands; k++ ) { tmp = L_shl( p_tmp[k], shift_qtotal ); intensity_slow[j * num_freq_bands + k] = Madd_32_32_r( tmp, intensity_slow[j * num_freq_bands + k], shiftEquiv ); intensity_slow[j * num_freq_bands + k] = BASOP_Util_Add_Mant32Exp( p_tmp[k], sub( 31, q_factor_intensity[i] ), intensity_slow[j * num_freq_bands + k], intensity_slow_e[j * num_freq_bands + k], &intensity_slow_e[j * num_freq_bands + k] ); move32(); } } } Word16 max_e; maximum_fx( energy_slow_e, CLDFB_NO_CHANNELS_MAX, &max_e ); q_ene = sub( 31, max_e ); FOR( i = 0; i < CLDFB_NO_CHANNELS_MAX; i++ ) { energy_slow[i] = L_shr( energy_slow[i], sub( max_e, energy_slow_e[i] ) ); // scaling to q_ene move32(); } q_intensity = s_min( q_intensity, q_tmp ); maximum_fx( intensity_slow_e, DIRAC_NUM_DIMS * CLDFB_NO_CHANNELS_MAX, &max_e ); q_intensity = sub( 31, max_e ); FOR( i = 0; i < DIRAC_NUM_DIMS * num_freq_bands; i++ ) { intensity_slow[i] = L_shr( intensity_slow[i], sub( max_e, intensity_slow_e[i] ) ); // scaling to q_intensity move32(); } min_q_shift1 = getScaleFactor32( intensity_slow, i_mult( DIRAC_NUM_DIMS, num_freq_bands ) ); min_q_shift1 = sub( min_q_shift1, idiv1616( add( find_guarded_bits_fx( DIRAC_NUM_DIMS ), 1 ), 2 ) ); scale_sig32( intensity_slow, i_mult( DIRAC_NUM_DIMS, num_freq_bands ), min_q_shift1 ); q_intensity = add( q_intensity, min_q_shift1 ); FOR( k = 0; k < num_freq_bands; k++ ) { intensity_slow_abs_64[k] = 0; Loading
lib_rend/ivas_dirac_ana_fx.c +54 −10 Original line number Diff line number Diff line Loading @@ -293,6 +293,7 @@ static void ivas_dirac_param_est_ana_fx( Word32 Foa_RealBuffer_fx[FOA_CHANNELS][CLDFB_NO_CHANNELS_MAX]; Word32 Foa_ImagBuffer_fx[FOA_CHANNELS][CLDFB_NO_CHANNELS_MAX]; Word32 intensity_real_fx[DIRAC_NUM_DIMS][MASA_FREQUENCY_BANDS]; Word16 intensity_real_q[MASA_FREQUENCY_BANDS]; Word32 direction_vector_fx[DIRAC_NUM_DIMS][MASA_FREQUENCY_BANDS]; Word32 diffuseness_vector_fx[MASA_FREQUENCY_BANDS]; Word32 diffuseness_m_fx[MASA_FREQUENCY_BANDS]; Loading @@ -308,6 +309,10 @@ static void ivas_dirac_param_est_ana_fx( Word16 numAnalysisChannels; Word16 inp_q; Word16 intensity_q, reference_power_q; Word16 temp_e, sf, scaled_data_q, s, shift = 31; move16(); Word32 temp; Word64 W_temp; num_freq_bands = hDirAC->nbands; /* l_ts = input_frame / CLDFB_NO_COL_MAX; */ l_ts = shr( input_frame, 4 ); Loading @@ -320,6 +325,16 @@ static void ivas_dirac_param_est_ana_fx( move16(); move16(); move16(); FOR( i = 0; i < numAnalysisChannels; i++ ) { shift = s_min( shift, L_norm_arr( data_fx[i], input_frame ) ); } shift = sub( shift, find_guarded_bits_fx( l_ts ) ); FOR( i = 0; i < numAnalysisChannels; i++ ) { scale_sig32( data_fx[i], input_frame, shift ); } scaled_data_q = add( data_q, shift ); /* do processing over all CLDFB time slots */ FOR( block_m_idx = 0; block_m_idx < MAX_PARAM_SPATIAL_SUBFRAMES; block_m_idx++ ) Loading Loading @@ -356,14 +371,14 @@ static void ivas_dirac_param_est_ana_fx( FOR( ts = mrange[0]; ts < mrange[1]; ts++ ) { Word16 cr_q = MAX_16, ci_q = MAX_16, sf, c_e; inp_q = data_q; // Input Q of data_fx Word16 cr_q = MAX_16, ci_q = MAX_16, c_e; inp_q = scaled_data_q; // Q of data_fx after scaling move16(); move16(); move16(); FOR( i = 0; i < numAnalysisChannels; i++ ) { inp_q = data_q; inp_q = scaled_data_q; move16(); cldfbAnalysis_ts_fx_var_q( &( data_fx[i][l_ts * ts] ), Foa_RealBuffer_fx[i], Foa_ImagBuffer_fx[i], l_ts, hDirAC->cldfbAnaEnc[i], &inp_q ); cr_q = s_min( cr_q, getScaleFactor32( Foa_RealBuffer_fx[i], l_ts ) ); Loading @@ -386,19 +401,38 @@ static void ivas_dirac_param_est_ana_fx( move16(); FOR( j = brange[0]; j < brange[1]; j++ ) { Word32 temp = L_add( Mult_32_32( Foa_RealBuffer_fx[0][j], Foa_RealBuffer_fx[0][j] ), Mult_32_32( Foa_ImagBuffer_fx[0][j], Foa_ImagBuffer_fx[0][j] ) ); // Q-> 2*inp_q - 31, e = 31 - (2*inp_q - 31) = 62 - 2*inp_q = 2*(31 - inp_q) = 2*c_e hDirAC->energy_fx[block_m_idx][band_m_idx] = BASOP_Util_Add_Mant32Exp( hDirAC->energy_fx[block_m_idx][band_m_idx], hDirAC->energy_e[block_m_idx][band_m_idx], temp, shl( c_e, 1 ), &hDirAC->energy_e[block_m_idx][band_m_idx] ); W_temp = W_mac_32_32( W_mult_32_32( Foa_RealBuffer_fx[0][j], Foa_RealBuffer_fx[0][j] ), Foa_ImagBuffer_fx[0][j], Foa_ImagBuffer_fx[0][j] ); // Q-> 2*inp_q + 1 sf = W_norm( W_temp ); temp = W_extract_h( W_shl( W_temp, sf ) ); // 2*inp_q + 1 + sf - 32 temp_e = sub( 63 - 1, add( shl( inp_q, 1 ), sf ) ); // 31 - ( 2 * inp_q + 1 + sf - 32 ) hDirAC->energy_fx[block_m_idx][band_m_idx] = BASOP_Util_Add_Mant32Exp( hDirAC->energy_fx[block_m_idx][band_m_idx], hDirAC->energy_e[block_m_idx][band_m_idx], temp, temp_e, &hDirAC->energy_e[block_m_idx][band_m_idx] ); move32(); } } /* Direction estimation */ computeIntensityVector_ana_fx( hDirAC->band_grouping, Foa_RealBuffer_fx, Foa_ImagBuffer_fx, num_freq_bands, intensity_real_fx ); /* Q intensity_real_fx = 2*inp_q-31, e = 31 - 2*inp_q + 31 = 62 - 2*inp_q = 2*(31-inp_q)=2*c_e */ intensity_q = sub( 31, shl( c_e, 1 ) ); computeIntensityVector_ana_fx( hDirAC->band_grouping, Foa_RealBuffer_fx, Foa_ImagBuffer_fx, num_freq_bands, intensity_real_fx, intensity_real_q, inp_q ); computeDirectionVectors_fixed( intensity_real_fx[0], intensity_real_fx[1], intensity_real_fx[2], 0, num_freq_bands, direction_vector_fx[0], direction_vector_fx[1], direction_vector_fx[2], 0, intensity_real_q ); computeDirectionVectors_fixed( intensity_real_fx[0], intensity_real_fx[1], intensity_real_fx[2], 0, num_freq_bands, direction_vector_fx[0], direction_vector_fx[1], direction_vector_fx[2], shl( c_e, 1 ), NULL ); /* Power estimation for diffuseness */ computeReferencePower_ana_fx( hDirAC->band_grouping, Foa_RealBuffer_fx, Foa_ImagBuffer_fx, reference_power_fx[ts], num_freq_bands ); //( 2 * ( scale_fact - Q1 ) - 31 - 1 ); // computeReferencePower_ana( hDirAC->band_grouping, Foa_RealBuffer, Foa_ImagBuffer, reference_power[ts], num_freq_bands ); computeReferencePower_ana_fx( hDirAC->band_grouping, Foa_RealBuffer_fx, Foa_ImagBuffer_fx, reference_power_fx[ts], num_freq_bands ); //( 2 * ( scale_fact - Q1 ) - 31 - 1 ); reference_power_q = sub( shl( inp_q, 1 ), 30 ); /* Aligning intensity_real to a common Q-factor */ minimum_fx( intensity_real_q, num_freq_bands, &intensity_q ); Word16 tmp; FOR( i = 0; i < num_freq_bands; i++ ) { tmp = sub( intensity_q, intensity_real_q[i] ); intensity_real_fx[0][i] = L_shl( intensity_real_fx[0][i], tmp ); move32(); intensity_real_fx[1][i] = L_shl( intensity_real_fx[1][i], tmp ); move32(); intensity_real_fx[2][i] = L_shl( intensity_real_fx[2][i], tmp ); move32(); } /* Fill buffers of length "averaging_length" time slots for intensity and energy */ hDirAC->index_buffer_intensity = add( ( hDirAC->index_buffer_intensity % DIRAC_NO_COL_AVG_DIFF ), 1 ); /* averaging_length = 32 */ move16(); Loading Loading @@ -426,7 +460,13 @@ static void ivas_dirac_param_est_ana_fx( move32(); hDirAC->direction_vector_m_fx[2][block_m_idx][band_m_idx] = BASOP_Util_Add_Mant32Exp( hDirAC->direction_vector_m_fx[2][block_m_idx][band_m_idx], hDirAC->direction_vector_e[2][block_m_idx][band_m_idx], Mult_32_32( norm_tmp_fx, direction_vector_fx[2][band_m_idx] ), shl( c_e, 1 ), &hDirAC->direction_vector_e[2][block_m_idx][band_m_idx] ); move32(); diffuseness_m_fx[band_m_idx] = BASOP_Util_Add_Mant32Exp( diffuseness_m_fx[band_m_idx], diffuseness_e[band_m_idx], L_shl( Mult_32_32( reference_power_fx[ts][band_m_idx], diffuseness_vector_fx[band_m_idx] ), 1 ), sub( shl( c_e, 1 ), 1 ), &diffuseness_e[band_m_idx] ); W_temp = W_mult0_32_32( reference_power_fx[ts][band_m_idx], diffuseness_vector_fx[band_m_idx] ); s = W_norm( W_temp ); temp = W_extract_h( W_shl( W_temp, s ) ); temp_e = sub( 63, add( add( reference_power_q, diffuseness_q ), s ) ); // 31 - ( reference_power_q + diffuseness_q + s - 32 ) diffuseness_m_fx[band_m_idx] = BASOP_Util_Add_Mant32Exp( diffuseness_m_fx[band_m_idx], diffuseness_e[band_m_idx], temp, temp_e, &diffuseness_e[band_m_idx] ); move32(); renormalization_factor_diff_fx[band_m_idx] = BASOP_Util_Add_Mant32Exp( renormalization_factor_diff_fx[band_m_idx], renormalization_factor_diff_e[band_m_idx], reference_power_fx[ts][band_m_idx], sub( shl( c_e, 1 ), 1 ), &renormalization_factor_diff_e[band_m_idx] ); Loading Loading @@ -479,6 +519,10 @@ static void ivas_dirac_param_est_ana_fx( } } FOR( i = 0; i < numAnalysisChannels; i++ ) { scale_sig32( data_fx[i], input_frame, negate( shift ) ); } return; } Loading
lib_rend/ivas_mcmasa_ana_fx.c +83 −21 File changed.Preview size limit exceeded, changes collapsed. Show changes
lib_rend/ivas_omasa_ana_fx.c +68 −19 Original line number Diff line number Diff line Loading @@ -362,6 +362,7 @@ static void ivas_omasa_param_est_ana_fx( Word32 Foa_RealBuffer_fx[FOA_CHANNELS][CLDFB_NO_CHANNELS_MAX]; Word32 Foa_ImagBuffer_fx[FOA_CHANNELS][CLDFB_NO_CHANNELS_MAX]; Word32 intensity_real_fx[DIRAC_NUM_DIMS][MASA_FREQUENCY_BANDS]; Word16 intensity_real_q[MASA_FREQUENCY_BANDS]; Word32 direction_vector_fx[DIRAC_NUM_DIMS][MASA_FREQUENCY_BANDS]; Word32 diffuseness_vector_fx[MASA_FREQUENCY_BANDS]; Word16 diffuseness_q = 0; Loading Loading @@ -523,15 +524,29 @@ static void ivas_omasa_param_est_ana_fx( v_multc_acc_32_32( Chnl_RealBuffer_fx[i], hOMasa->chnlToFoaMtx_fx[3][i], Foa_RealBuffer_fx[3], num_freq_bins ); // Q: Chnl_RealBuffer_q v_multc_acc_32_32( Chnl_ImagBuffer_fx[i], hOMasa->chnlToFoaMtx_fx[3][i], Foa_ImagBuffer_fx[3], num_freq_bins ); // Q: Chnl_ImagBuffer_q } computeIntensityVector_ana_fx( hOMasa->band_grouping, Foa_RealBuffer_fx, Foa_ImagBuffer_fx, num_freq_bands, intensity_real_fx ); /* Q intensity_real_fx = 2*inp_q-31, e = 31 - 2*inp_q + 31 = 62 - 2*inp_q = 2*(31-inp_q)=2*c_e */ intensity_q = sub( 31, shl( c_e, 1 ) ); computeIntensityVector_ana_fx( hOMasa->band_grouping, Foa_RealBuffer_fx, Foa_ImagBuffer_fx, num_freq_bands, intensity_real_fx, intensity_real_q, inp_q ); computeDirectionVectors_fixed( intensity_real_fx[0], intensity_real_fx[1], intensity_real_fx[2], 0, num_freq_bands, direction_vector_fx[0], direction_vector_fx[1], direction_vector_fx[2], shl( c_e, 1 ), NULL ); /* Q direction_vector_fx = Q30*/ computeDirectionVectors_fixed( intensity_real_fx[0], intensity_real_fx[1], intensity_real_fx[2], 0, num_freq_bands, direction_vector_fx[0], direction_vector_fx[1], direction_vector_fx[2], 0, intensity_real_q ); /* Q direction_vector_fx = Q30*/ /* Power estimation for diffuseness */ computeReferencePower_ana_fx( hOMasa->band_grouping, Foa_RealBuffer_fx, Foa_ImagBuffer_fx, reference_power_fx[ts], num_freq_bands ); // 2 * inputq - 30 reference_power_q = sub( shl( inp_q, 1 ), 30 ); /* Aligning intensity_real to a common Q-factor */ minimum_fx( intensity_real_q, num_freq_bands, &intensity_q ); Word16 tmp; FOR( i = 0; i < num_freq_bands; i++ ) { tmp = sub( intensity_q, intensity_real_q[i] ); intensity_real_fx[0][i] = L_shl( intensity_real_fx[0][i], tmp ); move32(); intensity_real_fx[1][i] = L_shl( intensity_real_fx[1][i], tmp ); move32(); intensity_real_fx[2][i] = L_shl( intensity_real_fx[2][i], tmp ); move32(); } /* Fill buffers of length "averaging_length" time slots for intensity and energy */ hOMasa->index_buffer_intensity = add( ( hOMasa->index_buffer_intensity % DIRAC_NO_COL_AVG_DIFF ), 1 ); /* averaging_length = 32 */ move16(); Loading Loading @@ -761,8 +776,9 @@ void computeIntensityVector_ana_fx( Word32 Cldfb_RealBuffer[FOA_CHANNELS][CLDFB_NO_CHANNELS_MAX], /* i : Real part of input signal Qx */ Word32 Cldfb_ImagBuffer[FOA_CHANNELS][CLDFB_NO_CHANNELS_MAX], /* i : Imag part of input sig Qx */ const Word16 num_frequency_bands, /* i : Number of frequency bands */ Word32 intensity_real[DIRAC_NUM_DIMS][MASA_FREQUENCY_BANDS] /* o : Intensity 2 * Qx -31 */ ) Word32 intensity_real[DIRAC_NUM_DIMS][MASA_FREQUENCY_BANDS], /* o : Intensity */ Word16 q_intensity_real[MASA_FREQUENCY_BANDS], Word16 inp_q ) { /* Reminder * X = a + ib; Y = c + id Loading @@ -771,33 +787,66 @@ void computeIntensityVector_ana_fx( Word16 i, j; Word32 real, img; Word16 brange[2]; Word16 shift_value = add( shl( inp_q, 1 ), 1 ); Word16 tmp_norm; FOR( i = 0; i < num_frequency_bands; i++ ) { brange[0] = band_grouping[i]; move16(); brange[1] = band_grouping[i + 1]; move16(); Word16 num_bins = sub( brange[1], brange[0] ); Word16 gb = find_guarded_bits_fx( num_bins ); Word16 norm; intensity_real[0][i] = 0; move32(); intensity_real[1][i] = 0; move32(); intensity_real[2][i] = 0; move32(); Word64 tmp_1 = 0, tmp_2 = 0, tmp_3 = 0; move64(); move64(); move64(); FOR( j = brange[0]; j < brange[1]; j++ ) { real = Cldfb_RealBuffer[0][j]; // Qx img = Cldfb_ImagBuffer[0][j]; // Qx /* Intensity is XYZ order, audio is WYZX order. */ intensity_real[0][i] = L_add( intensity_real[0][i], L_add( Mpy_32_32( Cldfb_RealBuffer[3][j], real ), Mpy_32_32( Cldfb_ImagBuffer[3][j], img ) ) ); // output Q = 2 * Qx -31 move32(); intensity_real[1][i] = L_add( intensity_real[1][i], L_add( Mpy_32_32( Cldfb_RealBuffer[1][j], real ), Mpy_32_32( Cldfb_ImagBuffer[1][j], img ) ) ); // output Q = 2 * Qx -31 real = Cldfb_RealBuffer[0][j]; move32(); intensity_real[2][i] = L_add( intensity_real[2][i], L_add( Mpy_32_32( Cldfb_RealBuffer[2][j], real ), Mpy_32_32( Cldfb_ImagBuffer[2][j], img ) ) ); // output Q = 2 * Qx -31 img = Cldfb_ImagBuffer[0][j]; move32(); Word64 t1, t2, t3; t1 = W_mac_32_32( W_mult_32_32( Cldfb_RealBuffer[3][j], real ), Cldfb_ImagBuffer[3][j], img ); /* 2 * q_cldfb + 1 */ t2 = W_mac_32_32( W_mult_32_32( Cldfb_RealBuffer[1][j], real ), Cldfb_ImagBuffer[1][j], img ); /* 2 * q_cldfb + 1 */ t3 = W_mac_32_32( W_mult_32_32( Cldfb_RealBuffer[2][j], real ), Cldfb_ImagBuffer[2][j], img ); /* 2 * q_cldfb + 1 */ t1 = W_shr( t1, gb ); t2 = W_shr( t2, gb ); t3 = W_shr( t3, gb ); /* Intensity is XYZ order, audio is WYZX order. */ tmp_1 = W_add( tmp_1, t1 ); /* 2 * q_cldfb + 1 */ tmp_2 = W_add( tmp_2, t2 ); /* 2 * q_cldfb + 1 */ tmp_3 = W_add( tmp_3, t3 ); /* 2 * q_cldfb + 1 */ } norm = 63; move16(); IF( tmp_1 != 0 ) { tmp_norm = W_norm( tmp_1 ); norm = s_min( norm, tmp_norm ); } IF( tmp_2 != 0 ) { tmp_norm = W_norm( tmp_2 ); norm = s_min( norm, tmp_norm ); } IF( tmp_3 != 0 ) { tmp_norm = W_norm( tmp_3 ); norm = s_min( norm, tmp_norm ); } norm = sub( norm, 32 ); intensity_real[0][i] = W_shl_sat_l( tmp_1, norm ); // shift_value - (gb - norm) move32(); intensity_real[1][i] = W_shl_sat_l( tmp_2, norm ); // shift_value - (gb - norm) move32(); intensity_real[2][i] = W_shl_sat_l( tmp_3, norm ); // shift_value - (gb - norm) q_intensity_real[i] = sub( shift_value, sub( gb, norm ) ); move16(); } return; Loading
lib_rend/ivas_prot_rend_fx.h +7 −6 Original line number Diff line number Diff line Loading @@ -1430,10 +1430,11 @@ void ivas_omasa_ana_close( void computeIntensityVector_ana_fx( const Word16 *band_grouping, /* i : Band grouping for estimation */ Word32 Cldfb_RealBuffer[FOA_CHANNELS][CLDFB_NO_CHANNELS_MAX], /* i : Real part of input signal Qx */ Word32 Cldfb_ImagBuffer[FOA_CHANNELS][CLDFB_NO_CHANNELS_MAX], /* i : Imag part of input signal Qx */ Word32 Cldfb_ImagBuffer[FOA_CHANNELS][CLDFB_NO_CHANNELS_MAX], /* i : Imag part of input sig Qx */ const Word16 num_frequency_bands, /* i : Number of frequency bands */ Word32 intensity_real[DIRAC_NUM_DIMS][MASA_FREQUENCY_BANDS] /* o : Intensity vector 2 * Qx -31 */ ); Word32 intensity_real[DIRAC_NUM_DIMS][MASA_FREQUENCY_BANDS], /* o : Intensity */ Word16 q_intensity_real[MASA_FREQUENCY_BANDS], Word16 inp_q ); void computeReferencePower_ana_fx( const Word16 *band_grouping, /* i : Band grouping for estimation */ Loading