From bdca923ceedac60bf9a36ee725a772627e99a025 Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 25 Oct 2022 13:02:03 +0200 Subject: [PATCH] [harmonization] Use a common name MCT_flag instead of is_mct/is_MCT/isMCT/hMCT_flag/MCT_flag --- lib_com/core_com_config.c | 12 +- lib_com/ivas_prot.h | 202 ++++++++++++++-------------- lib_com/prot.h | 85 ++++++------ lib_com/swb_tbe_com.c | 6 + lib_com/tcx_utils.c | 8 +- lib_com/tns_base.c | 5 +- lib_dec/core_dec_init.c | 20 +-- lib_dec/core_dec_switch.c | 18 +-- lib_dec/dec_tcx.c | 43 +++--- lib_dec/ivas_mct_dec_mct.c | 2 +- lib_dec/ivas_mdct_core_dec.c | 74 +++++----- lib_dec/ivas_stereo_mdct_core_dec.c | 2 +- lib_dec/ivas_tcx_core_dec.c | 10 +- lib_enc/cod_tcx.c | 4 +- lib_enc/core_enc_init.c | 17 +-- lib_enc/core_enc_switch.c | 15 ++- lib_enc/enc_prm.c | 12 +- lib_enc/ivas_core_enc.c | 18 +-- lib_enc/ivas_core_pre_proc.c | 6 +- lib_enc/ivas_decision_matrix_enc.c | 10 +- lib_enc/ivas_front_vad.c | 6 +- lib_enc/ivas_mdct_core_enc.c | 20 +-- lib_enc/ivas_tcx_core_enc.c | 2 +- lib_enc/setmodeindex.c | 12 +- 24 files changed, 304 insertions(+), 305 deletions(-) diff --git a/lib_com/core_com_config.c b/lib_com/core_com_config.c index 295eca6233..7ffb4f0e9f 100644 --- a/lib_com/core_com_config.c +++ b/lib_com/core_com_config.c @@ -163,9 +163,9 @@ int16_t get_codec_mode( *-------------------------------------------------------------------*/ int16_t getTcxonly( - const int16_t element_mode, /* i : IVAS element mode */ - const int32_t total_brate, /* i : total bitrate */ - const int16_t is_mct /* i : MCT mode flag */ + const int16_t element_mode, /* i : IVAS element mode */ + const int32_t total_brate, /* i : total bitrate */ + const int16_t MCT_flag /* i : hMCT handle allocated (1) or not (0)*/ ) { int16_t tcxonly = 0; @@ -187,7 +187,7 @@ int16_t getTcxonly( } break; case IVAS_CPE_MDCT: - if ( total_brate >= ( is_mct ? IVAS_32k : IVAS_48k ) ) + if ( total_brate >= ( MCT_flag ? IVAS_32k : IVAS_48k ) ) { tcxonly = 1; } @@ -808,7 +808,7 @@ void init_tcx_cfg( const int16_t infoIGFStopFreq, const int16_t element_mode, const int16_t ini_frame, - const int16_t is_mct, + const int16_t MCT_flag, const MCT_CHAN_MODE mct_chan_mode /* i : MDCT channel mode */ ) { @@ -850,7 +850,7 @@ void init_tcx_cfg( if ( hTcxCfg->fIsTNSAllowed ) { - InitTnsConfigs( bwidth, hTcxCfg->tcx_coded_lines, hTcxCfg->tnsConfig, infoIGFStopFreq, total_brate, element_mode, is_mct ); + InitTnsConfigs( bwidth, hTcxCfg->tcx_coded_lines, hTcxCfg->tnsConfig, infoIGFStopFreq, total_brate, element_mode, MCT_flag ); SetAllowTnsOnWhite( hTcxCfg->tnsConfig, element_mode == IVAS_CPE_MDCT ); } diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index ff23fb7ebf..6419fbc905 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -225,7 +225,7 @@ ivas_error pre_proc_ivas( const int16_t vad_flag_dtx, /* i : HE-SAD flag with additional DTX HO */ const float enerBuffer[CLDFB_NO_CHANNELS_MAX], /* i : energy buffer */ const float fft_buff[2 * L_FFT], /* i : FFT buffer */ - const int16_t is_mct, /* i : MCT mode flag */ + const int16_t MCT_flag, /* i : hMCT handle allocated (1) or not (0) */ const int16_t vad_hover_flag, /* i : VAD hangover flag */ const int16_t flag_16k_smc /* i : flag to indicate if the OL SMC is run at 16 kHz */ ); @@ -504,7 +504,7 @@ void stereo_tcx_core_dec( void stereo_tcx_init_dec( Decoder_State *st, /* i/o: decoder state structure */ - const int16_t is_mct, /* i : MCT mode flag */ + const int16_t MCT_flag, /* i : hMCT handle allocated (1) or not (0) */ const int16_t last_element_mode /* i : element mode of previous frame */ ); @@ -561,7 +561,7 @@ void ivas_decision_matrix_enc( void ivas_signaling_enc( Encoder_State *st, /* i/o: encoder state structure */ - const int16_t is_MCT, /* i : MCT enabled */ + const int16_t MCT_flag, /* i : hMCT handle allocated (1) or not (0) */ const int32_t element_brate, /* i : element bitrate */ const int16_t tdm_SM_flag, /* i : channel combination scheme flag in TD stereo */ const int16_t tdm_Pitch_reuse_flag /* i : primary channel pitch reuse flag in TD stereo*/ @@ -1869,7 +1869,7 @@ void EstimateStereoTCXNoiseLevel( const int16_t ignore_chan[], /* i : flag indicating whether the channel should be ignored */ float fac_ns[][NB_DIV], /* o : noise filling level */ int16_t param_core[][NB_DIV * NPRM_DIV], /* o : quantized noise filling level */ - const int16_t is_mct /* i : is mct flag */ + const int16_t MCT_flag /* i : hMCT handle allocated (1) or not (0) */ ); void TNSAnalysisStereo( @@ -1998,7 +1998,7 @@ void decoder_tcx_noisefilling( const int16_t *prm_sqQ, int16_t nf_seed, const int16_t bfi, /* i : Bad frame indicator */ - const int16_t isMCT, + const int16_t MCT_flag, const int16_t frame_cnt /* i : frame counter in the super frame */ ); @@ -2082,7 +2082,7 @@ void decoder_tcx_IGF_stereo( const int16_t left_rect, /* i : left part is rectangular */ const int16_t k, /* i : Subframe index */ const int16_t bfi, /* i : bad frame indicator */ - const int16_t is_mct /* i : flag to signal MCT or SMDCT */ + const int16_t MCT_flag /* i : hMCT handle allocated (1) or not (0) */ ); void ms_processing( @@ -2360,7 +2360,7 @@ ivas_error front_vad( Encoder_State *st, /* i/o: encoder state structure */ const ENCODER_CONFIG_HANDLE hEncoderConfig, /* i : configuration structure */ FRONT_VAD_ENC_HANDLE *hFrontVads, /* i/o: front-VAD handles */ - const int16_t hMCT_flag, /* i : hMCT handle allocated (1) or not (0) */ + const int16_t MCT_flag, /* i : hMCT handle allocated (1) or not (0) */ const int16_t input_frame, /* i : frame length */ int16_t vad_flag_dtx[], /* o : HE-SAD flag with additional DTX HO */ float fr_bands[][2 * NB_BANDS], /* i : energy in frequency bands */ @@ -2603,139 +2603,139 @@ int16_t read_GR0( *----------------------------------------------------------------------------------*/ void ivas_mdct_core_whitening_enc( - CPE_ENC_HANDLE hCPE, /* i/o: CPE encoder structure */ - float new_samples[CPE_CHANNELS][L_INP], /* i : new samples */ - float old_wsp[CPE_CHANNELS][L_WSP], /* i : 12.8kHz weighted speech (for LTP */ - float pitch_buf[CPE_CHANNELS][NB_SUBFR16k], /* o : floating pitch for each subframe */ - float *mdst_spectrum_long[CPE_CHANNELS], /* o : buffer for MDST spectrum */ - int16_t tnsBits[CPE_CHANNELS][NB_DIV], /* o : buffer TNS bits */ - float *orig_spectrum_long[CPE_CHANNELS], /* o : origingal spectrum w/o whitening */ - int16_t tnsSize[CPE_CHANNELS][NB_DIV], /* o : size of TNS */ - int16_t p_param[CPE_CHANNELS][NB_DIV], /* o : pointer to parameter array */ - BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ - int16_t *LFE_off, /* o : flag if LFE has content */ - const int16_t mct_on, /* i : flag mct block (1) or stereo (0) */ - const int16_t nChannels /* i : total number of coded channels */ + CPE_ENC_HANDLE hCPE, /* i/o: CPE encoder structure */ + float new_samples[CPE_CHANNELS][L_INP], /* i : new samples */ + float old_wsp[CPE_CHANNELS][L_WSP], /* i : 12.8kHz weighted speech (for LTP */ + float pitch_buf[CPE_CHANNELS][NB_SUBFR16k], /* o : floating pitch for each subframe */ + float *mdst_spectrum_long[CPE_CHANNELS], /* o : buffer for MDST spectrum */ + int16_t tnsBits[CPE_CHANNELS][NB_DIV], /* o : buffer TNS bits */ + float *orig_spectrum_long[CPE_CHANNELS], /* o : origingal spectrum w/o whitening */ + int16_t tnsSize[CPE_CHANNELS][NB_DIV], /* o : size of TNS */ + int16_t p_param[CPE_CHANNELS][NB_DIV], /* o : pointer to parameter array */ + BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ + int16_t *LFE_off, /* o : flag if LFE has content */ + const int16_t mct_on, /* i : flag mct block (1) or stereo (0) */ + const int16_t nChannels /* i : total number of coded channels */ ); void ivas_mct_core_enc( - const IVAS_FORMAT ivas_format, /* i : IVAS format */ - MCT_ENC_HANDLE hMCT, /* i/o: MCT encoder structure */ - CPE_ENC_HANDLE hCPE[MCT_MAX_BLOCKS], /* i/o: CPE encoder structures */ - const int16_t nChannels, /* i : number of channels to be coded */ - const int32_t ivas_total_brate, /* i : IVAS total bitrate */ - const int16_t switch_bw, /* i : flag bandwidth switch occurance */ - const int16_t lfe_bits /* i : bits spent for LFE */ + const IVAS_FORMAT ivas_format, /* i : IVAS format */ + MCT_ENC_HANDLE hMCT, /* i/o: MCT encoder structure */ + CPE_ENC_HANDLE hCPE[MCT_MAX_BLOCKS], /* i/o: CPE encoder structures */ + const int16_t nChannels, /* i : number of channels to be coded */ + const int32_t ivas_total_brate, /* i : IVAS total bitrate */ + const int16_t switch_bw, /* i : flag bandwidth switch occurance */ + const int16_t lfe_bits /* i : bits spent for LFE */ #ifdef FIX_I1_113 , - const int16_t sba_order /* i : Ambisonic (SBA) order */ + const int16_t sba_order /* i : Ambisonic (SBA) order */ #endif ); void ivas_mdct_quant_coder( - CPE_ENC_HANDLE hCPE, /* i/o: Encoder CPE handle */ - const int16_t LFE_off, /* i : flag if LFE has content */ - int16_t tnsBits[CPE_CHANNELS][NB_DIV], /* i : bits needed for TNS parameters */ - int16_t tnsSize[CPE_CHANNELS][NB_DIV], /* i : size of TNS */ - int16_t p_param[CPE_CHANNELS][NB_DIV], /* i : pointer to parameter array */ - const int16_t is_mct /* i : is mct flag */ + CPE_ENC_HANDLE hCPE, /* i/o: Encoder CPE handle */ + const int16_t LFE_off, /* i : flag if LFE has content */ + int16_t tnsBits[CPE_CHANNELS][NB_DIV], /* i : bits needed for TNS parameters */ + int16_t tnsSize[CPE_CHANNELS][NB_DIV], /* i : size of TNS */ + int16_t p_param[CPE_CHANNELS][NB_DIV], /* i : pointer to parameter array */ + const int16_t MCT_flag /* i : hMCT handle allocated (1) or not (0) */ ); void apply_MCT_enc( - MCT_ENC_HANDLE hMCT, /* i/o: MCT encoder structure */ - Encoder_State **sts, /* i/o: encoder state structure */ - float *mdst_spectrum[MCT_MAX_CHANNELS][NB_DIV], /* i/o: MDST spectrum */ - float *inv_spectrum[MCT_MAX_CHANNELS][NB_DIV], /* i/o: inverse spectrum */ - float *inv_mdst_spectrum[MCT_MAX_CHANNELS][NB_DIV], /* i/o: inverse MDST spectrum */ - const int16_t nchan /* i : number of channels */ + MCT_ENC_HANDLE hMCT, /* i/o: MCT encoder structure */ + Encoder_State **sts, /* i/o: encoder state structure */ + float *mdst_spectrum[MCT_MAX_CHANNELS][NB_DIV], /* i/o: MDST spectrum */ + float *inv_spectrum[MCT_MAX_CHANNELS][NB_DIV], /* i/o: inverse spectrum */ + float *inv_mdst_spectrum[MCT_MAX_CHANNELS][NB_DIV], /* i/o: inverse MDST spectrum */ + const int16_t nchan /* i : number of channels */ ); void write_mct_bitstream( - Encoder_State **sts, /* i/o: encoder state structure */ - MCT_ENC_HANDLE hMCT, /* i/o: MCT encoder structure */ - const int16_t nchan /* i : number of channels */ + Encoder_State **sts, /* i/o: encoder state structure */ + MCT_ENC_HANDLE hMCT, /* i/o: MCT encoder structure */ + const int16_t nchan /* i : number of channels */ ); void splitAvailableBitsMCT( - void **sts, /* i/o: encoder/decoder state structure */ - const int16_t total_bits, /* i : total number of available bits */ - const int16_t split_ratio[MCT_MAX_CHANNELS], /* i : ratio for splitting the bits */ - const int16_t enc_dec, /* i : encoder or decoder flag */ - const int16_t nchan /* i : number of channels */ + void **sts, /* i/o: encoder/decoder state structure */ + const int16_t total_bits, /* i : total number of available bits */ + const int16_t split_ratio[MCT_MAX_CHANNELS], /* i : ratio for splitting the bits */ + const int16_t enc_dec, /* i : encoder or decoder flag */ + const int16_t nchan /* i : number of channels */ ); void getChannelEnergies( - Encoder_State **sts, /* i : Encoder state structure */ - float nrg[MCT_MAX_CHANNELS], /* o : energies */ - const int16_t nchan /* i : number of channels */ + Encoder_State **sts, /* i : Encoder state structure */ + float nrg[MCT_MAX_CHANNELS], /* o : energies */ + const int16_t nchan /* i : number of channels */ ); void mctStereoIGF_enc( - MCT_ENC_HANDLE hMCT, /* i/o: MCT encoder structure */ - Encoder_State **sts, /* i/o: encoder state structure */ - float *orig_spectrum[MCT_MAX_CHANNELS][NB_DIV], /* i : MDCT spectrum for ITF */ - float powerSpec[MCT_MAX_CHANNELS][L_FRAME48k], /* i/o: MDCT^2 + MDST^2 spectrum,or estimate*/ - float *powerSpecMsInv[MCT_MAX_CHANNELS][NB_DIV], /* i : same as above but for inverse spect.*/ - float *inv_spectrum[MCT_MAX_CHANNELS][NB_DIV], /* i : inverse spectrum */ - const int16_t sp_aud_decision0[MCT_MAX_CHANNELS] /* i : speech audio decision */ + MCT_ENC_HANDLE hMCT, /* i/o: MCT encoder structure */ + Encoder_State **sts, /* i/o: encoder state structure */ + float *orig_spectrum[MCT_MAX_CHANNELS][NB_DIV], /* i : MDCT spectrum for ITF */ + float powerSpec[MCT_MAX_CHANNELS][L_FRAME48k], /* i/o: MDCT^2 + MDST^2 spectrum,or estimate */ + float *powerSpecMsInv[MCT_MAX_CHANNELS][NB_DIV], /* i : same as above but for inverse spect. */ + float *inv_spectrum[MCT_MAX_CHANNELS][NB_DIV], /* i : inverse spectrum */ + const int16_t sp_aud_decision0[MCT_MAX_CHANNELS] /* i : speech audio decision */ ); void ivas_mdct_dec_side_bits_frame_channel( - CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ - int16_t param_lpc[MCT_MAX_CHANNELS][NPRM_LPC_NEW], /* o : lpc_parameters */ - int16_t p_param[CPE_CHANNELS][NB_DIV], /* o : pointer to param buffer */ - Decoder_State *st0, /* i : pointer to bitstream handle */ - int16_t *LFE_off, /* o : flag if LFE has content */ - int16_t nTnsBitsTCX10[CPE_CHANNELS][NB_DIV], /* o : number of bits for TNS */ - int16_t param[CPE_CHANNELS][DEC_NPRM_DIV * NB_DIV], /* i/o: parameters buffer */ - const int16_t MCT_flag, /* i : MCT tool active(1) or deactive (0) */ - const int16_t odd_channel_cpe /* i : flag cpe with odd nb of tc channels */ + CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ + int16_t param_lpc[MCT_MAX_CHANNELS][NPRM_LPC_NEW], /* o : lpc_parameters */ + int16_t p_param[CPE_CHANNELS][NB_DIV], /* o : pointer to param buffer */ + Decoder_State *st0, /* i : pointer to bitstream handle */ + int16_t *LFE_off, /* o : flag if LFE has content */ + int16_t nTnsBitsTCX10[CPE_CHANNELS][NB_DIV], /* o : number of bits for TNS */ + int16_t param[CPE_CHANNELS][DEC_NPRM_DIV * NB_DIV], /* i/o: parameters buffer */ + const int16_t MCT_flag, /* i : hMCT handle allocated (1) or not (0) */ + const int16_t odd_channel_cpe /* i : flag cpe with odd nb of tc channels */ ); void ivas_mct_side_bits( - MCT_DEC_HANDLE hMCT, /* i/o: MCT decoder structure */ - CPE_DEC_HANDLE hCPE[MCT_MAX_BLOCKS], /* i/o: CPE decoder structure */ - const int16_t nCPE, /* i : number of CPEs */ - Decoder_State *st0, /* i : decoder handle for Bstr */ - const int16_t bfi, /* i : BFI flag */ - uint16_t *bitstream, /* o : bitstream indices */ - const int32_t ivas_total_brate, /* i : IVAS total bitrate */ - const int16_t nb_bits_metadata /* i : number of metadata bits */ + MCT_DEC_HANDLE hMCT, /* i/o: MCT decoder structure */ + CPE_DEC_HANDLE hCPE[MCT_MAX_BLOCKS], /* i/o: CPE decoder structure */ + const int16_t nCPE, /* i : number of CPEs */ + Decoder_State *st0, /* i : decoder handle for Bstr */ + const int16_t bfi, /* i : BFI flag */ + uint16_t *bitstream, /* o : bitstream indices */ + const int32_t ivas_total_brate, /* i : IVAS total bitrate */ + const int16_t nb_bits_metadata /* i : number of metadata bits */ ); void ivas_mdct_core_invQ( - CPE_DEC_HANDLE hCPE, /* i/o: CPE handle */ - const int16_t LFE_off, /* i : flag if LFE content */ - int16_t nTnsBitsTCX10[CPE_CHANNELS][NB_DIV], /* i : number of TNS bits */ - int16_t p_param[CPE_CHANNELS][NB_DIV], /* i : pointer to param buffer */ - int16_t param_lpc[CPE_CHANNELS][NPRM_LPC_NEW], /* i : lpc parameters */ - int16_t param[CPE_CHANNELS][DEC_NPRM_DIV * NB_DIV], /* i : param buffer */ - int16_t fUseTns[CPE_CHANNELS][NB_DIV], /* i : flag TNS enabled */ - STnsData tnsData[CPE_CHANNELS][NB_DIV], /* i : TNS parameter */ - float *x_0[CPE_CHANNELS][NB_DIV], /* i/o: signal buffer */ - float *x[CPE_CHANNELS][NB_DIV], /* i/o: signal buffer */ - float Aq[CPE_CHANNELS][( NB_SUBFR16k + 1 ) * ( M + 1 )], /* i : LP coefficients */ - int16_t ms_mask[NB_DIV][MAX_SFB], /* i : M/S mask */ - const int16_t isMCT /* i : MCT flag */ + CPE_DEC_HANDLE hCPE, /* i/o: CPE handle */ + const int16_t LFE_off, /* i : flag if LFE content */ + int16_t nTnsBitsTCX10[CPE_CHANNELS][NB_DIV], /* i : number of TNS bits */ + int16_t p_param[CPE_CHANNELS][NB_DIV], /* i : pointer to param buffer */ + int16_t param_lpc[CPE_CHANNELS][NPRM_LPC_NEW], /* i : lpc parameters */ + int16_t param[CPE_CHANNELS][DEC_NPRM_DIV * NB_DIV], /* i : param buffer */ + int16_t fUseTns[CPE_CHANNELS][NB_DIV], /* i : flag TNS enabled */ + STnsData tnsData[CPE_CHANNELS][NB_DIV], /* i : TNS parameter */ + float *x_0[CPE_CHANNELS][NB_DIV], /* i/o: signal buffer */ + float *x[CPE_CHANNELS][NB_DIV], /* i/o: signal buffer */ + float Aq[CPE_CHANNELS][( NB_SUBFR16k + 1 ) * ( M + 1 )], /* i : LP coefficients */ + int16_t ms_mask[NB_DIV][MAX_SFB], /* i : M/S mask */ + const int16_t MCT_flag /* i : hMCT handle allocated (1) or not (0) */ ); void ivas_mdct_core_reconstruct( - CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ - float *x[][NB_DIV], /* i/o: pointers to synthesis @internal_FS */ - float signal_outFB[CPE_CHANNELS][L_FRAME_PLUS], /* o : synthesis @output_FS */ - const int16_t LFE_off, /* i : flag if LFE content */ - int16_t fUseTns[CPE_CHANNELS][NB_DIV], /* i : flage TNS enabled */ - const int16_t isMCT /* i : MCT flag */ + CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ + float *x[][NB_DIV], /* i/o: pointers to synthesis @internal_FS */ + float signal_outFB[CPE_CHANNELS][L_FRAME_PLUS], /* o : synthesis @output_FS */ + const int16_t LFE_off, /* i : flag if LFE content */ + int16_t fUseTns[CPE_CHANNELS][NB_DIV], /* i : flage TNS enabled */ + const int16_t MCT_flag /* i : hMCT handle allocated (1) or not (0) */ ); void ivas_mdct_core_tns_ns( - CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ - const int16_t LFE_off, /* i : flag if LFE has content */ - int16_t fUseTns[CPE_CHANNELS][NB_DIV], /* i : two entries for each channel in TCX10*/ - STnsData tnsData[CPE_CHANNELS][NB_DIV], /* o : TNS parameter */ - float *x[CPE_CHANNELS][NB_DIV], /* o : synthesis @internal_FS */ - float Aq[CPE_CHANNELS][( NB_SUBFR16k + 1 ) * ( M + 1 )], /* o : LP coefficients */ - const int16_t isMCT /* i : MCT flag */ + CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ + const int16_t LFE_off, /* i : flag if LFE has content */ + int16_t fUseTns[CPE_CHANNELS][NB_DIV], /* i : two entries for each channel in TCX10 */ + STnsData tnsData[CPE_CHANNELS][NB_DIV], /* o : TNS parameter */ + float *x[CPE_CHANNELS][NB_DIV], /* o : synthesis @internal_FS */ + float Aq[CPE_CHANNELS][( NB_SUBFR16k + 1 ) * ( M + 1 )], /* o : LP coefficients */ + const int16_t MCT_flag /* i : hMCT handle allocated (1) or not (0) */ ); void ivas_mct_core_dec( diff --git a/lib_com/prot.h b/lib_com/prot.h index 5bc1e39753..9ea060effd 100755 --- a/lib_com/prot.h +++ b/lib_com/prot.h @@ -6745,7 +6745,7 @@ float correlation_shift( void init_coder_ace_plus( Encoder_State *st, /* i : Encoder state handle */ const int32_t last_total_brate, /* i : last total bitrate */ - const int16_t is_mct /* i : MCT mode flag */ + const int16_t MCT_flag /* i : hMCT handle allocated (1) or not (0)*/ ); void core_coder_reconfig( @@ -6756,7 +6756,7 @@ void core_coder_reconfig( void core_coder_mode_switch( Encoder_State *st, /* i/o: encoder state structure */ const int32_t last_total_brate, /* i : last bitrate */ - const int16_t is_mct /* i : MCT mode flag */ + const int16_t MCT_flag /* i : hMCT handle allocated (1) or not (0)*/ ); void enc_acelp_tcx_main( @@ -6775,8 +6775,7 @@ void getTCXMode( Decoder_State *st, /* i/o: decoder memory state */ Decoder_State *st0 /* i : bitstream */ , - const int16_t MCT_flag -); + const int16_t MCT_flag ); void getTCXWindowing( const int16_t core, /* i : current frame mode */ @@ -7606,8 +7605,7 @@ void InitTnsConfigs( const int16_t igfStopFreq, const int32_t total_brate, const int16_t element_mode, - const int16_t is_mct /* i : MCT mode flag */ -); + const int16_t MCT_flag ); void SetAllowTnsOnWhite( STnsConfig tnsConfig[2][2], @@ -7884,13 +7882,12 @@ void decoder_tcx( ); void decoder_tcx_post( - Decoder_State *st, /* i/o: decoder memory state */ - float *synth, - float *synthFB, - float *A, - const int16_t bfi - , - const int16_t isMCT + Decoder_State *st, /* i/o: decoder memory state */ + float *synth, /* i/o: synthesis */ + float *synthFB, /* i/o: FB synthesis */ + float *A, /* i : A(z) filter coefficients */ + const int16_t bfi, /* i : Bad frame indicator */ + const int16_t MCT_flag /* i : hMCT handle allocated (1) or not (0) */ ); void coder_acelp( @@ -7941,10 +7938,10 @@ void decoder_acelp( ); void writeTCXMode( - Encoder_State *st, /* i/o: encoder state structure */ - BSTR_ENC_HANDLE hBstr, /* i/o: bitstream handle */ - const int16_t is_mct, - int16_t *nbits_start /* o : nbits start */ + Encoder_State *st, /* i/o: encoder state structure */ + BSTR_ENC_HANDLE hBstr, /* i/o: bitstream handle */ + const int16_t MCT_flag, /* i : hMCT handle allocated (1) or not (0)*/ + int16_t *nbits_start /* o : nbits start */ ); void writeTCXWindowing( @@ -8133,8 +8130,7 @@ void con_tcx( int16_t *noise_seed, /* i/o: noise seed for stereo */ const int16_t only_left /* i : TD-PLC only in left channel */ , - const float *A_cng -); + const float *A_cng ); /*! r: codebook index */ int16_t tcxlpc_get_cdk( @@ -8848,8 +8844,7 @@ void InitTnsConfiguration( const int16_t igfStopFreq, const int32_t total_brate, const int16_t element_mode, - const int16_t is_mct /* i : MCT mode flag */ -); + const int16_t MCT_flag ); int16_t DetectTnsFilt( const STnsConfig *pTnsConfig, /* i : TNS Configuration struct */ @@ -9183,13 +9178,13 @@ void longshiftleft( ); void open_decoder_LPD( - Decoder_State *st, /* i/o: decoder state structure */ - const int32_t total_brate, /* i : total bitrate */ - const int32_t last_total_brate, /* i : last total bitrate */ - const int16_t bwidth, /* i : audio bandwidth */ - const int16_t is_mct, /* i : MCT mode flag */ - const int16_t last_element_mode, - const int16_t is_init /* i : indicate call during initialization */ + Decoder_State *st, /* i/o: decoder state structure */ + const int32_t total_brate, /* i : total bitrate */ + const int32_t last_total_brate, /* i : last total bitrate */ + const int16_t bwidth, /* i : audio bandwidth */ + const int16_t MCT_flag, /* i : hMCT handle allocated (1) or not (0) */ + const int16_t last_element_mode, /* i : last element mode */ + const int16_t is_init /* i : indicate call during initialization */ ); void acelp_plc_mdct_transition( @@ -9223,14 +9218,13 @@ void reconfig_decoder_LPD( ); void mode_switch_decoder_LPD( - Decoder_State *st, /* i/o: decoder state structure */ - const int16_t bwidth, /* i : audio bandwidth */ - const int32_t total_brate, /* i : total bitrate */ - const int32_t last_total_brate, /* i : last frame total bitrate */ - const int16_t frame_size_index, /* i : index determining the frame size*/ - const int16_t is_mct /* i : MCT mode flag */ - , - const int16_t last_element_mode /* i : last element mode */ + Decoder_State *st, /* i/o: decoder state structure */ + const int16_t bwidth, /* i : audio bandwidth */ + const int32_t total_brate, /* i : total bitrate */ + const int32_t last_total_brate, /* i : last frame total bitrate */ + const int16_t frame_size_index, /* i : index determining the frame size */ + const int16_t MCT_flag, /* i : hMCT handle allocated (1) or not (0)*/ + const int16_t last_element_mode /* i : last element mode */ ); void dec_acelp_tcx_frame( @@ -9510,10 +9504,8 @@ void TonalMDCTConceal_SaveFreqSignal( const float *mdctSpectrum, const uint16_t numSamples, const uint16_t nNewSamplesCore, - const float *scaleFactors - , - const int16_t infoIGFStartLine -); + const float *scaleFactors, + const int16_t infoIGFStartLine ); void TonalMDCTConceal_UpdateState( TonalMDCTConcealPtr hTonalMDCTConc, @@ -9658,9 +9650,9 @@ int16_t get_codec_mode( ); int16_t getTcxonly( - const int16_t element_mode, /* i : IVAS element mode */ - const int32_t total_brate, /* i : total bitrate */ - const int16_t is_mct /* i : MCT mode flag */ + const int16_t element_mode, /* i : IVAS element mode */ + const int32_t total_brate, /* i : total bitrate */ + const int16_t MCT_flag /* i : hMCT handle allocated (1) or not (0)*/ ); int16_t getTnsAllowed( @@ -9740,7 +9732,7 @@ void SetModeIndex( Encoder_State *st, /* i : Encoder state */ const int32_t last_total_brate, /* i : last total bitrate */ const int16_t last_element_mode, /* i : last IVAS element mode */ - const int16_t is_mct /* i : MCT mode flag */ + const int16_t MCT_flag /* i : hMCT handle allocated (1) or not (0) */ ); int16_t getNumTcxCodedLines( @@ -9964,6 +9956,7 @@ void IGFSCFDecoderDecode( if 0 on input the decoder will be forced to encode without a reset */ ); +/*! r: offset value */ int16_t tbe_celp_exc_offset( const int16_t T0, /* i : Integer pitch */ const int16_t T0_frac /* i : Fractional part of the pitch */ @@ -10006,6 +9999,6 @@ void init_tcx_cfg( const int16_t infoIGFStopFreq, const int16_t element_mode, const int16_t ini_frame, - const int16_t is_mct, /* i : MCT mode flag */ - const MCT_CHAN_MODE mct_chan_mode /* i : MCT channel mode */ + const int16_t MCT_flag, /* i : hMCT handle allocated (1) or not (0) */ + const MCT_CHAN_MODE mct_chan_mode /* i : MCT channel mode */ ); diff --git a/lib_com/swb_tbe_com.c b/lib_com/swb_tbe_com.c index 4291feaed9..cc0c70cbbf 100644 --- a/lib_com/swb_tbe_com.c +++ b/lib_com/swb_tbe_com.c @@ -89,6 +89,7 @@ void swb_tbe_reset( return; } + /*-------------------------------------------------------------------* * swb_tbe_reset_synth() * @@ -105,11 +106,14 @@ void swb_tbe_reset_synth( return; } + /*-------------------------------------------------------------------* * tbe_celp_exc_offset() * * Compute tbe bwe celp excitation offset *-------------------------------------------------------------------*/ + +/*! r: offset value */ int16_t tbe_celp_exc_offset( const int16_t T0, /* i : Integer pitch */ const int16_t T0_frac /* i : Fractional part of the pitch */ @@ -120,6 +124,8 @@ int16_t tbe_celp_exc_offset( return offset; } + + /*-------------------------------------------------------------------* * flip_and_downmix_generic() * diff --git a/lib_com/tcx_utils.c b/lib_com/tcx_utils.c index 19e0220439..6e868add48 100644 --- a/lib_com/tcx_utils.c +++ b/lib_com/tcx_utils.c @@ -995,16 +995,16 @@ void InitTnsConfigs( const int16_t igfStopFreq, const int32_t total_brate, const int16_t element_mode, - const int16_t is_mct ) + const int16_t MCT_flag ) { if ( total_brate > ACELP_32k ) { - InitTnsConfiguration( bwidth, L_frame / 2, &tnsConfig[0][0], igfStopFreq, total_brate, element_mode, is_mct ); + InitTnsConfiguration( bwidth, L_frame / 2, &tnsConfig[0][0], igfStopFreq, total_brate, element_mode, MCT_flag ); } - InitTnsConfiguration( bwidth, L_frame, &tnsConfig[1][0], igfStopFreq, total_brate, element_mode, is_mct ); + InitTnsConfiguration( bwidth, L_frame, &tnsConfig[1][0], igfStopFreq, total_brate, element_mode, MCT_flag ); - InitTnsConfiguration( bwidth, L_frame + L_frame / 4, &tnsConfig[1][1], igfStopFreq, total_brate, element_mode, is_mct ); + InitTnsConfiguration( bwidth, L_frame + L_frame / 4, &tnsConfig[1][1], igfStopFreq, total_brate, element_mode, MCT_flag ); return; } diff --git a/lib_com/tns_base.c b/lib_com/tns_base.c index 1be0b73b0c..94b014b59b 100644 --- a/lib_com/tns_base.c +++ b/lib_com/tns_base.c @@ -78,7 +78,7 @@ void InitTnsConfiguration( const int16_t igfStopFreq, const int32_t total_brate, const int16_t element_mode, - const int16_t is_mct ) + const int16_t MCT_flag ) { int32_t nSampleRate; int16_t iFilter; @@ -111,8 +111,7 @@ void InitTnsConfiguration( } else if ( nSampleRate > 16000 ) { - - if ( ( element_mode > IVAS_SCE ) && ( total_brate >= ( is_mct ? IVAS_32k : IVAS_48k ) ) ) + if ( ( element_mode > IVAS_SCE ) && ( total_brate >= ( MCT_flag ? IVAS_32k : IVAS_48k ) ) ) { pTnsConfig->nMaxFilters = sizeof( tnsParameters32kHz_Stereo ) / sizeof( tnsParameters32kHz_Stereo[0] ); if ( nSampleRate == 100 * frameLength ) /* sub-frame length is <= 10 ms */ diff --git a/lib_dec/core_dec_init.c b/lib_dec/core_dec_init.c index 906d24adab..90827ca0ee 100644 --- a/lib_dec/core_dec_init.c +++ b/lib_dec/core_dec_init.c @@ -52,13 +52,13 @@ *-----------------------------------------------------------------------*/ void open_decoder_LPD( - Decoder_State *st, - const int32_t total_brate, - const int32_t last_total_brate, - const int16_t bwidth, - const int16_t is_mct, /* i : MCT mode flag */ - const int16_t last_element_mode, - const int16_t is_init /* i : indicate call from init_decoder() to avoid double TC initialization */ + Decoder_State *st, /* i/o: decoder state structure */ + const int32_t total_brate, /* i : total bitrate */ + const int32_t last_total_brate, /* i : last total bitrate */ + const int16_t bwidth, /* i : audio bandwidth */ + const int16_t MCT_flag, /* i : hMCT handle allocated (1) or not (0) */ + const int16_t last_element_mode, /* i : last element mode */ + const int16_t is_init /* i : indicate call during initialization */ ) { int16_t i; @@ -92,7 +92,7 @@ void open_decoder_LPD( } } - st->tcxonly = getTcxonly( st->element_mode, total_brate, is_mct ); + st->tcxonly = getTcxonly( st->element_mode, total_brate, MCT_flag ); /* the TD TCX PLC in MODE1 still runs with 80ms subframes */ if ( ( st->element_mode == EVS_MONO && st->L_frame == L_FRAME16k && total_brate <= ACELP_32k ) || ( st->element_mode > EVS_MONO && st->L_frame == L_FRAME16k && total_brate <= MAX_ACELP_BRATE ) || ( st->tcxonly && ( st->sr_core == 32000 || st->sr_core == 16000 ) ) ) @@ -190,7 +190,7 @@ void open_decoder_LPD( { if ( !is_init || st->element_mode != IVAS_CPE_MDCT ) { - init_tcx_cfg( st->hTcxCfg, total_brate, st->sr_core, st->output_Fs, st->L_frame, st->bwidth, st->hTcxDec->L_frameTCX, st->fscale, encoderLookahead, encoderLookaheadFB, st->preemph_fac, st->tcxonly, st->rf_flag, st->igf, st->hIGFDec->infoIGFStopFreq, st->element_mode, st->ini_frame, is_mct, st->mct_chan_mode ); + init_tcx_cfg( st->hTcxCfg, total_brate, st->sr_core, st->output_Fs, st->L_frame, st->bwidth, st->hTcxDec->L_frameTCX, st->fscale, encoderLookahead, encoderLookaheadFB, st->preemph_fac, st->tcxonly, st->rf_flag, st->igf, st->hIGFDec->infoIGFStopFreq, st->element_mode, st->ini_frame, MCT_flag, st->mct_chan_mode ); } else { @@ -550,7 +550,7 @@ void open_decoder_LPD( { st->hTcxDec->prev_widow_left_rect = 0; - if ( is_init || is_mct || !( st->element_mode == IVAS_CPE_MDCT && st->element_mode == last_element_mode ) ) + if ( is_init || MCT_flag || !( st->element_mode == IVAS_CPE_MDCT && st->element_mode == last_element_mode ) ) { st->hTcxDec->CngLevelBackgroundTrace_bfi = PLC_MIN_CNG_LEV; st->hTcxDec->NoiseLevelIndex_bfi = PLC_MIN_STAT_BUFF_SIZE - 1; diff --git a/lib_dec/core_dec_switch.c b/lib_dec/core_dec_switch.c index cc1619cba0..7b28143666 100644 --- a/lib_dec/core_dec_switch.c +++ b/lib_dec/core_dec_switch.c @@ -51,14 +51,14 @@ *-------------------------------------------------------------*/ void mode_switch_decoder_LPD( - Decoder_State *st, /* i/o: decoder state structure */ - const int16_t bwidth, /* i : audio bandwidth */ - const int32_t total_brate, /* i : total bitrate */ - const int32_t last_total_brate, /* i : last frame total bitrate */ - const int16_t frame_size_index, /* i : index determining the frame size*/ - const int16_t is_mct /* i : MCT mode flag */ + Decoder_State *st, /* i/o: decoder state structure */ + const int16_t bwidth, /* i : audio bandwidth */ + const int32_t total_brate, /* i : total bitrate */ + const int32_t last_total_brate, /* i : last frame total bitrate */ + const int16_t frame_size_index, /* i : index determining the frame size */ + const int16_t MCT_flag /* i : hMCT handle allocated (1) or not (0)*/ , - const int16_t last_element_mode /* i : last element mode */ + const int16_t last_element_mode /* i : last element mode */ ) { int16_t fscale, switchWB; @@ -107,7 +107,7 @@ void mode_switch_decoder_LPD( if ( fscale != st->fscale || switchWB || bSwitchFromAmrwbIO || st->last_codec_mode == MODE1 || st->force_lpd_reset ) { - open_decoder_LPD( st, total_brate, last_total_brate, bwidth, is_mct, last_element_mode, 0 ); + open_decoder_LPD( st, total_brate, last_total_brate, bwidth, MCT_flag, last_element_mode, 0 ); } else { @@ -146,7 +146,7 @@ void mode_switch_decoder_LPD( if ( st->hTcxCfg->fIsTNSAllowed && st->hIGFDec != NULL && st->hTcxCfg != NULL ) { - InitTnsConfigs( bwidth, st->hTcxCfg->tcx_coded_lines, st->hTcxCfg->tnsConfig, st->hIGFDec->infoIGFStopFreq, total_brate, st->element_mode, is_mct ); + InitTnsConfigs( bwidth, st->hTcxCfg->tcx_coded_lines, st->hTcxCfg->tnsConfig, st->hIGFDec->infoIGFStopFreq, total_brate, st->element_mode, MCT_flag ); SetAllowTnsOnWhite( st->hTcxCfg->tnsConfig, st->element_mode == IVAS_CPE_MDCT ); } diff --git a/lib_dec/dec_tcx.c b/lib_dec/dec_tcx.c index d625139a47..4f9b0c3a28 100644 --- a/lib_dec/dec_tcx.c +++ b/lib_dec/dec_tcx.c @@ -120,13 +120,12 @@ void decoder_tcx( *-------------------------------------------------------------------*/ void decoder_tcx_post( - Decoder_State *st, - float *synth, - float *synthFB, - float *A, - const int16_t bfi - , - const int16_t isMCT + Decoder_State *st, /* i/o: decoder memory state */ + float *synth, /* i/o: synthesis */ + float *synthFB, /* i/o: FB synthesis */ + float *A, /* i : A(z) filter coefficients */ + const int16_t bfi, /* i : Bad frame indicator */ + const int16_t MCT_flag /* i : hMCT handle allocated (1) or not (0) */ ) { int16_t i; @@ -178,7 +177,7 @@ void decoder_tcx_post( /* PLC: [TCX: Fade-out] * PLC: update or retrieve the background level */ - if ( bfi == 0 && st->tcxonly && ( st->element_mode != IVAS_CPE_MDCT || isMCT ) && st->clas_dec == UNVOICED_CLAS ) + if ( bfi == 0 && st->tcxonly && ( st->element_mode != IVAS_CPE_MDCT || MCT_flag ) && st->clas_dec == UNVOICED_CLAS ) { minimumStatistics( hTcxDec->NoiseLevelMemory_bfi, &hTcxDec->NoiseLevelIndex_bfi, &hTcxDec->CurrLevelIndex_bfi, &hTcxDec->CngLevelBackgroundTrace_bfi, &hTcxDec->LastFrameLevel_bfi, level_syn, PLC_MIN_CNG_LEV, PLC_MIN_STAT_BUFF_SIZE ); } @@ -193,7 +192,7 @@ void decoder_tcx_post( { gainCNG = hTcxDec->CngLevelBackgroundTrace_bfi / ( level_syn + 0.01f ); - if ( st->element_mode == IVAS_CPE_MDCT && !isMCT ) + if ( st->element_mode == IVAS_CPE_MDCT && !MCT_flag ) { if ( st->nbLostCmpt > MDCT_ST_PLC_FADEOUT_MAX_CONC_FRAME + MDCT_ST_PLC_FADEOUT_TO_ZERO_LEN ) { @@ -1078,7 +1077,7 @@ void decoder_tcx_noisefilling( const int16_t *prm_sqQ, int16_t nf_seed, const int16_t bfi, /* i : Bad frame indicator */ - const int16_t isMCT, + const int16_t MCT_flag, const int16_t frame_cnt /* i : frame counter in the super frame*/ ) { @@ -1223,7 +1222,7 @@ void decoder_tcx_noisefilling( { /* set f to 1 to not fade out */ /* set f to 0 to immediately switch to white noise */ - if ( st->tcxonly && ( st->element_mode != IVAS_CPE_MDCT || isMCT ) ) + if ( st->tcxonly && ( st->element_mode != IVAS_CPE_MDCT || MCT_flag ) ) { f = 1.0f; } @@ -1262,7 +1261,7 @@ void decoder_tcx_noisefilling( noiseTiltFactor = 1.0f; tcxGetNoiseFillingTilt( A, L_frame, ( total_brate >= ACELP_13k20 && !st->rf_flag ), &noiseTiltFactor ); - if ( st->element_mode == IVAS_CPE_MDCT && !isMCT ) + if ( st->element_mode == IVAS_CPE_MDCT && !MCT_flag ) { TonalMDCTConceal_InsertNoise( st->hTonalMDCTConc, x, st->tonal_mdct_plc_active, &st->seed_tcx_plc, noiseTiltFactor, f, concealment_noise, hTcxDec->CngLevelBackgroundTrace_bfi, infoIGFStartLine ); } @@ -1905,15 +1904,15 @@ void decoder_tcx_IGF_mono( *-------------------------------------------------------------------*/ void decoder_tcx_IGF_stereo( - Decoder_State **sts, /* i/o: coder memory states */ - STEREO_MDCT_DEC_DATA_HANDLE hStereoMdct, /* i/o: MDCT stereo structure */ - int16_t ms_mask[NB_DIV][MAX_SFB], /* i : bandwise MS mask */ - float *x[CPE_CHANNELS][NB_DIV], /* o : de-quatized coefficients */ - const int16_t L_frame, /* i : frame length */ - const int16_t left_rect, /* i : left part is rectangular */ - const int16_t k, /* i : Subframe index */ - const int16_t bfi, /* i : bad frame indicator */ - const int16_t is_mct /* i : flag to signal MCT or SMDCT */ + Decoder_State **sts, /* i/o: coder memory states */ + STEREO_MDCT_DEC_DATA_HANDLE hStereoMdct, /* i/o: MDCT stereo structure */ + int16_t ms_mask[NB_DIV][MAX_SFB], /* i : bandwise MS mask */ + float *x[CPE_CHANNELS][NB_DIV], /* o : de-quatized coefficients */ + const int16_t L_frame, /* i : frame length */ + const int16_t left_rect, /* i : left part is rectangular */ + const int16_t k, /* i : Subframe index */ + const int16_t bfi, /* i : bad frame indicator */ + const int16_t MCT_flag /* i : hMCT handle allocated (1) or not (0) */ ) { int16_t coreMsMask[N_MAX]; @@ -1966,7 +1965,7 @@ void decoder_tcx_IGF_stereo( igfGridIdx = ( sts[0]->last_core == ACELP_CORE || ( left_rect && bfi ) ) ? IGF_GRID_LB_TRAN : IGF_GRID_LB_NORM; } - IGFDecApplyStereo( sts[0]->hIGFDec, sts[1]->hIGFDec, x[0][k], x[1][k], igfGridIdx, coreMsMask, hStereoMdct->IGFStereoMode[k] == SMDCT_BW_MS, bfi, is_mct ); + IGFDecApplyStereo( sts[0]->hIGFDec, sts[1]->hIGFDec, x[0][k], x[1][k], igfGridIdx, coreMsMask, hStereoMdct->IGFStereoMode[k] == SMDCT_BW_MS, bfi, MCT_flag ); } return; diff --git a/lib_dec/ivas_mct_dec_mct.c b/lib_dec/ivas_mct_dec_mct.c index b46320cbcd..2dd7b18d52 100644 --- a/lib_dec/ivas_mct_dec_mct.c +++ b/lib_dec/ivas_mct_dec_mct.c @@ -286,7 +286,7 @@ void mctStereoIGF_dec( /* stereo IGF decoding */ assert( ( sts[0]->core == sts[1]->core ) || ( hMCT->hBlockData[b]->hStereoMdct->mdct_stereo_mode[0] == SMDCT_DUAL_MONO ) ); - decoder_tcx_IGF_stereo( sts, hMCT->hBlockData[b]->hStereoMdct, hMCT->hBlockData[b]->mask, p_x, L_frame[0], left_rect[0], k, bfi, 1 /* <- is_mct */ ); + decoder_tcx_IGF_stereo( sts, hMCT->hBlockData[b]->hStereoMdct, hMCT->hBlockData[b]->mask, p_x, L_frame[0], left_rect[0], k, bfi, 1 /* MCT_flag */ ); } else { diff --git a/lib_dec/ivas_mdct_core_dec.c b/lib_dec/ivas_mdct_core_dec.c index 14de87546d..7fe27c4cd9 100644 --- a/lib_dec/ivas_mdct_core_dec.c +++ b/lib_dec/ivas_mdct_core_dec.c @@ -301,7 +301,7 @@ void ivas_mdct_dec_side_bits_frame_channel( int16_t *LFE_off, /* o : flag if LFE has content */ int16_t nTnsBitsTCX10[CPE_CHANNELS][NB_DIV], /* o : number of bits for TNS */ int16_t param[CPE_CHANNELS][DEC_NPRM_DIV * NB_DIV], /* i/o: parameters buffer */ - const int16_t MCT_flag, /* i : MCT tool active(1) or deactive(0) */ + const int16_t MCT_flag, /* i : hMCT handle allocated (1) or not (0)*/ const int16_t odd_channel_cpe /* i : flag cpe with odd nb of tc channels */ ) { @@ -433,19 +433,19 @@ void ivas_mdct_dec_side_bits_frame_channel( *-----------------------------------------------------------------*/ void ivas_mdct_core_invQ( - CPE_DEC_HANDLE hCPE, /* i/o: CPE handle */ - const int16_t LFE_off, /* i : flag if LFE content */ - int16_t nTnsBitsTCX10[CPE_CHANNELS][NB_DIV], /* i : number of TNS bits */ - int16_t p_param[CPE_CHANNELS][NB_DIV], /* i : pointer to param buffer */ - int16_t param_lpc[CPE_CHANNELS][NPRM_LPC_NEW], /* i : lpc parameters */ - int16_t param[CPE_CHANNELS][DEC_NPRM_DIV * NB_DIV], /* i : param buffer */ - int16_t fUseTns[CPE_CHANNELS][NB_DIV], /* i : flag TNS enabled */ - STnsData tnsData[CPE_CHANNELS][NB_DIV], /* i : TNS parameter */ - float *x_0[CPE_CHANNELS][NB_DIV], /* i/o: signal buffer */ - float *x[CPE_CHANNELS][NB_DIV], /* i/o: signal buffer */ - float Aq[CPE_CHANNELS][( NB_SUBFR16k + 1 ) * ( M + 1 )], /* i : LP coefficients */ - int16_t ms_mask[NB_DIV][MAX_SFB], /* i : M/S mask */ - const int16_t isMCT /* i : MCT flag */ + CPE_DEC_HANDLE hCPE, /* i/o: CPE handle */ + const int16_t LFE_off, /* i : flag if LFE content */ + int16_t nTnsBitsTCX10[CPE_CHANNELS][NB_DIV], /* i : number of TNS bits */ + int16_t p_param[CPE_CHANNELS][NB_DIV], /* i : pointer to param buffer */ + int16_t param_lpc[CPE_CHANNELS][NPRM_LPC_NEW], /* i : lpc parameters */ + int16_t param[CPE_CHANNELS][DEC_NPRM_DIV * NB_DIV], /* i : param buffer */ + int16_t fUseTns[CPE_CHANNELS][NB_DIV], /* i : flag TNS enabled */ + STnsData tnsData[CPE_CHANNELS][NB_DIV], /* i : TNS parameter */ + float *x_0[CPE_CHANNELS][NB_DIV], /* i/o: signal buffer */ + float *x[CPE_CHANNELS][NB_DIV], /* i/o: signal buffer */ + float Aq[CPE_CHANNELS][( NB_SUBFR16k + 1 ) * ( M + 1 )], /* i : LP coefficients */ + int16_t ms_mask[NB_DIV][MAX_SFB], /* i : M/S mask */ + const int16_t MCT_flag /* i : hMCT handle allocated (1) or not (0) */ ) { int16_t ch, bfi, k; @@ -491,7 +491,7 @@ void ivas_mdct_core_invQ( } /* temporarily restore LR representation of previous frame for PLC mode decision (done on the individual channels) */ - if ( bfi && !isMCT && ( hCPE->hStereoMdct->mdct_stereo_mode[0] > SMDCT_DUAL_MONO || hCPE->hStereoMdct->mdct_stereo_mode[1] > SMDCT_DUAL_MONO ) ) + if ( bfi && !MCT_flag && ( hCPE->hStereoMdct->mdct_stereo_mode[0] > SMDCT_DUAL_MONO || hCPE->hStereoMdct->mdct_stereo_mode[1] > SMDCT_DUAL_MONO ) ) { L_frameTCX[0] = sts[0]->L_frameTCX_past; #ifdef FIX_TCX10_STEREO_PROC @@ -613,7 +613,7 @@ void ivas_mdct_core_invQ( } } - if ( bfi && !isMCT && ( hCPE->hStereoMdct->mdct_stereo_mode[0] > SMDCT_DUAL_MONO || hCPE->hStereoMdct->mdct_stereo_mode[1] > SMDCT_DUAL_MONO ) ) + if ( bfi && !MCT_flag && ( hCPE->hStereoMdct->mdct_stereo_mode[0] > SMDCT_DUAL_MONO || hCPE->hStereoMdct->mdct_stereo_mode[1] > SMDCT_DUAL_MONO ) ) { /* avoid using TD-PLC in only one channel when stereo mode isn't dual mono */ if ( sts[0]->core != sts[1]->core && ( sts[0]->core == ACELP_CORE || sts[1]->core == ACELP_CORE ) ) @@ -722,11 +722,11 @@ void ivas_mdct_core_invQ( mvr2r( x[ch][k], x_0[ch][k], L_frameTCX[ch] ); - if ( bfi && !isMCT ) + if ( bfi && !MCT_flag ) { TonalMdctConceal_create_concealment_noise( concealment_noise[ch], hCPE, L_frameTCX[ch], L_frame[ch], ch, k, st->core, st->hTcxDec->cummulative_damping_tcx, noise_gen_mode_bfi ); } - decoder_tcx_noisefilling( st, concealment_noise[ch], Aq[ch], L_frameTCX_global[ch], L_spec[ch], L_frame[ch], L_frameTCX[ch], x[ch][k], NULL, &tmp_concealment_method, gain_tcx, prm_sqQ, nf_seed, bfi, isMCT, k ); + decoder_tcx_noisefilling( st, concealment_noise[ch], Aq[ch], L_frameTCX_global[ch], L_spec[ch], L_frame[ch], L_frameTCX[ch], x[ch][k], NULL, &tmp_concealment_method, gain_tcx, prm_sqQ, nf_seed, bfi, MCT_flag, k ); decoder_tcx_noiseshaping_igf( st, L_spec[ch], L_frame[ch], L_frameTCX[ch], left_rect[ch], x[ch][k], NULL, &tmp_concealment_method, bfi ); @@ -752,12 +752,12 @@ void ivas_mdct_core_invQ( *-----------------------------------------------------------------*/ void ivas_mdct_core_reconstruct( - CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ - float *x[][NB_DIV], /* i/o: synthesis @internal_FS */ - float signal_outFB[CPE_CHANNELS][L_FRAME_PLUS], /* o : synthesis @output_FS */ - const int16_t LFE_off, /* i : flag if LFE content */ - int16_t fUseTns[CPE_CHANNELS][NB_DIV], /* i : flage TNS enabled */ - const int16_t isMCT /* i : MCT flag */ + CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ + float *x[][NB_DIV], /* i/o: synthesis @internal_FS */ + float signal_outFB[CPE_CHANNELS][L_FRAME_PLUS], /* o : synthesis @output_FS */ + const int16_t LFE_off, /* i : flag if LFE content */ + int16_t fUseTns[CPE_CHANNELS][NB_DIV], /* i : flage TNS enabled */ + const int16_t MCT_flag /* i : hMCT handle allocated (1) or not (0)*/ ) { int16_t ch, k, bfi; @@ -843,13 +843,13 @@ void ivas_mdct_core_reconstruct( TonalMDCTConceal_SaveTimeSignal( st->hTonalMDCTConc, synthFB, L_frameTCX[ch] ); } - decoder_tcx_post( st, synth, synthFB, NULL, bfi, isMCT ); + decoder_tcx_post( st, synth, synthFB, NULL, bfi, MCT_flag ); } else /*ACELP core for ACELP-PLC */ { assert( st->bfi == 1 ); /* PLC: [TCX: TD PLC] */ - if ( isMCT ) + if ( MCT_flag ) { con_tcx( st, &synthFB[0], -1.f, NULL, 0, NULL ); } @@ -946,7 +946,7 @@ void ivas_mdct_core_reconstruct( } /* calculate coherence of signal needed when next frame is lost */ - if ( !bfi && !isMCT && hCPE->element_mode == IVAS_CPE_MDCT ) + if ( !bfi && !MCT_flag && hCPE->element_mode == IVAS_CPE_MDCT ) { int16_t i; @@ -976,13 +976,13 @@ void ivas_mdct_core_reconstruct( *-----------------------------------------------------------------*/ void ivas_mdct_core_tns_ns( - CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ - const int16_t LFE_off, /* i : flag if LFE has content */ - int16_t fUseTns[CPE_CHANNELS][NB_DIV], /* i : two entries for each channel in TCX10 */ - STnsData tnsData[CPE_CHANNELS][NB_DIV], /* o : TNS parameter */ - float *x[CPE_CHANNELS][NB_DIV], /* o : synthesis @internal_FS */ - float Aq[CPE_CHANNELS][( NB_SUBFR16k + 1 ) * ( M + 1 )], /* o : LP coefficients */ - const int16_t isMCT /* i : MCT flag */ + CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ + const int16_t LFE_off, /* i : flag if LFE has content */ + int16_t fUseTns[CPE_CHANNELS][NB_DIV], /* i : two entries for each channel in TCX10 */ + STnsData tnsData[CPE_CHANNELS][NB_DIV], /* o : TNS parameter */ + float *x[CPE_CHANNELS][NB_DIV], /* o : synthesis @internal_FS */ + float Aq[CPE_CHANNELS][( NB_SUBFR16k + 1 ) * ( M + 1 )], /* o : LP coefficients */ + const int16_t MCT_flag /* i : hMCT handle allocated (1) or not (0) */ ) { int16_t ch, k, bfi; @@ -1034,7 +1034,7 @@ void ivas_mdct_core_tns_ns( { sns_interpolate_scalefactors( &sns_int_scf[0], &Aq[ch][k * M], DEC ); - if ( isMCT && st->hTonalMDCTConc != NULL && ( ( k + 1 ) == nSubframes[ch] ) ) + if ( MCT_flag && st->hTonalMDCTConc != NULL && ( ( k + 1 ) == nSubframes[ch] ) ) { TonalMDCTConceal_SaveFreqSignal( st->hTonalMDCTConc, x[ch][k], L_frameTCX[ch], L_frame[ch], &sns_int_scf[0], get_igf_startline( st, L_frame[ch], L_frameTCX[ch] ) ); } @@ -1043,7 +1043,7 @@ void ivas_mdct_core_tns_ns( { if ( st->hTonalMDCTConc != NULL ) { - if ( !isMCT && st->hTcxDec->cummulative_damping_tcx != 1.f ) + if ( !MCT_flag && st->hTcxDec->cummulative_damping_tcx != 1.f ) { float *scf_last, *scf_bg; float fade_in, fade_out; @@ -1084,7 +1084,7 @@ void ivas_mdct_core_tns_ns( TonalMDCTConceal_Apply( st->hTonalMDCTConc, x[ch][0], st->hTcxCfg->psychParamsCurrent ); } - if ( ( bfi || isMCT ) && st->hTonalMDCTConc != NULL ) + if ( ( bfi || MCT_flag ) && st->hTonalMDCTConc != NULL ) { TonalMDCTConceal_UpdateState( st->hTonalMDCTConc, L_frameTCX[ch], ( st->hTcxDec->tcxltp_last_gain_unmodified > 0 ) ? st->old_fpitch : 0, bfi, bfi && st->tonal_mdct_plc_active ); } diff --git a/lib_dec/ivas_stereo_mdct_core_dec.c b/lib_dec/ivas_stereo_mdct_core_dec.c index 141858ccf8..82ad3fc95b 100644 --- a/lib_dec/ivas_stereo_mdct_core_dec.c +++ b/lib_dec/ivas_stereo_mdct_core_dec.c @@ -292,7 +292,7 @@ void stereo_mdct_core_dec( assert( ( sts[0]->core == sts[1]->core ) || ( hCPE->hStereoMdct->mdct_stereo_mode[0] == SMDCT_DUAL_MONO ) ); /* stereo IGF decoding */ - decoder_tcx_IGF_stereo( sts, hCPE->hStereoMdct, ms_mask, x, L_frame[0], left_rect[0], k, bfi, 0 /* <- is_mct */ ); + decoder_tcx_IGF_stereo( sts, hCPE->hStereoMdct, ms_mask, x, L_frame[0], left_rect[0], k, bfi, 0 /* MCT_flag */ ); } else { diff --git a/lib_dec/ivas_tcx_core_dec.c b/lib_dec/ivas_tcx_core_dec.c index 9420be9eb9..41196b6b02 100644 --- a/lib_dec/ivas_tcx_core_dec.c +++ b/lib_dec/ivas_tcx_core_dec.c @@ -61,9 +61,9 @@ static void dec_prm_tcx( Decoder_State *st, int16_t param[], int16_t param_lpc[] *-------------------------------------------------------------*/ void stereo_tcx_init_dec( - Decoder_State *st, /* i/o: decoder state structure */ - const int16_t is_mct, /* i : MCT mode flag */ - const int16_t last_element_mode /* i : element mode of previous frame */ + Decoder_State *st, /* i/o: decoder state structure */ + const int16_t MCT_flag, /* i : hMCT handle allocated (1) or not (0)*/ + const int16_t last_element_mode /* i : element mode of previous frame */ ) { int16_t frame_size_index; @@ -103,7 +103,7 @@ void stereo_tcx_init_dec( if ( st->element_mode == IVAS_SCE ) { - st->tcxonly = getTcxonly( st->element_mode, st->bits_frame_nominal * FRAMES_PER_SEC, is_mct ); + st->tcxonly = getTcxonly( st->element_mode, st->bits_frame_nominal * FRAMES_PER_SEC, MCT_flag ); /* LPC quantization */ if ( st->sr_core <= INT_FS_16k && st->tcxonly == 0 ) @@ -150,7 +150,7 @@ void stereo_tcx_init_dec( } /* Reconfigure Core */ - mode_switch_decoder_LPD( st, st->bwidth, st->bits_frame_nominal * FRAMES_PER_SEC, st->last_bits_frame_nominal * FRAMES_PER_SEC, frame_size_index, is_mct, last_element_mode ); + mode_switch_decoder_LPD( st, st->bwidth, st->bits_frame_nominal * FRAMES_PER_SEC, st->last_bits_frame_nominal * FRAMES_PER_SEC, frame_size_index, MCT_flag, last_element_mode ); } return; diff --git a/lib_enc/cod_tcx.c b/lib_enc/cod_tcx.c index 2ac9ca9aca..f60ac1a314 100644 --- a/lib_enc/cod_tcx.c +++ b/lib_enc/cod_tcx.c @@ -943,7 +943,7 @@ void EstimateStereoTCXNoiseLevel( const int16_t ignore_chan[], /* i : flag indicating whether the channel should be ignored */ float fac_ns[][NB_DIV], /* o : noise filling level */ int16_t param_core[][NB_DIV * NPRM_DIV], /* o : quantized noise filling level */ - const int16_t is_mct /* i : is mct flag */ + const int16_t MCT_flag /* i : hMCT handle allocated (1) or not (0) */ ) { int16_t ch, n; @@ -964,7 +964,7 @@ void EstimateStereoTCXNoiseLevel( { continue; } - total_brate = ( st->element_mode == IVAS_CPE_MDCT && !is_mct ) ? st->element_brate : st->total_brate; + total_brate = ( st->element_mode == IVAS_CPE_MDCT && !MCT_flag ) ? st->element_brate : st->total_brate; for ( n = 0; n < nSubframes; n++ ) { diff --git a/lib_enc/core_enc_init.c b/lib_enc/core_enc_init.c index 333700164a..009185cc88 100644 --- a/lib_enc/core_enc_init.c +++ b/lib_enc/core_enc_init.c @@ -49,7 +49,7 @@ * Local function prototypes *-----------------------------------------------------------------------*/ -static void init_tcx( Encoder_State *st, const int16_t L_frame_old, const int32_t total_brate, const int32_t last_total_brate, const int16_t is_mct ); +static void init_tcx( Encoder_State *st, const int16_t L_frame_old, const int32_t total_brate, const int32_t last_total_brate, const int16_t MCT_flag ); static void init_sig_buffers( Encoder_State *st, const int16_t L_frame_old, const int16_t L_subfr, const int32_t total_brate, const int32_t last_total_brate ); static void init_core_sig_ana( Encoder_State *st ); static void init_acelp( Encoder_State *st, const int16_t L_frame_old, const int32_t total_brate, const int32_t last_total_brate ); @@ -62,16 +62,17 @@ static void init_modes( Encoder_State *st, const int32_t last_total_brate ); *-----------------------------------------------------------------------*/ void init_coder_ace_plus( - Encoder_State *st, - const int32_t last_total_brate, - const int16_t is_mct ) + Encoder_State *st, /* i : Encoder state */ + const int32_t last_total_brate, /* i : last total bitrate */ + const int16_t MCT_flag /* i : hMCT handle allocated (1) or not (0) */ +) { TCX_ENC_HANDLE hTcxEnc = st->hTcxEnc; int16_t L_frame_old; /*keep old frame size for switching */ int16_t L_subfr; /* Bitrate */ - st->tcxonly = getTcxonly( st->element_mode, st->total_brate, is_mct ); + st->tcxonly = getTcxonly( st->element_mode, st->total_brate, MCT_flag ); /* Core Sampling Rate */ st->sr_core = getCoreSamplerateMode2( st->element_mode, st->total_brate, st->bwidth, st->flag_ACELP16k, st->rf_mode ); @@ -167,7 +168,7 @@ void init_coder_ace_plus( /* Initialize TCX */ if ( hTcxEnc != NULL ) { - init_tcx( st, L_frame_old, st->total_brate, last_total_brate, is_mct ); + init_tcx( st, L_frame_old, st->total_brate, last_total_brate, MCT_flag ); } /* Initialize Signal Buffers */ @@ -252,7 +253,7 @@ static void init_tcx( const int16_t L_frame_old, const int32_t total_brate, const int32_t last_total_brate, - const int16_t is_mct ) + const int16_t MCT_flag ) { TCX_ENC_HANDLE hTcxEnc = st->hTcxEnc; @@ -260,7 +261,7 @@ static void init_tcx( hTcxEnc->spectrum[0] = hTcxEnc->spectrum_long; hTcxEnc->spectrum[1] = hTcxEnc->spectrum_long + N_TCX10_MAX; - init_tcx_cfg( st->hTcxCfg, total_brate, st->sr_core, st->input_Fs, st->L_frame, st->bwidth, hTcxEnc->L_frameTCX, st->fscale, st->encoderLookahead_enc, st->encoderLookahead_FB, st->preemph_fac, st->tcxonly, st->rf_mode, st->igf, st->hIGFEnc != NULL ? st->hIGFEnc->infoStopFrequency : 0, st->element_mode, st->ini_frame, is_mct, st->mct_chan_mode ); + init_tcx_cfg( st->hTcxCfg, total_brate, st->sr_core, st->input_Fs, st->L_frame, st->bwidth, hTcxEnc->L_frameTCX, st->fscale, st->encoderLookahead_enc, st->encoderLookahead_FB, st->preemph_fac, st->tcxonly, st->rf_mode, st->igf, st->hIGFEnc != NULL ? st->hIGFEnc->infoStopFrequency : 0, st->element_mode, st->ini_frame, MCT_flag, st->mct_chan_mode ); /* Init TCX target bits correction factor */ hTcxEnc->tcx_target_bits_fac = 1.0f; diff --git a/lib_enc/core_enc_switch.c b/lib_enc/core_enc_switch.c index ca92135736..f96d0eed57 100644 --- a/lib_enc/core_enc_switch.c +++ b/lib_enc/core_enc_switch.c @@ -50,9 +50,10 @@ *-------------------------------------------------------------------*/ void core_coder_mode_switch( - Encoder_State *st, - const int32_t last_total_brate, - const int16_t is_mct ) + Encoder_State *st, /* i/o: encoder state structure */ + const int32_t last_total_brate, /* i : last bitrate */ + const int16_t MCT_flag /* i : hMCT handle allocated (1) or not (0)*/ +) { TCX_ENC_HANDLE hTcxEnc = st->hTcxEnc; int16_t i, fscale, switchWB; @@ -78,7 +79,7 @@ void core_coder_mode_switch( switchWB = 1; /*force init when coming from MODE1*/ } - tcxonly_tmp = getTcxonly( st->element_mode, st->total_brate, is_mct ); + tcxonly_tmp = getTcxonly( st->element_mode, st->total_brate, MCT_flag ); if ( tcxonly_tmp != st->tcxonly ) { @@ -90,7 +91,7 @@ void core_coder_mode_switch( st->sr_core = sr_core; st->L_frame = (int16_t) ( sr_core / FRAMES_PER_SEC ); - st->tcxonly = getTcxonly( st->element_mode, st->total_brate, is_mct ); + st->tcxonly = getTcxonly( st->element_mode, st->total_brate, MCT_flag ); st->bits_frame_nominal = (int16_t) ( (float) st->L_frame / (float) st->fscale * (float) FSCALE_DENOM / 128.0f * (float) st->total_brate / 100.0f + 0.49f ); @@ -115,7 +116,7 @@ void core_coder_mode_switch( if ( st->hTcxCfg->fIsTNSAllowed ) { - InitTnsConfigs( st->bwidth, st->hTcxCfg->tcx_coded_lines, st->hTcxCfg->tnsConfig, st->hIGFEnc->infoStopFrequency, st->total_brate, st->element_mode, is_mct ); + InitTnsConfigs( st->bwidth, st->hTcxCfg->tcx_coded_lines, st->hTcxCfg->tnsConfig, st->hIGFEnc->infoStopFrequency, st->total_brate, st->element_mode, MCT_flag ); SetAllowTnsOnWhite( st->hTcxCfg->tnsConfig, st->element_mode == IVAS_CPE_MDCT ); } @@ -151,7 +152,7 @@ void core_coder_mode_switch( else { st->igf = getIgfPresent( st->element_mode, st->total_brate, st->bwidth, st->rf_mode, st->mct_chan_mode ); - init_coder_ace_plus( st, last_total_brate, is_mct ); + init_coder_ace_plus( st, last_total_brate, MCT_flag ); } if ( st->igf && st->hBWE_TD != NULL ) diff --git a/lib_enc/enc_prm.c b/lib_enc/enc_prm.c index a68f95aff6..cd606af8fb 100644 --- a/lib_enc/enc_prm.c +++ b/lib_enc/enc_prm.c @@ -53,10 +53,10 @@ *--------------------------------------------------------------------*/ void writeTCXMode( - Encoder_State *st, /* i/o: encoder state structure */ - BSTR_ENC_HANDLE hBstr, /* i/o: bitstream handle */ - const int16_t is_mct, - int16_t *nbits_start /* o : nbits start */ + Encoder_State *st, /* i/o: encoder state structure */ + BSTR_ENC_HANDLE hBstr, /* i/o: bitstream handle */ + const int16_t MCT_flag, /* i : hMCT handle allocated (1) or not (0) */ + int16_t *nbits_start /* o : nbits start */ ) { uint16_t index; @@ -86,7 +86,7 @@ void writeTCXMode( push_next_indice( hBstr, index, 2 ); - if ( st->element_mode == IVAS_CPE_MDCT && !is_mct ) + if ( st->element_mode == IVAS_CPE_MDCT && !MCT_flag ) { push_next_indice( hBstr, st->vad_flag, 1 ); } @@ -788,7 +788,7 @@ void enc_prm( /* EVS header */ /* Modes (ACE_GC, ACE_UC, TCX20, TCX10...) */ - writeTCXMode( st, st->hBstr, 0, /* <- is_mct */ &nbits_start ); + writeTCXMode( st, st->hBstr, 0 /* MCT_flag */, &nbits_start ); /* write last_core for error concealment */ if ( !( core == ACELP_CORE && st->hTcxCfg->lfacNext <= 0 ) ) diff --git a/lib_enc/ivas_core_enc.c b/lib_enc/ivas_core_enc.c index 3f9cb84b51..597f1d5854 100644 --- a/lib_enc/ivas_core_enc.c +++ b/lib_enc/ivas_core_enc.c @@ -86,7 +86,7 @@ ivas_error ivas_core_enc( ) { int16_t n, input_frame; - int16_t cpe_id, is_MCT; + int16_t cpe_id, MCT_flag; Encoder_State **sts, *st; STEREO_ICBWE_ENC_HANDLE hStereoICBWE; STEREO_TD_ENC_DATA_HANDLE hStereoTD; @@ -122,7 +122,7 @@ ivas_error ivas_core_enc( if ( hSCE != NULL ) { cpe_id = -1; - is_MCT = 0; + MCT_flag = 0; sts = hSCE->hCoreCoder; hStereoTD = NULL; hStereoICBWE = NULL; @@ -136,10 +136,10 @@ ivas_error ivas_core_enc( else { cpe_id = hCPE->cpe_id; - is_MCT = 0; + MCT_flag = 0; if ( hMCT != NULL ) { - is_MCT = 1; + MCT_flag = 1; } sts = hCPE->hCoreCoder; hStereoICBWE = hCPE->hStereoICBWE; @@ -188,9 +188,9 @@ ivas_error ivas_core_enc( *---------------------------------------------------------------------*/ #ifdef CORECODER_BITRATE_SWITCHING - if ( ( error = pre_proc_ivas( st, last_element_mode, element_brate, ivas_format == SBA_FORMAT ? last_element_brate : element_brate, input_frame, old_inp_12k8[n], old_inp_16k[n], &inp[n], &ener[n], A[n], Aw[n], epsP[n], lsp_new[n], lsp_mid[n], new_inp_resamp16k[n], &Voicing_flag[n], old_wsp[n], loc_harm[n], cor_map_sum[n], vad_flag_dtx[n], enerBuffer[n], fft_buff[n], is_MCT, vad_hover_flag[n], flag_16k_smc ) ) != IVAS_ERR_OK ) + if ( ( error = pre_proc_ivas( st, last_element_mode, element_brate, ivas_format == SBA_FORMAT ? last_element_brate : element_brate, input_frame, old_inp_12k8[n], old_inp_16k[n], &inp[n], &ener[n], A[n], Aw[n], epsP[n], lsp_new[n], lsp_mid[n], new_inp_resamp16k[n], &Voicing_flag[n], old_wsp[n], loc_harm[n], cor_map_sum[n], vad_flag_dtx[n], enerBuffer[n], fft_buff[n], MCT_flag, vad_hover_flag[n], flag_16k_smc ) ) != IVAS_ERR_OK ) #else - if ( ( error = pre_proc_ivas( st, last_element_mode, element_brate, input_frame, old_inp_12k8[n], old_inp_16k[n], &inp[n], &ener[n], A[n], Aw[n], epsP[n], lsp_new[n], lsp_mid[n], new_inp_resamp16k[n], &Voicing_flag[n], old_wsp[n], loc_harm[n], cor_map_sum[n], vad_flag_dtx[n], enerBuffer[n], fft_buff[n], is_MCT, vad_hover_flag[n], flag_16k_smc ) ) != IVAS_ERR_OK ) + if ( ( error = pre_proc_ivas( st, last_element_mode, element_brate, input_frame, old_inp_12k8[n], old_inp_16k[n], &inp[n], &ener[n], A[n], Aw[n], epsP[n], lsp_new[n], lsp_mid[n], new_inp_resamp16k[n], &Voicing_flag[n], old_wsp[n], loc_harm[n], cor_map_sum[n], vad_flag_dtx[n], enerBuffer[n], fft_buff[n], MCT_flag, vad_hover_flag[n], flag_16k_smc ) ) != IVAS_ERR_OK ) #endif { return error; @@ -214,9 +214,9 @@ ivas_error ivas_core_enc( * Write signaling info into the bitstream *---------------------------------------------------------------------*/ - if ( !is_MCT || ( is_MCT && cpe_id == 0 ) ) + if ( !MCT_flag || ( MCT_flag && cpe_id == 0 ) ) { - ivas_signaling_enc( st, is_MCT, element_brate, tdm_SM_or_LRTD_Pri, tdm_Pitch_reuse_flag ); + ivas_signaling_enc( st, MCT_flag, element_brate, tdm_SM_or_LRTD_Pri, tdm_Pitch_reuse_flag ); } /*---------------------------------------------------------------------* @@ -271,7 +271,7 @@ ivas_error ivas_core_enc( { if ( sts[0]->core_brate > SID_2k40 && sts[1]->core_brate > SID_2k40 ) { - if ( is_MCT ) + if ( MCT_flag ) { ivas_mdct_core_whitening_enc( hCPE, old_inp_16k, old_wsp, pitch_buf, hMCT->p_mdst_spectrum_long[cpe_id], hMCT->tnsBits[cpe_id], hMCT->p_orig_spectrum_long[cpe_id], hMCT->tnsSize[cpe_id], hMCT->p_param[cpe_id], hMCT->hBstr, &hMCT->LFE_off, 1, hMCT->nchan_out_woLFE + hMCT->num_lfe ); diff --git a/lib_enc/ivas_core_pre_proc.c b/lib_enc/ivas_core_pre_proc.c index ded3df2235..3cc206e65e 100644 --- a/lib_enc/ivas_core_pre_proc.c +++ b/lib_enc/ivas_core_pre_proc.c @@ -76,7 +76,7 @@ ivas_error pre_proc_ivas( const int16_t vad_flag_dtx, /* i : HE-SAD flag with additional DTX HO */ const float enerBuffer[CLDFB_NO_CHANNELS_MAX], /* i : energy buffer */ const float fft_buff[2 * L_FFT], /* i : FFT buffer */ - const int16_t is_mct, /* i : MCT mode flag */ + const int16_t MCT_flag, /* i : hMCT handle allocated (1) or not (0) */ const int16_t vad_hover_flag, /* i : VAD hangover flag */ const int16_t flag_16k_smc /* i : flag to indicate if the OL SMC is run at 16 kHz */ ) @@ -237,7 +237,7 @@ ivas_error pre_proc_ivas( /* Configure TCX with the same bitrate as given when (re-)initializing TCX */ total_brate_tmp = st->total_brate; st->total_brate = st->bits_frame_nominal * FRAMES_PER_SEC; - SetModeIndex( st, st->last_bits_frame_nominal * FRAMES_PER_SEC, last_element_mode, is_mct ); + SetModeIndex( st, st->last_bits_frame_nominal * FRAMES_PER_SEC, last_element_mode, MCT_flag ); st->sr_core = getCoreSamplerateMode2( element_mode, st->total_brate, st->bwidth, st->flag_ACELP16k, st->rf_mode ); st->total_brate = total_brate_tmp; @@ -281,7 +281,7 @@ ivas_error pre_proc_ivas( #ifdef CORECODER_BITRATE_SWITCHING else if ( element_brate != last_element_brate ) { - SetModeIndex( st, st->bits_frame_nominal * FRAMES_PER_SEC, element_mode, is_mct ); + SetModeIndex( st, st->bits_frame_nominal * FRAMES_PER_SEC, element_mode, MCT_flag ); } #endif diff --git a/lib_enc/ivas_decision_matrix_enc.c b/lib_enc/ivas_decision_matrix_enc.c index 49bb62e469..de6fe8dc96 100644 --- a/lib_enc/ivas_decision_matrix_enc.c +++ b/lib_enc/ivas_decision_matrix_enc.c @@ -374,11 +374,11 @@ void ivas_decision_matrix_enc( *---------------------------------------------------------------------*/ void ivas_signaling_enc( - Encoder_State *st, /* i/o: encoder state structure */ - const int16_t is_MCT, /* i : MCT enabled */ - const int32_t element_brate, /* i : element bitrate */ + Encoder_State *st, /* i/o: encoder state structure */ + const int16_t MCT_flag, /* i : hMCT handle allocated (1) or not (0) */ + const int32_t element_brate, /* i : element bitrate */ const int16_t tdm_SM_or_LRTD_Pri, /* i : channel combination scheme flag in TD stereo OR LRTD primary channel */ - const int16_t tdm_Pitch_reuse_flag /* i : primary channel pitch reuse flag in TD stereo */ + const int16_t tdm_Pitch_reuse_flag /* i : primary channel pitch reuse flag in TD stereo */ ) { int16_t ind; @@ -405,7 +405,7 @@ void ivas_signaling_enc( * Write element mode info *--------------------------------------------------------------------------*/ - if ( st->element_mode >= IVAS_CPE_DFT && element_brate < MIN_BRATE_MDCT_STEREO && !is_MCT ) /* note: in MCT, the MDCT stereo is used exclusively */ + if ( st->element_mode >= IVAS_CPE_DFT && element_brate < MIN_BRATE_MDCT_STEREO && !MCT_flag ) /* note: in MCT, the MDCT stereo is used exclusively */ { ind = st->element_mode - IVAS_CPE_DFT; push_indice( hBstr, IND_SMODE, ind, NBITS_ELEMENT_MODE ); diff --git a/lib_enc/ivas_front_vad.c b/lib_enc/ivas_front_vad.c index 09fd624ca5..1d18af7761 100644 --- a/lib_enc/ivas_front_vad.c +++ b/lib_enc/ivas_front_vad.c @@ -57,7 +57,7 @@ ivas_error front_vad( Encoder_State *st, /* i/o: encoder state structure */ const ENCODER_CONFIG_HANDLE hEncoderConfig, /* i : configuration structure */ FRONT_VAD_ENC_HANDLE *hFrontVads, /* i/o: FrontVad handles */ - const int16_t hMCT_flag, /* i : hMCT handle allocated (1) or not (0) */ + const int16_t MCT_flag, /* i : hMCT handle allocated (1) or not (0) */ const int16_t input_frame, /* i : frame length */ int16_t vad_flag_dtx[], /* o : HE-SAD flag with additional DTX HO */ float fr_bands[][2 * NB_BANDS], /* i : energy in frequency bands */ @@ -116,7 +116,7 @@ ivas_error front_vad( * Allocate/deallocate hFrontVad handles in case of element_mode change *-----------------------------------------------------------------*/ - if ( sts[0]->ini_frame > 0 && hMCT_flag == 0 && last_element_mode != element_mode ) + if ( sts[0]->ini_frame > 0 && MCT_flag == 0 && last_element_mode != element_mode ) { if ( element_mode == IVAS_CPE_MDCT ) { @@ -422,7 +422,7 @@ ivas_error front_vad_spar( * Front-VAD *-----------------------------------------------------------------*/ - if ( ( error = front_vad( NULL, st, hEncoderConfig, &hFrontVad, 0 /* hMCT_flag */, input_frame, vad_flag_dtx, fr_bands, Etot, lf_E, localVAD_HE_SAD, vad_hover_flag, band_energies, &PS[0], &st->Bin_E[0] ) ) != IVAS_ERR_OK ) + if ( ( error = front_vad( NULL, st, hEncoderConfig, &hFrontVad, 0 /* MCT_flag */, input_frame, vad_flag_dtx, fr_bands, Etot, lf_E, localVAD_HE_SAD, vad_hover_flag, band_energies, &PS[0], &st->Bin_E[0] ) ) != IVAS_ERR_OK ) { return error; } diff --git a/lib_enc/ivas_mdct_core_enc.c b/lib_enc/ivas_mdct_core_enc.c index 5234ae5c60..f516af2310 100644 --- a/lib_enc/ivas_mdct_core_enc.c +++ b/lib_enc/ivas_mdct_core_enc.c @@ -63,8 +63,8 @@ static void enc_prm_pre_mdct( int16_t param[], /* i : parameters */ const int16_t *no_param_tns, /* i : number of TNS parameters per subframe */ int16_t p_param[2], /* o : pointer to parameters for next round of bs writing */ - const int16_t is_mct, - BSTR_ENC_HANDLE hBstr /* i/o: encoder bitstream handle */ + const int16_t MCT_flag, /* i : hMCT handle allocated (1) or not (0) */ + BSTR_ENC_HANDLE hBstr /* i/o: encoder bitstream handle */ ) { int16_t nbits_start; @@ -78,7 +78,7 @@ static void enc_prm_pre_mdct( * Header *--------------------------------------------------------------------------------*/ - writeTCXMode( st, hBstr, is_mct, &nbits_start ); + writeTCXMode( st, hBstr, MCT_flag, &nbits_start ); /* write last_core for core switching and error concealment */ push_next_indice( hBstr, st->last_core != ACELP_CORE, 1 ); @@ -1151,12 +1151,12 @@ void ivas_mdct_core_whitening_enc( *---------------------------------------------------------------*/ void ivas_mdct_quant_coder( - CPE_ENC_HANDLE hCPE, /* i/o: Encoder CPE handle */ - const int16_t LFE_off, /* i : flag if LFE is inactive */ - int16_t tnsBits[CPE_CHANNELS][NB_DIV], /* i : bits needed for TNS parameters */ - int16_t tnsSize[CPE_CHANNELS][NB_DIV], /* i : size of TNS */ - int16_t p_param[CPE_CHANNELS][NB_DIV], /* i : pointer to parameter array */ - const int16_t is_mct /* i : is mct flag */ + CPE_ENC_HANDLE hCPE, /* i/o: Encoder CPE handle */ + const int16_t LFE_off, /* i : flag if LFE is inactive */ + int16_t tnsBits[CPE_CHANNELS][NB_DIV], /* i : bits needed for TNS parameters */ + int16_t tnsSize[CPE_CHANNELS][NB_DIV], /* i : size of TNS */ + int16_t p_param[CPE_CHANNELS][NB_DIV], /* i : pointer to parameter array */ + const int16_t MCT_flag /* i : hMCT handle allocated (1) or not (0) */ ) { Encoder_State *st, **sts; @@ -1252,7 +1252,7 @@ void ivas_mdct_quant_coder( } } - EstimateStereoTCXNoiseLevel( sts, quantized_spectrum, gain_tcx, L_frame, noiseFillingBorder, hm_active, ignore_chan, fac_ns, param_core, is_mct ); + EstimateStereoTCXNoiseLevel( sts, quantized_spectrum, gain_tcx, L_frame, noiseFillingBorder, hm_active, ignore_chan, fac_ns, param_core, MCT_flag ); for ( ch = 0; ch < CPE_CHANNELS; ch++ ) { diff --git a/lib_enc/ivas_tcx_core_enc.c b/lib_enc/ivas_tcx_core_enc.c index 2c1e4a9051..e8cfaf6697 100644 --- a/lib_enc/ivas_tcx_core_enc.c +++ b/lib_enc/ivas_tcx_core_enc.c @@ -268,7 +268,7 @@ void stereo_tcx_core_enc( *--------------------------------------------------------------------------------*/ /* TCX20/TCX10 and coder type */ - writeTCXMode( st, hBstr, 0, /* <- is_mct */ &nbits_start ); + writeTCXMode( st, hBstr, 0, /* MCT_flag */ &nbits_start ); /* write last_core for error concealment */ push_next_indice( hBstr, ( st->last_core != ACELP_CORE || st->core == TCX_10_CORE ), 1 ); diff --git a/lib_enc/setmodeindex.c b/lib_enc/setmodeindex.c index 199933fbaf..67d2d9d710 100644 --- a/lib_enc/setmodeindex.c +++ b/lib_enc/setmodeindex.c @@ -55,10 +55,11 @@ ---------------------------------------------------------------------------*/ void SetModeIndex( - Encoder_State *st, - const int32_t last_total_brate, - const int16_t last_element_mode, - const int16_t is_mct ) + Encoder_State *st, /* i : Encoder state */ + const int32_t last_total_brate, /* i : last total bitrate */ + const int16_t last_element_mode, /* i : last IVAS element mode */ + const int16_t MCT_flag /* i : hMCT handle allocated (1) or not (0) */ +) { int16_t ini_frame_loc = st->ini_frame; @@ -75,10 +76,9 @@ void SetModeIndex( ( st->rf_mode_last != st->rf_mode ) || ( st->element_mode > EVS_MONO && st->ini_frame == 0 ) ) { - core_coder_mode_switch( st, last_total_brate, is_mct ); + core_coder_mode_switch( st, last_total_brate, MCT_flag ); } - st->ini_frame = ini_frame_loc; return; -- GitLab