diff --git a/apps/decoder.c b/apps/decoder.c index fd659b74aed5a8ba522ba0f4c4d40d7055454ffc..f1787da629d5f14a58460b901f5c5caa660f720c 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -2255,8 +2255,7 @@ static ivas_error decodeVoIP( /* decode and get samples */ - if ( ( error = IVAS_DEC_VoIP_GetSamples( hIvasDec, nOutSamples, pcmBuf, systemTime_ms, - &nSamplesAvailableNext + if ( ( error = IVAS_DEC_VoIP_GetSamples( hIvasDec, nOutSamples, pcmBuf, systemTime_ms, &nSamplesAvailableNext #ifdef SUPPORT_JBM_TRACEFILE , writeJbmTraceFileFrameWrapper, diff --git a/lib_com/bitstream.c b/lib_com/bitstream.c index 81b734b400074b1b997c522c1e18c9c99a94437e..a95775590a740d50d02277933e91bac77938a6ec 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 */ @@ -1377,7 +1381,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 */ ) @@ -1397,6 +1401,7 @@ int16_t find_indice( return -1; } + /*-------------------------------------------------------------------* * delete_indice() * @@ -1406,7 +1411,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 78db889104b0c544790d2bafa22f50d212c56479..27a361bdb883b290a922a0c0497db30246346099 100755 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -983,8 +983,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 430e33e343bfa414b747e9009c6c803a7c0b540f..e2aa44627bc46cf337e9d23a4360124c21ac9404 100644 --- a/lib_com/ivas_cov_smooth.c +++ b/lib_com/ivas_cov_smooth.c @@ -52,8 +52,8 @@ static void ivas_set_up_cov_smoothing( ivas_filterbank_t *pFb, const float max_update_rate, const int16_t min_pool_size, - const COV_SMOOTHING_TYPE smooth_mode /* i : flag multichannel vs SPAR */ - , + const COV_SMOOTHING_TYPE smooth_mode, /* i : flag multichannel vs SPAR */ + const int32_t ivas_total_brate ) { int16_t j, k; @@ -147,13 +147,12 @@ static void ivas_set_up_cov_smoothing( *------------------------------------------------------------------------*/ 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 */ - , - COV_SMOOTHING_TYPE smooth_mode, /* i : Smooth covariance for SPAR or MC */ - const int32_t ivas_total_brate /* i : IVAS total bitrate */ + 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 COV_SMOOTHING_TYPE smooth_mode, /* i : Smooth covariance for SPAR or MC */ + const int32_t ivas_total_brate /* i : IVAS total bitrate */ ) { ivas_cov_smooth_state_t *hCovState; @@ -181,7 +180,6 @@ ivas_error ivas_spar_covar_smooth_enc_open( } } - ivas_set_up_cov_smoothing( hCovState, pFb, cov_smooth_cfg->max_update_rate, cov_smooth_cfg->min_pool_size, smooth_mode, ivas_total_brate ); *hCovState_out = hCovState; diff --git a/lib_com/ivas_fb_mixer.c b/lib_com/ivas_fb_mixer.c index 4dd3c588e425b2bee0d2f50d7270b8027af8b751..a2f1a9d509f92b3da666862a600742d285bd9f13 100644 --- a/lib_com/ivas_fb_mixer.c +++ b/lib_com/ivas_fb_mixer.c @@ -104,9 +104,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; @@ -478,8 +477,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; @@ -519,16 +517,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 ); @@ -550,9 +545,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; diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index b12e9afb9517615155cb222a67036a640514cfe2..bb774c73bc97972504d35cba3a75c49a71972624 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -113,9 +113,9 @@ ivas_error mct_enc_reconfigure( ivas_error ivas_spar_md_enc_init ( - ivas_spar_md_enc_state_t *hMdEnc, /* o : MD encoder handle */ - const ENCODER_CONFIG_HANDLE hEncoderConfig, /* i : configuration structure */ - const int16_t sba_order /* i : Ambisonic (SBA) order */ + ivas_spar_md_enc_state_t *hMdEnc, /* o : MD encoder handle */ + const ENCODER_CONFIG_HANDLE hEncoderConfig, /* i : configuration structure */ + const int16_t sba_order /* i : Ambisonic (SBA) order */ ); ivas_error ivas_sba_enc_reconfigure( @@ -213,7 +213,7 @@ ivas_error pre_proc_front_ivas( const int16_t front_vad_flag, /* i : front-VAD flag to overwrite VAD decision */ const int16_t force_front_vad, /* i : flag to force VAD decision */ const int16_t front_vad_dtx_flag, /* i : front-VAD DTX flag to overwrite VAD decision*/ - const int32_t ivas_total_brate /* i : IVAS total bitrate */ + const int32_t ivas_total_brate /* i : IVAS total bitrate */ ); ivas_error pre_proc_ivas( @@ -318,8 +318,7 @@ ivas_error ivas_dec( ); ivas_error ivas_dec_setup( - Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ - , + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ uint16_t *nSamplesRendered, /* o : number of samples flushed from the previous frame (JBM) */ int16_t *data /* o : flushed PCM samples */ ); @@ -659,8 +658,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 */ - , + const int16_t idx, /* i : LS config. index */ uint16_t *nSamplesRendered, /* o : samples flushed from last frame (JBM) */ int16_t *data /* o : flushed samples (JBM) */ ); @@ -1004,8 +1002,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 */ ); @@ -1014,10 +1011,8 @@ ivas_error ivas_ism_enc_config( ); ivas_error ivas_ism_dec_config( - Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ - , - const ISM_MODE last_ism_mode /* i/o: last ISM mode */ - , + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + const ISM_MODE last_ism_mode, /* i/o: last ISM mode */ uint16_t *nSamplesRendered, /* o : number of samples flushed on renderer change*/ int16_t *data /* o : flushed PCM samples */ ); @@ -1318,9 +1313,8 @@ void stereo_dft_dec( ivas_spar_md_dec_state_t *hMdDec, /* i/o: SPAR MD handle for upmixing */ const int16_t cross_fade_start_offset, /* i : SPAR mixer delay compensation */ const int32_t output_Fs, /* i : Fs for delay calculation */ - const int16_t nchan_transport /* i : number of transpor channels */ - , - const int16_t num_md_sub_frames /* i: number of MD subframes */ + const int16_t nchan_transport, /* i : number of transpor channels */ + const int16_t num_md_sub_frames /* i : number of MD subframes */ ); void stereo_dft_res_ecu( @@ -1553,8 +1547,7 @@ int16_t read_BS_adapt_GR_sg( void stereo_dft_hybrid_ITD_flag( STEREO_DFT_CONFIG_DATA_HANDLE hConfig, /* o : DFT stereo configuration */ - const int32_t input_Fs /* i : CPE element sampling rate */ - , + const int32_t input_Fs, /* i : CPE element sampling rate */ const int16_t hybrid_itd_max /* i : flag for hybrid ITD for very large ITDs */ ); @@ -3086,8 +3079,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 */ ); @@ -3133,8 +3125,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 */ ); @@ -3145,9 +3136,8 @@ int16_t ivas_qmetadata_dec_decode_hr_384_512( int16_t *index, /* i/o: bitstream position */ const SPHERICAL_GRID_DATA *sph_grid16, /* i: spherical grid for deindexing */ const int16_t bits_sph_idx, - const int16_t bits_sp_coh - , - uint8_t ncoding_bands_config + const int16_t bits_sp_coh, + const uint8_t ncoding_bands_config ); /*! r: number of bits read */ @@ -3225,8 +3215,7 @@ ivas_error only_reduce_bits_direction( void quantize_direction_frame( IVAS_QDIRECTION *q_direction, /* i/o: quantized direction structure */ float azimuth_orig[MASA_MAXIMUM_CODING_SUBBANDS][MAX_PARAM_SPATIAL_SUBFRAMES], - float elevation_orig[MASA_MAXIMUM_CODING_SUBBANDS][MAX_PARAM_SPATIAL_SUBFRAMES] - , + float elevation_orig[MASA_MAXIMUM_CODING_SUBBANDS][MAX_PARAM_SPATIAL_SUBFRAMES], const int16_t hrmasa_flag /* i : flag indicating high-rate MASA MD coding*/ ); @@ -3366,8 +3355,7 @@ void ivas_dirac_param_est_enc( float **pp_fr_real, float **pp_fr_imag, const int16_t input_frame, - const IVAS_FORMAT ivas_format - , + const IVAS_FORMAT ivas_format , const int16_t hodirac_flag, const int16_t nchan_fb_in ); @@ -3433,9 +3421,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( @@ -3496,9 +3483,8 @@ void ivas_sba_dirac_stereo_smooth_parameters( STEREO_DFT_DEC_DATA_HANDLE hStereoDft, /* i/o: encoder DFT stereo handle */ ivas_spar_md_dec_state_t *hMdDec, /* i/o: SPAR MD handle for upmixing */ const int16_t cross_fade_start_offset, /* i : SPAR mixer delay compensation */ - const int32_t output_Fs /* i : Fs for delay calculation */ - , - const int16_t num_md_sub_frames /* i : number of subframes in mixing matrix */ + const int32_t output_Fs, /* i : Fs for delay calculation */ + const int16_t num_md_sub_frames /* i : number of subframes in mixing matrix */ ); void ivas_sba2mc_cldfb( @@ -3740,8 +3726,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 */ ); @@ -3760,11 +3745,9 @@ 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 index_slot - , - const int16_t hodirac_flag + const int16_t nchan_transport, /* i : number of transport channels */ + const int16_t ind_slot, /* i : index of the slot to be added to the input covariance */ + const int16_t hodirac_flag /* i : flag to indicate HO-DirAC mode */ ); void ivas_dirac_dec_output_synthesis_process_subframe_gain_shd( @@ -3773,8 +3756,7 @@ void ivas_dirac_dec_output_synthesis_process_subframe_gain_shd( DIRAC_DEC_HANDLE hDirAC, /* i/o: DirAC handle */ const int16_t nchan_transport, /* i : number of transport channels */ const int16_t nbslots, /* i : number of slots to process */ - const float *onset_filter - , + const float *onset_filter, #ifdef FIX_393_459_460_SBA_MD float *diffuseness, #else @@ -3787,11 +3769,11 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls( float RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX],/* i : LS signals */ float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX],/* i : LS signals */ DIRAC_DEC_HANDLE hDirAC, /* i/o: DirAC handle */ - const int16_t nbslots, /* i : number of slots to process */ + const int16_t nbslots, /* i : number of slots to process */ #ifdef FIX_393_459_460_SBA_MD - float *diffuseness_vector, /* i : diffuseness (needed for direction smoothing)*/ + float *diffuseness_vector, /* i : diffuseness (needed for direction smoothing)*/ #else - const int16_t diff_md_idx, /* i : md slot idx of diffuseness to use */ + const int16_t diff_md_idx, /* i : md slot idx of diffuseness to use */ #endif float *reference_power_smooth, float qualityBasedSmFactor @@ -4147,7 +4129,7 @@ void ivas_dirac_dec_output_synthesis_cov_param_mc_collect_slot( const int16_t nchan_in /* i : number of input channels */ ); -void ivas_dirac_dec_output_synthesis_cov_param_mc_synthesise_slot( +void ivas_dirac_dec_output_synthesis_cov_param_mc_synthesise_slot( float *Cldfb_RealBuffer_in, /* i : input channel filter bank samples (real part) */ float *Cldfb_ImagBuffer_in, /* i : input channel filter bank samples (imaginary part) */ float Cldfb_RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : output channel filter bank samples (real part) */ @@ -4487,8 +4469,7 @@ ivas_error ivas_spar_md_enc_process( BSTR_ENC_HANDLE hMetaData, /* i/o: MetaData handle */ const int16_t dtx_vad, const int16_t nchan_inp, - const int16_t sba_order /* i : Ambisonic (SBA) order */ - , + const int16_t sba_order, /* i : Ambisonic (SBA) order */ float *prior_mixer[IVAS_MAX_FB_MIXER_OUT_CH][IVAS_MAX_SPAR_FB_MIXER_IN_CH] /* i : prior mixer_matrix */ ); @@ -4596,9 +4577,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( @@ -4607,24 +4587,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 ); @@ -4633,9 +4610,8 @@ 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 */ - , - COV_SMOOTHING_TYPE smooth_mode, /* i : Smooth covariance for SPAR or MC*/ + 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 */ ); @@ -4655,8 +4631,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] ); @@ -4664,10 +4639,9 @@ 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 */ - , - COV_SMOOTHING_TYPE smooth_mode, /* i : Smooth covariance for SPAR or MC*/ - const int32_t ivas_total_brate /* i : IVAS total bitrate */ + const int16_t nchan_inp, /* i : number of input channels */ + const COV_SMOOTHING_TYPE smooth_mode, /* i : Smooth covariance for SPAR or MC */ + const int32_t ivas_total_brate /* i : IVAS total bitrate */ ); void ivas_spar_covar_smooth_enc_close( @@ -4898,8 +4872,7 @@ int16_t ivas_arith_encode_cmplx_cell_array( int16_t *pSymbol_old_re, ivas_cell_dim_t *pCell_dims, BSTR_ENC_HANDLE hMetaData, - const int16_t any_diff - , + const int16_t any_diff , const int16_t wc_strat_arith ); @@ -5112,8 +5085,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 */ ); @@ -5457,8 +5429,7 @@ 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 */ 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 */ const int16_t nchan_ana /* i : number of analysis channels */ ); @@ -5587,8 +5558,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 */ ); @@ -5609,16 +5579,14 @@ 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] ); 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 */ ); @@ -5628,8 +5596,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 26dbb10df141b59d6a2eb4bcb186a72d1488bcb1..32b4653d2f4c40a1dc9befe955c442ce71241a23 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 91137d3433894fbab32fea52f17eb4ecf9ceaf45..a81e7921954167f7d63e2ec3d70aa25ea8d88c51 100644 --- a/lib_com/ivas_sba_config.c +++ b/lib_com/ivas_sba_config.c @@ -210,9 +210,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; @@ -239,9 +239,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 */ @@ -261,6 +261,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]; @@ -269,6 +270,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 1128b085179dfcccdec40f6c9d34ead6f37cbf23..c56421103deaac3387275e153fd2f52430b35daf 100644 --- a/lib_com/ivas_spar_com.c +++ b/lib_com/ivas_spar_com.c @@ -1682,12 +1682,10 @@ void ivas_get_spar_md_from_dirac( remix_order = remix_order_set[hSpar_md_cfg->remix_unmix_order]; - num_ch = ivas_sba_get_nchan_metadata( order, - IVAS_256k /*dummy value as order is always 1 in this function*/ + num_ch = ivas_sba_get_nchan_metadata( order, IVAS_256k /*dummy value as order is always 1 in this function*/ ); - hoa2_ch = ivas_sba_get_nchan_metadata( SBA_HOA2_ORDER, - IVAS_256k /*dummy value as order is always 1 in this function*/ + hoa2_ch = ivas_sba_get_nchan_metadata( SBA_HOA2_ORDER, IVAS_256k /*dummy value as order is always 1 in this function*/ ); foa_ch = FOA_CHANNELS; @@ -1935,9 +1933,7 @@ void ivas_get_spar_md_from_dirac( #endif ivas_compute_spar_params( pCov_real, dm_fv_re, i_ts, ppMixer_mat, start_band, end_band, dtx_vad, - num_ch, 1, hSpar_md_cfg->active_w, - active_w_vlbr, - hSpar_md_cfg, hSpar_md, Wscale, 1 ); + num_ch, 1, hSpar_md_cfg->active_w, active_w_vlbr, hSpar_md_cfg, hSpar_md, Wscale, 1 ); if ( mixer_mat != NULL ) { @@ -2142,6 +2138,7 @@ void ivas_spar_set_bitrate_config( int16_t quant_strat; int16_t bands_bw; + 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 02a735e80c0baf8914c90526bd7fde29581f5dd8..4f40b8301550461f90bb78a3c18d32ac1a1b0186 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 172053bc5434e70b39057e416452e9829fa0eb52..1000e3738c314d23c2a8f1b63419e3ae1c3c264b 100644 --- a/lib_com/prot.h +++ b/lib_com/prot.h @@ -524,28 +524,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( @@ -562,16 +566,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 @@ -3086,9 +3092,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( @@ -3885,12 +3890,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 */ @@ -4562,9 +4565,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( @@ -4637,16 +4639,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( @@ -8110,19 +8111,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 */ ); @@ -8134,77 +8134,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 */ @@ -8352,9 +8354,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 eb2e84f598c8f4d0dd102fdf6abf06bd3980cd8f..8d5e9de34d67e9fad94e36773518d26078bd0bea 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_dec.c b/lib_dec/ivas_dirac_dec.c index 098aa348ebcca3fe32165e1288db4a82b89a7861..feb61ab063dfb9ab27918340a0282a76c68b6a23 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -314,8 +314,7 @@ ivas_error ivas_dirac_dec_config( nchan_transport_orig = st_ivas->nchan_transport; if ( st_ivas->ivas_format == SBA_FORMAT && !( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) { - st_ivas->nchan_transport = ivas_sba_get_nchan_metadata( st_ivas->sba_analysis_order, - st_ivas->hDecoderConfig->ivas_total_brate ); + st_ivas->nchan_transport = ivas_sba_get_nchan_metadata( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); } nchan_transport = st_ivas->nchan_transport; diff --git a/lib_dec/ivas_dirac_output_synthesis_dec.c b/lib_dec/ivas_dirac_output_synthesis_dec.c old mode 100644 new mode 100755 index 61682fca444a5d0df0721071c78e2bb29b5a5e88..d45086edb739665d8e700d7e62679e7159ce64cc --- a/lib_dec/ivas_dirac_output_synthesis_dec.c +++ b/lib_dec/ivas_dirac_output_synthesis_dec.c @@ -90,9 +90,8 @@ ivas_error ivas_dirac_dec_output_synthesis_open( DIRAC_DEC_HANDLE hDirAC, /* i/o: DirAC handle */ RENDERER_TYPE renderer_type, /* i : renderer type */ const int16_t nchan_transport, /* i : number of transport channels */ - const int32_t output_Fs /* i : output sampling rate */ - , - const int16_t hodirac_flag /* i : flag to indicate HO-DirAC mode */ + const int32_t output_Fs, /* i : output sampling rate */ + const int16_t hodirac_flag /* i : flag to indicate HO-DirAC mode */ ) { int16_t idx, ch_idx; @@ -355,10 +354,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; @@ -544,8 +542,7 @@ 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*/ const int16_t md_idx, const int16_t hodirac_flag /* i : flag to indicate HO-DirAC mode */ ) @@ -1760,9 +1757,8 @@ void ivas_dirac_dec_compute_directional_responses( const int16_t md_idx, 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_init_dec.c b/lib_dec/ivas_init_dec.c index 0f0365d437d5c1be66e095f94500dfbf6cf590f1..4bb061b572c63b0ad6daa655e65276e35202466d 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -62,8 +62,7 @@ static ivas_error doSanityChecks_IVAS( Decoder_Struct *st_ivas ); *-------------------------------------------------------------------*/ ivas_error ivas_dec_setup( - Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ - , + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ uint16_t *nSamplesRendered, /* o : number of samples flushed from the previous frame (JBM) */ int16_t *data /* o : flushed PCM samples */ ) diff --git a/lib_dec/ivas_ism_dec.c b/lib_dec/ivas_ism_dec.c index 1ee468dc80316d21bb043548e93c777cd8289fbd..5ad0ce08c7c084288ef8432e1933dabe81be1f50 100644 --- a/lib_dec/ivas_ism_dec.c +++ b/lib_dec/ivas_ism_dec.c @@ -49,10 +49,9 @@ static ivas_error ivas_ism_bitrate_switching( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ const int16_t nchan_transport_old, /* i : last number of transport channels */ - const ISM_MODE last_ism_mode /* i : last ISM mode */ - , - uint16_t *nSamplesRendered, /* o : number of samples rendered */ - int16_t *data /* o : rendered samples */ + const ISM_MODE last_ism_mode, /* i : last ISM mode */ + uint16_t *nSamplesRendered, /* o : number of samples rendered */ + int16_t *data /* o : rendered samples */ ) { ivas_error error; @@ -354,12 +353,11 @@ static ivas_error ivas_ism_bitrate_switching( *-------------------------------------------------------------------------*/ ivas_error ivas_ism_dec_config( - Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ - , - const ISM_MODE last_ism_mode /* i/o: last ISM mode */ - , - uint16_t *nSamplesRendered, /* o : number of samples flushed when the renderer granularity changes */ - int16_t *data ) + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + const ISM_MODE last_ism_mode, /* i/o: last ISM mode */ + uint16_t *nSamplesRendered, /* o : number of samples flushed when the renderer granularity changes */ + int16_t *data /* o : flushed PCM samples */ +) { int32_t ivas_total_brate; ivas_error error; diff --git a/lib_dec/ivas_ism_param_dec.c b/lib_dec/ivas_ism_param_dec.c index 1e28d2ea340395eb3f21151802ad761239eb5df9..7bbad7aa99a07d639b857c21b4edd9bff5314c0f 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_mct_dec.c b/lib_dec/ivas_mct_dec.c index a3a03f9ead016e5c573eed07425c3733a973dbd6..9d42ec0885f4c3b843a69d2d983aac543283ac1e 100755 --- a/lib_dec/ivas_mct_dec.c +++ b/lib_dec/ivas_mct_dec.c @@ -105,7 +105,6 @@ ivas_error ivas_mct_dec( } } - for ( cpe_id = 0; cpe_id < nCPE; cpe_id++ ) { /*initialize param_lpc buffer*/ @@ -129,7 +128,6 @@ ivas_error ivas_mct_dec( ivas_mdct_dec_side_bits_frame_channel( st_ivas->hCPE[cpe_id], param_lpc[cpe_id], p_param[cpe_id], st_ivas->hCPE[0]->hCoreCoder[0], nTnsBitsTCX10[cpe_id], param[cpe_id], 1, ( ( cpe_id + 1 ) * CPE_CHANNELS > hMCT->nchan_out_woLFE ) ); - st_ivas->BER_detect |= st_ivas->hCPE[cpe_id]->hCoreCoder[0]->BER_detect; st_ivas->BER_detect |= st_ivas->hCPE[cpe_id]->hCoreCoder[1]->BER_detect; } @@ -151,8 +149,7 @@ ivas_error ivas_mct_dec( set_zero( x[n][1], L_FRAME48k / 2 ); } - ivas_mdct_core_invQ( st_ivas->hCPE[cpe_id], - nTnsBitsTCX10[cpe_id], p_param[cpe_id], param_lpc[cpe_id], param[cpe_id], + ivas_mdct_core_invQ( st_ivas->hCPE[cpe_id], nTnsBitsTCX10[cpe_id], p_param[cpe_id], param_lpc[cpe_id], param[cpe_id], fUseTns[cpe_id], tnsData[cpe_id], x, x, Aq[cpe_id], NULL, 1 ); st_ivas->BER_detect |= st_ivas->hCPE[cpe_id]->hCoreCoder[0]->BER_detect; @@ -185,8 +182,7 @@ ivas_error ivas_mct_dec( x[n][1] = &output[n + cpe_id * CPE_CHANNELS][L_FRAME48k / 2]; } - ivas_mdct_core_tns_ns( hCPE, - fUseTns[cpe_id], tnsData[cpe_id], x, Aq[cpe_id], 1 ); + ivas_mdct_core_tns_ns( hCPE, fUseTns[cpe_id], tnsData[cpe_id], x, Aq[cpe_id], 1 ); } if ( st_ivas->renderer_type == RENDERER_MC ) @@ -222,8 +218,7 @@ ivas_error ivas_mct_dec( x[n][1] = &output[n + cpe_id * CPE_CHANNELS][L_FRAME48k / 2]; } - ivas_mdct_core_reconstruct( hCPE, x, synth, - fUseTns[cpe_id], 1 ); + ivas_mdct_core_reconstruct( hCPE, x, synth, fUseTns[cpe_id], 1 ); /*----------------------------------------------------------------* * CoreCoder Post-processing and updates @@ -619,9 +614,8 @@ void ivas_mct_dec_close( /*! r : MC format mode */ ivas_error ivas_mc_dec_config( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - const int16_t idx /* i : LS config. index */ - , + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + const int16_t idx, /* i : LS config. index */ uint16_t *nSamplesRendered, /* o : samples flushed from last frame (JBM) */ int16_t *data /* o : flushed samples (JBM) */ ) @@ -671,8 +665,7 @@ ivas_error ivas_mc_dec_config( *-------------------------------------------------------------------------*/ static ivas_error ivas_mc_dec_reconfig( - Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ - , + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ uint16_t *nSamplesRendered, /* o : number of samples flushed from the last frame (JBM) */ int16_t *data /* o : flushed samples (JBM) */ ) @@ -729,7 +722,6 @@ static ivas_error ivas_mc_dec_reconfig( renderer_type_old = st_ivas->renderer_type; ivas_renderer_select( st_ivas ); - /* side effect of the renderer selection can be a changed internal config */ ivas_output_init( &( st_ivas->hIntSetup ), st_ivas->intern_config ); @@ -795,6 +787,7 @@ static ivas_error ivas_mc_dec_reconfig( ivas_mc_paramupmix_dec_close( &( st_ivas->hMCParamUpmix ) ); ivas_ls_setup_conversion_close( &( st_ivas->hLsSetUpConversion ) ); } + /* De-allocate McMasa-related handles */ ivas_masa_dec_close( &( st_ivas->hMasa ) ); ivas_qmetadata_close( &st_ivas->hQMetaData ); diff --git a/lib_dec/ivas_output_config.c b/lib_dec/ivas_output_config.c index aec03b506b67e1127c05a49f25f5ef0c2caccdc1..e4c389e2f33d75921e997a480b04c88b7e71af7b 100644 --- a/lib_dec/ivas_output_config.c +++ b/lib_dec/ivas_output_config.c @@ -152,8 +152,7 @@ void ivas_renderer_select( if ( st_ivas->hDecoderConfig->Opt_Headrotation ) { - nchan_internal = ivas_sba_get_nchan_metadata( st_ivas->sba_analysis_order, - st_ivas->hDecoderConfig->ivas_total_brate ); + nchan_internal = ivas_sba_get_nchan_metadata( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); if ( nchan_internal == 2 ) { st_ivas->hHeadTrackData->shd_rot_max_order = 1; diff --git a/lib_dec/ivas_qmetadata_dec.c b/lib_dec/ivas_qmetadata_dec.c index d3ecf47b5288c32494d9d1a1943c51d903bc951c..a9fc4693f0d7bdbadb730427b0d37b9bfdafef3e 100644 --- a/lib_dec/ivas_qmetadata_dec.c +++ b/lib_dec/ivas_qmetadata_dec.c @@ -116,9 +116,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; @@ -751,7 +750,7 @@ int16_t ivas_qmetadata_dec_decode_hr_384_512( const SPHERICAL_GRID_DATA *sph_grid16, /* i : spherical grid for deindexing */ const int16_t bits_sph_idx, const int16_t bits_sp_coh, - uint8_t ncoding_bands_config ) + const uint8_t ncoding_bands_config ) { int16_t d, b, m; #ifdef DEBUG_MODE_QMETADATA @@ -3233,11 +3232,11 @@ static int16_t read_common_direction( *-----------------------------------------------------------------------*/ static void decode_spread_coherence( - IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: quantized metadata structure */ - int16_t idx_d, /* i : direction index */ - const int16_t no_frames /* i : number of time subframes */ - , - const int16_t hrmasa_flag /* i : flag indicating high-rate MASA MD coding*/ + IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: quantized metadata structure */ + int16_t idx_d, /* i : direction index */ + const int16_t no_frames, /* i : number of time subframes */ + + const int16_t hrmasa_flag /* i : flag indicating high-rate MASA MD coding */ ) { int16_t i, j; @@ -3299,7 +3298,6 @@ static void decode_spread_coherence( q_direction = &hQMetaData->q_direction[idx_d]; - for ( i = 0; i < coding_subbands; i++ ) { var_azi = var( q_direction->band_data[i].azimuth, no_frames ); @@ -3396,6 +3394,7 @@ static ivas_error read_huf( #endif *num_bits_read = end_pos; + return IVAS_ERR_OK; } @@ -3479,7 +3478,6 @@ static int16_t decode_fixed_rate_composed_index_coherence( /* fixed rate */ uint64_t no_cb; uint16_t temp_index[MASA_MAXIMUM_CODING_SUBBANDS]; - uint64_t idx_fr; int16_t no_bits_vec1, half_no_bands; int16_t bit_pos; @@ -3566,7 +3564,6 @@ static int16_t decode_fixed_rate_composed_index_coherence( decode_combined_index( idx_fr, no_cv_vec, temp_index, no_bands ); } - for ( j = 0; j < no_bands; j++ ) { decoded_index[j] = temp_index[j]; @@ -3606,7 +3603,6 @@ static int16_t read_coherence_data_hr_512( nbands = hQMetaData->q_direction[idx_dir].cfg.nbands; nblocks = hQMetaData->q_direction[idx_dir].cfg.nblocks; - cb_size = 1 << nbits_coh; delta = 256.0f / cb_size; nbits = *p_bit_pos; @@ -3640,13 +3636,13 @@ static int16_t read_coherence_data_hr_512( } else { - /* read min_index */ min_index = 0; for ( i = 0; i < nbits_coh; i++ ) { min_index = ( min_index << 1 ) + bitstream[( *p_bit_pos )--]; } + /* read GR param */ GR_param = bitstream[( *p_bit_pos )--]; for ( j = 0; j < nbands; j++ ) @@ -3656,7 +3652,9 @@ static int16_t read_coherence_data_hr_512( } } } + nbits = nbits - *p_bit_pos; + return nbits; } @@ -3669,12 +3667,11 @@ static int16_t read_coherence_data_hr_512( /*! r: number of bits read */ static int16_t read_coherence_data( - uint16_t *bitstream, /* i : bitstream */ - int16_t *p_bit_pos, /* i : position in the bitstream */ - IVAS_QMETADATA *hQMetaData, /* i/o: quantized metadata structure */ - const int16_t idx_dir /* i : direction index */ - , - const int16_t hrmasa_flag /* i : flag indicating high-rate MASA MD coding*/ + uint16_t *bitstream, /* i : bitstream */ + int16_t *p_bit_pos, /* i : position in the bitstream */ + IVAS_QMETADATA *hQMetaData, /* i/o: quantized metadata structure */ + const int16_t idx_dir, /* i : direction index */ + const int16_t hrmasa_flag /* i : flag indicating high-rate MASA MD coding*/ ) { int16_t j; diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index 6b8576a95f3c8c9cf76cb8acfa942a8307c6c183..429916d17e4a72b7bdfcbc3a3f5b4e65456cb316 100755 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -293,9 +293,7 @@ ivas_error ivas_sba_dec_reconfigure( &st_ivas->element_mode_init, ivas_total_brate, st_ivas->sba_analysis_order, - 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; } @@ -376,8 +374,7 @@ ivas_error ivas_sba_dec_reconfigure( } else if ( st_ivas->ivas_format == SBA_FORMAT ) { - tc_nchan_to_allocate = ivas_sba_get_nchan_metadata( st_ivas->sba_analysis_order, - st_ivas->hDecoderConfig->ivas_total_brate ); + tc_nchan_to_allocate = ivas_sba_get_nchan_metadata( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); } else { @@ -491,9 +488,7 @@ void ivas_sba_dec_render( float *output_f_local[MAX_OUTPUT_CHANNELS]; hSpar = st_ivas->hSpar; - nchan_internal = ivas_sba_get_nchan_metadata( st_ivas->sba_analysis_order, - st_ivas->hDecoderConfig->ivas_total_brate ); - + nchan_internal = ivas_sba_get_nchan_metadata( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); nchan_out = st_ivas->hIntSetup.nchan_out_woLFE + st_ivas->hIntSetup.num_lfe; #ifdef DEBUGGING diff --git a/lib_dec/ivas_sba_dirac_stereo_dec.c b/lib_dec/ivas_sba_dirac_stereo_dec.c index aca7ce78f96c8d5451707271caac593edb25f851..6c1649d08705aa45414cd5b371db0ab4713fab97 100644 --- a/lib_dec/ivas_sba_dirac_stereo_dec.c +++ b/lib_dec/ivas_sba_dirac_stereo_dec.c @@ -689,12 +689,11 @@ static void ivas_sba_dirac_stereo_apply_td_stefi( *-------------------------------------------------------------------*/ void ivas_sba_dirac_stereo_smooth_parameters( - STEREO_DFT_DEC_DATA_HANDLE hStereoDft, /* i/o: decoder DFT stereo handle */ - ivas_spar_md_dec_state_t *hMdDec, /* i/o: SPAR MD handle for upmixing */ - const int16_t cross_fade_start_offset, /* i : SPAR mixer delay compensation */ - const int32_t output_Fs /* i : Fs for delay calculation */ - , - const int16_t num_md_sub_frames /* i : number of subframes in mixing matrix */ + STEREO_DFT_DEC_DATA_HANDLE hStereoDft, /* i/o: decoder DFT stereo handle */ + ivas_spar_md_dec_state_t *hMdDec, /* i/o: SPAR MD handle for upmixing */ + const int16_t cross_fade_start_offset, /* i : SPAR mixer delay compensation */ + const int32_t output_Fs, /* i : Fs for delay calculation */ + const int16_t num_md_sub_frames /* i : number of subframes in mixing matrix */ ) { int16_t i, j, k, i_sf; diff --git a/lib_dec/ivas_sba_rendering_internal.c b/lib_dec/ivas_sba_rendering_internal.c index 17d231a6d3bcd8ad6ee6898664762720c93a5819..6f3dd13b7a560ee083b59b8991db441840454416 100644 --- a/lib_dec/ivas_sba_rendering_internal.c +++ b/lib_dec/ivas_sba_rendering_internal.c @@ -397,9 +397,7 @@ void ivas_sba_upmixer_renderer( push_wmops( "ivas_sba_upmixer_renderer" ); - nchan_internal = ivas_sba_get_nchan_metadata( st_ivas->sba_analysis_order, - st_ivas->hDecoderConfig->ivas_total_brate ); - + nchan_internal = ivas_sba_get_nchan_metadata( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); /* Upmixer + Renderer */ ivas_spar_dec_upmixer( st_ivas, output, nchan_internal, output_frame ); diff --git a/lib_dec/ivas_spar_decoder.c b/lib_dec/ivas_spar_decoder.c index d7b3aba54fbdd892e72f4cd41b34846f24e48386..48bbd5810d0a1be405b0e9de03bf936a7633733c 100644 --- a/lib_dec/ivas_spar_decoder.c +++ b/lib_dec/ivas_spar_decoder.c @@ -130,8 +130,7 @@ ivas_error ivas_spar_dec_open( /* set FB config. */ active_w_mixing = -1; - if ( ( error = ivas_fb_set_cfg( &fb_cfg, SBA_FORMAT, num_channels_internal, num_channels_internal, active_w_mixing, output_Fs, - 0 ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_fb_set_cfg( &fb_cfg, SBA_FORMAT, num_channels_internal, num_channels_internal, active_w_mixing, output_Fs, 0 ) ) != IVAS_ERR_OK ) { return error; } @@ -726,9 +725,7 @@ static void ivas_spar_dec_MD( sba_order = min( st_ivas->sba_analysis_order, IVAS_MAX_SBA_ORDER ); bfi = st_ivas->bfi; ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; - num_channels = ivas_sba_get_nchan_metadata( sba_order, - ivas_total_brate ); - + num_channels = ivas_sba_get_nchan_metadata( sba_order, ivas_total_brate ); num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( sba_order, st_ivas->hDecoderConfig->ivas_total_brate ); num_bands_out = hSpar->hFbMixer->pFb->filterbank_num_bands; @@ -792,10 +789,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 { @@ -806,8 +800,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 ); @@ -1119,8 +1112,7 @@ void ivas_spar_dec_agc_pca( if ( hSpar->hMdDec->td_decorr_flag ) { - num_in_ingest = ivas_sba_get_nchan_metadata( st_ivas->sba_analysis_order, - st_ivas->hDecoderConfig->ivas_total_brate ); + num_in_ingest = ivas_sba_get_nchan_metadata( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); } else { @@ -1240,8 +1232,7 @@ void ivas_spar_dec_digest_tc( /* TD decorrelator */ default_frame = (int16_t) ( st_ivas->hDecoderConfig->output_Fs / FRAMES_PER_SEC ); nSamplesLeftForTD = nSamplesForRendering; - nchan_internal = ivas_sba_get_nchan_metadata( st_ivas->sba_analysis_order, - st_ivas->hDecoderConfig->ivas_total_brate ); + nchan_internal = ivas_sba_get_nchan_metadata( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); for ( ch = 0; ch < nchan_internal; ch++ ) { @@ -1545,8 +1536,7 @@ void ivas_spar_dec_upmixer_sf( /* apply parameters */ /* determine if we can skip certain data */ - ivas_spar_get_skip_mat( hSpar, numch_out, numch_in, num_spar_bands, b_skip_mat, - num_md_sub_frames ); /* this can be precomputed based on bitrate and format*/ + ivas_spar_get_skip_mat( hSpar, numch_out, numch_in, num_spar_bands, b_skip_mat, num_md_sub_frames ); /* this can be precomputed based on bitrate and format*/ numch_out_dirac = hDecoderConfig->nchan_out; @@ -1560,12 +1550,7 @@ void ivas_spar_dec_upmixer_sf( { for ( ts = 0; ts < hSpar->subframe_nbslots[hSpar->subframes_rendered]; ts++ ) { - cldfbAnalysis_ts( - &p_tc[in_ch][ts * num_cldfb_bands], - cldfb_in_ts_re[in_ch][ts], - cldfb_in_ts_im[in_ch][ts], - num_cldfb_bands, - st_ivas->cldfbAnaDec[in_ch] ); + cldfbAnalysis_ts( &p_tc[in_ch][ts * num_cldfb_bands], cldfb_in_ts_re[in_ch][ts], cldfb_in_ts_im[in_ch][ts], num_cldfb_bands, st_ivas->cldfbAnaDec[in_ch] ); } } @@ -1695,12 +1680,7 @@ void ivas_spar_dec_upmixer_sf( { for ( ts = 0; ts < hSpar->subframe_nbslots[hSpar->subframes_rendered]; ts++ ) { - cldfbSynthesis( - &cldfb_in_ts_re[idx_in][ts], - &cldfb_in_ts_im[idx_in][ts], - &output[ch][ts * num_cldfb_bands], - num_cldfb_bands, - st_ivas->cldfbSynDec[idx_in] ); + cldfbSynthesis( &cldfb_in_ts_re[idx_in][ts], &cldfb_in_ts_im[idx_in][ts], &output[ch][ts * num_cldfb_bands], num_cldfb_bands, st_ivas->cldfbSynDec[idx_in] ); } } idx_in++; @@ -1717,12 +1697,7 @@ void ivas_spar_dec_upmixer_sf( { for ( ts = 0; ts < hSpar->subframe_nbslots[hSpar->subframes_rendered]; ts++ ) { - cldfbSynthesis( - &cldfb_in_ts_re[out_ch][ts], - &cldfb_in_ts_im[out_ch][ts], - &output[out_ch][ts * num_cldfb_bands], - num_cldfb_bands, - st_ivas->cldfbSynDec[out_ch] ); + cldfbSynthesis( &cldfb_in_ts_re[out_ch][ts], &cldfb_in_ts_im[out_ch][ts], &output[out_ch][ts * num_cldfb_bands], num_cldfb_bands, st_ivas->cldfbSynDec[out_ch] ); } } #ifdef DEBUG_SBA_AUDIO_DUMP @@ -1734,7 +1709,6 @@ void ivas_spar_dec_upmixer_sf( ivas_spar_dump_signal_wav( output_frame, NULL, output, hSpar->numOutChannels, spar_foa_dec_wav[3], "cldfbSynthesis()" ); #endif - hSpar->slots_rendered += hSpar->subframe_nbslots[hSpar->subframes_rendered]; hSpar->subframes_rendered++; diff --git a/lib_dec/ivas_spar_md_dec.c b/lib_dec/ivas_spar_md_dec.c index abf3c1a72c3bf59c49f4cd25546f326d021567c6..c8108ac33fdb08f5f398163a1fc45b6a55362cec 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; @@ -612,8 +613,7 @@ static ivas_error ivas_spar_set_dec_config( hMdDec->spar_md_cfg.max_freq_per_chan[i] = ivas_spar_br_table_consts[hMdDec->table_idx].fpcs; } - nchan = ivas_sba_get_nchan_metadata( ivas_spar_br_table_consts[hMdDec->table_idx].sba_order, - ivas_spar_br_table_consts[hMdDec->table_idx].ivas_total_brate ); + nchan = ivas_sba_get_nchan_metadata( ivas_spar_br_table_consts[hMdDec->table_idx].sba_order, ivas_spar_br_table_consts[hMdDec->table_idx].ivas_total_brate ); switch ( nchan ) { @@ -675,13 +675,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 ); @@ -698,10 +699,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" ); @@ -993,11 +991,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 { @@ -1019,9 +1013,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; @@ -1039,10 +1031,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; @@ -1116,10 +1107,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 */ @@ -1171,8 +1161,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; } @@ -1637,8 +1626,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; @@ -1706,8 +1694,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; } @@ -1818,7 +1805,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 ) { @@ -1830,6 +1816,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 @@ -2241,6 +2228,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; } @@ -2894,9 +2882,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 08caff6233a43875a1cf12946b56666636a7a7c6..24a9c7347b083cfaec6ab168a17d0a6fc6669c1a 100644 --- a/lib_dec/ivas_stereo_dft_dec.c +++ b/lib_dec/ivas_stereo_dft_dec.c @@ -1130,9 +1130,8 @@ void stereo_dft_dec( ivas_spar_md_dec_state_t *hMdDec, /* i : SPAR MD handle for upmixing */ const int16_t cross_fade_start_offset, /* i : SPAR mixer delay compensation */ const int32_t output_Fs, /* i : Fs for delay calculation */ - const int16_t nchan_transport /* i : number of transpor channels */ - , - const int16_t num_md_sub_frames /* i: number of MD subframes */ + const int16_t nchan_transport, /* i : number of transpor channels */ + const int16_t num_md_sub_frames /* i : number of MD subframes */ ) { int16_t i, k, b, N_div, stop; diff --git a/lib_dec/ivas_stereo_mdct_core_dec.c b/lib_dec/ivas_stereo_mdct_core_dec.c index cbeaf2a1e516f0b4d2473fd8f8ca1ff406dd2c2c..9508a539825b2f28c3a9bd469663863b5e2bec50 100644 --- a/lib_dec/ivas_stereo_mdct_core_dec.c +++ b/lib_dec/ivas_stereo_mdct_core_dec.c @@ -221,8 +221,7 @@ void stereo_mdct_core_dec( if ( !bfi ) { - ivas_mdct_dec_side_bits_frame_channel( hCPE, param_lpc, p_param, hCPE->hCoreCoder[0], - nTnsBitsTCX10, param, 0, 0 ); + ivas_mdct_dec_side_bits_frame_channel( hCPE, param_lpc, p_param, hCPE->hCoreCoder[0], nTnsBitsTCX10, param, 0, 0 ); if ( sts[0]->igf ) { @@ -253,8 +252,7 @@ void stereo_mdct_core_dec( } } - ivas_mdct_core_invQ( hCPE, - nTnsBitsTCX10, p_param, param_lpc, param, fUseTns, tnsData, x_0, x, Aq, ms_mask, 0 ); + ivas_mdct_core_invQ( hCPE, nTnsBitsTCX10, p_param, param_lpc, param, fUseTns, tnsData, x_0, x, Aq, ms_mask, 0 ); for ( ch = 0; ch < nChannels; ch++ ) { @@ -347,8 +345,7 @@ void stereo_mdct_core_dec( stereo_decoder_tcx( hCPE->hStereoMdct, ms_mask, x_0[1], x[0], x[1], &hCPE->hStereoMdct->mdct_stereo_mode[0], sts[0]->core, sts[1]->core, sts[0]->igf, L_frameTCX[0], L_frameTCX[1], 0, sts[0]->last_core, sts[1]->last_core, 0 ); } - ivas_mdct_core_tns_ns( hCPE, - fUseTns, tnsData, x, Aq, 0 ); + ivas_mdct_core_tns_ns( hCPE, fUseTns, tnsData, x, Aq, 0 ); if ( st_ivas->renderer_type == RENDERER_MC_PARAMMC && ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_MONO || st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_STEREO ) ) { @@ -362,8 +359,7 @@ void stereo_mdct_core_dec( apply_dmx_weights( hCPE, x, sts[0]->transform_type, sts[1]->transform_type ); } - ivas_mdct_core_reconstruct( hCPE, x, signal_outFB_tmp, - fUseTns, 0 ); + ivas_mdct_core_reconstruct( hCPE, x, signal_outFB_tmp, fUseTns, 0 ); mvr2r( signal_out_tmp[0], signal_out[0], L_FRAME48k ); mvr2r( signal_out_tmp[1], signal_out[1], L_FRAME48k ); diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 673c030abf98d68519da86e7a5511e0891968dea..3b4618b6a29011fef488c547e9ec71457e4213dd 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -1714,12 +1714,11 @@ ivas_error IVAS_DEC_VoIP_SetScale( *---------------------------------------------------------------------*/ ivas_error IVAS_DEC_VoIP_GetSamples( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - uint16_t nSamplesPerChannel, /* i : number of samples per channel requested to be written to output buffer */ - int16_t *pcmBuf, /* i/o: buffer for decoded PCM output. The memory must already be allocated and be able to hold the expected number of output samples, based on frame size and number of output channels */ - const uint32_t systemTimestamp_ms /* i : current system timestamp */ - , - uint16_t *sampleAvailableNext /* o : samples available for the next call */ + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + uint16_t nSamplesPerChannel, /* i : number of samples per channel requested to be written to output buffer */ + int16_t *pcmBuf, /* i/o: buffer for decoded PCM output. The memory must already be allocated and be able to hold the expected number of output samples, based on frame size and number of output channels */ + const uint32_t systemTimestamp_ms, /* i : current system timestamp */ + uint16_t *sampleAvailableNext /* o : samples available for the next call */ #ifdef SUPPORT_JBM_TRACEFILE , JbmTraceFileWriterFn jbmWriterFn, @@ -2167,8 +2166,7 @@ ivas_error IVAS_DEC_VoIP_Flush( *---------------------------------------------------------------------*/ bool IVAS_DEC_VoIP_IsEmpty( - IVAS_DEC_HANDLE hIvasDec /* i/o: IVAS decoder handle */ - , + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ const int16_t nSamplesAsked ) { return ( ( JB4_bufferedDataUnits( hIvasDec->hVoIP->hJBM ) == 0 ) && ( hIvasDec->hVoIP->nSamplesAvailableNext < nSamplesAsked ) ); diff --git a/lib_dec/lib_dec.h b/lib_dec/lib_dec.h index 8d2159a71f6257eb6b1c4aa47f890dfb3a03e5a5..0572ace82e3f7de7cd5bfec8c1f4f3890439434a 100644 --- a/lib_dec/lib_dec.h +++ b/lib_dec/lib_dec.h @@ -231,8 +231,7 @@ ivas_error IVAS_DEC_VoIP_GetSamples( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ uint16_t nSamplesPerChannel, /* i : number of samples per channel requested to be written to output buffer */ int16_t *pcmBuf, /* i/o: buffer for decoded PCM output. The memory must already be allocated and be able to hold the expected number of output samples, based on frame size and number of output channels */ - const uint32_t systemTimestamp_ms /* i : current system timestamp */ - , + const uint32_t systemTimestamp_ms, /* i : current system timestamp */ uint16_t *sampleAvailableNext /* o : samples available for the next call */ #ifdef SUPPORT_JBM_TRACEFILE , JbmTraceFileWriterFn jbmWriterFn, @@ -371,8 +370,7 @@ ivas_error IVAS_DEC_GetPcmFrameSize( /*! r: true if decoder has no data in VoIP jitter buffer */ bool IVAS_DEC_VoIP_IsEmpty( - IVAS_DEC_HANDLE hIvasDec /* i/o: IVAS decoder handle */ - , + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ const int16_t nSamplesAsked ); diff --git a/lib_dec/lsf_dec.c b/lib_dec/lsf_dec.c index 73f8933daff76c16e4c0117877280bd95a8be8d7..9db7119aa22d1ce5d4258a9f5f3c277b66e41517 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/bw_detect.c b/lib_enc/bw_detect.c index 6de35a211a50ba5e2461bb2f42041346828d5e30..2e315608b39c46180d9f467efcdc242bdd8afd75 100644 --- a/lib_enc/bw_detect.c +++ b/lib_enc/bw_detect.c @@ -71,9 +71,8 @@ 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 */ ) { int16_t i, j, k, bw_max, bin_width, n_bins; diff --git a/lib_enc/ivas_dirac_enc.c b/lib_enc/ivas_dirac_enc.c index 70cbbb2043af91c5de00bbb2a694923adb9fde7b..1a25541d313e2caf29de099c1b5e3c83fb594dee 100644 --- a/lib_enc/ivas_dirac_enc.c +++ b/lib_enc/ivas_dirac_enc.c @@ -402,9 +402,8 @@ 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 */ const IVAS_FORMAT ivas_format, /* i : ivas_format */ - int16_t ref_power_w /* i : use 0 if hodirac is enabled */ - , - const int16_t nchan_ana /* i : number of analysis channels */ + int16_t ref_power_w, /* i : use 0 if hodirac is enabled */ + const int16_t nchan_ana /* i : number of analysis channels */ ) { int16_t brange[2]; @@ -540,10 +539,9 @@ void ivas_dirac_param_est_enc( { if ( hDirAC->hFbMixer ) { - ivas_fb_mixer_get_windowed_fr( hDirAC->hFbMixer, pcm_in, p_Cldfb_RealBuffer, p_Cldfb_ImagBuffer, l_ts, l_ts, - hDirAC->hFbMixer->fb_cfg->num_in_chans ); - ivas_fb_mixer_update_prior_input( hDirAC->hFbMixer, pcm_in, l_ts, - hDirAC->hFbMixer->fb_cfg->num_in_chans ); + ivas_fb_mixer_get_windowed_fr( hDirAC->hFbMixer, pcm_in, p_Cldfb_RealBuffer, p_Cldfb_ImagBuffer, l_ts, l_ts, hDirAC->hFbMixer->fb_cfg->num_in_chans ); + + ivas_fb_mixer_update_prior_input( hDirAC->hFbMixer, pcm_in, l_ts, hDirAC->hFbMixer->fb_cfg->num_in_chans ); for ( i = 0; i < nchan_fb_in; i++ ) { diff --git a/lib_enc/ivas_enc_cov_handler.c b/lib_enc/ivas_enc_cov_handler.c index b40b9d1e42df198f27786ef1685aeb2458ab6cdd..14920e4ac19a4b96e9b7897d6a044fd364b2eb09 100644 --- a/lib_enc/ivas_enc_cov_handler.c +++ b/lib_enc/ivas_enc_cov_handler.c @@ -66,10 +66,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 */ - , - COV_SMOOTHING_TYPE smooth_mode, /* i : Smooth covariance for SPAR or MC */ - const int32_t ivas_total_brate /* i : IVAS total bitrate */ + 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 */ ) { ivas_enc_cov_handler_state_t *hCovState; diff --git a/lib_enc/ivas_ism_param_enc.c b/lib_enc/ivas_ism_param_enc.c index 572a0f1802936a966eba0bfbfa7edded5e88fabc..7565bdcae65d7564ef52e3e905002a8635706d65 100644 --- a/lib_enc/ivas_ism_param_enc.c +++ b/lib_enc/ivas_ism_param_enc.c @@ -299,8 +299,7 @@ ivas_error ivas_param_ism_enc_open( /* set FB config. */ - if ( ( error = ivas_fb_set_cfg( &fb_cfg, ISM_FORMAT, st_ivas->hEncoderConfig->nchan_inp, 0, 0, input_Fs, - 0 ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_fb_set_cfg( &fb_cfg, ISM_FORMAT, st_ivas->hEncoderConfig->nchan_inp, 0, 0, input_Fs, 0 ) ) != IVAS_ERR_OK ) { return error; } @@ -410,11 +409,9 @@ void ivas_param_ism_enc( for ( ts = 0; ts < num_time_slots; ts++ ) { - ivas_fb_mixer_get_windowed_fr( hDirAC->hFbMixer, pcm_in, p_fb_RealBuffer, p_fb_ImagBuffer, l_ts, l_ts, - hDirAC->hFbMixer->fb_cfg->num_in_chans ); + ivas_fb_mixer_get_windowed_fr( hDirAC->hFbMixer, pcm_in, p_fb_RealBuffer, p_fb_ImagBuffer, l_ts, l_ts, hDirAC->hFbMixer->fb_cfg->num_in_chans ); - ivas_fb_mixer_update_prior_input( hDirAC->hFbMixer, pcm_in, l_ts, - hDirAC->hFbMixer->fb_cfg->num_in_chans ); + ivas_fb_mixer_update_prior_input( hDirAC->hFbMixer, pcm_in, l_ts, hDirAC->hFbMixer->fb_cfg->num_in_chans ); for ( i = 0; i < nchan_ism; i++ ) { diff --git a/lib_enc/ivas_mc_param_enc.c b/lib_enc/ivas_mc_param_enc.c index 2af0ee3c0420d84d75fe8de58de6e864ea1885d7..ba2b88648331347876bfcef766813deb7c8b345d 100644 --- a/lib_enc/ivas_mc_param_enc.c +++ b/lib_enc/ivas_mc_param_enc.c @@ -140,8 +140,7 @@ ivas_error ivas_param_mc_enc_open( hParamMC->dmx_factors = ivas_param_mc_conf[config_index].dmx_fac; /* set FB config. */ - if ( ( error = ivas_fb_set_cfg( &fb_cfg, MC_FORMAT, nchan_inp, 0, 0, input_Fs, - 0 ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_fb_set_cfg( &fb_cfg, MC_FORMAT, nchan_inp, 0, 0, input_Fs, 0 ) ) != IVAS_ERR_OK ) { return error; } @@ -684,10 +683,9 @@ static void ivas_param_mc_param_est_enc( for ( ts = start_ts; ts < num_time_slots; ts++ ) { - ivas_fb_mixer_get_windowed_fr( hParamMC->hFbMixer, pcm_in, p_slot_frame_f_real, p_slot_frame_f_imag, l_ts, l_ts, - hParamMC->hFbMixer->fb_cfg->num_in_chans ); - ivas_fb_mixer_update_prior_input( hParamMC->hFbMixer, pcm_in, l_ts, - hParamMC->hFbMixer->fb_cfg->num_in_chans ); + ivas_fb_mixer_get_windowed_fr( hParamMC->hFbMixer, pcm_in, p_slot_frame_f_real, p_slot_frame_f_imag, l_ts, l_ts, hParamMC->hFbMixer->fb_cfg->num_in_chans ); + + ivas_fb_mixer_update_prior_input( hParamMC->hFbMixer, pcm_in, l_ts, hParamMC->hFbMixer->fb_cfg->num_in_chans ); for ( i = 0; i < nchan_input; i++ ) { diff --git a/lib_enc/ivas_mc_paramupmix_enc.c b/lib_enc/ivas_mc_paramupmix_enc.c index 500065c34700ac23892a774400d17a7542595352..35439bc02bcc53f287ee788c7f9dd3f05c388af8 100644 --- a/lib_enc/ivas_mc_paramupmix_enc.c +++ b/lib_enc/ivas_mc_paramupmix_enc.c @@ -184,8 +184,7 @@ ivas_error ivas_mc_paramupmix_enc_open( /* set FB config. */ /* need to set num output channels to a value > 0 to get pFb != NULL */ - if ( ( error = ivas_fb_set_cfg( &fb_cfg, MC_FORMAT, MC_PARAMUPMIX_COMBINATIONS * MC_PARAMUPMIX_NCH, MC_PARAMUPMIX_COMBINATIONS, 0, input_Fs, - 0 ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_fb_set_cfg( &fb_cfg, MC_FORMAT, MC_PARAMUPMIX_COMBINATIONS * MC_PARAMUPMIX_NCH, MC_PARAMUPMIX_COMBINATIONS, 0, input_Fs, 0 ) ) != IVAS_ERR_OK ) { return error; } @@ -730,11 +729,9 @@ 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; int16_t maxbands; - 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 }; @@ -751,6 +748,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 ); @@ -776,10 +774,10 @@ static void ivas_mc_paramupmix_param_est_enc( l_ts = input_frame / MAX_PARAM_SPATIAL_SUBFRAMES; for ( ts = 0; ts < MAX_PARAM_SPATIAL_SUBFRAMES; ts++ ) { - 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 ); + 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; @@ -791,14 +789,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++ ) @@ -807,6 +808,7 @@ 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 ); } maxbands = hMCParamUpmix->hFbMixer->pFb->filterbank_num_bands; @@ -838,5 +840,6 @@ static void ivas_mc_paramupmix_param_est_enc( } } } + return; } diff --git a/lib_enc/ivas_mcmasa_enc.c b/lib_enc/ivas_mcmasa_enc.c index 398b975705a723147f4d09a82d6e1562de7d973a..3bafe7ceab7853045570c7e71880158740cdfc36 100644 --- a/lib_enc/ivas_mcmasa_enc.c +++ b/lib_enc/ivas_mcmasa_enc.c @@ -188,8 +188,7 @@ ivas_error ivas_mcmasa_enc_open( } /* set FB config. */ - if ( ( error = ivas_fb_set_cfg( &fb_cfg, MASA_FORMAT, numAnalysisChannels, 0, 0, input_Fs, - 0 ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_fb_set_cfg( &fb_cfg, MASA_FORMAT, numAnalysisChannels, 0, 0, input_Fs, 0 ) ) != IVAS_ERR_OK ) { return error; } @@ -220,8 +219,7 @@ ivas_error ivas_mcmasa_enc_open( else { /* Allocate and initialize FB mixer handle for LFE channel */ - if ( ( error = ivas_fb_set_cfg( &fb_cfgLfe, MASA_FORMAT, 1, 0, 0, input_Fs, - 0 ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_fb_set_cfg( &fb_cfgLfe, MASA_FORMAT, 1, 0, 0, input_Fs, 0 ) ) != IVAS_ERR_OK ) { return error; } @@ -833,14 +831,15 @@ void ivas_mcmasa_param_est_enc( for ( ts = mrange[0]; ts < mrange[1]; ts++ ) { - ivas_fb_mixer_get_windowed_fr( hMcMasa->hFbMixer, pcm_in, p_Chnl_RealBuffer, p_Chnl_ImagBuffer, l_ts, l_ts, - hMcMasa->hFbMixer->fb_cfg->num_in_chans ); - ivas_fb_mixer_update_prior_input( hMcMasa->hFbMixer, pcm_in, l_ts, - hMcMasa->hFbMixer->fb_cfg->num_in_chans ); + ivas_fb_mixer_get_windowed_fr( hMcMasa->hFbMixer, pcm_in, p_Chnl_RealBuffer, p_Chnl_ImagBuffer, l_ts, l_ts, hMcMasa->hFbMixer->fb_cfg->num_in_chans ); + + ivas_fb_mixer_update_prior_input( hMcMasa->hFbMixer, pcm_in, l_ts, hMcMasa->hFbMixer->fb_cfg->num_in_chans ); + for ( i = 0; i < numAnalysisChannels; i++ ) { pcm_in[i] += l_ts; } + /* Compute covariance matrix */ for ( i = 0; i < num_freq_bands; i++ ) { @@ -870,6 +869,7 @@ void ivas_mcmasa_param_est_enc( } } } + /* Compute standard FOA */ /* W */ v_add( Chnl_RealBuffer[0], Chnl_RealBuffer[1], Foa_RealBuffer[0], num_freq_bins ); @@ -1708,10 +1708,10 @@ static void computeLfeEnergy( for ( ts = mrange[0]; ts < mrange[1]; ts++ ) { - ivas_fb_mixer_get_windowed_fr( hMcMasa->hFbMixerLfe, pcm_in, p_Chnl_RealBuffer, p_Chnl_ImagBuffer, l_ts, l_ts, - hMcMasa->hFbMixerLfe->fb_cfg->num_in_chans ); - ivas_fb_mixer_update_prior_input( hMcMasa->hFbMixerLfe, pcm_in, l_ts, - hMcMasa->hFbMixerLfe->fb_cfg->num_in_chans ); + ivas_fb_mixer_get_windowed_fr( hMcMasa->hFbMixerLfe, pcm_in, p_Chnl_RealBuffer, p_Chnl_ImagBuffer, l_ts, l_ts, hMcMasa->hFbMixerLfe->fb_cfg->num_in_chans ); + + ivas_fb_mixer_update_prior_input( hMcMasa->hFbMixerLfe, pcm_in, l_ts, hMcMasa->hFbMixerLfe->fb_cfg->num_in_chans ); + pcm_in[0] += l_ts; /* Compute low frequency energy for LFE, for other channels it is computed in ivas_chnl_param_est_enc() */ diff --git a/lib_enc/ivas_mct_enc.c b/lib_enc/ivas_mct_enc.c index 20f5c9da291cd3ebc3795b1a27e75c6483a2ade3..3daae0a87744351bcc3e06438794118eb8f1b980 100644 --- a/lib_enc/ivas_mct_enc.c +++ b/lib_enc/ivas_mct_enc.c @@ -60,7 +60,7 @@ static ivas_error ivas_mc_enc_reconfig( Encoder_Struct *st_ivas, const int16_t l static void set_mct_enc_params( MCT_ENC_HANDLE hMCT, /* i/o: MCT encoder structure */ const int32_t ivas_total_brate, /* i : IVAS total bitrate */ - const IVAS_FORMAT ivas_format, /* i : IVAS_FORMAT */ + const IVAS_FORMAT ivas_format, /* i : IVAS_format */ const uint16_t b_nchan_change /* i : flag indicating different channel count */ ) { @@ -101,6 +101,7 @@ static void set_mct_enc_params( * cpe_id 1: L=data[4] R=data[5] * cpe_id 2: L=data[2] (mid) R=NULL *-------------------------------------------------------------------*/ + static void map_input_to_cpe_channels( const Encoder_Struct *st_ivas, /* i/o: IVAS encoder structure */ float *pdata[MAX_INPUT_CHANNELS], /* o: mapped input pointers */ @@ -142,6 +143,8 @@ static void map_input_to_cpe_channels( return; } + + /*-------------------------------------------------------------------* * ivas_mct_enc() * @@ -233,11 +236,7 @@ ivas_error ivas_mct_enc( } /* joint MCT encoding */ - ivas_mct_core_enc( ivas_format, hMCT, st_ivas->hCPE, - hMCT->nchan_out_woLFE, - ivas_total_brate, switch_bw, - ( ivas_format == MC_FORMAT && ( st_ivas->mc_mode == MC_MODE_MCT || st_ivas->mc_mode == MC_MODE_PARAMUPMIX ) ) ? (int16_t) st_ivas->hLFE->lfe_bits : 0, - st_ivas->hEncoderConfig->sba_order ); + ivas_mct_core_enc( ivas_format, hMCT, st_ivas->hCPE, hMCT->nchan_out_woLFE, ivas_total_brate, switch_bw, ( ivas_format == MC_FORMAT && ( st_ivas->mc_mode == MC_MODE_MCT || st_ivas->mc_mode == MC_MODE_PARAMUPMIX ) ) ? (int16_t) st_ivas->hLFE->lfe_bits : 0, st_ivas->hEncoderConfig->sba_order ); /* Spectrum quantization and coding */ for ( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) @@ -250,8 +249,7 @@ ivas_error ivas_mct_enc( hCPE->hCoreCoder[0]->hBstr->ind_list = st_ivas->hCPE[cpe_id - 1]->hCoreCoder[1]->hBstr->ind_list + st_ivas->hCPE[cpe_id - 1]->hCoreCoder[1]->hBstr->nb_ind_tot; } #endif - ivas_mdct_quant_coder( hCPE, - hMCT->tnsBits[cpe_id], hMCT->tnsSize[cpe_id], hMCT->p_param[cpe_id], 1 ); + ivas_mdct_quant_coder( hCPE, hMCT->tnsBits[cpe_id], hMCT->tnsSize[cpe_id], hMCT->p_param[cpe_id], 1 ); /* update input samples buffer (as done in ivas_cpe_enc() for other than MCT coding) */ for ( n = 0; n < CPE_CHANNELS; n++ ) @@ -343,8 +341,7 @@ ivas_error create_mct_enc( } /* in case we have an uneven number of transport channels, indicate last channel ID as inactive */ - if ( ( hMCT->nchan_out_woLFE ) % - 2 ) + if ( ( hMCT->nchan_out_woLFE ) % 2 ) { st_ivas->hCPE[st_ivas->nCPE - 1]->hCoreCoder[1]->mct_chan_mode = MCT_CHAN_MODE_IGNORE; } @@ -354,7 +351,6 @@ ivas_error create_mct_enc( for ( n = 0; n < max_blocks; n++ ) { - assert( st_ivas->hEncoderConfig->element_mode_init == IVAS_CPE_MDCT && "MCT is not supported for other stereo modes" ); if ( ( hMCT->hBlockData[n] = (MCT_BLOCK_DATA_HANDLE) malloc( sizeof( MCT_BLOCK_DATA ) ) ) == NULL ) diff --git a/lib_enc/ivas_qmetadata_enc.c b/lib_enc/ivas_qmetadata_enc.c index 26f46e943fa54bc7677b9710a2cbab20cc5cd9f9..ad34d810c1095289938c5836b8d6f03cbc54696a 100644 --- a/lib_enc/ivas_qmetadata_enc.c +++ b/lib_enc/ivas_qmetadata_enc.c @@ -138,10 +138,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; @@ -4731,11 +4730,10 @@ static int16_t coherence_coding_length( /*! r: number of bits written */ static int16_t encode_spread_coherence_1sf( - IVAS_QMETADATA *q_metadata, /* i : quantized metadata */ - const int16_t idx_d, /* i : current direction index */ - BSTR_ENC_HANDLE hMasaMetaData /* i/o: metadata bitstream handle */ - , - const int16_t hrmasa_flag /* i : flag indicating high-rate MASA MD coding */ + IVAS_QMETADATA *q_metadata, /* i : quantized metadata */ + const int16_t idx_d, /* i : current direction index */ + BSTR_ENC_HANDLE hMasaMetaData, /* i/o: metadata bitstream handle */ + const int16_t hrmasa_flag /* i : flag indicating high-rate MASA MD coding */ ) { int16_t i, j, k; @@ -5333,16 +5331,15 @@ static int16_t encode_surround_coherence_hr( /*! r: quantized value */ static float quantize_DCT_0_coh( - const float x, /* i : input value */ - const int16_t j, /* i : subband index */ - const float *coherence_cb, /* i : coherence codebook */ - const float delta_var, /* i : azimuth variance threshold */ - const int16_t no_cb, /* i : maximum number of codewords */ - IVAS_QDIRECTION *q_direction, /* i : quantized metadata */ - uint16_t *idx_x, /* o : codewords index */ - int16_t *p_no_cb /* o : actual number of codewords dependent on energy ratio value */ - , - const int16_t hrmasa_flag /* i : flag indicating high-rate MASA MD coding */ + const float x, /* i : input value */ + const int16_t j, /* i : subband index */ + const float *coherence_cb, /* i : coherence codebook */ + const float delta_var, /* i : azimuth variance threshold */ + const int16_t no_cb, /* i : maximum number of codewords */ + IVAS_QDIRECTION *q_direction, /* i : quantized metadata */ + uint16_t *idx_x, /* o : codewords index */ + int16_t *p_no_cb, /* o : actual number of codewords dependent on energy ratio value */ + const int16_t hrmasa_flag /* i : flag indicating high-rate MASA MD coding */ ) { float var_azi, xhat; diff --git a/lib_enc/ivas_spar_encoder.c b/lib_enc/ivas_spar_encoder.c index c5be41e0609caaebfae8b724b1dada3f6b6a4545..7ba08e84f0eac7fdd063138f3736cc888b939437 100644 --- a/lib_enc/ivas_spar_encoder.c +++ b/lib_enc/ivas_spar_encoder.c @@ -87,8 +87,7 @@ ivas_error ivas_spar_enc_open( hSpar->spar_reconfig_flag = 0; input_Fs = hEncoderConfig->input_Fs; sba_order_internal = min( st_ivas->sba_analysis_order, IVAS_MAX_SBA_ORDER ); - nchan_inp = ivas_sba_get_nchan_metadata( sba_order_internal, - hEncoderConfig->ivas_total_brate ); + nchan_inp = ivas_sba_get_nchan_metadata( sba_order_internal, hEncoderConfig->ivas_total_brate ); assert( nchan_inp <= hEncoderConfig->nchan_inp ); ivas_total_brate = hEncoderConfig->ivas_total_brate; @@ -124,8 +123,10 @@ ivas_error ivas_spar_enc_open( /* set FB config. */ active_w_mixing = ivas_spar_br_table_consts[table_idx].active_w; - ivas_fb_set_cfg( &fb_cfg, SBA_FORMAT, nchan_inp, nchan_transport, active_w_mixing, input_Fs, - nchan_fb_in ); + if ( ( error = ivas_fb_set_cfg( &fb_cfg, SBA_FORMAT, nchan_inp, nchan_transport, active_w_mixing, input_Fs, nchan_fb_in ) ) != IVAS_ERR_OK ) + { + return error; + } fb_cfg->remix_order = remix_order_set[hSpar->hMdEnc->spar_md_cfg.remix_unmix_order]; /* FB mixer handle */ @@ -446,10 +447,12 @@ static ivas_error ivas_spar_enc_process( *-----------------------------------------------------------------------------------------*/ ivas_transient_det_process( hSpar->hTranDet, data_f[0], input_frame, transient_det ); + if ( ivas_total_brate < IVAS_24k4 ) { transient_det[1] = 0; } + /* store previous input samples for W in local buffer */ assert( num_del_samples <= IVAS_FB_1MS_48K_SAMP ); if ( hSpar->hFbMixer->fb_cfg->active_w_mixing == 0 ) @@ -472,8 +475,7 @@ static ivas_error ivas_spar_enc_process( } /* run Filter Bank overlapping MDFT analysis first, then we can use the temporary buffer for Parameter MDFT analysis*/ - ivas_fb_mixer_pcm_ingest( hSpar->hFbMixer, data_f, p_pcm_tmp, input_frame, - hSpar->hMdEnc->HOA_md_ind ); + ivas_fb_mixer_pcm_ingest( hSpar->hFbMixer, data_f, p_pcm_tmp, input_frame, hSpar->hMdEnc->HOA_md_ind ); /* prepare Parameter MDFT analysis */ for ( i = 0; i < nchan_fb_in; i++ ) @@ -487,11 +489,9 @@ static ivas_error ivas_spar_enc_process( for ( ts = 0; ts < MAX_PARAM_SPATIAL_SUBFRAMES; ts++ ) { - ivas_fb_mixer_get_windowed_fr( hSpar->hFbMixer, p_pcm_tmp, ppIn_FR_real, ppIn_FR_imag, l_ts, l_ts, - nchan_fb_in ); + ivas_fb_mixer_get_windowed_fr( hSpar->hFbMixer, p_pcm_tmp, ppIn_FR_real, ppIn_FR_imag, l_ts, l_ts, nchan_fb_in ); - ivas_fb_mixer_update_prior_input( hSpar->hFbMixer, p_pcm_tmp, l_ts, - nchan_fb_in ); + ivas_fb_mixer_update_prior_input( hSpar->hFbMixer, p_pcm_tmp, l_ts, nchan_fb_in ); for ( i = 0; i < nchan_fb_in; i++ ) { @@ -518,6 +518,7 @@ static ivas_error ivas_spar_enc_process( hodirac_flag = ivas_get_hodirac_flag( ivas_total_brate, st_ivas->sba_analysis_order ); ivas_dirac_enc( st_ivas->hDirAC, hQMetaData, hMetaData, data_f, ppIn_FR_real, ppIn_FR_imag, input_frame, dtx_vad, hEncoderConfig->ivas_format, hodirac_flag ); + /*-----------------------------------------------------------------------------------------* * Set SPAR bitrates *-----------------------------------------------------------------------------------------*/ @@ -536,11 +537,7 @@ static ivas_error ivas_spar_enc_process( } else { - ivas_spar_set_bitrate_config( &hSpar->hMdEnc->spar_md_cfg, table_idx, - ( hSpar->hMdEnc->spar_hoa_md_flag ) ? IVAS_MAX_NUM_BANDS : SPAR_DIRAC_SPLIT_START_BAND, - hSpar->hMdEnc->spar_hoa_dirac2spar_md_flag, - 1, hEncoderConfig->Opt_PCA_ON, - hSpar->AGC_Enable ); + ivas_spar_set_bitrate_config( &hSpar->hMdEnc->spar_md_cfg, table_idx, ( hSpar->hMdEnc->spar_hoa_md_flag ) ? IVAS_MAX_NUM_BANDS : SPAR_DIRAC_SPLIT_START_BAND, hSpar->hMdEnc->spar_hoa_dirac2spar_md_flag, 1, hEncoderConfig->Opt_PCA_ON, hSpar->AGC_Enable ); } } @@ -557,19 +554,8 @@ static ivas_error ivas_spar_enc_process( } } - ivas_enc_cov_handler_process( - hSpar->hCovEnc, - ppIn_FR_real, - ppIn_FR_imag, - cov_real, - cov_dtx_real, - hSpar->hFbMixer->pFb, - 0, - hSpar->hFbMixer->pFb->filterbank_num_bands, - nchan_inp, - dtx_vad, - transient_det, - hSpar->hMdEnc->HOA_md_ind ); + ivas_enc_cov_handler_process( hSpar->hCovEnc, ppIn_FR_real, ppIn_FR_imag, cov_real, cov_dtx_real, hSpar->hFbMixer->pFb, 0, hSpar->hFbMixer->pFb->filterbank_num_bands, nchan_inp, dtx_vad, transient_det, hSpar->hMdEnc->HOA_md_ind ); + nchan_transport = st_ivas->nchan_transport; /*-----------------------------------------------------------------------------------------* @@ -578,9 +564,9 @@ static ivas_error ivas_spar_enc_process( if ( hSpar->hMdEnc->spar_hoa_md_flag == 0 ) { - ivas_spar_md_enc_process( hSpar->hMdEnc, hEncoderConfig, cov_real, cov_dtx_real, hMetaData, dtx_vad, nchan_inp, sba_order, - hSpar->hFbMixer->prior_mixer ); + ivas_spar_md_enc_process( hSpar->hMdEnc, hEncoderConfig, cov_real, cov_dtx_real, hMetaData, dtx_vad, nchan_inp, sba_order, hSpar->hFbMixer->prior_mixer ); } + if ( hSpar->hMdEnc->spar_hoa_dirac2spar_md_flag ) { float azi_dirac[IVAS_MAX_NUM_BANDS][MAX_PARAM_SPATIAL_SUBFRAMES]; @@ -621,15 +607,14 @@ static ivas_error ivas_spar_enc_process( Wscale_d[b] = min( 2.0f, max( Wscale_d[b], 1.0f ) ); } - ivas_get_spar_md_from_dirac( azi_dirac, ele_dirac, diffuseness, 1, hSpar->hMdEnc->mixer_mat, &hSpar->hMdEnc->spar_md, &hSpar->hMdEnc->spar_md_cfg, d_start_band, d_end_band, ( hSpar->hMdEnc->spar_hoa_md_flag ) ? 1 : sba_order, dtx_vad, Wscale_d, - hQMetaData->useLowerRes, active_w_vlbr ); + ivas_get_spar_md_from_dirac( azi_dirac, ele_dirac, diffuseness, 1, hSpar->hMdEnc->mixer_mat, &hSpar->hMdEnc->spar_md, &hSpar->hMdEnc->spar_md_cfg, d_start_band, d_end_band, ( hSpar->hMdEnc->spar_hoa_md_flag ) ? 1 : sba_order, dtx_vad, Wscale_d, hQMetaData->useLowerRes, active_w_vlbr ); } if ( hSpar->hMdEnc->spar_hoa_md_flag ) { - ivas_spar_md_enc_process( hSpar->hMdEnc, hEncoderConfig, cov_real, cov_dtx_real, hMetaData, dtx_vad, nchan_inp, sba_order, - hSpar->hFbMixer->prior_mixer ); + ivas_spar_md_enc_process( hSpar->hMdEnc, hEncoderConfig, cov_real, cov_dtx_real, hMetaData, dtx_vad, nchan_inp, sba_order, hSpar->hFbMixer->prior_mixer ); } + #ifdef DEBUG_LBR_SBA /* Dumping SPAR Coefficients */ char f_name[100]; @@ -758,6 +743,7 @@ static ivas_error ivas_spar_enc_process( v_add( data_f[idx], p_pcm_tmp[i] + num_del_samples, p_pcm_tmp[i] + num_del_samples, input_frame - num_del_samples ); } } + #if 0 /* SBA_TD_RESIDUAL */ { static FILE *fid = 0; @@ -797,6 +783,7 @@ static ivas_error ivas_spar_enc_process( push_next_indice( hMetaData, PCA_MODE_INACTIVE, 1 ); } } + #ifdef DEBUG_LBR_SBA for ( int t = 0; t < 960; t++ ) { diff --git a/lib_enc/ivas_spar_md_enc.c b/lib_enc/ivas_spar_md_enc.c index 47491f6a783ad08c836d56174660d5335f109aed..99134b2af3b2f4db0c637f7590fd1340dfefd24c 100644 --- a/lib_enc/ivas_spar_md_enc.c +++ b/lib_enc/ivas_spar_md_enc.c @@ -117,8 +117,7 @@ ivas_error ivas_spar_md_enc_open( return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR MD encoder" ); } - num_channels = ivas_sba_get_nchan_metadata( sba_order, - hEncoderConfig->ivas_total_brate ); + num_channels = ivas_sba_get_nchan_metadata( sba_order, hEncoderConfig->ivas_total_brate ); if ( ( hMdEnc->spar_md.band_coeffs = (ivas_band_coeffs_t *) malloc( IVAS_MAX_NUM_BANDS * sizeof( ivas_band_coeffs_t ) ) ) == NULL ) { @@ -563,8 +562,7 @@ ivas_error ivas_spar_md_enc_process( BSTR_ENC_HANDLE hMetaData, /* i/o: MetaData handle */ const int16_t dtx_vad, const int16_t nchan_inp, - const int16_t sba_order /* i : Ambisonic (SBA) order */ - , + const int16_t sba_order, /* i : Ambisonic (SBA) order */ float *prior_mixer[IVAS_MAX_FB_MIXER_OUT_CH][IVAS_MAX_SPAR_FB_MIXER_IN_CH] /* i : prior mixer_matrix */ ) { diff --git a/lib_enc/ivas_stereo_dft_enc_itd.c b/lib_enc/ivas_stereo_dft_enc_itd.c index 669a4a0a12932be3d2cf07544c965fd8d05f14f2..f8155600e4096dbf5d6ae799dfece244cd41daa0 100644 --- a/lib_enc/ivas_stereo_dft_enc_itd.c +++ b/lib_enc/ivas_stereo_dft_enc_itd.c @@ -114,9 +114,8 @@ static void set_band_limits( void stereo_dft_hybrid_ITD_flag( STEREO_DFT_CONFIG_DATA_HANDLE hConfig, /* o : DFT stereo configuration */ - const int32_t input_Fs /* i : CPE element sampling rate */ - , - const int16_t hybrid_itd_max /* i : flag for hybrid ITD for very large ITDs */ + const int32_t input_Fs, /* i : CPE element sampling rate */ + const int16_t hybrid_itd_max /* i : flag for hybrid ITD for very large ITDs */ ) { if ( hConfig != NULL ) diff --git a/lib_enc/lsf_enc.c b/lib_enc/lsf_enc.c index 66f8847608b989e47ec7068d02972d36203383db..968a9a0d25e555e7539cdb0ca0556f8abefcf9df 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 9c7bed762948c8b29da305cca7bd148f4f5adad1..47d9d83a8a3a022b20a31c4c32e8a7bdfcef4a31 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 */ ) { @@ -465,7 +470,7 @@ void msvq_enc( 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. */ + loop over c=0..m is hardcoded to c=0, since m=1. */ /* dist[0][0] */ for ( j = 0; j < levels[s]; j++ ) {