Loading lib_com/ivas_cnst.h +3 −0 Original line number Diff line number Diff line Loading @@ -1068,6 +1068,9 @@ typedef enum #define IVAS_SPAR_DYN_ACTIVEW_THRESH (0.0039f) #define IVAS_SPAR_DYN_ACTIVEW_THRESH_FX (8375186) /* 0.0039f in Q31 */ #define IVAS_SPAR_SIDE_CH_DYN_ACTIVEW_THRESH (32.0f) #ifdef IVAS_FLOAT_FIXED #define IVAS_SPAR_SIDE_CH_DYN_ACTIVEW_THRESH_Q0 (32) #endif #define MAX_QUANT_STRATS 3 #define MAX_CODING_STRATS 3 Loading lib_com/ivas_cov_smooth.c +51 −21 Original line number Diff line number Diff line Loading @@ -206,6 +206,7 @@ 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 @@ -216,6 +217,7 @@ 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 @@ -297,12 +299,11 @@ ivas_error ivas_spar_covar_smooth_enc_open( { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR COV encoder" ); } #else #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" ); } #endif for ( i = 0; i < nchan_inp; i++ ) { Loading @@ -319,6 +320,13 @@ ivas_error ivas_spar_covar_smooth_enc_open( 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 ) { 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 } } Loading Loading @@ -398,10 +406,9 @@ void ivas_spar_covar_smooth_enc_close( #ifdef IVAS_FLOAT_FIXED free( hCovState->pSmoothing_factor_fx ); hCovState->pSmoothing_factor_fx = NULL; #else #endif free( hCovState->pSmoothing_factor ); hCovState->pSmoothing_factor = NULL; #endif for ( i = 0; i < nchan_inp; i++ ) { Loading @@ -412,6 +419,10 @@ void ivas_spar_covar_smooth_enc_close( #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 Loading @@ -473,25 +484,35 @@ static void ivas_compute_smooth_cov_fx( const Word16 end_band, const Word16 num_ch, const Word16 transient_det[2], Word16 q_cov[][IVAS_SPAR_MAX_CH] ) Word16 *q_cov[IVAS_SPAR_MAX_CH] ) { Word16 i, j, k; Word16 prev_idx = hCovState->prior_bank_idx; Word32 factor = 0, L_tmp, L_tmp1; Word16 sm_b; Word16 non_sm_b_idx; Word16 q_tmp[IVAS_MAX_NUM_BANDS]; sm_b = BAND_SMOOTH_REST_START_IDX; move16(); assert( end_band <= pFb->filterbank_num_bands ); assert( LE_16( end_band, pFb->filterbank_num_bands ) ); IF( EQ_16( prev_idx, -1 ) || EQ_16( transient_det[1], 1 ) ) { FOR( i = 0; i < num_ch; i++ ) { FOR( j = 0; j < num_ch; j++ ) { set_s( hCovState->q_cov_real_per_band[i][j], q_cov[i][j], pFb->filterbank_num_bands ); } } FOR( i = 0; i < num_ch; i++ ) { FOR( k = start_band; k < end_band; k++ ) { L_tmp = Mpy_32_32( hCovState->pSmoothing_factor_fx[k], fac ); // (Q31, Q31) -> Q31 pCov_buf[i][i][k] = L_add( pCov_buf[i][i][k], L_shl( L_tmp, sub( q_cov[i][i], Q31 ) ) ); pCov_buf[i][i][k] = L_add( pCov_buf[i][i][k], L_shl( L_tmp, sub( hCovState->q_cov_real_per_band[i][i][k], Q31 ) ) ); move32(); } } Loading @@ -514,16 +535,20 @@ static void ivas_compute_smooth_cov_fx( move32(); } set_s( q_tmp, q_cov[i][j], sub( end_band, start_band ) ); FOR( k = start_band; k < non_sm_b_idx; k++ ) { L_tmp = Mpy_32_32( hCovState->pSmoothing_factor_fx[k], pCov_buf[i][j][k] ); // (Q31, q_cov[i][j]) -> q_cov[i][j] L_tmp1 = Mpy_32_32( L_sub( ONE_IN_Q31, hCovState->pSmoothing_factor_fx[k] ), pPrior_cov_buf[i][j][k] ); // (Q31, q_cov[i][j]) -> q_cov[i][j] pCov_buf[i][j][k] = L_add( L_tmp, L_tmp1 ); L_tmp1 = Mpy_32_32( L_sub( ONE_IN_Q31, hCovState->pSmoothing_factor_fx[k] ), pPrior_cov_buf[i][j][k] ); // (Q31, hCovState->q_cov_real_per_band[i][j][k]) -> hCovState->q_cov_real_per_band[i][j][k] pCov_buf[i][j][k] = BASOP_Util_Add_Mant32Exp( L_tmp, sub( Q31, q_cov[i][j] ), L_tmp1, sub( Q31, hCovState->q_cov_real_per_band[i][j][k] ), &q_tmp[k] ); move32(); L_tmp = L_shl( Mpy_32_32( hCovState->pSmoothing_factor_fx[k], factor ), sub( q_cov[i][j], Q31 ) ); // ((Q31, Q31) -> Q31) -> q_cov[i][j] q_tmp[k] = sub( Q31, q_tmp[k] ); move16(); L_tmp = L_shl( Mpy_32_32( hCovState->pSmoothing_factor_fx[k], factor ), sub( q_tmp[k], Q31 ) ); // ((Q31, Q31) -> Q31) -> q_tmp[k] pCov_buf[i][j][k] = L_add( pCov_buf[i][j][k], L_tmp ); move32(); } mvs2s( q_tmp, hCovState->q_cov_real_per_band[i][j], pFb->filterbank_num_bands ); } } FOR( i = 0; i < num_ch; i++ ) Loading @@ -531,7 +556,7 @@ static void ivas_compute_smooth_cov_fx( FOR( k = non_sm_b_idx; k < end_band; k++ ) { L_tmp = Mpy_32_32( hCovState->pSmoothing_factor_fx[k], fac ); // (Q31, Q31) -> Q31 pCov_buf[i][i][k] = L_add( pCov_buf[i][i][k], L_shl( L_tmp, sub( q_cov[i][i], Q31 ) ) ); pCov_buf[i][i][k] = L_add( pCov_buf[i][i][k], L_shl( L_tmp, sub( hCovState->q_cov_real_per_band[i][i][k], Q31 ) ) ); move32(); } } Loading @@ -556,20 +581,25 @@ static void ivas_compute_smooth_cov_fx( FOR( k = start_band; k < end_band; k++ ) { L_tmp = Mpy_32_32( hCovState->pSmoothing_factor_fx[k], pCov_buf[i][j][k] ); // (Q31, q_cov[i][j]) -> q_cov[i][j] L_tmp1 = Mpy_32_32( L_sub( ONE_IN_Q31, hCovState->pSmoothing_factor_fx[k] ), pPrior_cov_buf[i][j][k] ); // (Q31, q_cov[i][j]) -> q_cov[i][j] pCov_buf[i][j][k] = L_add( L_tmp, L_tmp1 ); L_tmp1 = Mpy_32_32( L_sub( ONE_IN_Q31, hCovState->pSmoothing_factor_fx[k] ), pPrior_cov_buf[i][j][k] ); // (Q31, hCovState->q_cov_real_per_band[i][j][k]) -> hCovState->q_cov_real_per_band[i][j][k] pCov_buf[i][j][k] = BASOP_Util_Add_Mant32Exp( L_tmp, sub( Q31, q_cov[i][j] ), L_tmp1, sub( Q31, hCovState->q_cov_real_per_band[i][j][k] ), &q_tmp[k] ); move32(); L_tmp = L_shl( Mpy_32_32( hCovState->pSmoothing_factor_fx[k], factor ), sub( q_cov[i][j], Q31 ) ); // ((Q31, Q31) -> Q31) -> q_cov[i][j] q_tmp[k] = sub( Q31, q_tmp[k] ); move16(); L_tmp = L_shl( Mpy_32_32( hCovState->pSmoothing_factor_fx[k], factor ), sub( q_tmp[k], Q31 ) ); // ((Q31, Q31) -> Q31) -> q_tmp[k] pCov_buf[i][j][k] = L_add( pCov_buf[i][j][k], L_tmp ); move32(); } mvs2s( q_tmp, hCovState->q_cov_real_per_band[i][j], pFb->filterbank_num_bands ); } } } return; } #else #endif /*-----------------------------------------------------------------------------------------* * Function ivas_compute_smooth_cov() * Loading Loading @@ -661,7 +691,6 @@ static void ivas_compute_smooth_cov( return; } #endif #ifdef IVAS_FLOAT_FIXED Loading @@ -679,12 +708,12 @@ void ivas_cov_smooth_process_fx( const Word16 end_band, const Word16 num_ch, const Word16 transient_det[2], Word16 q_cov[][IVAS_SPAR_MAX_CH] ) Word16 *q_cov[IVAS_SPAR_MAX_CH] ) { Word16 i, j; Word16 num_bands = end_band - start_band; Word16 num_bands = sub( end_band, start_band ); ivas_compute_smooth_cov_fx( hCovState, pFb, cov_real, hCovState->pPrior_cov_real_fx, (Word32) ( 1e-20f * ONE_IN_Q31 ), start_band, end_band, num_ch, transient_det, q_cov ); ivas_compute_smooth_cov_fx( hCovState, pFb, cov_real, hCovState->pPrior_cov_real_fx, 0, start_band, end_band, num_ch, transient_det, q_cov ); FOR( i = 0; i < num_ch; i++ ) { Loading @@ -699,7 +728,9 @@ void ivas_cov_smooth_process_fx( return; } #else #endif /*-----------------------------------------------------------------------------------------* * Function ivas_cov_smooth_process() * Loading Loading @@ -732,4 +763,3 @@ void ivas_cov_smooth_process( return; } #endif lib_com/ivas_fb_mixer.c +10 −1 Original line number Diff line number Diff line Loading @@ -62,6 +62,7 @@ static ivas_error ivas_fb_mixer_get_window_fx( const Word16 fade_len, const Word #endif #ifdef IVAS_FLOAT_FIXED /*-----------------------------------------------------------------------------------------* * Function ivas_get_num_bands_from_bw_idx() * Loading @@ -69,7 +70,6 @@ static ivas_error ivas_fb_mixer_get_window_fx( const Word16 fade_len, const Word *-----------------------------------------------------------------------------------------*/ /*! r: number of spectral bands */ #ifdef IVAS_FLOAT_FIXED Word16 ivas_get_num_bands_from_bw_idx( const Word16 bwidth /* i : audio bandwidth */ ) Loading @@ -78,10 +78,18 @@ Word16 ivas_get_num_bands_from_bw_idx( assert( bwidth > 0 ); /*NB BW is not supported*/ num_active_bands = ivas_num_active_bands[bwidth - 1]; move16(); return num_active_bands; } #else /*-----------------------------------------------------------------------------------------* * Function ivas_get_num_bands_from_bw_idx() * * Get number of bands from BW index *-----------------------------------------------------------------------------------------*/ /*! r: number of spectral bands */ int16_t ivas_get_num_bands_from_bw_idx( const int16_t bwidth /* i : audio bandwidth */ ) Loading @@ -95,6 +103,7 @@ int16_t ivas_get_num_bands_from_bw_idx( } #endif /*-----------------------------------------------------------------------------------------* * Function ivas_get_num_bands() * Loading lib_com/ivas_prot.h +47 −22 Original line number Diff line number Diff line Loading @@ -5868,26 +5868,30 @@ void ivas_spar_covar_enc_close( ); #ifdef IVAS_FLOAT_FIXED ivas_error ivas_enc_cov_handler_process( void ivas_enc_cov_handler_process_fx( ivas_enc_cov_handler_state_t *hCovEnc, /* i/o: SPAR Covar. encoder handle */ float **ppIn_FR_real, float **ppIn_FR_imag, float *cov_real[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], float *cov_dtx_real[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], Word32 **ppIn_FR_real, Word32 **ppIn_FR_imag, Word16 *q_ppIn_FR, Word32 *cov_real[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], Word16 *q_cov_real[IVAS_SPAR_MAX_CH], Word32 *cov_dtx_real[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], Word16 *q_cov_dtx_real[IVAS_SPAR_MAX_CH], ivas_filterbank_t *pFb, /* i/o: FB handle */ const int16_t start_band, const int16_t end_band, const int16_t num_ch, const int16_t dtx_vad, const int16_t transient_det[2], const int16_t HOA_md_ind[IVAS_SPAR_MAX_CH], int16_t *res_ind, const int16_t *remix_order, int16_t *dyn_active_w_flag, const int16_t nchan_transport, const int16_t is_sba const Word16 start_band, const Word16 end_band, const Word16 num_ch, const Word16 dtx_vad, const Word16 transient_det[2], const Word16 HOA_md_ind[IVAS_SPAR_MAX_CH], Word16 *res_ind, const Word16 *remix_order, Word16 *dyn_active_w_flag, const Word16 nchan_transport, const Word16 is_sba ); #else #endif void ivas_enc_cov_handler_process( ivas_enc_cov_handler_state_t *hCovEnc, /* i/o: SPAR Covar. encoder handle */ float **ppIn_FR_real, Loading @@ -5907,6 +5911,21 @@ void ivas_enc_cov_handler_process( const int16_t nchan_transport, const int16_t is_sba ); #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 */ ivas_filterbank_t *pFb, /* i/o: FB handle */ 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_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 ivas_error ivas_spar_covar_smooth_enc_open( Loading @@ -5932,9 +5951,10 @@ void ivas_cov_smooth_process_fx( const Word16 end_band, const Word16 num_ch, const Word16 transient_det[2], Word16 q_cov[][IVAS_SPAR_MAX_CH] Word16 *q_cov[IVAS_SPAR_MAX_CH] ); #else #endif 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 @@ -5944,7 +5964,6 @@ 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 Loading @@ -7591,9 +7610,15 @@ void ivas_fb_mixer_cross_fading( ); /*! r: number of spectral bands */ #ifdef IVAS_FLOAT_FIXED Word16 ivas_get_num_bands_from_bw_idx( const Word16 bwidth /* i : audio bandwidth */ ); #else int16_t ivas_get_num_bands_from_bw_idx( const int16_t bwidth /* i : audio bandwidth */ ); #endif #ifdef IVAS_FLOAT_FIXED /*to be moved to prot_fx1.h*/ Loading lib_com/ivas_stat_com.h +4 −5 Original line number Diff line number Diff line Loading @@ -369,12 +369,12 @@ typedef struct ivas_cov_smooth_state_t { float *pPrior_cov_real[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH]; int16_t prior_bank_idx; #ifndef IVAS_FLOAT_FIXED float *pSmoothing_factor; #endif 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]; Word32 *pSmoothing_factor_fx; /* Q31 */ #endif Loading @@ -382,9 +382,8 @@ typedef struct ivas_cov_smooth_state_t typedef struct ivas_cov_smooth_cfg_t { #ifndef IVAS_FLOAT_FIXED float max_update_rate; #else #ifdef IVAS_FLOAT_FIXED Word32 max_update_rate_fx; /* Q31 */ #endif int16_t min_pool_size; Loading Loading
lib_com/ivas_cnst.h +3 −0 Original line number Diff line number Diff line Loading @@ -1068,6 +1068,9 @@ typedef enum #define IVAS_SPAR_DYN_ACTIVEW_THRESH (0.0039f) #define IVAS_SPAR_DYN_ACTIVEW_THRESH_FX (8375186) /* 0.0039f in Q31 */ #define IVAS_SPAR_SIDE_CH_DYN_ACTIVEW_THRESH (32.0f) #ifdef IVAS_FLOAT_FIXED #define IVAS_SPAR_SIDE_CH_DYN_ACTIVEW_THRESH_Q0 (32) #endif #define MAX_QUANT_STRATS 3 #define MAX_CODING_STRATS 3 Loading
lib_com/ivas_cov_smooth.c +51 −21 Original line number Diff line number Diff line Loading @@ -206,6 +206,7 @@ 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 @@ -216,6 +217,7 @@ 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 @@ -297,12 +299,11 @@ ivas_error ivas_spar_covar_smooth_enc_open( { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR COV encoder" ); } #else #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" ); } #endif for ( i = 0; i < nchan_inp; i++ ) { Loading @@ -319,6 +320,13 @@ ivas_error ivas_spar_covar_smooth_enc_open( 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 ) { 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 } } Loading Loading @@ -398,10 +406,9 @@ void ivas_spar_covar_smooth_enc_close( #ifdef IVAS_FLOAT_FIXED free( hCovState->pSmoothing_factor_fx ); hCovState->pSmoothing_factor_fx = NULL; #else #endif free( hCovState->pSmoothing_factor ); hCovState->pSmoothing_factor = NULL; #endif for ( i = 0; i < nchan_inp; i++ ) { Loading @@ -412,6 +419,10 @@ void ivas_spar_covar_smooth_enc_close( #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 Loading @@ -473,25 +484,35 @@ static void ivas_compute_smooth_cov_fx( const Word16 end_band, const Word16 num_ch, const Word16 transient_det[2], Word16 q_cov[][IVAS_SPAR_MAX_CH] ) Word16 *q_cov[IVAS_SPAR_MAX_CH] ) { Word16 i, j, k; Word16 prev_idx = hCovState->prior_bank_idx; Word32 factor = 0, L_tmp, L_tmp1; Word16 sm_b; Word16 non_sm_b_idx; Word16 q_tmp[IVAS_MAX_NUM_BANDS]; sm_b = BAND_SMOOTH_REST_START_IDX; move16(); assert( end_band <= pFb->filterbank_num_bands ); assert( LE_16( end_band, pFb->filterbank_num_bands ) ); IF( EQ_16( prev_idx, -1 ) || EQ_16( transient_det[1], 1 ) ) { FOR( i = 0; i < num_ch; i++ ) { FOR( j = 0; j < num_ch; j++ ) { set_s( hCovState->q_cov_real_per_band[i][j], q_cov[i][j], pFb->filterbank_num_bands ); } } FOR( i = 0; i < num_ch; i++ ) { FOR( k = start_band; k < end_band; k++ ) { L_tmp = Mpy_32_32( hCovState->pSmoothing_factor_fx[k], fac ); // (Q31, Q31) -> Q31 pCov_buf[i][i][k] = L_add( pCov_buf[i][i][k], L_shl( L_tmp, sub( q_cov[i][i], Q31 ) ) ); pCov_buf[i][i][k] = L_add( pCov_buf[i][i][k], L_shl( L_tmp, sub( hCovState->q_cov_real_per_band[i][i][k], Q31 ) ) ); move32(); } } Loading @@ -514,16 +535,20 @@ static void ivas_compute_smooth_cov_fx( move32(); } set_s( q_tmp, q_cov[i][j], sub( end_band, start_band ) ); FOR( k = start_band; k < non_sm_b_idx; k++ ) { L_tmp = Mpy_32_32( hCovState->pSmoothing_factor_fx[k], pCov_buf[i][j][k] ); // (Q31, q_cov[i][j]) -> q_cov[i][j] L_tmp1 = Mpy_32_32( L_sub( ONE_IN_Q31, hCovState->pSmoothing_factor_fx[k] ), pPrior_cov_buf[i][j][k] ); // (Q31, q_cov[i][j]) -> q_cov[i][j] pCov_buf[i][j][k] = L_add( L_tmp, L_tmp1 ); L_tmp1 = Mpy_32_32( L_sub( ONE_IN_Q31, hCovState->pSmoothing_factor_fx[k] ), pPrior_cov_buf[i][j][k] ); // (Q31, hCovState->q_cov_real_per_band[i][j][k]) -> hCovState->q_cov_real_per_band[i][j][k] pCov_buf[i][j][k] = BASOP_Util_Add_Mant32Exp( L_tmp, sub( Q31, q_cov[i][j] ), L_tmp1, sub( Q31, hCovState->q_cov_real_per_band[i][j][k] ), &q_tmp[k] ); move32(); L_tmp = L_shl( Mpy_32_32( hCovState->pSmoothing_factor_fx[k], factor ), sub( q_cov[i][j], Q31 ) ); // ((Q31, Q31) -> Q31) -> q_cov[i][j] q_tmp[k] = sub( Q31, q_tmp[k] ); move16(); L_tmp = L_shl( Mpy_32_32( hCovState->pSmoothing_factor_fx[k], factor ), sub( q_tmp[k], Q31 ) ); // ((Q31, Q31) -> Q31) -> q_tmp[k] pCov_buf[i][j][k] = L_add( pCov_buf[i][j][k], L_tmp ); move32(); } mvs2s( q_tmp, hCovState->q_cov_real_per_band[i][j], pFb->filterbank_num_bands ); } } FOR( i = 0; i < num_ch; i++ ) Loading @@ -531,7 +556,7 @@ static void ivas_compute_smooth_cov_fx( FOR( k = non_sm_b_idx; k < end_band; k++ ) { L_tmp = Mpy_32_32( hCovState->pSmoothing_factor_fx[k], fac ); // (Q31, Q31) -> Q31 pCov_buf[i][i][k] = L_add( pCov_buf[i][i][k], L_shl( L_tmp, sub( q_cov[i][i], Q31 ) ) ); pCov_buf[i][i][k] = L_add( pCov_buf[i][i][k], L_shl( L_tmp, sub( hCovState->q_cov_real_per_band[i][i][k], Q31 ) ) ); move32(); } } Loading @@ -556,20 +581,25 @@ static void ivas_compute_smooth_cov_fx( FOR( k = start_band; k < end_band; k++ ) { L_tmp = Mpy_32_32( hCovState->pSmoothing_factor_fx[k], pCov_buf[i][j][k] ); // (Q31, q_cov[i][j]) -> q_cov[i][j] L_tmp1 = Mpy_32_32( L_sub( ONE_IN_Q31, hCovState->pSmoothing_factor_fx[k] ), pPrior_cov_buf[i][j][k] ); // (Q31, q_cov[i][j]) -> q_cov[i][j] pCov_buf[i][j][k] = L_add( L_tmp, L_tmp1 ); L_tmp1 = Mpy_32_32( L_sub( ONE_IN_Q31, hCovState->pSmoothing_factor_fx[k] ), pPrior_cov_buf[i][j][k] ); // (Q31, hCovState->q_cov_real_per_band[i][j][k]) -> hCovState->q_cov_real_per_band[i][j][k] pCov_buf[i][j][k] = BASOP_Util_Add_Mant32Exp( L_tmp, sub( Q31, q_cov[i][j] ), L_tmp1, sub( Q31, hCovState->q_cov_real_per_band[i][j][k] ), &q_tmp[k] ); move32(); L_tmp = L_shl( Mpy_32_32( hCovState->pSmoothing_factor_fx[k], factor ), sub( q_cov[i][j], Q31 ) ); // ((Q31, Q31) -> Q31) -> q_cov[i][j] q_tmp[k] = sub( Q31, q_tmp[k] ); move16(); L_tmp = L_shl( Mpy_32_32( hCovState->pSmoothing_factor_fx[k], factor ), sub( q_tmp[k], Q31 ) ); // ((Q31, Q31) -> Q31) -> q_tmp[k] pCov_buf[i][j][k] = L_add( pCov_buf[i][j][k], L_tmp ); move32(); } mvs2s( q_tmp, hCovState->q_cov_real_per_band[i][j], pFb->filterbank_num_bands ); } } } return; } #else #endif /*-----------------------------------------------------------------------------------------* * Function ivas_compute_smooth_cov() * Loading Loading @@ -661,7 +691,6 @@ static void ivas_compute_smooth_cov( return; } #endif #ifdef IVAS_FLOAT_FIXED Loading @@ -679,12 +708,12 @@ void ivas_cov_smooth_process_fx( const Word16 end_band, const Word16 num_ch, const Word16 transient_det[2], Word16 q_cov[][IVAS_SPAR_MAX_CH] ) Word16 *q_cov[IVAS_SPAR_MAX_CH] ) { Word16 i, j; Word16 num_bands = end_band - start_band; Word16 num_bands = sub( end_band, start_band ); ivas_compute_smooth_cov_fx( hCovState, pFb, cov_real, hCovState->pPrior_cov_real_fx, (Word32) ( 1e-20f * ONE_IN_Q31 ), start_band, end_band, num_ch, transient_det, q_cov ); ivas_compute_smooth_cov_fx( hCovState, pFb, cov_real, hCovState->pPrior_cov_real_fx, 0, start_band, end_band, num_ch, transient_det, q_cov ); FOR( i = 0; i < num_ch; i++ ) { Loading @@ -699,7 +728,9 @@ void ivas_cov_smooth_process_fx( return; } #else #endif /*-----------------------------------------------------------------------------------------* * Function ivas_cov_smooth_process() * Loading Loading @@ -732,4 +763,3 @@ void ivas_cov_smooth_process( return; } #endif
lib_com/ivas_fb_mixer.c +10 −1 Original line number Diff line number Diff line Loading @@ -62,6 +62,7 @@ static ivas_error ivas_fb_mixer_get_window_fx( const Word16 fade_len, const Word #endif #ifdef IVAS_FLOAT_FIXED /*-----------------------------------------------------------------------------------------* * Function ivas_get_num_bands_from_bw_idx() * Loading @@ -69,7 +70,6 @@ static ivas_error ivas_fb_mixer_get_window_fx( const Word16 fade_len, const Word *-----------------------------------------------------------------------------------------*/ /*! r: number of spectral bands */ #ifdef IVAS_FLOAT_FIXED Word16 ivas_get_num_bands_from_bw_idx( const Word16 bwidth /* i : audio bandwidth */ ) Loading @@ -78,10 +78,18 @@ Word16 ivas_get_num_bands_from_bw_idx( assert( bwidth > 0 ); /*NB BW is not supported*/ num_active_bands = ivas_num_active_bands[bwidth - 1]; move16(); return num_active_bands; } #else /*-----------------------------------------------------------------------------------------* * Function ivas_get_num_bands_from_bw_idx() * * Get number of bands from BW index *-----------------------------------------------------------------------------------------*/ /*! r: number of spectral bands */ int16_t ivas_get_num_bands_from_bw_idx( const int16_t bwidth /* i : audio bandwidth */ ) Loading @@ -95,6 +103,7 @@ int16_t ivas_get_num_bands_from_bw_idx( } #endif /*-----------------------------------------------------------------------------------------* * Function ivas_get_num_bands() * Loading
lib_com/ivas_prot.h +47 −22 Original line number Diff line number Diff line Loading @@ -5868,26 +5868,30 @@ void ivas_spar_covar_enc_close( ); #ifdef IVAS_FLOAT_FIXED ivas_error ivas_enc_cov_handler_process( void ivas_enc_cov_handler_process_fx( ivas_enc_cov_handler_state_t *hCovEnc, /* i/o: SPAR Covar. encoder handle */ float **ppIn_FR_real, float **ppIn_FR_imag, float *cov_real[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], float *cov_dtx_real[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], Word32 **ppIn_FR_real, Word32 **ppIn_FR_imag, Word16 *q_ppIn_FR, Word32 *cov_real[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], Word16 *q_cov_real[IVAS_SPAR_MAX_CH], Word32 *cov_dtx_real[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], Word16 *q_cov_dtx_real[IVAS_SPAR_MAX_CH], ivas_filterbank_t *pFb, /* i/o: FB handle */ const int16_t start_band, const int16_t end_band, const int16_t num_ch, const int16_t dtx_vad, const int16_t transient_det[2], const int16_t HOA_md_ind[IVAS_SPAR_MAX_CH], int16_t *res_ind, const int16_t *remix_order, int16_t *dyn_active_w_flag, const int16_t nchan_transport, const int16_t is_sba const Word16 start_band, const Word16 end_band, const Word16 num_ch, const Word16 dtx_vad, const Word16 transient_det[2], const Word16 HOA_md_ind[IVAS_SPAR_MAX_CH], Word16 *res_ind, const Word16 *remix_order, Word16 *dyn_active_w_flag, const Word16 nchan_transport, const Word16 is_sba ); #else #endif void ivas_enc_cov_handler_process( ivas_enc_cov_handler_state_t *hCovEnc, /* i/o: SPAR Covar. encoder handle */ float **ppIn_FR_real, Loading @@ -5907,6 +5911,21 @@ void ivas_enc_cov_handler_process( const int16_t nchan_transport, const int16_t is_sba ); #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 */ ivas_filterbank_t *pFb, /* i/o: FB handle */ 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_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 ivas_error ivas_spar_covar_smooth_enc_open( Loading @@ -5932,9 +5951,10 @@ void ivas_cov_smooth_process_fx( const Word16 end_band, const Word16 num_ch, const Word16 transient_det[2], Word16 q_cov[][IVAS_SPAR_MAX_CH] Word16 *q_cov[IVAS_SPAR_MAX_CH] ); #else #endif 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 @@ -5944,7 +5964,6 @@ 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 Loading @@ -7591,9 +7610,15 @@ void ivas_fb_mixer_cross_fading( ); /*! r: number of spectral bands */ #ifdef IVAS_FLOAT_FIXED Word16 ivas_get_num_bands_from_bw_idx( const Word16 bwidth /* i : audio bandwidth */ ); #else int16_t ivas_get_num_bands_from_bw_idx( const int16_t bwidth /* i : audio bandwidth */ ); #endif #ifdef IVAS_FLOAT_FIXED /*to be moved to prot_fx1.h*/ Loading
lib_com/ivas_stat_com.h +4 −5 Original line number Diff line number Diff line Loading @@ -369,12 +369,12 @@ typedef struct ivas_cov_smooth_state_t { float *pPrior_cov_real[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH]; int16_t prior_bank_idx; #ifndef IVAS_FLOAT_FIXED float *pSmoothing_factor; #endif 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]; Word32 *pSmoothing_factor_fx; /* Q31 */ #endif Loading @@ -382,9 +382,8 @@ typedef struct ivas_cov_smooth_state_t typedef struct ivas_cov_smooth_cfg_t { #ifndef IVAS_FLOAT_FIXED float max_update_rate; #else #ifdef IVAS_FLOAT_FIXED Word32 max_update_rate_fx; /* Q31 */ #endif int16_t min_pool_size; Loading