From dbcb5c7f9d1b6dd0a69aebcdb32d47bd45d543b2 Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 5 Jun 2023 14:45:03 +0200 Subject: [PATCH 1/3] Formatting after acceptance of switches --- lib_com/bitstream.c | 35 ++-- lib_com/ivas_cnst.h | 3 +- lib_com/ivas_cov_smooth.c | 11 +- lib_com/ivas_fb_mixer.c | 26 +-- lib_com/ivas_prot.h | 95 ++++----- lib_com/ivas_qmetadata_com.c | 5 +- lib_com/ivas_sba_config.c | 18 +- lib_com/ivas_spar_com.c | 1 + lib_com/lsf_tools.c | 87 +++++--- lib_com/prot.h | 219 ++++++++++---------- lib_dec/acelp_core_dec.c | 5 +- lib_dec/ivas_dirac_output_synthesis_dec.c | 202 +++++++++---------- lib_dec/ivas_ism_dec.c | 3 +- lib_dec/ivas_ism_param_dec.c | 5 +- lib_dec/ivas_qmetadata_dec.c | 5 +- lib_dec/ivas_sba_dec.c | 4 +- lib_dec/ivas_spar_decoder.c | 8 +- lib_dec/ivas_spar_md_dec.c | 54 ++--- lib_dec/ivas_stereo_dft_dec.c | 2 +- lib_dec/lsf_dec.c | 24 +-- lib_enc/ivas_dirac_enc.c | 6 +- lib_enc/ivas_enc_cov_handler.c | 3 +- lib_enc/ivas_init_enc.c | 5 +- lib_enc/ivas_mc_paramupmix_enc.c | 12 +- lib_enc/ivas_qmetadata_enc.c | 7 +- lib_enc/lib_enc.c | 6 +- lib_enc/lsf_enc.c | 5 +- lib_enc/lsf_msvq_ma_enc.c | 233 +++++++++++----------- 28 files changed, 538 insertions(+), 551 deletions(-) diff --git a/lib_com/bitstream.c b/lib_com/bitstream.c index c9571d41c1..076f8d51f1 100755 --- a/lib_com/bitstream.c +++ b/lib_com/bitstream.c @@ -228,8 +228,8 @@ Word16 rate2EVSmode( *-------------------------------------------------------------------*/ ivas_error ind_list_realloc( - BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ - int16_t max_num_indices /* i : new maximum number of allowed indices in the list */ + BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ + const int16_t max_num_indices /* i : new maximum number of allowed indices in the list */ ) { int16_t i, ind_list_pos; @@ -281,9 +281,10 @@ ivas_error ind_list_realloc( * Get the maximum allowed number of indices in the encoder *-----------------------------------------------------------------------*/ -int16_t get_ivas_max_num_indices( /* o : maximum number of indices */ - const IVAS_FORMAT ivas_format, /* i : IVAS format */ - const int32_t ivas_total_brate /* i : IVAS total bitrate */ +/*! r: maximum number of indices */ +int16_t get_ivas_max_num_indices( + const IVAS_FORMAT ivas_format, /* i : IVAS format */ + const int32_t ivas_total_brate /* i : IVAS total bitrate */ ) { if ( ivas_format == STEREO_FORMAT ) @@ -519,9 +520,10 @@ int16_t get_ivas_max_num_indices( /* o : maximum * Get the maximum allowed number of indices in the core coder *-----------------------------------------------------------------------*/ -int16_t get_core_max_num_indices( /* o : maximum number of indices */ - const int16_t core, /* i : core */ - const int32_t total_brate /* i : total bitrate */ +/*! r: maximum number of indices */ +int16_t get_core_max_num_indices( + const int16_t core, /* i : core */ + const int32_t total_brate /* i : total bitrate */ ) { /* set the maximum number of indices in the core coder */ @@ -694,8 +696,9 @@ int16_t get_core_max_num_indices( /* o : maximum numb * Get the maximum number of indices in the BWE *-----------------------------------------------------------------------*/ -int16_t get_BWE_max_num_indices( /* o : maximum number of indices */ - const int32_t extl_brate /* i : extensiona layer bitrate */ +/*! r: maximum number of indices */ +int16_t get_BWE_max_num_indices( + const int32_t extl_brate /* i : extensiona layer bitrate */ ) { /* set the maximum number of indices in the BWE */ @@ -716,9 +719,10 @@ int16_t get_BWE_max_num_indices( /* o : maximum number * Set the maximum allowed number of metadata indices in the list *-----------------------------------------------------------------------*/ -int16_t get_ivas_max_num_indices_metadata( /* o : maximum number of indices */ - const IVAS_FORMAT ivas_format, /* i : IVAS format */ - const int32_t ivas_total_brate /* i : IVAS total bitrate */ +/*! r: maximum number of indices */ +int16_t get_ivas_max_num_indices_metadata( + const IVAS_FORMAT ivas_format, /* i : IVAS format */ + const int32_t ivas_total_brate /* i : IVAS total bitrate */ ) { /* set the maximum required number of metadata indices */ @@ -1348,7 +1352,7 @@ void push_next_bits( /*! r: result: index of the indice in the list, -1 if not found */ int16_t find_indice( BSTR_ENC_HANDLE hBstr, /* i : encoder bitstream handle */ - int16_t id, /* i : ID of the indice */ + const int16_t id, /* i : ID of the indice */ uint16_t *value, /* o : value of the quantized indice */ int16_t *nb_bits /* o : number of bits used to quantize the indice */ ) @@ -1368,6 +1372,7 @@ int16_t find_indice( return -1; } + /*-------------------------------------------------------------------* * delete_indice() * @@ -1377,7 +1382,7 @@ int16_t find_indice( /*! r: number of deleted indices */ uint16_t delete_indice( BSTR_ENC_HANDLE hBstr, /* i : encoder bitstream handle */ - int16_t id /* i : ID of the indice */ + const int16_t id /* i : ID of the indice */ ) { int16_t i, j; diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index 9557f7aef1..897a7c4c18 100755 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -996,8 +996,7 @@ typedef enum typedef enum { DIRAC_OPEN, /* initialize to default value */ - DIRAC_RECONFIGURE /* HOA3 */ - , + DIRAC_RECONFIGURE, /* HOA3 */ DIRAC_RECONFIGURE_MODE } DIRAC_CONFIG_FLAG; diff --git a/lib_com/ivas_cov_smooth.c b/lib_com/ivas_cov_smooth.c index e407bccc6c..4ab255bc2b 100644 --- a/lib_com/ivas_cov_smooth.c +++ b/lib_com/ivas_cov_smooth.c @@ -53,12 +53,10 @@ 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 int16_t min_pool_size, #ifdef FIX_489_COV_SMOOTHING - , - const COV_SMOOTHING_TYPE smooth_mode /* i : flag multichannel vs SPAR */ + const COV_SMOOTHING_TYPE smooth_mode, /* i : flag multichannel vs SPAR */ #endif - , const int32_t ivas_total_brate ) { int16_t j, k; @@ -157,10 +155,9 @@ 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 */ ivas_filterbank_t *pFb, /* i/o: FB handle */ - const int16_t nchan_inp /* i : number of input channels */ - , + const int16_t nchan_inp, /* i : number of input channels */ #ifdef FIX_489_COV_SMOOTHING - COV_SMOOTHING_TYPE smooth_mode, /* i : Smooth covariance for SPAR or MC */ + const COV_SMOOTHING_TYPE smooth_mode, /* i : Smooth covariance for SPAR or MC */ #endif const int32_t ivas_total_brate /* i : IVAS total bitrate */ ) diff --git a/lib_com/ivas_fb_mixer.c b/lib_com/ivas_fb_mixer.c index dbbce9afe4..d4c00dc2d5 100644 --- a/lib_com/ivas_fb_mixer.c +++ b/lib_com/ivas_fb_mixer.c @@ -107,9 +107,8 @@ ivas_error ivas_fb_set_cfg( const int16_t num_in_chans, /* i : number of FB input channels */ const int16_t num_out_chans, /* i : number of FB output channels */ const int16_t active_w_mixing, /* i : active_w_mixing flag */ - const int32_t sampling_rate /* i : sampling rate */ - , - const int16_t nchan_fb_in /* i : number of dirAC analysis channels*/ + const int32_t sampling_rate, /* i : sampling rate */ + const int16_t nchan_fb_in /* i : number of dirAC analysis channels*/ ) { IVAS_FB_CFG *pFb_cfg; @@ -495,8 +494,7 @@ void ivas_fb_mixer_pcm_ingest( IVAS_FB_MIXER_HANDLE hFbMixer, /* i/o: FB mixer handle */ float pcm_in[][L_FRAME48k], /* i : input audio channels */ float **ppOut_pcm, /* o : output audio channels */ - const int16_t frame_len /* i : frame length */ - , + const int16_t frame_len, /* i : frame length */ const int16_t HOA_md_ind[IVAS_SPAR_MAX_CH] ) { int16_t i; @@ -536,16 +534,13 @@ void ivas_fb_mixer_pcm_ingest( void ivas_fb_mixer_update_prior_input( IVAS_FB_MIXER_HANDLE hFbMixer, /* i/o: FB mixer handle */ float *pcm_in[], /* i : input audio channels */ - const int16_t length /* i : length of time slot */ - , - const int16_t nchan_fb_in /* i : number of analysis channels */ + const int16_t length, /* i : length of time slot */ + const int16_t nchan_fb_in /* i : number of analysis channels */ ) { int16_t i; - for ( i = 0; i < - nchan_fb_in; - i++ ) + for ( i = 0; i < nchan_fb_in; i++ ) { mvr2r( &hFbMixer->ppFilterbank_prior_input[i][length], hFbMixer->ppFilterbank_prior_input[i], hFbMixer->fb_cfg->prior_input_length - length ); mvr2r( pcm_in[i], &hFbMixer->ppFilterbank_prior_input[i][hFbMixer->fb_cfg->prior_input_length - length], length ); @@ -567,9 +562,8 @@ void ivas_fb_mixer_get_windowed_fr( float *frame_f_real[], /* o : real freq domain values */ float *frame_f_imag[], /* o : imag freq domain values */ const int16_t length, /* i : number of new samples in time slot */ - const int16_t mdft_len /* i : MDFT frame length */ - , - const int16_t nchan_fb_in /* i : number of analysis channels */ + const int16_t mdft_len, /* i : MDFT frame length */ + const int16_t nchan_fb_in /* i : number of analysis channels */ ) { int16_t ch_idx, j, offset, rev_offset; @@ -850,8 +844,8 @@ static int16_t ivas_calculate_abs_fr( float short_stride_nrg = 0.0f; float cldfb_nrg = 0.0f; int16_t short_stride = pFb->fb_bin_to_band.short_stride; - const int16_t num_bins_per_short_stride_bin = ( const int16_t )( ( sampling_rate / FRAMES_PER_SEC ) / short_stride ); - const int16_t num_bins_per_cldfb_band = ( const int16_t )( ( sampling_rate / FRAMES_PER_SEC ) / pFb->fb_bin_to_band.num_cldfb_bands ); + const int16_t num_bins_per_short_stride_bin = (const int16_t) ( ( sampling_rate / FRAMES_PER_SEC ) / short_stride ); + const int16_t num_bins_per_cldfb_band = (const int16_t) ( ( sampling_rate / FRAMES_PER_SEC ) / pFb->fb_bin_to_band.num_cldfb_bands ); float short_stride_max_per_spar_band = 1e-9f; /*loop over all stored Filter Bank Response MDFT coefficients*/ diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 2804668e0f..c33c53457c 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -666,7 +666,7 @@ ivas_error ivas_mc_enc_config( ivas_error ivas_mc_dec_config( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ const int16_t idx /* i : LS config. index */ - #ifdef JBM_TSM_ON_TCS +#ifdef JBM_TSM_ON_TCS , uint16_t *nSamplesRendered, /* o : samples flushed from last frame (JBM) */ int16_t *data /* o : flushed samples (JBM) */ @@ -1014,8 +1014,7 @@ void ivas_param_ism_stereo_dmx( ); void ivas_param_ism_config( - PARAM_ISM_CONFIG_HANDLE hParamIsm /* i/o: IVAS Param ISM Config Structure */ - , + PARAM_ISM_CONFIG_HANDLE hParamIsm, /* i/o: IVAS Param ISM Config Structure */ const int16_t nchan_ism /* i : number of ISM channels */ ); @@ -1024,8 +1023,7 @@ ivas_error ivas_ism_enc_config( ); ivas_error ivas_ism_dec_config( - Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ - , + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ const ISM_MODE last_ism_mode /* i/o: last ISM mode */ #ifdef JBM_TSM_ON_TCS , @@ -1335,7 +1333,7 @@ void stereo_dft_dec( const int16_t nchan_transport /* i : number of transpor channels */ #ifdef FIX_STEREO_474 , - const int16_t num_md_sub_frames /* i: number of MD subframes */ + const int16_t num_md_sub_frames /* i : number of MD subframes */ #endif ); @@ -3104,8 +3102,7 @@ void mdct_read_IGF_bits( ivas_error ivas_qmetadata_enc_encode( BSTR_ENC_HANDLE hMetaData, /* i/o: metadata bitstream handle */ - IVAS_QMETADATA *hQMetaData /* i/o: q_metadata handle */ - , + IVAS_QMETADATA *hQMetaData, /* i/o: q_metadata handle */ const int16_t hodirac_flag /* i : flag to indicate HO-DirAC mode */ ); @@ -3161,8 +3158,7 @@ void ivas_qmetadata_enc_sid_encode( int16_t ivas_qmetadata_dec_decode( IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: q_metadata handle */ uint16_t *bitstream, /* i : bitstream */ - int16_t *index /* i/o: bitstream position */ - , + int16_t *index, /* i/o: bitstream position */ const int16_t hodirac_flag /* i : flag to indicate HO-DirAC mode */ ); @@ -3409,11 +3405,10 @@ void ivas_dirac_param_est_enc( float **pp_fr_imag, const int16_t input_frame, #ifndef SBA_MODE_CLEAN_UP - const SBA_MODE sba_mode + const SBA_MODE sba_mode, #else - const IVAS_FORMAT ivas_format + const IVAS_FORMAT ivas_format , #endif - , const int16_t hodirac_flag, const int16_t nchan_fb_in ); @@ -3491,9 +3486,8 @@ int16_t ivas_sba_get_nchan( /*! r: number of ambisonics metadata channels */ int16_t ivas_sba_get_nchan_metadata( - const int16_t sba_order /* i : Ambisonic (SBA) order */ - , - const int32_t ivas_total_brate + const int16_t sba_order, /* i : Ambisonic (SBA) order */ + const int32_t ivas_total_brate /* i : IVAS total bitrate */ ); void ivas_sba_get_spar_hoa_ch_ind( @@ -3843,8 +3837,7 @@ ivas_error ivas_dirac_dec_output_synthesis_open( void ivas_dirac_dec_output_synthesis_init( DIRAC_DEC_HANDLE hDirAC, /* i/o: DirAC handle */ - const int16_t nchan_out_woLFE /* i : number of output audio channels without LFE */ - , + const int16_t nchan_out_woLFE, /* i : number of output audio channels without LFE */ const int16_t hodirac_flag /* i : flag to indicate HO-DirAC mode */ ); @@ -3867,13 +3860,11 @@ void ivas_dirac_dec_output_synthesis_process_slot( const float *p_Rmat, /* i : rotation matrix */ const VBAP_HANDLE hVBAPdata, /* i : VBAP structure */ const IVAS_OUTPUT_SETUP hOutSetup, /* i : output setup structure */ - const int16_t nchan_transport /* i : number of transport channels */ + const int16_t nchan_transport, /* i : number of transport channels */ #if defined( JBM_TSM_ON_TCS ) - , - const int16_t index_slot + const int16_t ind_slot, /* i : index of the slot to be added to the input covariance */ #endif - , - const int16_t hodirac_flag + const int16_t hodirac_flag /* i : flag to indicate HO-DirAC mode */ ); void ivas_dirac_dec_output_synthesis_process_subframe_gain_shd( @@ -3884,8 +3875,7 @@ void ivas_dirac_dec_output_synthesis_process_subframe_gain_shd( #ifdef JBM_TSM_ON_TCS const int16_t nbslots, /* i : number of slots to process */ #endif - const float *onset_filter - , + const float *onset_filter, #ifdef FIX_393_459_460_SBA_MD float *diffuseness, #else @@ -4277,7 +4267,7 @@ void ivas_dirac_dec_output_synthesis_cov_param_mc_collect_slot( #endif ); -void ivas_dirac_dec_output_synthesis_cov_param_mc_synthesise_slot( +void ivas_dirac_dec_output_synthesis_cov_param_mc_synthesise_slot( #ifdef JBM_TSM_ON_TCS float *Cldfb_RealBuffer_in, /* i : input channel filter bank samples (real part) */ float *Cldfb_ImagBuffer_in, /* i : input channel filter bank samples (imaginary part) */ @@ -4745,9 +4735,8 @@ void ivas_spar_to_dirac( Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ ivas_spar_md_dec_state_t *hMdDec, /* i/o: SPAR MD decoder handle */ const int16_t dtx_vad, /* i : DTX frame flag */ - const int16_t num_bands_out /* i : number of output bands */ - , - const int16_t bw /* i : band joining factor */ + const int16_t num_bands_out, /* i : number of output bands */ + const int16_t bw /* i : band joining factor */ ); void ivas_spar_update_md_hist( @@ -4756,24 +4745,21 @@ void ivas_spar_update_md_hist( void ivas_spar_smooth_md_dtx( ivas_spar_md_dec_state_t *hMdDec, /* i/o: SPAR MD decoder handle */ - const int16_t num_bands_out /* i : number of output bands */ - , - const int16_t num_md_sub_frames /* i : number of metadata subframes */ + const int16_t num_bands_out, /* i : number of output bands */ + const int16_t num_md_sub_frames /* i : number of metadata subframes */ ); void ivas_spar_setup_md_smoothing( ivas_spar_md_dec_state_t *hMdDec, /* i/o: SPAR MD decoder handle */ - const int16_t num_bands_out /* i : number of output bands */ - , - const int16_t num_md_sub_frames /* i : number of metadata subframes */ + const int16_t num_bands_out, /* i : number of output bands */ + const int16_t num_md_sub_frames /* i : number of metadata subframes */ ); void ivas_spar_dec_gen_umx_mat( ivas_spar_md_dec_state_t *hMdDec, /* i/o: SPAR MD decoder handle */ const int16_t nchan_transport, /* i : number of transport channels */ const int16_t num_bands_out, /* i : number of output bands */ - const int16_t bfi /* i : bad frame indicator */ - , + const int16_t bfi, /* i : bad frame indicator */ const int16_t num_md_sub_frames ); @@ -4782,10 +4768,9 @@ ivas_error ivas_spar_covar_enc_open( ivas_enc_cov_handler_state_t **hCovEnc, /* i/o: SPAR Covar. encoder handle */ ivas_filterbank_t *pFb, /* i/o: FB handle */ const int32_t input_Fs, /* i : input sampling rate */ - const int16_t nchan_inp /* i : number of input channels */ - , + const int16_t nchan_inp, /* i : number of input channels */ #ifdef FIX_489_COV_SMOOTHING - COV_SMOOTHING_TYPE smooth_mode, /* i : Smooth covariance for SPAR or MC*/ + COV_SMOOTHING_TYPE smooth_mode, /* i : Smooth covariance for SPAR or MC*/ #endif const int32_t ivas_total_brate /* i : IVAS total bitrate */ ); @@ -4806,8 +4791,7 @@ void ivas_enc_cov_handler_process( const int16_t end_band, const int16_t nchan_inp, const int16_t dtx_vad, - const int16_t transient_det[2] - , + const int16_t transient_det[2], const int16_t HOA_md_ind[IVAS_SPAR_MAX_CH] ); @@ -4815,12 +4799,11 @@ 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 */ ivas_filterbank_t *pFb, /* i/o: FB handle */ - const int16_t nchan_inp /* i : number of input channels */ - , + const int16_t nchan_inp, /* i : number of input channels */ #ifdef FIX_489_COV_SMOOTHING - COV_SMOOTHING_TYPE smooth_mode, /* i : Smooth covariance for SPAR or MC*/ + const COV_SMOOTHING_TYPE smooth_mode, /* i : Smooth covariance for SPAR or MC */ #endif - const int32_t ivas_total_brate /* i : IVAS total bitrate */ + const int32_t ivas_total_brate /* i : IVAS total bitrate */ ); void ivas_spar_covar_smooth_enc_close( @@ -5191,8 +5174,7 @@ void masa_compensate_two_dir_energy_ratio_index( const int16_t ratio_index_1, /* i : Input ratio for direction 1 */ const int16_t ratio_index_2, /* i : Input ratio for direction 2 */ int16_t *ratio_index_mod1, /* o : Output modified ratio for direction 1 */ - int16_t *ratio_index_mod2 /* o : Output modified ratio for direction 2 */ - , + int16_t *ratio_index_mod2, /* o : Output modified ratio for direction 2 */ const int16_t hodirac_flag /* i : flag to indicate HO-DirAC mode */ ); @@ -5576,12 +5558,11 @@ void computeReferencePower_enc( const int16_t enc_param_start_band, /* i : first band to process */ const int16_t num_freq_bands, /* i : Number of frequency bands */ #ifndef SBA_MODE_CLEAN_UP - const SBA_MODE sba_mode /* i : SBA mode */ + const SBA_MODE sba_mode, /* i : SBA mode */ #else const IVAS_FORMAT ivas_format, /* i : ivas_format */ - int16_t ref_power_w /* i : use 0 if hodirac is enabled */ + int16_t ref_power_w, /* i : use 0 if hodirac is enabled */ #endif - , const int16_t nchan_ana /* i : number of analysis channels */ ); @@ -5719,8 +5700,7 @@ ivas_error ivas_fb_set_cfg( const int16_t num_in_chans, /* i : number of FB input channels */ const int16_t num_out_chans, /* i : number of FB output channels */ const int16_t active_w_mixing, /* i : active_w_mixing flag */ - const int32_t sampling_Fs /* i : sampling rate */ - , + const int32_t sampling_Fs, /* i : sampling rate */ const int16_t nachan_dirac_ana /* i : number of DirAR analysis channels */ ); @@ -5741,8 +5721,7 @@ void ivas_fb_mixer_pcm_ingest( IVAS_FB_MIXER_HANDLE hFbMixer, /* i/o: FB mixer handle */ float pcm_in[][L_FRAME48k], /* i : input audio channels */ float **ppOut_pcm, /* o : output audio channels */ - const int16_t frame_length /* i : frame length */ - , + const int16_t frame_length, /* i : frame length */ const int16_t HOA_md_ind[IVAS_SPAR_MAX_CH] ); @@ -5756,8 +5735,7 @@ void ivas_dirac_enc_spar_delay_synchro( void ivas_fb_mixer_update_prior_input( IVAS_FB_MIXER_HANDLE hFbMixer, /* i/o: FB mixer handle */ float *pcm_in[], /* i : input audio channels */ - const int16_t length /* i : length of time slot */ - , + const int16_t length, /* i : length of time slot */ const int16_t nchan_fb_in /* i : number of analysis channels */ ); @@ -5767,8 +5745,7 @@ void ivas_fb_mixer_get_windowed_fr( float *frame_f_real[], /* o : real freq domain values */ float *frame_f_imag[], /* o : imag freq domain values */ const int16_t length, /* i : number of new samples in time slot */ - const int16_t mdft_len /* i : MDFT frame length */ - , + const int16_t mdft_len, /* i : MDFT frame length */ const int16_t nchan_fb_in /* i : number of analysis channels */ ); diff --git a/lib_com/ivas_qmetadata_com.c b/lib_com/ivas_qmetadata_com.c index 26dbb10df1..32b4653d2f 100644 --- a/lib_com/ivas_qmetadata_com.c +++ b/lib_com/ivas_qmetadata_com.c @@ -507,9 +507,8 @@ void masa_compensate_two_dir_energy_ratio_index( const int16_t ratio_index_1, /* i : Input ratio for direction 1 */ const int16_t ratio_index_2, /* i : Input ratio for direction 2 */ int16_t *ratio_index_mod1, /* o : Output modified ratio for direction 1 */ - int16_t *ratio_index_mod2 /* o : Output modified ratio for direction 2 */ - , - const int16_t hodirac_flag /* i : flag to indicate HO-DirAC mode */ + int16_t *ratio_index_mod2, /* o : Output modified ratio for direction 2 */ + const int16_t hodirac_flag /* i : flag to indicate HO-DirAC mode */ ) { float ratio1, ratio2; diff --git a/lib_com/ivas_sba_config.c b/lib_com/ivas_sba_config.c index 450ebef791..fab61cd0cd 100644 --- a/lib_com/ivas_sba_config.c +++ b/lib_com/ivas_sba_config.c @@ -223,9 +223,9 @@ int16_t ivas_sba_get_nchan( /*! r: number of ambisonics metadata channels */ int16_t ivas_sba_get_nchan_metadata( - const int16_t sba_order /* i : Ambisonic (SBA) order */ - , - const int32_t ivas_total_brate ) + const int16_t sba_order, /* i : Ambisonic (SBA) order */ + const int32_t ivas_total_brate /* i : IVAS total bitrate */ +) { int16_t nb_channels; @@ -252,9 +252,9 @@ int16_t ivas_sba_get_nchan_metadata( } /*-------------------------------------------------------------------* - * ivas_sba_get_spar_hoa_md_flag() + * ivas_sba_get_spar_hoa_ch_ind() + * * - * Get the flag to code SPAR HOA MD for all band *-------------------------------------------------------------------*/ /*! r: flag indicating to code SPAR HOA MD for all bands */ @@ -274,6 +274,7 @@ void ivas_sba_get_spar_hoa_ch_ind( { hoa_ind = HOA_keep_ind_spar; } + for ( ch = 0; ch < num_md_chs; ch++ ) { HOA_md_ind[ch] = hoa_ind[ch]; @@ -282,6 +283,13 @@ void ivas_sba_get_spar_hoa_ch_ind( return; } + +/*-------------------------------------------------------------------* + * ivas_sba_get_spar_hoa_md_flag() + * + * Get the flag to code SPAR HOA MD for all band + *-------------------------------------------------------------------*/ + void ivas_sba_get_spar_hoa_md_flag( const int16_t sba_order, /* i : Ambisonic (SBA) order */ const int32_t ivas_total_brate, /* i : IVAS total bitrate */ diff --git a/lib_com/ivas_spar_com.c b/lib_com/ivas_spar_com.c index 8e7da38580..3c39d7f5e4 100644 --- a/lib_com/ivas_spar_com.c +++ b/lib_com/ivas_spar_com.c @@ -2153,6 +2153,7 @@ void ivas_spar_set_bitrate_config( int16_t quant_strat; int16_t bands_bw; #endif + pSpar_md_cfg->nchan_transport = ivas_spar_br_table_consts[table_idx].nchan_transport; for ( i = 0; i < pSpar_md_cfg->nchan_transport; i++ ) diff --git a/lib_com/lsf_tools.c b/lib_com/lsf_tools.c index 02a735e80c..c0c4556126 100644 --- a/lib_com/lsf_tools.c +++ b/lib_com/lsf_tools.c @@ -2027,13 +2027,20 @@ int16_t tcxlpc_get_cdk( return cdk; } + +/*--------------------------------------------------------------------------* + * dec_FDCNG_MSVQ_stage1() + * + * + *--------------------------------------------------------------------------*/ + void dec_FDCNG_MSVQ_stage1( - int16_t j_full, /* i: index full range */ - int16_t n, /* i: dimension to generate */ - const float *invTrfMatrix, /* i: IDCT matrix for synthesis */ - const DCTTYPE idcttype, /* i: specify which IDCT */ - float *uq, /* o: synthesized stage1 vector */ - Word16 *uq_ind /* o: synthesized stage1 vector in BASOP */ + int16_t j_full, /* i : index full range */ + int16_t n, /* i : dimension to generate */ + const float *invTrfMatrix, /* i : IDCT matrix for synthesis */ + const DCTTYPE idcttype, /* i : specify which IDCT */ + float *uq, /* o : synthesized stage1 vector */ + Word16 *uq_ind /* o : synthesized stage1 vector in BASOP */ ) { int16_t col, segm_ind, j; @@ -2080,6 +2087,8 @@ void dec_FDCNG_MSVQ_stage1( /*add common mid fdcng vector, in fdcng bands domain */ v_add( idct_vec, cdk1r_tr_midQ_truncQ, uq, n ); assert( uq_ind == NULL ); + + return; } @@ -2089,7 +2098,6 @@ void dec_FDCNG_MSVQ_stage1( * *--------------------------------------------------------------------------*/ - void msvq_dec( const float *const *cb, /* i : Codebook (indexed cb[*stages][levels][p]) */ const int16_t dims[], /* i : Dimension of each codebook stage (NULL: full dim.) */ @@ -2098,10 +2106,10 @@ void msvq_dec( const int16_t N, /* i : Vector dimension */ const int16_t maxN, /* i : Codebook dimension */ const int16_t Idx[], /* i : Indices */ - const int16_t applyIDCT_flag, /* i : applyIDCT flag */ - const float *invTrfMatrix, /* i: matrix for IDCT synthesis */ - float *uq, /* o : quantized vector */ - Word16 *uq_ind /* o : quantized vector (fixed point) */ + const int16_t applyIDCT_flag, /* i : applyIDCT flag */ + const float *invTrfMatrix, /* i: matrix for IDCT synthesis */ + float *uq, /* o : quantized vector */ + Word16 *uq_ind /* o : quantized vector (fixed point) */ ) { int16_t i, n, maxn, start; @@ -2425,19 +2433,22 @@ void a2isf( return; } + /*-------------------------------------------------------------------* * dctT2_N_apply_matrix() * * dct/idct truncated matrix appl. for DCT basis vector lengths of N *-------------------------------------------------------------------*/ + void dctT2_N_apply_matrix( - const float *input, - float *output, - const int16_t dct_dim, - int16_t fdcngvq_dim, - const float *matrix, - const int16_t matrix_row_dim, - DCTTYPE dcttype ) + const float *input, /* i : input in fdcng or DCT(fdcng) domain */ + float *output, /* o : output in DCT(fdcng) or fdcng ordomain */ + const int16_t dct_dim, /* i : dct processing dim possibly truncated */ + int16_t fdcngvq_dim, /* i : fdcng domain length */ + const float *matrix, /* i : IDCT matrix */ + const int16_t matrix_row_dim, /* i : */ + const DCTTYPE dcttype /* i : matrix operation type */ +) { int16_t i, j, dim_in, dim_out; int16_t mat_step_col, mat_step_row, mat_step_col_flag; @@ -2494,9 +2505,13 @@ void dctT2_N_apply_matrix( } pt_y++; } + mvr2r( tmp_y, output, dim_out ); + + return; } + /*-------------------------------------------------------------------* * extend_dctN_input() * @@ -2505,14 +2520,15 @@ void dctT2_N_apply_matrix( *-------------------------------------------------------------------*/ void extend_dctN_input( - const float *input, /* i: input in fdcng domain */ - const float *dct_input, /* i: input in dctN(fdcng) domain */ - const int16_t in_dim, /* i: in_dim == N */ - float *ext_sig, /* o: extended output in fdcng domain */ - const int16_t out_dim, /* i: output total dim */ - float *matrix, /* i: idct synthesis matrix N rows, n_cols columns */ - const int16_t n_cols, /* i: number of columns == DCT truncation length */ - DCTTYPE dcttype ) /* i: matrix operation type */ + const float *input, /* i : input in fdcng domain */ + const float *dct_input, /* i : input in dctN(fdcng) domain */ + const int16_t in_dim, /* i : in_dim == N */ + float *ext_sig, /* o : extended output in fdcng domain */ + const int16_t out_dim, /* i : output total dim */ + float *matrix, /* i : idct synthesis matrix N rows, n_cols columns */ + const int16_t n_cols, /* i : number of columns == DCT truncation length */ + const DCTTYPE dcttype /* i : matrix operation type */ +) { int16_t i, j, i_rev; const float( *ptr )[FDCNG_VQ_DCT_MAXTRUNC] = (void *) matrix; @@ -2545,11 +2561,24 @@ void extend_dctN_input( #undef WMC_TOOL_SKIP } } + + return; } -/* inititate idct24 FDCNG_VQ_DCT_MAXTRUNCx N matrix in RAM from a quantized compressed ROM format */ -void create_IDCT_N_Matrix( float *inv_matrixFloatQ, const int16_t N, const int16_t n_cols, const int16_t alloc_size ) +/*-------------------------------------------------------------------* + * create_IDCT_N_Matrix() + * + * inititate idct24 FDCNG_VQ_DCT_MAXTRUNCx N matrix in + * RAM from a quantized compressed ROM format + *-------------------------------------------------------------------*/ + +void create_IDCT_N_Matrix( + float *inv_matrixFloatQ, /* i/o: RAM buffer */ + const int16_t N, /* i : DCT length, number of time samples */ + const int16_t n_cols, /* i : number of dct coeffs (as DCT may be truncated) */ + const int16_t alloc_size /* i : RAM buffer size in elements */ +) { int16_t c, c1, r, r_flip, W16_val; int16_t len; @@ -2613,4 +2642,6 @@ void create_IDCT_N_Matrix( float *inv_matrixFloatQ, const int16_t N, const int16 #undef WMC_TOOL_SKIP } } + + return; } diff --git a/lib_com/prot.h b/lib_com/prot.h index e6f371c468..313a35d425 100644 --- a/lib_com/prot.h +++ b/lib_com/prot.h @@ -520,28 +520,32 @@ void push_next_bits( ); #ifdef IND_LIST_DYN -int16_t get_ivas_max_num_indices( /* o : maximum number of indices */ - const IVAS_FORMAT ivas_format, /* i : IVAS format */ - const int32_t ivas_total_brate /* i : IVAS total bitrate */ +/*! r: maximum number of indices */ +int16_t get_ivas_max_num_indices( + const IVAS_FORMAT ivas_format, /* i : IVAS format */ + const int32_t ivas_total_brate /* i : IVAS total bitrate */ ); -int16_t get_core_max_num_indices( /* o : maximum number of indices */ - const int16_t core, /* i : core */ - const int32_t total_brate /* i : total bitrate */ +/*! r: maximum number of indices */ +int16_t get_core_max_num_indices( + const int16_t core, /* i : core */ + const int32_t total_brate /* i : total bitrate */ ); -int16_t get_BWE_max_num_indices( /* o : maximum number of indices */ - const int32_t extl_brate /* i : extensiona layer bitrate */ +/*! r: maximum number of indices */ +int16_t get_BWE_max_num_indices( + const int32_t extl_brate /* i : extensiona layer bitrate */ ); -int16_t get_ivas_max_num_indices_metadata( /* o : maximum number of indices for metadata */ - const IVAS_FORMAT ivas_format, /* i : IVAS format */ - const int32_t ivas_total_brate /* i : IVAS total bitrate */ +/*! r: maximum number of indices */ +int16_t get_ivas_max_num_indices_metadata( + const IVAS_FORMAT ivas_format, /* i : IVAS format */ + const int32_t ivas_total_brate /* i : IVAS total bitrate */ ); ivas_error ind_list_realloc( - BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ - int16_t max_num_indices /* i : new maximum number of allowed indices in the list */ + BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ + const int16_t max_num_indices /* i : new maximum number of allowed indices in the list */ ); ivas_error check_ind_list_limits( @@ -554,16 +558,18 @@ ivas_error move_indices( const int16_t nb_indices /* i : number of moved indices */ ); -int16_t find_indice( /* o : index of the indice in the list, -1 if not found */ - BSTR_ENC_HANDLE hBstr, /* i : encoder bitstream handle */ - int16_t id, /* i : ID of the indice */ - uint16_t *value, /* o : value of the quantized indice */ - int16_t *nb_bits /* o : number of bits used to quantize the indice */ +/*! r: index of the indice in the list, -1 if not found */ +int16_t find_indice( + BSTR_ENC_HANDLE hBstr, /* i : encoder bitstream handle */ + const int16_t id, /* i : ID of the indice */ + uint16_t *value, /* o : value of the quantized indice */ + int16_t *nb_bits /* o : number of bits used to quantize the indice */ ); -uint16_t delete_indice( /* o : number of deleted indices */ - BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ - int16_t id /* i : ID of the indice */ +/*! r: number of deleted indices */ +uint16_t delete_indice( + BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ + const int16_t id /* i : ID of the indice */ ); #endif @@ -3078,9 +3084,8 @@ void lsf_enc( float *lsp_mid, /* i : mid-frame LSP vector */ float *Aq, /* o : quantized A(z) for 4 subframes */ const int16_t tdm_low_rate_mode, /* i : secondary channel low rate mode flag */ - const int16_t GSC_IVAS_mode /* i : GSC IVAS mode */ - , - const float tdm_lsfQ_PCh[M] /* i : Q LSFs for primary channel */ + const int16_t GSC_IVAS_mode, /* i : GSC IVAS mode */ + const float tdm_lsfQ_PCh[M] /* i : Q LSFs for primary channel */ ); void isf_enc_amr_wb( @@ -3877,12 +3882,10 @@ void bw_detect( Encoder_State *st, /* i/o: Encoder State */ const float signal_in[], /* i : input signal */ float *spectrum, /* i : MDCT spectrum */ - const float *enerBuffer /* i : energy buffer */ - , - const int16_t mct_on /* i : flag MCT mode */ + const float *enerBuffer, /* i : energy buffer */ + const int16_t mct_on /* i : flag MCT mode */ ); - void set_bw( const int16_t element_mode, /* i : element mode */ const int32_t element_brate, /* i : element bitrate */ @@ -4554,9 +4557,8 @@ ivas_error acelp_core_dec( const int32_t last_element_brate, /* i : last element bitrate */ const int16_t flag_sec_CNA, /* i : CNA flag for secondary channel */ const int16_t nchan_out, /* i : number of output channels */ - STEREO_CNG_DEC_HANDLE hStereoCng /* i : stereo CNG handle */ - , - const int16_t read_sid_info /* i : read SID info flag */ + STEREO_CNG_DEC_HANDLE hStereoCng, /* i : stereo CNG handle */ + const int16_t read_sid_info /* i : read SID info flag */ ); void bass_psfilter_init( @@ -4629,16 +4631,15 @@ void swb_CNG_dec( ); void lsf_dec( - Decoder_State *st, /* i/o: State structure */ - const int16_t tc_subfr, /* i : TC subframe index */ - float *Aq, /* o : quantized A(z) for 4 subframes */ - int16_t *LSF_Q_prediction, /* o : LSF prediction mode */ - float *lsf_new, /* o : de-quantized LSF vector */ - float *lsp_new, /* o : de-quantized LSP vector */ - float *lsp_mid, /* o : de-quantized mid-frame LSP vector */ - const int16_t tdm_low_rate_mode /* i : secondary channel low rate mode flag */ - , - const float tdm_lsfQ_PCh[M] /* i : Q LSFs for primary channel */ + Decoder_State *st, /* i/o: State structure */ + const int16_t tc_subfr, /* i : TC subframe index */ + float *Aq, /* o : quantized A(z) for 4 subframes */ + int16_t *LSF_Q_prediction, /* o : LSF prediction mode */ + float *lsf_new, /* o : de-quantized LSF vector */ + float *lsp_new, /* o : de-quantized LSP vector */ + float *lsp_mid, /* o : de-quantized mid-frame LSP vector */ + const int16_t tdm_low_rate_mode, /* i : secondary channel low rate mode flag */ + const float tdm_lsfQ_PCh[M] /* i : Q LSFs for primary channel */ ); void isf_dec_amr_wb( @@ -8102,19 +8103,18 @@ int16_t enc_lsf_tcxlpc( ); void msvq_enc( - const float *const *cb, /* i : Codebook (indexed cb[*stages][levels][p]) */ - const int16_t dims[], /* i : Dimension of each codebook stage (NULL: full dim.) */ - const int16_t offs[], /* i : Starting dimension of each codebook stage (NULL: 0) */ - const float u[], /* i : Vector to be encoded (prediction and mean removed) */ - const int16_t *levels, /* i : Number of levels in each stage */ - const int16_t maxC, /* i : Tree search size (number of candidates kept from */ - /* one stage to the next == M-best) */ + const float *const *cb, /* i : Codebook (indexed cb[*stages][levels][p]) */ + const int16_t dims[], /* i : Dimension of each codebook stage (NULL: full dim.) */ + const int16_t offs[], /* i : Starting dimension of each codebook stage (NULL: 0) */ + const float u[], /* i : Vector to be encoded (prediction and mean removed) */ + const int16_t *levels, /* i : Number of levels in each stage */ + const int16_t maxC, /* i : Tree search size (number of candidates kept from one stage to the next == M-best) */ const int16_t stages, /* i : Number of stages */ const float w[], /* i : Weights */ const int16_t N, /* i : Vector dimension */ const int16_t maxN, /* i : Codebook dimension */ - const int16_t applyDCT_flag, /* i : applyDCT flag */ - float *invTrfMatrix, /* i:/o expanded synthesis matrix */ + const int16_t applyDCT_flag, /* i : applyDCT flag */ + float *invTrfMatrix, /* i/o: expanded synthesis matrix */ int16_t Idx[] /* o : Indices */ ); @@ -8126,77 +8126,79 @@ void msvq_dec( const int16_t N, /* i : Vector dimension */ const int16_t maxN, /* i : Codebook dimension */ const int16_t Idx[], /* i : Indices */ - const int16_t applyIDCT_flag, /* i : applyIDCT flag */ - const float *invTrfMatrix, /* i: synthesis matrix */ + const int16_t applyIDCT_flag, /* i : applyIDCT flag */ + const float *invTrfMatrix, /* i : synthesis matrix */ float *uq, /* o : quantized vector */ Word16 *uq_ind /* o : quantized vector (fixed point) */ ); void dec_FDCNG_MSVQ_stage1( - int16_t j_full, /* i: index full range */ - int16_t n, /* i: dimension to generate */ - const float *invTrfMatrix, /* i: synthesis matrix */ - DCTTYPE idcttype, /* i: idct type */ - float *uq, /* o: synthesized stage1 vector */ - Word16 *uq_ind /* o: synthesized stage1 vector in BASOP */ + int16_t j_full, /* i : index full range */ + int16_t n, /* i : dimension to generate */ + const float *invTrfMatrix, /* i : IDCT matrix for synthesis */ + const DCTTYPE idcttype, /* i : specify which IDCT */ + float *uq, /* o : synthesized stage1 vector */ + Word16 *uq_ind /* o : synthesized stage1 vector in BASOP */ ); void create_IDCT_N_Matrix( - float *inv_matrixFloatQ, /* i/o: RAM buffer */ - const int16_t N, /* i: DCT length , number of time samples */ - const int16_t n_cols, /* i: number of dct coeffs (as DCT may be truncated) */ - const int16_t alloc_size /* i: RAM buffer size in elements*/ + float *inv_matrixFloatQ, /* i/o: RAM buffer */ + const int16_t N, /* i : DCT length, number of time samples */ + const int16_t n_cols, /* i : number of dct coeffs (as DCT may be truncated) */ + const int16_t alloc_size /* i : RAM buffer size in elements */ ); - void dctT2_N_apply_matrix( - const float *input, /* i: input in fdcng or DCT(fdcng) domain */ - float *output, /* o: output in DCT(fdcng) or fdcng ordomain */ - const int16_t dct_dim, /* i: dct processing dim possibly truncated */ - int16_t fdcngvq_dim, /* i: fdcng domain length */ - const float *idctT2_N_16matrixQ16, /* i: IDCT matrix */ - const int16_t matrix_1st_dim, /* i: */ - DCTTYPE dcttype ); /* i: matrix operation type */ - -void extend_dctN_input( - const float *input, /* i: input in fdcng domain */ - const float *dct_input, /* i: input in dctN(fdcng) domain */ - const int16_t in_dim, /* i: in_dim==N */ - float *ext_sig, /* o: extended output in fdcng domain */ - const int16_t out_dim, /* i: output total dim */ - float *matrix, /* i: idct matrix of size N rows , n_cols columns*/ - const int16_t n_cols, /* i: number of columns == truncation length */ - DCTTYPE dcttype ); /* i: matrix type */ - -int16_t msvq_stage1_dct_search( /* o : (p_max , best candidate sofar ) */ - const float *u, /* i : target */ - const int16_t N, /* i : target length and IDCT synthesis length */ - const int16_t maxC_st1, /* i : number of final stage 1 candidates to provide */ - const DCTTYPE dcttype, /* e.g. DCT_T2_16_XX, DCT_T2_24_XX; */ - const int16_t max_dct_trunc, /* i: maximum of truncation lenghts */ - float *invTrfMatrix, /* i : IDCT synthesis matrix for dim N */ - const float *midQ_truncQ, /* i: midQ vector */ - const float *dct_invScaleF, /* i: global inv scale factors*/ - const float *dct_scaleF, /* i: global scale factors*/ - const Word16 n_segm, /* i: number of segments */ - const Word16 *cols_per_segment, /* i: remaining length per segment */ - const Word16 *trunc_dct_cols_per_segment, /* i: trunc length per segment */ - const Word16 *entries_per_segment, /* i: number of rows per segment */ - const Word16 *cum_entries_per_segment, /* i: number of cumulative entries */ - const Word8 *const W8Qx_dct_sections[], /*i: Word8(byte) segment table ptrs */ - const Word16 *col_syn_shift[], /*i: columnwise syn shift tables */ - const Word8 *segm_neighbour_fwd, /*i: circular neighbour list fwd */ - const Word8 *segm_neighbour_rev, /*i: circular neighbour list reverse */ - const Word16 npost_check, /*i: number of neigbours to check , should be even */ - float *st1_mse_ptr, /*i: dynRAM buffer for MSEs */ - int16_t *indices_st1_local, /*o: selected cand indices */ - float *st1_syn_vec_ptr, /*i/o: buffer for IDCT24 synthesis */ - float *dist1_ptr /*o: resulting stage 1 MSEs in DCT-N domain */ + const float *input, /* i : input in fdcng or DCT(fdcng) domain */ + float *output, /* o : output in DCT(fdcng) or fdcng ordomain */ + const int16_t dct_dim, /* i : dct processing dim possibly truncated */ + int16_t fdcngvq_dim, /* i : fdcng domain length */ + const float *matrix, /* i : IDCT matrix */ + const int16_t matrix_row_dim, /* i : */ + const DCTTYPE dcttype /* i : matrix operation type */ ); +void extend_dctN_input( + const float *input, /* i : input in fdcng domain */ + const float *dct_input, /* i : input in dctN(fdcng) domain */ + const int16_t in_dim, /* i : in_dim == N */ + float *ext_sig, /* o : extended output in fdcng domain */ + const int16_t out_dim, /* i : output total dim */ + float *matrix, /* i : idct synthesis matrix N rows, n_cols columns */ + const int16_t n_cols, /* i : number of columns == DCT truncation length */ + const DCTTYPE dcttype /* i : matrix operation type */ +); + +/*! r: (p_max , best candidate sofar ) */ +int16_t msvq_stage1_dct_search( + const float *u, /* i : target */ + const int16_t N, /* i : target length and IDCT synthesis length */ + const int16_t maxC_st1, /* i : number of final stage 1 candidates to provide */ + const DCTTYPE dcttype, /* e.g. DCT_T2_16_XX, DCT_T2_24_XX; */ + const int16_t max_dct_trunc, /* i : maximum of truncation lenghts */ + float *invTrfMatrix, /* i : IDCT synthesis matrix for dim N */ + const float *midQ_truncQ, /* i : midQ vector */ + const float *dct_invScaleF, /* i : global inv scale factors */ + const float *dct_scaleF, /* i : global scale factors */ + const Word16 n_segm, /* i : number of segments */ + const Word16 *cols_per_segment, /* i : remaining length per segment */ + const Word16 *trunc_dct_cols_per_segment, /* i : trunc length per segment */ + const Word16 *entries_per_segment, /* i : number of rows per segment */ + const Word16 *cum_entries_per_segment, /* i : number of cumulative entries */ + const Word8 *const W8Qx_dct_sections[], /* i : Word8(byte) segment table ptrs */ + const Word16 *col_syn_shift[], /* i : columnwise syn shift tables */ + const Word8 *segm_neighbour_fwd, /* i : circular neighbour list fwd */ + const Word8 *segm_neighbour_rev, /* i : circular neighbour list reverse */ + const Word16 npost_check, /* i : number of neigbours to check , should be even */ + float *st1_mse_ptr, /* i : dynRAM buffer for MSEs */ + int16_t *indices_st1_local, /* o : selected cand indices */ + float *st1_syn_vec_ptr, /* i/o: buffer for IDCT24 synthesis */ + float *dist1_ptr /* o : resulting stage 1 MSEs in DCT-N domain */ +); + +/*! r: (updated p_max) */ int16_t msvq_stage1_dct_recalc_candidates_fdcng_wb( - /* o : (updated p_max) */ const float *st1_syn_vec_ptr, /* i : IDCT24 synthesis vectors */ const float *u, /* i : target signal */ const int16_t maxC_st1, /* i : number of candidates in stage1 */ @@ -8344,9 +8346,8 @@ void lsf_end_dec( float *qlsf, /* o : quantized LSFs in the cosine domain */ int16_t *lpc_param, /* i : LPC parameters */ int16_t *LSF_Q_prediction, /* o : LSF prediction mode */ - int16_t *nb_indices /* o : number of indices */ - , - const float tdm_lsfQ_PCh[M] /* i : Q LSFs for primary channel */ + int16_t *nb_indices, /* o : number of indices */ + const float tdm_lsfQ_PCh[M] /* i : Q LSFs for primary channel */ ); ivas_error find_pred_mode( diff --git a/lib_dec/acelp_core_dec.c b/lib_dec/acelp_core_dec.c index eb2e84f598..8d5e9de34d 100644 --- a/lib_dec/acelp_core_dec.c +++ b/lib_dec/acelp_core_dec.c @@ -74,9 +74,8 @@ ivas_error acelp_core_dec( const int32_t last_element_brate, /* i : last element bitrate */ const int16_t flag_sec_CNA, /* i : CNA flag for secondary channel */ const int16_t nchan_out, /* i : number of output channels */ - STEREO_CNG_DEC_HANDLE hStereoCng /* i : stereo CNG handle */ - , - const int16_t read_sid_info /* i : read SID info flag */ + STEREO_CNG_DEC_HANDLE hStereoCng, /* i : stereo CNG handle */ + const int16_t read_sid_info /* i : read SID info flag */ ) { float old_exc[L_EXC_DEC], *exc; /* excitation signal buffer */ diff --git a/lib_dec/ivas_dirac_output_synthesis_dec.c b/lib_dec/ivas_dirac_output_synthesis_dec.c index 33004c540c..9bf4762ecd 100755 --- a/lib_dec/ivas_dirac_output_synthesis_dec.c +++ b/lib_dec/ivas_dirac_output_synthesis_dec.c @@ -367,10 +367,9 @@ ivas_error ivas_dirac_dec_output_synthesis_open( *------------------------------------------------------------------------*/ void ivas_dirac_dec_output_synthesis_init( - DIRAC_DEC_HANDLE hDirAC, /* i/o: DirAC handle */ - const int16_t nchan_out_woLFE /* i : number of output audio channels without LFE */ - , - const int16_t hodirac_flag /* i : flag to indicate HO-DirAC mode */ + DIRAC_DEC_HANDLE hDirAC, /* i/o: DirAC handle */ + const int16_t nchan_out_woLFE, /* i : number of output audio channels without LFE */ + const int16_t hodirac_flag /* i : flag to indicate HO-DirAC mode */ ) { int16_t size; @@ -560,12 +559,10 @@ void ivas_dirac_dec_output_synthesis_process_slot( const float *p_Rmat, /* i : rotation matrix */ const VBAP_HANDLE hVBAPdata, /* i : VBAP structure */ const IVAS_OUTPUT_SETUP hOutSetup, /* i : output setup structure */ - const int16_t nchan_transport /* i : number of transport channels*/ + const int16_t nchan_transport, /* i : number of transport channels*/ #if defined( JBM_TSM_ON_TCS ) - , - const int16_t md_idx + const int16_t md_idx, #endif - , const int16_t hodirac_flag /* i : flag to indicate HO-DirAC mode */ ) { @@ -680,118 +677,118 @@ void ivas_dirac_dec_output_synthesis_process_slot( } else // ( hDirAC->hConfig->dec_param_estim == TRUE ) if ( hDirAC->hConfig->dec_param_estim == TRUE ) - { + { - /* compute direct responses */ + /* compute direct responses */ #ifdef JBM_TSM_ON_TCS - ivas_dirac_dec_compute_directional_responses( hDirAC, - hVBAPdata, - NULL, - azimuth, - elevation, - md_idx, - NULL, - sh_rot_max_order, - p_Rmat, - hodirac_flag ); + ivas_dirac_dec_compute_directional_responses( hDirAC, + hVBAPdata, + NULL, + azimuth, + elevation, + md_idx, + NULL, + sh_rot_max_order, + p_Rmat, + hodirac_flag ); #endif - if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) - { - ivas_dirac_dec_compute_gain_factors( num_freq_bands, - diffuseness, - h_dirac_output_synthesis_params->max_band_decorr, - h_dirac_output_synthesis_state->direct_power_factor, - h_dirac_output_synthesis_state->diffuse_power_factor ); + if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) + { + ivas_dirac_dec_compute_gain_factors( num_freq_bands, + diffuseness, + h_dirac_output_synthesis_params->max_band_decorr, + h_dirac_output_synthesis_state->direct_power_factor, + h_dirac_output_synthesis_state->diffuse_power_factor ); - v_multc( h_dirac_output_synthesis_state->direct_power_factor, - 0.25f, - h_dirac_output_synthesis_state->direct_power_factor, - num_freq_bands ); - v_multc( h_dirac_output_synthesis_state->diffuse_power_factor, - 0.25f, - h_dirac_output_synthesis_state->diffuse_power_factor, - num_freq_bands ); + v_multc( h_dirac_output_synthesis_state->direct_power_factor, + 0.25f, + h_dirac_output_synthesis_state->direct_power_factor, + num_freq_bands ); + v_multc( h_dirac_output_synthesis_state->diffuse_power_factor, + 0.25f, + h_dirac_output_synthesis_state->diffuse_power_factor, + num_freq_bands ); - /*Direct gain*/ - for ( ch_idx = 0; ch_idx < min( 4, nchan_transport ); ch_idx++ ) + /*Direct gain*/ + for ( ch_idx = 0; ch_idx < min( 4, nchan_transport ); ch_idx++ ) + { + int16_t k; + if ( ch_idx != 0 ) { - int16_t k; - if ( ch_idx != 0 ) - { - float a, b, c; + float a, b, c; - /*Directonal sound gain nrg compensation*/ - for ( k = 0; k < num_freq_bands_diff; k++ ) - { - a = h_dirac_output_synthesis_state->direct_responses[ch_idx * num_freq_bands + k]; - b = reference_power[k + num_freq_bands] / ( reference_power[k + ( ch_idx + 1 ) * num_freq_bands] + EPSILON ); - c = 1.f + ( 1.f / 6.f ) * ( h_dirac_output_synthesis_params->diffuse_compensation_factor_decorr - 1.f ); /*Diffuseness modellling nrg compensation*/ - h_dirac_output_synthesis_state->cy_cross_dir_smooth[ch_idx * num_freq_bands + k] += 0.25f * sqrtf( diffuseness[k] * c + ( ( 1.f - diffuseness[k] ) * a * a * b ) ); - } - for ( ; k < num_freq_bands; k++ ) - { - a = h_dirac_output_synthesis_state->direct_responses[ch_idx * num_freq_bands + k]; - b = reference_power[k + num_freq_bands] / ( reference_power[k + ( ch_idx + 1 ) * num_freq_bands] + EPSILON ); - c = 1.f + ( 1.f / 6.f ) * ( h_dirac_output_synthesis_params->diffuse_compensation_factor - 1.f ); /*Diffuseness modellling nrg compensation*/ - h_dirac_output_synthesis_state->cy_cross_dir_smooth[ch_idx * num_freq_bands + k] += 0.25f * sqrtf( diffuseness[k] * c + ( ( 1.f - diffuseness[k] ) * a * a * b ) ); - } + /*Directonal sound gain nrg compensation*/ + for ( k = 0; k < num_freq_bands_diff; k++ ) + { + a = h_dirac_output_synthesis_state->direct_responses[ch_idx * num_freq_bands + k]; + b = reference_power[k + num_freq_bands] / ( reference_power[k + ( ch_idx + 1 ) * num_freq_bands] + EPSILON ); + c = 1.f + ( 1.f / 6.f ) * ( h_dirac_output_synthesis_params->diffuse_compensation_factor_decorr - 1.f ); /*Diffuseness modellling nrg compensation*/ + h_dirac_output_synthesis_state->cy_cross_dir_smooth[ch_idx * num_freq_bands + k] += 0.25f * sqrtf( diffuseness[k] * c + ( ( 1.f - diffuseness[k] ) * a * a * b ) ); } - else + for ( ; k < num_freq_bands; k++ ) { - /*Diffuseness modellling nrg compensation*/ - for ( k = 0; k < num_freq_bands_diff; k++ ) - { - h_dirac_output_synthesis_state->cy_cross_dir_smooth[ch_idx * num_freq_bands + k] += 0.25f * sqrtf( 1.0f + diffuseness[k] * 0.5f * ( h_dirac_output_synthesis_params->diffuse_compensation_factor_decorr - 1.f ) ); - } - for ( ; k < num_freq_bands; k++ ) - { - h_dirac_output_synthesis_state->cy_cross_dir_smooth[ch_idx * num_freq_bands + k] += 0.25f * sqrtf( 1.0f + diffuseness[k] * 0.5f * ( h_dirac_output_synthesis_params->diffuse_compensation_factor - 1.f ) ); - } + a = h_dirac_output_synthesis_state->direct_responses[ch_idx * num_freq_bands + k]; + b = reference_power[k + num_freq_bands] / ( reference_power[k + ( ch_idx + 1 ) * num_freq_bands] + EPSILON ); + c = 1.f + ( 1.f / 6.f ) * ( h_dirac_output_synthesis_params->diffuse_compensation_factor - 1.f ); /*Diffuseness modellling nrg compensation*/ + h_dirac_output_synthesis_state->cy_cross_dir_smooth[ch_idx * num_freq_bands + k] += 0.25f * sqrtf( diffuseness[k] * c + ( ( 1.f - diffuseness[k] ) * a * a * b ) ); } } - - /*Directional gain (panning)*/ - for ( ch_idx = min( 4, nchan_transport ); ch_idx < num_channels_dir; ch_idx++ ) - { - v_mult( h_dirac_output_synthesis_state->direct_power_factor, - &h_dirac_output_synthesis_state->direct_responses[ch_idx * num_freq_bands], - aux_buf, - num_freq_bands ); - - v_add( aux_buf, - &h_dirac_output_synthesis_state->cy_cross_dir_smooth[ch_idx * num_freq_bands], - &h_dirac_output_synthesis_state->cy_cross_dir_smooth[ch_idx * num_freq_bands], - num_freq_bands ); - } - - /*Diffuse gain*/ - for ( ch_idx = min( 4, nchan_transport ); ch_idx < num_channels_diff; ch_idx++ ) + else { - v_multc( h_dirac_output_synthesis_state->diffuse_power_factor, - hDirAC->diffuse_response_function[ch_idx], - aux_buf, - num_freq_bands_diff ); - - v_add( aux_buf, - &h_dirac_output_synthesis_state->cy_auto_diff_smooth[ch_idx * num_freq_bands_diff], - &h_dirac_output_synthesis_state->cy_auto_diff_smooth[ch_idx * num_freq_bands_diff], - num_freq_bands_diff ); + /*Diffuseness modellling nrg compensation*/ + for ( k = 0; k < num_freq_bands_diff; k++ ) + { + h_dirac_output_synthesis_state->cy_cross_dir_smooth[ch_idx * num_freq_bands + k] += 0.25f * sqrtf( 1.0f + diffuseness[k] * 0.5f * ( h_dirac_output_synthesis_params->diffuse_compensation_factor_decorr - 1.f ) ); + } + for ( ; k < num_freq_bands; k++ ) + { + h_dirac_output_synthesis_state->cy_cross_dir_smooth[ch_idx * num_freq_bands + k] += 0.25f * sqrtf( 1.0f + diffuseness[k] * 0.5f * ( h_dirac_output_synthesis_params->diffuse_compensation_factor - 1.f ) ); + } } + } - return; + /*Directional gain (panning)*/ + for ( ch_idx = min( 4, nchan_transport ); ch_idx < num_channels_dir; ch_idx++ ) + { + v_mult( h_dirac_output_synthesis_state->direct_power_factor, + &h_dirac_output_synthesis_state->direct_responses[ch_idx * num_freq_bands], + aux_buf, + num_freq_bands ); + + v_add( aux_buf, + &h_dirac_output_synthesis_state->cy_cross_dir_smooth[ch_idx * num_freq_bands], + &h_dirac_output_synthesis_state->cy_cross_dir_smooth[ch_idx * num_freq_bands], + num_freq_bands ); } - else + + /*Diffuse gain*/ + for ( ch_idx = min( 4, nchan_transport ); ch_idx < num_channels_diff; ch_idx++ ) { - /* compute reference and diffuse power factor for this frame */ - ivas_dirac_dec_compute_power_factors( num_freq_bands, - diffuseness, - h_dirac_output_synthesis_params->max_band_decorr, - h_dirac_output_synthesis_state->direct_power_factor, - h_dirac_output_synthesis_state->diffuse_power_factor ); + v_multc( h_dirac_output_synthesis_state->diffuse_power_factor, + hDirAC->diffuse_response_function[ch_idx], + aux_buf, + num_freq_bands_diff ); + + v_add( aux_buf, + &h_dirac_output_synthesis_state->cy_auto_diff_smooth[ch_idx * num_freq_bands_diff], + &h_dirac_output_synthesis_state->cy_auto_diff_smooth[ch_idx * num_freq_bands_diff], + num_freq_bands_diff ); } + + return; + } + else + { + /* compute reference and diffuse power factor for this frame */ + ivas_dirac_dec_compute_power_factors( num_freq_bands, + diffuseness, + h_dirac_output_synthesis_params->max_band_decorr, + h_dirac_output_synthesis_state->direct_power_factor, + h_dirac_output_synthesis_state->diffuse_power_factor ); } + } diff_start_band = 0; if ( h_dirac_output_synthesis_params->use_onset_filters ) @@ -1841,9 +1838,8 @@ void ivas_dirac_dec_compute_directional_responses( #endif const float *surCohRatio, const int16_t shd_rot_max_order, /* i : split-order rotation method */ - const float *p_Rmat /* i : rotation matrix */ - , - const int16_t hodirac_flag /* i : flag to indicate HO-DirAC mode */ + const float *p_Rmat, /* i : rotation matrix */ + const int16_t hodirac_flag /* i : flag to indicate HO-DirAC mode */ ) { int16_t k, l; diff --git a/lib_dec/ivas_ism_dec.c b/lib_dec/ivas_ism_dec.c index fe98ca0dcb..e6e0037e2c 100644 --- a/lib_dec/ivas_ism_dec.c +++ b/lib_dec/ivas_ism_dec.c @@ -389,8 +389,7 @@ static ivas_error ivas_ism_bitrate_switching( *-------------------------------------------------------------------------*/ ivas_error ivas_ism_dec_config( - Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ - , + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ const ISM_MODE last_ism_mode /* i/o: last ISM mode */ #ifdef JBM_TSM_ON_TCS , diff --git a/lib_dec/ivas_ism_param_dec.c b/lib_dec/ivas_ism_param_dec.c index da4ce92107..18d0a0cc9e 100644 --- a/lib_dec/ivas_ism_param_dec.c +++ b/lib_dec/ivas_ism_param_dec.c @@ -50,9 +50,8 @@ *-----------------------------------------------------------------------*/ static void ivas_param_ism_dec_dequant_DOA( - DIRAC_DEC_HANDLE hDirAC /* i/o: decoder DirAC handle */ - , - const int16_t nchan_ism /* i : number of ISM channels */ + DIRAC_DEC_HANDLE hDirAC, /* i/o: decoder DirAC handle */ + const int16_t nchan_ism /* i : number of ISM channels */ ) { int16_t i; diff --git a/lib_dec/ivas_qmetadata_dec.c b/lib_dec/ivas_qmetadata_dec.c index cfd748afde..3745718470 100644 --- a/lib_dec/ivas_qmetadata_dec.c +++ b/lib_dec/ivas_qmetadata_dec.c @@ -138,9 +138,8 @@ static int16_t read_coherence_data_hr_512( uint16_t *bitstream, int16_t *p_bit_p int16_t ivas_qmetadata_dec_decode( IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: hQMetaData handle */ uint16_t *bitstream, /* i : bitstream */ - int16_t *index /* i/o: bitstream position */ - , - const int16_t hodirac_flag /* i : flag to indicate HO-DirAC mode */ + int16_t *index, /* i/o: bitstream position */ + const int16_t hodirac_flag /* i : flag to indicate HO-DirAC mode */ ) { int16_t d, b, m; diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index 478749ddc0..a1995b53bf 100755 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -311,9 +311,7 @@ ivas_error ivas_sba_dec_reconfigure( #ifndef SBA_MODE_CLEAN_UP st_ivas->sba_mode, #endif - ivas_get_hodirac_flag( ivas_total_brate, st_ivas->sba_analysis_order ) ? IVAS_MAX_NUM_BANDS : ( IVAS_MAX_NUM_BANDS - SPAR_DIRAC_SPLIT_START_BAND ) - - ) ) != IVAS_ERR_OK ) + ivas_get_hodirac_flag( ivas_total_brate, st_ivas->sba_analysis_order ) ? IVAS_MAX_NUM_BANDS : ( IVAS_MAX_NUM_BANDS - SPAR_DIRAC_SPLIT_START_BAND ) ) ) != IVAS_ERR_OK ) { return error; } diff --git a/lib_dec/ivas_spar_decoder.c b/lib_dec/ivas_spar_decoder.c index f3fd5ed04c..bce6fb910a 100755 --- a/lib_dec/ivas_spar_decoder.c +++ b/lib_dec/ivas_spar_decoder.c @@ -809,10 +809,7 @@ static void ivas_spar_dec_MD( if ( st0->m_old_frame_type == ZERO_FRAME && ivas_total_brate == IVAS_SID_5k2 && st0->prev_bfi == 0 && hSpar->hMdDec->spar_md_cfg.nchan_transport == 1 ) { - ivas_spar_setup_md_smoothing( hSpar->hMdDec, num_bands_out - - , - num_md_sub_frames ); + ivas_spar_setup_md_smoothing( hSpar->hMdDec, num_bands_out, num_md_sub_frames ); } else { @@ -823,8 +820,7 @@ static void ivas_spar_dec_MD( { if ( !bfi ) { - ivas_spar_smooth_md_dtx( hSpar->hMdDec, num_bands_out, - num_md_sub_frames ); + ivas_spar_smooth_md_dtx( hSpar->hMdDec, num_bands_out, num_md_sub_frames ); } set_s( hSpar->hMdDec->valid_bands, 0, IVAS_MAX_NUM_BANDS ); diff --git a/lib_dec/ivas_spar_md_dec.c b/lib_dec/ivas_spar_md_dec.c index 03f014ecfd..8fd477b391 100755 --- a/lib_dec/ivas_spar_md_dec.c +++ b/lib_dec/ivas_spar_md_dec.c @@ -83,12 +83,14 @@ static ivas_error ivas_spar_set_dec_config( ivas_spar_md_dec_state_t *hMdDec, co static void ivas_parse_parameter_bitstream_dtx( ivas_spar_md_t *pSpar_md, Decoder_State *st, const int16_t bw, const int16_t num_bands, int16_t *num_dmx_per_band, int16_t *num_dec_per_band ); static ivas_error ivas_deindex_real_index( const int16_t *index, const int16_t q_levels, const float min_value, const float max_value, float *quant, const int16_t num_ch_dim2 ); + #ifdef FIX_501_TABLE_IDX_INIT static void ivas_spar_dec_parse_md_bs( ivas_spar_md_dec_state_t *hMdDec, Decoder_State *st, int16_t *nB, int16_t *bands_bw, int16_t *dtx_vad, const int32_t ivas_total_brate, const int16_t use_planar_coeff, const int16_t sba_inactive_mode, const int32_t last_active_brate ); #else static void ivas_spar_dec_parse_md_bs( ivas_spar_md_dec_state_t *hMdDec, Decoder_State *st, int16_t *nB, int16_t *bands_bw, int16_t *dtx_vad, const int32_t ivas_total_brate, const int16_t use_planar_coeff, const int16_t sba_inactive_mode ); #endif + /*------------------------------------------------------------------------- * ivas_spar_md_dec_matrix_open() * @@ -97,8 +99,7 @@ static void ivas_spar_dec_parse_md_bs( ivas_spar_md_dec_state_t *hMdDec, Decoder static ivas_error ivas_spar_md_dec_matrix_open( ivas_spar_md_dec_state_t *hMdDec, /* i/o: SPAR MD decoder handle */ - const int16_t num_channels /* i : number of internal channels */ - , + const int16_t num_channels, /* i : number of internal channels */ const int16_t num_md_sub_frames ) { int16_t i, j; @@ -680,13 +681,14 @@ void ivas_spar_md_dec_process( ivas_spar_md_dec_state_t *hMdDec; int16_t num_md_chs; int16_t num_md_sub_frames; + int16_t active_w_vlbr; hMdDec = st_ivas->hSpar->hMdDec; - int16_t active_w_vlbr; active_w_vlbr = ( st_ivas->hDecoderConfig->ivas_total_brate < IVAS_24k4 ) ? 1 : 0; num_md_chs = ivas_sba_get_nchan_metadata( sba_order, st_ivas->hDecoderConfig->ivas_total_brate ); + num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( sba_order, st_ivas->hDecoderConfig->ivas_total_brate ); @@ -703,10 +705,7 @@ void ivas_spar_md_dec_process( char f_name[100]; int16_t num_bands = nB; int16_t num_subframes = 1, num_block_groups = 1, num_elements = 1, byte_size = sizeof( float ); - int16_t num_ch = ivas_sba_get_nchan_metadata( sba_order - , - st_ivas->hDecoderConfig->ivas_total_brate - ); + int16_t num_ch = ivas_sba_get_nchan_metadata( sba_order , st_ivas->hDecoderConfig->ivas_total_brate ); for ( b = 0; b < num_bands; b++ ) { sprintf( f_name, "spar_band_pred_coeffs_dec.bin" ); @@ -998,11 +997,7 @@ void ivas_spar_md_dec_process( } } - ivas_get_spar_matrices( hMdDec, num_bands_out, num_md_sub_frames, bw, dtx_vad, nB, - num_md_chs, - active_w_vlbr - - ); + ivas_get_spar_matrices( hMdDec, num_bands_out, num_md_sub_frames, bw, dtx_vad, nB, num_md_chs, active_w_vlbr ); #ifdef DEBUG_SPAR_DIRAC_WRITE_OUT_PRED_PARS { @@ -1024,9 +1019,7 @@ void ivas_spar_md_dec_process( hMdDec->valid_bands[b] = 1; } - ivas_spar_md_fill_invalid_bands( &hMdDec->spar_coeffs, &hMdDec->spar_coeffs_prev, &hMdDec->valid_bands[0], &hMdDec->base_band_age[0], num_bands_out, - num_md_chs, - num_md_sub_frames ); + ivas_spar_md_fill_invalid_bands( &hMdDec->spar_coeffs, &hMdDec->spar_coeffs_prev, &hMdDec->valid_bands[0], &hMdDec->base_band_age[0], num_bands_out, num_md_chs, num_md_sub_frames ); hMdDec->dtx_md_smoothing_cntr = 1; @@ -1044,10 +1037,9 @@ void ivas_spar_md_dec_process( /* NOTE: No changes here as DTX only operates below 160kbps */ #endif void ivas_spar_smooth_md_dtx( - ivas_spar_md_dec_state_t *hMdDec, /* i/o: SPAR MD decoder handle */ - const int16_t num_bands_out /* i : number of output bands */ - , - const int16_t num_md_sub_frames /* i : number of metadata subframes */ + ivas_spar_md_dec_state_t *hMdDec, /* i/o: SPAR MD decoder handle */ + const int16_t num_bands_out, /* i : number of output bands */ + const int16_t num_md_sub_frames /* i : number of metadata subframes */ ) { int16_t j, k, b, dmx_ch; @@ -1121,10 +1113,9 @@ void ivas_spar_smooth_md_dtx( *-----------------------------------------------------------------------------------------*/ void ivas_spar_setup_md_smoothing( - ivas_spar_md_dec_state_t *hMdDec, /* i/o: SPAR MD decoder handle */ - const int16_t num_bands_out /* i : number of output bands */ - , - const int16_t num_md_sub_frames /* i : number of metadata subframes */ + ivas_spar_md_dec_state_t *hMdDec, /* i/o: SPAR MD decoder handle */ + const int16_t num_bands_out, /* i : number of output bands */ + const int16_t num_md_sub_frames /* i : number of metadata subframes */ ) { /* copy the coeffs */ @@ -1176,8 +1167,7 @@ void ivas_spar_setup_md_smoothing( } } - ivas_spar_smooth_md_dtx( hMdDec, num_bands_out, - num_md_sub_frames ); + ivas_spar_smooth_md_dtx( hMdDec, num_bands_out, num_md_sub_frames ); return; } @@ -1642,8 +1632,7 @@ void ivas_spar_dec_gen_umx_mat( ivas_spar_md_dec_state_t *hMdDec, /* i/o: SPAR MD decoder handle */ const int16_t nchan_transport, /* i : number of transport channels */ const int16_t num_bands_out, /* i : number of output bands */ - const int16_t bfi /* i : bad frame indicator */ - , + const int16_t bfi, /* i : bad frame indicator */ const int16_t num_md_sub_frames ) { int16_t i, j, b, i_ts, num_out_ch; @@ -1711,8 +1700,7 @@ void ivas_spar_dec_gen_umx_mat( #endif } - ivas_spar_dec_compute_ramp_down_post_matrix( hMdDec, num_bands_out, bfi, - num_md_sub_frames ); + ivas_spar_dec_compute_ramp_down_post_matrix( hMdDec, num_bands_out, bfi, num_md_sub_frames ); return; } @@ -1823,7 +1811,6 @@ static void ivas_spar_dec_parse_md_bs( ivas_parse_parameter_bitstream_dtx( &hMdDec->spar_md, st0, *bands_bw, *nB, hMdDec->spar_md_cfg.num_dmx_chans_per_band, hMdDec->spar_md_cfg.num_decorr_per_band ); - #ifdef FIX_501_TABLE_IDX_INIT if ( last_active_brate >= IVAS_24k4 ) { @@ -1835,6 +1822,7 @@ static void ivas_spar_dec_parse_md_bs( } bw_fact = *bands_bw / bw_final; #endif + for ( i = *nB - 1; i >= 0; i-- ) { #ifdef FIX_501_TABLE_IDX_INIT @@ -2246,6 +2234,7 @@ static void ivas_decode_arith_bs( ivas_get_band_idx_from_differential( &hMdDec->spar_md, hMdDec->spar_md_cfg.quant_strat->P_r.q_levels, 1, nB, DECD_COEFF ); ivas_get_band_idx_from_differential( &hMdDec->spar_md, hMdDec->spar_md_cfg.quant_strat->P_c.q_levels, 0, nB, DECX_COEFF ); } + return; } @@ -2899,9 +2888,8 @@ void ivas_spar_to_dirac( Decoder_Struct *st_ivas, ivas_spar_md_dec_state_t *hMdDec, /* i/o: SPAR MD decoder handle */ const int16_t dtx_vad, /* i : DTX frame flag */ - const int16_t num_bands_out /* i : number of output bands */ - , - const int16_t bw /* i : band joining factor */ + const int16_t num_bands_out, /* i : number of output bands */ + const int16_t bw /* i : band joining factor */ ) { DIRAC_DEC_HANDLE hDirAC; diff --git a/lib_dec/ivas_stereo_dft_dec.c b/lib_dec/ivas_stereo_dft_dec.c index 5c2d0b37e6..43fdcb49aa 100644 --- a/lib_dec/ivas_stereo_dft_dec.c +++ b/lib_dec/ivas_stereo_dft_dec.c @@ -1133,7 +1133,7 @@ void stereo_dft_dec( const int16_t nchan_transport /* i : number of transpor channels */ #ifdef FIX_STEREO_474 , - const int16_t num_md_sub_frames /* i: number of MD subframes */ + const int16_t num_md_sub_frames /* i : number of MD subframes */ #endif ) { diff --git a/lib_dec/lsf_dec.c b/lib_dec/lsf_dec.c index 73f8933daf..9db7119aa2 100644 --- a/lib_dec/lsf_dec.c +++ b/lib_dec/lsf_dec.c @@ -64,16 +64,15 @@ static void dqlsf_CNG( Decoder_State *st, float *lsf_q ); *---------------------------------------------------------------------*/ void lsf_dec( - Decoder_State *st, /* i/o: State structure */ - const int16_t tc_subfr, /* i : TC subframe index */ - float *Aq, /* o : quantized A(z) for 4 subframes */ - int16_t *LSF_Q_prediction, /* o : LSF prediction mode */ - float *lsf_new, /* o : de-quantized LSF vector */ - float *lsp_new, /* o : de-quantized LSP vector */ - float *lsp_mid, /* o : de-quantized mid-frame LSP vector */ - const int16_t tdm_low_rate_mode /* i : secondary channel low rate mode flag */ - , - const float tdm_lsfQ_PCh[M] /* i : Q LSFs for primary channel */ + Decoder_State *st, /* i/o: State structure */ + const int16_t tc_subfr, /* i : TC subframe index */ + float *Aq, /* o : quantized A(z) for 4 subframes */ + int16_t *LSF_Q_prediction, /* o : LSF prediction mode */ + float *lsf_new, /* o : de-quantized LSF vector */ + float *lsp_new, /* o : de-quantized LSP vector */ + float *lsp_mid, /* o : de-quantized mid-frame LSP vector */ + const int16_t tdm_low_rate_mode, /* i : secondary channel low rate mode flag */ + const float tdm_lsfQ_PCh[M] /* i : Q LSFs for primary channel */ ) { int16_t i, nBits, coder_type, no_param_lpc; @@ -258,9 +257,8 @@ void lsf_end_dec( float *qlsf, /* o : quantized LSFs in the cosine domain */ int16_t *lpc_param, /* i : LPC parameters */ int16_t *LSF_Q_prediction, /* o : LSF prediction mode */ - int16_t *nb_indices /* o : number of indices */ - , - const float tdm_lsfQ_PCh[M] /* i : Q LSFs for primary channel */ + int16_t *nb_indices, /* o : number of indices */ + const float tdm_lsfQ_PCh[M] /* i : Q LSFs for primary channel */ ) { float pred0[M]; /* Prediction for the safety-net quantizer (usually mean)*/ diff --git a/lib_enc/ivas_dirac_enc.c b/lib_enc/ivas_dirac_enc.c index 5aa872e434..904d6de51e 100644 --- a/lib_enc/ivas_dirac_enc.c +++ b/lib_enc/ivas_dirac_enc.c @@ -692,12 +692,11 @@ void computeReferencePower_enc( const int16_t enc_param_start_band, /* i : first band to process */ const int16_t num_freq_bands, /* i : Number of frequency bands */ #ifndef SBA_MODE_CLEAN_UP - const SBA_MODE sba_mode /* i : SBA mode */ + const SBA_MODE sba_modem, /* i : SBA mode */ #else const IVAS_FORMAT ivas_format, /* i : ivas_format */ - int16_t ref_power_w /* i : use 0 if hodirac is enabled */ + int16_t ref_power_w, /* i : use 0 if hodirac is enabled */ #endif - , const int16_t nchan_ana /* i : number of analysis channels */ ) { @@ -730,6 +729,7 @@ void computeReferencePower_enc( } v_multc( reference_power, 0.5f, reference_power, num_freq_bands ); + #ifndef SBA_MODE_CLEAN_UP if ( sba_mode == SBA_MODE_SPAR ) #else diff --git a/lib_enc/ivas_enc_cov_handler.c b/lib_enc/ivas_enc_cov_handler.c index 61c4ccaef9..ec7c1acb0b 100644 --- a/lib_enc/ivas_enc_cov_handler.c +++ b/lib_enc/ivas_enc_cov_handler.c @@ -66,8 +66,7 @@ ivas_error ivas_spar_covar_enc_open( ivas_enc_cov_handler_state_t **hCovEnc, /* i/o: SPAR Covar. encoder handle */ ivas_filterbank_t *pFb, /* i/o: FB handle */ const int32_t input_Fs, /* i : input sampling rate */ - const int16_t nchan_inp /* i : number of input channels */ - , + const int16_t nchan_inp, /* i : number of input channels */ #ifdef FIX_489_COV_SMOOTHING COV_SMOOTHING_TYPE smooth_mode, /* i : Smooth covariance for SPAR or MC */ #endif diff --git a/lib_enc/ivas_init_enc.c b/lib_enc/ivas_init_enc.c index 006fb176fb..137f6ba846 100644 --- a/lib_enc/ivas_init_enc.c +++ b/lib_enc/ivas_init_enc.c @@ -328,10 +328,7 @@ ivas_error ivas_init_encoder( Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ #ifndef IND_LIST_DYN , - Indice ind_list[][MAX_NUM_INDICES] /* o : bitstream indices */ -#endif -#ifndef IND_LIST_DYN - , + Indice ind_list[][MAX_NUM_INDICES], /* o : bitstream indices */ Indice ind_list_metadata[][MAX_BITS_METADATA] /* o : bitstream indices metadata */ #endif ) diff --git a/lib_enc/ivas_mc_paramupmix_enc.c b/lib_enc/ivas_mc_paramupmix_enc.c index c5ee2950db..8582718730 100644 --- a/lib_enc/ivas_mc_paramupmix_enc.c +++ b/lib_enc/ivas_mc_paramupmix_enc.c @@ -735,13 +735,11 @@ static void ivas_mc_paramupmix_param_est_enc( float *cov_real[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH]; float *cov_dtx_real[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH]; float rxx, rxy, ryy, cmat, rxxest, drxx, wetaux; - int16_t l_ts; int16_t b, i, j, ts, bnd; #ifdef FIX_468_16KHZ_PUPMIX int16_t maxbands; #endif - int16_t transient_det[MC_PARAMUPMIX_COMBINATIONS][2]; int16_t transient_det_l[2], transient_det_r[2]; int16_t chan1s[4] = { 4, 5, 8, 9 }; @@ -758,6 +756,7 @@ static void ivas_mc_paramupmix_param_est_enc( /*-----------------------------------------------------------------------------------------* * Transient detector *-----------------------------------------------------------------------------------------*/ + for ( i = 0; i < MC_PARAMUPMIX_COMBINATIONS; i++ ) { ivas_transient_det_process( hMCParamUpmix->hTranDet[2 * i], pcm_in[2 * i], input_frame, transient_det_l ); @@ -785,8 +784,10 @@ static void ivas_mc_paramupmix_param_est_enc( { ivas_fb_mixer_get_windowed_fr( hMCParamUpmix->hFbMixer, pcm_in, pp_in_fr_real, pp_in_fr_imag, l_ts, l_ts, hMCParamUpmix->hFbMixer->fb_cfg->num_in_chans ); + ivas_fb_mixer_update_prior_input( hMCParamUpmix->hFbMixer, pcm_in, l_ts, hMCParamUpmix->hFbMixer->fb_cfg->num_in_chans ); + for ( i = 0; i < MC_PARAMUPMIX_COMBINATIONS * MC_PARAMUPMIX_NCH; i++ ) { pcm_in[i] += l_ts; @@ -798,14 +799,17 @@ static void ivas_mc_paramupmix_param_est_enc( /*-----------------------------------------------------------------------------------------* * Covariance process *-----------------------------------------------------------------------------------------*/ + for ( b = 0; b < MC_PARAMUPMIX_COMBINATIONS; b++ ) { pp_in_fr_real[0] = p_fr_realbuffer[2 * b]; pp_in_fr_imag[0] = p_fr_imagbuffer[2 * b]; pp_in_fr_real[1] = FR_Real_Mid; pp_in_fr_imag[1] = FR_Imag_Mid; + v_add( pp_in_fr_real[0], p_fr_realbuffer[2 * b + 1], pp_in_fr_real[1], L_FRAME48k ); v_add( pp_in_fr_imag[0], p_fr_imagbuffer[2 * b + 1], pp_in_fr_imag[1], L_FRAME48k ); + for ( i = 0; i < MC_PARAMUPMIX_NCH; i++ ) { for ( j = 0; j < MC_PARAMUPMIX_NCH; j++ ) @@ -814,8 +818,10 @@ static void ivas_mc_paramupmix_param_est_enc( cov_dtx_real[i][j] = hMCParamUpmix->cov_dtx_real[b][i][j]; } } + ivas_enc_cov_handler_process( hMCParamUpmix->hCovEnc[b], pp_in_fr_real, pp_in_fr_imag, cov_real, cov_dtx_real, hMCParamUpmix->hFbMixer->pFb, 0, hMCParamUpmix->hFbMixer->pFb->filterbank_num_bands, MC_PARAMUPMIX_NCH, 0 /*dtx_vad*/, transient_det[b], HOA_md_ind ); } + #ifdef FIX_468_16KHZ_PUPMIX maxbands = hMCParamUpmix->hFbMixer->pFb->filterbank_num_bands; for ( b = 0; b < MC_PARAMUPMIX_COMBINATIONS; b++ ) @@ -841,6 +847,7 @@ static void ivas_mc_paramupmix_param_est_enc( betas[b][bnd] = (float) 2.0 * wetaux; } } + #ifdef FIX_468_16KHZ_PUPMIX if ( maxbands < IVAS_MAX_NUM_BANDS ) { @@ -854,5 +861,6 @@ static void ivas_mc_paramupmix_param_est_enc( } } #endif + return; } diff --git a/lib_enc/ivas_qmetadata_enc.c b/lib_enc/ivas_qmetadata_enc.c index 213c0ce756..2a358730d0 100644 --- a/lib_enc/ivas_qmetadata_enc.c +++ b/lib_enc/ivas_qmetadata_enc.c @@ -155,10 +155,9 @@ static int16_t ivas_qmetadata_quantize_coherence_hr_512( IVAS_QMETADATA *hQMetaD *-----------------------------------------------------------------------*/ ivas_error ivas_qmetadata_enc_encode( - BSTR_ENC_HANDLE hMetaData, /* i/o: metadata bitstream handle */ - IVAS_QMETADATA *hQMetaData /* i/o: metadata handle */ - , - const int16_t hodirac_flag /* i : flag to indicate HO-DirAC mode*/ + BSTR_ENC_HANDLE hMetaData, /* i/o: metadata bitstream handle */ + IVAS_QMETADATA *hQMetaData, /* i/o: metadata handle */ + const int16_t hodirac_flag /* i : flag to indicate HO-DirAC mode*/ ) { int16_t i, bit_pos_start, bit_pos_start_coh; diff --git a/lib_enc/lib_enc.c b/lib_enc/lib_enc.c index 28b954c841..97d427a319 100755 --- a/lib_enc/lib_enc.c +++ b/lib_enc/lib_enc.c @@ -956,11 +956,7 @@ static ivas_error configureEncoder( if ( ( error = ivas_init_encoder( st_ivas #ifndef IND_LIST_DYN , - hIvasEnc->ind_list -#endif -#ifndef IND_LIST_DYN - , - hIvasEnc->ind_list_metadata + hIvasEnc->ind_list, hIvasEnc->ind_list_metadata #endif ) ) != IVAS_ERR_OK ) { diff --git a/lib_enc/lsf_enc.c b/lib_enc/lsf_enc.c index 66f8847608..968a9a0d25 100644 --- a/lib_enc/lsf_enc.c +++ b/lib_enc/lsf_enc.c @@ -82,9 +82,8 @@ void lsf_enc( float *lsp_mid, /* i/o: mid-frame LSP vector */ float *Aq, /* o : quantized A(z) for 4 subframes */ const int16_t tdm_low_rate_mode, /* i : secondary channel low rate mode flag */ - const int16_t GSC_IVAS_mode /* i : GSC IVAS mode */ - , - const float tdm_lsfQ_PCh[M] /* i : Q LSFs for primary channel */ + const int16_t GSC_IVAS_mode, /* i : GSC IVAS mode */ + const float tdm_lsfQ_PCh[M] /* i : Q LSFs for primary channel */ ) { int16_t i, nBits, force_sf, no_param_lpc; diff --git a/lib_enc/lsf_msvq_ma_enc.c b/lib_enc/lsf_msvq_ma_enc.c index 9c7bed7629..4c2bcef534 100644 --- a/lib_enc/lsf_msvq_ma_enc.c +++ b/lib_enc/lsf_msvq_ma_enc.c @@ -40,54 +40,54 @@ #include "debug.h" #endif #include "cnst.h" +#include "ivas_prot.h" #include "prot.h" #include "rom_com.h" #include "rom_enc.h" #include "basop_proto_func.h" #include "wmc_auto.h" -#define kMaxC 8 +/*--------------------------------------------------------------------------* + * Local constants + *--------------------------------------------------------------------------*/ -#include "ivas_prot.h" +#define kMaxC 8 -// void dctT2_N_apply_matrix( const float *input, float *output, const int16_t dct_dim, int16_t fdcngvq_dim, const float *idctT2_24_X_matrixQ16, const int16_t matrix_1st_dim, DCTTYPE dcttype ); +/*--------------------------------------------------------------------------* + * msvq_encmsvq_stage1_dct_search() + * + * stage1 search in a segmentwise truncated dct N domain without weights + *--------------------------------------------------------------------------*/ +/*! r: (p_max , best candidate sofar ) */ int16_t msvq_stage1_dct_search( - /* o : (p_max , best candidate sofar ) */ - const float *u, /* i : target */ - const int16_t N, /* i : target length and IDCT synthesis length */ - - /* parameterization of segmented DCT domain storage */ - const int16_t maxC_st1, /* i : number of final stage 1 candidates to provide */ - - const DCTTYPE dcttype, /* e.g. DCT_T2_16_XX, DCT_T2_24_XX; */ - const int16_t max_dct_trunc, /* i: maximum of truncation lenghts */ - float *invTrfMatrix, /* i : IDCT synthesis matrix for dim N */ - - const float *midQ_truncQ, /* i: midQ vector */ - const float *dct_invScaleF, /* i: global inv scale factors*/ - const float *dct_scaleF, /* i: global scale factors*/ - const Word16 n_segm, /* i: number of segments */ - const Word16 *cols_per_segment, /* i: remaining length per segment */ - const Word16 *trunc_dct_cols_per_segment, /* i: trunc length per segment */ - const Word16 *entries_per_segment, /* i: number of rows per segment */ - const Word16 *cum_entries_per_segment, /* i: number of cumulative entries */ - - const Word8 *const W8Qx_dct_sections[], /*i: Word8(byte) segment table ptrs */ - const Word16 *col_syn_shift[], /*i: columnwise syn shift tables */ - const Word8 *segm_neighbour_fwd, /*i: circular neighbour list fwd */ - const Word8 *segm_neighbour_rev, /*i: circular neighbour list reverse */ - const Word16 npost_check, /*i: number of neigbours to check , should be even */ - - float *st1_mse_ptr, /*i: dynRAM buffer for MSEs */ - int16_t *indices_st1_local, /*o: selected cand indices */ - float *st1_syn_vec_ptr, /*i/o: buffer for IDCT24 synthesis */ - float *dist1_ptr /*o: resulting stage 1 MSEs in DCT-N domain */ + const float *u, /* i : target */ + const int16_t N, /* i : target length and IDCT synthesis length */ + const int16_t maxC_st1, /* i : number of final stage 1 candidates to provide */ + const DCTTYPE dcttype, /* e.g. DCT_T2_16_XX, DCT_T2_24_XX; */ + const int16_t max_dct_trunc, /* i : maximum of truncation lenghts */ + float *invTrfMatrix, /* i : IDCT synthesis matrix for dim N */ + const float *midQ_truncQ, /* i : midQ vector */ + const float *dct_invScaleF, /* i : global inv scale factors */ + const float *dct_scaleF, /* i : global scale factors */ + const Word16 n_segm, /* i : number of segments */ + const Word16 *cols_per_segment, /* i : remaining length per segment */ + const Word16 *trunc_dct_cols_per_segment, /* i : trunc length per segment */ + const Word16 *entries_per_segment, /* i : number of rows per segment */ + const Word16 *cum_entries_per_segment, /* i : number of cumulative entries */ + const Word8 *const W8Qx_dct_sections[], /* i : Word8(byte) segment table ptrs */ + const Word16 *col_syn_shift[], /* i : columnwise syn shift tables */ + const Word8 *segm_neighbour_fwd, /* i : circular neighbour list fwd */ + const Word8 *segm_neighbour_rev, /* i : circular neighbour list reverse */ + const Word16 npost_check, /* i : number of neigbours to check , should be even */ + float *st1_mse_ptr, /* i : dynRAM buffer for MSEs */ + int16_t *indices_st1_local, /* o : selected cand indices */ + float *st1_syn_vec_ptr, /* i/o: buffer for IDCT24 synthesis */ + float *dist1_ptr /* o : resulting stage 1 MSEs in DCT-N domain */ ) -{ /* stage1 search in a segmentwise truncated dct N domain without weights */ - +{ float dct_target[FDCNG_VQ_DCT_MAXTRUNC]; float u_mr[FDCNG_VQ_MAX_LEN]; float u_mr_scaled[FDCNG_VQ_MAX_LEN]; @@ -271,15 +271,20 @@ int16_t msvq_stage1_dct_search( } -/* recalc MSE for fdcng WB(0..20) coeffs , +/*--------------------------------------------------------------------------* + * msvq_stage1_dct_recalc_candidates_fdcng_wb() + * + * recalc MSE for fdcng WB(0..20) coeffs , essentially subtract res21^2 ,res22^2, res23^2 that was included in stage1 MSE in the DCT24 domain truncated search, excludes the waveform contributions at pos 21,22,23 to the MSE, important to keep the WB MSEs update for the subsequent stages -*/ -int16_t msvq_stage1_dct_recalc_candidates_fdcng_wb( /* o : (updated p_max) */ - const float *st1_syn_vec_ptr, /* i : IDCT24 synthesis vectors */ - const float *u, /* i : target signal */ - const int16_t maxC_st1, /* i : number of candidates in stage1 */ - float *dist_ptr /* i/o: updated MSE vector for stage1 */ + *--------------------------------------------------------------------------*/ + +/*! r: (updated p_max) */ +int16_t msvq_stage1_dct_recalc_candidates_fdcng_wb( + const float *st1_syn_vec_ptr, /* i : IDCT24 synthesis vectors */ + const float *u, /* i : target signal */ + const int16_t maxC_st1, /* i : number of candidates in stage1 */ + float *dist_ptr /* i/o: updated MSE vector for stage1 */ ) { int16_t p_max_local, c; @@ -309,20 +314,20 @@ int16_t msvq_stage1_dct_recalc_candidates_fdcng_wb( * * MSVQ encoder *--------------------------------------------------------------------------*/ + void msvq_enc( const float *const *cb, /* i : Codebook (indexed cb[*stages][levels][p]) */ const int16_t dims[], /* i : Dimension of each codebook stage (NULL: full dim.) */ const int16_t offs[], /* i : Starting dimension of each codebook stage (NULL: 0) */ const float u[], /* i : Vector to be encoded (prediction and mean removed) */ const int16_t *levels, /* i : Number of levels in each stage */ - const int16_t maxC, /* i : Tree search size (number of candidates kept from */ - /* one stage to the next == M-best) */ + const int16_t maxC, /* i : Tree search size (number of candidates kept from one stage to the next == M-best) */ const int16_t stages, /* i : Number of stages */ const float w[], /* i : Weights */ const int16_t N, /* i : Vector dimension */ const int16_t maxN, /* i : Codebook dimension */ - const int16_t applyDCT_flag, /* i : applyDCT flag */ - float *invTrfMatrix, /*i/o : synthesis matrix */ + const int16_t applyDCT_flag, /* i : applyDCT flag */ + float *invTrfMatrix, /* i/o: synthesis matrix */ int16_t Idx[] /* o : Indices */ ) { @@ -463,37 +468,86 @@ void msvq_enc( else /* non-DCT Stage #1 code below */ if ( !s ) /* means: m==1 */ - { - /* This loop is identical to the one below, except, that the inner + { + /* This loop is identical to the one below, except, that the inner loop over c=0..m is hardcoded to c=0, since m=1. */ - /* dist[0][0] */ - for ( j = 0; j < levels[s]; j++ ) + /* dist[0][0] */ + for ( j = 0; j < levels[s]; j++ ) + { + en = 0.0f; + /* w,Tmp */ + /* Compute weighted codebook element and its energy */ + for ( c2 = 0; c2 < n; c2++ ) + { + Tmp[start + c2] = w[start + c2] * cbp[c2]; + en += cbp[c2] * Tmp[start + c2]; + } + cbp += maxn; /* pointer is incremented */ + + pTmp = &resid[0][0]; + /* Tmp */ + tmp = ( *pTmp++ ) * Tmp[0]; + for ( c2 = 1; c2 < N; c2++ ) { - en = 0.0f; - /* w,Tmp */ - /* Compute weighted codebook element and its energy */ - for ( c2 = 0; c2 < n; c2++ ) + tmp += ( *pTmp++ ) * Tmp[c2]; + } + tmp = en - 2.0f * tmp; + tmp += dist[0][0]; + if ( tmp < dist[1][p_max] ) + { + /* Replace worst */ + dist[1][p_max] = tmp; + indices[1][p_max * stages] = j; + parents[p_max] = 0; + + p_max = 0; + for ( c2 = 1; c2 < maxC; c2++ ) { - Tmp[start + c2] = w[start + c2] * cbp[c2]; - en += cbp[c2] * Tmp[start + c2]; + if ( dist[1][c2] > dist[1][p_max] ) + { + p_max = c2; + } } - cbp += maxn; /* pointer is incremented */ + } /* if (tmp <= dist[1][p_max]) */ + } /* for (j=0; j dist[1][p_max] ) - { - p_max = c2; - } - } - } /* if (tmp <= dist[1][p_max]) */ - } /* for(c=0; c Date: Mon, 5 Jun 2023 16:04:12 +0200 Subject: [PATCH 2/3] clang-format --- lib_com/ivas_fb_mixer.c | 4 +- lib_com/lsf_tools.c | 2 +- lib_dec/ivas_dirac_output_synthesis_dec.c | 184 +++++++++++----------- lib_enc/lsf_msvq_ma_enc.c | 136 ++++++++-------- 4 files changed, 163 insertions(+), 163 deletions(-) diff --git a/lib_com/ivas_fb_mixer.c b/lib_com/ivas_fb_mixer.c index d4c00dc2d5..febb090d3e 100644 --- a/lib_com/ivas_fb_mixer.c +++ b/lib_com/ivas_fb_mixer.c @@ -844,8 +844,8 @@ static int16_t ivas_calculate_abs_fr( float short_stride_nrg = 0.0f; float cldfb_nrg = 0.0f; int16_t short_stride = pFb->fb_bin_to_band.short_stride; - const int16_t num_bins_per_short_stride_bin = (const int16_t) ( ( sampling_rate / FRAMES_PER_SEC ) / short_stride ); - const int16_t num_bins_per_cldfb_band = (const int16_t) ( ( sampling_rate / FRAMES_PER_SEC ) / pFb->fb_bin_to_band.num_cldfb_bands ); + const int16_t num_bins_per_short_stride_bin = ( const int16_t )( ( sampling_rate / FRAMES_PER_SEC ) / short_stride ); + const int16_t num_bins_per_cldfb_band = ( const int16_t )( ( sampling_rate / FRAMES_PER_SEC ) / pFb->fb_bin_to_band.num_cldfb_bands ); float short_stride_max_per_spar_band = 1e-9f; /*loop over all stored Filter Bank Response MDFT coefficients*/ diff --git a/lib_com/lsf_tools.c b/lib_com/lsf_tools.c index c0c4556126..4f40b83015 100644 --- a/lib_com/lsf_tools.c +++ b/lib_com/lsf_tools.c @@ -2569,7 +2569,7 @@ void extend_dctN_input( /*-------------------------------------------------------------------* * create_IDCT_N_Matrix() * - * inititate idct24 FDCNG_VQ_DCT_MAXTRUNCx N matrix in + * inititate idct24 FDCNG_VQ_DCT_MAXTRUNCx N matrix in * RAM from a quantized compressed ROM format *-------------------------------------------------------------------*/ diff --git a/lib_dec/ivas_dirac_output_synthesis_dec.c b/lib_dec/ivas_dirac_output_synthesis_dec.c index 9bf4762ecd..d0ce6fa435 100755 --- a/lib_dec/ivas_dirac_output_synthesis_dec.c +++ b/lib_dec/ivas_dirac_output_synthesis_dec.c @@ -677,118 +677,118 @@ void ivas_dirac_dec_output_synthesis_process_slot( } else // ( hDirAC->hConfig->dec_param_estim == TRUE ) if ( hDirAC->hConfig->dec_param_estim == TRUE ) - { + { - /* compute direct responses */ + /* compute direct responses */ #ifdef JBM_TSM_ON_TCS - ivas_dirac_dec_compute_directional_responses( hDirAC, - hVBAPdata, - NULL, - azimuth, - elevation, - md_idx, - NULL, - sh_rot_max_order, - p_Rmat, - hodirac_flag ); + ivas_dirac_dec_compute_directional_responses( hDirAC, + hVBAPdata, + NULL, + azimuth, + elevation, + md_idx, + NULL, + sh_rot_max_order, + p_Rmat, + hodirac_flag ); #endif - if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) - { - ivas_dirac_dec_compute_gain_factors( num_freq_bands, - diffuseness, - h_dirac_output_synthesis_params->max_band_decorr, - h_dirac_output_synthesis_state->direct_power_factor, - h_dirac_output_synthesis_state->diffuse_power_factor ); + if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) + { + ivas_dirac_dec_compute_gain_factors( num_freq_bands, + diffuseness, + h_dirac_output_synthesis_params->max_band_decorr, + h_dirac_output_synthesis_state->direct_power_factor, + h_dirac_output_synthesis_state->diffuse_power_factor ); - v_multc( h_dirac_output_synthesis_state->direct_power_factor, - 0.25f, - h_dirac_output_synthesis_state->direct_power_factor, - num_freq_bands ); - v_multc( h_dirac_output_synthesis_state->diffuse_power_factor, - 0.25f, - h_dirac_output_synthesis_state->diffuse_power_factor, - num_freq_bands ); + v_multc( h_dirac_output_synthesis_state->direct_power_factor, + 0.25f, + h_dirac_output_synthesis_state->direct_power_factor, + num_freq_bands ); + v_multc( h_dirac_output_synthesis_state->diffuse_power_factor, + 0.25f, + h_dirac_output_synthesis_state->diffuse_power_factor, + num_freq_bands ); - /*Direct gain*/ - for ( ch_idx = 0; ch_idx < min( 4, nchan_transport ); ch_idx++ ) - { - int16_t k; - if ( ch_idx != 0 ) + /*Direct gain*/ + for ( ch_idx = 0; ch_idx < min( 4, nchan_transport ); ch_idx++ ) { - float a, b, c; - - /*Directonal sound gain nrg compensation*/ - for ( k = 0; k < num_freq_bands_diff; k++ ) + int16_t k; + if ( ch_idx != 0 ) { - a = h_dirac_output_synthesis_state->direct_responses[ch_idx * num_freq_bands + k]; - b = reference_power[k + num_freq_bands] / ( reference_power[k + ( ch_idx + 1 ) * num_freq_bands] + EPSILON ); - c = 1.f + ( 1.f / 6.f ) * ( h_dirac_output_synthesis_params->diffuse_compensation_factor_decorr - 1.f ); /*Diffuseness modellling nrg compensation*/ - h_dirac_output_synthesis_state->cy_cross_dir_smooth[ch_idx * num_freq_bands + k] += 0.25f * sqrtf( diffuseness[k] * c + ( ( 1.f - diffuseness[k] ) * a * a * b ) ); + float a, b, c; + + /*Directonal sound gain nrg compensation*/ + for ( k = 0; k < num_freq_bands_diff; k++ ) + { + a = h_dirac_output_synthesis_state->direct_responses[ch_idx * num_freq_bands + k]; + b = reference_power[k + num_freq_bands] / ( reference_power[k + ( ch_idx + 1 ) * num_freq_bands] + EPSILON ); + c = 1.f + ( 1.f / 6.f ) * ( h_dirac_output_synthesis_params->diffuse_compensation_factor_decorr - 1.f ); /*Diffuseness modellling nrg compensation*/ + h_dirac_output_synthesis_state->cy_cross_dir_smooth[ch_idx * num_freq_bands + k] += 0.25f * sqrtf( diffuseness[k] * c + ( ( 1.f - diffuseness[k] ) * a * a * b ) ); + } + for ( ; k < num_freq_bands; k++ ) + { + a = h_dirac_output_synthesis_state->direct_responses[ch_idx * num_freq_bands + k]; + b = reference_power[k + num_freq_bands] / ( reference_power[k + ( ch_idx + 1 ) * num_freq_bands] + EPSILON ); + c = 1.f + ( 1.f / 6.f ) * ( h_dirac_output_synthesis_params->diffuse_compensation_factor - 1.f ); /*Diffuseness modellling nrg compensation*/ + h_dirac_output_synthesis_state->cy_cross_dir_smooth[ch_idx * num_freq_bands + k] += 0.25f * sqrtf( diffuseness[k] * c + ( ( 1.f - diffuseness[k] ) * a * a * b ) ); + } } - for ( ; k < num_freq_bands; k++ ) + else { - a = h_dirac_output_synthesis_state->direct_responses[ch_idx * num_freq_bands + k]; - b = reference_power[k + num_freq_bands] / ( reference_power[k + ( ch_idx + 1 ) * num_freq_bands] + EPSILON ); - c = 1.f + ( 1.f / 6.f ) * ( h_dirac_output_synthesis_params->diffuse_compensation_factor - 1.f ); /*Diffuseness modellling nrg compensation*/ - h_dirac_output_synthesis_state->cy_cross_dir_smooth[ch_idx * num_freq_bands + k] += 0.25f * sqrtf( diffuseness[k] * c + ( ( 1.f - diffuseness[k] ) * a * a * b ) ); + /*Diffuseness modellling nrg compensation*/ + for ( k = 0; k < num_freq_bands_diff; k++ ) + { + h_dirac_output_synthesis_state->cy_cross_dir_smooth[ch_idx * num_freq_bands + k] += 0.25f * sqrtf( 1.0f + diffuseness[k] * 0.5f * ( h_dirac_output_synthesis_params->diffuse_compensation_factor_decorr - 1.f ) ); + } + for ( ; k < num_freq_bands; k++ ) + { + h_dirac_output_synthesis_state->cy_cross_dir_smooth[ch_idx * num_freq_bands + k] += 0.25f * sqrtf( 1.0f + diffuseness[k] * 0.5f * ( h_dirac_output_synthesis_params->diffuse_compensation_factor - 1.f ) ); + } } } - else + + /*Directional gain (panning)*/ + for ( ch_idx = min( 4, nchan_transport ); ch_idx < num_channels_dir; ch_idx++ ) { - /*Diffuseness modellling nrg compensation*/ - for ( k = 0; k < num_freq_bands_diff; k++ ) - { - h_dirac_output_synthesis_state->cy_cross_dir_smooth[ch_idx * num_freq_bands + k] += 0.25f * sqrtf( 1.0f + diffuseness[k] * 0.5f * ( h_dirac_output_synthesis_params->diffuse_compensation_factor_decorr - 1.f ) ); - } - for ( ; k < num_freq_bands; k++ ) - { - h_dirac_output_synthesis_state->cy_cross_dir_smooth[ch_idx * num_freq_bands + k] += 0.25f * sqrtf( 1.0f + diffuseness[k] * 0.5f * ( h_dirac_output_synthesis_params->diffuse_compensation_factor - 1.f ) ); - } + v_mult( h_dirac_output_synthesis_state->direct_power_factor, + &h_dirac_output_synthesis_state->direct_responses[ch_idx * num_freq_bands], + aux_buf, + num_freq_bands ); + + v_add( aux_buf, + &h_dirac_output_synthesis_state->cy_cross_dir_smooth[ch_idx * num_freq_bands], + &h_dirac_output_synthesis_state->cy_cross_dir_smooth[ch_idx * num_freq_bands], + num_freq_bands ); } - } - /*Directional gain (panning)*/ - for ( ch_idx = min( 4, nchan_transport ); ch_idx < num_channels_dir; ch_idx++ ) - { - v_mult( h_dirac_output_synthesis_state->direct_power_factor, - &h_dirac_output_synthesis_state->direct_responses[ch_idx * num_freq_bands], - aux_buf, - num_freq_bands ); - - v_add( aux_buf, - &h_dirac_output_synthesis_state->cy_cross_dir_smooth[ch_idx * num_freq_bands], - &h_dirac_output_synthesis_state->cy_cross_dir_smooth[ch_idx * num_freq_bands], - num_freq_bands ); - } + /*Diffuse gain*/ + for ( ch_idx = min( 4, nchan_transport ); ch_idx < num_channels_diff; ch_idx++ ) + { + v_multc( h_dirac_output_synthesis_state->diffuse_power_factor, + hDirAC->diffuse_response_function[ch_idx], + aux_buf, + num_freq_bands_diff ); + + v_add( aux_buf, + &h_dirac_output_synthesis_state->cy_auto_diff_smooth[ch_idx * num_freq_bands_diff], + &h_dirac_output_synthesis_state->cy_auto_diff_smooth[ch_idx * num_freq_bands_diff], + num_freq_bands_diff ); + } - /*Diffuse gain*/ - for ( ch_idx = min( 4, nchan_transport ); ch_idx < num_channels_diff; ch_idx++ ) + return; + } + else { - v_multc( h_dirac_output_synthesis_state->diffuse_power_factor, - hDirAC->diffuse_response_function[ch_idx], - aux_buf, - num_freq_bands_diff ); - - v_add( aux_buf, - &h_dirac_output_synthesis_state->cy_auto_diff_smooth[ch_idx * num_freq_bands_diff], - &h_dirac_output_synthesis_state->cy_auto_diff_smooth[ch_idx * num_freq_bands_diff], - num_freq_bands_diff ); + /* compute reference and diffuse power factor for this frame */ + ivas_dirac_dec_compute_power_factors( num_freq_bands, + diffuseness, + h_dirac_output_synthesis_params->max_band_decorr, + h_dirac_output_synthesis_state->direct_power_factor, + h_dirac_output_synthesis_state->diffuse_power_factor ); } - - return; - } - else - { - /* compute reference and diffuse power factor for this frame */ - ivas_dirac_dec_compute_power_factors( num_freq_bands, - diffuseness, - h_dirac_output_synthesis_params->max_band_decorr, - h_dirac_output_synthesis_state->direct_power_factor, - h_dirac_output_synthesis_state->diffuse_power_factor ); } - } diff_start_band = 0; if ( h_dirac_output_synthesis_params->use_onset_filters ) diff --git a/lib_enc/lsf_msvq_ma_enc.c b/lib_enc/lsf_msvq_ma_enc.c index 4c2bcef534..47d9d83a8a 100644 --- a/lib_enc/lsf_msvq_ma_enc.c +++ b/lib_enc/lsf_msvq_ma_enc.c @@ -468,86 +468,37 @@ void msvq_enc( else /* non-DCT Stage #1 code below */ if ( !s ) /* means: m==1 */ - { - /* This loop is identical to the one below, except, that the inner - loop over c=0..m is hardcoded to c=0, since m=1. */ - /* dist[0][0] */ - for ( j = 0; j < levels[s]; j++ ) { - en = 0.0f; - /* w,Tmp */ - /* Compute weighted codebook element and its energy */ - for ( c2 = 0; c2 < n; c2++ ) - { - Tmp[start + c2] = w[start + c2] * cbp[c2]; - en += cbp[c2] * Tmp[start + c2]; - } - cbp += maxn; /* pointer is incremented */ - - pTmp = &resid[0][0]; - /* Tmp */ - tmp = ( *pTmp++ ) * Tmp[0]; - for ( c2 = 1; c2 < N; c2++ ) - { - tmp += ( *pTmp++ ) * Tmp[c2]; - } - tmp = en - 2.0f * tmp; - tmp += dist[0][0]; - if ( tmp < dist[1][p_max] ) + /* This loop is identical to the one below, except, that the inner + loop over c=0..m is hardcoded to c=0, since m=1. */ + /* dist[0][0] */ + for ( j = 0; j < levels[s]; j++ ) { - /* Replace worst */ - dist[1][p_max] = tmp; - indices[1][p_max * stages] = j; - parents[p_max] = 0; - - p_max = 0; - for ( c2 = 1; c2 < maxC; c2++ ) + en = 0.0f; + /* w,Tmp */ + /* Compute weighted codebook element and its energy */ + for ( c2 = 0; c2 < n; c2++ ) { - if ( dist[1][c2] > dist[1][p_max] ) - { - p_max = c2; - } + Tmp[start + c2] = w[start + c2] * cbp[c2]; + en += cbp[c2] * Tmp[start + c2]; } - } /* if (tmp <= dist[1][p_max]) */ - } /* for (j=0; j dist[1][p_max] ) + { + p_max = c2; + } + } + } /* if (tmp <= dist[1][p_max]) */ + } /* for(c=0; c Date: Wed, 7 Jun 2023 08:33:17 +0200 Subject: [PATCH 3/3] clang-format --- lib_dec/ivas_dirac_output_synthesis_dec.c | 184 +++++++++++----------- lib_enc/ivas_enc_cov_handler.c | 4 +- 2 files changed, 94 insertions(+), 94 deletions(-) diff --git a/lib_dec/ivas_dirac_output_synthesis_dec.c b/lib_dec/ivas_dirac_output_synthesis_dec.c index 103ffa2e8f..d45086edb7 100755 --- a/lib_dec/ivas_dirac_output_synthesis_dec.c +++ b/lib_dec/ivas_dirac_output_synthesis_dec.c @@ -622,116 +622,116 @@ void ivas_dirac_dec_output_synthesis_process_slot( } else // ( hDirAC->hConfig->dec_param_estim == TRUE ) if ( hDirAC->hConfig->dec_param_estim == TRUE ) - { + { - /* compute direct responses */ - ivas_dirac_dec_compute_directional_responses( hDirAC, - hVBAPdata, - NULL, - azimuth, - elevation, - md_idx, - NULL, - sh_rot_max_order, - p_Rmat, - hodirac_flag ); + /* compute direct responses */ + ivas_dirac_dec_compute_directional_responses( hDirAC, + hVBAPdata, + NULL, + azimuth, + elevation, + md_idx, + NULL, + sh_rot_max_order, + p_Rmat, + hodirac_flag ); - if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) - { - ivas_dirac_dec_compute_gain_factors( num_freq_bands, - diffuseness, - h_dirac_output_synthesis_params->max_band_decorr, - h_dirac_output_synthesis_state->direct_power_factor, - h_dirac_output_synthesis_state->diffuse_power_factor ); + if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) + { + ivas_dirac_dec_compute_gain_factors( num_freq_bands, + diffuseness, + h_dirac_output_synthesis_params->max_band_decorr, + h_dirac_output_synthesis_state->direct_power_factor, + h_dirac_output_synthesis_state->diffuse_power_factor ); - v_multc( h_dirac_output_synthesis_state->direct_power_factor, - 0.25f, - h_dirac_output_synthesis_state->direct_power_factor, - num_freq_bands ); - v_multc( h_dirac_output_synthesis_state->diffuse_power_factor, - 0.25f, - h_dirac_output_synthesis_state->diffuse_power_factor, - num_freq_bands ); + v_multc( h_dirac_output_synthesis_state->direct_power_factor, + 0.25f, + h_dirac_output_synthesis_state->direct_power_factor, + num_freq_bands ); + v_multc( h_dirac_output_synthesis_state->diffuse_power_factor, + 0.25f, + h_dirac_output_synthesis_state->diffuse_power_factor, + num_freq_bands ); - /*Direct gain*/ - for ( ch_idx = 0; ch_idx < min( 4, nchan_transport ); ch_idx++ ) - { - int16_t k; - if ( ch_idx != 0 ) + /*Direct gain*/ + for ( ch_idx = 0; ch_idx < min( 4, nchan_transport ); ch_idx++ ) { - float a, b, c; - - /*Directonal sound gain nrg compensation*/ - for ( k = 0; k < num_freq_bands_diff; k++ ) + int16_t k; + if ( ch_idx != 0 ) { - a = h_dirac_output_synthesis_state->direct_responses[ch_idx * num_freq_bands + k]; - b = reference_power[k + num_freq_bands] / ( reference_power[k + ( ch_idx + 1 ) * num_freq_bands] + EPSILON ); - c = 1.f + ( 1.f / 6.f ) * ( h_dirac_output_synthesis_params->diffuse_compensation_factor_decorr - 1.f ); /*Diffuseness modellling nrg compensation*/ - h_dirac_output_synthesis_state->cy_cross_dir_smooth[ch_idx * num_freq_bands + k] += 0.25f * sqrtf( diffuseness[k] * c + ( ( 1.f - diffuseness[k] ) * a * a * b ) ); + float a, b, c; + + /*Directonal sound gain nrg compensation*/ + for ( k = 0; k < num_freq_bands_diff; k++ ) + { + a = h_dirac_output_synthesis_state->direct_responses[ch_idx * num_freq_bands + k]; + b = reference_power[k + num_freq_bands] / ( reference_power[k + ( ch_idx + 1 ) * num_freq_bands] + EPSILON ); + c = 1.f + ( 1.f / 6.f ) * ( h_dirac_output_synthesis_params->diffuse_compensation_factor_decorr - 1.f ); /*Diffuseness modellling nrg compensation*/ + h_dirac_output_synthesis_state->cy_cross_dir_smooth[ch_idx * num_freq_bands + k] += 0.25f * sqrtf( diffuseness[k] * c + ( ( 1.f - diffuseness[k] ) * a * a * b ) ); + } + for ( ; k < num_freq_bands; k++ ) + { + a = h_dirac_output_synthesis_state->direct_responses[ch_idx * num_freq_bands + k]; + b = reference_power[k + num_freq_bands] / ( reference_power[k + ( ch_idx + 1 ) * num_freq_bands] + EPSILON ); + c = 1.f + ( 1.f / 6.f ) * ( h_dirac_output_synthesis_params->diffuse_compensation_factor - 1.f ); /*Diffuseness modellling nrg compensation*/ + h_dirac_output_synthesis_state->cy_cross_dir_smooth[ch_idx * num_freq_bands + k] += 0.25f * sqrtf( diffuseness[k] * c + ( ( 1.f - diffuseness[k] ) * a * a * b ) ); + } } - for ( ; k < num_freq_bands; k++ ) + else { - a = h_dirac_output_synthesis_state->direct_responses[ch_idx * num_freq_bands + k]; - b = reference_power[k + num_freq_bands] / ( reference_power[k + ( ch_idx + 1 ) * num_freq_bands] + EPSILON ); - c = 1.f + ( 1.f / 6.f ) * ( h_dirac_output_synthesis_params->diffuse_compensation_factor - 1.f ); /*Diffuseness modellling nrg compensation*/ - h_dirac_output_synthesis_state->cy_cross_dir_smooth[ch_idx * num_freq_bands + k] += 0.25f * sqrtf( diffuseness[k] * c + ( ( 1.f - diffuseness[k] ) * a * a * b ) ); + /*Diffuseness modellling nrg compensation*/ + for ( k = 0; k < num_freq_bands_diff; k++ ) + { + h_dirac_output_synthesis_state->cy_cross_dir_smooth[ch_idx * num_freq_bands + k] += 0.25f * sqrtf( 1.0f + diffuseness[k] * 0.5f * ( h_dirac_output_synthesis_params->diffuse_compensation_factor_decorr - 1.f ) ); + } + for ( ; k < num_freq_bands; k++ ) + { + h_dirac_output_synthesis_state->cy_cross_dir_smooth[ch_idx * num_freq_bands + k] += 0.25f * sqrtf( 1.0f + diffuseness[k] * 0.5f * ( h_dirac_output_synthesis_params->diffuse_compensation_factor - 1.f ) ); + } } } - else + + /*Directional gain (panning)*/ + for ( ch_idx = min( 4, nchan_transport ); ch_idx < num_channels_dir; ch_idx++ ) { - /*Diffuseness modellling nrg compensation*/ - for ( k = 0; k < num_freq_bands_diff; k++ ) - { - h_dirac_output_synthesis_state->cy_cross_dir_smooth[ch_idx * num_freq_bands + k] += 0.25f * sqrtf( 1.0f + diffuseness[k] * 0.5f * ( h_dirac_output_synthesis_params->diffuse_compensation_factor_decorr - 1.f ) ); - } - for ( ; k < num_freq_bands; k++ ) - { - h_dirac_output_synthesis_state->cy_cross_dir_smooth[ch_idx * num_freq_bands + k] += 0.25f * sqrtf( 1.0f + diffuseness[k] * 0.5f * ( h_dirac_output_synthesis_params->diffuse_compensation_factor - 1.f ) ); - } + v_mult( h_dirac_output_synthesis_state->direct_power_factor, + &h_dirac_output_synthesis_state->direct_responses[ch_idx * num_freq_bands], + aux_buf, + num_freq_bands ); + + v_add( aux_buf, + &h_dirac_output_synthesis_state->cy_cross_dir_smooth[ch_idx * num_freq_bands], + &h_dirac_output_synthesis_state->cy_cross_dir_smooth[ch_idx * num_freq_bands], + num_freq_bands ); } - } - /*Directional gain (panning)*/ - for ( ch_idx = min( 4, nchan_transport ); ch_idx < num_channels_dir; ch_idx++ ) - { - v_mult( h_dirac_output_synthesis_state->direct_power_factor, - &h_dirac_output_synthesis_state->direct_responses[ch_idx * num_freq_bands], - aux_buf, - num_freq_bands ); - - v_add( aux_buf, - &h_dirac_output_synthesis_state->cy_cross_dir_smooth[ch_idx * num_freq_bands], - &h_dirac_output_synthesis_state->cy_cross_dir_smooth[ch_idx * num_freq_bands], - num_freq_bands ); - } + /*Diffuse gain*/ + for ( ch_idx = min( 4, nchan_transport ); ch_idx < num_channels_diff; ch_idx++ ) + { + v_multc( h_dirac_output_synthesis_state->diffuse_power_factor, + hDirAC->diffuse_response_function[ch_idx], + aux_buf, + num_freq_bands_diff ); + + v_add( aux_buf, + &h_dirac_output_synthesis_state->cy_auto_diff_smooth[ch_idx * num_freq_bands_diff], + &h_dirac_output_synthesis_state->cy_auto_diff_smooth[ch_idx * num_freq_bands_diff], + num_freq_bands_diff ); + } - /*Diffuse gain*/ - for ( ch_idx = min( 4, nchan_transport ); ch_idx < num_channels_diff; ch_idx++ ) + return; + } + else { - v_multc( h_dirac_output_synthesis_state->diffuse_power_factor, - hDirAC->diffuse_response_function[ch_idx], - aux_buf, - num_freq_bands_diff ); - - v_add( aux_buf, - &h_dirac_output_synthesis_state->cy_auto_diff_smooth[ch_idx * num_freq_bands_diff], - &h_dirac_output_synthesis_state->cy_auto_diff_smooth[ch_idx * num_freq_bands_diff], - num_freq_bands_diff ); + /* compute reference and diffuse power factor for this frame */ + ivas_dirac_dec_compute_power_factors( num_freq_bands, + diffuseness, + h_dirac_output_synthesis_params->max_band_decorr, + h_dirac_output_synthesis_state->direct_power_factor, + h_dirac_output_synthesis_state->diffuse_power_factor ); } - - return; - } - else - { - /* compute reference and diffuse power factor for this frame */ - ivas_dirac_dec_compute_power_factors( num_freq_bands, - diffuseness, - h_dirac_output_synthesis_params->max_band_decorr, - h_dirac_output_synthesis_state->direct_power_factor, - h_dirac_output_synthesis_state->diffuse_power_factor ); } - } diff_start_band = 0; if ( h_dirac_output_synthesis_params->use_onset_filters ) diff --git a/lib_enc/ivas_enc_cov_handler.c b/lib_enc/ivas_enc_cov_handler.c index 3af8a35e31..14920e4ac1 100644 --- a/lib_enc/ivas_enc_cov_handler.c +++ b/lib_enc/ivas_enc_cov_handler.c @@ -67,8 +67,8 @@ ivas_error ivas_spar_covar_enc_open( ivas_filterbank_t *pFb, /* i/o: FB handle */ const int32_t input_Fs, /* i : input sampling rate */ const int16_t nchan_inp, /* i : number of input channels */ - COV_SMOOTHING_TYPE smooth_mode, /* i : Smooth covariance for SPAR or MC */ - const int32_t ivas_total_brate /* i : IVAS total bitrate */ + COV_SMOOTHING_TYPE smooth_mode, /* i : Smooth covariance for SPAR or MC */ + const int32_t ivas_total_brate /* i : IVAS total bitrate */ ) { ivas_enc_cov_handler_state_t *hCovState; -- GitLab