Loading lib_com/ivas_cov_smooth.c +35 −56 Original line number Diff line number Diff line Loading @@ -206,7 +206,6 @@ static void ivas_set_up_cov_smoothing_fx( Word16 active_bins = pFb->fb_bin_to_band.pFb_active_bins_per_band[j]; update_factor = ivas_calculate_update_factor_fx( pFb->fb_bin_to_band.pFb_bin_to_band_fx[j], active_bins ); ivas_calculate_smoothning_factor_fx( &hCovState->pSmoothing_factor_fx[j], update_factor, min_pool_size, max_update_rate, smooth_mode, ivas_total_brate, j ); hCovState->pSmoothing_factor[j] = fixedToFloat( hCovState->pSmoothing_factor_fx[j], Q31 ); } } ELSE Loading @@ -217,7 +216,6 @@ static void ivas_set_up_cov_smoothing_fx( Word16 active_bins = pFb->fb_bin_to_band.p_short_stride_num_bins_per_band[j]; update_factor = ivas_calculate_update_factor_fx( p_bin_to_band, active_bins ); ivas_calculate_smoothning_factor_fx( &hCovState->pSmoothing_factor_fx[j], update_factor, min_pool_size, max_update_rate, smooth_mode, ivas_total_brate, j ); hCovState->pSmoothing_factor[j] = fixedToFloat( hCovState->pSmoothing_factor_fx[j], Q31 ); } } Loading Loading @@ -270,78 +268,65 @@ static void ivas_set_up_cov_smoothing( #endif #ifdef IVAS_FLOAT_FIXED /*------------------------------------------------------------------------- * ivas_spar_covar_smooth_enc_open() * ivas_spar_covar_smooth_enc_open_fx() * * Allocate and initialize SPAR Covar. smoothing handle *------------------------------------------------------------------------*/ #ifdef IVAS_FLOAT_FIXED ivas_error ivas_spar_covar_smooth_enc_open( ivas_error ivas_spar_covar_smooth_enc_open_fx( ivas_cov_smooth_state_t **hCovState_out, /* i/o: SPAR Covar. smoothing handle */ const ivas_cov_smooth_cfg_t *cov_smooth_cfg, /* i : SPAR config. handle */ ivas_filterbank_t *pFb, /* i/o: FB handle */ const int16_t nchan_inp, /* i : number of input channels */ const Word16 nchan_inp, /* i : number of input channels */ const COV_SMOOTHING_TYPE smooth_mode, /* i : Smooth covariance for SPAR or MC */ const int32_t ivas_total_brate /* i : IVAS total bitrate */ const Word32 ivas_total_brate /* i : IVAS total bitrate */ ) { ivas_cov_smooth_state_t *hCovState; int16_t i, j; Word16 i, j; if ( ( hCovState = (ivas_cov_smooth_state_t *) malloc( sizeof( ivas_cov_smooth_state_t ) ) ) == NULL ) IF( ( hCovState = (ivas_cov_smooth_state_t *) malloc( sizeof( ivas_cov_smooth_state_t ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR COV encoder" ); } #ifdef IVAS_FLOAT_FIXED IF( ( hCovState->pSmoothing_factor_fx = (Word32 *) malloc( sizeof( Word32 ) * cov_smooth_cfg->max_bands ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR COV encoder" ); } #endif if ( ( hCovState->pSmoothing_factor = (float *) malloc( sizeof( float ) * cov_smooth_cfg->max_bands ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR COV encoder" ); } for ( i = 0; i < nchan_inp; i++ ) { for ( j = 0; j < nchan_inp; j++ ) FOR( i = 0; i < nchan_inp; i++ ) { if ( ( hCovState->pPrior_cov_real[i][j] = (float *) malloc( sizeof( float ) * cov_smooth_cfg->max_bands ) ) == NULL ) FOR( j = 0; j < nchan_inp; j++ ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR COV encoder" ); } set_zero( hCovState->pPrior_cov_real[i][j], cov_smooth_cfg->max_bands ); #ifdef IVAS_FLOAT_FIXED if ( ( hCovState->pPrior_cov_real_fx[i][j] = (Word32 *) malloc( sizeof( Word32 ) * cov_smooth_cfg->max_bands ) ) == NULL ) IF( ( hCovState->pPrior_cov_real_fx[i][j] = (Word32 *) malloc( sizeof( Word32 ) * cov_smooth_cfg->max_bands ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR COV encoder Fixed" ); } set_zero_fx( hCovState->pPrior_cov_real_fx[i][j], cov_smooth_cfg->max_bands ); #endif #ifdef IVAS_FLOAT_FIXED if ( ( hCovState->q_cov_real_per_band[i][j] = (Word16 *) malloc( sizeof( Word16 ) * cov_smooth_cfg->max_bands ) ) == NULL ) IF( ( hCovState->q_cov_real_per_band[i][j] = (Word16 *) malloc( sizeof( Word16 ) * cov_smooth_cfg->max_bands ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR COV encoder Fixed" ); } set_s( hCovState->q_cov_real_per_band[i][j], Q31, cov_smooth_cfg->max_bands ); #endif } } #ifdef IVAS_FLOAT_FIXED ivas_set_up_cov_smoothing_fx( hCovState, pFb, cov_smooth_cfg->max_update_rate_fx, cov_smooth_cfg->min_pool_size, smooth_mode, ivas_total_brate ); #else ivas_set_up_cov_smoothing( hCovState, pFb, cov_smooth_cfg->max_update_rate, cov_smooth_cfg->min_pool_size, smooth_mode, ivas_total_brate ); #endif *hCovState_out = hCovState; return IVAS_ERR_OK; } #else /*------------------------------------------------------------------------- * ivas_spar_covar_smooth_enc_open() * * Allocate and initialize SPAR Covar. smoothing handle *------------------------------------------------------------------------*/ ivas_error ivas_spar_covar_smooth_enc_open( ivas_cov_smooth_state_t **hCovState_out, /* i/o: SPAR Covar. smoothing handle */ const ivas_cov_smooth_cfg_t *cov_smooth_cfg, /* i : SPAR config. handle */ Loading Loading @@ -384,46 +369,36 @@ ivas_error ivas_spar_covar_smooth_enc_open( } #endif #ifdef IVAS_FLOAT_FIXED /*------------------------------------------------------------------------- * ivas_spar_covar_smooth_enc_close() * ivas_spar_covar_smooth_enc_close_fx() * * Deallocate SPAR Covar. smoothing handle *------------------------------------------------------------------------*/ #ifdef IVAS_FLOAT_FIXED void ivas_spar_covar_smooth_enc_close( void ivas_spar_covar_smooth_enc_close_fx( ivas_cov_smooth_state_t **hCovState_out, /* i/o: SPAR Covar. smoothing handle */ const int16_t nchan_inp /* i : number of input channels */ const Word16 nchan_inp /* i : number of input channels */ ) { ivas_cov_smooth_state_t *hCovState; int16_t i, j; Word16 i, j; hCovState = *hCovState_out; if ( hCovState != NULL ) IF( hCovState != NULL ) { #ifdef IVAS_FLOAT_FIXED free( hCovState->pSmoothing_factor_fx ); hCovState->pSmoothing_factor_fx = NULL; #endif free( hCovState->pSmoothing_factor ); hCovState->pSmoothing_factor = NULL; for ( i = 0; i < nchan_inp; i++ ) FOR( i = 0; i < nchan_inp; i++ ) { for ( j = 0; j < nchan_inp; j++ ) FOR( j = 0; j < nchan_inp; j++ ) { free( hCovState->pPrior_cov_real[i][j] ); hCovState->pPrior_cov_real[i][j] = NULL; #ifdef IVAS_FLOAT_FIXED free( hCovState->pPrior_cov_real_fx[i][j] ); hCovState->pPrior_cov_real_fx[i][j] = NULL; #endif #ifdef IVAS_FLOAT_FIXED free( hCovState->q_cov_real_per_band[i][j] ); hCovState->q_cov_real_per_band[i][j] = NULL; #endif } } Loading @@ -434,6 +409,12 @@ void ivas_spar_covar_smooth_enc_close( return; } #else /*------------------------------------------------------------------------- * ivas_spar_covar_smooth_enc_close() * * Deallocate SPAR Covar. smoothing handle *------------------------------------------------------------------------*/ void ivas_spar_covar_smooth_enc_close( ivas_cov_smooth_state_t **hCovState_out, /* i/o: SPAR Covar. smoothing handle */ const int16_t nchan_inp /* i : number of input channels */ Loading Loading @@ -597,9 +578,7 @@ static void ivas_compute_smooth_cov_fx( return; } #endif #else /*-----------------------------------------------------------------------------------------* * Function ivas_compute_smooth_cov() * Loading Loading @@ -691,6 +670,7 @@ static void ivas_compute_smooth_cov( return; } #endif #ifdef IVAS_FLOAT_FIXED Loading Loading @@ -728,9 +708,7 @@ void ivas_cov_smooth_process_fx( return; } #endif #else /*-----------------------------------------------------------------------------------------* * Function ivas_cov_smooth_process() * Loading Loading @@ -763,3 +741,4 @@ void ivas_cov_smooth_process( return; } #endif lib_com/ivas_prot.h +23 −7 Original line number Diff line number Diff line Loading @@ -5860,6 +5860,21 @@ void ivas_spar_dec_gen_umx_mat( const int16_t num_md_sub_frames ); #ifdef IVAS_FLOAT_FIXED ivas_error ivas_spar_covar_enc_open_fx( ivas_enc_cov_handler_state_t **hCovEnc, /* i/o: SPAR Covar. encoder handle */ ivas_filterbank_t *pFb, /* i/o: FB handle */ const Word32 input_Fs, /* i : input sampling rate */ const Word16 nchan_inp, /* i : number of input channels */ const COV_SMOOTHING_TYPE smooth_mode, /* i : Smooth covariance for SPAR or MC*/ const Word32 ivas_total_brate /* i : IVAS total bitrate */ ); void ivas_spar_covar_enc_close_fx( ivas_enc_cov_handler_state_t **hCovEnc, /* i/o: SPAR Covar. encoder handle */ const Word16 nchan_inp /* i : number of input channels */ ); #else /* Covariance module */ ivas_error ivas_spar_covar_enc_open( ivas_enc_cov_handler_state_t **hCovEnc, /* i/o: SPAR Covar. encoder handle */ Loading @@ -5874,6 +5889,7 @@ void ivas_spar_covar_enc_close( ivas_enc_cov_handler_state_t **hCovEnc, /* i/o: SPAR Covar. encoder handle */ const int16_t nchan_inp /* i : number of input channels */ ); #endif #ifdef IVAS_FLOAT_FIXED void ivas_enc_cov_handler_process_fx( Loading @@ -5898,8 +5914,7 @@ void ivas_enc_cov_handler_process_fx( const Word16 nchan_transport, const Word16 is_sba ); #endif #else void ivas_enc_cov_handler_process( ivas_enc_cov_handler_state_t *hCovEnc, /* i/o: SPAR Covar. encoder handle */ float **ppIn_FR_real, Loading @@ -5919,8 +5934,9 @@ void ivas_enc_cov_handler_process( const int16_t nchan_transport, const int16_t is_sba ); #endif #ifdef IVAS_FLOAT_FIXED_ #ifdef IVAS_FLOAT_FIXED ivas_error ivas_spar_covar_smooth_enc_open_fx( ivas_cov_smooth_state_t **hCovState, /* i/o: SPAR Covar. smoothing handle */ const ivas_cov_smooth_cfg_t *cov_smooth_cfg, /* i : SPAR config. handle */ Loading @@ -5934,8 +5950,7 @@ void ivas_spar_covar_smooth_enc_close_fx( ivas_cov_smooth_state_t **hCovState, /* i/o: SPAR Covar. encoder handle */ const Word16 nchan_inp /* i : number of input channels */ ); #endif #else ivas_error ivas_spar_covar_smooth_enc_open( ivas_cov_smooth_state_t **hCovState, /* i/o: SPAR Covar. smoothing handle */ const ivas_cov_smooth_cfg_t *cov_smooth_cfg, /* i : SPAR config. handle */ Loading @@ -5949,6 +5964,7 @@ void ivas_spar_covar_smooth_enc_close( ivas_cov_smooth_state_t **hCovState, /* i/o: SPAR Covar. encoder handle */ const int16_t nchan_inp /* i : number of input channels */ ); #endif #ifdef IVAS_FLOAT_FIXED void ivas_cov_smooth_process_fx( Loading @@ -5961,8 +5977,7 @@ void ivas_cov_smooth_process_fx( const Word16 transient_det[2], Word16 *q_cov[IVAS_SPAR_MAX_CH] ); #endif #else void ivas_cov_smooth_process( ivas_cov_smooth_state_t *hCovState, /* i/o: Covariance state handle */ float *cov_real[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], Loading @@ -5972,6 +5987,7 @@ void ivas_cov_smooth_process( const int16_t num_ch, const int16_t transient_det[2] ); #endif /* Transient detector module */ ivas_error ivas_transient_det_open( Loading lib_com/ivas_prot_fx.h +5 −0 Original line number Diff line number Diff line Loading @@ -2393,6 +2393,11 @@ Word16 ism_quant_meta_fx( const Word16 cbsize /* i : codebook size */ ); /*! r: number of channels to be analysed */ Word16 getNumChanAnalysis_fx( Encoder_Struct *st_ivas /* i : IVAS encoder structure */ ); ivas_error ivas_limiter_open_fx( IVAS_LIMITER_HANDLE *hLimiter_out, /* o : limiter struct handle */ const Word16 max_num_channels, /* i : maximum number of I/O channels to be processed */ Loading lib_com/ivas_stat_com.h +11 −7 Original line number Diff line number Diff line Loading @@ -367,24 +367,28 @@ typedef struct ivas_agc_com_state_t /* Covariance structures */ typedef struct ivas_cov_smooth_state_t { float *pPrior_cov_real[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH]; int16_t prior_bank_idx; float *pSmoothing_factor; int16_t num_bins; #ifdef IVAS_FLOAT_FIXED Word32 *pPrior_cov_real_fx[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH]; Word16 *q_cov_real[IVAS_SPAR_MAX_CH]; Word16 *q_cov_real_per_band[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH]; #else float *pPrior_cov_real[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH]; #endif int16_t prior_bank_idx; #ifdef IVAS_FLOAT_FIXED Word32 *pSmoothing_factor_fx; /* Q31 */ #else float *pSmoothing_factor; #endif int16_t num_bins; } ivas_cov_smooth_state_t; typedef struct ivas_cov_smooth_cfg_t { float max_update_rate; #ifdef IVAS_FLOAT_FIXED Word32 max_update_rate_fx; /* Q31 */ #else float max_update_rate; #endif int16_t min_pool_size; int16_t max_bands; Loading lib_com/ivas_tools.c +12 −55 Original line number Diff line number Diff line Loading @@ -2555,64 +2555,21 @@ void lls_interp_n_fx( { Word16 i; const Word16 n_i_fx[11] = { 0, 2048, 4096, 6144, 8192, 10240, 12288, 14336, 16384, 18432, 20480 }; // Q11 move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); const Word16 one_by_n_fx[11] = { 0, 32767, 16384, 10911, 8192, 6553, 5459, 4681, 4096, 3640, 3276 }; move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); const Word16 sum_i_fx[12] = { 0, 0, 1, 3, 6, 10, 15, 21, 28, 36, 45, 55 }; move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); // 1.0f/ ( N * sum_ii[N] - sum_i[N] * sum_i[N] ) const Word32 res_table[12] = { 0, 0, 0, 357913952, 107374184, 42949672, 20452226, 10956549, 6391320, 3976821, 2603010, 385 }; move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); Word32 sum_x_fx, sum_ix_fx, slope_fx, offset_fx; Word16 dot_exp = 0, sum_ix_q = 0; move16(); move16(); move16(); move16(); Word32 num; assert( N > 0 && LE_16( N, 10 ) ); Loading Loading
lib_com/ivas_cov_smooth.c +35 −56 Original line number Diff line number Diff line Loading @@ -206,7 +206,6 @@ static void ivas_set_up_cov_smoothing_fx( Word16 active_bins = pFb->fb_bin_to_band.pFb_active_bins_per_band[j]; update_factor = ivas_calculate_update_factor_fx( pFb->fb_bin_to_band.pFb_bin_to_band_fx[j], active_bins ); ivas_calculate_smoothning_factor_fx( &hCovState->pSmoothing_factor_fx[j], update_factor, min_pool_size, max_update_rate, smooth_mode, ivas_total_brate, j ); hCovState->pSmoothing_factor[j] = fixedToFloat( hCovState->pSmoothing_factor_fx[j], Q31 ); } } ELSE Loading @@ -217,7 +216,6 @@ static void ivas_set_up_cov_smoothing_fx( Word16 active_bins = pFb->fb_bin_to_band.p_short_stride_num_bins_per_band[j]; update_factor = ivas_calculate_update_factor_fx( p_bin_to_band, active_bins ); ivas_calculate_smoothning_factor_fx( &hCovState->pSmoothing_factor_fx[j], update_factor, min_pool_size, max_update_rate, smooth_mode, ivas_total_brate, j ); hCovState->pSmoothing_factor[j] = fixedToFloat( hCovState->pSmoothing_factor_fx[j], Q31 ); } } Loading Loading @@ -270,78 +268,65 @@ static void ivas_set_up_cov_smoothing( #endif #ifdef IVAS_FLOAT_FIXED /*------------------------------------------------------------------------- * ivas_spar_covar_smooth_enc_open() * ivas_spar_covar_smooth_enc_open_fx() * * Allocate and initialize SPAR Covar. smoothing handle *------------------------------------------------------------------------*/ #ifdef IVAS_FLOAT_FIXED ivas_error ivas_spar_covar_smooth_enc_open( ivas_error ivas_spar_covar_smooth_enc_open_fx( ivas_cov_smooth_state_t **hCovState_out, /* i/o: SPAR Covar. smoothing handle */ const ivas_cov_smooth_cfg_t *cov_smooth_cfg, /* i : SPAR config. handle */ ivas_filterbank_t *pFb, /* i/o: FB handle */ const int16_t nchan_inp, /* i : number of input channels */ const Word16 nchan_inp, /* i : number of input channels */ const COV_SMOOTHING_TYPE smooth_mode, /* i : Smooth covariance for SPAR or MC */ const int32_t ivas_total_brate /* i : IVAS total bitrate */ const Word32 ivas_total_brate /* i : IVAS total bitrate */ ) { ivas_cov_smooth_state_t *hCovState; int16_t i, j; Word16 i, j; if ( ( hCovState = (ivas_cov_smooth_state_t *) malloc( sizeof( ivas_cov_smooth_state_t ) ) ) == NULL ) IF( ( hCovState = (ivas_cov_smooth_state_t *) malloc( sizeof( ivas_cov_smooth_state_t ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR COV encoder" ); } #ifdef IVAS_FLOAT_FIXED IF( ( hCovState->pSmoothing_factor_fx = (Word32 *) malloc( sizeof( Word32 ) * cov_smooth_cfg->max_bands ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR COV encoder" ); } #endif if ( ( hCovState->pSmoothing_factor = (float *) malloc( sizeof( float ) * cov_smooth_cfg->max_bands ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR COV encoder" ); } for ( i = 0; i < nchan_inp; i++ ) { for ( j = 0; j < nchan_inp; j++ ) FOR( i = 0; i < nchan_inp; i++ ) { if ( ( hCovState->pPrior_cov_real[i][j] = (float *) malloc( sizeof( float ) * cov_smooth_cfg->max_bands ) ) == NULL ) FOR( j = 0; j < nchan_inp; j++ ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR COV encoder" ); } set_zero( hCovState->pPrior_cov_real[i][j], cov_smooth_cfg->max_bands ); #ifdef IVAS_FLOAT_FIXED if ( ( hCovState->pPrior_cov_real_fx[i][j] = (Word32 *) malloc( sizeof( Word32 ) * cov_smooth_cfg->max_bands ) ) == NULL ) IF( ( hCovState->pPrior_cov_real_fx[i][j] = (Word32 *) malloc( sizeof( Word32 ) * cov_smooth_cfg->max_bands ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR COV encoder Fixed" ); } set_zero_fx( hCovState->pPrior_cov_real_fx[i][j], cov_smooth_cfg->max_bands ); #endif #ifdef IVAS_FLOAT_FIXED if ( ( hCovState->q_cov_real_per_band[i][j] = (Word16 *) malloc( sizeof( Word16 ) * cov_smooth_cfg->max_bands ) ) == NULL ) IF( ( hCovState->q_cov_real_per_band[i][j] = (Word16 *) malloc( sizeof( Word16 ) * cov_smooth_cfg->max_bands ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR COV encoder Fixed" ); } set_s( hCovState->q_cov_real_per_band[i][j], Q31, cov_smooth_cfg->max_bands ); #endif } } #ifdef IVAS_FLOAT_FIXED ivas_set_up_cov_smoothing_fx( hCovState, pFb, cov_smooth_cfg->max_update_rate_fx, cov_smooth_cfg->min_pool_size, smooth_mode, ivas_total_brate ); #else ivas_set_up_cov_smoothing( hCovState, pFb, cov_smooth_cfg->max_update_rate, cov_smooth_cfg->min_pool_size, smooth_mode, ivas_total_brate ); #endif *hCovState_out = hCovState; return IVAS_ERR_OK; } #else /*------------------------------------------------------------------------- * ivas_spar_covar_smooth_enc_open() * * Allocate and initialize SPAR Covar. smoothing handle *------------------------------------------------------------------------*/ ivas_error ivas_spar_covar_smooth_enc_open( ivas_cov_smooth_state_t **hCovState_out, /* i/o: SPAR Covar. smoothing handle */ const ivas_cov_smooth_cfg_t *cov_smooth_cfg, /* i : SPAR config. handle */ Loading Loading @@ -384,46 +369,36 @@ ivas_error ivas_spar_covar_smooth_enc_open( } #endif #ifdef IVAS_FLOAT_FIXED /*------------------------------------------------------------------------- * ivas_spar_covar_smooth_enc_close() * ivas_spar_covar_smooth_enc_close_fx() * * Deallocate SPAR Covar. smoothing handle *------------------------------------------------------------------------*/ #ifdef IVAS_FLOAT_FIXED void ivas_spar_covar_smooth_enc_close( void ivas_spar_covar_smooth_enc_close_fx( ivas_cov_smooth_state_t **hCovState_out, /* i/o: SPAR Covar. smoothing handle */ const int16_t nchan_inp /* i : number of input channels */ const Word16 nchan_inp /* i : number of input channels */ ) { ivas_cov_smooth_state_t *hCovState; int16_t i, j; Word16 i, j; hCovState = *hCovState_out; if ( hCovState != NULL ) IF( hCovState != NULL ) { #ifdef IVAS_FLOAT_FIXED free( hCovState->pSmoothing_factor_fx ); hCovState->pSmoothing_factor_fx = NULL; #endif free( hCovState->pSmoothing_factor ); hCovState->pSmoothing_factor = NULL; for ( i = 0; i < nchan_inp; i++ ) FOR( i = 0; i < nchan_inp; i++ ) { for ( j = 0; j < nchan_inp; j++ ) FOR( j = 0; j < nchan_inp; j++ ) { free( hCovState->pPrior_cov_real[i][j] ); hCovState->pPrior_cov_real[i][j] = NULL; #ifdef IVAS_FLOAT_FIXED free( hCovState->pPrior_cov_real_fx[i][j] ); hCovState->pPrior_cov_real_fx[i][j] = NULL; #endif #ifdef IVAS_FLOAT_FIXED free( hCovState->q_cov_real_per_band[i][j] ); hCovState->q_cov_real_per_band[i][j] = NULL; #endif } } Loading @@ -434,6 +409,12 @@ void ivas_spar_covar_smooth_enc_close( return; } #else /*------------------------------------------------------------------------- * ivas_spar_covar_smooth_enc_close() * * Deallocate SPAR Covar. smoothing handle *------------------------------------------------------------------------*/ void ivas_spar_covar_smooth_enc_close( ivas_cov_smooth_state_t **hCovState_out, /* i/o: SPAR Covar. smoothing handle */ const int16_t nchan_inp /* i : number of input channels */ Loading Loading @@ -597,9 +578,7 @@ static void ivas_compute_smooth_cov_fx( return; } #endif #else /*-----------------------------------------------------------------------------------------* * Function ivas_compute_smooth_cov() * Loading Loading @@ -691,6 +670,7 @@ static void ivas_compute_smooth_cov( return; } #endif #ifdef IVAS_FLOAT_FIXED Loading Loading @@ -728,9 +708,7 @@ void ivas_cov_smooth_process_fx( return; } #endif #else /*-----------------------------------------------------------------------------------------* * Function ivas_cov_smooth_process() * Loading Loading @@ -763,3 +741,4 @@ void ivas_cov_smooth_process( return; } #endif
lib_com/ivas_prot.h +23 −7 Original line number Diff line number Diff line Loading @@ -5860,6 +5860,21 @@ void ivas_spar_dec_gen_umx_mat( const int16_t num_md_sub_frames ); #ifdef IVAS_FLOAT_FIXED ivas_error ivas_spar_covar_enc_open_fx( ivas_enc_cov_handler_state_t **hCovEnc, /* i/o: SPAR Covar. encoder handle */ ivas_filterbank_t *pFb, /* i/o: FB handle */ const Word32 input_Fs, /* i : input sampling rate */ const Word16 nchan_inp, /* i : number of input channels */ const COV_SMOOTHING_TYPE smooth_mode, /* i : Smooth covariance for SPAR or MC*/ const Word32 ivas_total_brate /* i : IVAS total bitrate */ ); void ivas_spar_covar_enc_close_fx( ivas_enc_cov_handler_state_t **hCovEnc, /* i/o: SPAR Covar. encoder handle */ const Word16 nchan_inp /* i : number of input channels */ ); #else /* Covariance module */ ivas_error ivas_spar_covar_enc_open( ivas_enc_cov_handler_state_t **hCovEnc, /* i/o: SPAR Covar. encoder handle */ Loading @@ -5874,6 +5889,7 @@ void ivas_spar_covar_enc_close( ivas_enc_cov_handler_state_t **hCovEnc, /* i/o: SPAR Covar. encoder handle */ const int16_t nchan_inp /* i : number of input channels */ ); #endif #ifdef IVAS_FLOAT_FIXED void ivas_enc_cov_handler_process_fx( Loading @@ -5898,8 +5914,7 @@ void ivas_enc_cov_handler_process_fx( const Word16 nchan_transport, const Word16 is_sba ); #endif #else void ivas_enc_cov_handler_process( ivas_enc_cov_handler_state_t *hCovEnc, /* i/o: SPAR Covar. encoder handle */ float **ppIn_FR_real, Loading @@ -5919,8 +5934,9 @@ void ivas_enc_cov_handler_process( const int16_t nchan_transport, const int16_t is_sba ); #endif #ifdef IVAS_FLOAT_FIXED_ #ifdef IVAS_FLOAT_FIXED ivas_error ivas_spar_covar_smooth_enc_open_fx( ivas_cov_smooth_state_t **hCovState, /* i/o: SPAR Covar. smoothing handle */ const ivas_cov_smooth_cfg_t *cov_smooth_cfg, /* i : SPAR config. handle */ Loading @@ -5934,8 +5950,7 @@ void ivas_spar_covar_smooth_enc_close_fx( ivas_cov_smooth_state_t **hCovState, /* i/o: SPAR Covar. encoder handle */ const Word16 nchan_inp /* i : number of input channels */ ); #endif #else ivas_error ivas_spar_covar_smooth_enc_open( ivas_cov_smooth_state_t **hCovState, /* i/o: SPAR Covar. smoothing handle */ const ivas_cov_smooth_cfg_t *cov_smooth_cfg, /* i : SPAR config. handle */ Loading @@ -5949,6 +5964,7 @@ void ivas_spar_covar_smooth_enc_close( ivas_cov_smooth_state_t **hCovState, /* i/o: SPAR Covar. encoder handle */ const int16_t nchan_inp /* i : number of input channels */ ); #endif #ifdef IVAS_FLOAT_FIXED void ivas_cov_smooth_process_fx( Loading @@ -5961,8 +5977,7 @@ void ivas_cov_smooth_process_fx( const Word16 transient_det[2], Word16 *q_cov[IVAS_SPAR_MAX_CH] ); #endif #else void ivas_cov_smooth_process( ivas_cov_smooth_state_t *hCovState, /* i/o: Covariance state handle */ float *cov_real[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], Loading @@ -5972,6 +5987,7 @@ void ivas_cov_smooth_process( const int16_t num_ch, const int16_t transient_det[2] ); #endif /* Transient detector module */ ivas_error ivas_transient_det_open( Loading
lib_com/ivas_prot_fx.h +5 −0 Original line number Diff line number Diff line Loading @@ -2393,6 +2393,11 @@ Word16 ism_quant_meta_fx( const Word16 cbsize /* i : codebook size */ ); /*! r: number of channels to be analysed */ Word16 getNumChanAnalysis_fx( Encoder_Struct *st_ivas /* i : IVAS encoder structure */ ); ivas_error ivas_limiter_open_fx( IVAS_LIMITER_HANDLE *hLimiter_out, /* o : limiter struct handle */ const Word16 max_num_channels, /* i : maximum number of I/O channels to be processed */ Loading
lib_com/ivas_stat_com.h +11 −7 Original line number Diff line number Diff line Loading @@ -367,24 +367,28 @@ typedef struct ivas_agc_com_state_t /* Covariance structures */ typedef struct ivas_cov_smooth_state_t { float *pPrior_cov_real[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH]; int16_t prior_bank_idx; float *pSmoothing_factor; int16_t num_bins; #ifdef IVAS_FLOAT_FIXED Word32 *pPrior_cov_real_fx[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH]; Word16 *q_cov_real[IVAS_SPAR_MAX_CH]; Word16 *q_cov_real_per_band[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH]; #else float *pPrior_cov_real[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH]; #endif int16_t prior_bank_idx; #ifdef IVAS_FLOAT_FIXED Word32 *pSmoothing_factor_fx; /* Q31 */ #else float *pSmoothing_factor; #endif int16_t num_bins; } ivas_cov_smooth_state_t; typedef struct ivas_cov_smooth_cfg_t { float max_update_rate; #ifdef IVAS_FLOAT_FIXED Word32 max_update_rate_fx; /* Q31 */ #else float max_update_rate; #endif int16_t min_pool_size; int16_t max_bands; Loading
lib_com/ivas_tools.c +12 −55 Original line number Diff line number Diff line Loading @@ -2555,64 +2555,21 @@ void lls_interp_n_fx( { Word16 i; const Word16 n_i_fx[11] = { 0, 2048, 4096, 6144, 8192, 10240, 12288, 14336, 16384, 18432, 20480 }; // Q11 move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); const Word16 one_by_n_fx[11] = { 0, 32767, 16384, 10911, 8192, 6553, 5459, 4681, 4096, 3640, 3276 }; move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); const Word16 sum_i_fx[12] = { 0, 0, 1, 3, 6, 10, 15, 21, 28, 36, 45, 55 }; move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); // 1.0f/ ( N * sum_ii[N] - sum_i[N] * sum_i[N] ) const Word32 res_table[12] = { 0, 0, 0, 357913952, 107374184, 42949672, 20452226, 10956549, 6391320, 3976821, 2603010, 385 }; move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); Word32 sum_x_fx, sum_ix_fx, slope_fx, offset_fx; Word16 dot_exp = 0, sum_ix_q = 0; move16(); move16(); move16(); move16(); Word32 num; assert( N > 0 && LE_16( N, 10 ) ); Loading