From acf9be8017709a621447ecda37e22c2a868f71c5 Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 21 Jun 2023 12:05:23 +0200 Subject: [PATCH 1/6] formatting --- lib_dec/ivas_cpe_dec.c | 5 +---- lib_dec/ivas_dec.c | 17 ++++------------- lib_dec/ivas_jbm_dec.c | 6 ++---- lib_enc/ivas_cpe_enc.c | 2 ++ 4 files changed, 9 insertions(+), 21 deletions(-) diff --git a/lib_dec/ivas_cpe_dec.c b/lib_dec/ivas_cpe_dec.c index a2683860df..9096843e9c 100644 --- a/lib_dec/ivas_cpe_dec.c +++ b/lib_dec/ivas_cpe_dec.c @@ -405,8 +405,7 @@ ivas_error ivas_cpe_dec( } else { - stereo_dft_dec( hCPE->hStereoDft, sts[0], DFT, hCPE->input_mem[1], hCPE->hStereoCng, 0, 0, 0, 0, 0, 0, - MAX_PARAM_SPATIAL_SUBFRAMES ); + stereo_dft_dec( hCPE->hStereoDft, sts[0], DFT, hCPE->input_mem[1], hCPE->hStereoCng, 0, 0, 0, 0, 0, 0, MAX_PARAM_SPATIAL_SUBFRAMES ); } /* synthesis iFFT */ @@ -829,7 +828,6 @@ void destroy_cpe_dec( int16_t n; Decoder_State *st; - for ( n = 0; n < CPE_CHANNELS; n++ ) { st = hCPE->hCoreCoder[n]; @@ -930,7 +928,6 @@ static void read_stereo_mode_and_bwidth( if ( st_ivas->bfi || st_ivas->hDecoderConfig->ivas_total_brate < IVAS_SID_5k2 ) { - hCPE->element_mode = hCPE->last_element_mode; } diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index fd0bf5b530..4bee6cb0c4 100644 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -261,15 +261,8 @@ ivas_error ivas_dec( } else if ( st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM ) { - if ( ( error = ivas_rend_crendProcess( st_ivas->hCrendWrapper, - AUDIO_CONFIG_7_1_4, - AUDIO_CONFIG_BINAURAL_ROOM_IR, - NULL, - NULL, - NULL, - NULL, - p_output, - output_Fs ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_rend_crendProcess( st_ivas->hCrendWrapper, AUDIO_CONFIG_7_1_4, AUDIO_CONFIG_BINAURAL_ROOM_IR, NULL, + NULL, NULL, NULL, p_output, output_Fs ) ) != IVAS_ERR_OK ) { return error; } @@ -481,8 +474,7 @@ ivas_error ivas_dec( if ( st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV || st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM ) { if ( ( error = ivas_rend_crendProcess( st_ivas->hCrendWrapper, st_ivas->intern_config, st_ivas->hOutSetup.output_config, st_ivas->hDecoderConfig, - st_ivas->hCombinedOrientationData, - &st_ivas->hIntSetup, st_ivas->hEFAPdata, p_output, output_Fs ) ) != IVAS_ERR_OK ) + st_ivas->hCombinedOrientationData, &st_ivas->hIntSetup, st_ivas->hEFAPdata, p_output, output_Fs ) ) != IVAS_ERR_OK ) { return error; } @@ -540,8 +532,7 @@ ivas_error ivas_dec( if ( st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV || st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM ) { if ( ( error = ivas_rend_crendProcess( st_ivas->hCrendWrapper, st_ivas->intern_config, st_ivas->hOutSetup.output_config, st_ivas->hDecoderConfig, - st_ivas->hCombinedOrientationData, - &st_ivas->hIntSetup, st_ivas->hEFAPdata, p_output, output_Fs ) ) != IVAS_ERR_OK ) + st_ivas->hCombinedOrientationData, &st_ivas->hIntSetup, st_ivas->hEFAPdata, p_output, output_Fs ) ) != IVAS_ERR_OK ) { return error; } diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index 5222104ee8..0e1e9690f1 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -811,8 +811,7 @@ ivas_error ivas_jbm_dec_render( /* Rendering */ if ( st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV || st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM ) { - if ( ( error = ivas_rend_crendProcessSubframe( st_ivas->hCrendWrapper, st_ivas->intern_config, st_ivas->hOutSetup.output_config, st_ivas->hDecoderConfig, - st_ivas->hCombinedOrientationData, + if ( ( error = ivas_rend_crendProcessSubframe( st_ivas->hCrendWrapper, st_ivas->intern_config, st_ivas->hOutSetup.output_config, st_ivas->hDecoderConfig, st_ivas->hCombinedOrientationData, &st_ivas->hIntSetup, st_ivas->hEFAPdata, st_ivas->hTcBuffer, p_tc, p_output, *nSamplesRendered, output_Fs ) ) != IVAS_ERR_OK ) { return error; @@ -1033,8 +1032,7 @@ ivas_error ivas_jbm_dec_flush_renderer( { if ( renderer_type_old == RENDERER_BINAURAL_MIXER_CONV || renderer_type_old == RENDERER_BINAURAL_MIXER_CONV_ROOM ) { - if ( ( error = ivas_rend_crendProcessSubframe( st_ivas->hCrendWrapper, intern_config_old, st_ivas->hOutSetup.output_config, st_ivas->hDecoderConfig, - st_ivas->hCombinedOrientationData, + if ( ( error = ivas_rend_crendProcessSubframe( st_ivas->hCrendWrapper, intern_config_old, st_ivas->hOutSetup.output_config, st_ivas->hDecoderConfig, st_ivas->hCombinedOrientationData, hIntSetupOld, st_ivas->hEFAPdata, st_ivas->hTcBuffer, hTcBuffer->tc, p_output, hTcBuffer->n_samples_granularity, st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) { return error; diff --git a/lib_enc/ivas_cpe_enc.c b/lib_enc/ivas_cpe_enc.c index f00e8187ce..ff8a4b479b 100644 --- a/lib_enc/ivas_cpe_enc.c +++ b/lib_enc/ivas_cpe_enc.c @@ -278,6 +278,7 @@ ivas_error ivas_cpe_enc( stereo_dft_config( hCPE->hStereoDft == NULL ? NULL : hCPE->hStereoDft->hConfig, hCPE->element_brate, &sts[0]->bits_frame_nominal, &sts[1]->bits_frame_nominal ); } } + if ( hCPE->element_mode == IVAS_CPE_TD ) { if ( hCPE->hStereoTD->tdm_LRTD_flag ) @@ -837,6 +838,7 @@ ivas_error create_cpe_enc( copy_encoder_config( st_ivas, st, 1 ); st->total_brate = hCPE->element_brate / ( st_ivas->nCPE > 1 ? 1 : CPE_CHANNELS ); /* dummy initialization for getting right pointers initialization of input buffers in init_coder_ace_plus() */ st->mct_chan_mode = MCT_CHAN_MODE_REGULAR; + if ( ( error = init_encoder( st, #ifdef IND_LIST_DYN st_ivas, -- GitLab From 071dac150b03e02a259870f9f28e691e889c9573 Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 21 Jun 2023 13:00:26 +0200 Subject: [PATCH 2/6] formatting + comments --- lib_com/ivas_prot.h | 88 ++++++++++++++++---------------- lib_com/options.h | 4 +- lib_dec/ivas_dec.c | 6 +-- lib_dec/ivas_dirac_dec.c | 4 +- lib_dec/ivas_jbm_dec.c | 5 +- lib_dec/ivas_mct_dec.c | 2 +- lib_dec/ivas_spar_decoder.c | 7 ++- lib_dec/ivas_spar_md_dec.c | 50 +++++++++++------- lib_dec/ivas_tcx_core_dec.c | 2 +- lib_enc/FEC_enc.c | 3 +- lib_enc/ivas_cpe_enc.c | 12 ++--- lib_enc/ivas_enc.c | 3 +- lib_enc/ivas_enc_cov_handler.c | 10 ++-- lib_enc/ivas_init_enc.c | 4 +- lib_enc/ivas_ism_enc.c | 9 ++-- lib_enc/ivas_mc_param_enc.c | 10 ++-- lib_enc/ivas_mc_paramupmix_enc.c | 8 +-- lib_enc/ivas_mct_enc.c | 2 +- lib_enc/ivas_sce_enc.c | 12 ++--- lib_enc/ivas_spar_encoder.c | 4 +- lib_enc/ivas_stereo_dmx_evs.c | 2 - lib_enc/lib_enc.c | 1 - lib_enc/lsf_enc.c | 7 +-- 23 files changed, 125 insertions(+), 130 deletions(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 34226e640c..035dfb517d 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -109,9 +109,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( @@ -3527,12 +3527,12 @@ void ivas_dirac_enc( IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: q_metadata handle */ BSTR_ENC_HANDLE hMetaData, /* i/o: Metadata bitstream handle */ float data_f[][L_FRAME48k], /* i/o: SBA channels */ - float **ppIn_FR_real, /* o : real freq domain values */ - float **ppIn_FR_imag, /* o : imag freq domain values */ - const int16_t input_frame, /* i : input frame length */ - const int16_t dtx_vad, /* i : DTX vad flag */ - const IVAS_FORMAT ivas_format, /* i : ivas format */ - int16_t hodirac_flag /* i : hodirac flag */ + float **ppIn_FR_real, /* o : real freq domain values */ + float **ppIn_FR_imag, /* o : imag freq domain values */ + const int16_t input_frame, /* i : input frame length */ + const int16_t dtx_vad, /* i : DTX vad flag */ + const IVAS_FORMAT ivas_format, /* i : ivas format */ + int16_t hodirac_flag /* i : hodirac flag */ ); ivas_error ivas_dirac_config( void *st_ivas, /* i/o: IVAS encoder/decoder state structure */ @@ -3772,8 +3772,8 @@ 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 */ - float *diffuseness_vector, /* i : diffuseness (needed for direction smoothing)*/ + const int16_t nbslots, /* i : number of slots to process */ + float *diffuseness_vector, /* i : diffuseness (needed for direction smoothing)*/ float *reference_power_smooth, float qualityBasedSmFactor ); @@ -3829,52 +3829,52 @@ void ivas_dirac_dec_get_frequency_axis( void calculate_hodirac_sector_parameters( DIRAC_ENC_HANDLE hDirAC, - float RealBuffer[DIRAC_MAX_ANA_CHANS][DIRAC_NO_FB_BANDS_MAX],/* i : signal vector (L+1)^2 x N_bins, real part */ - float ImagBuffer[DIRAC_MAX_ANA_CHANS][DIRAC_NO_FB_BANDS_MAX],/* i : signal vector, imaginary part */ - const float beta, /* i : forgetting factor for average filtering */ - const int16_t *band_grouping, /* i : indices of band groups */ - const int16_t N_bands, /* i : number of bands (groups) */ - const int16_t enc_param_start_band, /* i : first band to process */ - float *azi, /* o : array of sector azimuth angles, flat */ - float *ele, /* o : array of sector elevation angles, flat */ - float *diff, /* o : array of sector diffuseness values, flat */ - float *ene /* o : array of sector energy values, flat */ + float RealBuffer[DIRAC_MAX_ANA_CHANS][DIRAC_NO_FB_BANDS_MAX],/* i : signal vector (L+1)^2 x N_bins, real part */ + float ImagBuffer[DIRAC_MAX_ANA_CHANS][DIRAC_NO_FB_BANDS_MAX],/* i : signal vector, imaginary part */ + const float beta, /* i : forgetting factor for average filtering */ + const int16_t *band_grouping, /* i : indices of band groups */ + const int16_t N_bands, /* i : number of bands (groups) */ + const int16_t enc_param_start_band, /* i : first band to process */ + float *azi, /* o : array of sector azimuth angles, flat */ + float *ele, /* o : array of sector elevation angles, flat */ + float *diff, /* o : array of sector diffuseness values, flat */ + float *ene /* o : array of sector energy values, flat */ ); void ivas_mc_paramupmix_enc( - Encoder_Struct *st_ivas, /* i/o: IVAS Encoder handle */ - BSTR_ENC_HANDLE hMetaData, /* i/o: IVAS Metadata bitstream handle */ - float data_f[][L_FRAME48k], /* i/o: input: CICP6, CICP12, CICP14, CICP16 or CICP19 MC data */ - const int16_t input_frame /* i : input frame length */ + Encoder_Struct *st_ivas, /* i/o: IVAS Encoder handle */ + BSTR_ENC_HANDLE hMetaData, /* i/o: IVAS Metadata bitstream handle */ + float data_f[][L_FRAME48k], /* i/o: input: MC data */ + const int16_t input_frame /* i : input frame length */ ); ivas_error ivas_mc_paramupmix_enc_open( - Encoder_Struct *st_ivas /* i/o: IVAS encoder handle */ + Encoder_Struct *st_ivas /* i/o: IVAS encoder handle */ ); void ivas_mc_paramupmix_enc_close( - MC_PARAMUPMIX_ENC_HANDLE *hMCParamUpmix, /* i/o: MC Param-Upmix encoder handle */ + MC_PARAMUPMIX_ENC_HANDLE *hMCParamUpmix, /* i/o: MC Param-Upmix encoder handle */ const int32_t input_Fs /* i : input sampling rate */ ); void ivas_mc_paramupmix_dec( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ - float output_f[][L_FRAME48k] /* i/o: synthesized core-coder transport channels/DirAC output */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + float output_f[][L_FRAME48k] /* i/o: synthesized core-coder transport channels/DirAC output */ ); ivas_error ivas_mc_paramupmix_dec_open( - Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ + Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ); void ivas_mc_paramupmix_dec_close( - MC_PARAMUPMIX_DEC_HANDLE *hMCParamUpmix_out /* i/o: Parametric MC decoder handle */ + MC_PARAMUPMIX_DEC_HANDLE *hMCParamUpmix_out /* i/o: Parametric MC decoder handle */ ); void ivas_mc_paramupmix_dec_read_BS( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - Decoder_State *st, /* i/o: decoder state structure */ - MC_PARAMUPMIX_DEC_HANDLE hMCParamUpmix, /* i/o: decoder MC Param-Upmix handle */ - int16_t *nb_bits /* o : number of bits written */ + Decoder_State *st, /* i/o: decoder state structure */ + MC_PARAMUPMIX_DEC_HANDLE hMCParamUpmix, /* i/o: decoder MC Param-Upmix handle */ + int16_t *nb_bits /* o : number of bits written */ ); void ivas_param_mc_metadata_open( @@ -3921,7 +3921,7 @@ void ivas_param_mc_enc_close( void ivas_param_mc_enc( Encoder_Struct *st_ivas, /* i/o: IVAS Encoder handle */ BSTR_ENC_HANDLE hMetaData, /* i/o: IVAS Metadata bitstream handle */ - float data_f[][L_FRAME48k], /* i/o: input: CICP6, CICP12, CICP14, CICP16 or CICP19 MC data */ + float data_f[][L_FRAME48k], /* i/o: input: MC data */ const int16_t input_frame /* i : input frame length */ ); @@ -3947,7 +3947,7 @@ void ivas_param_mc_dec_read_BS( void ivas_param_mc_dec_digest_tc( Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ const uint8_t nCldfbSlots, /* i : number of CLFBS slots in the transport channels */ - float *transport_channels_f[] /* i : synthesized core-coder transport channels/DirAC output */ + float *transport_channels_f[] /* i : synthesized core-coder transport channels/DirAC output */ ); void ivas_param_mc_dec_render( @@ -4522,9 +4522,11 @@ void ivas_get_spar_md_from_dirac( const int16_t active_w_vlbr ); +/*! r: number of MD subframes */ int16_t ivas_get_spar_dec_md_num_subframes( const int16_t sba_order, /* i : Ambisonic (SBA) order */ - const int32_t ivas_total_brate ); + const int32_t ivas_total_brate /* i : IVAS total bitrate */ +); ivas_error ivas_spar_md_dec_open( ivas_spar_md_dec_state_t **hMdDec_out, /* i/o: SPAR MD decoder handle */ @@ -4567,7 +4569,7 @@ void ivas_spar_to_dirac( 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 bw /* i : band joining factor */ ); void ivas_spar_update_md_hist( @@ -4577,13 +4579,13 @@ 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_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_md_sub_frames /* i : number of metadata subframes */ ); void ivas_spar_dec_gen_umx_mat( @@ -4600,7 +4602,7 @@ ivas_error ivas_spar_covar_enc_open( ivas_filterbank_t *pFb, /* i/o: FB handle */ const int32_t input_Fs, /* i : input sampling rate */ const int16_t nchan_inp, /* i : number of input channels */ - COV_SMOOTHING_TYPE smooth_mode, /* i : Smooth covariance for SPAR or MC*/ + const COV_SMOOTHING_TYPE smooth_mode, /* i : Smooth covariance for SPAR or MC */ const int32_t ivas_total_brate /* i : IVAS total bitrate */ ); @@ -4661,7 +4663,7 @@ void ivas_transient_det_close( void ivas_transient_det_process( ivas_trans_det_state_t *hTranDet, /* i/o: SPAR TD handle */ float *pIn_pcm, /* i : input audio channels */ - const int16_t frame_len, /* i : frame length in samples */ + const int16_t frame_len, /* i : frame length in samples */ int16_t transient_det[2] /* o : transient det outputs */ ); @@ -5010,7 +5012,7 @@ ivas_error ivas_masa_enc_open( ); void ivas_masa_enc_close( - MASA_ENCODER_HANDLE *hMasa /* i/o: MASA metadata structure */ + MASA_ENCODER_HANDLE *hMasa /* i/o: MASA metadata structure */ ); void ivas_masa_enc_reconfigure( diff --git a/lib_com/options.h b/lib_com/options.h index 8ac9057763..af1ec74c1e 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -99,7 +99,7 @@ /*MCT Debug switches*/ /*#define DEBUG_FORCE_MCT_CP*/ /* force MCT Stereo pairs for verification with SPAR */ #ifdef DEBUG_FORCE_MCT_CP -/*#define DEBUG_SINGLE_CODE_OMNI*/ /* force 3 TC SBA always code W channel seperately */ +/*#define DEBUG_SINGLE_CODE_OMNI*/ /* force 3 TC SBA always code W channel separatelly */ #endif /*PLC Debug switches*/ @@ -125,7 +125,7 @@ #endif /*#define SPAR_HOA_DBG*/ /* SPAR HOA debug statements */ /*#define DEBUG_BINAURAL_FILTER_DESIGN*/ /* debugging of Crend binaural filter design */ -//#define DEBUG_AGC_ENCODER_CMD_OPTION /* Ability to force enable or disable AGC behaviour in DIRAC/SPAR via command line option */ +/*#define DEBUG_AGC_ENCODER_CMD_OPTION*/ /* Ability to force enable or disable AGC behaviour in DIRAC/SPAR via command line option */ #define DEBUG_JBM_CMD_OPTION /* ability for telling the decoder the frontend fetch size and to not delay compensate for bad frames at the beginning */ #define VARIABLE_SPEED_DECODING /* variable speed decoding employing the JBM functioniality; move to DEBUGGING after build for disabled is fixed */ diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index 7dcc667363..439a90fb2c 100644 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -108,8 +108,7 @@ ivas_error ivas_dec( * Combine orientations *----------------------------------------------------------------*/ - if ( ( error = combine_external_and_head_orientations_dec( st_ivas->hHeadTrackData, st_ivas->hExtOrientationData, - st_ivas->hCombinedOrientationData ) ) != IVAS_ERR_OK ) + if ( ( error = combine_external_and_head_orientations_dec( st_ivas->hHeadTrackData, st_ivas->hExtOrientationData, st_ivas->hCombinedOrientationData ) ) != IVAS_ERR_OK ) { return error; } @@ -266,6 +265,7 @@ ivas_error ivas_dec( { return error; } + ivas_binaural_add_LFE( st_ivas, output_frame, p_output, p_output ); } #ifdef DEBUGGING @@ -292,7 +292,6 @@ ivas_error ivas_dec( } else if ( st_ivas->ivas_format == SBA_FORMAT ) { - if ( ( error = ivas_spar_dec( st_ivas, nb_bits_metadata ) ) != IVAS_ERR_OK ) { return error; @@ -380,7 +379,6 @@ ivas_error ivas_dec( nchan_remapped = ivas_sba_remapTCs( output, st_ivas, output_frame ); if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) - { ivas_sba_mix_matrix_determiner( st_ivas->hSpar, output, st_ivas->bfi, nchan_remapped, output_frame ); } diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index fc24c8bdef..fde07ad130 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -421,7 +421,6 @@ ivas_error ivas_dirac_dec_config( return IVAS_ERR_OK; } - if ( nchan_transport_orig > 2 && hDirAC->hOutSetup.is_loudspeaker_setup && st_ivas->renderer_type == RENDERER_DIRAC #ifdef FIX_DIRAC_LS_SYNTHESIS_CONFIG && !hodirac_flag @@ -431,8 +430,7 @@ ivas_error ivas_dirac_dec_config( hDirAC->synthesisConf = DIRAC_SYNTHESIS_PSD_LS; hDirAC->panningConf = DIRAC_PANNING_VBAP; } - else if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || - st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC ) + else if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC ) { hDirAC->synthesisConf = DIRAC_SYNTHESIS_PSD_LS; hDirAC->panningConf = DIRAC_PANNING_VBAP; diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index 5303cb93f9..25c082d2bb 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -202,6 +202,7 @@ ivas_error ivas_jbm_dec_tc( { return error; } + #ifdef FIX_470_MASA_JBM_EXT if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_EXTERNAL ) { @@ -212,7 +213,6 @@ ivas_error ivas_jbm_dec_tc( } else if ( st_ivas->ivas_format == SBA_FORMAT ) { - if ( ( error = ivas_spar_dec( st_ivas, nb_bits_metadata ) ) != IVAS_ERR_OK ) { return error; @@ -328,6 +328,7 @@ ivas_error ivas_jbm_dec_tc( { st_ivas->hCPE[1]->hCoreCoder[1]->hTcxCfg = st_ivas->hCPE[1]->hCoreCoder[0]->hTcxCfg; } + ivas_lfe_dec( st_ivas->hLFE, st, output_frame, st_ivas->bfi, output_lfe_ch ); } @@ -348,6 +349,7 @@ ivas_error ivas_jbm_dec_tc( hp20( output[n], output_frame, st_ivas->mem_hp20_out[n], output_Fs ); } } + if ( st_ivas->transport_config != st_ivas->intern_config && ( st_ivas->intern_config == AUDIO_CONFIG_FOA || st_ivas->intern_config == AUDIO_CONFIG_HOA2 || st_ivas->intern_config == AUDIO_CONFIG_HOA3 ) ) { if ( ( st_ivas->hTransSetup.nchan_out_woLFE + st_ivas->hTransSetup.num_lfe ) <= ( st_ivas->hIntSetup.nchan_out_woLFE + st_ivas->hIntSetup.num_lfe ) ) @@ -355,6 +357,7 @@ ivas_error ivas_jbm_dec_tc( ivas_mc2sba( st_ivas->hTransSetup, p_output, p_output, output_frame, st_ivas->hIntSetup.ambisonics_order, GAIN_LFE ); } } + if ( ( st_ivas->renderer_type == RENDERER_MC || st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC ) && ( st_ivas->hTransSetup.nchan_out_woLFE + st_ivas->hTransSetup.num_lfe ) >= ( st_ivas->hOutSetup.nchan_out_woLFE + st_ivas->hOutSetup.num_lfe ) ) { if ( st_ivas->renderer_type == RENDERER_MC ) diff --git a/lib_dec/ivas_mct_dec.c b/lib_dec/ivas_mct_dec.c index 51d6856987..2024637abe 100755 --- a/lib_dec/ivas_mct_dec.c +++ b/lib_dec/ivas_mct_dec.c @@ -1057,7 +1057,7 @@ static ivas_error ivas_mc_dec_reconfig( /*-----------------------------------------------------------------* - * Allocate the LFE handle that is coded seperately after the allocation of the core coders + * Allocate the LFE handle that is coded separatelly after the allocation of the core coders *-----------------------------------------------------------------*/ if ( ( st_ivas->mc_mode == MC_MODE_MCT || st_ivas->mc_mode == MC_MODE_PARAMUPMIX ) && st_ivas->hLFE == NULL ) { diff --git a/lib_dec/ivas_spar_decoder.c b/lib_dec/ivas_spar_decoder.c index df60adb8c1..906a73b317 100755 --- a/lib_dec/ivas_spar_decoder.c +++ b/lib_dec/ivas_spar_decoder.c @@ -967,6 +967,7 @@ static void ivas_spar_get_skip_mat( break; } } + if ( skip_mat[out_ch][in_ch] == 1 ) { for ( i_ts = 0; i_ts < num_md_sub_frames; i_ts++ ) @@ -1014,6 +1015,7 @@ static void ivas_spar_calc_smooth_facs( { break; } + /* calculate band-wise subframe energies */ subframe_band_nrg[b] = 0.f; while ( b == bin2band->p_cldfb_map_to_spar_band[bin] ) @@ -1045,8 +1047,10 @@ static void ivas_spar_calc_smooth_facs( /* calculate smoothing factor based on energy averages */ /* reduce factor for higher short-term energy */ smooth_fac[b] = min( 1.f, smooth_long_avg[b] / smooth_short_avg[b] ); + /* map factor to range [0;1] */ smooth_fac[b] = max( 0.f, smooth_fac[b] - (float) SBA_DIRAC_NRG_SMOOTH_SHORT / SBA_DIRAC_NRG_SMOOTH_LONG ) * ( (float) SBA_DIRAC_NRG_SMOOTH_LONG / ( SBA_DIRAC_NRG_SMOOTH_LONG - SBA_DIRAC_NRG_SMOOTH_SHORT ) ); + /* compress factor (higher compression in lowest bands) */ if ( b < 2 ) { @@ -1361,6 +1365,7 @@ void ivas_spar_dec_upmixer( for ( subframe_idx = 0; subframe_idx < MAX_PARAM_SPATIAL_SUBFRAMES; subframe_idx++ ) { ivas_spar_dec_upmixer_sf( st_ivas, output_f_local, nchan_internal ); + for ( n = 0; n < nchan_out; n++ ) { output_f_local[n] += n_samples_sf; @@ -1493,7 +1498,6 @@ void ivas_spar_dec_upmixer_sf( hSpar->pca_ingest_channels = num_in_ingest; #endif - hSpar->hFbMixer->fb_cfg->num_in_chans = num_in_ingest; @@ -1526,7 +1530,6 @@ void ivas_spar_dec_upmixer_sf( } } - /*---------------------------------------------------------------------* * CLDFB Processing and Synthesis *---------------------------------------------------------------------*/ diff --git a/lib_dec/ivas_spar_md_dec.c b/lib_dec/ivas_spar_md_dec.c index 92e18c5c2c..993dd34c4e 100644 --- a/lib_dec/ivas_spar_md_dec.c +++ b/lib_dec/ivas_spar_md_dec.c @@ -96,7 +96,8 @@ 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_md_sub_frames ) + const int16_t num_md_sub_frames /* i : number of MD subframes */ +) { int16_t i, j; @@ -240,11 +241,21 @@ static ivas_error ivas_spar_md_dec_matrix_open( return IVAS_ERR_OK; } + +/*------------------------------------------------------------------------- + * ivas_get_spar_dec_md_num_subframes() + * + * return number of MD subframes + *------------------------------------------------------------------------*/ + +/*! r: number of MD subframes */ int16_t ivas_get_spar_dec_md_num_subframes( - 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 num_subframes; + num_subframes = MAX_PARAM_SPATIAL_SUBFRAMES; if ( sba_order > SBA_FOA_ORDER ) { @@ -253,9 +264,11 @@ int16_t ivas_get_spar_dec_md_num_subframes( num_subframes = 1; } } + return ( num_subframes ); } + /*------------------------------------------------------------------------- * ivas_spar_md_dec_open() * @@ -282,8 +295,8 @@ ivas_error ivas_spar_md_dec_open( } num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( sba_order, hDecoderConfig->ivas_total_brate ); - if ( ( error = ivas_spar_md_dec_matrix_open( hMdDec, num_channels, - num_md_sub_frames ) ) != IVAS_ERR_OK ) + + if ( ( error = ivas_spar_md_dec_matrix_open( hMdDec, num_channels, num_md_sub_frames ) ) != IVAS_ERR_OK ) { return error; } @@ -673,10 +686,8 @@ void ivas_spar_md_dec_process( num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( sba_order, st_ivas->hDecoderConfig->ivas_total_brate ); - ivas_spar_dec_parse_md_bs( hMdDec, st0, &nB, &bw, &dtx_vad, st_ivas->hDecoderConfig->ivas_total_brate, - ivas_spar_br_table_consts[hMdDec->table_idx].usePlanarCoeff, st_ivas->hQMetaData->sba_inactive_mode, - st_ivas->last_active_ivas_total_brate ); + ivas_spar_br_table_consts[hMdDec->table_idx].usePlanarCoeff, st_ivas->hQMetaData->sba_inactive_mode, st_ivas->last_active_ivas_total_brate ); #if 0 { @@ -950,6 +961,7 @@ void ivas_spar_md_dec_process( } }*/ #endif + /* expand DirAC MD to all time slots */ for ( i_ts = 1; i_ts < num_md_sub_frames; i_ts++ ) { @@ -1158,7 +1170,8 @@ void ivas_spar_setup_md_smoothing( *-----------------------------------------------------------------------------------------*/ void ivas_spar_update_md_hist( - ivas_spar_md_dec_state_t *hMdDec ) + ivas_spar_md_dec_state_t *hMdDec /* i/o: SPAR MD decoder handle */ +) { int16_t num_channels, i, j, k; @@ -1888,8 +1901,7 @@ static void ivas_spar_dec_parse_md_bs( if ( no_ec == 0 ) { - ivas_decode_arith_bs( hMdDec, st0, qsi, *nB, *bands_bw, do_diff, freq_diff, planarCP, - strat, ivas_total_brate ); + ivas_decode_arith_bs( hMdDec, st0, qsi, *nB, *bands_bw, do_diff, freq_diff, planarCP, strat, ivas_total_brate ); } else { @@ -2395,8 +2407,7 @@ static void ivas_decode_huffman_bs( for ( j = pred_offset; j < pred_dim; j++ ) { - ivas_huffman_decode( &hMdDec->huff_coeffs.pred_huff_re[qsi], st0, - &hMdDec->spar_md.band_coeffs_idx[i].pred_index_re[j] ); + ivas_huffman_decode( &hMdDec->huff_coeffs.pred_huff_re[qsi], st0, &hMdDec->spar_md.band_coeffs_idx[i].pred_index_re[j] ); } if ( hMdDec->spar_hoa_md_flag && hMdDec->spar_hoa_dirac2spar_md_flag ) @@ -2873,6 +2884,7 @@ void ivas_spar_to_dirac( int16_t *dirac_to_spar_md_bands; int16_t enc_param_start_band; int16_t active_w_vlbr; + int16_t i, num_subframes; sba_order_internal = min( st_ivas->sba_analysis_order, IVAS_MAX_SBA_ORDER ); start_band = 0; @@ -3045,7 +3057,6 @@ void ivas_spar_to_dirac( dirac_band_idx = dirac_to_spar_md_bands[band] - enc_param_start_band; - int16_t num_subframes; num_subframes = MAX_PARAM_SPATIAL_SUBFRAMES; if ( st_ivas->hQMetaData->useLowerRes ) { @@ -3068,8 +3079,8 @@ void ivas_spar_to_dirac( /* DirAC MD averaged over 4 subframes and converted to SPAR format similar to encoder processing */ if ( hMdDec->spar_md_cfg.nchan_transport > 1 ) { - ivas_get_spar_md_from_dirac( azi_dirac, ele_dirac, diffuseness, 1, NULL, &hMdDec->spar_md, &hMdDec->spar_md_cfg, end_band, num_bands_out, ( hMdDec->spar_hoa_md_flag ) ? 1 : sba_order_internal, dtx_vad, NULL, - st_ivas->hQMetaData->useLowerRes, active_w_vlbr ); + ivas_get_spar_md_from_dirac( azi_dirac, ele_dirac, diffuseness, 1, NULL, &hMdDec->spar_md, &hMdDec->spar_md_cfg, + end_band, num_bands_out, ( hMdDec->spar_hoa_md_flag ) ? 1 : sba_order_internal, dtx_vad, NULL, st_ivas->hQMetaData->useLowerRes, active_w_vlbr ); /* temporarily copy frame-wise prediction coefficients in DirAC bands*/ for ( pred_idx = 0; pred_idx < FOA_CHANNELS - 1; pred_idx++ ) @@ -3080,12 +3091,13 @@ void ivas_spar_to_dirac( } } } - int16_t num_subframes; + num_subframes = MAX_PARAM_SPATIAL_SUBFRAMES; if ( st_ivas->hQMetaData->useLowerRes ) { num_subframes = 1; } + ivas_get_spar_md_from_dirac( azi_dirac, ele_dirac, diffuseness, num_subframes, NULL, &hMdDec->spar_md, &hMdDec->spar_md_cfg, end_band, num_bands_out / bw, ( hMdDec->spar_hoa_md_flag ) ? 1 : sba_order_internal, dtx_vad, NULL, st_ivas->hQMetaData->useLowerRes, active_w_vlbr ); @@ -3095,11 +3107,11 @@ void ivas_spar_to_dirac( { for ( block = 1; block < MAX_PARAM_SPATIAL_SUBFRAMES; block++ ) { - for ( int16_t i = 0; i < FOA_CHANNELS - 1; i++ ) /* pred coefficient index (index 0, 1, 2 predicts Y, Z, X respectively) */ + for ( i = 0; i < FOA_CHANNELS - 1; i++ ) /* pred coefficient index (index 0, 1, 2 predicts Y, Z, X respectively) */ { hMdDec->spar_md.band_coeffs[band + block * IVAS_MAX_NUM_BANDS].pred_re[i] = hMdDec->spar_md.band_coeffs[band].pred_re[i]; } - for ( int16_t i = 0; i < FOA_CHANNELS - 1; i++ ) /* pred coefficient index (index 0, 1, 2 predicts Y, Z, X respectively) */ + for ( i = 0; i < FOA_CHANNELS - 1; i++ ) /* pred coefficient index (index 0, 1, 2 predicts Y, Z, X respectively) */ { hMdDec->spar_md.band_coeffs[band + block * IVAS_MAX_NUM_BANDS].P_re[i] = hMdDec->spar_md.band_coeffs[band].P_re[i]; } diff --git a/lib_dec/ivas_tcx_core_dec.c b/lib_dec/ivas_tcx_core_dec.c index b5b61c2f1c..f40b313125 100644 --- a/lib_dec/ivas_tcx_core_dec.c +++ b/lib_dec/ivas_tcx_core_dec.c @@ -569,7 +569,7 @@ void stereo_tcx_core_dec( /* note: the classifier needs the pitch only for tcx_only == 0, i.e. not for TCX10 */ set_f( pitch_C, floorf( st->old_fpitch + 0.5f ), 4 ); - /* note: codec_mode is foced to MODE2, since FEC_clas_estim() considers only TCX being in Mode2*/ + /* note: codec_mode is forced to MODE2, since FEC_clas_estim() considers only TCX being in Mode2*/ FEC_clas_estim( synth, pitch_C, st->L_frame, st->tcxonly ? GENERIC : st->core_ext_mode, MODE2, st->mem_syn_clas_estim, &st->clas_dec, &st->lp_ener_bfi, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, hTcxLtpDec->tcxltp ? hTcxDec->tcxltp_last_gain_unmodified : -1.0f, st->narrowBand, CLASSIFIER_TCX, bfi, st->preemph_fac, st->tcxonly, st->last_core_brate, -1 ); } } diff --git a/lib_enc/FEC_enc.c b/lib_enc/FEC_enc.c index 5bf8d1f1f4..9b753c97b8 100644 --- a/lib_enc/FEC_enc.c +++ b/lib_enc/FEC_enc.c @@ -133,8 +133,7 @@ void FEC_encode( { /* retrieve the last glottal pulse position of the previous frame */ /* use the current pitch information to scale or not the quantization */ - tmp_FER_pitch = (int16_t) ( fpit[0] ); /* take the 1st subframe pitch, since it is easier to retieve it on decoder side */ - + tmp_FER_pitch = (int16_t) ( fpit[0] ); /* take the 1st subframe pitch, since it is easier to retrieve it on decoder side */ sign = 0; maxi = *last_pulse_pos; diff --git a/lib_enc/ivas_cpe_enc.c b/lib_enc/ivas_cpe_enc.c index efc2de2612..3c1d7a61c6 100644 --- a/lib_enc/ivas_cpe_enc.c +++ b/lib_enc/ivas_cpe_enc.c @@ -432,11 +432,9 @@ ivas_error ivas_cpe_enc( for ( n = 0; n < n_CoreChannels; n++ ) { error = pre_proc_front_ivas( NULL, hCPE, hCPE->element_brate, nb_bits_metadata, input_frame, n, old_inp_12k8[n], old_inp_16k[n], - &ener[n], &relE[n], A[n], Aw[n], epsP[n], lsp_new[n], lsp_mid[n], - &vad_hover_flag[n], &attack_flag[n], realBuffer[n], imagBuffer[n], old_wsp[n], pitch_fr[n], voicing_fr[n], &loc_harm[n], &cor_map_sum[n], &vad_flag_dtx[n], enerBuffer[n], - fft_buff[n], A[0], lsp_new[0], currFlatness[n], tdm_ratio_idx, fr_bands, Etot_LR, lf_E, localVAD_HE_SAD, band_energies_LR, 0, st_ivas->hSpar != NULL ? st_ivas->hSpar->front_vad_flag : 0, 0, 0, - ivas_format, - ivas_total_brate ); + &ener[n], &relE[n], A[n], Aw[n], epsP[n], lsp_new[n], lsp_mid[n], &vad_hover_flag[n], &attack_flag[n], + realBuffer[n], imagBuffer[n], old_wsp[n], pitch_fr[n], voicing_fr[n], &loc_harm[n], &cor_map_sum[n], &vad_flag_dtx[n], enerBuffer[n], + fft_buff[n], A[0], lsp_new[0], currFlatness[n], tdm_ratio_idx, fr_bands, Etot_LR, lf_E, localVAD_HE_SAD, band_energies_LR, 0, st_ivas->hSpar != NULL ? st_ivas->hSpar->front_vad_flag : 0, 0, 0, ivas_format, ivas_total_brate ); if ( error != IVAS_ERR_OK ) { return error; @@ -832,9 +830,7 @@ ivas_error create_cpe_enc( st->total_brate = hCPE->element_brate / ( st_ivas->nCPE > 1 ? 1 : CPE_CHANNELS ); /* dummy initialization for getting right pointers initialization of input buffers in init_coder_ace_plus() */ st->mct_chan_mode = MCT_CHAN_MODE_REGULAR; - if ( ( error = init_encoder( st, - st_ivas, - n, hEncoderConfig->var_SID_rate_flag, hEncoderConfig->interval_SID, 0, st_ivas->ism_mode ) ) != IVAS_ERR_OK ) + if ( ( error = init_encoder( st, st_ivas, n, hEncoderConfig->var_SID_rate_flag, hEncoderConfig->interval_SID, 0, st_ivas->ism_mode ) ) != IVAS_ERR_OK ) { return error; } diff --git a/lib_enc/ivas_enc.c b/lib_enc/ivas_enc.c index 6a8debd0ce..04445a740f 100644 --- a/lib_enc/ivas_enc.c +++ b/lib_enc/ivas_enc.c @@ -136,7 +136,7 @@ ivas_error ivas_enc( { hp20( data_f[HOA_keep_ind[st_ivas->hSpar->hMdEnc->HOA_md_ind[i]]], input_frame, st_ivas->mem_hp20_in[i], input_Fs ); } - else if ( !( ivas_format == MC_FORMAT && i == LFE_CHANNEL ) ) /*TODO: is the HPF needed for LFE channel? */ + else if ( !( ivas_format == MC_FORMAT && i == LFE_CHANNEL ) ) { hp20( data_f[i], input_frame, st_ivas->mem_hp20_in[i], input_Fs ); } @@ -293,7 +293,6 @@ ivas_error ivas_enc( } else if ( st_ivas->mc_mode == MC_MODE_PARAMUPMIX ) { - /* encode MC ParamUpmix parameters and write bitstream */ ivas_mc_paramupmix_enc( st_ivas, hMetaData, data_f, input_frame ); diff --git a/lib_enc/ivas_enc_cov_handler.c b/lib_enc/ivas_enc_cov_handler.c index 14920e4ac1..fcf2efc6c2 100644 --- a/lib_enc/ivas_enc_cov_handler.c +++ b/lib_enc/ivas_enc_cov_handler.c @@ -63,11 +63,11 @@ static void ivas_band_cov( float **ppIn_FR_real, float **ppIn_FR_imag, const int *------------------------------------------------------------------------*/ 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 */ + ivas_enc_cov_handler_state_t **hCovEnc, /* i/o: SPAR Covar. encoder handle */ + ivas_filterbank_t *pFb, /* i/o: FB handle */ + const int32_t input_Fs, /* i : input sampling rate */ + const int16_t nchan_inp, /* i : number of input channels */ + const COV_SMOOTHING_TYPE smooth_mode, /* i : Smooth covariance for SPAR or MC*/ const int32_t ivas_total_brate /* i : IVAS total bitrate */ ) { diff --git a/lib_enc/ivas_init_enc.c b/lib_enc/ivas_init_enc.c index 270c8d5710..8e11e91228 100644 --- a/lib_enc/ivas_init_enc.c +++ b/lib_enc/ivas_init_enc.c @@ -477,8 +477,8 @@ ivas_error ivas_init_encoder( if ( ivas_format == SBA_FORMAT ) { - st_ivas->sba_analysis_order = ivas_sba_get_analysis_order( ivas_total_brate, st_ivas->hEncoderConfig->sba_order ); + if ( ( error = ivas_spar_enc_open( st_ivas, 0 ) ) != IVAS_ERR_OK ) { return error; @@ -492,6 +492,7 @@ ivas_error ivas_init_encoder( else { st_ivas->nchan_transport = hEncoderConfig->nchan_inp; + if ( ( error = ivas_masa_enc_open( st_ivas ) ) != IVAS_ERR_OK ) { return error; @@ -505,7 +506,6 @@ ivas_error ivas_init_encoder( return error; } - if ( ivas_format == SBA_FORMAT && st_ivas->hEncoderConfig->Opt_DTX_ON ) { st_ivas->hSCE[sce_id]->hCoreCoder[0]->dtx_sce_sba = 1; diff --git a/lib_enc/ivas_ism_enc.c b/lib_enc/ivas_ism_enc.c index 91ccdcbe0f..558455f017 100644 --- a/lib_enc/ivas_ism_enc.c +++ b/lib_enc/ivas_ism_enc.c @@ -160,12 +160,9 @@ ivas_error ivas_ism_enc( *----------------------------------------------------------------*/ error = pre_proc_front_ivas( hSCE, NULL, hSCE->element_brate, nb_bits_metadata[sce_id], input_frame, 0, old_inp_12k8[sce_id][0], old_inp_16k[sce_id][0], - &ener[sce_id][0], &relE[sce_id][0], A[sce_id][0], Aw[sce_id][0], epsP[sce_id][0], lsp_new[sce_id][0], lsp_mid[sce_id][0], - &vad_hover_flag[sce_id][0], &attack_flag[sce_id][0], realBuffer[sce_id][0], imagBuffer[sce_id][0], old_wsp[sce_id][0], pitch_fr[sce_id][0], voicing_fr[sce_id][0], &loc_harm[sce_id][0], &cor_map_sum[sce_id][0], &vad_flag_dtx[sce_id][0], enerBuffer[sce_id][0], - fft_buff[sce_id][0], A[sce_id][0], lsp_new[sce_id][0], currFlatness[0], 0, fr_bands, Etot_LR, lf_E, localVAD_HE_SAD, NULL, 0, 0, 0, 0, - ISM_FORMAT, - - st_ivas->hEncoderConfig->ivas_total_brate ); + &ener[sce_id][0], &relE[sce_id][0], A[sce_id][0], Aw[sce_id][0], epsP[sce_id][0], lsp_new[sce_id][0], lsp_mid[sce_id][0], &vad_hover_flag[sce_id][0], &attack_flag[sce_id][0], + realBuffer[sce_id][0], imagBuffer[sce_id][0], old_wsp[sce_id][0], pitch_fr[sce_id][0], voicing_fr[sce_id][0], &loc_harm[sce_id][0], &cor_map_sum[sce_id][0], &vad_flag_dtx[sce_id][0], enerBuffer[sce_id][0], + fft_buff[sce_id][0], A[sce_id][0], lsp_new[sce_id][0], currFlatness[0], 0, fr_bands, Etot_LR, lf_E, localVAD_HE_SAD, NULL, 0, 0, 0, 0, ISM_FORMAT, st_ivas->hEncoderConfig->ivas_total_brate ); if ( error != IVAS_ERR_OK ) { return error; diff --git a/lib_enc/ivas_mc_param_enc.c b/lib_enc/ivas_mc_param_enc.c index 715d3fe248..1d21b5c0a6 100644 --- a/lib_enc/ivas_mc_param_enc.c +++ b/lib_enc/ivas_mc_param_enc.c @@ -386,10 +386,10 @@ void ivas_param_mc_enc_close( *------------------------------------------------------------------------*/ void ivas_param_mc_enc( - Encoder_Struct *st_ivas, /* i/o: IVAS Encoder handle */ - BSTR_ENC_HANDLE hMetaData, /* i/o: IVAS Metadata bitstream handle */ - float data_f[][L_FRAME48k], /* i/o: input: CICP6, CICP12, CICP14, CICP16 or CICP19 MC data */ - const int16_t input_frame /* i : input frame length */ + Encoder_Struct *st_ivas, /* i/o: IVAS Encoder handle */ + BSTR_ENC_HANDLE hMetaData, /* i/o: IVAS Metadata bitstream handle */ + float data_f[][L_FRAME48k], /* i/o: input: MC data */ + const int16_t input_frame /* i : input frame length */ ) { int16_t k; @@ -1235,7 +1235,6 @@ static void ivas_param_mc_quantize_ilds( v_multc( Nrg, limit_fac, Nrg, num_ilds_to_code ); } - /* limit ILD jumps in non-tranient frames */ tot_ener = 0.0f; dmx_ener = 0.0f; @@ -1269,6 +1268,7 @@ static void ivas_param_mc_quantize_ilds( } hParamMC->ener_fac[freq_idx] = ener_fac; + #ifdef FIX_563_PARAMMC_LIMITER /* update also combined bands ener_fac when in transient frame */ if ( hParamMC->hMetadataPMC.bAttackPresent && ( ( freq_idx + 1 ) < hParamMC->hMetadataPMC.nbands_coded ) ) diff --git a/lib_enc/ivas_mc_paramupmix_enc.c b/lib_enc/ivas_mc_paramupmix_enc.c index f29b152838..5c50c3d6bd 100644 --- a/lib_enc/ivas_mc_paramupmix_enc.c +++ b/lib_enc/ivas_mc_paramupmix_enc.c @@ -79,10 +79,10 @@ static void quantize_pars( const int16_t nv, const float *v, const int16_t nq, c *------------------------------------------------------------------------*/ void ivas_mc_paramupmix_enc( - Encoder_Struct *st_ivas, /* i/o: IVAS Encoder handle */ - BSTR_ENC_HANDLE hBStr, /* i/o: IVAS Metadata bitstream handle */ - float data_f[][L_FRAME48k], /* i/o: input: CICP6, CICP12, CICP14, CICP16 or CICP19 MC data */ - const int16_t input_frame /* i : input frame length */ + Encoder_Struct *st_ivas, /* i/o: IVAS Encoder handle */ + BSTR_ENC_HANDLE hBStr, /* i/o: IVAS Metadata bitstream handle */ + float data_f[][L_FRAME48k], /* i/o: input: MC data */ + const int16_t input_frame /* i : input frame length */ ) { MC_PARAMUPMIX_ENC_HANDLE hMCParamUpmix; diff --git a/lib_enc/ivas_mct_enc.c b/lib_enc/ivas_mct_enc.c index 0f20a03768..4a00eb3d4d 100644 --- a/lib_enc/ivas_mct_enc.c +++ b/lib_enc/ivas_mct_enc.c @@ -224,7 +224,7 @@ ivas_error ivas_mct_enc( /* set coded audio band-width */ switch_bw = set_bw_mct( st_ivas->hCPE, st_ivas->nCPE ); - /*for MC and MCT remove pointer to LFE input that has been processed seperately */ + /*for MC and MCT remove pointer to LFE input that has been processed separatelly */ map_input_to_cpe_channels( st_ivas, pdata, data ); /* pre-processing */ diff --git a/lib_enc/ivas_sce_enc.c b/lib_enc/ivas_sce_enc.c index 0a16109e6a..97992ecb9f 100644 --- a/lib_enc/ivas_sce_enc.c +++ b/lib_enc/ivas_sce_enc.c @@ -181,12 +181,10 @@ ivas_error ivas_sce_enc( *----------------------------------------------------------------*/ error = pre_proc_front_ivas( hSCE, NULL, hSCE->element_brate, nb_bits_metadata, input_frame, 0, old_inp_12k8[0], old_inp_16k[0], - &ener[0], &relE[0], A[0], Aw[0], epsP[0], lsp_new[0], lsp_mid[0], - &vad_hover_flag[0], &attack_flag[0], realBuffer[0], imagBuffer[0], old_wsp[0], pitch_fr[0], voicing_fr[0], &loc_harm[0], &cor_map_sum[0], &vad_flag_dtx[0], enerBuffer[0], + &ener[0], &relE[0], A[0], Aw[0], epsP[0], lsp_new[0], lsp_mid[0], &vad_hover_flag[0], &attack_flag[0], + realBuffer[0], imagBuffer[0], old_wsp[0], pitch_fr[0], voicing_fr[0], &loc_harm[0], &cor_map_sum[0], &vad_flag_dtx[0], enerBuffer[0], fft_buff[0], A[0], lsp_new[0], currFlatness[0], 0, fr_bands, Etot_LR, lf_E, localVAD_HE_SAD, NULL, flag_16k_smc, - st_ivas->hSpar != NULL ? st_ivas->hSpar->front_vad_flag : 0, st_ivas->hSpar != NULL ? st_ivas->hSpar->force_front_vad : 0, st_ivas->hSpar != NULL ? st_ivas->hSpar->front_vad_dtx_flag : 0, - ivas_format, - st_ivas->hEncoderConfig->ivas_total_brate ); + st_ivas->hSpar != NULL ? st_ivas->hSpar->front_vad_flag : 0, st_ivas->hSpar != NULL ? st_ivas->hSpar->force_front_vad : 0, st_ivas->hSpar != NULL ? st_ivas->hSpar->front_vad_dtx_flag : 0, ivas_format, st_ivas->hEncoderConfig->ivas_total_brate ); if ( error != IVAS_ERR_OK ) { return error; @@ -339,9 +337,7 @@ ivas_error create_sce_enc( st->total_brate = hSCE->element_brate; /* dummy initialization for getting right pointers initialization of input buffers in init_coder_ace_plus() */ st->mct_chan_mode = MCT_CHAN_MODE_REGULAR; - if ( ( error = init_encoder( st, - st_ivas, - 0, st_ivas->hEncoderConfig->var_SID_rate_flag, st_ivas->hEncoderConfig->interval_SID, 0, st_ivas->ism_mode ) ) != IVAS_ERR_OK ) + if ( ( error = init_encoder( st, st_ivas, 0, st_ivas->hEncoderConfig->var_SID_rate_flag, st_ivas->hEncoderConfig->interval_SID, 0, st_ivas->ism_mode ) ) != IVAS_ERR_OK ) { return error; } diff --git a/lib_enc/ivas_spar_encoder.c b/lib_enc/ivas_spar_encoder.c index 444d613e29..5f382c4719 100644 --- a/lib_enc/ivas_spar_encoder.c +++ b/lib_enc/ivas_spar_encoder.c @@ -225,9 +225,7 @@ ivas_error ivas_spar_enc_open( hSpar->hCoreCoderVAD->total_brate = hEncoderConfig->ivas_total_brate; /* dummy initialization for getting right pointers initialization of input buffers in init_coder_ace_plus() */ hSpar->hCoreCoderVAD->mct_chan_mode = MCT_CHAN_MODE_IGNORE; - if ( ( error = init_encoder( hSpar->hCoreCoderVAD, - st_ivas, - 0, hEncoderConfig->var_SID_rate_flag, hEncoderConfig->interval_SID, 1, st_ivas->ism_mode ) ) != IVAS_ERR_OK ) + if ( ( error = init_encoder( hSpar->hCoreCoderVAD, st_ivas, 0, hEncoderConfig->var_SID_rate_flag, hEncoderConfig->interval_SID, 1, st_ivas->ism_mode ) ) != IVAS_ERR_OK ) { return error; } diff --git a/lib_enc/ivas_stereo_dmx_evs.c b/lib_enc/ivas_stereo_dmx_evs.c index 46014fded0..e2b1c09a34 100644 --- a/lib_enc/ivas_stereo_dmx_evs.c +++ b/lib_enc/ivas_stereo_dmx_evs.c @@ -1470,7 +1470,6 @@ ivas_error stereo_dmx_evs_init_encoder( hStereoDmxEVS->hPOC->confidence = 0.0f; - hStereoDmxEVS->hPHA = NULL; if ( ( hStereoDmxEVS->hPHA = (STEREO_DMX_EVS_PHA_HANDLE) malloc( sizeof( STEREO_DMX_EVS_PHA_DATA ) ) ) == NULL ) { @@ -1617,7 +1616,6 @@ ivas_error stereo_dmx_evs_init_encoder( hStereoDmxEVS->hPHA->trns_aux_energy[n] = 0.0f; } - *hStereoDmxEVS_out = hStereoDmxEVS; return IVAS_ERR_OK; diff --git a/lib_enc/lib_enc.c b/lib_enc/lib_enc.c index 58a010ff7e..18cfb9247d 100644 --- a/lib_enc/lib_enc.c +++ b/lib_enc/lib_enc.c @@ -904,7 +904,6 @@ static ivas_error configureEncoder( return error; } - if ( hEncoderConfig->ivas_format == MONO_FORMAT ) { hIvasEnc->hCoreCoder = st_ivas->hSCE[0]->hCoreCoder[0]; /* Note: this is needed for switching in EVS mono */ diff --git a/lib_enc/lsf_enc.c b/lib_enc/lsf_enc.c index 968a9a0d25..61a81ffec8 100644 --- a/lib_enc/lsf_enc.c +++ b/lib_enc/lsf_enc.c @@ -479,8 +479,7 @@ void lsf_end_enc( flag_1bit_gran = ( st->element_mode > EVS_MONO ); nBits = nBits_in; - if ( coder_type_org == GENERIC && st->sr_core == INT_FS_16k && st->codec_mode == MODE1 && ( st->idchan == 0 ) /* this bit is used only for primary channel or mono */ - ) + if ( coder_type_org == GENERIC && st->sr_core == INT_FS_16k && st->codec_mode == MODE1 && ( st->idchan == 0 ) /* this bit is used only for primary channel or mono */ ) { if ( coder_type_raw == VOICED ) { @@ -734,9 +733,7 @@ void lsf_end_enc( if ( st->codec_mode == MODE1 && st->core == ACELP_CORE ) { /* write coder_type bit for VOICED@16kHz or GENERIC@16kHz */ - if ( coder_type_org == GENERIC && st->sr_core == INT_FS_16k && st->idchan == 0 - - ) + if ( coder_type_org == GENERIC && st->sr_core == INT_FS_16k && st->idchan == 0 ) { /* VOICED =2 and GENERIC=3, so "coder_type-2" means VOICED =0 and GENERIC=1*/ push_indice( hBstr, IND_LSF_PREDICTOR_SELECT_BIT, coder_type - 2, 1 ); -- GitLab From c42babc7b0b51a6cf68dd9b3296c95c83e7e8a80 Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 21 Jun 2023 13:04:24 +0200 Subject: [PATCH 3/6] clang-format --- lib_dec/ivas_spar_md_dec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_dec/ivas_spar_md_dec.c b/lib_dec/ivas_spar_md_dec.c index 993dd34c4e..e83aa7e617 100644 --- a/lib_dec/ivas_spar_md_dec.c +++ b/lib_dec/ivas_spar_md_dec.c @@ -245,7 +245,7 @@ static ivas_error ivas_spar_md_dec_matrix_open( /*------------------------------------------------------------------------- * ivas_get_spar_dec_md_num_subframes() * - * return number of MD subframes + * return number of MD subframes *------------------------------------------------------------------------*/ /*! r: number of MD subframes */ -- GitLab From f6e4d8417299d5a9a47cb45bfde4dc13f6d2bf80 Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 21 Jun 2023 17:59:04 +0200 Subject: [PATCH 4/6] correct comments --- lib_com/options.h | 2 +- lib_dec/ivas_mct_dec.c | 2 +- lib_enc/ivas_mct_enc.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index af1ec74c1e..2ee7797810 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -99,7 +99,7 @@ /*MCT Debug switches*/ /*#define DEBUG_FORCE_MCT_CP*/ /* force MCT Stereo pairs for verification with SPAR */ #ifdef DEBUG_FORCE_MCT_CP -/*#define DEBUG_SINGLE_CODE_OMNI*/ /* force 3 TC SBA always code W channel separatelly */ +/*#define DEBUG_SINGLE_CODE_OMNI*/ /* force 3 TC SBA always code W channel separately */ #endif /*PLC Debug switches*/ diff --git a/lib_dec/ivas_mct_dec.c b/lib_dec/ivas_mct_dec.c index 2024637abe..7742656899 100755 --- a/lib_dec/ivas_mct_dec.c +++ b/lib_dec/ivas_mct_dec.c @@ -1057,7 +1057,7 @@ static ivas_error ivas_mc_dec_reconfig( /*-----------------------------------------------------------------* - * Allocate the LFE handle that is coded separatelly after the allocation of the core coders + * Allocate the LFE handle that is coded separately after the allocation of the core coders *-----------------------------------------------------------------*/ if ( ( st_ivas->mc_mode == MC_MODE_MCT || st_ivas->mc_mode == MC_MODE_PARAMUPMIX ) && st_ivas->hLFE == NULL ) { diff --git a/lib_enc/ivas_mct_enc.c b/lib_enc/ivas_mct_enc.c index 4a00eb3d4d..42ce327a4c 100644 --- a/lib_enc/ivas_mct_enc.c +++ b/lib_enc/ivas_mct_enc.c @@ -224,7 +224,7 @@ ivas_error ivas_mct_enc( /* set coded audio band-width */ switch_bw = set_bw_mct( st_ivas->hCPE, st_ivas->nCPE ); - /*for MC and MCT remove pointer to LFE input that has been processed separatelly */ + /*for MC and MCT remove pointer to LFE input that has been processed separately */ map_input_to_cpe_channels( st_ivas, pdata, data ); /* pre-processing */ -- GitLab From 2942db0dbb71473fbf914655ee5cefd89a6ff810 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Wed, 21 Jun 2023 21:20:11 +0200 Subject: [PATCH 5/6] strange linebreaks --- lib_dec/dec_tcx.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib_dec/dec_tcx.c b/lib_dec/dec_tcx.c index 35bdc6041f..bc10986256 100644 --- a/lib_dec/dec_tcx.c +++ b/lib_dec/dec_tcx.c @@ -1592,8 +1592,7 @@ void decoder_tcx_imdct( hTcxCfg->tcx_last_overlap_mode = hTcxCfg->tcx_curr_overlap_mode; } - if ( - st->igf ) + if ( st->igf ) { proc = st->hIGFDec->flatteningTrigger; -- GitLab From 25d674aaac553c679d11b879cf8420965405569d Mon Sep 17 00:00:00 2001 From: vaclav Date: Thu, 22 Jun 2023 18:07:25 +0200 Subject: [PATCH 6/6] clang-format --- lib_dec/ivas_jbm_dec.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index b2901afb62..ff28af051a 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -191,18 +191,18 @@ ivas_error ivas_jbm_dec_tc( { st = ( st_ivas->nSCE > 0 ) ? st_ivas->hSCE[0]->hCoreCoder[0] : st_ivas->hCPE[0]->hCoreCoder[0]; - if ( ( error = ivas_masa_decode( st_ivas, st, &nb_bits_metadata[0] ) ) != IVAS_ERR_OK ) - { - return error; - } + if ( ( error = ivas_masa_decode( st_ivas, st, &nb_bits_metadata[0] ) ) != IVAS_ERR_OK ) + { + return error; + } #ifdef FIX_470_MASA_JBM_EXT - if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_EXTERNAL ) - { - ivas_jbm_dec_copy_masa_meta_to_buffer( st_ivas ); - } -#endif + if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_EXTERNAL ) + { + ivas_jbm_dec_copy_masa_meta_to_buffer( st_ivas ); } +#endif + } else if ( st_ivas->ivas_format == SBA_FORMAT ) { if ( ( error = ivas_spar_dec( st_ivas, nb_bits_metadata ) ) != IVAS_ERR_OK ) -- GitLab