Loading lib_com/ivas_cov_smooth.c +87 −0 Original line number Diff line number Diff line Loading @@ -41,6 +41,7 @@ #include "prot.h" #define BAND_SMOOTH_REST_START_IDX ( 2 ) #ifndef CODE_CLEAN_UP_DIRAC /*-----------------------------------------------------------------------------------------* * Function ivas_set_up_cov_smoothing() * Loading Loading @@ -138,7 +139,93 @@ static void ivas_set_up_cov_smoothing( return; } #else /*-----------------------------------------------------------------------------------------* * Function ivas_calculate_update_factor() * * To calculate the update factor *-----------------------------------------------------------------------------------------*/ static float ivas_calculate_update_factor( float *p_bin_to_band, int16_t active_bins ) { float update_factor_temp = 0.0f; int16_t k; for ( k = 0; k < active_bins; k++ ) { update_factor_temp += p_bin_to_band[k]; } return update_factor_temp; } /*-----------------------------------------------------------------------------------------* * Function ivas_calculate_smoothning_factor() * * To calculate the Smoothning factor *-----------------------------------------------------------------------------------------*/ static void ivas_calculate_smoothning_factor( float *Smoothing_factor, float update_factor, const int16_t min_pool_size, const float max_update_rate, const COV_SMOOTHING_TYPE smooth_mode, const int32_t ivas_total_brate, int16_t j ) { float smooth_fact; *Smoothing_factor = update_factor / min_pool_size; if ( smooth_mode != COV_SMOOTH_MC ) { if ( ivas_total_brate < IVAS_24k4 ) { smooth_fact = 0.5f; } else { smooth_fact = 0.75f; } *Smoothing_factor *= ( j + 1 ) * smooth_fact; } if ( *Smoothing_factor > max_update_rate ) { *Smoothing_factor = max_update_rate; } } /*-----------------------------------------------------------------------------------------* * Function ivas_set_up_cov_smoothing() * * Setup for covariance smoothing *-----------------------------------------------------------------------------------------*/ static void ivas_set_up_cov_smoothing( ivas_cov_smooth_state_t *hCovState, ivas_filterbank_t *pFb, const float max_update_rate, const int16_t min_pool_size, const COV_SMOOTHING_TYPE smooth_mode, /* i : flag multichannel vs SPAR */ const int32_t ivas_total_brate ) { int16_t j; float update_factor; if ( smooth_mode == COV_SMOOTH_MC ) { for ( j = 0; j < pFb->filterbank_num_bands; j++ ) { int16_t active_bins = pFb->fb_bin_to_band.pFb_active_bins_per_band[j]; update_factor = ivas_calculate_update_factor( pFb->fb_bin_to_band.pFb_bin_to_band[j], active_bins ); ivas_calculate_smoothning_factor( &hCovState->pSmoothing_factor[j], update_factor, min_pool_size, max_update_rate, smooth_mode, ivas_total_brate, j ); } } else { for ( j = 0; j < pFb->filterbank_num_bands; j++ ) { float *p_bin_to_band = pFb->fb_bin_to_band.pp_short_stride_bin_to_band[j]; int16_t active_bins = pFb->fb_bin_to_band.p_short_stride_num_bins_per_band[j]; update_factor = ivas_calculate_update_factor( p_bin_to_band, active_bins ); ivas_calculate_smoothning_factor( &hCovState->pSmoothing_factor[j], update_factor, min_pool_size, max_update_rate, smooth_mode, ivas_total_brate, j ); } } hCovState->prior_bank_idx = -1; } #endif /*------------------------------------------------------------------------- * ivas_spar_covar_smooth_enc_open() Loading lib_com/ivas_prot.h +8 −2 Original line number Diff line number Diff line Loading @@ -4525,8 +4525,11 @@ void ivas_calc_c_p_coeffs( const int16_t num_dmx, const int16_t band_idx, const int16_t dtx_vad, const int16_t compute_p_flag, const int16_t compute_p_flag #ifndef FIX_280_PLANAR_CP , const int16_t planarCP #endif ); void ivas_get_spar_md_from_dirac( Loading Loading @@ -4995,8 +4998,11 @@ void ivas_copy_band_coeffs_idx_to_arr( const int16_t nB, int16_t *pSymbol_re, ivas_cell_dim_t *pCell_dims, const ivas_coeffs_type_t coeff_type, const ivas_coeffs_type_t coeff_type #ifndef FIX_280_PLANAR_CP , const int16_t planarCP #endif ); void ivas_clear_band_coeffs( Loading lib_com/ivas_sba_config.c +4 −0 Original line number Diff line number Diff line Loading @@ -224,8 +224,12 @@ int16_t ivas_sba_get_nchan_metadata( { if ( ivas_total_brate >= IVAS_512k ) { #ifndef COVARIANCE_MEMORY_OPT nb_channels = ( SBA_HOA2_ORDER + 1 ) * ( SBA_HOA2_ORDER + 1 ); nb_channels += 2; #else nb_channels = IVAS_SPAR_MAX_CH; #endif nb_channels = min( nb_channels, ( sba_order + 1 ) * ( sba_order + 1 ) ); } else Loading lib_com/ivas_spar_com.c +18 −2 Original line number Diff line number Diff line Loading @@ -802,6 +802,7 @@ void ivas_create_fullr_dmx_mat( { ivas_reorder_array( down_mix_mat1_re, in_chans, order, mixer_mat, start_band, end_band ); } #ifndef CODE_CLEAN_UP_DIRAC else { /* Custom 4x4 mult for WYiX case */ Loading @@ -823,6 +824,7 @@ void ivas_create_fullr_dmx_mat( } } } #endif return; } Loading Loading @@ -1253,10 +1255,16 @@ void ivas_calc_c_p_coeffs( const int16_t num_dmx, const int16_t band_idx, const int16_t dtx_vad, const int16_t compute_p_flag, const int16_t planarCP ) const int16_t compute_p_flag #ifndef FIX_280_PLANAR_CP , const int16_t planarCP #endif ) { #ifndef FIX_280_PLANAR_CP int16_t i, j; #endif float postpred_cov_re[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH]; if ( num_dmx != num_ch ) Loading @@ -1268,6 +1276,7 @@ void ivas_calc_c_p_coeffs( ivas_calc_c_coeffs_per_band( pSparMd, i_ts, postpred_cov_re, num_ch, num_dmx, band_idx, dtx_vad ); } #ifndef FIX_280_PLANAR_CP if ( planarCP ) { for ( i = 0; i < num_ch - num_dmx; i++ ) Loading @@ -1281,12 +1290,14 @@ void ivas_calc_c_p_coeffs( } } } #endif if ( compute_p_flag == 1 ) { ivas_calc_p_coeffs_per_band( pSparMd, i_ts, postpred_cov_re, num_ch, dtx_vad, num_dmx, band_idx ); } #ifndef FIX_280_PLANAR_CP if ( planarCP ) { for ( i = num_dmx; i < num_ch; i++ ) Loading @@ -1297,6 +1308,7 @@ void ivas_calc_c_p_coeffs( } } } #endif } return; Loading Loading @@ -1611,7 +1623,11 @@ void ivas_compute_spar_params( if ( ndm != num_ch ) { #ifndef FIX_280_PLANAR_CP ivas_calc_c_p_coeffs( hSparMd, cov_real, i_ts, mixer_mat, num_ch, ndm, b, dtx_vad, 1, 0 ); #else ivas_calc_c_p_coeffs( hSparMd, cov_real, i_ts, mixer_mat, num_ch, ndm, b, dtx_vad, 1 ); #endif #ifdef SPAR_HOA_DBG /* if (b == 0) */ Loading lib_com/ivas_spar_com_quant_util.c +12 −2 Original line number Diff line number Diff line Loading @@ -243,11 +243,17 @@ void ivas_copy_band_coeffs_idx_to_arr( const int16_t nB, int16_t *pSymbol_re, ivas_cell_dim_t *pCell_dims, const ivas_coeffs_type_t coeff_type, const int16_t planarCP ) const ivas_coeffs_type_t coeff_type #ifndef FIX_280_PLANAR_CP , const int16_t planarCP #endif ) { int16_t i, len; #ifndef FIX_280_PLANAR_CP int16_t j, k; #endif int16_t *pPtr_idx = NULL; for ( i = 0; i < nB; i++ ) Loading Loading @@ -277,10 +283,13 @@ void ivas_copy_band_coeffs_idx_to_arr( len = pCell_dims[i].dim1 * pCell_dims[i].dim2; if ( ( coeff_type != DECX_COEFF ) ) { #ifndef FIX_280_PLANAR_CP if ( ( coeff_type == PRED_COEFF ) || !planarCP ) { #endif mvs2s( pPtr_idx, pSymbol_re, len ); pSymbol_re += len; #ifndef FIX_280_PLANAR_CP } else { Loading @@ -295,6 +304,7 @@ void ivas_copy_band_coeffs_idx_to_arr( } pSymbol_re += k; } #endif } } Loading Loading
lib_com/ivas_cov_smooth.c +87 −0 Original line number Diff line number Diff line Loading @@ -41,6 +41,7 @@ #include "prot.h" #define BAND_SMOOTH_REST_START_IDX ( 2 ) #ifndef CODE_CLEAN_UP_DIRAC /*-----------------------------------------------------------------------------------------* * Function ivas_set_up_cov_smoothing() * Loading Loading @@ -138,7 +139,93 @@ static void ivas_set_up_cov_smoothing( return; } #else /*-----------------------------------------------------------------------------------------* * Function ivas_calculate_update_factor() * * To calculate the update factor *-----------------------------------------------------------------------------------------*/ static float ivas_calculate_update_factor( float *p_bin_to_band, int16_t active_bins ) { float update_factor_temp = 0.0f; int16_t k; for ( k = 0; k < active_bins; k++ ) { update_factor_temp += p_bin_to_band[k]; } return update_factor_temp; } /*-----------------------------------------------------------------------------------------* * Function ivas_calculate_smoothning_factor() * * To calculate the Smoothning factor *-----------------------------------------------------------------------------------------*/ static void ivas_calculate_smoothning_factor( float *Smoothing_factor, float update_factor, const int16_t min_pool_size, const float max_update_rate, const COV_SMOOTHING_TYPE smooth_mode, const int32_t ivas_total_brate, int16_t j ) { float smooth_fact; *Smoothing_factor = update_factor / min_pool_size; if ( smooth_mode != COV_SMOOTH_MC ) { if ( ivas_total_brate < IVAS_24k4 ) { smooth_fact = 0.5f; } else { smooth_fact = 0.75f; } *Smoothing_factor *= ( j + 1 ) * smooth_fact; } if ( *Smoothing_factor > max_update_rate ) { *Smoothing_factor = max_update_rate; } } /*-----------------------------------------------------------------------------------------* * Function ivas_set_up_cov_smoothing() * * Setup for covariance smoothing *-----------------------------------------------------------------------------------------*/ static void ivas_set_up_cov_smoothing( ivas_cov_smooth_state_t *hCovState, ivas_filterbank_t *pFb, const float max_update_rate, const int16_t min_pool_size, const COV_SMOOTHING_TYPE smooth_mode, /* i : flag multichannel vs SPAR */ const int32_t ivas_total_brate ) { int16_t j; float update_factor; if ( smooth_mode == COV_SMOOTH_MC ) { for ( j = 0; j < pFb->filterbank_num_bands; j++ ) { int16_t active_bins = pFb->fb_bin_to_band.pFb_active_bins_per_band[j]; update_factor = ivas_calculate_update_factor( pFb->fb_bin_to_band.pFb_bin_to_band[j], active_bins ); ivas_calculate_smoothning_factor( &hCovState->pSmoothing_factor[j], update_factor, min_pool_size, max_update_rate, smooth_mode, ivas_total_brate, j ); } } else { for ( j = 0; j < pFb->filterbank_num_bands; j++ ) { float *p_bin_to_band = pFb->fb_bin_to_band.pp_short_stride_bin_to_band[j]; int16_t active_bins = pFb->fb_bin_to_band.p_short_stride_num_bins_per_band[j]; update_factor = ivas_calculate_update_factor( p_bin_to_band, active_bins ); ivas_calculate_smoothning_factor( &hCovState->pSmoothing_factor[j], update_factor, min_pool_size, max_update_rate, smooth_mode, ivas_total_brate, j ); } } hCovState->prior_bank_idx = -1; } #endif /*------------------------------------------------------------------------- * ivas_spar_covar_smooth_enc_open() Loading
lib_com/ivas_prot.h +8 −2 Original line number Diff line number Diff line Loading @@ -4525,8 +4525,11 @@ void ivas_calc_c_p_coeffs( const int16_t num_dmx, const int16_t band_idx, const int16_t dtx_vad, const int16_t compute_p_flag, const int16_t compute_p_flag #ifndef FIX_280_PLANAR_CP , const int16_t planarCP #endif ); void ivas_get_spar_md_from_dirac( Loading Loading @@ -4995,8 +4998,11 @@ void ivas_copy_band_coeffs_idx_to_arr( const int16_t nB, int16_t *pSymbol_re, ivas_cell_dim_t *pCell_dims, const ivas_coeffs_type_t coeff_type, const ivas_coeffs_type_t coeff_type #ifndef FIX_280_PLANAR_CP , const int16_t planarCP #endif ); void ivas_clear_band_coeffs( Loading
lib_com/ivas_sba_config.c +4 −0 Original line number Diff line number Diff line Loading @@ -224,8 +224,12 @@ int16_t ivas_sba_get_nchan_metadata( { if ( ivas_total_brate >= IVAS_512k ) { #ifndef COVARIANCE_MEMORY_OPT nb_channels = ( SBA_HOA2_ORDER + 1 ) * ( SBA_HOA2_ORDER + 1 ); nb_channels += 2; #else nb_channels = IVAS_SPAR_MAX_CH; #endif nb_channels = min( nb_channels, ( sba_order + 1 ) * ( sba_order + 1 ) ); } else Loading
lib_com/ivas_spar_com.c +18 −2 Original line number Diff line number Diff line Loading @@ -802,6 +802,7 @@ void ivas_create_fullr_dmx_mat( { ivas_reorder_array( down_mix_mat1_re, in_chans, order, mixer_mat, start_band, end_band ); } #ifndef CODE_CLEAN_UP_DIRAC else { /* Custom 4x4 mult for WYiX case */ Loading @@ -823,6 +824,7 @@ void ivas_create_fullr_dmx_mat( } } } #endif return; } Loading Loading @@ -1253,10 +1255,16 @@ void ivas_calc_c_p_coeffs( const int16_t num_dmx, const int16_t band_idx, const int16_t dtx_vad, const int16_t compute_p_flag, const int16_t planarCP ) const int16_t compute_p_flag #ifndef FIX_280_PLANAR_CP , const int16_t planarCP #endif ) { #ifndef FIX_280_PLANAR_CP int16_t i, j; #endif float postpred_cov_re[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH]; if ( num_dmx != num_ch ) Loading @@ -1268,6 +1276,7 @@ void ivas_calc_c_p_coeffs( ivas_calc_c_coeffs_per_band( pSparMd, i_ts, postpred_cov_re, num_ch, num_dmx, band_idx, dtx_vad ); } #ifndef FIX_280_PLANAR_CP if ( planarCP ) { for ( i = 0; i < num_ch - num_dmx; i++ ) Loading @@ -1281,12 +1290,14 @@ void ivas_calc_c_p_coeffs( } } } #endif if ( compute_p_flag == 1 ) { ivas_calc_p_coeffs_per_band( pSparMd, i_ts, postpred_cov_re, num_ch, dtx_vad, num_dmx, band_idx ); } #ifndef FIX_280_PLANAR_CP if ( planarCP ) { for ( i = num_dmx; i < num_ch; i++ ) Loading @@ -1297,6 +1308,7 @@ void ivas_calc_c_p_coeffs( } } } #endif } return; Loading Loading @@ -1611,7 +1623,11 @@ void ivas_compute_spar_params( if ( ndm != num_ch ) { #ifndef FIX_280_PLANAR_CP ivas_calc_c_p_coeffs( hSparMd, cov_real, i_ts, mixer_mat, num_ch, ndm, b, dtx_vad, 1, 0 ); #else ivas_calc_c_p_coeffs( hSparMd, cov_real, i_ts, mixer_mat, num_ch, ndm, b, dtx_vad, 1 ); #endif #ifdef SPAR_HOA_DBG /* if (b == 0) */ Loading
lib_com/ivas_spar_com_quant_util.c +12 −2 Original line number Diff line number Diff line Loading @@ -243,11 +243,17 @@ void ivas_copy_band_coeffs_idx_to_arr( const int16_t nB, int16_t *pSymbol_re, ivas_cell_dim_t *pCell_dims, const ivas_coeffs_type_t coeff_type, const int16_t planarCP ) const ivas_coeffs_type_t coeff_type #ifndef FIX_280_PLANAR_CP , const int16_t planarCP #endif ) { int16_t i, len; #ifndef FIX_280_PLANAR_CP int16_t j, k; #endif int16_t *pPtr_idx = NULL; for ( i = 0; i < nB; i++ ) Loading Loading @@ -277,10 +283,13 @@ void ivas_copy_band_coeffs_idx_to_arr( len = pCell_dims[i].dim1 * pCell_dims[i].dim2; if ( ( coeff_type != DECX_COEFF ) ) { #ifndef FIX_280_PLANAR_CP if ( ( coeff_type == PRED_COEFF ) || !planarCP ) { #endif mvs2s( pPtr_idx, pSymbol_re, len ); pSymbol_re += len; #ifndef FIX_280_PLANAR_CP } else { Loading @@ -295,6 +304,7 @@ void ivas_copy_band_coeffs_idx_to_arr( } pSymbol_re += k; } #endif } } Loading