From 9cdc6b22fe3f32bd45b5c8f00a1af65edd6eebd8 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Fri, 8 Mar 2024 16:06:03 +0530 Subject: [PATCH] IVAS encoder structure commonization for EVS/IVAS --- apps/encoder.c | 5 +- apps/renderer.c | 4 +- lib_com/bitstream_fx.c | 4 +- lib_com/cldfb_evs.c | 10 +- lib_com/ivas_prot.h | 3 +- lib_com/lsf_tools_fx.c | 4 +- lib_com/prot_fx2.h | 18 +- lib_com/residu_fx.c | 4 +- lib_enc/FEC_enc_fx.c | 20 +- lib_enc/acelp_core_enc_fx.c | 142 ++-- lib_enc/acelp_core_switch_enc_fx.c | 50 +- lib_enc/amr_wb_enc_fx.c | 106 +-- lib_enc/arith_coder_enc_fx.c | 2 +- lib_enc/bw_detect_fx.c | 210 ++--- lib_enc/cng_enc_fx.c | 120 +-- lib_enc/cod_ace_fx.c | 18 +- lib_enc/cod_tcx_fx.c | 96 +-- lib_enc/core_enc_2div_fx.c | 36 +- lib_enc/core_enc_init_fx.c | 228 +++--- lib_enc/core_enc_ol_fx.c | 128 +-- lib_enc/core_enc_reconf_fx.c | 38 +- lib_enc/core_enc_switch_fx.c | 70 +- lib_enc/core_enc_updt_fx.c | 60 +- lib_enc/core_switching_enc_fx.c | 108 +-- lib_enc/decision_matrix_enc_fx.c | 216 ++--- lib_enc/detect_transient_fx.c | 36 +- lib_enc/dtx_fx.c | 142 ++-- lib_enc/enc_acelp_tcx_main_fx.c | 20 +- lib_enc/enc_amr_wb_fx.c | 20 +- lib_enc/enc_gen_voic_fx.c | 32 +- lib_enc/enc_gen_voic_rf_fx.c | 16 +- lib_enc/enc_higher_acelp_fx.c | 18 +- lib_enc/enc_nelp_fx.c | 8 +- lib_enc/enc_pit_exc_fx.c | 44 +- lib_enc/enc_ppp_fx.c | 14 +- lib_enc/enc_prm_fx.c | 30 +- lib_enc/enc_tran_fx.c | 22 +- lib_enc/enc_uv_fx.c | 10 +- lib_enc/eval_pit_contr_fx.c | 42 +- lib_enc/evs_enc_fx.c | 168 ++-- lib_enc/ext_sig_ana_fx.c | 16 +- lib_enc/fd_cng_enc_fx.c | 168 ++-- lib_enc/find_uv_fx.c | 54 +- lib_enc/gaus_enc_fx.c | 2 +- lib_enc/gs_enc_fx.c | 110 +-- lib_enc/guided_plc_enc_fx.c | 12 +- lib_enc/hq_classifier_enc_fx.c | 34 +- lib_enc/hq_core_enc_fx.c | 20 +- lib_enc/hq_hr_enc_fx.c | 10 +- lib_enc/hq_lr_enc_fx.c | 48 +- lib_enc/hvq_enc_fx.c | 4 +- lib_enc/igf_enc_fx.c | 2 +- lib_enc/init_enc_fx.c | 164 ++-- lib_enc/inov_enc_fx.c | 4 +- lib_enc/isf_enc_amr_wb_fx.c | 12 +- lib_enc/ivas_init_enc.c | 21 +- lib_enc/ivas_sce_enc.c | 85 +- lib_enc/ivas_stat_enc.h | 6 +- lib_enc/lib_enc.c | 102 +-- lib_enc/lib_enc.h | 2 - lib_enc/long_enr_fx.c | 6 +- lib_enc/lsf_enc_fx.c | 50 +- lib_enc/mdct_classifier_fx.c | 14 +- lib_enc/mdct_selector_fx.c | 24 +- lib_enc/nelp_enc_fx.c | 22 +- lib_enc/nois_est_fx.c | 28 +- lib_enc/ppp_enc_fx.c | 20 +- lib_enc/pre_proc_fx.c | 258 +++--- lib_enc/prot_fx_enc.h | 238 +++--- lib_enc/qlpc_stoch_fx.c | 12 +- lib_enc/rst_enc_fx.c | 8 +- lib_enc/setmodeindex_fx.c | 16 +- lib_enc/sig_clas_fx.c | 40 +- lib_enc/speech_music_classif_fx.c | 74 +- lib_enc/stat_enc.h | 1224 +++++++++++++++------------- lib_enc/stat_noise_uv_enc_fx.c | 16 +- lib_enc/swb_bwe_enc_fx.c | 84 +- lib_enc/swb_bwe_enc_hr_fx.c | 26 +- lib_enc/swb_bwe_enc_lr_fx.c | 4 +- lib_enc/swb_pre_proc_fx.c | 64 +- lib_enc/swb_tbe_enc_fx.c | 138 ++-- lib_enc/tcx_utils_enc_fx.c | 18 +- lib_enc/tns_base_enc_fx.c | 2 +- lib_enc/transient_detection_fx.c | 6 +- lib_enc/transition_enc_fx.c | 66 +- lib_enc/updt_enc_fx.c | 98 +-- lib_enc/vad_fx.c | 58 +- lib_enc/vad_param_updt_fx.c | 14 +- lib_enc/vbr_average_rate_fx.c | 2 +- lib_enc/voiced_enc_fx.c | 4 +- lib_util/audio_file_reader.c | 5 +- lib_util/audio_file_reader.h | 3 +- 92 files changed, 2939 insertions(+), 2901 deletions(-) diff --git a/apps/encoder.c b/apps/encoder.c index 6b110851e..c08116795 100644 --- a/apps/encoder.c +++ b/apps/encoder.c @@ -414,13 +414,12 @@ int main( /*------------------------------------------------------------------------------------------* * Open input audio file *------------------------------------------------------------------------------------------*/ - short isInputRawFile; - if ( AudioFileReader_open( &audioReader, arg.inputWavFilename, &isInputRawFile ) != IVAS_ERR_OK ) + + if ( AudioFileReader_open( &audioReader, arg.inputWavFilename ) != IVAS_ERR_OK ) { fprintf( stderr, "\nCan't open %s\n\n", arg.inputWavFilename ); goto cleanup; } - set_raw_file_flag( hIvasEnc, isInputRawFile ); /* Validate input sampling rate */ int32_t inFileSampleRate = 0; diff --git a/apps/renderer.c b/apps/renderer.c index 232506c6c..bbc4213a1 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -780,8 +780,8 @@ int main( exit( -1 ); } } - short ignore; - if ( AudioFileReader_open( &audioReader, audioFilePath, &ignore ) != IVAS_ERR_OK ) + + if ( AudioFileReader_open( &audioReader, audioFilePath ) != IVAS_ERR_OK ) { fprintf( stderr, "Error opening file: %s\n", audioFilePath ); exit( -1 ); diff --git a/lib_com/bitstream_fx.c b/lib_com/bitstream_fx.c index 21ed5faa5..c75094595 100644 --- a/lib_com/bitstream_fx.c +++ b/lib_com/bitstream_fx.c @@ -665,7 +665,7 @@ void write_indices_fx( *-------------------------------------------------------------------*/ void write_indices_buf_fx( - Encoder_State_fx *st_fx, /* i/o: encoder state structure */ + Encoder_State *st_fx, /* i/o: encoder state structure */ BSTR_ENC_HANDLE hBstr, /* i/o: encoder state structure */ UWord16 *out_buf, /* i : output bitstream buf */ UWord8 *pFrame, /* i: byte array with bit packet and byte aligned coded speech data */ @@ -726,7 +726,7 @@ void write_indices_buf_fx( { /* Create and write ToC header */ /* qbit always set to 1 on encoder side for AMRWBIO , no qbit in use for EVS, but set to 0(bad) */ - header = (UWord8) ( st_fx->Opt_AMR_WB_fx << 5 | st_fx->Opt_AMR_WB_fx << 4 | rate2EVSmode( hBstr->nb_bits_tot_fx * 50, &isAmrWb ) ); + header = (UWord8) ( st_fx->Opt_AMR_WB << 5 | st_fx->Opt_AMR_WB << 4 | rate2EVSmode( hBstr->nb_bits_tot_fx * 50, &isAmrWb ) ); // fwrite(&header, sizeof(UWord8), 1, file); memcpy( out_buf, &header, sizeof( UWord8 ) ); *num_bits += sizeof( UWord8 ); diff --git a/lib_com/cldfb_evs.c b/lib_com/cldfb_evs.c index 7f17f4f15..63b3030fa 100644 --- a/lib_com/cldfb_evs.c +++ b/lib_com/cldfb_evs.c @@ -1183,7 +1183,7 @@ AnalysisPostSpectrumScaling_Fx (HANDLE_CLDFB_FILTER_BANK cldfbBank, /*!< Handle *--------------------------------------------------------------------*/ void analysisCldfbEncoder_fx( - Encoder_State_fx *st_fx, /* i/o: encoder state structure */ + Encoder_State *st_fx, /* i/o: encoder state structure */ const Word16 *timeIn, Word32 realBuffer[CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], Word32 imagBuffer[CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], @@ -1213,7 +1213,7 @@ void analysisCldfbEncoder_fx( /* perform analysis */ cldfbAnalysisFiltering ( - st_fx->cldfbAna_Fx, + st_fx->cldfbAnaEnc, ppBuf_Real, ppBuf_Imag, scale, @@ -1228,7 +1228,7 @@ void analysisCldfbEncoder_fx( /* get 16bit respresentation */ AnalysisPostSpectrumScaling_Fx ( - st_fx->cldfbAna_Fx, + st_fx->cldfbAnaEnc, ppBuf_Real, ppBuf_Imag, ppBuf_Real16, @@ -1243,8 +1243,8 @@ void analysisCldfbEncoder_fx( ppBuf_Real16, ppBuf_Imag16, enerScale.lb_scale16, - st_fx->cldfbAna_Fx->no_channels, - st_fx->cldfbAna_Fx->no_col, + st_fx->cldfbAnaEnc->no_channels, + st_fx->cldfbAnaEnc->no_col, &st_fx->currEnergyHF_fx, &st_fx->currEnergyHF_e_fx, enerBuffSum, diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 021e9762b..775235c24 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -94,7 +94,8 @@ ivas_error create_sce_enc( ivas_error create_evs_sce_enc( Encoder_Struct *st_ivas, /* i/o: IVAS encoder structure */ - const int16_t sce_id /* i : SCE # identifier */ + const int16_t sce_id, /* i : SCE # identifier */ + const int32_t element_brate /* i : element bitrate */ ); ivas_error create_cpe_enc( diff --git a/lib_com/lsf_tools_fx.c b/lib_com/lsf_tools_fx.c index 816ffe3e0..e844a58ef 100644 --- a/lib_com/lsf_tools_fx.c +++ b/lib_com/lsf_tools_fx.c @@ -2648,7 +2648,7 @@ Word16 qlsf_ARSN_tcvq_Dec_16k_fx( /*=======================================================================*/ void lsf_syn_mem_backup_fx( - Encoder_State_fx *st_fx, /* i: state structure */ + Encoder_State *st_fx, /* i: state structure */ Word16 *btilt_code_fx, /* i: tilt code */ Word32 *gc_threshold_fx, /* i: */ Word16 *clip_var_bck_fx, /* o: */ @@ -2785,7 +2785,7 @@ void lsf_update_memory( /* _ None */ /*=======================================================================*/ void lsf_syn_mem_restore_fx( - Encoder_State_fx *st_fx, /* o: state structure */ + Encoder_State *st_fx, /* o: state structure */ Word16 btilt_code_fx, /* i: */ Word32 gc_threshold_fx, /* i: */ Word16 *clip_var_bck_fx, /* i: */ diff --git a/lib_com/prot_fx2.h b/lib_com/prot_fx2.h index 53194fbeb..30be7a81c 100644 --- a/lib_com/prot_fx2.h +++ b/lib_com/prot_fx2.h @@ -758,7 +758,7 @@ Word16 tcxlpc_get_cdk( ); void lsf_syn_mem_restore_fx( - Encoder_State_fx *st_fx, /* o: state structure */ + Encoder_State *st_fx, /* o: state structure */ Word16 btilt_code_fx, /* i: */ Word32 gc_threshold_fx, /* i: */ Word16 *clip_var_bck_fx, /* i: */ @@ -790,7 +790,7 @@ void lsf_update_memory( ); void lsf_syn_mem_backup_fx( - Encoder_State_fx *st_fx, /* i: state structure */ + Encoder_State *st_fx, /* i: state structure */ Word16 *btilt_code, /* i: tilt code */ Word32 *bgc_threshold, /* i: */ Word16 *clip_var_bck, /* o: */ @@ -1106,7 +1106,7 @@ void write_indices_fx( ); void write_indices_buf_fx( - Encoder_State_fx *st_fx, /* i/o: encoder state structure */ + Encoder_State *st_fx, /* i/o: encoder state structure */ BSTR_ENC_HANDLE hBstr, /* i/o: encoder state structure */ UWord16 *out_buf, /* i : output bitstream file */ UWord8 *pFrame, /* i: byte array with bit packet and byte aligned coded speech data */ @@ -2247,7 +2247,7 @@ void Residu3_fx( ); void calc_residu_fx( - Encoder_State_fx *st, /* i/o: state structure */ + Encoder_State *st, /* i/o: state structure */ const Word16 *speech, /* i : weighted speech signal */ Word16 *res, /* o : residual signal */ const Word16 *p_Aq /* i : quantized LP filter coefficients */ @@ -3332,7 +3332,7 @@ void quantize_uvg_fx( ); void nelp_encoder_fx( - Encoder_State_fx *st_fx, /* i/o: encoder state */ + Encoder_State *st_fx, /* i/o: encoder state */ Word16 *in_fx, /* i : residual signal */ Word16 *exc_fx, /* o : NELP quantized excitation signal */ Word16 *qIn1 @@ -3344,7 +3344,7 @@ swb_bwe_enc_lr_fx.c /========================================================================================================*/ void swb_bwe_enc_lr_fx( - Encoder_State_fx *st_fx, /* i/o: encoder state structure */ + Encoder_State *st_fx, /* i/o: encoder state structure */ const Word32 L_m_core[], /* i : lowband synthesis */ Word16 QsL, const Word32 L_m_orig[], /* i/o: scaled orig signal (MDCT) */ @@ -3373,7 +3373,7 @@ isf_enc_amr_wb_fx.c /========================================================================================================*/ void isf_enc_amr_wb_fx( - Encoder_State_fx* st, /* i/o: state structure */ + Encoder_State* st, /* i/o: state structure */ Word16* isf_new, /* i/o: quantized ISF vector */ Word16* isp_new, /* i/o: ISP vector to quantize/quantized */ Word16* Aq /* o : quantized A(z) for 4 subframes */ @@ -3387,7 +3387,7 @@ Word16 detect_transient_fx( const Word16 *in_fx, /*Q_new */ const Word16 L, Word16 Q_new, - Encoder_State_fx *st_fx + Encoder_State *st_fx ); /*========================================================================================================/ @@ -4182,7 +4182,7 @@ AnalysisPostSpectrumScaling_Fx(HANDLE_CLDFB_FILTER_BANK cldfbBank, ); void analysisCldfbEncoder_fx( - Encoder_State_fx *st_fx, /* i/o: encoder state structure */ + Encoder_State *st_fx, /* i/o: encoder state structure */ const Word16 *timeIn, Word32 realBuffer[CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], Word32 imagBuffer[CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], diff --git a/lib_com/residu_fx.c b/lib_com/residu_fx.c index ea9c6297c..2c3624a5d 100644 --- a/lib_com/residu_fx.c +++ b/lib_com/residu_fx.c @@ -194,7 +194,7 @@ void Residu3_fx( /*==========================================================================*/ void calc_residu_fx( - Encoder_State_fx *st, /* i/o: state structure */ + Encoder_State *st, /* i/o: state structure */ const Word16 *speech, /* i : weighted speech signal */ Word16 *res, /* o : residual signal */ const Word16 *p_Aq /* i : quantized LP filter coefficients */ @@ -202,7 +202,7 @@ void calc_residu_fx( { Word16 i_subfr; - FOR( i_subfr = 0; i_subfr < st->L_frame_fx; i_subfr += L_SUBFR ) + FOR( i_subfr = 0; i_subfr < st->L_frame; i_subfr += L_SUBFR ) { /* calculate the residual signal */ Residu3_fx( p_Aq, &speech[i_subfr], &res[i_subfr], L_SUBFR, 1 ); diff --git a/lib_enc/FEC_enc_fx.c b/lib_enc/FEC_enc_fx.c index 2e5d88aa2..5467a112e 100644 --- a/lib_enc/FEC_enc_fx.c +++ b/lib_enc/FEC_enc_fx.c @@ -30,7 +30,7 @@ /*----------------------------------------------------------------------------*/ /* INPUT/OUTPUT ARGUMENTS : */ /* Word16 *last_pulse_pos i/o: Position of the last pulse */ -/* Encoder_State_fx *st_fx i/o: state structure */ +/* Encoder_State *st_fx i/o: state structure */ /*----------------------------------------------------------------------------*/ /* RETURN ARGUMENTS : */ /* _ None */ @@ -199,7 +199,7 @@ void FEC_encode_fx( *-------------------------------------------------------------------*/ void FEC_lsf_estim_enc_fx( - Encoder_State_fx *st_fx, /* i : Encoder static memory */ + Encoder_State *st_fx, /* i : Encoder static memory */ Word16 *lsf /* o : estimated LSF vector */ ) { @@ -207,7 +207,7 @@ void FEC_lsf_estim_enc_fx( Word16 alpha, lsf_mean[M]; Word16 tmp; - IF( EQ_16(st_fx->L_frame_fx, L_FRAME)) + IF( EQ_16(st_fx->L_frame, L_FRAME)) { Copy( UVWB_Ave_fx, lsf_mean, M ); } @@ -220,7 +220,7 @@ void FEC_lsf_estim_enc_fx( * Initialize the alpha factor *----------------------------------------------------------------------*/ - IF( EQ_16(st_fx->last_coder_type_fx, UNVOICED)) + IF( EQ_16(st_fx->last_coder_type, UNVOICED)) { /* clearly unvoiced */ alpha = _ALPHA_UU_FX; @@ -230,29 +230,29 @@ void FEC_lsf_estim_enc_fx( { test(); test(); - IF( EQ_16(st_fx->last_coder_type_fx, AUDIO)||EQ_16(st_fx->clas_fx,INACTIVE_CLAS)) + IF( EQ_16(st_fx->last_coder_type, AUDIO)||EQ_16(st_fx->clas,INACTIVE_CLAS)) { alpha = 32604; move16(); } - ELSE IF( EQ_16(st_fx->clas_fx, UNVOICED_CLAS)) + ELSE IF( EQ_16(st_fx->clas, UNVOICED_CLAS)) { /* if stable, do not flatten the spectrum in the first erased frame */ /* alpha = st->stab_fac * (1.0f - 2.0f*ALPHA_U) + 2.0f*ALPHA_U; */ alpha = add(mult(st_fx->stab_fac_fx, 32768 - _ALPHA_U_FX_X_2), _ALPHA_U_FX_X_2); } - ELSE IF( EQ_16(st_fx->clas_fx, UNVOICED_TRANSITION)) + ELSE IF( EQ_16(st_fx->clas, UNVOICED_TRANSITION)) { alpha = _ALPHA_UT_FX; move16(); } - ELSE IF( EQ_16(st_fx->clas_fx, VOICED_CLAS)||EQ_16(st_fx->clas_fx,ONSET)) + ELSE IF( EQ_16(st_fx->clas, VOICED_CLAS)||EQ_16(st_fx->clas,ONSET)) { /* clearly voiced - mild convergence to the CNG spectrum for the first three erased frames */ alpha = _ALPHA_V_FX; move16(); } - ELSE IF( EQ_16(st_fx->clas_fx, SIN_ONSET)) + ELSE IF( EQ_16(st_fx->clas, SIN_ONSET)) { alpha = _ALPHA_S_FX; move16(); @@ -281,7 +281,7 @@ void FEC_lsf_estim_enc_fx( } /* check LSF stability through LSF ordering */ - IF( EQ_16(st_fx->L_frame_fx, L_FRAME)) + IF( EQ_16(st_fx->L_frame, L_FRAME)) { reorder_lsf_fx( lsf, MODE1_LSF_GAP_FX, M , INT_FS_FX); } diff --git a/lib_enc/acelp_core_enc_fx.c b/lib_enc/acelp_core_enc_fx.c index 6c6c9a5f4..ecc3557bf 100644 --- a/lib_enc/acelp_core_enc_fx.c +++ b/lib_enc/acelp_core_enc_fx.c @@ -21,7 +21,7 @@ * ACELP core encoder *--------------------------------------------------------------------*/ ivas_error acelp_core_enc_fx( - Encoder_State_fx *st_fx, /* i/o: encoder state structure */ + Encoder_State *st_fx, /* i/o: encoder state structure */ const Word16 inp_fx[], /* i : input signal of the current frame */ const Word32 ener_fx, /* i : residual energy from Levinson-Durbin*/ Word16 A_fx[NB_SUBFR16k*(M+1)], /* i : A(z) unquantized for the 4 subframes*/ @@ -101,7 +101,7 @@ ivas_error acelp_core_enc_fx( error = IVAS_ERR_OK; test(); - IF (EQ_16(st_fx->element_mode, IVAS_CPE_MDCT) && LE_32(st_fx->core_brate_fx, SID_2k40) ) + IF (EQ_16(st_fx->element_mode, IVAS_CPE_MDCT) && LE_32(st_fx->core_brate, SID_2k40) ) { /* Core was ACELP because of DTX in MDCT-Stereo, but SID encoding for that is done in separate function */ return error; @@ -128,14 +128,14 @@ ivas_error acelp_core_enc_fx( bwe_exc_fx = NULL; } - st_fx->bpf_off_fx = 0; + st_fx->bpf_off = 0; move16(); test();test();test(); - IF( EQ_16(st_fx->last_core_fx,HQ_CORE) || EQ_16(st_fx->last_codec_mode,MODE2) || - EQ_16(st_fx->last_core_fx, TCX_20_CORE) || EQ_16(st_fx->last_core_fx, TCX_10_CORE) ) + IF( EQ_16(st_fx->last_core,HQ_CORE) || EQ_16(st_fx->last_codec_mode,MODE2) || + EQ_16(st_fx->last_core, TCX_20_CORE) || EQ_16(st_fx->last_core, TCX_10_CORE) ) { /* in case of HQ->ACELP switching, do not apply BPF */ - st_fx->bpf_off_fx = 1; + st_fx->bpf_off = 1; move16(); if (hGSCEnc != NULL) { @@ -145,16 +145,16 @@ ivas_error acelp_core_enc_fx( } /* force safety-net LSFQ in the first frames after CNG segment */ - if( LE_32(st_fx->last_core_brate_fx,SID_2k40)) + if( LE_32(st_fx->last_core_brate,SID_2k40)) { - st_fx->Nb_ACELP_frames_fx = 0; + st_fx->Nb_ACELP_frames = 0; move16(); } - st_fx->Nb_ACELP_frames_fx = add(st_fx->Nb_ACELP_frames_fx,1); + st_fx->Nb_ACELP_frames = add(st_fx->Nb_ACELP_frames,1); int_fs_fx = INT_FS_16k_FX; move16(); - if( EQ_16(st_fx->L_frame_fx, L_FRAME)) + if( EQ_16(st_fx->L_frame, L_FRAME)) { int_fs_fx = INT_FS_FX; move16(); @@ -182,7 +182,7 @@ ivas_error acelp_core_enc_fx( /* channel-aware mode */ reset_rf_indices_fx(st_fx); /* VBR modes */ - IF (st_fx->Opt_SC_VBR_fx) + IF (st_fx->Opt_SC_VBR) { ppp_mode = hSC_VBR->ppp_mode; nelp_mode = hSC_VBR->nelp_mode; @@ -225,20 +225,20 @@ ivas_error acelp_core_enc_fx( * ACELP@12k8 / ACELP@16k switching *-----------------------------------------------------------------*/ test(); - IF( NE_16(st_fx->last_L_frame_fx,st_fx->L_frame_fx) && (EQ_16(st_fx->last_core_fx, ACELP_CORE) || EQ_16(st_fx->last_core_fx, AMR_WB_CORE) ) ) + IF( NE_16(st_fx->last_L_frame,st_fx->L_frame) && (EQ_16(st_fx->last_core, ACELP_CORE) || EQ_16(st_fx->last_core, AMR_WB_CORE) ) ) { /* in case of switching, do not apply BPF */ - st_fx->bpf_off_fx = 1; + st_fx->bpf_off = 1; move16(); /* force safety-net LSFQ in the first frames after ACELP@12k8/ACELP@16k switching */ - st_fx->Nb_ACELP_frames_fx = 1; + st_fx->Nb_ACELP_frames = 1; move16(); /* convert old quantized LSP vector */ - IF( EQ_16(st_fx->L_frame_fx,L_FRAME)) + IF( EQ_16(st_fx->L_frame,L_FRAME)) { - st_fx->rate_switching_reset = lsp_convert_poly_fx( st_fx->lsp_old_fx, st_fx->L_frame_fx, 0 ); + st_fx->rate_switching_reset = lsp_convert_poly_fx( st_fx->lsp_old_fx, st_fx->L_frame, 0 ); } ELSE { @@ -254,11 +254,11 @@ ivas_error acelp_core_enc_fx( IF( st_fx->rate_switching_reset ) { /*extrapolation in case of unstable LSP*/ - int_lsp4_fx( st_fx->L_frame_fx, lsp_mid_fx, lsp_mid_fx, lsp_new_fx, A_fx, M, 0 ); + int_lsp4_fx( st_fx->L_frame, lsp_mid_fx, lsp_mid_fx, lsp_new_fx, A_fx, M, 0 ); } ELSE { - int_lsp4_fx( st_fx->L_frame_fx, st_fx->lsp_old_fx, lsp_mid_fx, lsp_new_fx, A_fx, M, 0 ); + int_lsp4_fx( st_fx->L_frame, st_fx->lsp_old_fx, lsp_mid_fx, lsp_new_fx, A_fx, M, 0 ); } /* Reset LPC mem */ @@ -266,19 +266,19 @@ ivas_error acelp_core_enc_fx( set16_fx( st_fx->mem_MA_fx,0, M ); /* update synthesis filter memories */ - synth_mem_updt2( st_fx->L_frame_fx, st_fx->last_L_frame_fx, hLPDmem->old_exc, hLPDmem->mem_syn_r,hLPDmem->mem_syn2, hLPDmem->mem_syn, ENC ); + synth_mem_updt2( st_fx->L_frame, st_fx->last_L_frame, hLPDmem->old_exc, hLPDmem->mem_syn_r,hLPDmem->mem_syn2, hLPDmem->mem_syn, ENC ); Copy( hLPDmem->old_exc, old_exc_fx, L_EXC_MEM ); Copy( hLPDmem->mem_syn2, hLPDmem->mem_syn1_fx, M ); Copy( hLPDmem->mem_syn2, hLPDmem->mem_syn3, M ); /* update Aw[] coefficients */ - weight_a_subfr_fx( shr(st_fx->L_frame_fx,6), A_fx, Aw_fx, st_fx->gamma, M ); + weight_a_subfr_fx( shr(st_fx->L_frame,6), A_fx, Aw_fx, st_fx->gamma, M ); } test(); test(); - if(EQ_16(st_fx->last_bwidth_fx,NB)&&NE_16(st_fx->bwidth_fx,NB)&&st_fx->ini_frame_fx!=0) + if(EQ_16(st_fx->last_bwidth,NB)&&NE_16(st_fx->bwidth,NB)&&st_fx->ini_frame!=0) { st_fx->rate_switching_reset=1; move16(); @@ -287,9 +287,9 @@ ivas_error acelp_core_enc_fx( * Encoding of CNG frames *----------------------------------------------------------------*/ test(); - IF ( EQ_32(st_fx->core_brate_fx,SID_2k40)||EQ_32(st_fx->core_brate_fx,FRAME_NO_DATA)) + IF ( EQ_32(st_fx->core_brate,SID_2k40)||EQ_32(st_fx->core_brate,FRAME_NO_DATA)) { - IF( EQ_16(st_fx->cng_type_fx,LP_CNG)) + IF( EQ_16(st_fx->cng_type,LP_CNG)) { /* Run CNG post parameter update */ cng_params_postupd_fx(hTdCngEnc->ho_circ_ptr, &hTdCngEnc->cng_buf_cnt, hTdCngEnc->cng_exc2_buf, hTdCngEnc->cng_Qexc_buf, @@ -298,33 +298,33 @@ ivas_error acelp_core_enc_fx( CNG_enc_fx( st_fx, Aq_fx, inp_fx, ener_fx, lsp_mid_fx, lsp_new_fx, lsf_new_fx, &allow_cn_step_fx, sub(Q_new,1), q_env, &sid_bw); /* comfort noise generation */ - CNG_exc_fx( st_fx->core_brate_fx, st_fx->L_frame_fx, &hTdCngEnc->Enew_fx, &hTdCngEnc->cng_seed, exc_fx, exc2_fx, &hTdCngEnc->lp_ener_fx, st_fx->last_core_brate_fx, + CNG_exc_fx( st_fx->core_brate, st_fx->L_frame, &hTdCngEnc->Enew_fx, &hTdCngEnc->cng_seed, exc_fx, exc2_fx, &hTdCngEnc->lp_ener_fx, st_fx->last_core_brate, &hDtxEnc->first_CNG, &hTdCngEnc->cng_ener_seed, bwe_exc_fx, allow_cn_step_fx, &hTdCngEnc->last_allow_cn_step, sub(st_fx->prev_Q_new,1), sub(Q_new,1), hTdCngEnc->num_ho, - q_env, hTdCngEnc->lp_env_fx, hTdCngEnc->old_env_fx, hTdCngEnc->exc_mem_fx, hTdCngEnc->exc_mem1_fx, &sid_bw, &hTdCngEnc->cng_ener_seed1, exc3_fx, st_fx->Opt_AMR_WB_fx, st_fx->element_mode); + q_env, hTdCngEnc->lp_env_fx, hTdCngEnc->old_env_fx, hTdCngEnc->exc_mem_fx, hTdCngEnc->exc_mem1_fx, &sid_bw, &hTdCngEnc->cng_ener_seed1, exc3_fx, st_fx->Opt_AMR_WB, st_fx->element_mode); } ELSE { test(); - IF( EQ_32(st_fx->core_brate_fx, SID_2k40) && NE_16(st_fx->element_mode, IVAS_CPE_MDCT) ) + IF( EQ_32(st_fx->core_brate, SID_2k40) && NE_16(st_fx->element_mode, IVAS_CPE_MDCT) ) { - FdCng_encodeSID_fx( st_fx->hFdCngEnc_fx, st_fx, st_fx->preemph_fac ); - hDtxEnc->last_CNG_L_frame = st_fx->L_frame_fx; + FdCng_encodeSID_fx( st_fx->hFdCngEnc, st_fx, st_fx->preemph_fac ); + hDtxEnc->last_CNG_L_frame = st_fx->L_frame; move16(); } generate_comfort_noise_enc_fx( st_fx, Q_new, 1 ); - FdCng_exc( st_fx->hFdCngEnc_fx->hFdCngCom, &hDtxEnc->CNG_mode, st_fx->L_frame_fx, st_fx->lsp_old_fx, + FdCng_exc( st_fx->hFdCngEnc->hFdCngCom, &hDtxEnc->CNG_mode, st_fx->L_frame, st_fx->lsp_old_fx, hDtxEnc->first_CNG, hDtxEnc->lspCNG_fx, Aq_fx, lsp_new_fx, lsf_new_fx, exc_fx, exc2_fx, bwe_exc_fx ); - Copy( exc2_fx, exc3_fx, st_fx->L_frame_fx ); + Copy( exc2_fx, exc3_fx, st_fx->L_frame ); - IF( EQ_32(st_fx->core_brate_fx, SID_2k40)) + IF( EQ_32(st_fx->core_brate, SID_2k40)) { IF (hTdCngEnc != NULL) { /*IVAS_CODE CNG_att is missing */ - enr = cng_energy_fx(st_fx->element_mode, st_fx->bwidth_fx, hDtxEnc->CNG_mode, /*st_fx->hTdCngEnc->CNG_att*/0, exc_fx, st_fx->L_frame_fx, Q_new); + enr = cng_energy_fx(st_fx->element_mode, st_fx->bwidth, hDtxEnc->CNG_mode, /*st_fx->hTdCngEnc->CNG_att*/0, exc_fx, st_fx->L_frame, Q_new); /* calculate the energy quantization index */ enr_index = add(enr, 512 /* Q8(2.0) */); /* enr + 2.0 */ @@ -346,7 +346,7 @@ ivas_error acelp_core_enc_fx( move16(); } /* synthesis at 12.8kHz sampling rate */ - syn_12k8_fx( st_fx->L_frame_fx, Aq_fx, exc3_fx, syn1_fx, hLPDmem->mem_syn3, 1, Q_new, st_fx->Q_syn ); + syn_12k8_fx( st_fx->L_frame, Aq_fx, exc3_fx, syn1_fx, hLPDmem->mem_syn3, 1, Q_new, st_fx->Q_syn ); /* reset the encoder */ CNG_reset_enc_fx( st_fx, hLPDmem, pitch_buf_fx, voice_factors_fx, 0 ); @@ -358,18 +358,18 @@ ivas_error acelp_core_enc_fx( Copy( hLPDmem->mem_syn3, hLPDmem->mem_syn, M ); /* update old synthesis buffer - needed for ACELP internal sampling rate switching */ - Copy( syn1_fx + st_fx->L_frame_fx - L_SYN_MEM, hLPDmem->mem_syn_r, L_SYN_MEM ); + Copy( syn1_fx + st_fx->L_frame - L_SYN_MEM, hLPDmem->mem_syn_r, L_SYN_MEM ); IF (hBWE_FD != NULL) { /* save and delay synthesis to be used by SWB BWE */ - save_old_syn_fx( st_fx->L_frame_fx, syn1_fx, old_syn_12k8_16k_fx, hBWE_FD->old_syn_12k8_16k_fx, st_fx->preemph_fac, &hBWE_FD->mem_deemph_old_syn_fx ); + save_old_syn_fx( st_fx->L_frame, syn1_fx, old_syn_12k8_16k_fx, hBWE_FD->old_syn_12k8_16k_fx, st_fx->preemph_fac, &hBWE_FD->mem_deemph_old_syn_fx ); } /* Update MODE2 core switching memory */ tmp16 = hLPDmem->syn[M]; move16(); - E_UTIL_deemph2( sub(Q_new,1), syn1_fx, st_fx->preemph_fac, st_fx->L_frame_fx, &tmp16 ); - Copy( syn1_fx+st_fx->L_frame_fx-M-1, hLPDmem->syn, M+1 ); + E_UTIL_deemph2( sub(Q_new,1), syn1_fx, st_fx->preemph_fac, st_fx->L_frame, &tmp16 ); + Copy( syn1_fx+st_fx->L_frame-M-1, hLPDmem->syn, M+1 ); } @@ -390,8 +390,8 @@ ivas_error acelp_core_enc_fx( test(); IF (!nelp_mode && !ppp_mode) { - config_acelp1(ENC, st_fx->total_brate_fx, st_fx->core_brate_fx, st_fx->core_fx, st_fx->extl_fx, st_fx->extl_brate_fx, - st_fx->L_frame_fx, st_fx->GSC_noisy_speech_fx, &(st_fx->acelp_cfg), hBstr->nb_bits_tot_fx, st_fx->coder_type, + config_acelp1(ENC, st_fx->total_brate, st_fx->core_brate, st_fx->core, st_fx->extl, st_fx->extl_brate, + st_fx->L_frame, st_fx->GSC_noisy_speech, &(st_fx->acelp_cfg), hBstr->nb_bits_tot_fx, st_fx->coder_type, tc_subfr_fx, 0, &nb_bits, unbits_fx, st_fx->element_mode, &uc_two_stage_flag, tdm_lp_reuse_flag, tdm_low_rate_mode, st_fx->idchan, st_fx->active_fr_cnt_fx, tdm_Pitch_reuse_flag, st_fx->tdm_LRTD_flag, st_fx->GSC_IVAS_mode); } @@ -401,7 +401,7 @@ ivas_error acelp_core_enc_fx( *-----------------------------------------------------------------*/ test(); - IF ( EQ_32(st_fx->last_core_brate_fx,FRAME_NO_DATA)||EQ_32(st_fx->last_core_brate_fx,SID_2k40)) + IF ( EQ_32(st_fx->last_core_brate,FRAME_NO_DATA)||EQ_32(st_fx->last_core_brate,SID_2k40)) { Copy(hDtxEnc->lspCNG_fx, st_fx->lsp_old_fx, M ); @@ -417,7 +417,7 @@ ivas_error acelp_core_enc_fx( move16(); st_fx->mem_preemp_preQ_fx = 0; move16(); - st_fx->last_nq_preQ_fx = 0; + st_fx->last_nq_preQ = 0; move16(); } @@ -438,9 +438,9 @@ ivas_error acelp_core_enc_fx( if (!tdm_lp_reuse_flag) { #ifdef LSF_RE_USE_SECONDARY_CHANNEL - lsf_enc_fx(st_fx, lsf_new_fx, lsp_new_fx, lsp_mid_fx, Aq_fx, st_fx->Nb_ACELP_frames_fx, tdm_low_rate_mode, st_fx->GSC_IVAS_mode, tdm_lsfQ_PCh, Q_new); + lsf_enc_fx(st_fx, lsf_new_fx, lsp_new_fx, lsp_mid_fx, Aq_fx, st_fx->Nb_ACELP_frames, tdm_low_rate_mode, st_fx->GSC_IVAS_mode, tdm_lsfQ_PCh, Q_new); #else - lsf_enc_fx(st_fx, lsf_new_fx, lsp_new_fx, lsp_mid_fx, Aq_fx, st_fx->Nb_ACELP_frames_fx, tdm_low_rate_mode, st_fx->GSC_IVAS_mode, Q_new); + lsf_enc_fx(st_fx, lsf_new_fx, lsp_new_fx, lsp_mid_fx, Aq_fx, st_fx->Nb_ACELP_frames, tdm_low_rate_mode, st_fx->GSC_IVAS_mode, Q_new); #endif } #ifdef ADD_LRTD @@ -515,7 +515,7 @@ ivas_error acelp_core_enc_fx( *---------------------------------------------------------------*/ calc_residu_fx(st_fx, inp_fx, res_fx, Aq_fx); calculate_hangover_attenuation_gain_fx(st_fx, &att, vad_hover_flag_fx); - v_multc_att(res_fx, att, res_fx, st_fx->L_frame_fx); + v_multc_att(res_fx, att, res_fx, st_fx->L_frame); /*-----------------------------------------------------------------* * Determine TC subframe classification @@ -523,9 +523,9 @@ ivas_error acelp_core_enc_fx( IF (EQ_16(st_fx->coder_type, TRANSITION ) ) { - tc_classif_enc_fx(Q_new, st_fx->L_frame_fx, &tc_subfr_fx, &position, attack_flag, st_fx->pitch_fx[0], res_fx); + tc_classif_enc_fx(Q_new, st_fx->L_frame, &tc_subfr_fx, &position, attack_flag, st_fx->pitch_fx[0], res_fx); - config_acelp1(ENC, st_fx->total_brate_fx, st_fx->core_brate_fx, st_fx->core_fx, st_fx->extl_fx, st_fx->extl_brate_fx, st_fx->L_frame_fx, + config_acelp1(ENC, st_fx->total_brate, st_fx->core_brate, st_fx->core, st_fx->extl, st_fx->extl_brate, st_fx->L_frame, -1, &(st_fx->acelp_cfg), hBstr->nb_bits_tot_fx, st_fx->coder_type, tc_subfr_fx, 1, NULL, unbits_fx, st_fx->element_mode, &uc_two_stage_flag, tdm_lp_reuse_flag, tdm_low_rate_mode, st_fx->idchan, st_fx->active_fr_cnt_fx, tdm_Pitch_reuse_flag, st_fx->tdm_LRTD_flag, st_fx->GSC_IVAS_mode); } @@ -536,7 +536,7 @@ ivas_error acelp_core_enc_fx( *---------------------------------------------------------------*/ IF(nb_bits > 0) { - Es_pred_enc_fx( &Es_pred_fx, &indice, st_fx->L_frame_fx, res_fx, st_fx->voicing_fx, nb_bits, 0, Q_new ); + Es_pred_enc_fx( &Es_pred_fx, &indice, st_fx->L_frame, res_fx, st_fx->voicing_fx, nb_bits, 0, Q_new ); push_indice_fx( st_fx->hBstr, IND_ES_PRED, indice, nb_bits ); } @@ -593,15 +593,15 @@ ivas_error acelp_core_enc_fx( lsp_mid_bck_fx, mCb1_fx, Bin_E_fx,Bin_E_old_fx,mem_syn_bck_fx, mem_w0_bck_fx, streaklimit_fx, pstreaklen_fx ); /* Configure ACELP bit allocation */ - config_acelp1(ENC, st_fx->total_brate_fx, st_fx->core_brate_fx, st_fx->core_fx, st_fx->extl_fx, st_fx->extl_brate_fx, st_fx->L_frame_fx, + config_acelp1(ENC, st_fx->total_brate, st_fx->core_brate, st_fx->core, st_fx->extl, st_fx->extl_brate, st_fx->L_frame, -1, &(st_fx->acelp_cfg), hBstr->nb_bits_tot_fx, st_fx->coder_type, tc_subfr_fx, 0, &nb_bits, unbits_fx, 0, &uc_two_stage_flag, 0, 0, st_fx->idchan, st_fx->active_fr_cnt_fx, tdm_Pitch_reuse_flag, st_fx->tdm_LRTD_flag, st_fx->GSC_IVAS_mode); /* redo LSF quantization */ #ifdef LSF_RE_USE_SECONDARY_CHANNEL - lsf_enc_fx(st_fx, lsf_new_fx, lsp_new_fx, lsp_mid_fx, Aq_fx, st_fx->Nb_ACELP_frames_fx, tdm_low_rate_mode, st_fx->GSC_IVAS_mode, tdm_lsfQ_PCh, Q_new); + lsf_enc_fx(st_fx, lsf_new_fx, lsp_new_fx, lsp_mid_fx, Aq_fx, st_fx->Nb_ACELP_frames, tdm_low_rate_mode, st_fx->GSC_IVAS_mode, tdm_lsfQ_PCh, Q_new); #else - lsf_enc_fx( st_fx, lsf_new_fx, lsp_new_fx, lsp_mid_fx, Aq_fx, st_fx->Nb_ACELP_frames_fx, tdm_low_rate_mode, st_fx->GSC_IVAS_mode, Q_new ); + lsf_enc_fx( st_fx, lsf_new_fx, lsp_new_fx, lsp_mid_fx, Aq_fx, st_fx->Nb_ACELP_frames, tdm_low_rate_mode, st_fx->GSC_IVAS_mode, Q_new ); #endif /* recalculation of LP residual (filtering through A[z] filter) */ calc_residu_fx( st_fx, inp_fx, res_fx, Aq_fx); @@ -613,7 +613,7 @@ ivas_error acelp_core_enc_fx( exc_fx, exc2_fx, pitch_buf_fx, voice_factors_fx, bwe_exc_fx, unbits_fx, tdm_Pitch_reuse_flag, tdm_Pri_pitch_buf, shift, Q_new ); } } - ELSE IF( EQ_16(coder_type,AUDIO)||(EQ_16(coder_type,INACTIVE)&&LE_32(st_fx->core_brate_fx,ACELP_24k40))) + ELSE IF( EQ_16(coder_type,AUDIO)||(EQ_16(coder_type,INACTIVE)&&LE_32(st_fx->core_brate,ACELP_24k40))) { /* AUDIO and INACTIVE frames (coded by GSC technology) */ encod_audio_fx( st_fx, inp_fx, Aw_fx, Aq_fx, res_fx, syn_fx, exc_fx, pitch_buf_fx, voice_factors_fx, bwe_exc_fx, @@ -630,20 +630,20 @@ ivas_error acelp_core_enc_fx( Copy( hLPDmem->mem_syn, hLPDmem->mem_syn1_fx, M ); /* update old synthesis buffer - needed for ACELP internal sampling rate switching */ - Copy( syn_fx + st_fx->L_frame_fx - L_SYN_MEM, hLPDmem->mem_syn_r, L_SYN_MEM ); + Copy( syn_fx + st_fx->L_frame - L_SYN_MEM, hLPDmem->mem_syn_r, L_SYN_MEM ); /* save and delay synthesis to be used by SWB BWE */ IF (hBWE_FD != NULL) { - save_old_syn_fx(st_fx->L_frame_fx, syn_fx, old_syn_12k8_16k_fx, hBWE_FD->old_syn_12k8_16k_fx, st_fx->preemph_fac, &hBWE_FD->mem_deemph_old_syn_fx); + save_old_syn_fx(st_fx->L_frame, syn_fx, old_syn_12k8_16k_fx, hBWE_FD->old_syn_12k8_16k_fx, st_fx->preemph_fac, &hBWE_FD->mem_deemph_old_syn_fx); } /*Update MODE2 core switching memory*/ - Copy( syn_fx, syn1_fx, st_fx->L_frame_fx ); - E_UTIL_deemph2( sub(Q_new,1), syn1_fx, st_fx->preemph_fac, st_fx->L_frame_fx, &hLPDmem->syn[M] ); - Copy( syn1_fx+st_fx->L_frame_fx-M-1, hLPDmem->syn, M+1 ); + Copy( syn_fx, syn1_fx, st_fx->L_frame ); + E_UTIL_deemph2( sub(Q_new,1), syn1_fx, st_fx->preemph_fac, st_fx->L_frame, &hLPDmem->syn[M] ); + Copy( syn1_fx+st_fx->L_frame-M-1, hLPDmem->syn, M+1 ); IF (GT_16(st_fx->element_mode, EVS_MONO) && st_fx->hTcxEnc != NULL) { - Copy(syn1_fx + st_fx->L_frame_fx / 2, st_fx->hTcxEnc->Txnq, st_fx->L_frame_fx / 2); + Copy(syn1_fx + st_fx->L_frame / 2, st_fx->hTcxEnc->Txnq, st_fx->L_frame / 2); } /*--------------------------------------------------------------------------------------* @@ -656,7 +656,7 @@ ivas_error acelp_core_enc_fx( move32(); L_epsP[1] = L_Comp(epsP_h_fx[M],epsP_l_fx[M]); move32(); - Copy(exc_fx, exc2_fx, st_fx->L_frame_fx); + Copy(exc_fx, exc2_fx, st_fx->L_frame); stat_noise_uv_enc_fx( st_fx, L_epsP, lsp_new_fx, lsp_mid_fx, Aq_fx, exc2_fx, uc_two_stage_flag, Q_new ); } @@ -664,13 +664,13 @@ ivas_error acelp_core_enc_fx( * Encode supplementary information for Frame Error Concealment *-----------------------------------------------------------------*/ - FEC_encode_fx(hBstr, st_fx->acelp_cfg, syn_fx, coder_type, st_fx->clas_fx, pitch_buf_fx, res_fx, &st_fx->Last_pulse_pos_fx, - st_fx->L_frame_fx, st_fx->total_brate_fx, Q_new, shift ); + FEC_encode_fx(hBstr, st_fx->acelp_cfg, syn_fx, coder_type, st_fx->clas, pitch_buf_fx, res_fx, &st_fx->Last_pulse_pos, + st_fx->L_frame, st_fx->total_brate, Q_new, shift ); IF (hBWE_TD != NULL) { - IF(EQ_16(st_fx->L_frame_fx, L_FRAME)) + IF(EQ_16(st_fx->L_frame, L_FRAME)) { Copy(Aq_fx + 2 * (M + 1), hBWE_TD->cur_sub_Aq_fx, (M + 1)); } @@ -687,7 +687,7 @@ ivas_error acelp_core_enc_fx( test(); test(); - IF ( NE_32(st_fx->core_brate_fx,SID_2k40)&&NE_32(st_fx->core_brate_fx,FRAME_NO_DATA)&&NE_32(st_fx->core_brate_fx,PPP_NELP_2k80)) + IF ( NE_32(st_fx->core_brate,SID_2k40)&&NE_32(st_fx->core_brate,FRAME_NO_DATA)&&NE_32(st_fx->core_brate,PPP_NELP_2k80)) { /* reserved bits */ nBits = st_fx->acelp_cfg.ubits; @@ -711,19 +711,19 @@ ivas_error acelp_core_enc_fx( test(); test(); test(); test(); test(); - IF((EQ_16(st_fx->last_Opt_SC_VBR_fx, 1) && st_fx->Opt_SC_VBR_fx == 0) || ((EQ_16(st_fx->extl_fx, SWB_TBE) || EQ_16(st_fx->extl_fx, WB_TBE) || EQ_16(st_fx->extl_fx, FB_TBE)) && NE_16(st_fx->last_extl_fx, SWB_TBE) && NE_16(st_fx->last_extl_fx, WB_TBE) && NE_16(st_fx->last_extl_fx, FB_TBE))) + IF((EQ_16(st_fx->last_Opt_SC_VBR, 1) && st_fx->Opt_SC_VBR == 0) || ((EQ_16(st_fx->extl, SWB_TBE) || EQ_16(st_fx->extl, WB_TBE) || EQ_16(st_fx->extl, FB_TBE)) && NE_16(st_fx->last_extl, SWB_TBE) && NE_16(st_fx->last_extl, WB_TBE) && NE_16(st_fx->last_extl, FB_TBE))) { hBWE_TD->bwe_non_lin_prev_scale_fx = L_deposit_l(0); set16_fx(hBWE_TD->old_bwe_exc_extended_fx, 0, NL_BUFF_OFFSET); } - IF(!st_fx->Opt_SC_VBR_fx) + IF(!st_fx->Opt_SC_VBR) { /* Apply a non linearity to the SHB excitation */ - non_linearity_fx(bwe_exc_fx, bwe_exc_extended_fx, L_FRAME32k, &hBWE_TD->bwe_non_lin_prev_scale_fx, Q_new, coder_type, voice_factors_fx, st_fx->L_frame_fx); + non_linearity_fx(bwe_exc_fx, bwe_exc_extended_fx, L_FRAME32k, &hBWE_TD->bwe_non_lin_prev_scale_fx, Q_new, coder_type, voice_factors_fx, st_fx->L_frame); } test(); - if (EQ_32(st_fx->core_brate_fx, SID_2k40) || EQ_32(st_fx->core_brate_fx, FRAME_NO_DATA)) + if (EQ_32(st_fx->core_brate, SID_2k40) || EQ_32(st_fx->core_brate, FRAME_NO_DATA)) { hBWE_TD->bwe_non_lin_prev_scale_fx = L_deposit_l(0); } @@ -734,14 +734,14 @@ ivas_error acelp_core_enc_fx( updt_enc_fx( st_fx, old_exc_fx, pitch_buf_fx, Es_pred_fx,Aq_fx, lsf_new_fx, lsp_new_fx, old_bwe_exc_fx ); test(); - IF(hTdCngEnc != NULL && (st_fx->Opt_DTX_ON_fx != 0 ) && (GT_32(st_fx->core_brate_fx,SID_2k40))) + IF(hTdCngEnc != NULL && (st_fx->Opt_DTX_ON != 0 ) && (GT_32(st_fx->core_brate,SID_2k40))) { /* update CNG parameters in active frames */ - cng_params_upd_fx( lsp_new_fx, exc_fx, st_fx->L_frame_fx, &hTdCngEnc->ho_circ_ptr, hTdCngEnc->ho_ener_circ_fx, + cng_params_upd_fx( lsp_new_fx, exc_fx, st_fx->L_frame, &hTdCngEnc->ho_circ_ptr, hTdCngEnc->ho_ener_circ_fx, &hTdCngEnc->ho_circ_size, hTdCngEnc->ho_lsp_circ_fx, Q_new, ENC, NULL, &hTdCngEnc->cng_buf_cnt, hTdCngEnc->cng_exc2_buf, hTdCngEnc->cng_Qexc_buf, hTdCngEnc->cng_brate_buf, hDtxEnc->last_active_brate ); - IF( EQ_16(st_fx->L_frame_fx,L_FRAME)) + IF( EQ_16(st_fx->L_frame,L_FRAME)) { /* store LSPs@16k, potentially to be used in CNG@16k */ Copy( st_fx->lsp_old16k_fx, &(hTdCngEnc->ho_lsp_circ2_fx[(hTdCngEnc->ho_circ_ptr)*M]), M ); @@ -750,7 +750,7 @@ ivas_error acelp_core_enc_fx( /* Set 16k LSP flag for CNG buffer */ hTdCngEnc->ho_16k_lsp[hTdCngEnc->ho_circ_ptr] = 0; move16(); - if(NE_16(st_fx->L_frame_fx, L_FRAME)) + if(NE_16(st_fx->L_frame, L_FRAME)) { hTdCngEnc->ho_16k_lsp[hTdCngEnc->ho_circ_ptr] = 1; move16(); @@ -766,7 +766,7 @@ ivas_error acelp_core_enc_fx( /* SC-VBR update of average data rate */ IF ( EQ_16(st_fx->vad_flag,1) && (hSC_VBR != NULL) ) { - update_average_rate_fx(hSC_VBR, st_fx->core_brate_fx); + update_average_rate_fx(hSC_VBR, st_fx->core_brate); } return error; diff --git a/lib_enc/acelp_core_switch_enc_fx.c b/lib_enc/acelp_core_switch_enc_fx.c index 68b926aa0..ce7dfa212 100644 --- a/lib_enc/acelp_core_switch_enc_fx.c +++ b/lib_enc/acelp_core_switch_enc_fx.c @@ -17,11 +17,11 @@ * Local function prototypes *---------------------------------------------------------------------*/ -static void encod_gen_voic_core_switch_fx( Encoder_State_fx *st_fx, +static void encod_gen_voic_core_switch_fx( Encoder_State *st_fx, const Word16 L_frame_fx, const Word16 inp_fx[], const Word16 Aq_fx[], const Word16 A_fx[], const Word16 T_op[], Word16 *exc_fx, const Word32 core_bitrate_fx, Word16 shift, Word16 Q_new ); -static void bwe_switch_enc_fx(Encoder_State_fx *st_fx, const Word16 *new_speech ); +static void bwe_switch_enc_fx(Encoder_State *st_fx, const Word16 *new_speech ); static Word16 dotprod_satcont(const Word16 *x, const Word16 *y, Word16 qx, Word16 qy, Word16 *qo, Word16 len, Word16 delta); @@ -32,7 +32,7 @@ static Word16 dotprod_satcont(const Word16 *x, const Word16 *y, Word16 qx, Word1 *--------------------------------------------------------------------*/ void acelp_core_switch_enc_fx( - Encoder_State_fx *st_fx, /* i/o: encoder state structure */ + Encoder_State *st_fx, /* i/o: encoder state structure */ const Word16 inp12k8[], /* i : input signal @12.8 kHz Q0 */ const Word16 inp16k[], /* i : input signal @16 kHz Q0 */ const Word16 A[NB_SUBFR16k*(M+1)], /* i : A(z) unquantized for the 4 subframes Q12*/ @@ -66,34 +66,34 @@ void acelp_core_switch_enc_fx( * set switching frame bitrate *----------------------------------------------------------------*/ - IF( EQ_16(st_fx->last_L_frame_fx, L_FRAME)) /* ACELP@12k8 core */ + IF( EQ_16(st_fx->last_L_frame, L_FRAME)) /* ACELP@12k8 core */ { inp = inp12k8; - IF( GT_32(st_fx->core_brate_fx, ACELP_24k40 )) + IF( GT_32(st_fx->core_brate, ACELP_24k40 )) { cbrate = L_add(ACELP_24k40, 0); } ELSE { - cbrate = L_add(st_fx->core_brate_fx, 0); + cbrate = L_add(st_fx->core_brate, 0); } } ELSE /* ACELP@16k core */ { inp = inp16k; - IF( LE_32(st_fx->core_brate_fx, ACELP_8k00)) + IF( LE_32(st_fx->core_brate, ACELP_8k00)) { cbrate = L_add(ACELP_8k00, 0); } - ELSE IF (LE_32(st_fx->core_brate_fx, ACELP_14k80)) + ELSE IF (LE_32(st_fx->core_brate, ACELP_14k80)) { cbrate = L_add(ACELP_14k80, 0); } ELSE { - cbrate = L_min( st_fx->core_brate_fx, ACELP_22k60 ); + cbrate = L_min( st_fx->core_brate, ACELP_22k60 ); } } #ifdef FIX_I4_OL_PITCH @@ -101,7 +101,7 @@ void acelp_core_switch_enc_fx( IF (EQ_16(st_fx->last_codec_mode, MODE1)) { /* in MODE1 T_op is at 12.8 kHz */ - IF (NE_16(st_fx->last_L_frame_fx, L_FRAME)) /* ACELP@16k core -> convert T_op to 16 kHz */ + IF (NE_16(st_fx->last_L_frame, L_FRAME)) /* ACELP@16k core -> convert T_op to 16 kHz */ { T_op[0] = shr(add(round_fx(L_shl(L_mult(20480, T_op[0]), 2)), 1), 1); move16(); @@ -112,7 +112,7 @@ void acelp_core_switch_enc_fx( ELSE { /* in MODE2 T_op is at 16 kHz */ - IF (EQ_16(st_fx->last_L_frame_fx, L_FRAME)) /* ACELP@12.8k core -> convert T_op to 12.8 kHz */ + IF (EQ_16(st_fx->last_L_frame, L_FRAME)) /* ACELP@12.8k core -> convert T_op to 12.8 kHz */ { move16();move16(); T_op[0] = mult_r(26214, T_op[0]); @@ -120,7 +120,7 @@ void acelp_core_switch_enc_fx( } } #else - IF( NE_16(st_fx->last_L_frame_fx, L_FRAME) ) + IF( NE_16(st_fx->last_L_frame, L_FRAME) ) { T_op[0] = shr(add(round_fx(L_shl(L_mult(20480, T_op[0]), 2)), 1), 1); move16(); @@ -131,10 +131,10 @@ void acelp_core_switch_enc_fx( /*----------------------------------------------------------------* * Excitation encoding *----------------------------------------------------------------*/ - config_acelp1(ENC, st_fx->total_brate_fx, cbrate, st_fx->core_fx, -1, -1, st_fx->last_L_frame_fx, -1, &(st_fx->acelp_cfg), hBstr->nb_bits_tot_fx, + config_acelp1(ENC, st_fx->total_brate, cbrate, st_fx->core, -1, -1, st_fx->last_L_frame, -1, &(st_fx->acelp_cfg), hBstr->nb_bits_tot_fx, GENERIC, -1, -1, &j, &i, st_fx->element_mode, &i /*dummy*/, 0 /*tdm_lp_reuse_flag*/, 0 /*tdm_low_rate_mode*/, st_fx->idchan, st_fx->active_fr_cnt_fx, 0 /*tdm_Pitch_reuse_flag*/, 0, 0 /*GSC_IVAS_mode*/); - encod_gen_voic_core_switch_fx( st_fx, st_fx->last_L_frame_fx, inp, Aq, A, T_op, exc, cbrate, shift, Q_new ); + encod_gen_voic_core_switch_fx( st_fx, st_fx->last_L_frame, inp, Aq, A, T_op, exc, cbrate, shift, Q_new ); /*----------------------------------------------------------------* * bit-stream: modify the layer of sub frame CELP @@ -167,7 +167,7 @@ void acelp_core_switch_enc_fx( test(); test(); - IF( !( ( EQ_16(st_fx->last_L_frame_fx, L_FRAME16k)&&EQ_16(inner_frame_tbl[st_fx->bwidth_fx],L_FRAME16k))||EQ_16(inner_frame_tbl[st_fx->bwidth_fx],L_FRAME8k))) + IF( !( ( EQ_16(st_fx->last_L_frame, L_FRAME16k)&&EQ_16(inner_frame_tbl[st_fx->bwidth],L_FRAME16k))||EQ_16(inner_frame_tbl[st_fx->bwidth],L_FRAME8k))) { bwe_switch_enc_fx( st_fx, (const Word16 *)st_fx->old_input_signal_fx ); } @@ -182,7 +182,7 @@ void acelp_core_switch_enc_fx( *-------------------------------------------------------------------*/ static void encod_gen_voic_core_switch_fx( - Encoder_State_fx *st_fx, /* i/o: state structure */ + Encoder_State *st_fx, /* i/o: state structure */ const Word16 L_frame, /* i : length of the frame */ const Word16 inp[], /* i : input signal */ const Word16 Aq[], /* i : LP coefficients */ @@ -260,15 +260,15 @@ static void encod_gen_voic_core_switch_fx( * Calculation of LP residual (filtering through A[z] filter) *------------------------------------------------------------------*/ - tmp16=st_fx->L_frame_fx; + tmp16=st_fx->L_frame; move16(); - st_fx->L_frame_fx=L_SUBFR; + st_fx->L_frame=L_SUBFR; move16(); calc_residu_fx(st_fx, inp, res, Aq); hTdCngEnc->burst_ho_cnt = 0; move16(); - st_fx->L_frame_fx=tmp16; + st_fx->L_frame=tmp16; move16(); /*------------------------------------------------------------------* @@ -333,7 +333,7 @@ static void encod_gen_voic_core_switch_fx( * Innovation encoding *-----------------------------------------------------------------*/ - inov_encode_fx( st_fx, core_bitrate, 0, L_frame,st_fx->last_L_frame_fx, GENERIC, st_fx->bwidth_fx, 0, 0, -1, Aq, gain_pit, cn, exc, + inov_encode_fx( st_fx, core_bitrate, 0, L_frame,st_fx->last_L_frame, GENERIC, st_fx->bwidth, 0, 0, -1, Aq, gain_pit, cn, exc, h2, hLPDmem->tilt_code, pitch, xn2, code, y2, &unbits, L_SUBFR, shift); /*-----------------------------------------------------------------* @@ -399,7 +399,7 @@ static void encod_gen_voic_core_switch_fx( *-------------------------------------------------------------------*/ static void bwe_switch_enc_fx( - Encoder_State_fx *st_fx, /* i/o: encoder state structure */ + Encoder_State *st_fx, /* i/o: encoder state structure */ const Word16 *new_speech_fx /* i : original input signal Q0 */ ) { @@ -422,19 +422,19 @@ static void bwe_switch_enc_fx( Flag Overflow = 0; #endif hBstr = st_fx->hBstr; - L = NS2SA_fx2(st_fx->input_Fs_fx,FRAME_SIZE_NS); + L = NS2SA_fx2(st_fx->input_Fs,FRAME_SIZE_NS); /* set multiplication factor according to the sampling rate */ - tmp = extract_l(L_shr(st_fx->input_Fs_fx,14)); + tmp = extract_l(L_shr(st_fx->input_Fs,14)); delta_fx = add(tmp,1); Fs_kHz = shl(delta_fx,4); - tmp = add(tmp,i_mult2(3,(sub(st_fx->last_L_frame_fx,L_FRAME)!=0))); + tmp = add(tmp,i_mult2(3,(sub(st_fx->last_L_frame,L_FRAME)!=0))); ptmp = fpointers_tab[tmp]; move16(); hp_filter_fx = ptmp; fdelay_fx=i_mult2(16,delta_fx); - IF(EQ_16(st_fx->last_L_frame_fx,L_FRAME)) + IF(EQ_16(st_fx->last_L_frame,L_FRAME)) { fdelay_fx=i_mult2(20,delta_fx); } diff --git a/lib_enc/amr_wb_enc_fx.c b/lib_enc/amr_wb_enc_fx.c index 2f2f3f4d7..23e72016c 100644 --- a/lib_enc/amr_wb_enc_fx.c +++ b/lib_enc/amr_wb_enc_fx.c @@ -22,7 +22,7 @@ *--------------------------------------------------------------------*/ void amr_wb_enc_fx( - Encoder_State_fx *st, /* i/o: encoder state structure */ + Encoder_State *st, /* i/o: encoder state structure */ const Word16 input_sp[], /* i : input signal */ const Word16 n_samples /* i : number of input samples */ ) @@ -91,38 +91,38 @@ void amr_wb_enc_fx( * Initialization *------------------------------------------------------------------*/ - st->L_frame_fx = L_FRAME; + st->L_frame = L_FRAME; move16(); st->gamma = GAMMA1; move16(); - st->core_fx = AMR_WB_CORE; + st->core = AMR_WB_CORE; move16(); - st->core_brate_fx = st->total_brate_fx; + st->core_brate = st->total_brate; move16(); - st->input_bwidth_fx = st->last_input_bwidth_fx; + st->input_bwidth = st->last_input_bwidth; move16(); - st->bwidth_fx = st->last_bwidth_fx; + st->bwidth = st->last_bwidth; move16(); st->coder_type = GENERIC; move16(); input_frame = st->input_frame_fx; move16(); /* frame length of the input signal */ - st->extl_fx = -1; + st->extl = -1; st->encoderPastSamples_enc = (L_FRAME*9)/16; st->encoderLookahead_enc = L_LOOK_12k8; - st->bpf_off_fx = 0; + st->bpf_off = 0; move16(); test(); - if( EQ_16(st->last_core_fx,HQ_CORE)||EQ_16(st->last_codec_mode,MODE2)) + if( EQ_16(st->last_core,HQ_CORE)||EQ_16(st->last_codec_mode,MODE2)) { - st->bpf_off_fx = 1; + st->bpf_off = 1; move16(); } st->igf = 0; move16(); /* Updates in case of EVS primary mode -> AMR-WB IO mode switching */ - IF( NE_16(st->last_core_fx,AMR_WB_CORE)) + IF( NE_16(st->last_core,AMR_WB_CORE)) { updt_IO_switch_enc_fx( st, input_frame); } @@ -151,7 +151,7 @@ void amr_wb_enc_fx( /* in case of switching, reset AMR-WB BWE memories */ test(); - IF( EQ_32(st->total_brate_fx,ACELP_23k85)&&NE_32(st->last_core_brate_fx,ACELP_23k85)) + IF( EQ_32(st->total_brate,ACELP_23k85)&&NE_32(st->last_core_brate,ACELP_23k85)) { hf_cod_init_fx(hAmrwb_IO->mem_hp400_enc_fx, hAmrwb_IO->mem_hf_enc_fx, hAmrwb_IO->mem_syn_hf_enc_fx, hAmrwb_IO->mem_hf2_enc_fx, &hAmrwb_IO->gain_alpha_fx ); } @@ -161,22 +161,22 @@ void amr_wb_enc_fx( *----------------------------------------------------------------*/ /* get delay to synchronize ACELP and MDCT frame */ - delay = NS2SA_fx2(st->input_Fs_fx, DELAY_FIR_RESAMPL_NS); + delay = NS2SA_fx2(st->input_Fs, DELAY_FIR_RESAMPL_NS); - Copy( st->input - delay, st->old_input_signal_fx, input_frame+delay ); + Copy( st->input_fx - delay, st->old_input_signal_fx, input_frame+delay ); /*----------------------------------------------------------------* * Buffering of input signal * HP filtering *----------------------------------------------------------------*/ - Copy( input_sp, st->input, n_samples ); + Copy( input_sp, st->input_fx, n_samples ); FOR( i = n_samples; i < input_frame; i++ ) { - st->input[i] = 0; + st->input_fx[i] = 0; move16(); } - hp20( st->input, 1, input_frame, st->mem_hp20_in_fx, st->input_Fs_fx ); + hp20( st->input_fx, 1, input_frame, st->mem_hp20_in_fx, st->input_Fs ); /*-----------------------------------------------------------------* * switching from ACELP@16k core to AMR-WB IO mode @@ -186,10 +186,10 @@ void amr_wb_enc_fx( move16(); test(); test(); - IF( NE_16(st->last_core_fx,AMR_WB_CORE)&&EQ_16(st->last_L_frame_fx,L_FRAME16k)&&NE_16(st->last_core_fx,HQ_CORE)) + IF( NE_16(st->last_core,AMR_WB_CORE)&&EQ_16(st->last_L_frame,L_FRAME16k)&&NE_16(st->last_core,HQ_CORE)) { /* in case of switching, do not apply BPF */ - st->bpf_off_fx = 1; + st->bpf_off = 1; move16(); st->rate_switching_reset=lsp_convert_poly_fx(st->lsp_old_fx, L_FRAME, 1); @@ -201,7 +201,7 @@ void amr_wb_enc_fx( set16_fx( st->mem_MA_fx,0, M ); /* update synthesis filter memories */ - synth_mem_updt2(L_FRAME, st->last_L_frame_fx, hLPDmem->old_exc, hLPDmem->mem_syn_r, hLPDmem->mem_syn1_fx, hLPDmem->mem_syn, ENC); + synth_mem_updt2(L_FRAME, st->last_L_frame, hLPDmem->old_exc, hLPDmem->mem_syn_r, hLPDmem->mem_syn1_fx, hLPDmem->mem_syn, ENC); Copy(hLPDmem->mem_syn1_fx, hLPDmem->mem_syn2, M); Copy( hLPDmem->old_exc, old_exc, L_EXC_MEM ); @@ -214,15 +214,15 @@ void amr_wb_enc_fx( } /* update buffer of old subframe pitch values */ - IF( NE_16(st->last_L_frame_fx,L_FRAME)) + IF( NE_16(st->last_L_frame,L_FRAME)) { move16(); - IF( EQ_16(st->last_L_frame_fx,L_FRAME32k)) + IF( EQ_16(st->last_L_frame,L_FRAME32k)) { /* (float)12800/(float)32000; */ tmp = 13107; } - ELSE IF( EQ_16(st->last_L_frame_fx,512)) + ELSE IF( EQ_16(st->last_L_frame,512)) { /* (float)12800/(float)25600; */ tmp = 16384; @@ -247,7 +247,7 @@ void amr_wb_enc_fx( } test(); - if( EQ_16(st->last_bwidth_fx,NB)&&st->ini_frame_fx !=0) + if( EQ_16(st->last_bwidth,NB)&&st->ini_frame !=0) { st->rate_switching_reset=1; move16(); @@ -257,7 +257,7 @@ void amr_wb_enc_fx( * Change the sampling frequency to 12.8 kHz *----------------------------------------------------------------*/ - modify_Fs_fx( st->input, input_frame, st->input_Fs_fx, new_inp, 12800, st->mem_decim_fx, 0 ); + modify_Fs_fx( st->input_fx, input_frame, st->input_Fs, new_inp, 12800, st->mem_decim_fx, 0 ); /* update signal buffer */ Copy( new_inp, st->buf_speech_enc+L_FRAME, L_FRAME ); @@ -267,14 +267,14 @@ void amr_wb_enc_fx( * Perform fixed preemphasis through 1 - g*z^-1 *-----------------------------------------------------------------*/ - Preemph_scaled( new_inp, &Q_new, &st->mem_preemph_fx, st->Q_max, PREEMPH_FAC, 0, 1, L_Q_MEM, L_FRAME, st->last_coder_type_fx, 1 ); + Preemph_scaled( new_inp, &Q_new, &st->mem_preemph_fx, st->Q_max, PREEMPH_FAC, 0, 1, L_Q_MEM, L_FRAME, st->last_coder_type, 1 ); Q_exp = sub(Q_new, st->Q_old); move16(); st->Q_old = Q_new; move16(); - Le_min_scaled = Scale_mem_pre_proc( st->ini_frame_fx, Q_exp, &Q_new, old_inp, &(st->mem_wsp_fx), hNoiseEst->enrO_fx, hNoiseEst->bckr_fx, hNoiseEst->ave_enr_fx, + Le_min_scaled = Scale_mem_pre_proc( st->ini_frame, Q_exp, &Q_new, old_inp, &(st->mem_wsp_fx), hNoiseEst->enrO_fx, hNoiseEst->bckr_fx, hNoiseEst->ave_enr_fx, hNoiseEst->ave_enr2_fx, hNoiseEst->fr_bands1_fx, hNoiseEst->fr_bands2_fx, st->Bin_E_old_fx ); Q_exp = sub(Q_new, st->prev_Q_new); @@ -292,17 +292,17 @@ void amr_wb_enc_fx( #ifdef IVAS_CODE_CPE hCPE, #endif - st->input_Fs_fx, inp, Q_new, fr_bands, lf_E, & Etot, st->min_band_fx, st->max_band_fx, Le_min_scaled, Scale_fac, st->Bin_E_fx, + st->input_Fs, inp, Q_new, fr_bands, lf_E, & Etot, st->min_band, st->max_band, Le_min_scaled, Scale_fac, st->Bin_E_fx, st->Bin_E_old_fx, PS, st->lgBin_E_fx, st->band_energies, fft_buff ); - noise_est_pre_fx( Etot, st->ini_frame_fx, hNoiseEst, 0, EVS_MONO, EVS_MONO); + noise_est_pre_fx( Etot, st->ini_frame, hNoiseEst, 0, EVS_MONO, EVS_MONO); /*----------------------------------------------------------------* * VAD *----------------------------------------------------------------*/ st->vad_flag = wb_vad_fx( st, fr_bands, &noisy_speech_HO, &clean_speech_HO, &NB_speech_HO, - &snr_sum_he, &localVAD_HE_SAD, &(st->flag_noisy_speech_snr), Q_new + &snr_sum_he, &localVAD_HE_SAD, &(st->flag_noisy_speech_snr_fx), Q_new , hVAD,hNoiseEst, st->lp_speech_fx, st->lp_noise_fx ) ; if (st->vad_flag == 0 ) @@ -318,7 +318,7 @@ void amr_wb_enc_fx( * Select SID or FRAME_NO_DATA frame if DTX enabled *-----------------------------------------------------------------*/ - IF ( NE_16(st->last_core_fx,AMR_WB_CORE)) + IF ( NE_16(st->last_core,AMR_WB_CORE)) { st->fd_cng_reset_flag = 1; move16(); @@ -341,7 +341,7 @@ void amr_wb_enc_fx( * Correlation correction as a function of total noise level *----------------------------------------------------------------*/ - noise_est_down_fx( fr_bands, hNoiseEst->bckr_fx, tmpN, tmpE, st->min_band_fx, st->max_band_fx, &hNoiseEst->totalNoise_fx, + noise_est_down_fx( fr_bands, hNoiseEst->bckr_fx, tmpN, tmpE, st->min_band, st->max_band, &hNoiseEst->totalNoise_fx, Etot, &hNoiseEst->Etot_last_fx, &hNoiseEst->Etot_v_h2_fx, Q_new, Le_min_scaled ); high_lpn_flag = 0; @@ -353,7 +353,7 @@ void amr_wb_enc_fx( ); relE = sub(Etot, st->lp_speech_fx); /* Q8 */ - IF( NE_16(st->bwidth_fx, NB)) + IF( NE_16(st->bwidth, NB)) { lp_bckr = Mean32(hNoiseEst->bckr_fx, 10 ); } @@ -361,7 +361,7 @@ void amr_wb_enc_fx( { lp_bckr = Mean32(hNoiseEst->bckr_fx+1, 9 ); } - hp_bckr = L_shr(L_add(hNoiseEst->bckr_fx[st->max_band_fx -1] , hNoiseEst->bckr_fx[st->max_band_fx]),1); + hp_bckr = L_shr(L_add(hNoiseEst->bckr_fx[st->max_band -1] , hNoiseEst->bckr_fx[st->max_band]),1); if( hp_bckr == 0 ) /* Avoid division by zero. */ { hp_bckr = L_deposit_l(1); @@ -376,12 +376,12 @@ void amr_wb_enc_fx( * WB, SWB and FB bandwidth detector *----------------------------------------------------------------*/ - bw_detect_fx( st, st->input, NULL, NULL, NULL, MONO_FORMAT, 0); + bw_detect_fx( st, st->input_fx, NULL, NULL, NULL, MONO_FORMAT, 0); /* in AMR_WB IO, limit the maximum band-width to WB */ - if( GT_16(st->bwidth_fx,WB)) + if( GT_16(st->bwidth,WB)) { - st->bwidth_fx = WB; + st->bwidth = WB; move16(); } @@ -395,7 +395,7 @@ void amr_wb_enc_fx( IF (st->vad_flag == 0 ) { /* reset the OL pitch tracker memories during inactive frames */ - pitch_ol_init_fx( &st->old_thres_fx, &st->old_pitch, &st->delta_pit_fx, &st->old_corr_fx) ; + pitch_ol_init_fx( &st->old_thres_fx, &st->old_pitch, &st->delta_pit, &st->old_corr_fx) ; } old_pitch1 = st->pitch_fx[1]; move16(); @@ -419,7 +419,7 @@ void amr_wb_enc_fx( shift = -1; move16(); } - pitch_ol_fx( st->pitch_fx, st->voicing_fx, &st->old_pitch, &st->old_corr_fx, corr_shift, &st->old_thres_fx, &st->delta_pit_fx, st->old_wsp2_fx, wsp, st->mem_decim2_fx, relE, 0, st->bwidth_fx, st->Opt_SC_VBR_fx ); + pitch_ol_fx( st->pitch_fx, st->voicing_fx, &st->old_pitch, &st->old_corr_fx, corr_shift, &st->old_thres_fx, &st->delta_pit, st->old_wsp2_fx, wsp, st->mem_decim2_fx, relE, 0, st->bwidth, st->Opt_SC_VBR ); st->old_pitch_la = st->pitch_fx[2]; move16(); st->old_voicing_la = st->voicing_fx[2]; @@ -438,7 +438,7 @@ void amr_wb_enc_fx( #ifdef IVAS_CODE NULL, NULL, #endif - st->ini_frame_fx); + st->ini_frame); /*----------------------------------------------------------------* * Change the sampling frequency to 16 kHz, @@ -446,17 +446,17 @@ void amr_wb_enc_fx( *----------------------------------------------------------------*/ test(); - IF( EQ_32(st->input_Fs_fx, 16000)) + IF( EQ_32(st->input_Fs, 16000)) { /* no resampling needed, only delay adjustement to account for the FIR resampling delay */ tmps = NS2SA_fx2(16000, DELAY_FIR_RESAMPL_NS); Copy_Scale_sig( &st->mem_decim16k_fx[tmps], new_inp_16k, tmps, -1 ); /* Input in Q0 -> Output in Q-1 to mimic the resampling filter */ - Copy_Scale_sig( st->input, new_inp_16k + tmps, sub(input_frame, tmps), -1 ); /* Input in Q0 -> Output in Q-1 to mimic the resampling filter */ - Copy( st->input + input_frame - shl(tmps,1), st->mem_decim16k_fx, shl(tmps,1) ); /* memory still in Q0 */ + Copy_Scale_sig( st->input_fx, new_inp_16k + tmps, sub(input_frame, tmps), -1 ); /* Input in Q0 -> Output in Q-1 to mimic the resampling filter */ + Copy( st->input_fx + input_frame - shl(tmps,1), st->mem_decim16k_fx, shl(tmps,1) ); /* memory still in Q0 */ } - ELSE IF( EQ_32(st->input_Fs_fx, 32000)||EQ_32(st->input_Fs_fx,48000)) + ELSE IF( EQ_32(st->input_Fs, 32000)||EQ_32(st->input_Fs,48000)) { - modify_Fs_fx( st->input, input_frame, st->input_Fs_fx, new_inp_16k, 16000, st->mem_decim16k_fx, 0 ); + modify_Fs_fx( st->input_fx, input_frame, st->input_Fs, new_inp_16k, 16000, st->mem_decim16k_fx, 0 ); } /*----------------------------------------------------------------* @@ -464,16 +464,16 @@ void amr_wb_enc_fx( *----------------------------------------------------------------*/ test(); - IF ( EQ_32(st->core_brate_fx,SID_1k75)||EQ_32(st->core_brate_fx,FRAME_NO_DATA)) + IF ( EQ_32(st->core_brate,SID_1k75)||EQ_32(st->core_brate,FRAME_NO_DATA)) { /* encode CNG parameters */ CNG_enc_fx( st, Aq, inp, ener, isp_new, isp_new, isf_new , &allow_cn_step, sub(Q_new,1), q_env, &sid_bw ); /* comfort noise generation */ - CNG_exc_fx( st->core_brate_fx, L_FRAME, &hTdCngEnc->Enew_fx, &hTdCngEnc->cng_seed, exc, exc2, &hTdCngEnc->lp_ener_fx, - st->last_core_brate_fx, &hDtxEnc->first_CNG, &hTdCngEnc->cng_ener_seed, dummy_buf, allow_cn_step, + CNG_exc_fx( st->core_brate, L_FRAME, &hTdCngEnc->Enew_fx, &hTdCngEnc->cng_seed, exc, exc2, &hTdCngEnc->lp_ener_fx, + st->last_core_brate, &hDtxEnc->first_CNG, &hTdCngEnc->cng_ener_seed, dummy_buf, allow_cn_step, &hTdCngEnc->last_allow_cn_step, sub(st->prev_Q_new,1), sub(Q_new,1), hTdCngEnc->num_ho, q_env, hTdCngEnc->lp_env_fx, - hTdCngEnc->old_env_fx, hTdCngEnc->exc_mem_fx, hTdCngEnc->exc_mem1_fx, &sid_bw, &hTdCngEnc->cng_ener_seed1, exc3, st->Opt_AMR_WB_fx, st->element_mode); + hTdCngEnc->old_env_fx, hTdCngEnc->exc_mem_fx, hTdCngEnc->exc_mem1_fx, &sid_bw, &hTdCngEnc->cng_ener_seed1, exc3, st->Opt_AMR_WB, st->element_mode); if (hDtxEnc->first_CNG == 0 ) { @@ -511,7 +511,7 @@ void amr_wb_enc_fx( * After inactive period, use the most up-to-date ISPs *-----------------------------------------------------------------*/ test(); - IF( EQ_32(st->last_core_brate_fx,FRAME_NO_DATA)||EQ_32(st->last_core_brate_fx,SID_1k75)) + IF( EQ_32(st->last_core_brate,FRAME_NO_DATA)||EQ_32(st->last_core_brate,SID_1k75)) { Copy(hDtxEnc->lspCNG_fx, st->lsp_old_fx, M ); E_LPC_isp_isf_conversion(hDtxEnc->lspCNG_fx, st->lsf_old_fx, M); @@ -570,7 +570,7 @@ void amr_wb_enc_fx( Copy( &old_inp[L_FRAME], st->old_inp_12k8_fx, L_INP_MEM ); /* update old input signal @16kHz buffer */ - IF( GT_32(st->input_Fs_fx,8000)) + IF( GT_32(st->input_Fs,8000)) { Copy( &old_inp_16k[L_FRAME16k], st->old_inp_16k_fx, L_INP_MEM ); } @@ -579,8 +579,8 @@ void amr_wb_enc_fx( Copy32( fr_bands + NB_BANDS, hNoiseEst->enrO_fx, NB_BANDS ); /* update the last bandwidth */ - st->last_input_bwidth_fx = st->input_bwidth_fx; - st->last_bwidth_fx = st->bwidth_fx; + st->last_input_bwidth = st->input_bwidth; + st->last_bwidth = st->bwidth; /* update signal buffers */ Copy( new_inp, st->buf_speech_enc_pe+L_FRAME, L_FRAME ); diff --git a/lib_enc/arith_coder_enc_fx.c b/lib_enc/arith_coder_enc_fx.c index 4d162f097..9a6bb3e77 100644 --- a/lib_enc/arith_coder_enc_fx.c +++ b/lib_enc/arith_coder_enc_fx.c @@ -673,7 +673,7 @@ void tcx_arith_encode_envelope_fx( Word16 signs[], /* o: signs (spectrum[.]<0) Q0 */ const Word16 L_frame, /* i: frame or MDCT length Q0 */ const Word16 L_spec, /* i: frame or MDCT length Q0 */ - Encoder_State_fx *st, /* i/o: coder state */ + Encoder_State *st, /* i/o: coder state */ const Word16 A_ind[], /* i: quantised LPC coefficients Q12 */ Word16 target_bits, /* i: number of available bits Q0 */ Word16 prm[], /* o: bitstream parameters Q0 */ diff --git a/lib_enc/bw_detect_fx.c b/lib_enc/bw_detect_fx.c index 87a328c53..07fcc6763 100644 --- a/lib_enc/bw_detect_fx.c +++ b/lib_enc/bw_detect_fx.c @@ -40,7 +40,7 @@ *--------------------------------------------------------------------*/ void bw_detect_fx( - Encoder_State_fx *st, /* i/o: Encoder State */ + Encoder_State *st, /* i/o: Encoder State */ const Word16 signal_in[], /* i : input signal */ Word16* spectrum, /* i : MDCT spectrum */ const Word32 *enerBuffer, /* i : CLDFB Energy Q31 */ @@ -79,19 +79,19 @@ void bw_detect_fx( bwd_count_wider_bw = BWD_COUNT_WIDER_BW; move16(); test();test();test();test();test(); - if (st->ini_frame_fx > 0 && ((EQ_16(st->element_mode, IVAS_CPE_MDCT) && (GE_32(st->element_brate, BWD_MIN_BRATE_WIDER_BW_MDCT) || mct_on)) || + if (st->ini_frame > 0 && ((EQ_16(st->element_mode, IVAS_CPE_MDCT) && (GE_32(st->element_brate, BWD_MIN_BRATE_WIDER_BW_MDCT) || mct_on)) || (EQ_16(ivas_format, ISM_FORMAT) && GE_32(st->element_brate, BWD_MIN_BRATE_WIDER_BW_ISM)))) { bwd_count_wider_bw = BWD_COUNT_WIDER_BW_MDCT; move16(); } - IF( GT_32(st->input_Fs_fx,8000)) + IF( GT_32(st->input_Fs,8000)) { IF ( enerBuffer != NULL) { n_bins = 9; move16(); - scale = st->cldfbAna_Fx->scale; + scale = st->cldfbAnaEnc->scale; move16();/* 7Q8 */ /*ScalFac = 1/ ( st->cldfbAnaEnc->scale * st->cldfbAnaEnc->scale * 8.f);*/ @@ -134,7 +134,7 @@ void bw_detect_fx( move32();/* 1/log2(10) */ /* Q25 */ /* WB: 4.4 - 7.2 kHz, 8 cldfb-bands, mid band(14) counted twice */ - IF( GE_32(st->input_Fs_fx,16000)) + IF( GE_32(st->input_Fs,16000)) { /* cldfb_bin[1] += Sum( &(enerBuffer[11]), cldfb_bin_width ); @@ -165,7 +165,7 @@ void bw_detect_fx( } /* SWB: 9.2 - 15.6 kHz, 16 cldfb-bands */ - IF( GE_32(st->input_Fs_fx,32000)) + IF( GE_32(st->input_Fs,32000)) { /* cldfb_bin[3] += Sum( &(enerBuffer[23]), cldfb_bin_width ); @@ -203,7 +203,7 @@ void bw_detect_fx( } /* FB: 16.8 - 20.0 kHz, 8 cldfb-bands */ - IF( GE_32(st->input_Fs_fx,48000)) + IF( GE_32(st->input_Fs,48000)) { /* cldfb_bin[7] += Sum( &(enerBuffer[42]), cldfb_bin_width ); @@ -241,7 +241,7 @@ void bw_detect_fx( { /* set width of a speactral bin (corresponds to 1.5kHz) */ - IF( EQ_32(st->input_Fs_fx,16000)) + IF( EQ_32(st->input_Fs,16000)) { bw_max = WB; move16(); @@ -250,7 +250,7 @@ void bw_detect_fx( n_bins = 5; move16(); /* spectrum to 7.5 kHz */ } - ELSE IF( EQ_32(st->input_Fs_fx,32000)) + ELSE IF( EQ_32(st->input_Fs,32000)) { bw_max = SWB; move16(); @@ -396,7 +396,7 @@ void bw_detect_fx( /*if WB */ - IF( EQ_32(st->input_Fs_fx,16000)) + IF( EQ_32(st->input_Fs,16000)) { /* for 16kHz sampled inputs, do not check SWB & FB */ mean_SWB = 0; @@ -411,7 +411,7 @@ void bw_detect_fx( ELSE { /* else if SWB */ - IF( EQ_32(st->input_Fs_fx,32000)) + IF( EQ_32(st->input_Fs,32000)) { /* for 32kHz sampled inputs, do not check FB */ @@ -478,7 +478,7 @@ void bw_detect_fx( L_tmp = L_mac(L_tmp,*pt++,16384); mean_WB = round_fx(L_tmp); - IF( EQ_32(st->input_Fs_fx,16000)) + IF( EQ_32(st->input_Fs,16000)) { /* for 16kHz sampled inputs, do not check SWB & FB */ mean_SWB = 0; @@ -501,7 +501,7 @@ void bw_detect_fx( L_tmp = L_mac(L_tmp,*pt++,8192); mean_SWB = round_fx(L_tmp); - IF( EQ_32(st->input_Fs_fx,48000)) + IF( EQ_32(st->input_Fs,48000)) { /* FB: 16.5-19.5kHz (2 bins) */ pt++; @@ -564,7 +564,7 @@ void bw_detect_fx( L_tmp1 = L_mult(max_NB, 4096); /* Q11 x (1 in Q12) -> Q24 */ IF( GT_32(L_tmp,L_tmp1)) /* Q24 */ { - st->count_WB_fx = add(st->count_WB_fx,1); + st->count_WB = add(st->count_WB,1); } } ELSE @@ -575,7 +575,7 @@ void bw_detect_fx( L_tmp = L_sub(L_tmp, L_tmp1); IF( L_tmp < 0 ) { - st->count_WB_fx = sub(st->count_WB_fx, 1); + st->count_WB = sub(st->count_WB, 1); } } @@ -602,7 +602,7 @@ void bw_detect_fx( L_tmp1 = L_sub(L_tmp1, L_tmp); /* Q24 - (Q11 x (1 in Q12) ) = Q24 */ IF(L_tmp1 > 0 ) { - st->count_SWB_fx = add(st->count_SWB_fx, 1); + st->count_SWB = add(st->count_SWB, 1); } } ELSE @@ -613,7 +613,7 @@ void bw_detect_fx( L_tmp1 = L_sub(L_tmp1,L_tmp); /* Q24 - (Q11 x (1 in Q12) ) = Q24 */ IF(L_tmp1 < 0 ) { - st->count_SWB_fx = sub(st->count_SWB_fx,1); + st->count_SWB = sub(st->count_SWB,1); } } /*if( max_FB > BWD_LT_THRESH_FX * st->lt_mean_SWB_fx && 0.83f * max_SWB > BWD_LT_THRESH_FX * st->lt_mean_WB_fx && max_WB > BWD_LT_THRESH_FX * st->lt_mean_NB_fx )*/ @@ -644,7 +644,7 @@ void bw_detect_fx( L_tmp1 = L_sub(L_tmp1, L_tmp); /* Q24 */ IF(L_tmp1 > 0 ) { - st->count_FB_fx = add(st->count_FB_fx,1); + st->count_FB = add(st->count_FB,1); } } ELSE @@ -655,7 +655,7 @@ void bw_detect_fx( L_tmp1 = L_sub(L_tmp1,L_tmp); /* Q24 */ IF(L_tmp1 < 0 ) { - st->count_FB_fx = sub(st->count_FB_fx,1); + st->count_FB = sub(st->count_FB,1); } } @@ -669,7 +669,7 @@ void bw_detect_fx( L_tmp = L_mult(8192,max_WB); /* 2.0 in Q12 x Q11 -> Q24*/ if( L_msu(L_tmp,max_NB,4096) > 0 ) { - st->count_WB_fx = add(st->count_WB_fx,1); + st->count_WB = add(st->count_WB,1); } } ELSE @@ -681,7 +681,7 @@ void bw_detect_fx( test(); if( L_tmp < 0 && !(EQ_16(mean_WB,-1)&&EQ_16(mean_NB,-1))) { - st->count_WB_fx = sub(st->count_WB_fx, 1); + st->count_WB = sub(st->count_WB, 1); } } @@ -694,7 +694,7 @@ void bw_detect_fx( L_tmp = L_mult(8192,max_SWB); /* 2.0 in Q12 x Q11 -> Q24*/ if( L_msu(L_tmp,max_WB,4096) > 0 ) { - st->count_SWB_fx = add(st->count_SWB_fx,1); + st->count_SWB = add(st->count_SWB,1); } } ELSE @@ -706,7 +706,7 @@ void bw_detect_fx( test(); if( L_tmp < 0 && !(EQ_16(mean_SWB,-1)&&EQ_16(mean_WB,-1))) { - st->count_SWB_fx = sub(st->count_SWB_fx,1); + st->count_SWB = sub(st->count_SWB,1); } } @@ -719,7 +719,7 @@ void bw_detect_fx( L_tmp = L_mult(8192,max_FB); /* 2.0 in Q12 x Q11 -> Q24*/ if( L_msu(L_tmp,max_SWB,4096) > 0 ) { - st->count_FB_fx = add(st->count_FB_fx,1); + st->count_FB = add(st->count_FB,1); } } ELSE @@ -730,22 +730,22 @@ void bw_detect_fx( test(); if( L_msu(L_tmp,mean_SWB,4096) < 0 && !(EQ_16(mean_FB,-1)&&EQ_16(mean_SWB,-1))) { - st->count_FB_fx = sub(st->count_FB_fx,1); + st->count_FB = sub(st->count_FB,1); } } } - st->count_WB_fx = s_min(st->count_WB_fx,BWD_COUNT_MAX); + st->count_WB = s_min(st->count_WB,BWD_COUNT_MAX); move16(); - st->count_SWB_fx = s_min(st->count_SWB_fx,BWD_COUNT_MAX); + st->count_SWB = s_min(st->count_SWB,BWD_COUNT_MAX); move16(); - st->count_FB_fx = s_min(st->count_FB_fx,BWD_COUNT_MAX); + st->count_FB = s_min(st->count_FB,BWD_COUNT_MAX); move16(); - st->count_WB_fx = s_max(st->count_WB_fx,0); + st->count_WB = s_max(st->count_WB,0); move16(); - st->count_SWB_fx = s_max(st->count_SWB_fx,0); + st->count_SWB = s_max(st->count_SWB,0); move16(); - st->count_FB_fx = s_max(st->count_FB_fx,0); + st->count_FB = s_max(st->count_FB,0); move16(); /*---------------------------------------------------------------------* @@ -754,27 +754,27 @@ void bw_detect_fx( *---------------------------------------------------------------------*/ /* switching to a higher BW */ - IF( EQ_16(st->last_input_bwidth_fx,NB)) + IF( EQ_16(st->last_input_bwidth,NB)) { - IF( GT_16(st->count_WB_fx, bwd_count_wider_bw)) + IF( GT_16(st->count_WB, bwd_count_wider_bw)) { - st->input_bwidth_fx = WB; + st->input_bwidth = WB; move16(); - st->count_WB_fx = BWD_COUNT_MAX; + st->count_WB = BWD_COUNT_MAX; move16(); - IF( GT_16(st->count_SWB_fx, bwd_count_wider_bw)) + IF( GT_16(st->count_SWB, bwd_count_wider_bw)) { - st->input_bwidth_fx = SWB; + st->input_bwidth = SWB; move16(); - st->count_SWB_fx = BWD_COUNT_MAX; + st->count_SWB = BWD_COUNT_MAX; move16(); - IF( GT_16(st->count_FB_fx, bwd_count_wider_bw)) + IF( GT_16(st->count_FB, bwd_count_wider_bw)) { - st->input_bwidth_fx = FB; + st->input_bwidth = FB; move16(); - st->count_FB_fx = BWD_COUNT_MAX; + st->count_FB = BWD_COUNT_MAX; move16(); } } @@ -782,105 +782,105 @@ void bw_detect_fx( } test(); - IF( EQ_16(st->last_input_bwidth_fx,WB)&>_32(st->input_Fs_fx,16000)) + IF( EQ_16(st->last_input_bwidth,WB)&>_32(st->input_Fs,16000)) { - IF( GT_16(st->count_SWB_fx, bwd_count_wider_bw)) + IF( GT_16(st->count_SWB, bwd_count_wider_bw)) { - st->input_bwidth_fx = SWB; + st->input_bwidth = SWB; move16(); - st->count_SWB_fx = BWD_COUNT_MAX; + st->count_SWB = BWD_COUNT_MAX; move16(); - IF( GT_16(st->count_FB_fx, bwd_count_wider_bw)) + IF( GT_16(st->count_FB, bwd_count_wider_bw)) { - st->input_bwidth_fx = FB; + st->input_bwidth = FB; move16(); - st->count_FB_fx = BWD_COUNT_MAX; + st->count_FB = BWD_COUNT_MAX; move16(); } } } test(); - IF( EQ_16(st->last_input_bwidth_fx,SWB)&>_32(st->input_Fs_fx,32000)) + IF( EQ_16(st->last_input_bwidth,SWB)&>_32(st->input_Fs,32000)) { - IF( GT_16(st->count_FB_fx, bwd_count_wider_bw)) + IF( GT_16(st->count_FB, bwd_count_wider_bw)) { - st->input_bwidth_fx = FB; + st->input_bwidth = FB; move16(); - st->count_FB_fx = BWD_COUNT_MAX; + st->count_FB = BWD_COUNT_MAX; move16(); } } /* switching to a lower BW */ - IF( EQ_16(st->last_input_bwidth_fx,FB)) + IF( EQ_16(st->last_input_bwidth,FB)) { - IF( LT_16(st->count_FB_fx,10)) + IF( LT_16(st->count_FB,10)) { - st->input_bwidth_fx = SWB; + st->input_bwidth = SWB; move16(); - st->count_FB_fx = 0; + st->count_FB = 0; move16(); } - IF( LT_16(st->count_SWB_fx,10)) + IF( LT_16(st->count_SWB,10)) { - st->input_bwidth_fx = WB; + st->input_bwidth = WB; move16(); - st->count_SWB_fx = 0; + st->count_SWB = 0; move16(); - st->count_FB_fx = 0; + st->count_FB = 0; move16(); } - IF( LT_16(st->count_WB_fx,10)) + IF( LT_16(st->count_WB,10)) { - st->input_bwidth_fx = NB; + st->input_bwidth = NB; move16(); - st->count_WB_fx = 0; + st->count_WB = 0; move16(); - st->count_SWB_fx = 0; + st->count_SWB = 0; move16(); - st->count_FB_fx = 0; + st->count_FB = 0; move16(); } } - IF( EQ_16(st->last_input_bwidth_fx,SWB)) + IF( EQ_16(st->last_input_bwidth,SWB)) { - IF( LT_16(st->count_SWB_fx,10)) + IF( LT_16(st->count_SWB,10)) { - st->input_bwidth_fx = WB; + st->input_bwidth = WB; move16(); - st->count_SWB_fx = 0; + st->count_SWB = 0; move16(); - st->count_FB_fx = 0; + st->count_FB = 0; move16(); } - IF( LT_16(st->count_WB_fx,10)) + IF( LT_16(st->count_WB,10)) { - st->input_bwidth_fx = NB; + st->input_bwidth = NB; move16(); - st->count_WB_fx = 0; + st->count_WB = 0; move16(); - st->count_SWB_fx = 0; + st->count_SWB = 0; move16(); - st->count_FB_fx = 0; + st->count_FB = 0; move16(); } } - IF( EQ_16(st->last_input_bwidth_fx,WB)) + IF( EQ_16(st->last_input_bwidth,WB)) { - IF( LT_16(st->count_WB_fx,10)) + IF( LT_16(st->count_WB,10)) { - st->input_bwidth_fx = NB; + st->input_bwidth = NB; move16(); - st->count_WB_fx = 0; + st->count_WB = 0; move16(); - st->count_SWB_fx = 0; + st->count_SWB = 0; move16(); - st->count_FB_fx = 0; + st->count_FB = 0; move16(); } } @@ -889,9 +889,9 @@ void bw_detect_fx( /* verify that maximum encoded bandwidth (specified on the command line) is not exceeded */ - IF( GT_16(st->input_bwidth_fx,st->max_bwidth_fx)) + IF( GT_16(st->input_bwidth,st->max_bwidth)) { - st->input_bwidth_fx = st->max_bwidth_fx; + st->input_bwidth = st->max_bwidth; move16(); } IF (EQ_16(st->element_mode, EVS_MONO) ) @@ -911,23 +911,23 @@ void bw_detect_fx( void set_bw_fx( const Word16 element_mode, /* i : element mode */ const Word32 element_brate, /* i : element bitrate */ - Encoder_State_fx* st, /* i/o: Encoder State */ + Encoder_State* st, /* i/o: Encoder State */ const Word16 codec_mode /* i : codec mode */ ) { Word32 total_brate_fx, L_tmp; /* initialization */ - st->bwidth_fx = st->input_bwidth_fx; + st->bwidth = st->input_bwidth; move16(); /* Set and limit the encoded bandwidth */ IF(EQ_16(st->codec_mode, MODE1)) { - st->bwidth_fx = st->input_bwidth_fx; + st->bwidth = st->input_bwidth; move16(); - total_brate_fx = L_add(st->total_brate_fx, 0); + total_brate_fx = L_add(st->total_brate, 0); /* change the encoded bandwidth, if not supported at particular bitrate */ test(); @@ -940,7 +940,7 @@ void set_bw_fx( //PMT("this IVAS_SCE section has not been verified ") IF (LT_32(element_brate, MIN_BRATE_SWB_STEREO)) { - st->bwidth_fx = WB; + st->bwidth = WB; move16(); } ELSE @@ -950,17 +950,17 @@ void set_bw_fx( { IF (GE_32(element_brate, MIN_BRATE_FB_STEREO)) { - st->bwidth_fx = s_min(st->bwidth_fx, FB); + st->bwidth = s_min(st->bwidth, FB); } ELSE { - st->bwidth_fx = s_min(st->bwidth_fx, SWB); + st->bwidth = s_min(st->bwidth, SWB); } - st->bwidth_fx = s_max(st->bwidth_fx, WB); + st->bwidth = s_max(st->bwidth, WB); } ELSE { - st->bwidth_fx = WB; + st->bwidth = WB; move16(); } } @@ -968,35 +968,35 @@ void set_bw_fx( ELSE IF (EQ_16(element_mode, IVAS_SCE)) { test(); - IF ( LT_32(element_brate, MIN_BRATE_SWB_SCE) || LT_16(st->bwidth_fx, WB) ) + IF ( LT_32(element_brate, MIN_BRATE_SWB_SCE) || LT_16(st->bwidth, WB) ) { - st->bwidth_fx = WB; + st->bwidth = WB; move16(); } - ELSE IF (GT_16(st->bwidth_fx, SWB) && ((LT_32(element_brate, MIN_BRATE_FB_STEREO) && !st->is_ism_format) || (LT_32(element_brate, MIN_BRATE_FB_ISM) && st->is_ism_format))) + ELSE IF (GT_16(st->bwidth, SWB) && ((LT_32(element_brate, MIN_BRATE_FB_STEREO) && !st->is_ism_format) || (LT_32(element_brate, MIN_BRATE_FB_ISM) && st->is_ism_format))) { - st->bwidth_fx = SWB; + st->bwidth = SWB; move16(); } ELSE IF (GT_32(element_brate, BWD_MAX_BRATE_WIDER_BW_ISM)) { - st->bwidth_fx = st->max_bwidth_fx; move16(); + st->bwidth = st->max_bwidth; move16(); } } /* element_mode == EVS_MONO */ - ELSE IF(LE_32(total_brate_fx, ACELP_9k60) && GT_16(st->bwidth_fx, WB) ) + ELSE IF(LE_32(total_brate_fx, ACELP_9k60) && GT_16(st->bwidth, WB) ) { - st->bwidth_fx = WB; + st->bwidth = WB; move16(); } - ELSE IF(GE_32(st->total_brate_fx, ACELP_13k20) && LE_32(st->total_brate_fx, ACELP_16k40) && GT_16(st->bwidth_fx, SWB)) + ELSE IF(GE_32(st->total_brate, ACELP_13k20) && LE_32(st->total_brate, ACELP_16k40) && GT_16(st->bwidth, SWB)) { - st->bwidth_fx = SWB; + st->bwidth = SWB; move16(); } - ELSE IF(GE_32(st->total_brate_fx, ACELP_32k) && LT_16(st->bwidth_fx, WB)) + ELSE IF(GE_32(st->total_brate, ACELP_32k) && LT_16(st->bwidth, WB)) { - st->bwidth_fx = WB; + st->bwidth = WB; move16(); } } @@ -1007,7 +1007,7 @@ void set_bw_fx( UWord16 lsb; Word16 tmpbandwidthMin; - Mpy_32_16_ss(st->total_brate_fx, 5243, &L_tmp, &lsb); /* 5243 is 1/50 in Q18. (0+18-15=3) */ + Mpy_32_16_ss(st->total_brate, 5243, &L_tmp, &lsb); /* 5243 is 1/50 in Q18. (0+18-15=3) */ bits_frame_nominal = extract_l(L_shr(L_tmp, 3)); /* Q0 */ FOR(n = 0; n < FRAME_SIZE_NB; n++) @@ -1026,7 +1026,7 @@ void set_bw_fx( { tmpbandwidthMin = WB; } - st->bwidth_fx = s_max(s_min(st->input_bwidth_fx, FrameSizeConfig[n].bandwidth_max), tmpbandwidthMin); + st->bwidth = s_max(s_min(st->input_bwidth, FrameSizeConfig[n].bandwidth_max), tmpbandwidthMin); } } #ifdef IVAS_CODE_BWD diff --git a/lib_enc/cng_enc_fx.c b/lib_enc/cng_enc_fx.c index d66280e38..75152a28d 100644 --- a/lib_enc/cng_enc_fx.c +++ b/lib_enc/cng_enc_fx.c @@ -25,15 +25,15 @@ /*---------------------------------------------------------------------* * Local function prototypes *---------------------------------------------------------------------*/ -static void shb_CNG_encod_fx(Encoder_State_fx *st_fx, const Word16 update_fx ); -static Word16 shb_DTX_fx(Encoder_State_fx *st_fx, const Word16 *shb_speech_fx, const Word16 *syn_12k8_16k ); +static void shb_CNG_encod_fx(Encoder_State *st_fx, const Word16 update_fx ); +static Word16 shb_DTX_fx(Encoder_State *st_fx, const Word16 *shb_speech_fx, const Word16 *syn_12k8_16k ); /*---------------------------------------------------------------------* * CNG_enc() * * Confort noise generation for the coder *---------------------------------------------------------------------*/ void CNG_enc_fx( - Encoder_State_fx *st_fx,/* i/o: State structure */ + Encoder_State *st_fx,/* i/o: State structure */ Word16 Aq[], /* o : LP coefficients Q12 */ const Word16 *speech, /* i : pointer to current frame input speech buffer Q_new */ Word32 L_enr, /* i : residual energy from Levinson-Durbin Q6 */ @@ -114,7 +114,7 @@ void CNG_enc_fx( pt_sp = speech; L_ener = L_deposit_l(1); /* L_ener = L_add(L_shr(sum2_f_fx( speech, L_frame ), 8) , L_ener);*/ - IF( EQ_16(st_fx->L_frame_fx, L_FRAME)) + IF( EQ_16(st_fx->L_frame, L_FRAME)) { FOR (j=0; j<128; j++) { @@ -164,7 +164,7 @@ void CNG_enc_fx( test(); test(); test(); - IF( GT_32(st_fx->last_core_brate_fx, SID_2k40) && ( EQ_16( st_fx->last_core_fx, HQ_CORE ) || st_fx->hTdCngEnc->burst_ho_cnt > 0 ) && LT_16(hTdCngEnc->lp_sp_enr_fx, 1536) && + IF( GT_32(st_fx->last_core_brate, SID_2k40) && ( EQ_16( st_fx->last_core, HQ_CORE ) || st_fx->hTdCngEnc->burst_ho_cnt > 0 ) && LT_16(hTdCngEnc->lp_sp_enr_fx, 1536) && GT_16(sub(sp_enr, hTdCngEnc->lp_sp_enr_fx), 1024) && GT_16(sp_enr, 1536) ) { hTdCngEnc->lp_sp_enr_fx = sp_enr; @@ -194,14 +194,14 @@ void CNG_enc_fx( *-----------------------------------------------------------------*/ test(); test(); - IF( (EQ_32(st_fx->core_brate_fx, SID_2k40) || EQ_32(st_fx->core_brate_fx,SID_1k75)) && GE_16(hDtxEnc->cng_cnt,sub(hDtxEnc->cng_hist_size,1))) + IF( (EQ_32(st_fx->core_brate, SID_2k40) || EQ_32(st_fx->core_brate,SID_1k75)) && GE_16(hDtxEnc->cng_cnt,sub(hDtxEnc->cng_hist_size,1))) { set32_fx( max_val, 0, 2 ); set16_fx( max_idx, 0, 2 ); FOR( i=0; i< hDtxEnc->cng_hist_size; i++ ) { - IF ( EQ_16(st_fx->L_frame_fx,L_FRAME)) + IF ( EQ_16(st_fx->L_frame,L_FRAME)) { lsp2lsf_fx( &hTdCngEnc->cng_lsp_hist_fx[i*M], lsf_tmp, M, INT_FS_FX ); ftmp_fx = 964; @@ -285,7 +285,7 @@ void CNG_enc_fx( (LT_16(add(st_lp_sp_enr, 1024 /* 4.0, Q8 */), sp_enr)) && (hDtxEnc->first_CNG != 0) && (hTdCngEnc->old_enr_index >= 0) && - (GT_32(st_fx->last_core_brate_fx, SID_2k40))) || + (GT_32(st_fx->last_core_brate, SID_2k40))) || EQ_16(force_cn_step, 1)) { *allow_cn_step = 1; @@ -311,10 +311,10 @@ void CNG_enc_fx( test(); - IF( EQ_32(st_fx->core_brate_fx, SID_2k40) || EQ_32(st_fx->core_brate_fx,SID_1k75)) + IF( EQ_32(st_fx->core_brate, SID_2k40) || EQ_32(st_fx->core_brate,SID_1k75)) { /* LSF quantization */ - IF ( st_fx->Opt_AMR_WB_fx != 0 ) + IF ( st_fx->Opt_AMR_WB != 0 ) { isf_enc_amr_wb_fx( st_fx, lsf_new, lsp_new, 0); } @@ -329,7 +329,7 @@ void CNG_enc_fx( /* Reset CNG history if CNG frame length is changed */ test(); test(); - if ( EQ_16(st_fx->bwidth_fx,WB) && hDtxEnc->first_CNG!=0 && NE_16(st_fx->L_frame_fx, hDtxEnc->last_CNG_L_frame)) + if ( EQ_16(st_fx->bwidth,WB) && hDtxEnc->first_CNG!=0 && NE_16(st_fx->L_frame, hDtxEnc->last_CNG_L_frame)) { hTdCngEnc->ho_hist_size = 0; move16(); @@ -347,10 +347,10 @@ void CNG_enc_fx( * Find A(z) coefficients *---------------------------------------------------------------------*/ - IF( LE_32(st_fx->last_core_brate_fx, SID_2k40)) + IF( LE_32(st_fx->last_core_brate, SID_2k40)) { /* Reset hangover counter if not first SID period */ - if( GT_32(st_fx->core_brate_fx,FRAME_NO_DATA)) + if( GT_32(st_fx->core_brate,FRAME_NO_DATA)) { hTdCngEnc->num_ho = 0; move16(); @@ -373,7 +373,7 @@ void CNG_enc_fx( test(); test(); test(); - IF( EQ_16(st_fx->element_mode, EVS_MONO) && (( st_fx->Opt_AMR_WB_fx || EQ_16(st_fx->bwidth_fx,WB)) + IF( EQ_16(st_fx->element_mode, EVS_MONO) && (( st_fx->Opt_AMR_WB || EQ_16(st_fx->bwidth,WB)) && ( !hDtxEnc->first_CNG || GE_16(hTdCngEnc->act_cnt2,MIN_ACT_CNG_UPD) ) ) ) { IF (GT_32(hDtxEnc->last_active_brate, ACELP_16k40)) @@ -410,12 +410,12 @@ void CNG_enc_fx( /* Conversion between 12.8k and 16k LSPs */ test(); test(); - IF( EQ_16(st_fx->L_frame_fx,L_FRAME )&&EQ_16(hTdCngEnc->ho_16k_lsp[s_ptr],1)) + IF( EQ_16(st_fx->L_frame,L_FRAME )&&EQ_16(hTdCngEnc->ho_16k_lsp[s_ptr],1)) { /* Conversion from 16k LPSs to 12k8 */ - lsp_convert_poly_fx( &(hTdCngEnc->ho_lsp_circ_fx[s_ptr*M]), st_fx->L_frame_fx, 0 ); + lsp_convert_poly_fx( &(hTdCngEnc->ho_lsp_circ_fx[s_ptr*M]), st_fx->L_frame, 0 ); } - ELSE IF ( EQ_16(st_fx->L_frame_fx,L_FRAME16k)&& hTdCngEnc->ho_16k_lsp[s_ptr]==0) + ELSE IF ( EQ_16(st_fx->L_frame,L_FRAME16k)&& hTdCngEnc->ho_16k_lsp[s_ptr]==0) { /* 16k LSPs already converted and stored, just copy to the other buffer */ Copy(&(hTdCngEnc->ho_lsp_circ2_fx[s_ptr*M]), &(hTdCngEnc->ho_lsp_circ_fx[s_ptr*M]), M ); @@ -529,7 +529,7 @@ void CNG_enc_fx( FOR( i=0; iL_frame_fx,L_FRAME)) + IF ( EQ_16(st_fx->L_frame,L_FRAME)) { lsp2lsf_fx( &tmp[i*M], lsf_tmp, M, INT_FS_FX ); ftmp_fx = 964; @@ -683,7 +683,7 @@ void CNG_enc_fx( Copy( lsp_new, hDtxEnc->lspCNG_fx, M ); /* use newly analyzed ISFs */ } } - IF ( st_fx->Opt_AMR_WB_fx != 0 ) + IF ( st_fx->Opt_AMR_WB != 0 ) { E_LPC_f_isp_a_conversion(hDtxEnc->lspCNG_fx, Aq, M ); } @@ -692,7 +692,7 @@ void CNG_enc_fx( E_LPC_f_lsp_a_conversion(hDtxEnc->lspCNG_fx, Aq, M ); /* Find A(z) (not interpolated) */ } - tmp_loop = shr(st_fx->L_frame_fx,6); + tmp_loop = shr(st_fx->L_frame,6); FOR( i=1; iL_frame_fx, 0); - Copy(res, res1, st_fx->L_frame_fx); + Residu3_fx(Aq, speech, res, st_fx->L_frame, 0); + Copy(res, res1, st_fx->L_frame); test(); IF (EQ_16(st_fx->element_mode, IVAS_CPE_DFT) || EQ_16(st_fx->element_mode, IVAS_CPE_TD)) { @@ -714,10 +714,10 @@ void CNG_enc_fx( v_multc(res1, att, res1, st->L_frame); #endif } - ELSE IF( NE_16(st_fx->bwidth_fx,NB)) + ELSE IF( NE_16(st_fx->bwidth,NB)) { test(); - IF( EQ_16(st_fx->bwidth_fx,WB) && hDtxEnc->CNG_mode>=0) + IF( EQ_16(st_fx->bwidth,WB) && hDtxEnc->CNG_mode>=0) { ftmp_fx = HO_ATT_FX[hDtxEnc->CNG_mode]; } @@ -734,7 +734,7 @@ void CNG_enc_fx( att = div_s(16374,tmp1); /* Q15 */ att = s_max(att, ftmp_fx); - FOR( i = 0; i < st_fx->L_frame_fx; i++ ) + FOR( i = 0; i < st_fx->L_frame; i++ ) { /*res1[i] *= att;*/ res1[i] = mult(res1[i],att); @@ -744,9 +744,9 @@ void CNG_enc_fx( } /* calculate the spectrum of residual signal */ - Copy(res1, fft_io, st_fx->L_frame_fx); + Copy(res1, fft_io, st_fx->L_frame); - IF ( EQ_16(st_fx->L_frame_fx,L_FRAME16k)) + IF ( EQ_16(st_fx->L_frame,L_FRAME16k)) { modify_Fs_fx( fft_io, L_FRAME16k, 16000, fft_io, 12800, hTdCngEnc->exc_mem2_fx,0); } @@ -780,14 +780,14 @@ void CNG_enc_fx( /*enr = dotp( res, res, L_frame ) / L_frame; */ maxv = 0; move16(); - FOR(i = 0; i < st_fx->L_frame_fx; i++) + FOR(i = 0; i < st_fx->L_frame; i++) { maxv = s_max(maxv, abs_s(res[i])); } scale = norm_s(maxv); pt_res = res; L_ener = L_deposit_l(1); - IF( EQ_16(st_fx->L_frame_fx, L_FRAME)) + IF( EQ_16(st_fx->L_frame, L_FRAME)) { FOR (j=0; j<128; j++) { @@ -830,7 +830,7 @@ void CNG_enc_fx( * Quantize residual signal energy (only in SID frame) *-----------------------------------------------------------------*/ test(); - IF( EQ_32(st_fx->core_brate_fx, SID_2k40)||EQ_32(st_fx->core_brate_fx,SID_1k75)) + IF( EQ_32(st_fx->core_brate, SID_2k40)||EQ_32(st_fx->core_brate,SID_1k75)) { IF( GE_16(hDtxEnc->cng_cnt,sub(hDtxEnc->cng_hist_size,1))) { @@ -897,9 +897,9 @@ void CNG_enc_fx( //IVAS_CODE //enr += hTdCngEnc->CNG_att * FAC_LOG2 / 10.0f; } - ELSE IF( NE_16(st_fx->bwidth_fx, NB)) + ELSE IF( NE_16(st_fx->bwidth, NB)) { - IF( EQ_16(st_fx->bwidth_fx,WB)) + IF( EQ_16(st_fx->bwidth,WB)) { IF(hDtxEnc->CNG_mode >= 0 ) { @@ -922,7 +922,7 @@ void CNG_enc_fx( enr = sub(enr, att ); } /* intialize the energy quantization parameters */ - IF( st_fx->Opt_AMR_WB_fx == 0 ) + IF( st_fx->Opt_AMR_WB == 0 ) { step = STEP_SID_FX; move16(); @@ -983,12 +983,12 @@ void CNG_enc_fx( /* substract by 2 not done to leave Energy in Q2 */ lo = L_Extract_lc(L_tmp, &hi); hTdCngEnc->Enew_fx = Pow2(add(hi, 4), lo); /* Q6 */ - IF ( EQ_32(st_fx->core_brate_fx, SID_2k40)) + IF ( EQ_32(st_fx->core_brate, SID_2k40)) { /* enr1 = (float)log10( st->Enew*L_frame + 0.1f ) / (float)log10( 2.0f );*/ exp = norm_l(hTdCngEnc->Enew_fx); L_tmp = L_shl(hTdCngEnc->Enew_fx,exp); /*Q(exp+6) */ - L_tmp = Mult_32_16(L_tmp,shl(st_fx->L_frame_fx,5));/* Q(exp+6+5-15=exp-4) */ + L_tmp = Mult_32_16(L_tmp,shl(st_fx->L_frame,5));/* Q(exp+6+5-15=exp-4) */ L_tmp = L_shr(L_tmp,sub(exp,10)); /* Q6 */ exp = norm_l(L_tmp); @@ -1086,7 +1086,7 @@ void CNG_enc_fx( /* update the hangover energy buffer */ hTdCngEnc->ho_ener_hist_fx[hTdCngEnc->ho_hist_ptr] = hTdCngEnc->Enew_fx; move32(); - IF ( EQ_32(st_fx->core_brate_fx, SID_2k40)) + IF ( EQ_32(st_fx->core_brate, SID_2k40)) { FOR ( i=0; icore_brate_fx, SID_1k75)) + IF( EQ_32(st_fx->core_brate, SID_1k75)) { push_indice_fx( hBstr, IND_DITHERING, 0, 1 ); } - IF ( EQ_32(st_fx->core_brate_fx, SID_2k40)) + IF ( EQ_32(st_fx->core_brate, SID_2k40)) { - IF(EQ_16(st_fx->L_frame_fx, L_FRAME16k)) + IF(EQ_16(st_fx->L_frame, L_FRAME16k)) { push_indice_fx( hBstr, IND_ACELP_16KHZ, 1, 1 ); } @@ -1135,7 +1135,7 @@ void CNG_enc_fx( move16(); push_indice_fx( hBstr, IND_SID_TYPE, 0, 1 ); - IF ( LT_32(st_fx->input_Fs_fx, 32000) && NE_16(st_fx->element_mode, IVAS_CPE_DFT)) + IF ( LT_32(st_fx->input_Fs, 32000) && NE_16(st_fx->element_mode, IVAS_CPE_DFT)) { push_indice_fx( hBstr, IND_SID_BW, 0, 1 ); *sid_bw = 0; @@ -1148,14 +1148,14 @@ void CNG_enc_fx( *-----------------------------------------------------------------*/ /* update the SID frames counter */ test(); - IF( EQ_32(st_fx->core_brate_fx, SID_2k40)||EQ_32(st_fx->core_brate_fx,SID_1k75)) + IF( EQ_32(st_fx->core_brate, SID_2k40)||EQ_32(st_fx->core_brate,SID_1k75)) { hDtxEnc->cng_cnt = 0; move16(); hTdCngEnc->cng_hist_ptr = -1; move16(); /* update frame length memory */ - hDtxEnc->last_CNG_L_frame = st_fx->L_frame_fx; + hDtxEnc->last_CNG_L_frame = st_fx->L_frame; move16(); } ELSE @@ -1171,7 +1171,7 @@ void CNG_enc_fx( * SWB DTX/CNG encoding *---------------------------------------------------------------------*/ void swb_CNG_enc_fx( - Encoder_State_fx *st_fx, /* i/o: State structure */ + Encoder_State *st_fx, /* i/o: State structure */ const Word16 *shb_speech_fx, /* i : SHB target signal (6-14kHz) at 16kHz (Q0) */ const Word16 *syn_12k8_16k_fx /* i : ACELP core synthesis at 12.8kHz or 16kHz (st_fx->Q_syn = 0) */ ) @@ -1180,11 +1180,11 @@ void swb_CNG_enc_fx( TD_CNG_ENC_HANDLE hTdCngEnc = st_fx->hTdCngEnc; test(); - IF ( EQ_32(st_fx->core_brate_fx, SID_2k40)||st_fx->core_brate_fx==FRAME_NO_DATA) + IF ( EQ_32(st_fx->core_brate, SID_2k40)||st_fx->core_brate==FRAME_NO_DATA) { - IF (EQ_16(st_fx->cng_type_fx,LP_CNG)) + IF (EQ_16(st_fx->cng_type,LP_CNG)) { - IF (GE_32(st_fx->input_Fs_fx, L_FRAME32k * FRAMES_PER_SEC)) + IF (GE_32(st_fx->input_Fs, L_FRAME32k * FRAMES_PER_SEC)) { /* decide if SHB SID encoding or not */ shb_SID_updt_fx = shb_DTX_fx(st_fx, shb_speech_fx, syn_12k8_16k_fx); @@ -1192,7 +1192,7 @@ void swb_CNG_enc_fx( /* SHB CNG encoding */ shb_CNG_encod_fx(st_fx, shb_SID_updt_fx); } - ELSE IF (EQ_16(st_fx->element_mode, IVAS_CPE_DFT) && EQ_32(st_fx->core_brate_fx, SID_2k40)) + ELSE IF (EQ_16(st_fx->element_mode, IVAS_CPE_DFT) && EQ_32(st_fx->core_brate, SID_2k40)) { //PMT("CNG IVAS_CPE_DFT code not implemented") #ifdef IVAS_CODE @@ -1222,7 +1222,7 @@ void swb_CNG_enc_fx( * SID parameters encoding for SHB signal *---------------------------------------------------------------------*/ static void shb_CNG_encod_fx( - Encoder_State_fx *st_fx, /* i/o: State structure */ + Encoder_State *st_fx, /* i/o: State structure */ const Word16 update_fx /* i : SID update flag */ ) { @@ -1251,7 +1251,7 @@ static void shb_CNG_encod_fx( #endif } - if ( LT_16(st_fx->bwidth_fx, SWB)) + if ( LT_16(st_fx->bwidth, SWB)) { idx_ener_fx = 0; move16(); @@ -1308,7 +1308,7 @@ static void shb_CNG_encod_fx( } ELSE { - IF ( EQ_32(st_fx->core_brate_fx, SID_2k40)) + IF ( EQ_32(st_fx->core_brate, SID_2k40)) { hTdCngEnc->ho_sid_bw = L_shl(L_and(hTdCngEnc->ho_sid_bw, (Word32) 0x3fffffffL ), 1); push_indice_fx( hBstr, IND_SID_BW, 0, 1 ); @@ -1324,7 +1324,7 @@ static void shb_CNG_encod_fx( * Decide if encoding SHB SID or not *---------------------------------------------------------------------*/ static Word16 shb_DTX_fx( - Encoder_State_fx *st_fx, /* i/o: State structure */ + Encoder_State *st_fx, /* i/o: State structure */ const Word16 *shb_speech_fx, /* i : SHB target signal (6-14kHz) at 16kHz (Q0) */ const Word16 *syn_12k8_16k /* i : ACELP core synthesis at 12.8kHz or 16kHz (st_fx->Q_syn = 0) */ ) @@ -1362,7 +1362,7 @@ static Word16 shb_DTX_fx( shb_ener_fx = L_add(Mpy_32_16_1(shb_ener_fx, 102), 1); /* 102 in Q15, shb_ener_fx in Q1 */ wb_ener_fx = L_deposit_l(0); - FOR ( i=0; iL_frame_fx; i++ ) + FOR ( i=0; iL_frame; i++ ) { #ifdef BASOP_NOGLOB wb_ener_fx = L_mac_o(wb_ener_fx, syn_12k8_16k[i], syn_12k8_16k[i], &Overflow); @@ -1453,7 +1453,7 @@ static Word16 shb_DTX_fx( update_fx = 0; move16(); - IF ( EQ_32(st_fx->core_brate_fx, SID_2k40)) + IF ( EQ_32(st_fx->core_brate, SID_2k40)) { test(); test(); @@ -1480,7 +1480,7 @@ static Word16 shb_DTX_fx( ELSE { test(); - IF ( GE_16(st_fx->bwidth_fx, SWB)&<_16(hTdCngEnc->last_SID_bwidth,SWB)) + IF ( GE_16(st_fx->bwidth, SWB)&<_16(hTdCngEnc->last_SID_bwidth,SWB)) { update_fx = 1; move16(); @@ -1488,7 +1488,7 @@ static Word16 shb_DTX_fx( ELSE { test(); - IF ( LT_16(st_fx->bwidth_fx, SWB)&&GE_16(hTdCngEnc->last_SID_bwidth,SWB)) + IF ( LT_16(st_fx->bwidth, SWB)&&GE_16(hTdCngEnc->last_SID_bwidth,SWB)) { update_fx = 1; move16(); @@ -1498,12 +1498,12 @@ static Word16 shb_DTX_fx( } } - hTdCngEnc->last_SID_bwidth = st_fx->bwidth_fx; + hTdCngEnc->last_SID_bwidth = st_fx->bwidth; move16(); } /* LF-boost not yet implemented in decoder which means that the specific wb_sid information is not used */ test();test(); - if ((EQ_16(st_fx->element_mode, IVAS_CPE_DFT) || EQ_16(st_fx->element_mode, IVAS_CPE_TD)) && EQ_32(st_fx->core_brate_fx, SID_2k40)) + if ((EQ_16(st_fx->element_mode, IVAS_CPE_DFT) || EQ_16(st_fx->element_mode, IVAS_CPE_TD)) && EQ_32(st_fx->core_brate, SID_2k40)) { update_fx = 1; move16(); @@ -1530,7 +1530,7 @@ static Word16 shb_DTX_fx( *---------------------------------------------------------------------*/ void calculate_hangover_attenuation_gain_fx( - Encoder_State_fx* st, /* i : encoder state structure */ + Encoder_State* st, /* i : encoder state structure */ Word16* att, /* o : attenuation factor */ const Word16 vad_hover_flag /* i : VAD hangover flag */ ) @@ -1545,7 +1545,7 @@ void calculate_hangover_attenuation_gain_fx( IF (hTdCngEnc != NULL) { test();test();test(); - IF( hTdCngEnc->burst_ho_cnt > 0 && (vad_hover_flag != 0) && (NE_16(st->bwidth_fx, NB) || GT_16(st->element_mode, EVS_MONO))) /* corresponds to line 504 in FLT acelp_core_enc.c */ + IF( hTdCngEnc->burst_ho_cnt > 0 && (vad_hover_flag != 0) && (NE_16(st->bwidth, NB) || GT_16(st->element_mode, EVS_MONO))) /* corresponds to line 504 in FLT acelp_core_enc.c */ { #ifdef IVAS_CODE if (st->element_mode == IVAS_CPE_DFT || st->element_mode == IVAS_CPE_TD) @@ -1557,7 +1557,7 @@ void calculate_hangover_attenuation_gain_fx( { offset = 5; test(); - if (EQ_16(st->bwidth_fx, WB) && st->hDtxEnc->CNG_mode >= 0) + if (EQ_16(st->bwidth, WB) && st->hDtxEnc->CNG_mode >= 0) { offset = st->hDtxEnc->CNG_mode; move16(); diff --git a/lib_enc/cod_ace_fx.c b/lib_enc/cod_ace_fx.c index 19bcdba0b..ffb88f484 100644 --- a/lib_enc/cod_ace_fx.c +++ b/lib_enc/cod_ace_fx.c @@ -28,7 +28,7 @@ Word16 coder_acelp_fx( /* o : SEGSNR for CL decision */ const Word16 speech[], /* i : speech[-M..lg] */ Word16 *prm, /* o : acelp parameters */ Word16 stab_fac, - Encoder_State_fx *st, + Encoder_State *st, PLC_ENC_EVS_HANDLE hPlc_Ext, const Word16 target_bits, /* i/o: coder memory state */ const Word16 Q_new, @@ -105,7 +105,7 @@ Word16 coder_acelp_fx( /* o : SEGSNR for CL decision */ move16(); move16(); move16(); - L_frame = st->L_frame_fx; + L_frame = st->L_frame; /*------------------------------------------------------------------------* @@ -122,7 +122,7 @@ Word16 coder_acelp_fx( /* o : SEGSNR for CL decision */ Q_new_p5 = add(Q_new, 5); /* Reset phase dispersion */ - IF (GT_16(st->last_core_fx, ACELP_CORE)) + IF (GT_16(st->last_core, ACELP_CORE)) { move16(); move16(); @@ -139,7 +139,7 @@ Word16 coder_acelp_fx( /* o : SEGSNR for CL decision */ move16(); exc = exc_buf+L_EXC_MEM; Copy(hLPDmem->old_exc, exc_buf, L_EXC_MEM); - *(exc+st->L_frame_fx) = 0; + *(exc+st->L_frame) = 0; /* Init syn buffer */ move16(); @@ -161,7 +161,7 @@ Word16 coder_acelp_fx( /* o : SEGSNR for CL decision */ prm++; } - IF (EQ_16(st->L_frame_fx,L_FRAME)) + IF (EQ_16(st->L_frame,L_FRAME)) { Copy(Aq+2*(M+1), hBWE_TD->cur_sub_Aq_fx, (M+1)); } @@ -275,7 +275,7 @@ Word16 coder_acelp_fx( /* o : SEGSNR for CL decision */ * Encode the algebraic innovation * *----------------------------------------------------------------------*/ - E_ACELP_innovative_codebook_fx( exc, T0, T0_frac, T0_res, gain_pit, hLPDmem->tilt_code, acelp_cfg, i_subfr, p_Aq, h1, xn, cn, y1, y2, st->acelp_autocorr, &prm, code, shift ,st->L_frame_fx, st->last_L_frame_fx, st->total_brate_fx); + E_ACELP_innovative_codebook_fx( exc, T0, T0_frac, T0_res, gain_pit, hLPDmem->tilt_code, acelp_cfg, i_subfr, p_Aq, h1, xn, cn, y1, y2, st->acelp_autocorr, &prm, code, shift ,st->L_frame, st->last_L_frame, st->total_brate); E_ACELP_xy2_corr(xn, y1, y2, &g_corr, L_SUBFR, Q_xn); @@ -307,9 +307,9 @@ Word16 coder_acelp_fx( /* o : SEGSNR for CL decision */ *----------------------------------------------------------*/ encode_acelp_gains_fx( code, acelp_cfg->gains_mode[j_subfr], Es_pred, clip_gain, &g_corr, &gain_pit, &gain_code, &prm, - &past_gcode, &gain_inov, L_SUBFR, code2, &gain_code2, st->flag_noisy_speech_snr ); + &past_gcode, &gain_inov, L_SUBFR, code2, &gain_code2, st->flag_noisy_speech_snr_fx); - gp_clip_test_gain_pit_fx(st->element_mode, st->core_brate_fx, gain_pit, st->clip_var_fx ); + gp_clip_test_gain_pit_fx(st->element_mode, st->core_brate, gain_pit, st->clip_var_fx ); #ifndef SIMPLIFY_CODE_BE gain_code_vect[0] = gain_code; @@ -407,7 +407,7 @@ Word16 coder_acelp_fx( /* o : SEGSNR for CL decision */ IF( st->igf != 0 ) { prep_tbe_exc_fx( L_frame, i_subfr, gain_pit, gain_code, code, voice_fac, &voice_factors[i_subfr/L_SUBFR], - bwe_exc, gain_preQ, code_preQ, Q_new, T0, T0_frac, st->coder_type, st->core_brate_fx ); + bwe_exc, gain_preQ, code_preQ, Q_new, T0, T0_frac, st->coder_type, st->core_brate ); } /*---------------------------------------------------------* diff --git a/lib_enc/cod_tcx_fx.c b/lib_enc/cod_tcx_fx.c index 4510615a8..efa6af06f 100644 --- a/lib_enc/cod_tcx_fx.c +++ b/lib_enc/cod_tcx_fx.c @@ -733,7 +733,7 @@ void ShapeSpectrum_fx( Word16 L_spec, Word32 spectrum[], /* i/o: MDCT spectrum */ Word8 pfUseTns, /* output: Flag indicating if TNS is used */ - Encoder_State_fx *st + Encoder_State *st ) { Word16 L_frame; @@ -762,7 +762,7 @@ void ShapeSpectrum_fx( /* if past frame is ACELP */ - IF (st->last_core_fx == ACELP_CORE) + IF (st->last_core == ACELP_CORE) { L_frame = add(L_frame, hTcxCfg->tcx_offset); L_spec = add(L_spec, shr(hTcxCfg->tcx_coded_lines, 2)); @@ -777,7 +777,7 @@ void ShapeSpectrum_fx( tcxGetNoiseFillingTilt(A, M, L_frame, - (GE_32(st->total_brate_fx, ACELP_13k20) && st->rf_mode == 0 ), + (GE_32(st->total_brate, ACELP_13k20) && st->rf_mode == 0 ), &hTcxEnc->noiseTiltFactor); /* Calculate Spectrum Flatness Measure for the TCX Concealment */ @@ -789,8 +789,8 @@ void ShapeSpectrum_fx( test(); test(); test(); - IF( (EQ_32(st->total_brate_fx, ACELP_9k60)&&EQ_16(st->bwidth_fx,SWB))|| - (EQ_32(st->total_brate_fx, ACELP_13k20) && EQ_16(st->bwidth_fx, SWB) ) ) + IF( (EQ_32(st->total_brate, ACELP_9k60)&&EQ_16(st->bwidth,SWB))|| + (EQ_32(st->total_brate, ACELP_13k20) && EQ_16(st->bwidth, SWB) ) ) { max_low_pre = 0; move32(); @@ -834,8 +834,8 @@ void ShapeSpectrum_fx( /* reduce the peaks in the IGF region, to make life of the core-coder easier... */ test(); - IF( ( EQ_32(st->total_brate_fx, ACELP_9k60)&&EQ_16(st->bwidth_fx,SWB))|| - ( EQ_32(st->total_brate_fx, ACELP_13k20)&&EQ_16(st->bwidth_fx, SWB)) ) + IF( ( EQ_32(st->total_brate, ACELP_9k60)&&EQ_16(st->bwidth,SWB))|| + ( EQ_32(st->total_brate, ACELP_13k20)&&EQ_16(st->bwidth, SWB)) ) { Word16 sf_width; Word16 dist_low, dist_high; @@ -1123,7 +1123,7 @@ void QuantizeSpectrum_fx( Word16 tnsSize, /* input: number of tns parameters put into prm */ Word16 prm[], /* output: tcx parameters */ Word16 frame_cnt, /* input: frame counter in the super_frame */ - Encoder_State_fx *st, + Encoder_State *st, CONTEXT_HM_CONFIG *hm_cfg ) { @@ -1235,7 +1235,7 @@ void QuantizeSpectrum_fx( /* if past frame is ACELP */ - IF (st->last_core_fx == ACELP_CORE) + IF (st->last_core == ACELP_CORE) { hTcxCfg->last_aldo = 0; move16(); @@ -1346,15 +1346,15 @@ void QuantizeSpectrum_fx( /* Fast estimation of the scalar quantizer step size */ test(); - IF ((hTcxCfg->ctx_hm != 0) && (st->last_core_fx != ACELP_CORE)) + IF ((hTcxCfg->ctx_hm != 0) && (st->last_core != ACELP_CORE)) { LtpPitchLag = -1; move16(); test(); - IF ((tcxonly == 0) && (LT_16(hTcxEnc->tcxltp_pitch_int, st->L_frame_fx))) + IF ((tcxonly == 0) && (LT_16(hTcxEnc->tcxltp_pitch_int, st->L_frame))) { - tmp32 = L_shl(L_mult0(st->L_frame_fx, st->pit_res_max), 1+kLtpHmFractionalResolution+1); + tmp32 = L_shl(L_mult0(st->L_frame, st->pit_res_max), 1+kLtpHmFractionalResolution+1); tmp1 = add(imult1616(hTcxEnc->tcxltp_pitch_int, st->pit_res_max), hTcxEnc->tcxltp_pitch_fr); LtpPitchLag = div_l(tmp32, tmp1); } @@ -1775,16 +1775,16 @@ void QuantizeSpectrum_fx( LtpPitchLag = -1; move16(); - IF (LT_16(hTcxEnc->tcxltp_pitch_int, st->L_frame_fx)) + IF (LT_16(hTcxEnc->tcxltp_pitch_int, st->L_frame)) { - tmp32 = L_shl(L_mult0(st->L_frame_fx, st->pit_res_max), 1+kLtpHmFractionalResolution+1); + tmp32 = L_shl(L_mult0(st->L_frame, st->pit_res_max), 1+kLtpHmFractionalResolution+1); tmp1 = add(imult1616(hTcxEnc->tcxltp_pitch_int, st->pit_res_max), hTcxEnc->tcxltp_pitch_fr); LtpPitchLag = div_l(tmp32, tmp1); } tmp8 = 1; move16(); - if (EQ_16(st->last_core_fx, ACELP_CORE)) + if (EQ_16(st->last_core, ACELP_CORE)) { tmp8 = 0; move16(); @@ -1806,7 +1806,7 @@ void QuantizeSpectrum_fx( &sqBits, &signaling_bits, &nf_seed - , shr(st->bwidth_fx, 1) /* equivalent to: (st->bwidth_fx > WB)?1:0 */ + , shr(st->bwidth, 1) /* equivalent to: (st->bwidth > WB)?1:0 */ ); sqTargetBits = sub(sqTargetBits, signaling_bits); @@ -1855,7 +1855,7 @@ void QuantizeSpectrum_fx( * Quantize TCX gain * *-----------------------------------------------------------*/ - IF (GE_32(st->total_brate_fx, ACELP_13k20)&&st->rf_mode==0) + IF (GE_32(st->total_brate, ACELP_13k20)&&st->rf_mode==0) { QuantizeGain(L_spec, &gain_tcx, &gain_tcx_e, &prm[0]); } @@ -1942,7 +1942,7 @@ void QuantizeSpectrum_fx( * Estimate and quantize noise factor * *-----------------------------------------------------------*/ - IF (GE_32(st->total_brate_fx, HQ_96k)) + IF (GE_32(st->total_brate, HQ_96k)) { fac_ns = 0; move16(); @@ -1953,7 +1953,7 @@ void QuantizeSpectrum_fx( { /* noise filling start bin */ i = shr(L_frame, 3); - IF (GE_32(st->total_brate_fx, ACELP_13k20)&&st->rf_mode==0) + IF (GE_32(st->total_brate, ACELP_13k20)&&st->rf_mode==0) { i = idiv1616U(L_frame, 6); } @@ -1964,14 +1964,14 @@ void QuantizeSpectrum_fx( move16(); test(); test(); - if ((hTcxCfg->ctx_hm != 0) && (st->last_core_fx != ACELP_CORE) && (prm_hm[0] != 0)) + if ((hTcxCfg->ctx_hm != 0) && (st->last_core != ACELP_CORE) && (prm_hm[0] != 0)) { tmp1 = 10240/*0.3125f Q15*/; move16(); } noiseTransWidth = HOLE_SIZE_FROM_LTP(s_max(hTcxEnc->tcxltp_gain, tmp1)); - if (EQ_16(L_frame, shr(st->L_frame_fx, 1))) + if (EQ_16(L_frame, shr(st->L_frame, 1))) { /* minimum transition for noise filling in TCX-10 */ noiseTransWidth = 3; @@ -2047,7 +2047,7 @@ void QuantizeSpectrum_fx( *-----------------------------------------------------------*/ /* Replication of ACELP formant enhancement for low rates */ - IF ( LT_32(st->total_brate_fx, ACELP_13k20)||st->rf_mode!=0) + IF ( LT_32(st->total_brate, ACELP_13k20)||st->rf_mode!=0) { tcxFormantEnhancement(xn_buf16, gainlpc, gainlpc_e, spectrum, spectrum_e, L_frame, L_spec); } @@ -2056,7 +2056,7 @@ void QuantizeSpectrum_fx( { tmp1 = 0; move16(); - if ( GE_32(st->total_brate_fx, ACELP_13k20)&&st->rf_mode==0) + if ( GE_32(st->total_brate, ACELP_13k20)&&st->rf_mode==0) { tmp1 = 1; move16(); @@ -2071,7 +2071,7 @@ void QuantizeSpectrum_fx( tcx_noise_filling(spectrum, *spectrum_e,nf_seed /* seed */, i, noiseFillingSize, noiseTransWidth, L_frame, hTcxEnc->noiseTiltFactor, fac_ns, NULL, st->element_mode ); } - IF (LT_32(st->total_brate_fx, ACELP_13k20)||st->rf_mode!=0) + IF (LT_32(st->total_brate, ACELP_13k20)||st->rf_mode!=0) { /* partially recompute global gain (energy part), taking noise filling and formant enhancement into account */ s = sub(getScaleFactor32(spectrum, L_spec), 4); @@ -2121,7 +2121,7 @@ void QuantizeSpectrum_fx( stop = hTcxCfg->tcx_last_overlap_mode; /* backup last TCX overlap mode */ move16(); test(); - IF ((EQ_16(L_frame, shr(st->L_frame_fx, 1)))&&(tcxonly!=0)) + IF ((EQ_16(L_frame, shr(st->L_frame, 1)))&&(tcxonly!=0)) { Word16 L = L_frame; move16(); @@ -2139,7 +2139,7 @@ void QuantizeSpectrum_fx( spectrum, L, fUseTns, - st->last_core_fx, + st->last_core, stop, frame_cnt, 0); @@ -2154,7 +2154,7 @@ void QuantizeSpectrum_fx( test(); test(); test(); - SetTnsConfig(hTcxCfg, sub(L_frame_glob, st->L_frame_fx) == 0, (st->last_core_fx == ACELP_CORE) && (frame_cnt == 0)); + SetTnsConfig(hTcxCfg, sub(L_frame_glob, st->L_frame) == 0, (st->last_core == ACELP_CORE) && (frame_cnt == 0)); /* Apply TNS to get the reconstructed signal */ IF (fUseTns != 0) @@ -2162,7 +2162,7 @@ void QuantizeSpectrum_fx( ApplyTnsFilter(hTcxCfg->pCurrentTnsConfig, pTnsData, spectrum, 0); test(); - IF ((EQ_16(L_frame, shr(st->L_frame_fx, 1)))&&(tcxonly!=0)) + IF ((EQ_16(L_frame, shr(st->L_frame, 1)))&&(tcxonly!=0)) { test(); test(); @@ -2195,7 +2195,7 @@ void QuantizeSpectrum_fx( * Compute inverse MDCT of spectrum[]. * *-----------------------------------------------------------*/ test(); - IF ((EQ_16(L_frame, shr(st->L_frame_fx, 1)))&&(tcxonly!=0)) + IF ((EQ_16(L_frame, shr(st->L_frame, 1)))&&(tcxonly!=0)) { IF (hTcxCfg->tcx_last_overlap_mode != FULL_OVERLAP) { @@ -2243,13 +2243,13 @@ void QuantizeSpectrum_fx( tmp2 = 0; move16(); test(); - if ((w == 0) && (st->last_core_fx == ACELP_CORE)) + if ((w == 0) && (st->last_core == ACELP_CORE)) { tmp2 = 1; move16(); } - tmp3 = st->last_core_fx; + tmp3 = st->last_core; move16(); if (w > 0) { @@ -2416,7 +2416,7 @@ void QuantizeSpectrum_fx( overlap, hTcxCfg->tcx_mdct_window_half_length, hTcxCfg->tcx_mdct_window_min_length, - st->last_core_fx==ACELP_CORE, + st->last_core==ACELP_CORE, 0, hTcxEnc->acelp_zir, hTcxEnc->Txnq, @@ -2425,7 +2425,7 @@ void QuantizeSpectrum_fx( hTcxCfg->tcx_mdct_window_trans, L_win, tmp4, - st->last_core_fx, + st->last_core, 0, 0 ); @@ -2440,7 +2440,7 @@ void QuantizeSpectrum_fx( move16(); test(); test(); - if ((frame_cnt > 0) && (stop == 0) && (st->last_core_fx != ACELP_CORE)) + if ((frame_cnt > 0) && (stop == 0) && (st->last_core != ACELP_CORE)) { tmp1 = 2; move16(); @@ -2459,7 +2459,7 @@ void QuantizeSpectrum_fx( overlap, /*hTcxCfg->tcx_mdct_window_length*/ hTcxCfg->tcx_mdct_window_half_length, hTcxCfg->tcx_mdct_window_min_length, - st->last_core_fx==ACELP_CORE, + st->last_core==ACELP_CORE, tmp1, hTcxEnc->acelp_zir, hTcxEnc->Txnq, @@ -2468,7 +2468,7 @@ void QuantizeSpectrum_fx( hTcxCfg->tcx_mdct_window_trans, shr(L_frame_glob, 1), tmp4, - st->last_core_fx, + st->last_core, 0, 0 ); @@ -2551,7 +2551,7 @@ void QuantizeSpectrum_fx( overlap, /*hTcxCfg->tcx_mdct_window_length*/ hTcxCfg->tcx_mdct_window_half_length, hTcxCfg->tcx_mdct_window_min_length, - st->last_core_fx==ACELP_CORE, + st->last_core==ACELP_CORE, hTcxCfg->tcx_last_overlap_mode, /*left mode*/ hTcxEnc->acelp_zir, hTcxEnc->Txnq, @@ -2560,7 +2560,7 @@ void QuantizeSpectrum_fx( hTcxCfg->tcx_mdct_window_trans, shr(L_frame_glob, 1), tmp4, - st->last_core_fx, + st->last_core, 0, 0 ); @@ -2571,7 +2571,7 @@ void QuantizeSpectrum_fx( test(); test(); test(); - IF ((st->last_core_fx > ACELP_CORE) && (((EQ_16(L_frameTCX, shr(hTcxEnc->L_frameTCX, 1)))&&(st->tcxonly!=0))||(EQ_16(st->hTcxCfg->tcx_last_overlap_mode,TRANSITION_OVERLAP)))) + IF ((st->last_core > ACELP_CORE) && (((EQ_16(L_frameTCX, shr(hTcxEnc->L_frameTCX, 1)))&&(st->tcxonly!=0))||(EQ_16(st->hTcxCfg->tcx_last_overlap_mode,TRANSITION_OVERLAP)))) { IF (hTcxCfg->last_aldo != 0) @@ -2611,7 +2611,7 @@ void QuantizeSpectrum_fx( test(); test(); test(); - if ((frame_cnt > 0) && (stop == 0) && (hTcxCfg->tcx_curr_overlap_mode == 0) && (st->last_core_fx != ACELP_CORE)) + if ((frame_cnt > 0) && (stop == 0) && (hTcxCfg->tcx_curr_overlap_mode == 0) && (st->last_core != ACELP_CORE)) { stop = 2; /* use minimum overlap between the two TCX-10 windows */ move16(); } @@ -2744,7 +2744,7 @@ void coder_tcx_fx( Word32 spectrum[], /* i/o: MDCT spectrum */ Word16 *spectrum_e, /* i/o: MDCT spectrum exponent */ Word16 prm[], /* output: tcx parameters */ - Encoder_State_fx *st, + Encoder_State *st, CONTEXT_HM_CONFIG *hm_cfg ) { @@ -2864,7 +2864,7 @@ void coder_tcx_fx( } AnalyzePowerSpectrum_fx(st, - round_fx(L_shl(Mpy_32_16_1(L_mult0(L_frame,st->L_frame_fx)/*Q0*/, + round_fx(L_shl(Mpy_32_16_1(L_mult0(L_frame,st->L_frame)/*Q0*/, getInvFrameLen(hTcxEnc->L_frameTCX)/*Q21*/)/*Q6*/,16-6)), L_frame, left_overlap, right_overlap, @@ -2875,9 +2875,9 @@ void coder_tcx_fx( { test(); test(); - SetTnsConfig(hTcxCfg, sub(L_frame_glob, st->L_frame_fx) == 0, st->last_core_fx == 0); + SetTnsConfig(hTcxCfg, sub(L_frame_glob, st->L_frame) == 0, st->last_core == 0); - TNSAnalysis_fx(hTcxCfg, L_frame, L_spec, TCX_20, st->last_core_fx == 0, spectrum, hTcxEnc->tnsData, hTcxEnc->fUseTns_fx + TNSAnalysis_fx(hTcxCfg, L_frame, L_spec, TCX_20, st->last_core == 0, spectrum, hTcxEnc->tnsData, hTcxEnc->fUseTns_fx , &st->hIGFEnc->tns_predictionGain ); @@ -2891,7 +2891,7 @@ void coder_tcx_fx( IF(st->igf) { - ProcessIGF_fx(st->hIGFEnc, st, spectrum, spectrum_e, powerSpec, &powerSpec_e, 1, hTcxEnc->fUseTns_fx[0], (st->last_core_fx == ACELP_CORE), 0); + ProcessIGF_fx(st->hIGFEnc, st, spectrum, spectrum_e, powerSpec, &powerSpec_e, 1, hTcxEnc->fUseTns_fx[0], (st->last_core == ACELP_CORE), 0); } ShapeSpectrum_fx(hTcxCfg, A, gainlpc, gainlpc_e, @@ -2942,7 +2942,7 @@ void coder_tcx_fx( *-------------------------------------------------------------------*/ void coder_tcx_post_fx( - Encoder_State_fx *st, + Encoder_State *st, LPD_state *LPDmem, TCX_CONFIG_HANDLE hTcxCfg, /* i : configuration of TCX */ Word16 *synth, const Word16 *A, @@ -2955,7 +2955,7 @@ void coder_tcx_post_fx( Word16 xn_buf[L_FRAME_MAX]; /* TCX output */ - Copy( synth, xn_buf, st->L_frame_fx ); + Copy( synth, xn_buf, st->L_frame ); /*-----------------------------------------------------------* @@ -2963,7 +2963,7 @@ void coder_tcx_post_fx( *-----------------------------------------------------------*/ /* Update LPDmem (Txnq,syn,syn_pe,old_exc,wsyn,Ai,Aq) */ - tcx_encoder_memory_update_fx( wsig, xn_buf, st->L_frame_fx, Ai, A, hTcxCfg->preemph_fac, LPDmem, st, synth, Q_new, shift ); + tcx_encoder_memory_update_fx( wsig, xn_buf, st->L_frame, Ai, A, hTcxCfg->preemph_fac, LPDmem, st, synth, Q_new, shift ); return; } diff --git a/lib_enc/core_enc_2div_fx.c b/lib_enc/core_enc_2div_fx.c index 5f0aadd8d..f448d3830 100644 --- a/lib_enc/core_enc_2div_fx.c +++ b/lib_enc/core_enc_2div_fx.c @@ -24,7 +24,7 @@ void core_encode_twodiv_fx( const Word16 new_samples[], /* i : new samples */ - Encoder_State_fx *st, /* i/o: coder memory state */ + Encoder_State *st, /* i/o: coder memory state */ const Word16 coder_type, /* i : coding type */ Word16 Aw[NB_SUBFR16k*(M+1)], /* i : weighted A(z) unquant. for subframes*/ const Word16 vad_hover_flag, /* i : VAD hangover flag */ @@ -90,11 +90,11 @@ void core_encode_twodiv_fx( } /* convert pitch values to core sampling-rate */ - IF ( NE_16(st->L_frame_fx, L_FRAME)) + IF ( NE_16(st->L_frame, L_FRAME)) { move16(); - /* T_op[i] = (short)(T_op[i] * (float)st->L_frame_fx/(float)L_FRAME + 0.5f); */ - T_op[i] = round_fx(L_shr(L_mult0(T_op[i], st->L_frame_fx), 8 - 16)); + /* T_op[i] = (short)(T_op[i] * (float)st->L_frame/(float)L_FRAME + 0.5f); */ + T_op[i] = round_fx(L_shr(L_mult0(T_op[i], st->L_frame), 8 - 16)); } } @@ -103,11 +103,11 @@ void core_encode_twodiv_fx( *---------------------------------------------------------------*/ move16(); - st->core_fx = TCX_10_CORE; + st->core = TCX_10_CORE; if ( EQ_16(hTcxEnc->tcxMode,TCX_20)) { move16(); - st->core_fx = TCX_20_CORE; + st->core = TCX_20_CORE; } assert(hTcxEnc->tcxMode == TCX_20 || hTcxEnc->tcxMode == TCX_10); @@ -124,7 +124,7 @@ void core_encode_twodiv_fx( tnsBits, param_core, <pBits, - st->L_frame_fx, + st->L_frame, hTcxEnc->L_frameTCX, EVS_MONO, vad_hover_flag, @@ -154,13 +154,13 @@ void core_encode_twodiv_fx( * Run Two TCX10 *---------------------------------------------------------------*/ - IF ( EQ_16(st->core_fx,TCX_10_CORE)) + IF ( EQ_16(st->core,TCX_10_CORE)) { Word16 last_ace_mode; move16(); - last_ace_mode = st->last_core_fx; + last_ace_mode = st->last_core; FOR (n = 0; n < 2; n++) @@ -179,17 +179,17 @@ void core_encode_twodiv_fx( A_q, gainlpc[n], gainlpc_e[n], - shr(st->L_frame_fx, 1), + shr(st->L_frame, 1), shr(st->hTcxCfg->tcx_coded_lines, 1), spectrum[n], hTcxEnc->fUseTns_fx[n], st ); - st->last_core_fx = st->core_fx; + st->last_core = st->core; move16(); } - st->last_core_fx = last_ace_mode; + st->last_core = last_ace_mode; move16(); @@ -234,8 +234,8 @@ void core_encode_twodiv_fx( NULL, gainlpc[n], gainlpc_e[n], - st->synth+n*st->L_frame_fx/2, - shr(st->L_frame_fx, 1), + st->synth+n*st->L_frame/2, + shr(st->L_frame, 1), shr(hTcxEnc->L_frameTCX, 1), shr(st->hTcxCfg->tcx_coded_lines, 1), target_bits, @@ -268,7 +268,7 @@ void core_encode_twodiv_fx( * Run One TCX20 *---------------------------------------------------------------*/ - IF ( EQ_16(st->core_fx,TCX_20_CORE)) + IF ( EQ_16(st->core,TCX_20_CORE)) { E_LPC_f_lsp_a_conversion(lsp_q, A_q, M); @@ -278,7 +278,7 @@ void core_encode_twodiv_fx( A_q, gainlpc[0], gainlpc_e[0], - st->L_frame_fx, + st->L_frame, st->hTcxCfg->tcx_coded_lines, spectrum[0], hTcxEnc->fUseTns_fx[0], @@ -314,7 +314,7 @@ void core_encode_twodiv_fx( gainlpc[0], gainlpc_e[0], st->synth, - st->L_frame_fx, + st->L_frame, hTcxEnc->L_frameTCX, st->hTcxCfg->tcx_coded_lines, target_bits, @@ -344,7 +344,7 @@ void core_encode_twodiv_fx( * Generate Bitstream *---------------------------------------------------------------*/ - enc_prm_fx( coder_type, param_core, param_lpc, st, st->L_frame_fx, hm_cfg, bits_param_lpc, no_param_lpc ); + enc_prm_fx( coder_type, param_core, param_lpc, st, st->L_frame, hm_cfg, bits_param_lpc, no_param_lpc ); } diff --git a/lib_enc/core_enc_init_fx.c b/lib_enc/core_enc_init_fx.c index 37bce06a4..4252372b6 100644 --- a/lib_enc/core_enc_init_fx.c +++ b/lib_enc/core_enc_init_fx.c @@ -25,11 +25,11 @@ * Local functions *-----------------------------------------------------------------------*/ -static void init_tcx_fx( Encoder_State_fx *st, Word16 L_frame_old, const Word32 total_brate, const Word32 last_total_brate, const Word16 MCT_flag); -static void init_core_sig_ana_fx(Encoder_State_fx *st ); -static void init_acelp_fx(Encoder_State_fx *st, Word16 L_frame_old, const Word16 shift); -static void init_modes_fx(Encoder_State_fx *st, const Word32 Last_total_brate ); -static void init_sig_buffers_fx(Encoder_State_fx *st, const Word16 L_frame_old, const Word16 L_subfr); +static void init_tcx_fx( Encoder_State *st, Word16 L_frame_old, const Word32 total_brate, const Word32 last_total_brate, const Word16 MCT_flag); +static void init_core_sig_ana_fx(Encoder_State *st ); +static void init_acelp_fx(Encoder_State *st, Word16 L_frame_old, const Word16 shift); +static void init_modes_fx(Encoder_State *st, const Word32 Last_total_brate ); +static void init_sig_buffers_fx(Encoder_State *st, const Word16 L_frame_old, const Word16 L_subfr); /*-----------------------------------------------------------------------* * init_coder_ace_plus_fx() @@ -38,7 +38,7 @@ static void init_sig_buffers_fx(Encoder_State_fx *st, const Word16 L_frame_old, *-----------------------------------------------------------------------*/ void init_coder_ace_plus_fx( - Encoder_State_fx *st, + Encoder_State *st, const Word32 last_total_brate, /* i : last total bitrate */ const Word16 shift, const Word16 MCT_flag /* i : hMCT handle allocated (1) or not (0) */ @@ -54,7 +54,7 @@ void init_coder_ace_plus_fx( #ifdef IVAS_CODE_SWITCHING st->element_mode, #endif - st->total_brate_fx + st->total_brate #ifdef IVAS_CODE_SWITCHING , MCT_flag, st->is_ism_format #endif @@ -62,46 +62,46 @@ void init_coder_ace_plus_fx( move16(); /* Core Sampling Rate */ - st->sr_core = getCoreSamplerateMode2(st->element_mode, st->total_brate_fx, st->bwidth_fx, st->flag_ACELP16k, st->rf_mode, st->is_ism_format); + st->sr_core = getCoreSamplerateMode2(st->element_mode, st->total_brate, st->bwidth, st->flag_ACELP16k, st->rf_mode, st->is_ism_format); st->fscale = sr2fscale(st->sr_core); move16(); /* Narrowband? */ st->narrowBand = 0; move16(); - if( EQ_16(st->bwidth_fx, NB)) + if( EQ_16(st->bwidth, NB)) { st->narrowBand = 1; move16(); } /* Core Framing */ - L_frame_old = st->last_L_frame_fx; + L_frame_old = st->last_L_frame; move16(); - st->L_frame_fx = extract_l(Mult_32_16(st->sr_core , 0x0290)); + st->L_frame = extract_l(Mult_32_16(st->sr_core , 0x0290)); st->L_frame_past = -1; move16(); - hTcxEnc->L_frameTCX = extract_l(Mult_32_16(st->input_Fs_fx , 0x0290)); + hTcxEnc->L_frameTCX = extract_l(Mult_32_16(st->input_Fs , 0x0290)); st->nb_subfr = NB_SUBFR; move16(); - L_subfr = shr(st->L_frame_fx, 2); + L_subfr = shr(st->L_frame, 2); test(); - IF ( EQ_16(st->L_frame_fx, L_FRAME16k)&&LE_32(st->total_brate_fx,32000)) + IF ( EQ_16(st->L_frame, L_FRAME16k)&&LE_32(st->total_brate,32000)) { st->nb_subfr = NB_SUBFR16k; move16(); - L_subfr = mult(st->L_frame_fx, 0x199A); /*1/5 = 0x199A Q15*/ move16(); + L_subfr = mult(st->L_frame, 0x199A); /*1/5 = 0x199A Q15*/ move16(); } /* Core Lookahead */ st->encoderLookahead_enc = NS2SA_fx2(st->sr_core, ACELP_LOOK_NS); move16(); - st->encoderLookahead_FB = NS2SA_fx2(st->input_Fs_fx, ACELP_LOOK_NS); + st->encoderLookahead_FB = NS2SA_fx2(st->input_Fs, ACELP_LOOK_NS); move16(); - IF ( st->ini_frame_fx == 0 ) + IF ( st->ini_frame == 0 ) { st->acelpFramesCount = 0; move16(); @@ -139,7 +139,7 @@ void init_coder_ace_plus_fx( move16(); test(); test(); - IF ( NE_16(st->last_L_frame_fx,st->L_frame_fx)||EQ_16(st->last_core_fx,AMR_WB_CORE)||EQ_16(st->last_core_fx,HQ_CORE)) + IF ( NE_16(st->last_L_frame,st->L_frame)||EQ_16(st->last_core,AMR_WB_CORE)||EQ_16(st->last_core,HQ_CORE)) { set16_fx( st->mem_MA_fx, 0, M ); Copy(GEWB_Ave_fx, st->mem_AR_fx, M); @@ -153,7 +153,7 @@ void init_coder_ace_plus_fx( move16(); IF( st->igf ) { - IGFEncSetMode_fx(st->hIGFEnc, st->total_brate_fx, st->bwidth_fx, st->element_mode, st->rf_mode); + IGFEncSetMode_fx(st->hIGFEnc, st->total_brate, st->bwidth, st->element_mode, st->rf_mode); } ELSE IF (st->hIGFEnc != NULL) { @@ -168,7 +168,7 @@ void init_coder_ace_plus_fx( /* Initialize TCX */ if (hTcxEnc != NULL) { - init_tcx_fx(st, L_frame_old, st->total_brate_fx, last_total_brate, MCT_flag); + init_tcx_fx(st, L_frame_old, st->total_brate, last_total_brate, MCT_flag); } /* Initialize Core Signal Analysis Module */ init_core_sig_ana_fx( st ); @@ -179,7 +179,7 @@ void init_coder_ace_plus_fx( /* Initialize ACELP */ init_acelp_fx( st, L_frame_old , shift); - if(st->ini_frame_fx == 0) + if(st->ini_frame == 0) { st->tec_tfa = 0; move16(); @@ -196,7 +196,7 @@ void init_coder_ace_plus_fx( move16(); test(); test(); - if( EQ_16(st->bwidth_fx, SWB)&&(EQ_32(st->total_brate_fx,ACELP_16k40)||EQ_32(st->total_brate_fx,ACELP_24k40))) + if( EQ_16(st->bwidth, SWB)&&(EQ_32(st->total_brate,ACELP_16k40)||EQ_32(st->total_brate,ACELP_24k40))) { st->tec_tfa = 1; move16(); @@ -207,7 +207,7 @@ void init_coder_ace_plus_fx( st->tfa_flag = 0; move16(); /* Initialize DTX */ - IF( st->ini_frame_fx == 0 ) + IF( st->ini_frame == 0 ) { vad_init_fx(&st->vad_st); @@ -219,8 +219,8 @@ void init_coder_ace_plus_fx( test(); test(); test(); - if( (EQ_32(st->total_brate_fx, ACELP_9k60))||(EQ_32(st->total_brate_fx,ACELP_16k40))|| - (EQ_32(st->total_brate_fx, ACELP_24k40))||(EQ_32(st->total_brate_fx, ACELP_32k))) + if( (EQ_32(st->total_brate, ACELP_9k60))||(EQ_32(st->total_brate,ACELP_16k40))|| + (EQ_32(st->total_brate, ACELP_24k40))||(EQ_32(st->total_brate, ACELP_32k))) { st->glr = 1; move16(); @@ -236,16 +236,16 @@ void init_coder_ace_plus_fx( /* Adaptive BPF */ - set16_fx(st->mem_bpf.noise_buf, 0, 2*L_FILT16k); - set16_fx(st->mem_bpf.error_buf, 0, L_FILT16k); + set16_fx(st->mem_bpf_fx.noise_buf, 0, 2*L_FILT16k); + set16_fx(st->mem_bpf_fx.error_buf, 0, L_FILT16k); set16_fx(st->bpf_gainT, 0, NB_SUBFR16k); set16_fx(st->bpf_T, PIT_MIN_12k8, NB_SUBFR16k); - st->mem_bpf.noise_shift_old = 0; + st->mem_bpf_fx.noise_shift_old = 0; move16(); - IF ( st->ini_frame_fx == 0 ) + IF ( st->ini_frame == 0 ) { st->Q_max_enc[0] = 15; move16(); @@ -255,7 +255,7 @@ void init_coder_ace_plus_fx( st->enablePlcWaveadjust = 0; move16(); - if (GE_32(st->total_brate_fx, 48000)) + if (GE_32(st->total_brate, 48000)) { st->enablePlcWaveadjust = 1; move16(); @@ -282,7 +282,7 @@ void init_coder_ace_plus_fx( } static void init_tcx_fx( - Encoder_State_fx *st, + Encoder_State *st, Word16 L_frame_old, const Word32 total_brate, const Word32 last_total_brate, @@ -298,9 +298,9 @@ static void init_tcx_fx( (void)last_total_brate; #endif //PMT("init_tcx_fx needs an entire review to adapt to IVAS") - fscaleFB = div_l(L_shl(st->input_Fs_fx, LD_FSCALE_DENOM+1), 12800); + fscaleFB = div_l(L_shl(st->input_Fs, LD_FSCALE_DENOM+1), 12800); - init_TCX_config(st->hTcxCfg, st->L_frame_fx, st->fscale, hTcxEnc->L_frameTCX, fscaleFB ); + init_TCX_config(st->hTcxCfg, st->L_frame, st->fscale, hTcxEnc->L_frameTCX, fscaleFB ); st->hTcxCfg->tcx_mdct_window_length_old = st->hTcxCfg->tcx_mdct_window_length; move16(); @@ -312,11 +312,11 @@ static void init_tcx_fx( move16(); /*<0 rectangular transition with optimized window size = L_frame+L_frame/4*/ - st->hTcxCfg->lfacNext = sub(st->hTcxCfg->tcx_offset, shr(st->L_frame_fx, 2)); + st->hTcxCfg->lfacNext = sub(st->hTcxCfg->tcx_offset, shr(st->L_frame, 2)); move16(); st->hTcxCfg->lfacNextFB = sub(st->hTcxCfg->tcx_offsetFB, shr(hTcxEnc->L_frameTCX, 2)); - IF ( st->ini_frame_fx == 0 ) + IF ( st->ini_frame == 0 ) { st->hTcxCfg->tcx_curr_overlap_mode = st->hTcxCfg->tcx_last_overlap_mode = ALDO_WINDOW; move16(); @@ -353,22 +353,22 @@ static void init_tcx_fx( /* TCX bandwidth */ move16(); - st->hTcxCfg->bandwidth = getTcxBandwidth(st->bwidth_fx); + st->hTcxCfg->bandwidth = getTcxBandwidth(st->bwidth); /* set number of coded lines */ - st->hTcxCfg->tcx_coded_lines = getNumTcxCodedLines(st->bwidth_fx); + st->hTcxCfg->tcx_coded_lines = getNumTcxCodedLines(st->bwidth); /* TNS in TCX */ move16(); move16(); - st->hTcxCfg->fIsTNSAllowed = (Word8)getTnsAllowed(st->total_brate_fx ,st->igf, st->element_mode); + st->hTcxCfg->fIsTNSAllowed = (Word8)getTnsAllowed(st->total_brate ,st->igf, st->element_mode); st->hTcxCfg->pCurrentTnsConfig = NULL; IF ( st->hTcxCfg->fIsTNSAllowed != 0 ) { - InitTnsConfigs(st->bwidth_fx, st->hTcxCfg->tcx_coded_lines, st->hTcxCfg->tnsConfig, st->hIGFEnc->infoStopFrequency, st->total_brate_fx, st->element_mode, 0/*is_mct*/); + InitTnsConfigs(st->bwidth, st->hTcxCfg->tcx_coded_lines, st->hTcxCfg->tnsConfig, st->hIGFEnc->infoStopFrequency, st->total_brate, st->element_mode, 0/*is_mct*/); } /* TCX-LTP */ @@ -378,10 +378,10 @@ static void init_tcx_fx( test(); test(); test(); - IF( st->ini_frame_fx == 0 ) + IF( st->ini_frame == 0 ) { - hTcxEnc->tcxltp_pitch_int_past = st->L_frame_fx; + hTcxEnc->tcxltp_pitch_int_past = st->L_frame; move16(); hTcxEnc->tcxltp_pitch_fr_past = 0; move16(); @@ -390,7 +390,7 @@ static void init_tcx_fx( hTcxEnc->tcxltp_norm_corr_past = 0; move16(); } - ELSE IF ( NE_16(st->L_frame_fx,L_frame_old)&&!((st->total_brate_fx==16400||st->total_brate_fx==24400)&&(st->total_brate_fx==st->last_total_brate_fx)&&(st->last_bwidth_fx==st->bwidth_fx))) + ELSE IF ( NE_16(st->L_frame,L_frame_old)&&!((st->total_brate==16400||st->total_brate==24400)&&(st->total_brate==st->last_total_brate)&&(st->last_bwidth==st->bwidth))) { Word16 pitres, pitres_old; Word16 pit, pit_old; @@ -408,15 +408,15 @@ static void init_tcx_fx( pitres = 4; move16(); - if (EQ_16(160,shr(st->L_frame_fx,sub(7,norm_s(st->L_frame_fx))))) /*if ( st->L_frame_fx%160==0 )*/ + if (EQ_16(160,shr(st->L_frame,sub(7,norm_s(st->L_frame))))) /*if ( st->L_frame%160==0 )*/ { pitres = 6; move16(); } - /*pit = pit_old * (float)st->L_frame_fx/(float)L_frame_old;*/ - pit = shl(mult_r(pit_old, div_s(st->L_frame_fx, shl(L_frame_old, 2))), 2); - /* assert(pit <= st->L_frame_fx);*/ + /*pit = pit_old * (float)st->L_frame/(float)L_frame_old;*/ + pit = shl(mult_r(pit_old, div_s(st->L_frame, shl(L_frame_old, 2))), 2); + /* assert(pit <= st->L_frame);*/ hTcxEnc->tcxltp_pitch_int_past = pit; move16(); @@ -426,7 +426,7 @@ static void init_tcx_fx( } /* Residual Coding*/ - st->hTcxCfg->resq = getResq(st->total_brate_fx); + st->hTcxCfg->resq = getResq(st->total_brate); move16(); test(); @@ -436,23 +436,23 @@ static void init_tcx_fx( move16(); } - st->hTcxCfg->ctx_hm = getCtxHm(st->element_mode, st->total_brate_fx, st->rf_mode ); + st->hTcxCfg->ctx_hm = getCtxHm(st->element_mode, st->total_brate, st->rf_mode ); - hTcxEnc->tcx_lpc_shaped_ari = getTcxLpcShapedAri(st->total_brate_fx,st->rf_mode, st->element_mode); + hTcxEnc->tcx_lpc_shaped_ari = getTcxLpcShapedAri(st->total_brate,st->rf_mode, st->element_mode); } -void init_sig_buffers_fx( Encoder_State_fx *st, const Word16 L_frame_old, const Word16 L_subfr ) +void init_sig_buffers_fx( Encoder_State *st, const Word16 L_frame_old, const Word16 L_subfr ) { LPD_state_HANDLE hLPDmem = st->hLPDmem; TCX_ENC_HANDLE hTcxEnc = st->hTcxEnc; /* Encoder Past Samples at encoder-sampling-rate */ - st->encoderPastSamples_enc = shr(imult1616(st->L_frame_fx, 9), 4); + st->encoderPastSamples_enc = shr(imult1616(st->L_frame, 9), 4); /* Initialize Signal Buffers and Pointers at encoder-sampling-rate */ - IF ( st->ini_frame_fx == 0 ) + IF ( st->ini_frame == 0 ) { set16_fx(st->buf_speech_enc, 0, L_PAST_MAX_32k+L_FRAME32k+L_NEXT_MAX_32k); set16_fx(st->buf_speech_enc_pe, 0, L_PAST_MAX_32k+L_FRAME32k+L_NEXT_MAX_32k); @@ -466,51 +466,51 @@ void init_sig_buffers_fx( Encoder_State_fx *st, const Word16 L_frame_old, const test(); test(); test(); - IF ( NE_16(st->L_frame_fx,L_frame_old)&&!((EQ_32(st->total_brate_fx,ACELP_16k40)||EQ_32(st->total_brate_fx,ACELP_24k40))&&(EQ_32(st->total_brate_fx,st->last_total_brate_fx))&&(EQ_16(st->last_bwidth_fx,st->bwidth_fx)))) + IF ( NE_16(st->L_frame,L_frame_old)&&!((EQ_32(st->total_brate,ACELP_16k40)||EQ_32(st->total_brate,ACELP_24k40))&&(EQ_32(st->total_brate,st->last_total_brate))&&(EQ_16(st->last_bwidth,st->bwidth)))) { - lerp( st->buf_speech_enc, st->buf_speech_enc, st->L_frame_fx, L_frame_old ); + lerp( st->buf_speech_enc, st->buf_speech_enc, st->L_frame, L_frame_old ); test(); - IF( NE_16(st->last_core_fx,TCX_20_CORE)&&NE_16(st->last_core_fx,TCX_10_CORE)) /* condition should be checked again */ + IF( NE_16(st->last_core,TCX_20_CORE)&&NE_16(st->last_core,TCX_10_CORE)) /* condition should be checked again */ { - Copy( st->buf_speech_enc, hTcxEnc->buf_speech_ltp, st->L_frame_fx ); + Copy( st->buf_speech_enc, hTcxEnc->buf_speech_ltp, st->L_frame ); } - Copy_Scale_sig( st->old_wsp_fx, st->buf_wspeech_enc+st->L_frame_fx + L_SUBFR-L_WSP_MEM,L_WSP_MEM, sub(st->prev_Q_new, st->prev_Q_old)); + Copy_Scale_sig( st->old_wsp_fx, st->buf_wspeech_enc+st->L_frame + L_SUBFR-L_WSP_MEM,L_WSP_MEM, sub(st->prev_Q_new, st->prev_Q_old)); /*Resamp buffers needed only for ACELP*/ test(); test(); - IF( EQ_16(st->L_frame_fx,L_FRAME)&&!st->tcxonly) + IF( EQ_16(st->L_frame,L_FRAME)&&!st->tcxonly) { - Copy_Scale_sig( st->old_inp_12k8_fx, st->buf_speech_enc_pe+st->L_frame_fx-L_INP_MEM,L_INP_MEM, sub(st->prev_Q_new, st->prev_Q_old)); + Copy_Scale_sig( st->old_inp_12k8_fx, st->buf_speech_enc_pe+st->L_frame-L_INP_MEM,L_INP_MEM, sub(st->prev_Q_new, st->prev_Q_old)); } - ELSE IF( EQ_16(st->L_frame_fx,L_FRAME16k)&&!st->tcxonly) + ELSE IF( EQ_16(st->L_frame,L_FRAME16k)&&!st->tcxonly) { - lerp( st->buf_wspeech_enc+st->L_frame_fx + L_SUBFR-L_WSP_MEM, st->buf_wspeech_enc+st->L_frame_fx + L_SUBFR-310, 310, L_WSP_MEM ); - Copy( st->old_inp_16k_fx, st->buf_speech_enc_pe+st->L_frame_fx-L_INP_MEM,L_INP_MEM); + lerp( st->buf_wspeech_enc+st->L_frame + L_SUBFR-L_WSP_MEM, st->buf_wspeech_enc+st->L_frame + L_SUBFR-310, 310, L_WSP_MEM ); + Copy( st->old_inp_16k_fx, st->buf_speech_enc_pe+st->L_frame-L_INP_MEM,L_INP_MEM); } st->mem_preemph_enc = st->buf_speech_enc[st->encoderPastSamples_enc+st->encoderLookahead_enc-1]; move16(); - st->mem_wsp_enc = st->buf_wspeech_enc[st->L_frame_fx+L_SUBFR-1]; + st->mem_wsp_enc = st->buf_wspeech_enc[st->L_frame+L_SUBFR-1]; move16(); } /*coming from TCXonly modes*/ - ELSE IF( !st->tcxonly && GE_32(st->last_total_brate_fx,ACELP_32k)) + ELSE IF( !st->tcxonly && GE_32(st->last_total_brate,ACELP_32k)) { - Copy_Scale_sig( st->old_wsp_fx, st->buf_wspeech_enc+st->L_frame_fx + L_SUBFR-L_WSP_MEM,L_WSP_MEM, sub(st->prev_Q_new, st->prev_Q_old)); + Copy_Scale_sig( st->old_wsp_fx, st->buf_wspeech_enc+st->L_frame + L_SUBFR-L_WSP_MEM,L_WSP_MEM, sub(st->prev_Q_new, st->prev_Q_old)); /*Resamp buffers needed only for ACELP*/ - IF( EQ_16(st->L_frame_fx,L_FRAME16k)) + IF( EQ_16(st->L_frame,L_FRAME16k)) { - lerp( st->buf_wspeech_enc+st->L_frame_fx + L_SUBFR-L_WSP_MEM, st->buf_wspeech_enc+st->L_frame_fx + L_SUBFR-310, 310, L_WSP_MEM ); + lerp( st->buf_wspeech_enc+st->L_frame + L_SUBFR-L_WSP_MEM, st->buf_wspeech_enc+st->L_frame + L_SUBFR-310, 310, L_WSP_MEM ); } hLPDmem->mem_w0 = 0; move16(); - st->mem_wsp_enc = st->buf_wspeech_enc[st->L_frame_fx+L_SUBFR-1]; + st->mem_wsp_enc = st->buf_wspeech_enc[st->L_frame+L_SUBFR-1]; move16(); } } @@ -518,29 +518,29 @@ void init_sig_buffers_fx( Encoder_State_fx *st, const Word16 L_frame_old, const st->new_speech_enc = st->buf_speech_enc + st->encoderPastSamples_enc + st->encoderLookahead_enc; st->new_speech_enc_pe = st->buf_speech_enc_pe + st->encoderPastSamples_enc + st->encoderLookahead_enc; hTcxEnc->new_speech_ltp = hTcxEnc->buf_speech_ltp + st->encoderPastSamples_enc + st->encoderLookahead_enc; - hTcxEnc->new_speech_TCX = st->input_buff + L_FRAME48k + NS2SA(48000, DELAY_FIR_RESAMPL_NS) - NS2SA(st->input_Fs_fx, DELAY_FIR_RESAMPL_NS); + hTcxEnc->new_speech_TCX = st->input_buff_fx + L_FRAME48k + NS2SA(48000, DELAY_FIR_RESAMPL_NS) - NS2SA(st->input_Fs, DELAY_FIR_RESAMPL_NS); st->speech_enc = st->buf_speech_enc + st->encoderPastSamples_enc; st->speech_enc_pe = st->buf_speech_enc_pe + st->encoderPastSamples_enc; hTcxEnc->speech_ltp = hTcxEnc->buf_speech_ltp + st->encoderPastSamples_enc; hTcxEnc->speech_TCX = hTcxEnc->new_speech_TCX - st->encoderLookahead_FB; - st->wspeech_enc = st->buf_wspeech_enc + st->L_frame_fx + L_subfr; + st->wspeech_enc = st->buf_wspeech_enc + st->L_frame + L_subfr; test(); test(); - IF( st->ini_frame_fx == 0 || NE_16(st->L_frame_fx,L_frame_old)||EQ_16(st->last_codec_mode,MODE1)) + IF( st->ini_frame == 0 || NE_16(st->L_frame,L_frame_old)||EQ_16(st->last_codec_mode,MODE1)) { set16_fx(st->buf_synth, 0, OLD_SYNTH_SIZE_ENC+L_FRAME32k); } - st->synth = st->buf_synth + st->L_frame_fx + L_subfr; + st->synth = st->buf_synth + st->L_frame + L_subfr; return; } -static void init_core_sig_ana_fx( Encoder_State_fx *st ) +static void init_core_sig_ana_fx( Encoder_State *st ) { /* Pre-emphasis factor and memory */ @@ -571,16 +571,16 @@ static void init_core_sig_ana_fx( Encoder_State_fx *st ) } - st->min_band_fx = 1; + st->min_band = 1; move16(); - st->max_band_fx = 16; + st->max_band = 16; move16(); IF ( st->narrowBand == 0) { - st->min_band_fx = 0; + st->min_band = 0; move16(); - st->max_band_fx = 19; + st->max_band = 19; move16(); } @@ -588,7 +588,7 @@ static void init_core_sig_ana_fx( Encoder_State_fx *st ) return; } -static void init_acelp_fx( Encoder_State_fx *st, Word16 L_frame_old , const Word16 shift) +static void init_acelp_fx( Encoder_State *st, Word16 L_frame_old , const Word16 shift) { Word16 mem_syn_r_size_old; Word16 mem_syn_r_size_new; @@ -600,25 +600,25 @@ static void init_acelp_fx( Encoder_State_fx *st, Word16 L_frame_old , const Word /* Init LPDmem */ - IF( st->ini_frame_fx == 0 ) + IF( st->ini_frame == 0 ) { set16_fx( hLPDmem->syn, 0, 1+M ); set16_fx(hTcxEnc->Txnq, 0, L_FRAME32k/2+64); - hTcxEnc->acelp_zir = hTcxEnc->Txnq + shr(st->L_frame_fx,1); + hTcxEnc->acelp_zir = hTcxEnc->Txnq + shr(st->L_frame,1); set16_fx( hLPDmem->mem_syn_r, 0, L_SYN_MEM ); } ELSE /*Rate switching*/ { - IF( EQ_16(st->last_core_fx,ACELP_CORE)) + IF( EQ_16(st->last_core,ACELP_CORE)) { - lerp(hTcxEnc->Txnq,hTcxEnc->Txnq, shr(st->L_frame_fx,1), shr(L_frame_old,1) ); + lerp(hTcxEnc->Txnq,hTcxEnc->Txnq, shr(st->L_frame,1), shr(L_frame_old,1) ); } ELSE { lerp(hTcxEnc->Txnq,hTcxEnc->Txnq, st->hTcxCfg->tcx_mdct_window_length, st->hTcxCfg->tcx_mdct_window_length_old ); } - hTcxEnc->acelp_zir = hTcxEnc->Txnq + shr(st->L_frame_fx,1); + hTcxEnc->acelp_zir = hTcxEnc->Txnq + shr(st->L_frame,1); /* Rate switching */ IF( EQ_16(st->last_codec_mode,MODE1)) @@ -629,16 +629,16 @@ static void init_acelp_fx( Encoder_State_fx *st, Word16 L_frame_old , const Word } /*AMR-WBIO->MODE2*/ - IF( EQ_16(st->last_core_fx,AMR_WB_CORE)) + IF( EQ_16(st->last_core,AMR_WB_CORE)) { st->next_force_safety_net_fx=1; move16(); - st->last_core_fx = ACELP_CORE; + st->last_core = ACELP_CORE; move16(); } /*HQ-CORE->MODE2*/ test(); - IF( EQ_16(st->last_codec_mode,MODE1)&&EQ_16(st->last_core_fx,HQ_CORE)) + IF( EQ_16(st->last_codec_mode,MODE1)&&EQ_16(st->last_core,HQ_CORE)) { /*Reset of ACELP memories*/ st->next_force_safety_net_fx=1; @@ -656,12 +656,12 @@ static void init_acelp_fx( Encoder_State_fx *st, Word16 L_frame_old , const Word /* unquantized LPC*/ test(); - IF ( !((EQ_32(st->total_brate_fx,ACELP_16k40)||EQ_32(st->total_brate_fx,ACELP_24k40))&&(EQ_32(st->total_brate_fx,st->last_total_brate_fx))&&(EQ_16(st->last_bwidth_fx,st->bwidth_fx)))) + IF ( !((EQ_32(st->total_brate,ACELP_16k40)||EQ_32(st->total_brate,ACELP_24k40))&&(EQ_32(st->total_brate,st->last_total_brate))&&(EQ_16(st->last_bwidth,st->bwidth)))) { Copy( st->lsp_old1_fx, st->lspold_enc_fx, M ); /*lsp old @12.8kHz*/ - IF( EQ_16(st->L_frame_fx,L_FRAME16k)) + IF( EQ_16(st->L_frame,L_FRAME16k)) { - lsp_convert_poly_fx( st->lspold_enc_fx, st->L_frame_fx, 0 ); + lsp_convert_poly_fx( st->lspold_enc_fx, st->L_frame, 0 ); } } Copy( st->lspold_enc_fx, st->lsp_old_fx, M ); /*used unquantized values for mid-LSF Q*/ @@ -673,22 +673,22 @@ static void init_acelp_fx( Encoder_State_fx *st, Word16 L_frame_old , const Word { E_LPC_lsp_lsf_conversion( st->lsp_old_fx, st->lsf_old_fx, M ); } - st->last_core_fx = TCX_20_CORE; + st->last_core = TCX_20_CORE; move16(); st->hTcxCfg->last_aldo=1; /*It was previously ALDO*/ st->hTcxCfg->tcx_curr_overlap_mode = ALDO_WINDOW; /*ALDO overlap windowed past: also used in MODE1 but for other MDCT-FB*/ - set16_fx(hTcxEnc->old_out_fx, 0, st->L_frame_fx ); + set16_fx(hTcxEnc->old_out_fx, 0, st->L_frame ); } ELSE { test(); test(); - IF( (NE_16(st->L_frame_fx,L_frame_old))&&(LE_16(st->L_frame_fx,L_FRAME16k))&&(LE_16(L_frame_old,L_FRAME16k))) + IF( (NE_16(st->L_frame,L_frame_old))&&(LE_16(st->L_frame,L_FRAME16k))&&(LE_16(L_frame_old,L_FRAME16k))) { /* convert quantized LSP vector */ - st->rate_switching_reset=lsp_convert_poly_fx( st->lsp_old_fx, st->L_frame_fx, 0 ); + st->rate_switching_reset=lsp_convert_poly_fx( st->lsp_old_fx, st->L_frame, 0 ); IF( st->tcxonly == 0 ) { lsp2lsf_fx( st->lsp_old_fx, st->lsf_old_fx, M, st->sr_core ); @@ -697,7 +697,7 @@ static void init_acelp_fx( Encoder_State_fx *st, Word16 L_frame_old , const Word { E_LPC_lsp_lsf_conversion( st->lsp_old_fx, st->lsf_old_fx, M ); } - IF( EQ_16(st->L_frame_fx,L_FRAME16k)) + IF( EQ_16(st->L_frame,L_FRAME16k)) { Copy( st->lsp_old_fx, st->lspold_enc_fx, M ); } @@ -706,7 +706,7 @@ static void init_acelp_fx( Encoder_State_fx *st, Word16 L_frame_old , const Word Copy( st->lsp_old1_fx, st->lspold_enc_fx, M ); } - synth_mem_updt2( st->L_frame_fx, st->last_L_frame_fx, hLPDmem->old_exc, hLPDmem->mem_syn_r, hLPDmem->mem_syn2, hLPDmem->mem_syn, ENC ); + synth_mem_updt2( st->L_frame, st->last_L_frame, hLPDmem->old_exc, hLPDmem->mem_syn_r, hLPDmem->mem_syn2, hLPDmem->mem_syn, ENC ); /*Mem of deemphasis stay unchanged : hLPDmem->syn*/ { @@ -725,7 +725,7 @@ static void init_acelp_fx( Encoder_State_fx *st, Word16 L_frame_old , const Word hLPDmem->mem_w0 = sub(shr(st->wspeech_enc[-1],shift), tmp); } } - ELSE IF((NE_16(st->L_frame_fx,L_frame_old))) + ELSE IF((NE_16(st->L_frame,L_frame_old))) { /*Partial reset of ACELP memories*/ st->next_force_safety_net_fx=1; @@ -743,7 +743,7 @@ static void init_acelp_fx( Encoder_State_fx *st, Word16 L_frame_old , const Word /*Size of LPC syn memory*/ /* 1.25/20.0 = 1.0/16.0 -> shift 4 to the right. */ mem_syn_r_size_old = shr(L_frame_old, 4); - mem_syn_r_size_new = shr(st->L_frame_fx, 4); + mem_syn_r_size_new = shr(st->L_frame, 4); lerp( hLPDmem->mem_syn_r+L_SYN_MEM-mem_syn_r_size_old, hLPDmem->mem_syn_r+L_SYN_MEM-mem_syn_r_size_new, mem_syn_r_size_new, mem_syn_r_size_old ); Copy( hLPDmem->mem_syn_r+L_SYN_MEM-M, hLPDmem->mem_syn, M); @@ -755,9 +755,9 @@ static void init_acelp_fx( Encoder_State_fx *st, Word16 L_frame_old , const Word /* unquantized LPC*/ Copy( st->lsp_old1_fx, st->lspold_enc_fx, M ); /*lsp old @12.8kHz*/ - IF( EQ_16(st->L_frame_fx,L_FRAME16k)) + IF( EQ_16(st->L_frame,L_FRAME16k)) { - lsp_convert_poly_fx( st->lspold_enc_fx, st->L_frame_fx, 0 ); + lsp_convert_poly_fx( st->lspold_enc_fx, st->L_frame, 0 ); } Copy( st->lspold_enc_fx, st->lsp_old_fx, M ); /*used unquantized values for mid-LSF Q*/ IF( st->tcxonly == 0 ) @@ -769,7 +769,7 @@ static void init_acelp_fx( Encoder_State_fx *st, Word16 L_frame_old , const Word E_LPC_lsp_lsf_conversion( st->lsp_old_fx, st->lsf_old_fx, M ); } } - ELSE IF( !st->tcxonly && EQ_16(st->L_frame_fx,L_FRAME16k)&>_32(st->last_total_brate_fx,ACELP_32k)) + ELSE IF( !st->tcxonly && EQ_16(st->L_frame,L_FRAME16k)&>_32(st->last_total_brate,ACELP_32k)) { lsp2lsf_fx( st->lsp_old_fx, st->lsf_old_fx, M, st->sr_core ); } @@ -778,7 +778,7 @@ static void init_acelp_fx( Encoder_State_fx *st, Word16 L_frame_old , const Word test(); test(); - if(EQ_16(st->last_bwidth_fx,NB)&&NE_16(st->bwidth_fx,NB)&&st->ini_frame_fx!=0) + if(EQ_16(st->last_bwidth,NB)&&NE_16(st->bwidth,NB)&&st->ini_frame!=0) { st->rate_switching_reset=1; move16(); @@ -798,7 +798,7 @@ static void init_acelp_fx( Encoder_State_fx *st, Word16 L_frame_old , const Word move16(); /*Use for 12.8 kHz sampling rate and low bitrates, the conventional pulse search->better SNR*/ - if ((LE_32(st->total_brate_fx, ACELP_9k60)||st->rf_mode!=0)&&(EQ_32(st->sr_core,12800))) + if ((LE_32(st->total_brate, ACELP_9k60)||st->rf_mode!=0)&&(EQ_32(st->sr_core,12800))) { st->acelp_autocorr = 0; move16(); @@ -808,10 +808,10 @@ static void init_acelp_fx( Encoder_State_fx *st, Word16 L_frame_old , const Word /*BPF parameters for adjusting gain in function of background noise*/ IF( EQ_16(st->codec_mode,MODE2)) { - st->mem_bpf.lp_error_ener = L_deposit_l(0); + st->mem_bpf_fx.lp_error_ener = L_deposit_l(0); if( st->last_codec_mode == MODE1 ) { - st->mem_bpf.lp_error = L_deposit_l(0); + st->mem_bpf_fx.lp_error = L_deposit_l(0); } } @@ -820,7 +820,7 @@ static void init_acelp_fx( Encoder_State_fx *st, Word16 L_frame_old , const Word } static void init_modes_fx( - Encoder_State_fx *st, + Encoder_State *st, const Word32 last_total_brate ) { @@ -831,7 +831,7 @@ static void init_modes_fx( /* Restrict ACE/TCX20/TCX10 mode */ move16(); - st->restrictedMode = getRestrictedMode(st->element_mode, st->total_brate_fx, st->Opt_AMR_WB_fx); + st->restrictedMode = getRestrictedMode(st->element_mode, st->total_brate, st->Opt_AMR_WB); move16(); st->acelpEnabled = 0; move16(); @@ -861,19 +861,19 @@ static void init_modes_fx( move16(); /* Bits Budget */ - /*st->bits_frame_nominal = (int)( (float)st->L_frame_fx * (float)FSCALE_DENOM * (float)st->bitrate / ( (float)st->fscale * 12800.0f ) );*/ - /*st->bits_frame_nominal = (int)( (float)st->L_frame_fx/(float)st->fscale * (float)FSCALE_DENOM/128.0f * (float)st->bitrate/100.0f + 0.49f );*/ + /*st->bits_frame_nominal = (int)( (float)st->L_frame * (float)FSCALE_DENOM * (float)st->bitrate / ( (float)st->fscale * 12800.0f ) );*/ + /*st->bits_frame_nominal = (int)( (float)st->L_frame/(float)st->fscale * (float)FSCALE_DENOM/128.0f * (float)st->bitrate/100.0f + 0.49f );*/ /*328 = 0.010009765625 in 0Q15*/ - /* st->bits_frame_nominal = extract_h(L_add(L_mult(div_l(L_mult(shl(st->L_frame_fx,2),st->bitrate),st->fscale),328),16056)); */ + /* st->bits_frame_nominal = extract_h(L_add(L_mult(div_l(L_mult(shl(st->L_frame,2),st->bitrate),st->fscale),328),16056)); */ - /* st->bits_frame_nominal = (int)( (float)st->L_frame_fx/(float)st->fscale * (float)FSCALE_DENOM/128.0f * (float)st->bitrate/100.0f + 0.49f ); */ + /* st->bits_frame_nominal = (int)( (float)st->L_frame/(float)st->fscale * (float)FSCALE_DENOM/128.0f * (float)st->bitrate/100.0f + 0.49f ); */ assert(FSCALE_DENOM == 512); - assert(st->fscale == 2 * st->L_frame_fx); /* this assumption is true if operated in 20ms frames with FSCALE_DENOM == 512, which is the current default */ - tmp32 = L_shl(st->total_brate_fx, 1); /* (float)st->L_frame_fx/(float)st->fscale * (float)FSCALE_DENOM/128.0f * (float)st->bitrate */ + assert(st->fscale == 2 * st->L_frame); /* this assumption is true if operated in 20ms frames with FSCALE_DENOM == 512, which is the current default */ + tmp32 = L_shl(st->total_brate, 1); /* (float)st->L_frame/(float)st->fscale * (float)FSCALE_DENOM/128.0f * (float)st->bitrate */ st->bits_frame_nominal = extract_l(L_shr(Mpy_32_16_1(tmp32, 20972), 6)); /* 20972 = 0.01 * 64 * 32768 */ - assert(st->bits_frame_nominal == (int)( (float)st->L_frame_fx/(float)st->fscale * (float)FSCALE_DENOM/128.0f * (float)st->total_brate_fx/100.0f + 0.49f )); + assert(st->bits_frame_nominal == (int)( (float)st->L_frame/(float)st->fscale * (float)FSCALE_DENOM/128.0f * (float)st->total_brate/100.0f + 0.49f )); - IF (st->Opt_AMR_WB_fx) + IF (st->Opt_AMR_WB) { st->bits_frame = st->bits_frame_nominal; st->bits_frame_core = st->bits_frame_nominal; diff --git a/lib_enc/core_enc_ol_fx.c b/lib_enc/core_enc_ol_fx.c index e83c9e26b..62f022bb3 100644 --- a/lib_enc/core_enc_ol_fx.c +++ b/lib_enc/core_enc_ol_fx.c @@ -33,7 +33,7 @@ static void BITS_ALLOC_TCX_config_rf(Word16* rf_frame_type, Word16* rf_target_bi *-------------------------------------------------------------------*/ void core_encode_openloop_fx( - Encoder_State_fx *st, /* i/o: encoder state structure */ + Encoder_State *st, /* i/o: encoder state structure */ const Word16 coder_type, /* i : coding type */ const Word16 Aw[NB_SUBFR16k*(M+1)], /* i : weighted A(z) unquant. for subframes*/ const Word16 *lsp_new, /* i : LSPs at the end of the frame */ @@ -177,7 +177,7 @@ void core_encode_openloop_fx( } test(); - IF ( st->core_fx==ACELP_CORE || !st->enableTcxLpc ) + IF ( st->core==ACELP_CORE || !st->enableTcxLpc ) { IF (st->envWeighted) { @@ -187,7 +187,7 @@ void core_encode_openloop_fx( move16(); } - IF(EQ_16(st->core_fx,TCX_20_CORE)) + IF(EQ_16(st->core,TCX_20_CORE)) { lpc_quantization_fx( st, lsp_new, lsp_mid, lsp_q, lsf_q, lspmid_q, lspq_ind, st->clip_var_fx, AUDIO, st->acelp_cfg.midLpc, param_lpc, &nbits_lpc, bits_param_lpc, &no_param_lpc, add(Q_new, Q_SCALE - 2) ); @@ -210,7 +210,7 @@ void core_encode_openloop_fx( Copy( lsp_q, lspmid_q, M ); } - stab_fac = lsf_stab_fx(lsf_q, st->lsf_old_fx, 0, st->L_frame_fx); + stab_fac = lsf_stab_fx(lsf_q, st->lsf_old_fx, 0, st->L_frame); } @@ -219,15 +219,15 @@ void core_encode_openloop_fx( /*--------------------------------------------------------------* * Run ACELP *---------------------------------------------------------------*/ - IF ( st->core_fx==ACELP_CORE ) + IF ( st->core==ACELP_CORE ) { IF ( st->acelp_cfg.midLpc != 0 ) { - int_lsp4_fx( st->L_frame_fx, st->lsp_old_fx, lspmid_q, lsp_q, A_q, M, 0 ); + int_lsp4_fx( st->L_frame, st->lsp_old_fx, lspmid_q, lsp_q, A_q, M, 0 ); } ELSE { - int_lsp_fx( st->L_frame_fx, st->lsp_old_fx, lsp_q, A_q, M, interpol_frac_fx, 0 ); + int_lsp_fx( st->L_frame, st->lsp_old_fx, lsp_q, A_q, M, interpol_frac_fx, 0 ); } /* Calculate target bits */ @@ -241,7 +241,7 @@ void core_encode_openloop_fx( } IF( st->igf != 0 ) { - target_bits = sub( target_bits, get_tbe_bits_fx( st->total_brate_fx, st->bwidth_fx, st->rf_mode ) ); + target_bits = sub( target_bits, get_tbe_bits_fx( st->total_brate, st->bwidth, st->rf_mode ) ); } @@ -256,9 +256,9 @@ void core_encode_openloop_fx( } /* reset TBE buffers previous frame frame wasn't ACELP*/ - IF( NE_16( st->last_core_fx, ACELP_CORE )) + IF( NE_16( st->last_core, ACELP_CORE )) { - TBEreset_enc_fx( st, st->bwidth_fx ); + TBEreset_enc_fx( st, st->bwidth ); } @@ -281,7 +281,7 @@ void core_encode_openloop_fx( move16(); move16(); st->hPlcExt->LPDmem = hLPDmem; - encoderSideLossSimulation_fx( st,st->hPlcExt, lsf_q, stab_fac, st->hPlcExt->calcOnlylsf, st->L_frame_fx); + encoderSideLossSimulation_fx( st,st->hPlcExt, lsf_q, stab_fac, st->hPlcExt->calcOnlylsf, st->L_frame); } st->last_stab_fac = stab_fac; @@ -300,7 +300,7 @@ void core_encode_openloop_fx( * Run TCX20 *---------------------------------------------------------------*/ - IF ( EQ_16(st->core_fx, TCX_20_CORE)) + IF ( EQ_16(st->core, TCX_20_CORE)) { IF (st->enableTcxLpc) { @@ -391,7 +391,7 @@ void core_encode_openloop_fx( A_q, A_q_ind, st->synth, - st->L_frame_fx, + st->L_frame, hTcxEnc->L_frameTCX, st->hTcxCfg->tcx_coded_lines, target_bits, @@ -419,7 +419,7 @@ void core_encode_openloop_fx( } IF(st->hPlcExt) { - encoderSideLossSimulation_fx(st,st->hPlcExt, lsf_q, stab_fac, 1, st->L_frame_fx); + encoderSideLossSimulation_fx(st,st->hPlcExt, lsf_q, stab_fac, 1, st->L_frame); } } @@ -430,7 +430,7 @@ void core_encode_openloop_fx( Copy( lsp_new, st->lspold_enc_fx, M ); test(); - IF ( st->enableTcxLpc && st->core_fx != ACELP_CORE ) + IF ( st->enableTcxLpc && st->core != ACELP_CORE ) { /* Update lsf/lsp memory */ Copy(lsf_tcx_q, st->lsf_old_fx, M); @@ -457,13 +457,13 @@ void core_encode_openloop_fx( /*--------------------------------------------------------------* * Update LP_CNG parameters *--------------------------------------------------------------*/ - IF( st->Opt_DTX_ON_fx != 0 ) + IF( st->Opt_DTX_ON != 0 ) { /* update CNG parameters in active frames */ - IF ( EQ_16(st->bwidth_fx,NB)&&st->enableTcxLpc&&st->core_fx!=ACELP_CORE) + IF ( EQ_16(st->bwidth,NB)&&st->enableTcxLpc&&st->core!=ACELP_CORE) { Word16 buf[L_LP], res[L_FRAME], A[M+1], r_l[M+1], r_h[M+1], lsptmp[M], Q_r; - assert(st->L_frame_fx==L_FRAME); + assert(st->L_frame==L_FRAME); Copy(st->synth+L_FRAME-L_LP, buf, L_LP); tmp = st->synth[L_FRAME-L_LP-1]; E_UTIL_f_preemph2(Q_new-1, buf, st->preemph_fac, L_LP, &tmp); @@ -472,21 +472,21 @@ void core_encode_openloop_fx( E_LPC_lev_dur(r_h, r_l, A, NULL, M, NULL); E_LPC_a_lsp_conversion(A, lsptmp, lsp_new, M); Residu3_fx(A, buf+L_LP-L_FRAME, res, L_FRAME, 1); - cng_params_upd_fx( lsptmp, res, st->L_frame_fx, &hTdCngEnc->ho_circ_ptr, + cng_params_upd_fx( lsptmp, res, st->L_frame, &hTdCngEnc->ho_circ_ptr, hTdCngEnc->ho_ener_circ_fx, &hTdCngEnc->ho_circ_size, hTdCngEnc->ho_lsp_circ_fx, Q_new, ENC, NULL, &hTdCngEnc->cng_buf_cnt, hTdCngEnc->cng_exc2_buf, hTdCngEnc->cng_Qexc_buf, hTdCngEnc->cng_brate_buf, hDtxEnc->last_active_brate ); } ELSE { - cng_params_upd_fx( lsp_new, hLPDmem->old_exc+L_EXC_MEM-st->L_frame_fx, - st->L_frame_fx, &hTdCngEnc->ho_circ_ptr, hTdCngEnc->ho_ener_circ_fx, + cng_params_upd_fx( lsp_new, hLPDmem->old_exc+L_EXC_MEM-st->L_frame, + st->L_frame, &hTdCngEnc->ho_circ_ptr, hTdCngEnc->ho_ener_circ_fx, &hTdCngEnc->ho_circ_size, hTdCngEnc->ho_lsp_circ_fx, Q_new, ENC, NULL, &hTdCngEnc->cng_buf_cnt, hTdCngEnc->cng_exc2_buf, hTdCngEnc->cng_Qexc_buf, hTdCngEnc->cng_brate_buf, hDtxEnc->last_active_brate ); } - IF( EQ_16(st->L_frame_fx,L_FRAME)) + IF( EQ_16(st->L_frame,L_FRAME)) { /* store LSPs@16k, potentially to be used in CNG@16k */ Copy( st->lsp_old16k_fx, &(hTdCngEnc->ho_lsp_circ2_fx[(hTdCngEnc->ho_circ_ptr)*M]), M ); @@ -495,7 +495,7 @@ void core_encode_openloop_fx( /* Set 16k LSP flag for CNG buffer */ hTdCngEnc->ho_16k_lsp[hTdCngEnc->ho_circ_ptr] = 1; move16(); - if ( EQ_16(st->L_frame_fx,L_FRAME)) + if ( EQ_16(st->L_frame,L_FRAME)) { hTdCngEnc->ho_16k_lsp[hTdCngEnc->ho_circ_ptr] = 0; move16(); @@ -513,11 +513,11 @@ void core_encode_openloop_fx( *---------------------------------------------------------------*/ test(); - IF (GT_16(st->core_fx, ACELP_CORE)||(st->rate_switching_reset!=0)) + IF (GT_16(st->core, ACELP_CORE)||(st->rate_switching_reset!=0)) { /*TCX mode: copy values*/ - set16_fx(st->mem_bpf.noise_buf, 0, 2*L_FILT16k); /*TCX->no gain*/ - set16_fx(st->mem_bpf.error_buf, 0, L_FILT16k); /*TCX->no gain*/ + set16_fx(st->mem_bpf_fx.noise_buf, 0, 2*L_FILT16k); /*TCX->no gain*/ + set16_fx(st->mem_bpf_fx.error_buf, 0, L_FILT16k); /*TCX->no gain*/ st->bpf_gain_param=0; } ELSE IF (st->acelp_cfg.bpf_mode > 0) @@ -525,7 +525,7 @@ void core_encode_openloop_fx( /*ACELP: estimate bpf parameter with delay=0*/ /*Estimate bpf parameter*/ - bass_pf_enc_fx( st->speech_enc, st->synth, st->bpf_T, st->bpf_gainT, st->L_frame_fx, L_SUBFR, &(st->bpf_gain_param), st->acelp_cfg.bpf_mode, &(st->mem_bpf) ); + bass_pf_enc_fx( st->speech_enc, st->synth, st->bpf_T, st->bpf_gainT, st->L_frame, L_SUBFR, &(st->bpf_gain_param), st->acelp_cfg.bpf_mode, &(st->mem_bpf_fx) ); } @@ -540,13 +540,13 @@ void core_encode_openloop_fx( * Generate Bitstream *---------------------------------------------------------------*/ - enc_prm_fx( coder_type, param_core, param_lpc, st, st->L_frame_fx, &hm_cfg, bits_param_lpc, no_param_lpc ); + enc_prm_fx( coder_type, param_core, param_lpc, st, st->L_frame, &hm_cfg, bits_param_lpc, no_param_lpc ); /* Channel-aware mode - encode partial copy */ IF( EQ_16(st->rf_mode,1)) { set16_fx(lsf_q_1st_rf, 0, M); - IF (EQ_16(st->core_fx, ACELP_CORE)) + IF (EQ_16(st->core, ACELP_CORE)) { /* convert LSPs to LP coefficients */ lsp2lsf_fx( lsp_new, lsf_uq_rf, M, st->sr_core ); @@ -600,7 +600,7 @@ void core_encode_openloop_fx( hRF->rf_indx_lsf[0][2] = param_lpc[3]; } - IF (EQ_16(st->core_fx, ACELP_CORE)) + IF (EQ_16(st->core, ACELP_CORE)) { /* current n-th ACELP frame and its corresponding partial copy */ @@ -610,10 +610,10 @@ void core_encode_openloop_fx( /*o: lsp_q_rf in Q15*/ /* Interpolate LSPs and convert to LPC */ - int_lsp_fx( st->L_frame_fx, lsp_old_q_rf, lsp_q_rf, Aq_rf, M, interpol_frac_fx, 0 ); + int_lsp_fx( st->L_frame, lsp_old_q_rf, lsp_q_rf, Aq_rf, M, interpol_frac_fx, 0 ); /* stability estimation */ - stab_fac_rf = lsf_stab_fx( lsf_q_rf, lsf_old_q_rf, 0, st->L_frame_fx ); /*Q15*/ + stab_fac_rf = lsf_stab_fx( lsf_q_rf, lsf_old_q_rf, 0, st->L_frame ); /*Q15*/ /* Configure partial copy estimation of the current n-th frame to be packed in future with n+fec_offset frame */ /* o: rf_frame_type, o: rf_target_bits */ @@ -632,7 +632,7 @@ void core_encode_openloop_fx( } ELSE { - hRF->rf_clas[0] = st->clas_fx; + hRF->rf_clas[0] = st->clas; move16(); hRF->rf_gain_tcx[0] = param_core[0]; move16(); @@ -666,10 +666,10 @@ void core_encode_openloop_fx( test(); test(); IF( - (EQ_16(st->core_fx, TCX_20_CORE) )/*(st->core == TCX_20_CORE)*/ - && (EQ_16(st->last_core_fx,TCX_20_CORE) )/*&&(st->last_core == TCX_20_CORE)*/ + (EQ_16(st->core, TCX_20_CORE) )/*(st->core == TCX_20_CORE)*/ + && (EQ_16(st->last_core,TCX_20_CORE) )/*&&(st->last_core == TCX_20_CORE)*/ && (EQ_16(hRF->rf_second_last_core, TCX_20_CORE) )/*&& (st->rf_second_last_core == TCX_20_CORE)*/ - && ( (LE_16(hTcxEnc->tcxltp_pitch_int, shr(st->L_frame_fx, 1)) ) || ( LE_16(hTcxEnc->tcxltp_gain, 13107/*0.4f Q15*/) ) )/*&& ((st->tcxltp_pitch_int <= 0.5f*st->L_frame) || ( st->tcxltp_gain <= 0.4f))*/ + && ( (LE_16(hTcxEnc->tcxltp_pitch_int, shr(st->L_frame, 1)) ) || ( LE_16(hTcxEnc->tcxltp_gain, 13107/*0.4f Q15*/) ) )/*&& ((st->tcxltp_pitch_int <= 0.5f*st->L_frame) || ( st->tcxltp_gain <= 0.4f))*/ && (EQ_16(hTcxEnc->tcxltp_pitch_int, hRF->rf_tcxltp_pitch_int_past) )/*&& (st->tcxltp_pitch_int == st->rf_tcxltp_pitch_int_past)*/ && (hRF->rf_last_tns_active == 0)/*!st->rf_last_tns_active*/ && (hRF->rf_second_last_tns_active == 0)/*!st->rf_second_last_tns_active*/ @@ -679,15 +679,15 @@ void core_encode_openloop_fx( rf_PLC_Mode = 1; move16(); } - ELSE IF (st->last_core_fx != 0) + ELSE IF (st->last_core != 0) { test(); test(); test(); - IF ( ((LE_16(st->clas_fx, UNVOICED_TRANSITION))||(LE_16(st->last_clas_fx,UNVOICED_TRANSITION))||(LE_16(hTcxEnc->tcxltp_gain,13107/*0.4f Q15*/))) - && NE_16(st->last_core_fx, -1) ) + IF ( ((LE_16(st->clas, UNVOICED_TRANSITION))||(LE_16(st->last_clas,UNVOICED_TRANSITION))||(LE_16(hTcxEnc->tcxltp_gain,13107/*0.4f Q15*/))) + && NE_16(st->last_core, -1) ) { - rf_PLC_Mode = st->last_core_fx; + rf_PLC_Mode = st->last_core; move16(); } } @@ -716,7 +716,7 @@ void core_encode_openloop_fx( move16(); hRF->rf_last_tns_active = (st->hTcxCfg->fIsTNSAllowed & hTcxEnc->fUseTns_fx[0]); move16(); - hRF->rf_second_last_core = st->last_core_fx; + hRF->rf_second_last_core = st->last_core; move16(); hRF->rf_tcxltp_param[0] = hTcxEnc->tcxltp_param[1]; @@ -724,7 +724,7 @@ void core_encode_openloop_fx( /* Configure partial copy estimation of the current n-th frame to be packed in future with n+fec_offset frame */ /* o: rf_frame_type, o: rf_target_bits */ - BITS_ALLOC_TCX_config_rf( &hRF->rf_frame_type, &hRF->rf_target_bits, rf_PLC_Mode, coder_type, st->last_core_fx, TD_mode); + BITS_ALLOC_TCX_config_rf( &hRF->rf_frame_type, &hRF->rf_target_bits, rf_PLC_Mode, coder_type, st->last_core, TD_mode); /* RF frame type in the buffer */ hRF->rf_indx_frametype[0] = hRF->rf_frame_type; @@ -799,7 +799,7 @@ static void closest_centroid_rf( void core_acelp_tcx20_switching_fx( - Encoder_State_fx *st, /* i/o: encoder state structure */ + Encoder_State *st, /* i/o: encoder state structure */ Word16 non_staX, /* i : unbound non-stationarity for sp/mu clas */ Word16 *pitch_fr, /* i/o: fraction pitch values */ Word16 *voicing_fr, /* i/o: fractional voicing values */ @@ -852,7 +852,7 @@ void core_acelp_tcx20_switching_fx( /* convert pitch values to 16kHz domain */ s = mult_r(tmp16, 8192/*0.25f Q15*/); - if (EQ_16(st->L_frame_fx, L_FRAME16k)) + if (EQ_16(st->L_frame, L_FRAME16k)) { /*pitch[i] = (short)(pitch[i] * 1.25f + 0.5f);*/ tmp16 = add(tmp16, s); @@ -873,7 +873,7 @@ void core_acelp_tcx20_switching_fx( tcx_ltp_encode_fx(hTcxEnc->tcxltp, st->tcxonly, TCX_20, - st->L_frame_fx, + st->L_frame, L_SUBFR, st->speech_enc + st->encoderLookahead_enc, hTcxEnc->speech_ltp + st->encoderLookahead_enc, @@ -888,7 +888,7 @@ void core_acelp_tcx20_switching_fx( &hTcxEnc->tcxltp_pitch_fr_past, &hTcxEnc->tcxltp_gain_past, &hTcxEnc->tcxltp_norm_corr_past, - st->last_core_fx, + st->last_core, st->pit_min, st->pit_fr1, st->pit_fr2, @@ -903,7 +903,7 @@ void core_acelp_tcx20_switching_fx( /* Force TCX when TCX20 in MODE1 is selected */ IF ( EQ_16(st->mdct_sw, MODE1)) { - st->core_fx = TCX_20_CORE; + st->core = TCX_20_CORE; move16(); } ELSE @@ -912,7 +912,7 @@ void core_acelp_tcx20_switching_fx( * Estimate TCX SNR *---------------------------------------------------------------*/ - L_frame = st->L_frame_fx; + L_frame = st->L_frame; move16(); tcx_offset = st->hTcxCfg->tcx_offset; move16(); @@ -928,7 +928,7 @@ void core_acelp_tcx20_switching_fx( target = L_add(0xA618AE, 0); /* 500f * log2(10)/10 (15Q16) */ } - IF (st->last_core_fx == ACELP_CORE) + IF (st->last_core == ACELP_CORE) { L_frame = add(L_frame, tcx_offset); tcx_offset = s_min(st->hTcxCfg->lfacNext, 0); @@ -940,7 +940,7 @@ void core_acelp_tcx20_switching_fx( Copy(hTcxEnc->speech_ltp + sub(tcx_offset, shr(overlap, 1)), xn_buf, add(L_frame, overlap)); tmp16 = shr(overlap, 1); - IF (EQ_16(st->last_core_fx,ACELP_CORE)) + IF (EQ_16(st->last_core,ACELP_CORE)) { IF (tcx_offset < 0) { @@ -1103,7 +1103,7 @@ void core_acelp_tcx20_switching_fx( tcx_snr = L_deposit_l(0); - FOR (i = 0; i < st->L_frame_fx; i += L_SUBFR) + FOR (i = 0; i < st->L_frame; i += L_SUBFR) { tmp32 = L_deposit_l(0); @@ -1125,7 +1125,7 @@ void core_acelp_tcx20_switching_fx( tcx_snr = L_add(tcx_snr, tmp32); } - tcx_snr = Mpy_32_16_1(tcx_snr, div_s(L_SUBFR, st->L_frame_fx)); + tcx_snr = Mpy_32_16_1(tcx_snr, div_s(L_SUBFR, st->L_frame)); tcx_snr = L_sub(tcx_snr, L_shr(BASOP_Util_Log2(Mpy_32_16_1(ener, L_SUBFR)), 9)); tcx_snr = L_sub(tcx_snr, L_deposit_h(add(ener_e, 15))); tcx_snr = L_shl(Mpy_32_16_1(tcx_snr, 0x6054), 2); /* 0x6054 -> 10/log2(10) (2Q13) */ @@ -1151,7 +1151,7 @@ void core_acelp_tcx20_switching_fx( i2 = 0; move16(); - FOR (i = 0; i < st->L_frame_fx; i += L_SUBFR) + FOR (i = 0; i < st->L_frame; i += L_SUBFR) { IF ( EQ_32( st->sr_core, INT_FS_16k)) { @@ -1184,12 +1184,12 @@ void core_acelp_tcx20_switching_fx( #endif } /* Assume always 4 sub frames. */ - /*assert( (st->L_frame_fx / L_SUBFR) == 4);*/ + /*assert( (st->L_frame / L_SUBFR) == 4);*/ tmp32 = L_add(tmp32, Mpy_32_16_1(L_sub(BASOP_Util_Log2(signal), BASOP_Util_Log2(noise)), 12330/*3.0102999566398119521373889472449 Q12*/)); i2 = add(i2, 1); } - if(EQ_16(st->L_frame_fx,L_FRAME16k)) + if(EQ_16(st->L_frame,L_FRAME16k)) { tmp32 = Mpy_32_16_1(tmp32,26214/*(float)L_FRAME/(float)L_FRAME16k Q15*/); } @@ -1268,10 +1268,10 @@ void core_acelp_tcx20_switching_fx( move16(); } - IF ( st->flag_noisy_speech_snr ) + IF ( st->flag_noisy_speech_snr_fx) { test(); - IF ( st->vad_flag || st->Opt_DTX_ON_fx ) + IF ( st->vad_flag || st->Opt_DTX_ON ) { dsnr = add(dsnr, 512/*2.0f Q8*/); } @@ -1284,20 +1284,20 @@ void core_acelp_tcx20_switching_fx( test();test();test(); test();test();test(); if (EQ_32(st->sr_core, INT_FS_12k8) && (LT_16(non_staX,512/*2.0f Q8*/) || - (st->flag_noisy_speech_snr==0 && EQ_16(st->vad_flag,1) && (offset_tcx==L_add(0xFFD57AB5,0)) && GE_16(st->acelpFramesCount,6))) && - (st->last_core_fx==ACELP_CORE || st->last_core_fx==TCX_20_CORE)) + (st->flag_noisy_speech_snr_fx ==0 && EQ_16(st->vad_flag,1) && (offset_tcx==L_add(0xFFD57AB5,0)) && GE_16(st->acelpFramesCount,6))) && + (st->last_core==ACELP_CORE || st->last_core==TCX_20_CORE)) { - st->core_fx = st->last_core_fx; + st->core = st->last_core; } ELSE IF ( GT_16(add(snr_acelp, dsnr), snr_tcx)) { - st->core_fx = ACELP_CORE; + st->core = ACELP_CORE; move16(); st->acelpFramesCount = s_min(32767-1, add(st->acelpFramesCount, 1)); } ELSE { - st->core_fx = TCX_20_CORE; + st->core = TCX_20_CORE; move16(); st->acelpFramesCount = 0; move16(); @@ -1309,14 +1309,14 @@ void core_acelp_tcx20_switching_fx( test(); if ( st->acelpEnabled != 0 && st->tcx20Enabled == 0 ) { - st->core_fx = ACELP_CORE; + st->core = ACELP_CORE; move16(); } test(); if ( st->acelpEnabled == 0 && st->tcx20Enabled != 0 ) { - st->core_fx = TCX_20_CORE; + st->core = TCX_20_CORE; move16(); } diff --git a/lib_enc/core_enc_reconf_fx.c b/lib_enc/core_enc_reconf_fx.c index 2bed3d9d0..d91318146 100644 --- a/lib_enc/core_enc_reconf_fx.c +++ b/lib_enc/core_enc_reconf_fx.c @@ -20,7 +20,7 @@ * - reconfig core coder when switching to another frame type * *-----------------------------------------------------------------*/ void core_coder_reconfig_fx( - Encoder_State_fx* st, + Encoder_State* st, const Word32 last_total_brate ) { @@ -30,7 +30,7 @@ void core_coder_reconfig_fx( (void)last_total_brate; #endif /*Configuration of ACELP*/ - BITS_ALLOC_init_config_acelp(st->total_brate_fx, st->narrowBand, st->nb_subfr, &(st->acelp_cfg)); + BITS_ALLOC_init_config_acelp(st->total_brate, st->narrowBand, st->nb_subfr, &(st->acelp_cfg)); /*Configuration of partial copy*/ if (st->Opt_RF_ON) @@ -125,7 +125,7 @@ void core_coder_reconfig_fx( move16(); test(); - if ((LE_32(st->total_brate_fx, ACELP_9k60)) && (EQ_32(st->sr_core, INT_FS_12k8))) + if ((LE_32(st->total_brate, ACELP_9k60)) && (EQ_32(st->sr_core, INT_FS_12k8))) { st->acelp_autocorr = 0; move16(); @@ -164,8 +164,8 @@ void core_coder_reconfig_fx( test(); test(); IF(EQ_16(bwidth, scaleTcxTable[i].bwmode) && - GE_32(st->total_brate_fx, scaleTcxTable[i].bitrateFrom) && - LT_32(st->total_brate_fx, scaleTcxTable[i].bitrateTo)) + GE_32(st->total_brate, scaleTcxTable[i].bitrateFrom) && + LT_32(st->total_brate, scaleTcxTable[i].bitrateTo)) { if (st->rf_mode) { @@ -183,20 +183,20 @@ void core_coder_reconfig_fx( IF (GT_16(st->element_mode, IVAS_SCE)) { test();test(); - st->enableTcxLpc = (EQ_16(st->lpcQuantization, 1) && (LE_32(st->total_brate_fx, LOWRATE_TCXLPC_MAX_BR_CPE) || st->rf_mode)); + st->enableTcxLpc = (EQ_16(st->lpcQuantization, 1) && (LE_32(st->total_brate, LOWRATE_TCXLPC_MAX_BR_CPE) || st->rf_mode)); move16(); } ELSE { test();test(); - if (EQ_16(st->lpcQuantization, 1) && (LE_32(st->total_brate_fx, LOWRATE_TCXLPC_MAX_BR) || st->rf_mode != 0)) + if (EQ_16(st->lpcQuantization, 1) && (LE_32(st->total_brate, LOWRATE_TCXLPC_MAX_BR) || st->rf_mode != 0)) { st->enableTcxLpc = 1; move16(); } } test(); - IF ( st->ini_frame_fx == 0 || EQ_16(st->last_codec_mode, MODE1)) + IF ( st->ini_frame == 0 || EQ_16(st->last_codec_mode, MODE1)) { st->envWeighted = 0; move16(); @@ -204,8 +204,8 @@ void core_coder_reconfig_fx( test(); test(); - IF( EQ_16(st->bwidth_fx, SWB)&& - (EQ_32(st->total_brate_fx, ACELP_16k40) || EQ_32(st->total_brate_fx, ACELP_24k40)) ) + IF( EQ_16(st->bwidth, SWB)&& + (EQ_32(st->total_brate, ACELP_16k40) || EQ_32(st->total_brate, ACELP_24k40)) ) { IF(st->tec_tfa == 0) { @@ -226,7 +226,7 @@ void core_coder_reconfig_fx( st->enablePlcWaveadjust = 0; move16(); - IF (GE_32(st->total_brate_fx, 48000)) + IF (GE_32(st->total_brate, 48000)) { st->enablePlcWaveadjust = 1; move16(); @@ -239,7 +239,7 @@ void core_coder_reconfig_fx( test(); test(); test(); - if( (EQ_32(st->total_brate_fx, ACELP_9k60) || EQ_32(st->total_brate_fx, ACELP_16k40) || EQ_32(st->total_brate_fx, ACELP_24k40)) && EQ_16(st->element_mode, EVS_MONO) ) + if( (EQ_32(st->total_brate, ACELP_9k60) || EQ_32(st->total_brate, ACELP_16k40) || EQ_32(st->total_brate, ACELP_24k40)) && EQ_16(st->element_mode, EVS_MONO) ) { move16(); st->glr = 1; @@ -253,7 +253,7 @@ void core_coder_reconfig_fx( IF (hTcxEnc != NULL) { test(); - IF(EQ_16(st->bwidth_fx, NB) || EQ_16(st->bwidth_fx, WB)) + IF(EQ_16(st->bwidth, NB) || EQ_16(st->bwidth, WB)) { test(); IF(st->rf_mode == 0) @@ -267,7 +267,7 @@ void core_coder_reconfig_fx( hTcxEnc->nmStartLine = startLineWB[index]; move16(); } - ELSE /* (st->bwidth_fx == SWB || st->bwidth_fx == FB) */ + ELSE /* (st->bwidth == SWB || st->bwidth == FB) */ { IF(st->rf_mode == 0) { @@ -278,13 +278,13 @@ void core_coder_reconfig_fx( index = s_min(N_TCX_STARTLINE_NOISE_SWB - 1, sub(s_max(3, st->frame_size_index - 1), 3)); } test();test(); - if (GE_32(st->total_brate_fx, IVAS_96k) && LE_32(st->total_brate_fx, IVAS_192k) && GT_16(st->element_mode, IVAS_SCE)) + if (GE_32(st->total_brate, IVAS_96k) && LE_32(st->total_brate, IVAS_192k) && GT_16(st->element_mode, IVAS_SCE)) { index = sub(index, 1); } hTcxEnc->nmStartLine = startLineSWB[index]; move16(); - if (EQ_32(st->total_brate_fx, IVAS_48k) && EQ_16(st->element_mode, IVAS_CPE_MDCT) && LT_16(add(hTcxEnc->nmStartLine, shl(hTcxEnc->nmStartLine,2)) , shl(st->L_frame_fx, 2)) ) + if (EQ_32(st->total_brate, IVAS_48k) && EQ_16(st->element_mode, IVAS_CPE_MDCT) && LT_16(add(hTcxEnc->nmStartLine, shl(hTcxEnc->nmStartLine,2)) , shl(st->L_frame, 2)) ) { hTcxEnc->nmStartLine = shr(add(hTcxEnc->nmStartLine, shl(hTcxEnc->nmStartLine, 2)), 2); /* low-rate stereo is more efficient than dual-mono due to stereo processing */ } @@ -295,7 +295,7 @@ void core_coder_reconfig_fx( { test(); test(); test(); test(); test(); - IF((LT_32(st->total_brate_fx, ACELP_24k40)) && ((GT_32(st->total_brate_fx, st->last_total_brate_fx)) || (EQ_16(st->last_codec_mode, MODE1)))) + IF((LT_32(st->total_brate, ACELP_24k40)) && ((GT_32(st->total_brate, st->last_total_brate)) || (EQ_16(st->last_codec_mode, MODE1)))) { /* low-freq memQuantZeros_fx must be reset partially if bitrate increased */ FOR(i = 0; i < hTcxEnc->nmStartLine; i++) @@ -304,9 +304,9 @@ void core_coder_reconfig_fx( move16(); } } - ELSE IF((GE_32(st->total_brate_fx, ACELP_24k40)) && (LE_32(st->total_brate_fx, ACELP_32k)) && (GE_32(st->last_total_brate_fx, ACELP_13k20)) && (LT_32(st->last_total_brate_fx, ACELP_24k40))) + ELSE IF((GE_32(st->total_brate, ACELP_24k40)) && (LE_32(st->total_brate, ACELP_32k)) && (GE_32(st->last_total_brate, ACELP_13k20)) && (LT_32(st->last_total_brate, ACELP_24k40))) { - FOR(i = 0; i < st->L_frame_fx; i++) /* memQuantZeros_fx won't be updated */ + FOR(i = 0; i < st->L_frame; i++) /* memQuantZeros_fx won't be updated */ { hTcxEnc->memQuantZeros_fx[i] = 0; move16(); diff --git a/lib_enc/core_enc_switch_fx.c b/lib_enc/core_enc_switch_fx.c index 22ead67bc..8612f685c 100644 --- a/lib_enc/core_enc_switch_fx.c +++ b/lib_enc/core_enc_switch_fx.c @@ -18,7 +18,7 @@ void core_coder_mode_switch_fx( - Encoder_State_fx *st, + Encoder_State *st, const Word32 last_total_bitrate, const Word16 MCT_flag, const Word16 shift @@ -36,13 +36,13 @@ void core_coder_mode_switch_fx( switchWB = 0; bSwitchFromAmrwbIO = 0; - if ( EQ_16(st->last_core_fx, AMR_WB_CORE)) + if ( EQ_16(st->last_core, AMR_WB_CORE)) { move16(); bSwitchFromAmrwbIO = 1; } - sr_core = getCoreSamplerateMode2(st->element_mode, st->total_brate_fx, st->bwidth_fx, st->flag_ACELP16k, st->rf_mode, st->is_ism_format); + sr_core = getCoreSamplerateMode2(st->element_mode, st->total_brate, st->bwidth, st->flag_ACELP16k, st->rf_mode, st->is_ism_format); move16(); fscale = sr2fscale(sr_core); move16(); @@ -54,9 +54,9 @@ void core_coder_mode_switch_fx( } #ifdef IVAS_CODE_SWITCHING - tcxonly_tmp = getTcxonly(st->element_mode, st->total_brate_fx, MCT_flag, st->is_ism_format); + tcxonly_tmp = getTcxonly(st->element_mode, st->total_brate, MCT_flag, st->is_ism_format); #else - tcxonly_tmp = getTcxonly(st->total_brate_fx); + tcxonly_tmp = getTcxonly(st->total_brate); #endif test(); @@ -70,34 +70,34 @@ void core_coder_mode_switch_fx( test(); IF ( (EQ_16(fscale, st->fscale)) && (bSwitchFromAmrwbIO==0) && (switchWB==0)) { - /*st->total_brate_fx = bitrate; */ + /*st->total_brate = bitrate; */ move32(); st->sr_core = sr_core; move32(); - st->L_frame_fx = extract_l(Mult_32_16(st->sr_core , 0x0290)); - assert(st->L_frame_fx == st->sr_core / 50); + st->L_frame = extract_l(Mult_32_16(st->sr_core , 0x0290)); + assert(st->L_frame == st->sr_core / 50); #ifdef IVAS_CODE_SWITCHING - st->tcxonly = getTcxonly(st->element_mode, st->total_brate_fx, MCT_flag, st->is_ism_format); + st->tcxonly = getTcxonly(st->element_mode, st->total_brate, MCT_flag, st->is_ism_format); #else - st->tcxonly = (Word8)getTcxonly(st->total_brate_fx); + st->tcxonly = (Word8)getTcxonly(st->total_brate); #endif - /* st->bits_frame_nominal = (int)( (float)st->L_frame_fx/(float)st->fscale ) * (float)FSCALE_DENOM/128.0f * (float)st->bitrate/100.0f + 0.49f ; */ - /* st->bits_frame_nominal = extract_l(L_shr(Mpy_32_16_1( L_shl(st->bitrate,8), mult_r(div_s(st->fscale, shl(st->L_frame_fx,4)), FL2WORD16(FSCALE_DENOM/12800.f))), 6)); */ - tmp32 = L_shl(st->total_brate_fx, 1); /* (float)st->L_frame_fx/(float)st->fscale * (float)FSCALE_DENOM/128.0f * (float)st->bitrate */ + /* st->bits_frame_nominal = (int)( (float)st->L_frame/(float)st->fscale ) * (float)FSCALE_DENOM/128.0f * (float)st->bitrate/100.0f + 0.49f ; */ + /* st->bits_frame_nominal = extract_l(L_shr(Mpy_32_16_1( L_shl(st->bitrate,8), mult_r(div_s(st->fscale, shl(st->L_frame,4)), FL2WORD16(FSCALE_DENOM/12800.f))), 6)); */ + tmp32 = L_shl(st->total_brate, 1); /* (float)st->L_frame/(float)st->fscale * (float)FSCALE_DENOM/128.0f * (float)st->bitrate */ st->bits_frame_nominal = extract_l(L_shr(Mpy_32_16_1(tmp32, 20972), 6)); /* 20972 = 0.01 * 64 * 32768 */ - assert(st->bits_frame_nominal == (int)( (float)st->L_frame_fx/(float)st->fscale * (float)FSCALE_DENOM/128.0f * (float)st->total_brate_fx/100.0f + 0.49f )); + assert(st->bits_frame_nominal == (int)( (float)st->L_frame/(float)st->fscale * (float)FSCALE_DENOM/128.0f * (float)st->total_brate/100.0f + 0.49f )); - st->igf = getIgfPresent_fx(st->element_mode, st->total_brate_fx, st->bwidth_fx, st->rf_mode); + st->igf = getIgfPresent_fx(st->element_mode, st->total_brate, st->bwidth, st->rf_mode); /* switch IGF configuration */ IF (st->igf) { - IGFEncSetMode_fx(st->hIGFEnc, st->total_brate_fx, st->bwidth_fx, st->element_mode, st->rf_mode); + IGFEncSetMode_fx(st->hIGFEnc, st->total_brate, st->bwidth, st->element_mode, st->rf_mode); } - st->hTcxCfg->tcx_coded_lines = getNumTcxCodedLines(st->bwidth_fx); + st->hTcxCfg->tcx_coded_lines = getNumTcxCodedLines(st->bwidth); move16(); - st->hTcxCfg->bandwidth = getTcxBandwidth(st->bwidth_fx); + st->hTcxCfg->bandwidth = getTcxBandwidth(st->bwidth); move16(); move16(); st->hTcxCfg->tcxRateLoopOpt = 0; @@ -107,11 +107,11 @@ void core_coder_mode_switch_fx( st->hTcxCfg->tcxRateLoopOpt = 2; } - st->hTcxCfg->ctx_hm = getCtxHm(st->element_mode, st->total_brate_fx, st->rf_mode ); + st->hTcxCfg->ctx_hm = getCtxHm(st->element_mode, st->total_brate, st->rf_mode ); move16(); - st->hTcxCfg->resq = getResq(st->total_brate_fx); + st->hTcxCfg->resq = getResq(st->total_brate); move16(); - hTcxEnc->tcx_lpc_shaped_ari = getTcxLpcShapedAri(st->total_brate_fx, st->rf_mode, st->element_mode); + hTcxEnc->tcx_lpc_shaped_ari = getTcxLpcShapedAri(st->total_brate, st->rf_mode, st->element_mode); test(); if (st->hTcxCfg->resq != 0 && st->tcxonly == 0) @@ -119,10 +119,10 @@ void core_coder_mode_switch_fx( st->hTcxCfg->tcxRateLoopOpt = 1; move16(); } - st->hTcxCfg->fIsTNSAllowed = getTnsAllowed(st->total_brate_fx, st->igf, st->element_mode); + st->hTcxCfg->fIsTNSAllowed = getTnsAllowed(st->total_brate, st->igf, st->element_mode); IF (st->hTcxCfg->fIsTNSAllowed != 0) { - InitTnsConfigs(st->bwidth_fx, st->hTcxCfg->tcx_coded_lines, st->hTcxCfg->tnsConfig, st->hIGFEnc->infoStopFrequency, st->total_brate_fx, st->element_mode, MCT_flag); + InitTnsConfigs(st->bwidth, st->hTcxCfg->tcx_coded_lines, st->hTcxCfg->tnsConfig, st->hIGFEnc->infoStopFrequency, st->total_brate, st->element_mode, MCT_flag); #ifdef IVAS_CODE SetAllowTnsOnWhite(st->hTcxCfg->tnsConfig, EQ_16(st->element_mode, IVAS_CPE_MDCT)); #endif @@ -131,23 +131,23 @@ void core_coder_mode_switch_fx( st->narrowBand = 0; move16(); - if(EQ_16(st->bwidth_fx, NB)) + if(EQ_16(st->bwidth, NB)) { st->narrowBand = 1; move16(); } IF ( st->narrowBand ) { - st->min_band_fx = 1; + st->min_band = 1; move16(); - st->max_band_fx = 16; + st->max_band = 16; move16(); } ELSE { - st->min_band_fx = 0; + st->min_band = 0; move16(); - st->max_band_fx = 19; + st->max_band = 19; move16(); } @@ -166,13 +166,13 @@ void core_coder_mode_switch_fx( } } - st->restrictedMode = getRestrictedMode(st->element_mode, st->total_brate_fx, 0); + st->restrictedMode = getRestrictedMode(st->element_mode, st->total_brate, 0); core_coder_reconfig_fx( st, last_total_bitrate); } ELSE { - st->igf = getIgfPresent_fx(st->element_mode, st->total_brate_fx, st->bwidth_fx, st->rf_mode); + st->igf = getIgfPresent_fx(st->element_mode, st->total_brate, st->bwidth, st->rf_mode); init_coder_ace_plus_fx(st, last_total_bitrate, shift, MCT_flag); } @@ -184,12 +184,12 @@ void core_coder_mode_switch_fx( test(); test(); test(); - IF( (EQ_16(st->bwidth_fx, WB)&&NE_16(st->last_extl_fx,WB_TBE))|| - (EQ_16(st->bwidth_fx, SWB) && NE_16(st->last_extl_fx, SWB_TBE) ) || - (EQ_16(st->bwidth_fx, FB) && NE_16(st->last_extl_fx, FB_TBE) ) ) + IF( (EQ_16(st->bwidth, WB)&&NE_16(st->last_extl,WB_TBE))|| + (EQ_16(st->bwidth, SWB) && NE_16(st->last_extl, SWB_TBE) ) || + (EQ_16(st->bwidth, FB) && NE_16(st->last_extl, FB_TBE) ) ) { /* reset TBE buffers as previous frame wasn't using TBE */ - TBEreset_enc_fx( st, st->bwidth_fx ); + TBEreset_enc_fx( st, st->bwidth ); } ELSE { @@ -212,7 +212,7 @@ void core_coder_mode_switch_fx( st->enablePlcWaveadjust = 0; move16(); - if (GE_32(st->total_brate_fx, HQ_48k)) + if (GE_32(st->total_brate, HQ_48k)) { st->enablePlcWaveadjust = 1; move16(); diff --git a/lib_enc/core_enc_updt_fx.c b/lib_enc/core_enc_updt_fx.c index f1dd62c40..2d83d8e81 100644 --- a/lib_enc/core_enc_updt_fx.c +++ b/lib_enc/core_enc_updt_fx.c @@ -13,7 +13,7 @@ #include "prot_fx_enc.h" /* Function prototypes */ #include "basop_util.h" /* Function prototypes */ -void core_encode_update_fx(Encoder_State_fx *st +void core_encode_update_fx(Encoder_State *st ) { Word16 n; @@ -27,29 +27,29 @@ void core_encode_update_fx(Encoder_State_fx *st n = add(st->encoderPastSamples_enc, st->encoderLookahead_enc); - Copy(st->buf_speech_enc +st->L_frame_fx, st->buf_speech_enc, n); - Copy(st->buf_speech_enc_pe+st->L_frame_fx, st->buf_speech_enc_pe, n); + Copy(st->buf_speech_enc +st->L_frame, st->buf_speech_enc, n); + Copy(st->buf_speech_enc_pe+st->L_frame, st->buf_speech_enc_pe, n); IF(!st->tcxonly) { - n = add(st->L_frame_fx, shr(st->L_frame_fx,2)); - Copy(st->buf_wspeech_enc+st->L_frame_fx, st->buf_wspeech_enc, n); + n = add(st->L_frame, shr(st->L_frame,2)); + Copy(st->buf_wspeech_enc+st->L_frame, st->buf_wspeech_enc, n); } IF (hTcxEnc != NULL) { - IF(EQ_16(st->core_fx, ACELP_CORE) || EQ_32(st->core_brate_fx, SID_2k40) || EQ_32(st->core_brate_fx, FRAME_NO_DATA) || EQ_32(st->core_fx, AMR_WB_CORE)) + IF(EQ_16(st->core, ACELP_CORE) || EQ_32(st->core_brate, SID_2k40) || EQ_32(st->core_brate, FRAME_NO_DATA) || EQ_32(st->core, AMR_WB_CORE)) { - Copy(st->buf_speech_enc + st->L_frame_fx, hTcxEnc->buf_speech_ltp + st->L_frame_fx, st->L_frame_fx); + Copy(st->buf_speech_enc + st->L_frame, hTcxEnc->buf_speech_ltp + st->L_frame, st->L_frame); } } n = add(st->encoderPastSamples_enc, st->encoderLookahead_enc); - Copy(st->buf_synth+st->L_frame_fx, st->buf_synth, add(st->L_frame_fx,L_SUBFR)); + Copy(st->buf_synth+st->L_frame, st->buf_synth, add(st->L_frame,L_SUBFR)); if (hTcxEnc != NULL) { - Copy(hTcxEnc->buf_speech_ltp+st->L_frame_fx, hTcxEnc->buf_speech_ltp, n); + Copy(hTcxEnc->buf_speech_ltp+st->L_frame, hTcxEnc->buf_speech_ltp, n); #ifdef IVAS_CODE IF (NE_16(st->element_mode, IVAS_CPE_MDCT)) @@ -65,13 +65,13 @@ void core_encode_update_fx(Encoder_State_fx *st /* Update previous mode */ //move16(); - //st->last_core_fx = st->core_fx; /* _DIFF_FLOAT_FIX_ not in float -> remove? */ + //st->last_core = st->core; /* _DIFF_FLOAT_FIX_ not in float -> remove? */ test(); test(); test(); - IF( ( st->Opt_DTX_ON_fx && LE_32(st->core_brate_fx,SID_2k40) && EQ_16(st->cng_type_fx,FD_CNG)) || (st->tcxonly && EQ_16(st->codec_mode,MODE2))) + IF( ( st->Opt_DTX_ON && LE_32(st->core_brate,SID_2k40) && EQ_16(st->cng_type,FD_CNG)) || (st->tcxonly && EQ_16(st->codec_mode,MODE2))) { /* reset LP memories */ set16_fx( st->mem_MA_fx,0, M ); @@ -85,7 +85,7 @@ void core_encode_update_fx(Encoder_State_fx *st * Common updates in case of CNG *-------------------------------------------------------------------*/ void core_encode_update_cng_fx( - Encoder_State_fx *st, + Encoder_State *st, Word16 *timeDomainBuffer, Word16 *A, Word16 *Aw, @@ -108,7 +108,7 @@ void core_encode_update_cng_fx( /* LPC -> LSP/lsp */ /* LSP/lsp -> LSF/lsf */ E_LPC_a_lsp_conversion( A, lsp, st->lsp_old_fx, M ); - IF(EQ_16(st->L_frame_fx, L_FRAME16k)) + IF(EQ_16(st->L_frame, L_FRAME16k)) { lsp2lsf_fx( lsp, lsf, M, INT_FS_16k_FX ); } @@ -121,33 +121,33 @@ void core_encode_update_cng_fx( move16(); synth = synth_buf + (1+M); Copy( hLPDmem->syn, synth_buf, 1+M ); - Copy( timeDomainBuffer, synth, st->L_frame_fx ); - Copy( synth+st->L_frame_fx-(1+M), hLPDmem->syn, 1+M ); - Copy( synth, st->synth, st->L_frame_fx ); + Copy( timeDomainBuffer, synth, st->L_frame ); + Copy( synth+st->L_frame-(1+M), hLPDmem->syn, 1+M ); + Copy( synth, st->synth, st->L_frame ); /* Update ZIR */ - set16_fx( synth+st->L_frame_fx, 0, shr(st->L_frame_fx,1) ); - E_UTIL_synthesis(1, A, synth+st->L_frame_fx, synth+st->L_frame_fx, shr(st->L_frame_fx,1), &synth[st->L_frame_fx-M], 0, M ); + set16_fx( synth+st->L_frame, 0, shr(st->L_frame,1) ); + E_UTIL_synthesis(1, A, synth+st->L_frame, synth+st->L_frame, shr(st->L_frame,1), &synth[st->L_frame-M], 0, M ); IF (hTcxEnc != NULL) { - Copy(synth + st->L_frame_fx - (st->L_frame_fx / 2), hTcxEnc->Txnq, shr(st->L_frame_fx, 1)); + Copy(synth + st->L_frame - (st->L_frame / 2), hTcxEnc->Txnq, shr(st->L_frame, 1)); } /* Update pe-synth memory */ move16(); tmp = synth[-(1+M)]; - E_UTIL_f_preemph2( Q_new-1, synth-M, st->preemph_fac, M+st->L_frame_fx, &tmp ); - Copy( synth+st->L_frame_fx-M, hLPDmem->mem_syn, M ); - Copy( synth+st->L_frame_fx-M, hLPDmem->mem_syn2, M ); + E_UTIL_f_preemph2( Q_new-1, synth-M, st->preemph_fac, M+st->L_frame, &tmp ); + Copy( synth+st->L_frame-M, hLPDmem->mem_syn, M ); + Copy( synth+st->L_frame-M, hLPDmem->mem_syn2, M ); /* Update excitation memory */ - Copy( hLPDmem->old_exc+st->L_frame_fx, hLPDmem->old_exc, s_max(L_EXC_MEM-st->L_frame_fx, 0 )); - Residu3_fx( A, synth, hLPDmem->old_exc+s_max(L_EXC_MEM-st->L_frame_fx, 0), st->L_frame_fx, 1 ); + Copy( hLPDmem->old_exc+st->L_frame, hLPDmem->old_exc, s_max(L_EXC_MEM-st->L_frame, 0 )); + Residu3_fx( A, synth, hLPDmem->old_exc+s_max(L_EXC_MEM-st->L_frame, 0), st->L_frame, 1 ); /* Update LP_CNG memory */ - IF( EQ_32(st->core_brate_fx, SID_2k40)) + IF( EQ_32(st->core_brate, SID_2k40)) { /*IVAS_CODE CNG_att is missing */ - enr = cng_energy_fx(st->element_mode, st->bwidth_fx, hDtxEnc->CNG_mode, /*st->hTdCngEnc->CNG_att*/0, hLPDmem->old_exc + s_max(L_EXC_MEM - st->L_frame_fx, 0), st->L_frame_fx, Q_new); + enr = cng_energy_fx(st->element_mode, st->bwidth, hDtxEnc->CNG_mode, /*st->hTdCngEnc->CNG_att*/0, hLPDmem->old_exc + s_max(L_EXC_MEM - st->L_frame, 0), st->L_frame, Q_new); /* calculate the energy quantization index */ enr_index = add(enr, 512 /* Q8(2.0) */); /* enr + 2.0 */ @@ -163,7 +163,7 @@ void core_encode_update_cng_fx( /* Update weighted synthesis memory */ move16(); p_A = Aw; - FOR ( i = 0; i < st->L_frame_fx; i += L_SUBFR ) + FOR ( i = 0; i < st->L_frame; i += L_SUBFR ) { Residu3_fx( p_A, &synth[i], &wsyn[i], L_SUBFR, 0); p_A += (M+1); @@ -172,8 +172,8 @@ void core_encode_update_cng_fx( tmp = sub(st->wspeech_enc[-1],shl(hLPDmem->mem_w0,shift)); - E_UTIL_deemph2( -shift, wsyn, st->preemph_fac, st->L_frame_fx, &tmp ); - hLPDmem->mem_w0 = sub(st->wspeech_enc[st->L_frame_fx-1], tmp); + E_UTIL_deemph2( -shift, wsyn, st->preemph_fac, st->L_frame, &tmp ); + hLPDmem->mem_w0 = sub(st->wspeech_enc[st->L_frame-1], tmp); hLPDmem->mem_w0 =shr(hLPDmem->mem_w0, shift); /* Update LPC-related memories */ @@ -197,7 +197,7 @@ void core_encode_update_cng_fx( /* Update ace/tcx mode */ move16(); - st->core_fx = ACELP_CORE; + st->core = ACELP_CORE; /* Reset TCX overlap */ st->hTcxCfg->tcx_curr_overlap_mode = st->hTcxCfg->tcx_last_overlap_mode = ALDO_WINDOW; diff --git a/lib_enc/core_switching_enc_fx.c b/lib_enc/core_switching_enc_fx.c index cb5455aad..f5876ee33 100644 --- a/lib_enc/core_switching_enc_fx.c +++ b/lib_enc/core_switching_enc_fx.c @@ -20,7 +20,7 @@ *---------------------------------------------------------------------*/ void core_switching_pre_enc_fx( - Encoder_State_fx *st_fx, /* i/o: encoder state structure */ + Encoder_State *st_fx, /* i/o: encoder state structure */ const Word16 *old_inp_12k8, /* i : old input signal @12.8kHz */ const Word16 *old_inp_16k, /* i : old input signal @16kHz */ const Word16 active_cnt, /* i : active frame counter */ @@ -39,8 +39,8 @@ void core_switching_pre_enc_fx( /* Mode switching */ test();test();test(); - IF( EQ_16(st_fx->last_codec_mode,MODE2) || (((EQ_16(st_fx->last_core_fx, TCX_20_CORE) - || EQ_16(st_fx->last_core_fx, TCX_10_CORE)) && GT_16(st_fx->element_mode, EVS_MONO)))) + IF( EQ_16(st_fx->last_codec_mode,MODE2) || (((EQ_16(st_fx->last_core, TCX_20_CORE) + || EQ_16(st_fx->last_core, TCX_10_CORE)) && GT_16(st_fx->element_mode, EVS_MONO)))) { IF (hLPDmem != NULL) { @@ -57,7 +57,7 @@ void core_switching_pre_enc_fx( IF (hBWE_TD != NULL) { - IF(NE_16(st_fx->last_core_fx, ACELP_CORE)) + IF(NE_16(st_fx->last_core, ACELP_CORE)) { /* reset BWE memories */ set16_fx(hBWE_TD->old_bwe_exc_fx, 0, PIT16k_MAX * 2); @@ -67,11 +67,11 @@ void core_switching_pre_enc_fx( set16_fx(hBWE_FD->old_syn_12k8_16k_fx, 0, NS2SA(16000, DELAY_FD_BWE_ENC_NS)); } test(); - IF( EQ_16(st_fx->last_core_fx,TCX_20_CORE)||EQ_16(st_fx->last_core_fx,TCX_10_CORE)) + IF( EQ_16(st_fx->last_core,TCX_20_CORE)||EQ_16(st_fx->last_core,TCX_10_CORE)) { if (EQ_16(st_fx->element_mode, EVS_MONO)) { - st_fx->last_core_fx = HQ_CORE; + st_fx->last_core = HQ_CORE; move16(); } IF (hHQ_core != NULL) @@ -100,11 +100,11 @@ void core_switching_pre_enc_fx( } test(); - IF( (EQ_16(st_fx->L_frame_fx,L_FRAME16k))&&(EQ_16(st_fx->last_L_frame_fx,L_FRAME))) + IF( (EQ_16(st_fx->L_frame,L_FRAME16k))&&(EQ_16(st_fx->last_L_frame,L_FRAME))) { Copy( st_fx->lsp_old_fx, st_fx->lsp_old16k_fx, M ); - st_fx->rate_switching_reset_16kHz = lsp_convert_poly_fx( st_fx->lsp_old16k_fx, st_fx->L_frame_fx, 0 ); + st_fx->rate_switching_reset_16kHz = lsp_convert_poly_fx( st_fx->lsp_old16k_fx, st_fx->L_frame, 0 ); } st_fx->use_acelp_preq = 0; @@ -113,16 +113,16 @@ void core_switching_pre_enc_fx( } test();test();test(); - IF( EQ_16(st_fx->last_core_fx, -1) && ( EQ_16(st_fx->core_fx, HQ_CORE) || EQ_16(st_fx->core_fx, TCX_20_CORE) || EQ_16(st_fx->core_fx, TCX_10_CORE))) + IF( EQ_16(st_fx->last_core, -1) && ( EQ_16(st_fx->core, HQ_CORE) || EQ_16(st_fx->core, TCX_20_CORE) || EQ_16(st_fx->core, TCX_10_CORE))) { /* very first frame is HQ_CORE */ - st_fx->last_core_fx = HQ_CORE; + st_fx->last_core = HQ_CORE; move16(); } test(); test(); - IF( EQ_16(st_fx->core_fx, HQ_CORE)&&(EQ_16(st_fx->last_core_fx,ACELP_CORE)||EQ_16(st_fx->last_core_fx,AMR_WB_CORE))) /* HQ init */ + IF( EQ_16(st_fx->core, HQ_CORE)&&(EQ_16(st_fx->last_core,ACELP_CORE)||EQ_16(st_fx->last_core,AMR_WB_CORE))) /* HQ init */ { set32_fx(hHQ_core->last_ni_gain_fx, 0, BANDS_MAX ); set16_fx(hHQ_core->last_env_fx, 0, BANDS_MAX ); @@ -150,7 +150,7 @@ void core_switching_pre_enc_fx( within ACELP_CORE if switching from another bitarate to vbr, last_ppp and last_nelp is always updated in the previous frame */ test(); test(); - IF( EQ_16(st_fx->core_fx, ACELP_CORE)&&(NE_16(st_fx->last_core_fx,ACELP_CORE)||EQ_16(st_fx->last_codec_mode,MODE2))) + IF( EQ_16(st_fx->core, ACELP_CORE)&&(NE_16(st_fx->last_core,ACELP_CORE)||EQ_16(st_fx->last_codec_mode,MODE2))) { IF (hSC_VBR != NULL) { @@ -166,21 +166,21 @@ void core_switching_pre_enc_fx( test(); test(); test(); - IF( EQ_16(st_fx->core_fx, ACELP_CORE)&&(NE_16(st_fx->last_core_fx,ACELP_CORE)||EQ_16(st_fx->last_codec_mode,MODE2)||LE_32(st_fx->last_total_brate_fx,PPP_NELP_2k80))) + IF( EQ_16(st_fx->core, ACELP_CORE)&&(NE_16(st_fx->last_core,ACELP_CORE)||EQ_16(st_fx->last_codec_mode,MODE2)||LE_32(st_fx->last_total_brate,PPP_NELP_2k80))) { - st_fx->act_count_fx = 3; + st_fx->act_count = 3; move16(); - st_fx->uv_count_fx = 0; + st_fx->uv_count = 0; move16(); } test(); test(); - IF( ( ( EQ_16(st_fx->core_fx, ACELP_CORE)||EQ_16(st_fx->core_fx,AMR_WB_CORE))&&EQ_16(st_fx->last_core_fx,HQ_CORE)) || + IF( ( ( EQ_16(st_fx->core, ACELP_CORE)||EQ_16(st_fx->core,AMR_WB_CORE))&&EQ_16(st_fx->last_core,HQ_CORE)) || ((EQ_16(st_fx->element_mode, IVAS_CPE_DFT) || EQ_16(st_fx->element_mode, IVAS_CPE_TD) || (EQ_16(st_fx->element_mode, IVAS_CPE_MDCT) && EQ_16(last_element_mode, IVAS_CPE_DFT))) && EQ_16(active_cnt, 1))) { - IF(EQ_16(st_fx->L_frame_fx, L_FRAME16k)) + IF(EQ_16(st_fx->L_frame, L_FRAME16k)) { Copy( TRWB2_Ave_fx, st_fx->lsf_old_fx, M ); /* init of LSP */ lsf2lsp_fx( st_fx->lsf_old_fx, st_fx->lsp_old_fx, M, INT_FS_16k ); @@ -213,19 +213,19 @@ void core_switching_pre_enc_fx( move16(); hLPDmem->dm_fx.prev_gain_code = L_deposit_l(0); } - st_fx->Nb_ACELP_frames_fx = 0; + st_fx->Nb_ACELP_frames = 0; move16(); set16_fx( st_fx->mem_MA_fx,0, M ); Copy( GEWB_Ave_fx, st_fx->mem_AR_fx, M ); init_gp_clip_fx( st_fx->clip_var_fx ); - st_fx->last_coder_type_fx = GENERIC; + st_fx->last_coder_type = GENERIC; move16(); tmp16 = add(NB_SUBFR,1); move16(); - if( EQ_16(st_fx->L_frame_fx,L_FRAME)) + if( EQ_16(st_fx->L_frame,L_FRAME)) { tmp16=NB_SUBFR; move16(); @@ -253,10 +253,10 @@ void core_switching_pre_enc_fx( } } test();test();test(); - IF ((EQ_16(st_fx->core_fx, ACELP_CORE) || EQ_16(st_fx->core_fx, AMR_WB_CORE)) && (EQ_16(st_fx->last_core_fx, TCX_20_CORE) || EQ_16(st_fx->last_core_fx, TCX_10_CORE))) + IF ((EQ_16(st_fx->core, ACELP_CORE) || EQ_16(st_fx->core, AMR_WB_CORE)) && (EQ_16(st_fx->last_core, TCX_20_CORE) || EQ_16(st_fx->last_core, TCX_10_CORE))) { /* Reset the ACELP core in case of TCX->ACELP core switching */ - st_fx->Nb_ACELP_frames_fx = 0; move16(); + st_fx->Nb_ACELP_frames = 0; move16(); IF (hLPDmem != NULL) { @@ -273,9 +273,9 @@ void core_switching_pre_enc_fx( hLPDmem->dm_fx.prev_gain_code = L_deposit_l(0); } - st_fx->last_coder_type_fx = GENERIC; move16(); + st_fx->last_coder_type = GENERIC; move16(); - tmp16 = shr(st_fx->L_frame_fx, 6); + tmp16 = shr(st_fx->L_frame, 6); Copy(st_fx->old_pitch_buf_fx + tmp16, st_fx->old_pitch_buf_fx, tmp16); set16_fx(st_fx->old_pitch_buf_fx + tmp16, L_SUBFR, tmp16); @@ -293,10 +293,10 @@ void core_switching_pre_enc_fx( } } test();test();test(); - IF( GE_32(st_fx->input_Fs_fx, 16000)&&NE_16(st_fx->last_extl_fx,WB_BWE)&&EQ_16(st_fx->extl_fx,WB_BWE) && hBWE_FD != NULL) + IF( GE_32(st_fx->input_Fs, 16000)&&NE_16(st_fx->last_extl,WB_BWE)&&EQ_16(st_fx->extl,WB_BWE) && hBWE_FD != NULL) { test(); - IF( NE_16(st_fx->last_extl_fx, SWB_BWE)&&NE_16(st_fx->last_extl_fx,FB_BWE)) + IF( NE_16(st_fx->last_extl, SWB_BWE)&&NE_16(st_fx->last_extl,FB_BWE)) { hBWE_FD->prev_mode = NORMAL; move16(); @@ -309,12 +309,12 @@ void core_switching_pre_enc_fx( } test();test();test();test();test(); - IF( ( GE_32(st_fx->input_Fs_fx, 32000)&&NE_16(st_fx->last_extl_fx,SWB_BWE)&&EQ_16(st_fx->extl_fx,SWB_BWE))|| - ( GE_32(st_fx->input_Fs_fx, 48000) && NE_16(st_fx->last_extl_fx, FB_BWE) && EQ_16(st_fx->extl_fx, FB_BWE) ) ) + IF( ( GE_32(st_fx->input_Fs, 32000)&&NE_16(st_fx->last_extl,SWB_BWE)&&EQ_16(st_fx->extl,SWB_BWE))|| + ( GE_32(st_fx->input_Fs, 48000) && NE_16(st_fx->last_extl, FB_BWE) && EQ_16(st_fx->extl, FB_BWE) ) ) { /* we are switching to SWB BWE - reset SWB BWE buffers */ - IF( EQ_16(st_fx->L_frame_fx, L_FRAME)) + IF( EQ_16(st_fx->L_frame, L_FRAME)) { Sample_Delay_HP = NS2SA( 16000, ACELP_LOOK_NS + DELAY_FD_BWE_ENC_12k8_NS + DELAY_FIR_RESAMPL_NS - DELAY_CLDFB_NS ); Sample_Delay_LP = NS2SA( 12800, ACELP_LOOK_NS + DELAY_FD_BWE_ENC_12k8_NS ); @@ -348,7 +348,7 @@ void core_switching_pre_enc_fx( Copy( &hBWE_TD->old_speech_shb_fx[tmp], hBWE_FD->new_input_hp_fx, Sample_Delay_HP ); add(0,0); - IF (NE_16(st_fx->last_extl_fx,WB_BWE)) + IF (NE_16(st_fx->last_extl,WB_BWE)) { hBWE_FD->prev_mode = NORMAL; move16(); @@ -370,7 +370,7 @@ void core_switching_pre_enc_fx( { IF (st_fx->bwidth_sw_cnt_fx == 0) { - IF (GE_16(st_fx->bwidth_fx, SWB) && EQ_16(st_fx->last_bwidth_fx,WB)) + IF (GE_16(st_fx->bwidth, SWB) && EQ_16(st_fx->last_bwidth,WB)) { st_fx->bwidth_sw_cnt_fx = add(st_fx->bwidth_sw_cnt_fx, 1); } @@ -399,7 +399,7 @@ void core_switching_pre_enc_fx( * Postprocessing for ACELP/HQ core switching *---------------------------------------------------------------------*/ void core_switching_post_enc_fx( - Encoder_State_fx *st_fx, /* i/o: encoder state structure */ + Encoder_State *st_fx, /* i/o: encoder state structure */ const Word16 old_inp_12k8[], /* i : input signal @12.8 kHz Qinp */ const Word16 old_inp_16k[], /* i : input signal @16 kHz Qinp */ const Word16 A[], /* i : unquant. LP filter coefs. (Q12) */ @@ -412,13 +412,13 @@ void core_switching_post_enc_fx( TD_BWE_ENC_HANDLE hBWE_TD = st_fx->hBWE_TD; FD_BWE_ENC_HANDLE hBWE_FD = st_fx->hBWE_FD; - IF( EQ_16(st_fx->core_fx, HQ_CORE)) + IF( EQ_16(st_fx->core, HQ_CORE)) { st_fx->use_acelp_preq = 0; move16(); test();test(); - IF( ( EQ_16(st_fx->last_core_fx, ACELP_CORE)||EQ_16(st_fx->last_core_fx,AMR_WB_CORE)) && EQ_16(st_fx->element_mode, EVS_MONO) ) /* core switching ==> CELP subframe encoding */ + IF( ( EQ_16(st_fx->last_core, ACELP_CORE)||EQ_16(st_fx->last_core,AMR_WB_CORE)) && EQ_16(st_fx->element_mode, EVS_MONO) ) /* core switching ==> CELP subframe encoding */ { acelp_core_switch_enc_fx( st_fx, old_inp_12k8 + L_INP_MEM - NS2SA_fx2(INT_FS_FX, ACELP_LOOK_NS), old_inp_16k + L_INP_MEM - NS2SA_fx2(INT_FS_16k, ACELP_LOOK_NS), A, Qshift, Q_new ); @@ -440,11 +440,11 @@ void core_switching_post_enc_fx( /* reset SWB TBE buffers */ test(); - IF( EQ_16(st_fx->extl_fx, WB_TBE)&&NE_16(st_fx->last_extl_fx,WB_TBE)) + IF( EQ_16(st_fx->extl, WB_TBE)&&NE_16(st_fx->last_extl,WB_TBE)) { wb_tbe_extras_reset_fx(hBWE_TD->mem_genSHBexc_filt_down_wb2_fx, hBWE_TD->mem_genSHBexc_filt_down_wb3_fx ); - IF ( NE_16(st_fx->last_extl_fx, WB_BWE)) + IF ( NE_16(st_fx->last_extl, WB_BWE)) { set16_fx(hBWE_TD->decim_state1_fx, 0, 2*ALLPASSSECTIONS_STEEP+1 ); set16_fx(hBWE_TD->decim_state2_fx, 0, 2*ALLPASSSECTIONS_STEEP+1 ); @@ -457,9 +457,9 @@ void core_switching_post_enc_fx( test();test();test();test(); test();test();test();test();test();test(); - test();IF( (EQ_16(st_fx->extl_fx, SWB_TBE)||EQ_16(st_fx->extl_fx,FB_TBE))&& - ( EQ_16(st_fx->last_core_fx,HQ_CORE) || NE_16(st_fx->L_frame_fx, st_fx->last_L_frame_fx) || - ( NE_16(st_fx->last_extl_fx, SWB_TBE) && NE_16(st_fx->last_extl_fx, FB_TBE) && NE_16(st_fx->last_core_fx, TCX_20_CORE) && NE_16(st_fx->last_core_fx, TCX_10_CORE)) ) + test();IF( (EQ_16(st_fx->extl, SWB_TBE)||EQ_16(st_fx->extl,FB_TBE))&& + ( EQ_16(st_fx->last_core,HQ_CORE) || NE_16(st_fx->L_frame, st_fx->last_L_frame) || + ( NE_16(st_fx->last_extl, SWB_TBE) && NE_16(st_fx->last_extl, FB_TBE) && NE_16(st_fx->last_core, TCX_20_CORE) && NE_16(st_fx->last_core, TCX_10_CORE)) ) ) { set16_fx(hBWE_TD->state_ana_filt_shb_fx, 0, (2*ALLPASSSECTIONS_STEEP+1) ); @@ -483,8 +483,8 @@ void core_switching_post_enc_fx( set16_fx(hBWE_TD->dec_2_over_3_mem_fx,0, 12 ); set16_fx(hBWE_TD->dec_2_over_3_mem_lp_fx,0, 6 ); } - ELSE IF( ( EQ_16(st_fx->extl_fx, SWB_TBE)||EQ_16(st_fx->extl_fx,FB_TBE))&& - ( NE_32(st_fx->last_total_brate_fx, st_fx->total_brate_fx) || NE_16(st_fx->last_bwidth_fx, st_fx->bwidth_fx) || + ELSE IF( ( EQ_16(st_fx->extl, SWB_TBE)||EQ_16(st_fx->extl,FB_TBE))&& + ( NE_32(st_fx->last_total_brate, st_fx->total_brate) || NE_16(st_fx->last_bwidth, st_fx->bwidth) || NE_16(st_fx->last_codec_mode, MODE1) || NE_16(st_fx->rf_mode, st_fx->rf_mode_last) ) ) { set16_fx(hBWE_TD->state_lpc_syn_fx, 0, LPC_SHB_ORDER ); @@ -494,13 +494,13 @@ void core_switching_post_enc_fx( hBWE_TD->gain_prec_swb_fx = 16384; move16(); /*Q14 = 1 */ } - ELSE IF (EQ_16(st_fx->last_core_fx, TCX_20_CORE) || EQ_16(st_fx->last_core_fx, TCX_10_CORE)) + ELSE IF (EQ_16(st_fx->last_core, TCX_20_CORE) || EQ_16(st_fx->last_core, TCX_10_CORE)) { - TBEreset_enc_fx( st_fx, st_fx->bwidth_fx); + TBEreset_enc_fx( st_fx, st_fx->bwidth); } test(); test(); - IF( EQ_16(st_fx->extl_fx, FB_TBE) && ((NE_16(st_fx->last_extl_fx, FB_TBE) && NE_16(st_fx->last_core_fx, TCX_20_CORE) && NE_16(st_fx->last_core_fx, TCX_10_CORE)) || NE_16(st_fx->L_frame_fx, st_fx->last_L_frame_fx))) + IF( EQ_16(st_fx->extl, FB_TBE) && ((NE_16(st_fx->last_extl, FB_TBE) && NE_16(st_fx->last_core, TCX_20_CORE) && NE_16(st_fx->last_core, TCX_10_CORE)) || NE_16(st_fx->L_frame, st_fx->last_L_frame))) { set16_fx(hBWE_TD->fb_state_lpc_syn_fx, 0, LPC_SHB_ORDER ); hBWE_TD->fb_tbe_demph_fx = 0; @@ -528,7 +528,7 @@ void core_switching_post_enc_fx( *---------------------------------------------------------------------*/ void core_switching_hq_prepare_enc_fx( - Encoder_State_fx *st_fx, /* i/o: encoder state structure */ + Encoder_State *st_fx, /* i/o: encoder state structure */ Word16 *num_bits, /* i/o: bit budget update */ const Word16 input_frame, /* i : frame length */ Word32 *wtda_audio, /* shall be q_audio + 15, audio allready scalled in wtda function */ @@ -567,19 +567,19 @@ void core_switching_hq_prepare_enc_fx( } /* set switching frame bitrate */ - IF( EQ_16(st_fx->last_L_frame_fx, L_FRAME)) + IF( EQ_16(st_fx->last_L_frame, L_FRAME)) { - IF( GT_32(st_fx->core_brate_fx, ACELP_24k40)) + IF( GT_32(st_fx->core_brate, ACELP_24k40)) { cbrate = L_add(ACELP_24k40, 0); } ELSE { - cbrate = L_add(st_fx->core_brate_fx, 0); + cbrate = L_add(st_fx->core_brate, 0); } /* subtract ACELP switching frame bits */ - IF( GE_32(st_fx->core_brate_fx, ACELP_11k60)) + IF( GE_32(st_fx->core_brate, ACELP_11k60)) { (*num_bits) = sub((*num_bits), 1); /* LP_FLAG bit */ } @@ -589,21 +589,21 @@ void core_switching_hq_prepare_enc_fx( } ELSE /* L_frame == L_FRAME16k */ { - IF( LE_32(st_fx->core_brate_fx, ACELP_8k00)) + IF( LE_32(st_fx->core_brate, ACELP_8k00)) { cbrate = L_add(ACELP_8k00, 0); } - ELSE IF( LE_32(st_fx->core_brate_fx, ACELP_14k80)) + ELSE IF( LE_32(st_fx->core_brate, ACELP_14k80)) { cbrate = L_add(ACELP_14k80, 0); } ELSE { - cbrate = L_min(st_fx->core_brate_fx, ACELP_22k60); + cbrate = L_min(st_fx->core_brate, ACELP_22k60); } /* subtract ACELP switching frame bits */ - IF( GE_32(st_fx->core_brate_fx, ACELP_11k60)) + IF( GE_32(st_fx->core_brate, ACELP_11k60)) { (*num_bits) = sub((*num_bits), 1); /* LP_FLAG bit */ } @@ -615,7 +615,7 @@ void core_switching_hq_prepare_enc_fx( /* subtract BWE bits */ test(); test(); - IF( !( ( EQ_16(inner_frame_tbl[st_fx->bwidth_fx], L_FRAME16k)&&EQ_16(st_fx->last_L_frame_fx,L_FRAME16k))||EQ_16(inner_frame_tbl[st_fx->bwidth_fx],L_FRAME8k))) + IF( !( ( EQ_16(inner_frame_tbl[st_fx->bwidth], L_FRAME16k)&&EQ_16(st_fx->last_L_frame,L_FRAME16k))||EQ_16(inner_frame_tbl[st_fx->bwidth],L_FRAME8k))) { *num_bits = sub((*num_bits), (NOOFGAINBITS1 + AUDIODELAYBITS)); } diff --git a/lib_enc/decision_matrix_enc_fx.c b/lib_enc/decision_matrix_enc_fx.c index 5ceddcdae..a61b42e70 100644 --- a/lib_enc/decision_matrix_enc_fx.c +++ b/lib_enc/decision_matrix_enc_fx.c @@ -82,18 +82,18 @@ *-----------------------------------------------------------------*/ void decision_matrix_enc_fx( - Encoder_State_fx *st_fx, /* i : encoder state structure */ + Encoder_State *st_fx, /* i : encoder state structure */ Word16 *hq_core_type /* o : HQ core type */ ) { SC_VBR_ENC_HANDLE hSC_VBR = st_fx->hSC_VBR; /* initialization */ - st_fx->core_fx = -1; + st_fx->core = -1; move16(); - st_fx->extl_fx = -1; + st_fx->extl = -1; move16(); - st_fx->extl_brate_fx = 0; + st_fx->extl_brate = 0; move16(); *hq_core_type = -1; move16(); @@ -102,15 +102,15 @@ void decision_matrix_enc_fx( /* SID and FRAME_NO_DATA frames */ test(); test(); - IF( st_fx->Opt_DTX_ON_fx && (EQ_32(st_fx->core_brate_fx,SID_2k40)||EQ_32(st_fx->core_brate_fx,FRAME_NO_DATA))) + IF( st_fx->Opt_DTX_ON && (EQ_32(st_fx->core_brate,SID_2k40)||EQ_32(st_fx->core_brate,FRAME_NO_DATA))) { - st_fx->core_fx = ACELP_CORE; + st_fx->core = ACELP_CORE; move16(); test(); - if( GE_32(st_fx->input_Fs_fx,32000)&&GE_16(st_fx->bwidth_fx,SWB)) + if( GE_32(st_fx->input_Fs,32000)&&GE_16(st_fx->bwidth,SWB)) { - st_fx->extl_fx = SWB_CNG; + st_fx->extl = SWB_CNG; move16(); } @@ -120,17 +120,17 @@ void decision_matrix_enc_fx( return; } - st_fx->core_brate_fx = L_deposit_l(0); + st_fx->core_brate = L_deposit_l(0); /* SC-VBR */ - IF ( st_fx->Opt_SC_VBR_fx ) + IF ( st_fx->Opt_SC_VBR ) { /* SC-VBR */ - st_fx->core_fx = ACELP_CORE; + st_fx->core = ACELP_CORE; move16(); - st_fx->core_brate_fx = ACELP_7k20; + st_fx->core_brate = ACELP_7k20; move32(); - st_fx->total_brate_fx = ACELP_7k20; + st_fx->total_brate = ACELP_7k20; move32(); test(); @@ -139,10 +139,10 @@ void decision_matrix_enc_fx( IF ( EQ_16(hSC_VBR->ppp_mode,1)) { /* PPP mode */ - st_fx->core_brate_fx = PPP_NELP_2k80; + st_fx->core_brate = PPP_NELP_2k80; move16(); } - ELSE IF ( ( ( EQ_16(st_fx->coder_type,UNVOICED)||EQ_16(st_fx->coder_type,TRANSITION))&&st_fx->sp_aud_decision1==0)||NE_16(st_fx->bwidth_fx,NB)) + ELSE IF ( ( ( EQ_16(st_fx->coder_type,UNVOICED)||EQ_16(st_fx->coder_type,TRANSITION))&&st_fx->sp_aud_decision1==0)||NE_16(st_fx->bwidth,NB)) { test(); test(); @@ -156,23 +156,23 @@ void decision_matrix_enc_fx( test(); test(); IF ( EQ_16(st_fx->coder_type,UNVOICED)&&EQ_16(st_fx->vad_flag,1)&& - ( ( GE_16(st_fx->last_bwidth_fx,SWB) && st_fx->last_Opt_SC_VBR_fx == 1 ) || LT_16(st_fx->last_bwidth_fx, SWB) ) && - ( NE_16(st_fx->last_core_fx,HQ_CORE) || NE_16(st_fx->bwidth_fx, NB) ) ) + ( ( GE_16(st_fx->last_bwidth,SWB) && st_fx->last_Opt_SC_VBR == 1 ) || LT_16(st_fx->last_bwidth, SWB) ) && + ( NE_16(st_fx->last_core,HQ_CORE) || NE_16(st_fx->bwidth, NB) ) ) { /* NELP mode */ hSC_VBR->nelp_mode = 1; move16(); - st_fx->core_brate_fx = PPP_NELP_2k80; + st_fx->core_brate = PPP_NELP_2k80; move32(); } ELSE IF ( EQ_16(st_fx->coder_type,TRANSITION)||(EQ_16(st_fx->coder_type,UNVOICED)&&NE_16(hSC_VBR->nelp_mode,1))|| - ( ( EQ_16(st_fx->coder_type,AUDIO) || EQ_16(st_fx->coder_type,INACTIVE) ) && NE_16(st_fx->bwidth_fx, NB) ) ) + ( ( EQ_16(st_fx->coder_type,AUDIO) || EQ_16(st_fx->coder_type,INACTIVE) ) && NE_16(st_fx->bwidth, NB) ) ) { /* silence portions */ - st_fx->core_brate_fx = ACELP_8k00; + st_fx->core_brate = ACELP_8k00; move32(); - st_fx->total_brate_fx = ACELP_8k00; + st_fx->total_brate = ACELP_8k00; move32(); } } @@ -184,15 +184,15 @@ void decision_matrix_enc_fx( * NB *---------------------------------------------------------------------*/ - ELSE IF ( EQ_16(st_fx->bwidth_fx,NB)) + ELSE IF ( EQ_16(st_fx->bwidth,NB)) { - st_fx->core_fx = ACELP_CORE; + st_fx->core = ACELP_CORE; move16(); test(); - if ( GE_32(st_fx->total_brate_fx,HQCORE_NB_MIN_RATE)&&EQ_16(st_fx->sp_aud_decision1,1)) + if ( GE_32(st_fx->total_brate,HQCORE_NB_MIN_RATE)&&EQ_16(st_fx->sp_aud_decision1,1)) { - st_fx->core_fx = HQ_CORE; + st_fx->core = HQ_CORE; move16(); } } @@ -201,17 +201,17 @@ void decision_matrix_enc_fx( * WB *---------------------------------------------------------------------*/ - ELSE IF ( EQ_16(st_fx->bwidth_fx,WB)) + ELSE IF ( EQ_16(st_fx->bwidth,WB)) { - st_fx->core_fx = ACELP_CORE; + st_fx->core = ACELP_CORE; move16(); test(); test(); - IF ( ( GE_32(st_fx->total_brate_fx,HQCORE_WB_MIN_RATE)&&EQ_16(st_fx->sp_aud_decision1,1))|| - GE_32(st_fx->total_brate_fx,HQ_96k) ) + IF ( ( GE_32(st_fx->total_brate,HQCORE_WB_MIN_RATE)&&EQ_16(st_fx->sp_aud_decision1,1))|| + GE_32(st_fx->total_brate,HQ_96k) ) { - st_fx->core_fx = HQ_CORE; + st_fx->core = HQ_CORE; move16(); } ELSE @@ -220,12 +220,12 @@ void decision_matrix_enc_fx( test(); test(); test(); - IF ( EQ_16(st_fx->bwidth_fx,WB)&<_32(st_fx->total_brate_fx,ACELP_9k60)) + IF ( EQ_16(st_fx->bwidth,WB)&<_32(st_fx->total_brate,ACELP_9k60)) { - st_fx->extl_fx = WB_BWE; + st_fx->extl = WB_BWE; move16(); } - ELSE IF ( EQ_16(st_fx->bwidth_fx,WB)&&GE_32(st_fx->total_brate_fx,ACELP_9k60)&&LE_32(st_fx->total_brate_fx,ACELP_16k40)) + ELSE IF ( EQ_16(st_fx->bwidth,WB)&&GE_32(st_fx->total_brate,ACELP_9k60)&&LE_32(st_fx->total_brate,ACELP_16k40)) { /* Note: WB BWE is used exceptionally at 13.2 kbps if GSC is selected instead of LR-MDCT */ test(); @@ -233,16 +233,16 @@ void decision_matrix_enc_fx( test(); IF ( EQ_16(st_fx->sp_aud_decision1,1)||EQ_16(st_fx->coder_type,INACTIVE)||(st_fx->sp_aud_decision1==0&&EQ_16(st_fx->sp_aud_decision2,1))) { - st_fx->extl_fx = WB_BWE; + st_fx->extl = WB_BWE; move16(); - st_fx->extl_brate_fx = WB_BWE_0k35; + st_fx->extl_brate = WB_BWE_0k35; move32(); } ELSE { - st_fx->extl_fx = WB_TBE; + st_fx->extl = WB_TBE; move16(); - st_fx->extl_brate_fx = WB_TBE_1k05; + st_fx->extl_brate = WB_TBE_1k05; move32(); } } @@ -253,24 +253,24 @@ void decision_matrix_enc_fx( * SWB and FB *---------------------------------------------------------------------*/ - ELSE IF ( EQ_16(st_fx->bwidth_fx,SWB)||EQ_16(st_fx->bwidth_fx,FB)) + ELSE IF ( EQ_16(st_fx->bwidth,SWB)||EQ_16(st_fx->bwidth,FB)) { test(); test(); - IF ( ( GE_32(st_fx->total_brate_fx,HQCORE_SWB_MIN_RATE)&&EQ_16(st_fx->sp_aud_decision1,1))|| - GE_32(st_fx->total_brate_fx,HQ_96k) ) + IF ( ( GE_32(st_fx->total_brate,HQCORE_SWB_MIN_RATE)&&EQ_16(st_fx->sp_aud_decision1,1))|| + GE_32(st_fx->total_brate,HQ_96k) ) { - st_fx->core_fx = HQ_CORE; + st_fx->core = HQ_CORE; move16(); } ELSE { - st_fx->core_fx = ACELP_CORE; + st_fx->core = ACELP_CORE; move16(); test(); test(); - IF ( GE_32(st_fx->total_brate_fx,ACELP_13k20)&<_32(st_fx->total_brate_fx,ACELP_48k)) + IF ( GE_32(st_fx->total_brate,ACELP_13k20)&<_32(st_fx->total_brate,ACELP_48k)) { /* Note: SWB BWE is not used in case of GSC noisy speech */ /* Note: SWB BWE is used exceptionally at 13.2 kbps if GSC is selected instead of LR-MDCT */ @@ -278,56 +278,56 @@ void decision_matrix_enc_fx( test(); test(); test(); - IF ( (EQ_16(st_fx->sp_aud_decision1,1)||EQ_16(st_fx->coder_type,INACTIVE)||(st_fx->sp_aud_decision1==0&&EQ_16(st_fx->sp_aud_decision2,1)))&&st_fx->GSC_noisy_speech_fx==0) + IF ( (EQ_16(st_fx->sp_aud_decision1,1)||EQ_16(st_fx->coder_type,INACTIVE)||(st_fx->sp_aud_decision1==0&&EQ_16(st_fx->sp_aud_decision2,1)))&&st_fx->GSC_noisy_speech==0) { - st_fx->extl_fx = SWB_BWE; + st_fx->extl = SWB_BWE; move16(); - st_fx->extl_brate_fx = SWB_BWE_1k6; + st_fx->extl_brate = SWB_BWE_1k6; move32(); test(); - IF ( EQ_16(st_fx->bwidth_fx,FB)&&GE_32(st_fx->total_brate_fx,ACELP_24k40)) + IF ( EQ_16(st_fx->bwidth,FB)&&GE_32(st_fx->total_brate,ACELP_24k40)) { - st_fx->extl_fx = FB_BWE; + st_fx->extl = FB_BWE; move16(); - st_fx->extl_brate_fx = FB_BWE_1k8; + st_fx->extl_brate = FB_BWE_1k8; move32(); } } ELSE { - st_fx->extl_fx = SWB_TBE; + st_fx->extl = SWB_TBE; move16(); - st_fx->extl_brate_fx = SWB_TBE_1k6; + st_fx->extl_brate = SWB_TBE_1k6; move32(); - if( GE_32(st_fx->total_brate_fx,ACELP_24k40)) + if( GE_32(st_fx->total_brate,ACELP_24k40)) { - st_fx->extl_brate_fx = SWB_TBE_2k8; + st_fx->extl_brate = SWB_TBE_2k8; move32(); } test(); - IF ( EQ_16(st_fx->bwidth_fx,FB)&&GE_32(st_fx->total_brate_fx,ACELP_24k40)) + IF ( EQ_16(st_fx->bwidth,FB)&&GE_32(st_fx->total_brate,ACELP_24k40)) { - st_fx->extl_fx = FB_TBE; + st_fx->extl = FB_TBE; move16(); { - st_fx->extl_brate_fx = FB_TBE_3k0; + st_fx->extl_brate = FB_TBE_3k0; move32(); } } } } - ELSE IF ( GE_32(st_fx->total_brate_fx,ACELP_48k)) + ELSE IF ( GE_32(st_fx->total_brate,ACELP_48k)) { - st_fx->extl_fx = SWB_BWE_HIGHRATE; + st_fx->extl = SWB_BWE_HIGHRATE; move16(); - st_fx->extl_brate_fx = SWB_BWE_16k; + st_fx->extl_brate = SWB_BWE_16k; move32(); - if( EQ_16(st_fx->bwidth_fx,FB)) + if( EQ_16(st_fx->bwidth,FB)) { - st_fx->extl_fx = FB_BWE_HIGHRATE; + st_fx->extl = FB_BWE_HIGHRATE; move32(); } } @@ -338,20 +338,20 @@ void decision_matrix_enc_fx( * Set HQ core type *-----------------------------------------------------------------*/ - IF( EQ_16(st_fx->core_fx,HQ_CORE)) + IF( EQ_16(st_fx->core,HQ_CORE)) { *hq_core_type = NORMAL_HQ_CORE; move16(); test(); test(); - IF( (EQ_16(st_fx->bwidth_fx,SWB)||EQ_16(st_fx->bwidth_fx,WB))&&LE_32(st_fx->total_brate_fx,LRMDCT_CROSSOVER_POINT)) + IF( (EQ_16(st_fx->bwidth,SWB)||EQ_16(st_fx->bwidth,WB))&&LE_32(st_fx->total_brate,LRMDCT_CROSSOVER_POINT)) { /* note that FB (bitrate >= 24400 bps) is always coded with NORMAL_HQ_CORE */ *hq_core_type = LOW_RATE_HQ_CORE; move16(); } - ELSE IF( EQ_16(st_fx->bwidth_fx,NB)) + ELSE IF( EQ_16(st_fx->bwidth,NB)) { *hq_core_type = LOW_RATE_HQ_CORE; move16(); @@ -359,16 +359,16 @@ void decision_matrix_enc_fx( } /* set core bitrate */ - st_fx->core_brate_fx = L_sub(st_fx->total_brate_fx, st_fx->extl_brate_fx); + st_fx->core_brate = L_sub(st_fx->total_brate, st_fx->extl_brate); - IF ( st_fx->ini_frame_fx == 0 ) + IF ( st_fx->ini_frame == 0 ) { /* avoid switching in the very first frame */ - st_fx->last_core_fx = st_fx->core_fx; + st_fx->last_core = st_fx->core; move16(); - st_fx->last_core_brate_fx = st_fx->core_brate_fx; + st_fx->last_core_brate = st_fx->core_brate; move32(); - st_fx->last_extl_fx = st_fx->extl_fx; + st_fx->last_extl = st_fx->extl; move16(); } @@ -382,7 +382,7 @@ void decision_matrix_enc_fx( *---------------------------------------------------------------------*/ Word16 signalling_mode1_tcx20_enc( - Encoder_State_fx *st, /* i : encoder state structure */ + Encoder_State *st, /* i : encoder state structure */ Word16 push ) { @@ -391,18 +391,18 @@ Word16 signalling_mode1_tcx20_enc( BSTR_ENC_HANDLE hBstr; hBstr = st->hBstr; - assert(st->core_fx == TCX_20_CORE); + assert(st->core == TCX_20_CORE); num_bits = 0; move16(); /* Use ACELP signaling for LR MDCT */ - IF ( LE_32(st->total_brate_fx, ACELP_16k40)) + IF ( LE_32(st->total_brate, ACELP_16k40)) { /* find the section in the ACELP signalling table corresponding to bitrate */ idx = 0; move16(); - WHILE ( NE_32(acelp_sig_tbl[idx], st->total_brate_fx)) + WHILE ( NE_32(acelp_sig_tbl[idx], st->total_brate)) { idx = add(idx, 1); } @@ -415,7 +415,7 @@ Word16 signalling_mode1_tcx20_enc( idx = add(idx, 1); start_idx = idx; move16(); - WHILE ( NE_32(acelp_sig_tbl[idx], SIG2IND_fx(LR_MDCT, st->bwidth_fx, 0, 0))) + WHILE ( NE_32(acelp_sig_tbl[idx], SIG2IND_fx(LR_MDCT, st->bwidth, 0, 0))) { idx = add(idx, 1); } @@ -435,7 +435,7 @@ Word16 signalling_mode1_tcx20_enc( } ELSE { - IF ( LE_32(st->core_brate_fx, ACELP_64k)) + IF ( LE_32(st->core_brate, ACELP_64k)) { /* write ACELP/HQ core indication flag */ num_bits = add(num_bits, 1); @@ -456,15 +456,15 @@ Word16 signalling_mode1_tcx20_enc( IF (push != 0) { /* write band-width (needed for different I/O sampling rate support) */ - IF ( EQ_16(st->bwidth_fx, NB)) + IF ( EQ_16(st->bwidth, NB)) { push_indice_fx(hBstr, IND_HQ_BWIDTH, 0, 2 ); } - ELSE IF ( EQ_16(st->bwidth_fx, WB)) + ELSE IF ( EQ_16(st->bwidth, WB)) { push_indice_fx(hBstr, IND_HQ_BWIDTH, 1, 2 ); } - ELSE IF ( EQ_16(st->bwidth_fx, SWB)) + ELSE IF ( EQ_16(st->bwidth, SWB)) { push_indice_fx(hBstr, IND_HQ_BWIDTH, 2, 2 ); } @@ -485,7 +485,7 @@ Word16 signalling_mode1_tcx20_enc( *---------------------------------------------------------------------*/ void signalling_enc_fx( - Encoder_State_fx *st_fx /* i : encoder state structure */ + Encoder_State *st_fx /* i : encoder state structure */ ) { Word16 nBits, idx, start_idx; @@ -499,19 +499,19 @@ void signalling_enc_fx( { assert(!st_fx->tcxonly); - assert(st_fx->core_fx == HQ_CORE); + assert(st_fx->core == HQ_CORE); push_next_indice_fx(hBstr, 1, 1); /* TCX */ push_next_indice_fx(hBstr, 1, 1); /* HQ_CORE */ /* write ACELP->HQ core switching flag */ test(); - IF ( EQ_16(st_fx->last_core_fx, ACELP_CORE)||EQ_16(st_fx->last_core_fx,AMR_WB_CORE)) + IF ( EQ_16(st_fx->last_core, ACELP_CORE)||EQ_16(st_fx->last_core,AMR_WB_CORE)) { push_indice_fx(hBstr, IND_HQ_SWITCHING_FLG, 1, 1 ); /* write ACELP L_frame info */ - IF( EQ_16(st_fx->last_L_frame_fx, L_FRAME)) + IF( EQ_16(st_fx->last_L_frame, L_FRAME)) { push_indice_fx(hBstr, IND_LAST_L_FRAME, 0, 1 ); } @@ -527,14 +527,14 @@ void signalling_enc_fx( return; } - IF( EQ_16(st_fx->core_fx,ACELP_CORE )) + IF( EQ_16(st_fx->core,ACELP_CORE )) { Word16 ppp_mode, nelp_mode, sig; ppp_mode = 0; nelp_mode = 0; move16(); move16(); - IF(st_fx->Opt_SC_VBR_fx) + IF(st_fx->Opt_SC_VBR) { ppp_mode = hSC_VBR->ppp_mode; nelp_mode = hSC_VBR->nelp_mode; @@ -549,27 +549,27 @@ void signalling_enc_fx( push_indice_fx(hBstr, IND_CORE, 0, 1 ); /* SC-VBR: 0 - PPP_NB, 1 - PPP_WB, 2 - NELP_NB, 3 - NELP_WB */ test();test();test();test();test();test();test();test(); - IF ( EQ_16(st_fx->coder_type,VOICED)&&EQ_16(st_fx->bwidth_fx,NB)&&EQ_16(ppp_mode,1)) + IF ( EQ_16(st_fx->coder_type,VOICED)&&EQ_16(st_fx->bwidth,NB)&&EQ_16(ppp_mode,1)) { push_indice_fx(hBstr, IND_PPP_NELP_MODE, 0, 2 ); } - ELSE IF ( EQ_16(st_fx->coder_type,VOICED)&&NE_16(st_fx->bwidth_fx,NB)&&EQ_16(ppp_mode,1)) + ELSE IF ( EQ_16(st_fx->coder_type,VOICED)&&NE_16(st_fx->bwidth,NB)&&EQ_16(ppp_mode,1)) { push_indice_fx(hBstr, IND_PPP_NELP_MODE, 1, 2 ); } - ELSE IF ( EQ_16(st_fx->coder_type,UNVOICED)&&EQ_16(st_fx->bwidth_fx,NB)&&EQ_16(nelp_mode,1)) + ELSE IF ( EQ_16(st_fx->coder_type,UNVOICED)&&EQ_16(st_fx->bwidth,NB)&&EQ_16(nelp_mode,1)) { push_indice_fx(hBstr, IND_PPP_NELP_MODE, 2, 2); } - ELSE IF ( EQ_16(st_fx->coder_type,UNVOICED)&&NE_16(st_fx->bwidth_fx,NB)&&EQ_16(nelp_mode,1)) + ELSE IF ( EQ_16(st_fx->coder_type,UNVOICED)&&NE_16(st_fx->bwidth,NB)&&EQ_16(nelp_mode,1)) { push_indice_fx(hBstr, IND_PPP_NELP_MODE, 3, 2 ); } } - ELSE IF( NE_32(st_fx->core_brate_fx,SID_2k40)&&NE_32(st_fx->core_brate_fx,FRAME_NO_DATA)) + ELSE IF( NE_32(st_fx->core_brate,SID_2k40)&&NE_32(st_fx->core_brate,FRAME_NO_DATA)) { /* write the ACELP/HQ core selection bit */ - IF (GE_32(st_fx->total_brate_fx,ACELP_24k40)) + IF (GE_32(st_fx->total_brate,ACELP_24k40)) { push_indice_fx(hBstr, IND_CORE, 0, 1 ); } @@ -579,7 +579,7 @@ void signalling_enc_fx( move16(); WHILE (LT_16(idx, MAX_ACELP_SIG)) { - IF (LE_32(st_fx->total_brate_fx, brate_tbl[idx])) + IF (LE_32(st_fx->total_brate, brate_tbl[idx])) { BREAK; } @@ -602,19 +602,19 @@ void signalling_enc_fx( /* retrieve the signalling index */ #if 0 start_idx = ++idx; - k = SIG2IND_fx(st_fx->coder_type, st_fx->bwidth_fx, st_fx->sharpFlag, st_fx->rf_mode); + k = SIG2IND_fx(st_fx->coder_type, st_fx->bwidth, st_fx->sharpFlag, st_fx->rf_mode); WHILE( NE_32(acelp_sig_tbl[idx], k)) #else start_idx = ++idx; move16(); - IF (EQ_16(st_fx->element_mode, IVAS_CPE_TD) && EQ_16(st_fx->bwidth_fx, SWB) && LE_32(st_fx->total_brate_fx, ACELP_9k60)) + IF (EQ_16(st_fx->element_mode, IVAS_CPE_TD) && EQ_16(st_fx->bwidth, SWB) && LE_32(st_fx->total_brate, ACELP_9k60)) { /* patch to signal SWB as NB in Stereo */ sig = (Word16)SIG2IND(st_fx->coder_type, NB, st_fx->sharpFlag, st_fx->rf_mode); } ELSE { - sig = (Word16)SIG2IND(st_fx->coder_type, st_fx->bwidth_fx, st_fx->sharpFlag, st_fx->rf_mode); + sig = (Word16)SIG2IND(st_fx->coder_type, st_fx->bwidth, st_fx->sharpFlag, st_fx->rf_mode); } WHILE (NE_16((Word16)acelp_sig_tbl[idx] , sig)) @@ -627,17 +627,17 @@ void signalling_enc_fx( } /* write extension layer flag to distinguish between TBE (0) and BWE (1) */ - IF( st_fx->extl_brate_fx > 0 ) + IF( st_fx->extl_brate > 0 ) { test(); test(); test(); test(); - IF( EQ_16(st_fx->extl_fx,WB_TBE)||EQ_16(st_fx->extl_fx,SWB_TBE)||EQ_16(st_fx->extl_fx,FB_TBE)) + IF( EQ_16(st_fx->extl,WB_TBE)||EQ_16(st_fx->extl,SWB_TBE)||EQ_16(st_fx->extl,FB_TBE)) { push_indice_fx(hBstr, IND_BWE_FLAG, 0, 1 ); } - ELSE IF( EQ_16(st_fx->extl_fx,WB_BWE)||EQ_16(st_fx->extl_fx,SWB_BWE)||EQ_16(st_fx->extl_fx,FB_BWE)) + ELSE IF( EQ_16(st_fx->extl,WB_BWE)||EQ_16(st_fx->extl,SWB_BWE)||EQ_16(st_fx->extl,FB_BWE)) { push_indice_fx(hBstr, IND_BWE_FLAG, 1, 1 ); } @@ -647,11 +647,11 @@ void signalling_enc_fx( { /* write ACELP->HQ switching frame flag */ test(); - IF( EQ_16(st_fx->last_core_fx,ACELP_CORE)||EQ_16(st_fx->last_core_fx,AMR_WB_CORE)) + IF( EQ_16(st_fx->last_core,ACELP_CORE)||EQ_16(st_fx->last_core,AMR_WB_CORE)) { push_indice_fx(hBstr, IND_HQ_SWITCHING_FLG, 1, 1 ); /* write ACELP L_frame info */ - IF( EQ_16(st_fx->last_L_frame_fx, L_FRAME)) + IF( EQ_16(st_fx->last_L_frame, L_FRAME)) { push_indice_fx(hBstr, IND_LAST_L_FRAME, 0, 1 ); } @@ -669,11 +669,11 @@ void signalling_enc_fx( push_indice_fx(hBstr, IND_MDCT_CORE, 0, 1 ); /* Use ACELP signaling for LR MDCT */ - IF ( LE_32(st_fx->total_brate_fx,ACELP_16k40)) + IF ( LE_32(st_fx->total_brate,ACELP_16k40)) { /* find the section in the ACELP signalling table corresponding to bitrate */ idx = 0; - WHILE ( NE_32(acelp_sig_tbl[idx],st_fx->total_brate_fx)) + WHILE ( NE_32(acelp_sig_tbl[idx],st_fx->total_brate)) { idx++; } @@ -684,7 +684,7 @@ void signalling_enc_fx( /* retrieve the signalling index */ start_idx = ++idx; move16(); - k = SIG2IND_fx(LR_MDCT, st_fx->bwidth_fx, 0, 0); + k = SIG2IND_fx(LR_MDCT, st_fx->bwidth, 0, 0); WHILE( NE_32(acelp_sig_tbl[idx], k)) { idx++; @@ -695,26 +695,26 @@ void signalling_enc_fx( ELSE { - IF( LE_32(st_fx->core_brate_fx,ACELP_64k)) + IF( LE_32(st_fx->core_brate,ACELP_64k)) { /* write ACELP/HQ core indication flag */ push_indice_fx(hBstr, IND_CORE, 1, 1 ); } /* write band-width (needed for different I/O sampling rate support) */ - IF( EQ_16(st_fx->bwidth_fx,NB)) + IF( EQ_16(st_fx->bwidth,NB)) { push_indice_fx(hBstr, IND_HQ_BWIDTH, 0, 2 ); } - ELSE IF( EQ_16(st_fx->bwidth_fx,WB)) + ELSE IF( EQ_16(st_fx->bwidth,WB)) { push_indice_fx(hBstr, IND_HQ_BWIDTH, 1, 2 ); } - ELSE IF( EQ_16(st_fx->bwidth_fx,SWB)) + ELSE IF( EQ_16(st_fx->bwidth,SWB)) { push_indice_fx(hBstr, IND_HQ_BWIDTH, 2, 2 ); } - ELSE /* st_fx->bwidth_fx == FB */ + ELSE /* st_fx->bwidth == FB */ { push_indice_fx(hBstr, IND_HQ_BWIDTH, 3, 2 ); } @@ -731,7 +731,7 @@ void signalling_enc_fx( *---------------------------------------------------------------------*/ void signalling_enc_rf( - Encoder_State_fx *st /* i : encoder state structure */ + Encoder_State *st /* i : encoder state structure */ ) { Word16 i; diff --git a/lib_enc/detect_transient_fx.c b/lib_enc/detect_transient_fx.c index 47c0de708..af511b76d 100644 --- a/lib_enc/detect_transient_fx.c +++ b/lib_enc/detect_transient_fx.c @@ -115,7 +115,7 @@ Word16 detect_transient_fx( const Word16 *in_fx, /*Q_new */ const Word16 L, Word16 Q_new, - Encoder_State_fx *st_fx + Encoder_State *st_fx ) { Word32 Energy, L_tmp; @@ -140,9 +140,9 @@ Word16 detect_transient_fx( IsTransient = 0; move16(); - IF(NE_16(st_fx->last_extl_fx, st_fx->extl_fx)) + IF(NE_16(st_fx->last_extl, st_fx->extl)) { - st_fx->TransientHangOver_fx = 0; + st_fx->TransientHangOver = 0; move16(); st_fx->old_hpfilt_in_fx = 0; move16(); @@ -157,7 +157,7 @@ Word16 detect_transient_fx( test(); test(); test(); - IF(NE_16(st_fx->last_extl_fx, st_fx->extl_fx) || (EQ_16(st_fx->last_extl_fx, st_fx->extl_fx) && NE_16(st_fx->last_core_fx, st_fx->core_fx)) || EQ_16(st_fx->last_codec_mode, MODE2)) + IF(NE_16(st_fx->last_extl, st_fx->extl) || (EQ_16(st_fx->last_extl, st_fx->extl) && NE_16(st_fx->last_core, st_fx->core)) || EQ_16(st_fx->last_codec_mode, MODE2)) { /*EnergyLT = EPSILON_FX; */ EnergyLT = L_deposit_l(0); @@ -269,13 +269,13 @@ Word16 detect_transient_fx( Energy = L_add(L_shr(L_tmp, shift), L_shr(L_tmp2, shift)); #endif test(); - IF(EQ_16(st_fx->extl_fx,SWB_BWE) || EQ_16(st_fx->extl_fx,FB_BWE)) + IF(EQ_16(st_fx->extl,SWB_BWE) || EQ_16(st_fx->extl,FB_BWE)) { /*Calculate shift to get to Q0*/ test(); test(); IF((GT_32(Mult_32_16(Energy, shl(2427, shift)), EnergyLT)) || (GT_32(Mult_32_16(Energy,shl(3277,shift)),EnergyLT) - && EQ_16(st_fx->core_fx,ACELP_CORE) && EQ_16(st_fx->coder_type,INACTIVE))) + && EQ_16(st_fx->core,ACELP_CORE) && EQ_16(st_fx->coder_type,INACTIVE))) { IsTransient = 1; move16(); @@ -286,7 +286,7 @@ Word16 detect_transient_fx( ELSE { test(); - IF(LE_32(st_fx->total_brate_fx,HQ_16k40) && EQ_16(st_fx->bwidth_fx,SWB)) + IF(LE_32(st_fx->total_brate,HQ_16k40) && EQ_16(st_fx->bwidth,SWB)) { thr = 2427; move16(); @@ -324,8 +324,8 @@ Word16 detect_transient_fx( test(); test(); test(); - if ((NE_16(st_fx->last_extl_fx, SWB_BWE) && NE_16(st_fx->last_extl_fx, SWB_TBE) && EQ_16(st_fx->extl_fx, SWB_BWE)) || - (NE_16(st_fx->last_extl_fx, FB_BWE) && NE_16(st_fx->last_extl_fx, FB_TBE) && EQ_16(st_fx->extl_fx, FB_BWE))) + if ((NE_16(st_fx->last_extl, SWB_BWE) && NE_16(st_fx->last_extl, SWB_TBE) && EQ_16(st_fx->extl, SWB_BWE)) || + (NE_16(st_fx->last_extl, FB_BWE) && NE_16(st_fx->last_extl, FB_TBE) && EQ_16(st_fx->extl, FB_BWE))) { IsTransient = 0; move16(); @@ -374,12 +374,12 @@ Word16 detect_transient_fx( move16(); } } - IF(EQ_32(st_fx->core_brate_fx, ACELP_24k40)) + IF(EQ_32(st_fx->core_brate, ACELP_24k40)) { test(); - IF(NE_16(st_fx->last_core_fx, HQ_CORE) || NE_32(st_fx->last_core_brate_fx, ACELP_24k40)) + IF(NE_16(st_fx->last_core, HQ_CORE) || NE_32(st_fx->last_core_brate, ACELP_24k40)) { - st_fx->TransientHangOver_fx = 0; + st_fx->TransientHangOver = 0; move16(); IsTransient = 0; move16(); @@ -391,15 +391,15 @@ Word16 detect_transient_fx( IF(EQ_16(position,3)) { /* Set Hangover */ - st_fx->TransientHangOver_fx = 1; + st_fx->TransientHangOver = 1; move16(); } } ELSE { - IF(st_fx->TransientHangOver_fx) + IF(st_fx->TransientHangOver) { - st_fx->TransientHangOver_fx = 0; + st_fx->TransientHangOver = 0; move16(); IsTransient = 1; move16(); @@ -411,14 +411,14 @@ Word16 detect_transient_fx( { IF(IsTransient) { - st_fx->TransientHangOver_fx = 1; + st_fx->TransientHangOver = 1; move16(); } ELSE { - IF(st_fx->TransientHangOver_fx) + IF(st_fx->TransientHangOver) { - st_fx->TransientHangOver_fx = 0; + st_fx->TransientHangOver = 0; move16(); IsTransient = 1; move16(); diff --git a/lib_enc/dtx_fx.c b/lib_enc/dtx_fx.c index e852f3faf..1fb6f1feb 100644 --- a/lib_enc/dtx_fx.c +++ b/lib_enc/dtx_fx.c @@ -66,7 +66,7 @@ static void update_SID_cnt(DTX_ENC_HANDLE hDtxEnc, const Word32 core_brate, cons /* _ None */ /*==================================================================================*/ void dtx_fx( - Encoder_State_fx *st_fx, /* i/o: encoder state structure */ + Encoder_State *st_fx, /* i/o: encoder state structure */ const Word16 vad, /* i : vad flag for DTX */ const Word16 speech[], /* i : Pointer to the speech frame */ Word16 Q_speech /* i : Q factor for speech */ @@ -97,67 +97,67 @@ void dtx_fx( ELSE { /* _DIFF_FLOAT_FIX_ : lp_noise_fx threshold is different between float (15) and fix (5*256) */ - last_br_cng_flag = LE_32(st_fx->last_total_brate_cng_fx, ACELP_24k40) || LT_16(st_fx->lp_noise_fx, LP_NOISE_LV *256) || (EQ_16(st_fx->element_mode, IVAS_SCE) && LE_32(st_fx->last_total_brate_cng_fx, ACELP_32k)); + last_br_cng_flag = LE_32(st_fx->last_total_brate_cng, ACELP_24k40) || LT_16(st_fx->lp_noise_fx, LP_NOISE_LV *256) || (EQ_16(st_fx->element_mode, IVAS_SCE) && LE_32(st_fx->last_total_brate_cng, ACELP_32k)); - last_br_flag = LE_32(st_fx->last_total_brate_fx, ACELP_24k40) || LT_16(st_fx->lp_noise_fx, LP_NOISE_LV * 256) || (EQ_16(st_fx->element_mode, IVAS_SCE) && LE_32(st_fx->last_total_brate_fx, ACELP_32k)); + last_br_flag = LE_32(st_fx->last_total_brate, ACELP_24k40) || LT_16(st_fx->lp_noise_fx, LP_NOISE_LV * 256) || (EQ_16(st_fx->element_mode, IVAS_SCE) && LE_32(st_fx->last_total_brate, ACELP_32k)); br_dtx_flag = 0; move16(); } /* Initialization */ - IF( st_fx->ini_frame_fx == 0 ) + IF( st_fx->ini_frame == 0 ) { st_fx->active_fr_cnt_fx = CNG_TYPE_HO; move16(); - st_fx->cng_type_fx = FD_CNG; + st_fx->cng_type = FD_CNG; move16(); test(); - if( (EQ_16( st_fx->codec_mode, MODE1 )||st_fx->Opt_AMR_WB_fx) && EQ_16(st_fx->element_mode, IVAS_SCE) && EQ_16(st_fx->element_mode, IVAS_CPE_MDCT)) + if( (EQ_16( st_fx->codec_mode, MODE1 )||st_fx->Opt_AMR_WB) && EQ_16(st_fx->element_mode, IVAS_SCE) && EQ_16(st_fx->element_mode, IVAS_CPE_MDCT)) { - st_fx->cng_type_fx = LP_CNG; + st_fx->cng_type = LP_CNG; move16(); } } test(); test(); - IF( st_fx->Opt_DTX_ON_fx && vad == 0 && - GT_16(st_fx->ini_frame_fx,2) && /* CNG coding starts after 2 frames */ + IF( st_fx->Opt_DTX_ON && vad == 0 && + GT_16(st_fx->ini_frame,2) && /* CNG coding starts after 2 frames */ st_fx->fd_cng_reset_flag == 0 && - NE_16(st_fx->last_core_fx, AMR_WB_CORE) && - st_fx->Opt_AMR_WB_fx == 0 ) + NE_16(st_fx->last_core, AMR_WB_CORE) && + st_fx->Opt_AMR_WB == 0 ) { test(); test(); test(); - IF ( GT_32(st_fx->last_core_brate_fx,SID_2k40) && NE_32(st_fx->last_total_brate_cng_fx,-1) && - NE_32(st_fx->last_total_brate_cng_fx,st_fx->total_brate_fx) && last_br_cng_flag) + IF ( GT_32(st_fx->last_core_brate,SID_2k40) && NE_32(st_fx->last_total_brate_cng,-1) && + NE_32(st_fx->last_total_brate_cng,st_fx->total_brate) && last_br_cng_flag) { - st_fx->total_brate_fx = st_fx->last_total_brate_cng_fx; + st_fx->total_brate = st_fx->last_total_brate_cng; move32(); test(); - if( !(EQ_32(st_fx->total_brate_fx,ACELP_7k20)&&st_fx->Opt_SC_VBR_fx)) + if( !(EQ_32(st_fx->total_brate,ACELP_7k20)&&st_fx->Opt_SC_VBR)) { - st_fx->Opt_SC_VBR_fx = 0; + st_fx->Opt_SC_VBR = 0; move16(); } st_fx->rf_mode = st_fx->last_rf_mode_cng; move16(); - st_fx->bwidth_fx = st_fx->last_bwidth_cng_fx; + st_fx->bwidth = st_fx->last_bwidth_cng; move16(); st_fx->codec_mode = st_fx->last_codec_mode_cng; move16(); } test(); test(); - IF ( LE_32(st_fx->last_core_brate_fx,SID_2k40) && NE_32(st_fx->last_total_brate_fx,st_fx->total_brate_fx) && last_br_flag) + IF ( LE_32(st_fx->last_core_brate,SID_2k40) && NE_32(st_fx->last_total_brate,st_fx->total_brate) && last_br_flag) { - st_fx->total_brate_fx = st_fx->last_total_brate_fx; + st_fx->total_brate = st_fx->last_total_brate; move32(); test(); - if( !(EQ_32(st_fx->total_brate_fx,ACELP_7k20)&&st_fx->Opt_SC_VBR_fx)) + if( !(EQ_32(st_fx->total_brate,ACELP_7k20)&&st_fx->Opt_SC_VBR)) { - st_fx->Opt_SC_VBR_fx = 0; + st_fx->Opt_SC_VBR = 0; move16(); } @@ -166,14 +166,14 @@ void dtx_fx( test(); test(); test(); - if( st_fx->rf_mode && st_fx->rf_fec_offset > 0 && EQ_32(st_fx->total_brate_fx,ACELP_13k20)&&NE_16(st_fx->bwidth_fx,NB)) + if( st_fx->rf_mode && st_fx->rf_fec_offset > 0 && EQ_32(st_fx->total_brate,ACELP_13k20)&&NE_16(st_fx->bwidth,NB)) { st_fx->Opt_RF_ON = 1; move16(); } st_fx->rf_mode = st_fx->Opt_RF_ON; move16(); - st_fx->bwidth_fx = st_fx->last_bwidth_fx; + st_fx->bwidth = st_fx->last_bwidth; move32(); IF (GT_16(st_fx->element_mode, EVS_MONO)) { @@ -182,7 +182,7 @@ void dtx_fx( } ELSE { - st_fx->codec_mode = get_codec_mode(st_fx->total_brate_fx); + st_fx->codec_mode = get_codec_mode(st_fx->total_brate); } } } @@ -194,15 +194,15 @@ void dtx_fx( if (st_fx->dtx_sce_sba == 0) #endif { - br_dtx_flag = LE_32(st_fx->total_brate_fx, ACELP_24k40) || LT_16(st_fx->lp_noise_fx, LP_NOISE_LV * 256) || (EQ_16(st_fx->element_mode, IVAS_SCE) && LE_32(st_fx->total_brate_fx, ACELP_32k)) || + br_dtx_flag = LE_32(st_fx->total_brate, ACELP_24k40) || LT_16(st_fx->lp_noise_fx, LP_NOISE_LV * 256) || (EQ_16(st_fx->element_mode, IVAS_SCE) && LE_32(st_fx->total_brate, ACELP_32k)) || EQ_16(st_fx->element_mode, IVAS_CPE_DFT) || (EQ_16(st_fx->element_mode, IVAS_CPE_MDCT) && (LE_32(st_fx->element_brate, IVAS_64k) || LT_16(st_fx->lp_noise_fx, LP_NOISE_LV * 256))); } test(); test(); test(); test(); - IF( st_fx->Opt_DTX_ON_fx && vad == 0 && - GT_16(st_fx->ini_frame_fx,2) && /* CNG coding starts after 2 frames */ + IF( st_fx->Opt_DTX_ON && vad == 0 && + GT_16(st_fx->ini_frame,2) && /* CNG coding starts after 2 frames */ br_dtx_flag && st_fx->fd_cng_reset_flag == 0 ) { @@ -210,54 +210,54 @@ void dtx_fx( st_fx->active_fr_cnt_fx = 0; move16(); - IF( st_fx->Opt_AMR_WB_fx ) + IF( st_fx->Opt_AMR_WB ) { - st_fx->last_total_brate_cng_fx = -1; + st_fx->last_total_brate_cng = -1; st_fx->last_rf_mode_cng = st_fx->rf_mode; move16(); } ELSE { - st_fx->last_total_brate_cng_fx = st_fx->total_brate_fx; - st_fx->last_bwidth_cng_fx = st_fx->bwidth_fx; + st_fx->last_total_brate_cng = st_fx->total_brate; + st_fx->last_bwidth_cng = st_fx->bwidth; st_fx->last_codec_mode_cng = st_fx->codec_mode; } IF(hDtxEnc->cnt_SID == 0 ) { /* this will be a SID frame */ - IF ( st_fx->Opt_AMR_WB_fx ) + IF ( st_fx->Opt_AMR_WB ) { - st_fx->core_brate_fx = SID_1k75; + st_fx->core_brate = SID_1k75; move32(); } ELSE { - st_fx->core_brate_fx = SID_2k40; + st_fx->core_brate = SID_2k40; move32(); } } ELSE { /* this will be a no data frame */ - st_fx->core_brate_fx = FRAME_NO_DATA; + st_fx->core_brate = FRAME_NO_DATA; move32(); } test(); test(); - IF( EQ_32(st_fx->core_brate_fx,FRAME_NO_DATA)&&NE_16(st_fx->last_core_fx,ACELP_CORE)&&!st_fx->Opt_AMR_WB_fx) + IF( EQ_32(st_fx->core_brate,FRAME_NO_DATA)&&NE_16(st_fx->last_core,ACELP_CORE)&&!st_fx->Opt_AMR_WB) { /* force SID frame when switching from HQ core or AMR-WB IO mode into inactive frame in ACELP core when DTX is on */ - st_fx->core_brate_fx = SID_2k40; + st_fx->core_brate = SID_2k40; move32(); } //PMT("dtx_sce_sba code is missing") #ifdef IVAS_CODE - IF ((NE_16(st_fx->last_core_fx, ACELP_CORE) || EQ_16(st_fx->cng_type_fx, FD_CNG)) && EQ_16(st_fx->dtx_sce_sba, 1)) + IF ((NE_16(st_fx->last_core, ACELP_CORE) || EQ_16(st_fx->cng_type, FD_CNG)) && EQ_16(st_fx->dtx_sce_sba, 1)) { - st_fx->cng_type_fx = FD_CNG; move16(); - if (EQ_16(st_fx->element_mode, EVS_MONO) && (EQ_32(st_fx->total_brate_fx, ACELP_9k60) || EQ_32(st_fx->total_brate_fx, ACELP_16k40) || EQ_32(st_fx->total_brate_fx, ACELP_24k40) || EQ_32(st_fx->total_brate_fx, ACELP_48k) || EQ_32(st_fx->total_brate_fx, HQ_96k) || EQ_32(st_fx->total_brate_fx, HQ_128k))) + st_fx->cng_type = FD_CNG; move16(); + if (EQ_16(st_fx->element_mode, EVS_MONO) && (EQ_32(st_fx->total_brate, ACELP_9k60) || EQ_32(st_fx->total_brate, ACELP_16k40) || EQ_32(st_fx->total_brate, ACELP_24k40) || EQ_32(st_fx->total_brate, ACELP_48k) || EQ_32(st_fx->total_brate, HQ_96k) || EQ_32(st_fx->total_brate, HQ_128k))) { st_fx->codec_mode = MODE2; move16(); } @@ -266,10 +266,10 @@ void dtx_fx( #endif { test(); test(); test(); test(); - IF((EQ_16(st_fx->cng_type_fx,FD_CNG) && (LE_32(st_fx->total_brate_fx,ACELP_24k40) || (NE_16(st_fx->element_mode, EVS_MONO) && LE_32(st_fx->total_brate_fx, ACELP_32k)))) || (EQ_16(st_fx->element_mode, IVAS_CPE_MDCT))) /* at highest bitrates, use exclusively LP_CNG */ + IF((EQ_16(st_fx->cng_type,FD_CNG) && (LE_32(st_fx->total_brate,ACELP_24k40) || (NE_16(st_fx->element_mode, EVS_MONO) && LE_32(st_fx->total_brate, ACELP_32k)))) || (EQ_16(st_fx->element_mode, IVAS_CPE_MDCT))) /* at highest bitrates, use exclusively LP_CNG */ { test(); test(); - IF(EQ_16(st_fx->element_mode, EVS_MONO) && (EQ_32(st_fx->total_brate_fx,ACELP_9k60) || EQ_32(st_fx->total_brate_fx,ACELP_16k40) || EQ_32(st_fx->total_brate_fx,ACELP_24k40))) + IF(EQ_16(st_fx->element_mode, EVS_MONO) && (EQ_32(st_fx->total_brate,ACELP_9k60) || EQ_32(st_fx->total_brate,ACELP_16k40) || EQ_32(st_fx->total_brate,ACELP_24k40))) { st_fx->codec_mode = MODE2; move16(); @@ -277,7 +277,7 @@ void dtx_fx( } ELSE { - st_fx->cng_type_fx = LP_CNG; + st_fx->cng_type = LP_CNG; move16(); IF(st_fx->codec_mode == MODE2) { @@ -308,7 +308,7 @@ void dtx_fx( /* NB core bit rate can be "-1" at startup , so one can not use core_brate_fx <=2400 */ test(); test(); - IF ( (NE_32(st_fx->core_brate_fx ,SID_2k40)) && (NE_32(st_fx->core_brate_fx,SID_1k75)) && (NE_32(st_fx->core_brate_fx, FRAME_NO_DATA))) + IF ( (NE_32(st_fx->core_brate ,SID_2k40)) && (NE_32(st_fx->core_brate,SID_1k75)) && (NE_32(st_fx->core_brate, FRAME_NO_DATA))) { IF(hDtxEnc != NULL) { @@ -317,7 +317,7 @@ void dtx_fx( /* change SID update rate */ /* first SID update is only 8 (3) frames after the active speech end */ - IF(!st_fx->Opt_AMR_WB_fx) + IF(!st_fx->Opt_AMR_WB) { hDtxEnc->max_SID = FIXED_SID_RATE; move16(); @@ -338,7 +338,7 @@ void dtx_fx( move16(); /* reset the counter of CNG frames for averaging */ } test(); - IF( GE_16(st_fx->active_fr_cnt_fx,CNG_TYPE_HO) && st_fx->Opt_AMR_WB_fx==0 && NE_16(st_fx->element_mode, IVAS_CPE_MDCT)) + IF( GE_16(st_fx->active_fr_cnt_fx,CNG_TYPE_HO) && st_fx->Opt_AMR_WB==0 && NE_16(st_fx->element_mode, IVAS_CPE_MDCT)) { IF (EQ_16(st_fx->element_mode, IVAS_SCE)) { @@ -346,7 +346,7 @@ void dtx_fx( Word16 lp_thresh, fd_thresh; PMT("lp_thresh scaling is to be found") test(); - IF (st_fx->Opt_DTX_ON_fx && EQ_16(st_fx->dtx_sce_sba, 1) ) + IF (st_fx->Opt_DTX_ON && EQ_16(st_fx->dtx_sce_sba, 1) ) { lp_thresh = 5.f; fd_thresh = 2.f; @@ -372,22 +372,22 @@ void dtx_fx( ELSE { test(); test(); test(); test(); test(); test(); test(); test(); - IF(EQ_16(st_fx->cng_type_fx, LP_CNG) && ((EQ_16(st_fx->input_bwidth_fx, NB) && GT_32(st_fx->bckr_tilt_lt, 589824l/*9.f Q16*/)) || (GT_16(st_fx->input_bwidth_fx, NB) && GT_32(st_fx->bckr_tilt_lt, 2949120l/*45.f Q16*/)))) + IF(EQ_16(st_fx->cng_type, LP_CNG) && ((EQ_16(st_fx->input_bwidth, NB) && GT_32(st_fx->bckr_tilt_lt, 589824l/*9.f Q16*/)) || (GT_16(st_fx->input_bwidth, NB) && GT_32(st_fx->bckr_tilt_lt, 2949120l/*45.f Q16*/)))) { - st_fx->cng_type_fx = FD_CNG; + st_fx->cng_type = FD_CNG; move16(); } - ELSE IF(EQ_16(st_fx->cng_type_fx, FD_CNG) && ((EQ_16(st_fx->input_bwidth_fx, NB) && LT_32(st_fx->bckr_tilt_lt, 131072l/*2.f Q16*/)) || (GT_16(st_fx->input_bwidth_fx, NB) && LT_32(st_fx->bckr_tilt_lt, 655360l/*10.f Q16*/)))) + ELSE IF(EQ_16(st_fx->cng_type, FD_CNG) && ((EQ_16(st_fx->input_bwidth, NB) && LT_32(st_fx->bckr_tilt_lt, 131072l/*2.f Q16*/)) || (GT_16(st_fx->input_bwidth, NB) && LT_32(st_fx->bckr_tilt_lt, 655360l/*10.f Q16*/)))) { - st_fx->cng_type_fx = LP_CNG; + st_fx->cng_type = LP_CNG; move16(); } } - st_fx->last_total_brate_cng_fx = -1; + st_fx->last_total_brate_cng = -1; } - ELSE IF( st_fx->Opt_AMR_WB_fx ) + ELSE IF( st_fx->Opt_AMR_WB ) { - st_fx->cng_type_fx = LP_CNG; + st_fx->cng_type = LP_CNG; move16(); } st_fx->active_fr_cnt_fx = add( st_fx->active_fr_cnt_fx, 1 ); @@ -401,7 +401,7 @@ void dtx_fx( { hDtxEnc->frame_ener_fx = L_deposit_l(0); - IF(st_fx->Opt_DTX_ON_fx) + IF(st_fx->Opt_DTX_ON) { Q_speech2 = add(shl(Q_speech, 1), 7); FOR(j = 0; j < 16; j++) @@ -422,7 +422,7 @@ void dtx_fx( /* Active speech (voiced) */ - IF(EQ_16(st_fx->clas_fx, VOICED_CLAS)) + IF(EQ_16(st_fx->clas, VOICED_CLAS)) { alpha = ALPHA_ENER_SLOW_FX; move16(); @@ -442,7 +442,7 @@ void dtx_fx( hDtxEnc->VarDTX_cnt_voiced = s_min(hDtxEnc->VarDTX_cnt_voiced, MIN_CNT); } /* Background noise */ - ELSE IF(!st_fx->Opt_AMR_WB_fx) + ELSE IF(!st_fx->Opt_AMR_WB) { alpha = ALPHA_ENER_SLOW_FX; move16(); @@ -466,26 +466,26 @@ void dtx_fx( } /* Update of the SID counter */ - update_SID_cnt(hDtxEnc, st_fx->core_brate_fx, st_fx->Opt_AMR_WB_fx); + update_SID_cnt(hDtxEnc, st_fx->core_brate, st_fx->Opt_AMR_WB); /* Update encoded bandwidth */ test(); test(); - IF( st_fx->Opt_DTX_ON_fx && (st_fx->core_brate_fx == SID_2k40 || st_fx->core_brate_fx == FRAME_NO_DATA ) ) + IF( st_fx->Opt_DTX_ON && (st_fx->core_brate == SID_2k40 || st_fx->core_brate == FRAME_NO_DATA ) ) { - st_fx->bwidth_fx = st_fx->last_bwidth_fx; + st_fx->bwidth = st_fx->last_bwidth; move16(); test(); - if( GT_32(st_fx->last_core_brate_fx, SID_2k40)&&NE_32(st_fx->last_total_brate_cng_fx,-1)) + if( GT_32(st_fx->last_core_brate, SID_2k40)&&NE_32(st_fx->last_total_brate_cng,-1)) { - st_fx->bwidth_fx = st_fx->last_bwidth_cng_fx; + st_fx->bwidth = st_fx->last_bwidth_cng; move16(); } test(); test(); - IF( st_fx->Opt_RF_ON && (EQ_32(st_fx->total_brate_fx, ACELP_13k20))&&(EQ_16(st_fx->bwidth_fx,NB))) + IF( st_fx->Opt_RF_ON && (EQ_32(st_fx->total_brate, ACELP_13k20))&&(EQ_16(st_fx->bwidth,NB))) { st_fx->codec_mode = MODE1; move16(); @@ -498,7 +498,7 @@ void dtx_fx( test(); test(); - IF( st_fx->Opt_RF_ON && NE_32(st_fx->total_brate_fx, ACELP_13k20) ) + IF( st_fx->Opt_RF_ON && NE_32(st_fx->total_brate, ACELP_13k20) ) { reset_rf_indices_fx(st_fx); move16(); @@ -515,7 +515,7 @@ void dtx_fx( UWord16 lsb; Word16 tmpbandwidthMin; - Mpy_32_16_ss(st_fx->total_brate_fx, 5243, &L_tmp, &lsb); /* 5243 is 1/50 in Q18. (0+18-15=3) */ + Mpy_32_16_ss(st_fx->total_brate, 5243, &L_tmp, &lsb); /* 5243 is 1/50 in Q18. (0+18-15=3) */ bits_frame_nominal = extract_l(L_shr(L_tmp, 3)); /* Q0 */ FOR (n=0; nbwidth_fx = s_max(s_min(st_fx->bwidth_fx, FrameSizeConfig[n].bandwidth_max), tmpbandwidthMin); + st_fx->bwidth = s_max(s_min(st_fx->bwidth, FrameSizeConfig[n].bandwidth_max), tmpbandwidthMin); } } @@ -691,7 +691,7 @@ static void update_SID_cnt( void dtx_hangover_control_fx( - Encoder_State_fx *st_fx, /* i/o: encoder state structure */ + Encoder_State *st_fx, /* i/o: encoder state structure */ const Word16 lsp_new_fx[M] /* i : current frame LSPs */ ) { @@ -831,7 +831,7 @@ void dtx_hangover_control_fx( FOR( i=0; iL_frame_fx,L_FRAME)) + IF ( EQ_16(st_fx->L_frame,L_FRAME)) { lsp2lsf_fx( &tmp[i*M], lsf_tmp, M, INT_FS_FX ); ftmp_fx = 964; @@ -972,9 +972,9 @@ void dtx_hangover_control_fx( test();test();test();test();test();test();test();test();test();test();test(); IF ( ( LT_16(Dlsp,13107)&<_16(Denr,359)&<_16(S_max,3277) - && LT_16(Dlsp_n2e,13107) && LT_16(Denr_n2e,308) && st_fx->Opt_SC_VBR_fx == 1 ) || + && LT_16(Dlsp_n2e,13107) && LT_16(Denr_n2e,308) && st_fx->Opt_SC_VBR == 1 ) || ( LT_16(Dlsp,13107) && LT_16(Denr,205) && LT_16(S_max,3277) - && LT_16(Dlsp_n2e,13107) && LT_16(Denr_n2e,205) && st_fx->Opt_SC_VBR_fx == 0 ) ) + && LT_16(Dlsp_n2e,13107) && LT_16(Denr_n2e,205) && st_fx->Opt_SC_VBR == 0 ) ) { hVAD->hangover_terminate_flag = 1; @@ -1086,7 +1086,7 @@ void td_cng_enc_init_fx( *-------------------------------------------------------------------*/ void dtx_enc_init_fx( - Encoder_State_fx* st, /* i : Encoder state handle */ + Encoder_State* st, /* i : Encoder state handle */ const Word16 var_SID_rate_flag, /* i : flag for variable SID update rate */ const Word16 interval_SID /* i : interval for SID update */ ) diff --git a/lib_enc/enc_acelp_tcx_main_fx.c b/lib_enc/enc_acelp_tcx_main_fx.c index c7ce2b0ee..236402c3c 100644 --- a/lib_enc/enc_acelp_tcx_main_fx.c +++ b/lib_enc/enc_acelp_tcx_main_fx.c @@ -20,7 +20,7 @@ *--------------------------------------------------------------------*/ void enc_acelp_tcx_main_fx( const Word16 new_samples[], /* i : new samples */ - Encoder_State_fx *st, /* i/o: encoder state structure */ + Encoder_State *st, /* i/o: encoder state structure */ Word16 Aw[NB_SUBFR16k*(M+1)], /* i : weighted A(z) unquant. for subframes*/ const Word16 lsp_new[M], /* i : LSPs at the end of the frame */ const Word16 lsp_mid[M], /* i : LSPs at the middle of the frame */ @@ -38,7 +38,7 @@ void enc_acelp_tcx_main_fx( ptr_bwe_exc = old_bwe_exc + PIT16k_MAX * 2; - IF( EQ_16( st->last_core_fx, ACELP_CORE)) + IF( EQ_16( st->last_core, ACELP_CORE)) { set16_fx( old_bwe_exc + PIT16k_MAX * 2, 0, ((L_FRAME16k + 1) + L_SUBFR16k) * 2 ); Copy(hBWE_TD->old_bwe_exc_fx, old_bwe_exc, PIT16k_MAX * 2 ); @@ -50,9 +50,9 @@ void enc_acelp_tcx_main_fx( if (st->hPlcExt) {/* PLC: [Guided ACELP PLC] */ - gPLC_encInfo_fx(st->hPlcExt ,st->total_brate_fx, st->bwidth_fx, st->clas_fx, st->coder_type); + gPLC_encInfo_fx(st->hPlcExt ,st->total_brate, st->bwidth, st->clas, st->coder_type); } - IF ( s_and(st->core_brate_fx!=FRAME_NO_DATA, st->core_brate_fx!=SID_2k40) ) + IF ( s_and(st->core_brate!=FRAME_NO_DATA, st->core_brate!=SID_2k40) ) { /* Run Core Coder */ @@ -71,10 +71,10 @@ void enc_acelp_tcx_main_fx( test(); - IF( EQ_16( st->core_fx, ACELP_CORE )&&st->igf!=0) + IF( EQ_16( st->core, ACELP_CORE )&&st->igf!=0) { non_linearity_fx( ptr_bwe_exc, bwe_exc_extended, L_FRAME32k, &hBWE_TD->bwe_non_lin_prev_scale_fx, *Q_new - , st->coder_type, voice_factors, st->L_frame_fx); + , st->coder_type, voice_factors, st->L_frame); /* update the old BWE exe memory */ Copy( &old_bwe_exc[L_FRAME32k], hBWE_TD->old_bwe_exc_fx, PIT16k_MAX * 2 ); @@ -89,20 +89,20 @@ void enc_acelp_tcx_main_fx( ELSE { /* Run SID Coder */ - IF ( st->core_brate_fx == SID_2k40 ) + IF ( st->core_brate == SID_2k40 ) { - FdCng_encodeSID_fx( st->hFdCngEnc_fx, st, st->preemph_fac ); + FdCng_encodeSID_fx( st->hFdCngEnc, st, st->preemph_fac ); } /* Generate Comfort Noise */ generate_comfort_noise_enc_fx( st, *Q_new, 1 ); /* Update Core Encoder */ - core_encode_update_cng_fx( st, st->hFdCngEnc_fx->hFdCngCom->timeDomainBuffer, st->hFdCngEnc_fx->hFdCngCom->A_cng, Aw, *Q_new, *shift ); + core_encode_update_cng_fx( st, st->hFdCngEnc->hFdCngCom->timeDomainBuffer, st->hFdCngEnc->hFdCngCom->A_cng, Aw, *Q_new, *shift ); } /* coreSwitching update of MODE1 parameters in the last frame */ - st->last_coder_type_fx = st->coder_type; + st->last_coder_type = st->coder_type; move16(); diff --git a/lib_enc/enc_amr_wb_fx.c b/lib_enc/enc_amr_wb_fx.c index 257f0901d..be7d3bd07 100644 --- a/lib_enc/enc_amr_wb_fx.c +++ b/lib_enc/enc_amr_wb_fx.c @@ -18,7 +18,7 @@ * Encode excitation signal in AMR-WB IO mode *-------------------------------------------------------------------*/ void encod_amr_wb_fx( - Encoder_State_fx *st, /* i/o: state structure */ + Encoder_State *st, /* i/o: state structure */ const Word16 speech[], /* i : input speech */ const Word16 Aw[], /* i : weighted A(z) unquantized for subframes */ const Word16 Aq[], /* i : 12k8 Lp coefficient */ @@ -111,7 +111,7 @@ void encod_amr_wb_fx( *-----------------------------------------------------------------*/ lp_flag = NORMAL_OPERATION; - if (LT_32(st->core_brate_fx, ACELP_11k60)) + if (LT_32(st->core_brate, ACELP_11k60)) { lp_flag = LOW_PASS; move16(); @@ -144,7 +144,7 @@ void encod_amr_wb_fx( * Adaptive exc. construction *----------------------------------------------------------------*/ - *pt_pitch = pit_encode_fx(hBstr, st->acelp_cfg.pitch_bits, st->core_brate_fx, 1, L_FRAME, -1, &pitch_limit_flag, i_subfr, exc, + *pt_pitch = pit_encode_fx(hBstr, st->acelp_cfg.pitch_bits, st->core_brate, 1, L_FRAME, -1, &pitch_limit_flag, i_subfr, exc, L_SUBFR, T_op, &T0_min, &T0_max, &T0, &T0_frac, h1, xn , 0 /*hStereoTD->tdm_Pitch_reuse_flag*/, NULL /*hStereoTD->tdm_Pri_pitch_buf*/); @@ -159,7 +159,7 @@ void encod_amr_wb_fx( * or in case of floating point encoder & fixed p. decoder *-----------------------------------------------------------------*/ - clip_gain = gp_clip_fx(st->element_mode, st->core_brate_fx, st->voicing_fx, i_subfr, 0, xn, st->clip_var_fx, sub(shift_wsp,1)); + clip_gain = gp_clip_fx(st->element_mode, st->core_brate, st->voicing_fx, i_subfr, 0, xn, st->clip_var_fx, sub(shift_wsp,1)); /*-----------------------------------------------------------------* * LP filtering of the adaptive excitation, codebook target computation @@ -176,17 +176,17 @@ void encod_amr_wb_fx( /*-----------------------------------------------------------------* * Innovation encoding *-----------------------------------------------------------------*/ - inov_encode_fx( st, st->core_brate_fx, 1, L_FRAME, st->last_L_frame_fx, -1, -1, 0, i_subfr, -1, p_Aq, gain_pit, cn, + inov_encode_fx( st, st->core_brate, 1, L_FRAME, st->last_L_frame, -1, -1, 0, i_subfr, -1, p_Aq, gain_pit, cn, exc, h2, hLPDmem->tilt_code, *pt_pitch, xn2, code, y2, &unbits, L_SUBFR, shift ); /*-----------------------------------------------------------------* * Gain encoding * Pitch gain clipping test * Estimate spectrum tilt and voicing *-----------------------------------------------------------------*/ - gain_enc_amr_wb_fx(hBstr, xn, shift_wsp, y1, y2, code, st->core_brate_fx, &gain_pit, &gain_code, + gain_enc_amr_wb_fx(hBstr, xn, shift_wsp, y1, y2, code, st->core_brate, &gain_pit, &gain_code, &gain_inov, &norm_gain_code, g_corr, clip_gain, hAmrwb_IO->past_qua_en_fx ); - gp_clip_test_gain_pit_fx(st->element_mode, st->core_brate_fx, gain_pit, st->clip_var_fx ); + gp_clip_test_gain_pit_fx(st->element_mode, st->core_brate, gain_pit, st->clip_var_fx ); #ifdef BASOP_NOGLOB Lgcode = L_shl_o(gain_code, Q_new, &Overflow); /* scaled gain_code with Qnew -> Q16*/ gcode16 = round_fx_o(Lgcode, &Overflow); @@ -246,11 +246,11 @@ void encod_amr_wb_fx( * HF gain modification factors at 23.85 kbps *-----------------------------------------------------------------*/ - IF ( EQ_32(st->core_brate_fx,ACELP_23k85)) + IF ( EQ_32(st->core_brate,ACELP_23k85)) { - IF( GE_32(st->input_Fs_fx,16000)) + IF( GE_32(st->input_Fs,16000)) { - hf_cod_fx( st->core_brate_fx, &speech16k_fx[i_subfr * L_SUBFR16k/L_SUBFR], Aq, &exc[i_subfr], &syn[i_subfr], + hf_cod_fx( st->core_brate, &speech16k_fx[i_subfr * L_SUBFR16k/L_SUBFR], Aq, &exc[i_subfr], &syn[i_subfr], &hAmrwb_IO->seed2_enc, hAmrwb_IO->mem_hp400_enc_fx, hAmrwb_IO->mem_syn_hf_enc_fx, hAmrwb_IO->mem_hf_enc_fx, hAmrwb_IO->mem_hf2_enc_fx, hVAD->hangover_cnt, &hAmrwb_IO->gain_alpha_fx, &hf_gain_fx[i_subfr/L_SUBFR], add(Q_new,1), st->Q_syn); } diff --git a/lib_enc/enc_gen_voic_fx.c b/lib_enc/enc_gen_voic_fx.c index 9d341bd3e..ed6e3efe7 100644 --- a/lib_enc/enc_gen_voic_fx.c +++ b/lib_enc/enc_gen_voic_fx.c @@ -52,7 +52,7 @@ /*=======================================================================*/ void encod_gen_voic_fx( - Encoder_State_fx *st_fx, /* i/o: state structure */ + Encoder_State *st_fx, /* i/o: state structure */ const Word16 speech_fx[], /* i : input speech */ const Word16 Aw_fx[], /* i : weighted A(z) unquantized for subframes */ const Word16 Aq_fx[], /* i : 12k8 Lp coefficient */ @@ -127,7 +127,7 @@ void encod_gen_voic_fx( move16(); error_fx = 0; move16(); - L_frame = st_fx->L_frame_fx; + L_frame = st_fx->L_frame; move16(); @@ -165,9 +165,9 @@ void encod_gen_voic_fx( move16(); test(); test(); - IF( GE_32(st_fx->core_brate_fx, MIN_BRATE_AVQ_EXC) && LE_32(st_fx->core_brate_fx, MAX_BRATE_AVQ_EXC_TD) && EQ_16(st_fx->coder_type,GENERIC)) + IF( GE_32(st_fx->core_brate, MIN_BRATE_AVQ_EXC) && LE_32(st_fx->core_brate, MAX_BRATE_AVQ_EXC_TD) && EQ_16(st_fx->coder_type,GENERIC)) { - if( GT_16(st_fx->last_harm_flag_acelp_fx,2)) + if( GT_16(st_fx->last_harm_flag_acelp,2)) { harm_flag_acelp = 1; move16(); @@ -200,7 +200,7 @@ void encod_gen_voic_fx( /* scaling of xn[] to limit dynamic at 12 bits */ Scale_sig( xn_fx, L_SUBFR, shift ); - *pt_pitch_fx = pit_encode_fx(hBstr, st_fx->acelp_cfg.pitch_bits, st_fx->core_brate_fx, 0, L_frame, st_fx->coder_type, &pitch_limit_flag, i_subfr_fx, exc_fx, + *pt_pitch_fx = pit_encode_fx(hBstr, st_fx->acelp_cfg.pitch_bits, st_fx->core_brate, 0, L_frame, st_fx->coder_type, &pitch_limit_flag, i_subfr_fx, exc_fx, L_SUBFR, st_fx->pitch_fx, &T0_min_fx, &T0_max_fx, &T0_fx, &T0_frac_fx, h1_fx, xn_fx , tdm_Pitch_reuse_flag, tdm_Pri_pitch_buf); tbe_celp_exc(L_frame,i_subfr_fx,T0_fx, T0_frac_fx, &error_fx, bwe_exc_fx); @@ -215,7 +215,7 @@ void encod_gen_voic_fx( * Gain clipping test to avoid unstable synthesis on frame erasure *-----------------------------------------------------------------*/ - clip_gain_fx = gp_clip_fx(st_fx->element_mode, st_fx->core_brate_fx, st_fx->voicing_fx,i_subfr_fx,st_fx->coder_type,xn_fx,st_fx->clip_var_fx,sub(shift_wsp, 1)); + clip_gain_fx = gp_clip_fx(st_fx->element_mode, st_fx->core_brate, st_fx->voicing_fx,i_subfr_fx,st_fx->coder_type,xn_fx,st_fx->clip_var_fx,sub(shift_wsp, 1)); if( EQ_16(st_fx->coder_type,INACTIVE)) { @@ -248,7 +248,7 @@ void encod_gen_voic_fx( *-----------------------------------------------------------------*/ test(); - IF( GE_32(st_fx->core_brate_fx, MIN_BRATE_AVQ_EXC )&& NE_16(st_fx->coder_type,INACTIVE)) + IF( GE_32(st_fx->core_brate, MIN_BRATE_AVQ_EXC )&& NE_16(st_fx->coder_type,INACTIVE)) { transf_cdbk_enc_fx( st_fx, harm_flag_acelp, i_subfr_fx, cn_fx, exc_fx, p_Aq_fx, p_Aw_fx, h1_fx, xn_fx, xn2_fx, y1_fx, y2_fx, Es_pred_fx, &gain_pit_fx, gain_code_fx, g_corr_fx, clip_gain_fx, &gain_preQ_fx, code_preQ_fx, unbits_fx, Q_new, shift); @@ -258,20 +258,20 @@ void encod_gen_voic_fx( * Innovation encoding *-----------------------------------------------------------------*/ - inov_encode_fx( st_fx, st_fx->core_brate_fx, 0, L_frame, st_fx->last_L_frame_fx, - st_fx->coder_type, st_fx->bwidth_fx, st_fx->sharpFlag, i_subfr_fx, -1, p_Aq_fx, + inov_encode_fx( st_fx, st_fx->core_brate, 0, L_frame, st_fx->last_L_frame, + st_fx->coder_type, st_fx->bwidth, st_fx->sharpFlag, i_subfr_fx, -1, p_Aq_fx, gain_pit_fx, cn_fx, exc_fx, h2_fx, hLPDmem->tilt_code, *pt_pitch_fx, xn2_fx, code_fx, y2_fx, &unbits_PI_fx, L_SUBFR, shift ); /*-----------------------------------------------------------------* * Gain encoding *-----------------------------------------------------------------*/ - IF ( LE_32(st_fx->core_brate_fx,ACELP_8k00)) + IF ( LE_32(st_fx->core_brate,ACELP_8k00)) { gain_enc_lbr_fx(hBstr, st_fx->acelp_cfg.gains_mode, st_fx->coder_type, i_subfr_fx, xn_fx, y1_fx, shift_wsp, y2_fx, code_fx, &gain_pit_fx, &gain_code_fx, &gain_inov_fx, &norm_gain_code_fx, g_corr_fx, gc_mem, gp_mem, clip_gain_fx, L_SUBFR ); } - ELSE IF ( GT_32(st_fx->core_brate_fx,ACELP_32k)) + ELSE IF ( GT_32(st_fx->core_brate,ACELP_32k)) { gain_enc_SQ_fx(hBstr, st_fx->acelp_cfg.gains_mode, i_subfr_fx, xn_fx, y1_fx, y2_fx, code_fx, Es_pred_fx, &gain_pit_fx, &gain_code_fx, &gain_inov_fx, &norm_gain_code_fx, g_corr_fx, clip_gain_fx, shift_wsp ); @@ -281,7 +281,7 @@ void encod_gen_voic_fx( gain_enc_mless_fx(hBstr, st_fx->acelp_cfg.gains_mode, st_fx->element_mode, L_frame, i_subfr_fx, -1, xn_fx, y1_fx, shift_wsp, y2_fx, code_fx, Es_pred_fx, &gain_pit_fx, &gain_code_fx, &gain_inov_fx, &norm_gain_code_fx, g_corr_fx, clip_gain_fx ); } - IF (st_fx->Opt_SC_VBR_fx) + IF (st_fx->Opt_SC_VBR) { if (EQ_16(hSC_VBR->last_ppp_mode, 1)) { @@ -290,7 +290,7 @@ void encod_gen_voic_fx( move16(); } } - gp_clip_test_gain_pit_fx(st_fx->element_mode, st_fx->core_brate_fx, gain_pit_fx, st_fx->clip_var_fx ); + gp_clip_test_gain_pit_fx(st_fx->element_mode, st_fx->core_brate, gain_pit_fx, st_fx->clip_var_fx ); #ifdef BASOP_NOGLOB Lgcode = L_shl_o(gain_code_fx, Q_new, &Overflow); /* scaled gain_code with Qnew -> Q16*/ @@ -307,7 +307,7 @@ void encod_gen_voic_fx( *-----------------------------------------------------------------*/ test(); - IF ( GE_32(st_fx->core_brate_fx, MAX_GSC_INACTIVE_BRATE) && EQ_16(st_fx->coder_type,INACTIVE)) + IF ( GE_32(st_fx->core_brate, MAX_GSC_INACTIVE_BRATE) && EQ_16(st_fx->coder_type,INACTIVE)) { transf_cdbk_enc_fx( st_fx, 0, i_subfr_fx, cn_fx, exc_fx, p_Aq_fx, p_Aw_fx, h1_fx, xn_fx, xn2_fx, y1_fx, y2_fx, Es_pred_fx, &gain_pit_fx, gain_code_fx, g_corr_fx, clip_gain_fx, &gain_preQ_fx, code_preQ_fx, unbits_fx, Q_new, shift); @@ -394,7 +394,7 @@ void encod_gen_voic_fx( prep_tbe_exc_fx( L_frame, i_subfr_fx, gain_pit_fx, gain_code_fx, code_fx, voice_fac_fx, &voice_factors_fx[i_subfr_fx/L_SUBFR], bwe_exc_fx, gain_preQ_fx, code_preQ_fx, Q_new, - T0_fx, T0_frac_fx, st_fx->coder_type, st_fx->core_brate_fx ); + T0_fx, T0_frac_fx, st_fx->coder_type, st_fx->core_brate ); /*-----------------------------------------------------------------* * Synthesize speech to update mem_syn[]. @@ -415,7 +415,7 @@ void encod_gen_voic_fx( push_indice_fx(hBstr, IND_UNUSED, 0, i ); unbits_PI_fx -= i; } - IF (st_fx->Opt_SC_VBR_fx) + IF (st_fx->Opt_SC_VBR) { /* SC-VBR */ hSC_VBR->prev_ppp_gain_pit_fx = gain_pit_fx; diff --git a/lib_enc/enc_gen_voic_rf_fx.c b/lib_enc/enc_gen_voic_rf_fx.c index 1365e59c3..f5c574ee5 100644 --- a/lib_enc/enc_gen_voic_rf_fx.c +++ b/lib_enc/enc_gen_voic_rf_fx.c @@ -19,7 +19,7 @@ void reset_rf_indices_fx( - Encoder_State_fx *st /* i: state structure - contains partial RF indices */ + Encoder_State *st /* i: state structure - contains partial RF indices */ ) { RF_ENC_HANDLE hRF = st->hRF; @@ -52,7 +52,7 @@ void reset_rf_indices_fx( hRF->rf_target_bits = 0; move16(); - hRF->rf_tcxltp_pitch_int_past = st->L_frame_fx; + hRF->rf_tcxltp_pitch_int_past = st->L_frame; move16(); hRF->rf_last_tns_active = 0; move16(); @@ -126,7 +126,7 @@ void coder_acelp_rf_fx( const Word16 voicing[], /* input: open-loop LTP gain */ const Word16 T_op[], /* input: open-loop LTP lag */ Word16 stab_fac, - Encoder_State_fx *st, + Encoder_State *st, Word16 target_bits, /* i/o : coder memory state */ const Word16 rf_frame_type, /* i : rf_frame_type */ Word16 *exc_rf, /* i/o: pointer to RF excitation */ @@ -195,7 +195,7 @@ void coder_acelp_rf_fx( tmp2 = BITS_ALLOC_config_acelp( target_bits, rf_frame_type, &(hRF->acelp_cfg_rf), 0, st->nb_subfr ); /* Init Framing parameters */ - L_frame = st->L_frame_fx; + L_frame = st->L_frame; /*------------------------------------------------------------------------* * Initialize buffers * @@ -207,7 +207,7 @@ void coder_acelp_rf_fx( Q_new_p5 = add(Q_new, 5); /* Reset phase dispersion */ - IF (GT_16(st->last_core_fx, ACELP_CORE)) + IF (GT_16(st->last_core, ACELP_CORE)) { hRF->rf_dm_fx.prev_gain_code = 0; set16_fx(hRF->rf_dm_fx.prev_gain_pit, 0, 6); @@ -371,7 +371,7 @@ void coder_acelp_rf_fx( E_ACELP_innovative_codebook_fx( exc_rf,T0,T0_frac,T0_res, gain_pit, hRF->rf_tilt_code, acelp_cfg, i_subfr,p_Aq,h1,xn,cn,y1,y2,st->acelp_autocorr, - &prm_rf,code,shift,st->L_frame_fx, st->last_L_frame_fx,st->total_brate_fx); + &prm_rf,code,shift,st->L_frame, st->last_L_frame,st->total_brate); } ELSE { @@ -405,12 +405,12 @@ void coder_acelp_rf_fx( encode_acelp_gains_fx( code, acelp_cfg->gains_mode[j_subfr], Es_pred_rf, clip_gain, &g_corr, &gain_pit, &gain_code, &prm_rf, &past_gcode, - &gain_inov, L_SUBFR, code2, &gain_code2, st->flag_noisy_speech_snr ); + &gain_inov, L_SUBFR, code2, &gain_code2, st->flag_noisy_speech_snr_fx ); } - gp_clip_test_gain_pit_fx(st->element_mode, st->core_brate_fx, gain_pit, hRF->rf_clip_var ); + gp_clip_test_gain_pit_fx(st->element_mode, st->core_brate, gain_pit, hRF->rf_clip_var ); gain_code_vect[0] = gain_code; move32(); diff --git a/lib_enc/enc_higher_acelp_fx.c b/lib_enc/enc_higher_acelp_fx.c index aa0f93037..e74f2556b 100644 --- a/lib_enc/enc_higher_acelp_fx.c +++ b/lib_enc/enc_higher_acelp_fx.c @@ -21,7 +21,7 @@ static void find_cn_fx( const Word16 xn[], const Word16 Ap[], const Word16 *p_Aq *-----------------------------------------------------------------*/ #define Q_MINUS 4 void transf_cdbk_enc_fx( - Encoder_State_fx *st_fx, /* i/o: encoder state structure */ + Encoder_State *st_fx, /* i/o: encoder state structure */ const Word16 harm_flag_acelp,/* i : harmonic flag for higher rates ACELP */ const Word16 i_subfr, /* i : subframe index */ Word16 cn[], /* i/o: target vector in residual domain */ @@ -117,7 +117,7 @@ void transf_cdbk_enc_fx( test(); test(); test(); - IF( NE_16(st_fx->coder_type,INACTIVE) && LE_32(st_fx->core_brate_fx, MAX_BRATE_AVQ_EXC_TD) && GE_32(st_fx->core_brate_fx, MIN_BRATE_AVQ_EXC) && !harm_flag_acelp) + IF( NE_16(st_fx->coder_type,INACTIVE) && LE_32(st_fx->core_brate, MAX_BRATE_AVQ_EXC_TD) && GE_32(st_fx->core_brate, MIN_BRATE_AVQ_EXC) && !harm_flag_acelp) { Copy_Scale_sig( x_in, x_tran, L_SUBFR,-Q_MINUS+1 ); /*Q_new-1 -> Q_new-4*/ /*Copy( x_in, x_tran, L_SUBFR );*/ @@ -195,11 +195,11 @@ void transf_cdbk_enc_fx( stmp = 0; move16(); } - IF( GT_32(st_fx->core_brate_fx,56000)) + IF( GT_32(st_fx->core_brate,56000)) { index = usquant_fx( stmp, &stmp, G_AVQ_MIN_INACT_64k_Q12, G_AVQ_DELTA_INACT_64k_Q12>>1, (1 << G_AVQ_BITS) ); } - ELSE IF( GT_32(st_fx->core_brate_fx,42000)) + ELSE IF( GT_32(st_fx->core_brate,42000)) { index = usquant_fx( stmp, &stmp, G_AVQ_MIN_INACT_48k_Q12, G_AVQ_DELTA_INACT_48k_Q12>>1, (1 << G_AVQ_BITS) ); } @@ -238,7 +238,7 @@ void transf_cdbk_enc_fx( Ltmp = L_deposit_l(0); } test(); - IF( LE_32(st_fx->core_brate_fx,42000) && GT_32(st_fx->core_brate_fx ,ACELP_24k40)) + IF( LE_32(st_fx->core_brate,42000) && GT_32(st_fx->core_brate ,ACELP_24k40)) { index = gain_quant_fx(&Ltmp, &stmp, LG10_G_AVQ_MIN_32kbps_Q14, LG10_G_AVQ_MAX_Q13, G_AVQ_BITS, &e_den ); } @@ -275,7 +275,7 @@ void transf_cdbk_enc_fx( /* at the last subframe, write AVQ unused bits */ test(); test(); - IF( EQ_16(i_subfr,4*L_SUBFR) && NE_16(st_fx->extl_fx,SWB_BWE_HIGHRATE) && NE_16(st_fx->extl_fx,FB_BWE_HIGHRATE)) + IF( EQ_16(i_subfr,4*L_SUBFR) && NE_16(st_fx->extl,SWB_BWE_HIGHRATE) && NE_16(st_fx->extl,FB_BWE_HIGHRATE)) { WHILE( *unbits > 0 ) { @@ -303,7 +303,7 @@ void transf_cdbk_enc_fx( test(); test(); test(); - IF(NE_16(st_fx->coder_type,INACTIVE) && LE_32(st_fx->core_brate_fx, MAX_BRATE_AVQ_EXC_TD) && GE_32(st_fx->core_brate_fx, MIN_BRATE_AVQ_EXC) && !harm_flag_acelp) + IF(NE_16(st_fx->coder_type,INACTIVE) && LE_32(st_fx->core_brate, MAX_BRATE_AVQ_EXC_TD) && GE_32(st_fx->core_brate, MIN_BRATE_AVQ_EXC) && !harm_flag_acelp) { Copy( x_tran, code_preQ, L_SUBFR ); } @@ -323,13 +323,13 @@ void transf_cdbk_enc_fx( *--------------------------------------------------------------*/ /* in extreme cases at subframe boundaries, lower the preemphasis memory to avoid a saturation */ test(); - if( (nq[7] != 0) && (GT_16( sub(st_fx->last_nq_preQ_fx, nq[0]), 7))) + if( (nq[7] != 0) && (GT_16( sub(st_fx->last_nq_preQ, nq[0]), 7))) { /* *mem_preemp /= 16; */ st_fx->mem_preemp_preQ_fx = shr(st_fx->mem_preemp_preQ_fx,4); move16(); } - st_fx->last_nq_preQ_fx = nq[7]; + st_fx->last_nq_preQ = nq[7]; move16(); #ifdef IVAS_CODE /* TD pre-quantizer: in extreme cases at subframe boundaries, lower the preemphasis memory to avoid a saturation */ diff --git a/lib_enc/enc_nelp_fx.c b/lib_enc/enc_nelp_fx.c index 4dee03b80..01b5113f9 100644 --- a/lib_enc/enc_nelp_fx.c +++ b/lib_enc/enc_nelp_fx.c @@ -18,7 +18,7 @@ /* PURPOSE : Encode Unvoiced frames in SC-VBR */ /*------------------------------------------------------------------------------*/ /* INPUT ARGUMENTS : */ -/* _ (Encoder_State_fx) st_fx: state structure */ +/* _ (Encoder_State) st_fx: state structure */ /* _ (Word16[]) speech_fx : input speech Q_new-1 */ /* _ (Word16[]) Aq_fx : 12k8 Lp coefficient Q12 */ /* _ (Word16[]) A_fx : unquantized A(z) filter */ @@ -43,7 +43,7 @@ /* _ None */ /*==============================================================================*/ void encod_nelp_fx( - Encoder_State_fx *st_fx, /* i/o: state structure */ + Encoder_State *st_fx, /* i/o: state structure */ const Word16 *speech_fx, /* i : input speech */ const Word16 Aw_fx[], /* i : weighted A(z) unquantized for subframes */ const Word16 Aq_fx[], /* i : 12k8 Lp coefficient */ @@ -73,7 +73,7 @@ void encod_nelp_fx( LPD_state_HANDLE hLPDmem = st_fx->hLPDmem; SC_VBR_ENC_HANDLE hSC_VBR = st_fx->hSC_VBR; - IF ( EQ_16(st_fx->bwidth_fx, NB)&&GE_32(st_fx->input_Fs_fx,16000)) + IF ( EQ_16(st_fx->bwidth, NB)&&GE_32(st_fx->input_Fs,16000)) { IF (hSC_VBR->last_nelp_mode == 0) { @@ -108,7 +108,7 @@ void encod_nelp_fx( IF (i_subfr == 0) { test(); - IF ( EQ_16(hSC_VBR->Local_VAD, 1 ) && EQ_16(st_fx->bwidth_fx,NB)) + IF ( EQ_16(hSC_VBR->Local_VAD, 1 ) && EQ_16(st_fx->bwidth,NB)) { reduce_gains = 1; } diff --git a/lib_enc/enc_pit_exc_fx.c b/lib_enc/enc_pit_exc_fx.c index e6e9fc0a9..ceb64bad2 100644 --- a/lib_enc/enc_pit_exc_fx.c +++ b/lib_enc/enc_pit_exc_fx.c @@ -48,7 +48,7 @@ /* _ None */ /*=======================================================================*/ void enc_pit_exc_fx( - Encoder_State_fx *st_fx, /* i/o: State structure */ + Encoder_State *st_fx, /* i/o: State structure */ const Word16 *speech, /* i : Input speech */ const Word16 Aw[], /* i : weighted A(z) unquantized for subframes */ const Word16 Aq[], /* i : 12k8 Lp coefficient */ @@ -120,12 +120,12 @@ void enc_pit_exc_fx( Pitch_CT = GENERIC; move16(); - IF (st_fx->GSC_IVAS_mode > 0 && (st_fx->GSC_noisy_speech_fx || GT_32(st_fx->core_brate_fx, GSC_H_RATE_STG))) + IF (st_fx->GSC_IVAS_mode > 0 && (st_fx->GSC_noisy_speech || GT_32(st_fx->core_brate, GSC_H_RATE_STG))) { Local_BR = ACELP_8k00; Pitch_BR = ACELP_8k00; move32();move32(); - IF (EQ_16(st_fx->L_frame_fx, L_FRAME16k)) + IF (EQ_16(st_fx->L_frame, L_FRAME16k)) { Local_BR = ACELP_14k80; move32(); @@ -134,11 +134,11 @@ void enc_pit_exc_fx( Local_BR = ACELP_9k60; move32(); } - Pitch_BR = st_fx->core_brate_fx; + Pitch_BR = st_fx->core_brate; move32(); } } - ELSE IF( st_fx->GSC_noisy_speech_fx ) + ELSE IF( st_fx->GSC_noisy_speech ) { Local_BR = ACELP_7k20; move32(); @@ -146,9 +146,9 @@ void enc_pit_exc_fx( move32(); Pitch_CT = GENERIC; move16(); - if (EQ_16(st_fx->L_frame_fx, L_FRAME16k)) + if (EQ_16(st_fx->L_frame, L_FRAME16k)) { - Pitch_BR = st_fx->core_brate_fx; + Pitch_BR = st_fx->core_brate; move32(); } } @@ -157,12 +157,12 @@ void enc_pit_exc_fx( Local_BR = ACELP_7k20; move32(); - Pitch_BR = st_fx->core_brate_fx; + Pitch_BR = st_fx->core_brate; move32(); Pitch_CT = AUDIO; move16(); - if (EQ_16(st_fx->L_frame_fx, L_FRAME16k)) + if (EQ_16(st_fx->L_frame, L_FRAME16k)) { Local_BR = ACELP_13k20; move32(); @@ -173,7 +173,7 @@ void enc_pit_exc_fx( gain_code = 0; move16(); - IF (EQ_16(st_fx->L_frame_fx, L_FRAME16k)) + IF (EQ_16(st_fx->L_frame, L_FRAME16k)) { T0_max = PIT16k_MAX; T0_min = PIT16k_MIN; @@ -188,14 +188,14 @@ void enc_pit_exc_fx( cum_gpit = 0; move16(); - L_subfr = mult_r(st_fx->L_frame_fx,div_s(1,nb_subfr)); + L_subfr = mult_r(st_fx->L_frame,div_s(1,nb_subfr)); lp_flag = st_fx->acelp_cfg.ltf_mode; test();test();test();test();test();test();test();test(); - IF (((GE_32(st_fx->core_brate_fx, MIN_RATE_FCB) || (EQ_16(st_fx->GSC_noisy_speech_fx, 1) && - ((EQ_16(st_fx->L_frame_fx, L_FRAME) && GE_32(st_fx->core_brate_fx, ACELP_13k20)) || - (EQ_16(st_fx->L_frame_fx, L_FRAME16k) && GE_32(st_fx->core_brate_fx, GSC_H_RATE_STG)) || st_fx->GSC_IVAS_mode == 0))) && EQ_16(L_subfr, L_SUBFR))) + IF (((GE_32(st_fx->core_brate, MIN_RATE_FCB) || (EQ_16(st_fx->GSC_noisy_speech, 1) && + ((EQ_16(st_fx->L_frame, L_FRAME) && GE_32(st_fx->core_brate, ACELP_13k20)) || + (EQ_16(st_fx->L_frame, L_FRAME16k) && GE_32(st_fx->core_brate, GSC_H_RATE_STG)) || st_fx->GSC_IVAS_mode == 0))) && EQ_16(L_subfr, L_SUBFR))) { use_fcb = 1; move16(); @@ -227,7 +227,7 @@ void enc_pit_exc_fx( p_Aq = Aq; pt_pitch = pitch_buf; /* pointer to the pitch buffer */ shift_wsp = add(Q_new,shift); - FOR ( i_subfr = 0; i_subfr < st_fx->L_frame_fx; i_subfr += L_subfr ) + FOR ( i_subfr = 0; i_subfr < st_fx->L_frame; i_subfr += L_subfr ) { /*----------------------------------------------------------------* @@ -255,7 +255,7 @@ void enc_pit_exc_fx( * Close-loop pitch search and quantization * Adaptive exc. construction *----------------------------------------------------------------*/ - *pt_pitch = pit_encode_fx(hBstr, st_fx->acelp_cfg.pitch_bits, Pitch_BR, 0, st_fx->L_frame_fx, Pitch_CT, &pitch_limit_flag, i_subfr, exc, + *pt_pitch = pit_encode_fx(hBstr, st_fx->acelp_cfg.pitch_bits, Pitch_BR, 0, st_fx->L_frame, Pitch_CT, &pitch_limit_flag, i_subfr, exc, L_subfr, st_fx->pitch_fx, &T0_min, &T0_max, T0, T0_frac, h1, xn, tdm_Pitch_reuse_flag, tdm_Pri_pitch_buf); /*-----------------------------------------------------------------* * Find adaptive exitation @@ -267,7 +267,7 @@ void enc_pit_exc_fx( * or in case of floating point encoder & fixed p. decoder *-----------------------------------------------------------------*/ - clip_gain = gp_clip_fx(st_fx->element_mode, st_fx->core_brate_fx, st_fx->voicing_fx, i_subfr, AUDIO, xn, st_fx->clip_var_fx,sub(shift_wsp, 1)); + clip_gain = gp_clip_fx(st_fx->element_mode, st_fx->core_brate, st_fx->voicing_fx, i_subfr, AUDIO, xn, st_fx->clip_var_fx,sub(shift_wsp, 1)); /*-----------------------------------------------------------------* * Codebook target computation @@ -275,7 +275,7 @@ void enc_pit_exc_fx( *-----------------------------------------------------------------*/ lp_select = lp_filt_exc_enc_fx( MODE1, AUDIO, i_subfr, exc, h1, - xn, y1, xn2, L_subfr, st_fx->L_frame_fx, g_corr, clip_gain, &gain_pit, &lp_flag ); + xn, y1, xn2, L_subfr, st_fx->L_frame, g_corr, clip_gain, &gain_pit, &lp_flag ); IF( EQ_16(lp_flag,NORMAL_OPERATION)) { @@ -301,7 +301,7 @@ void enc_pit_exc_fx( IF(use_fcb == 0) { - IF (GE_32(st_fx->core_brate_fx, MIN_RATE_FCB)) + IF (GE_32(st_fx->core_brate, MIN_RATE_FCB)) { pit_idx = vquant_fx(&gain_pit, mean_gp_fx, &gain_pit, dic_gp_fx, 1, 32); push_indice_fx(hBstr, IND_PIT_IDX, pit_idx, 5); @@ -318,7 +318,7 @@ void enc_pit_exc_fx( * Innovation encoding *-----------------------------------------------------------------*/ - inov_encode_fx(st_fx, st_fx->core_brate_fx, 0, st_fx->L_frame_fx, st_fx->last_L_frame_fx, GENERIC, st_fx->bwidth_fx, 0, i_subfr, -1, p_Aq, + inov_encode_fx(st_fx, st_fx->core_brate, 0, st_fx->L_frame, st_fx->last_L_frame, GENERIC, st_fx->bwidth, 0, i_subfr, -1, p_Aq, gain_pit, cn, exc, h2, st_fx->hLPDmem->tilt_code, *pt_pitch, xn2, code, y2, &unbits_PI, 2 * L_SUBFR, shift); //PMT("code to be validated") /*-----------------------------------------------------------------* @@ -333,7 +333,7 @@ void enc_pit_exc_fx( * Innovation & gain encoding *-----------------------------------------------------------------*/ - inov_encode_fx(st_fx, Local_BR, 0, st_fx->L_frame_fx, st_fx->last_L_frame_fx, LOCAL_CT, WB, 1, i_subfr, -1, p_Aq, + inov_encode_fx(st_fx, Local_BR, 0, st_fx->L_frame, st_fx->last_L_frame, LOCAL_CT, WB, 1, i_subfr, -1, p_Aq, gain_pit, cn, exc, h2, hLPDmem->tilt_code, *pt_pitch, xn2, code, y2, &unbits_PI, L_SUBFR, shift); /*-----------------------------------------------------------------* * Gain encoding @@ -341,7 +341,7 @@ void enc_pit_exc_fx( gain_enc_mless_fx(hBstr, st_fx->acelp_cfg.gains_mode, st_fx->element_mode, L_FRAME, i_subfr, -1, xn, y1, shift_wsp, y2, code, Es_pred, &gain_pit, &gain_code, &gain_inov, &norm_gain_code, g_corr, clip_gain); } - gp_clip_test_gain_pit_fx(st_fx->element_mode, st_fx->core_brate_fx, gain_pit, st_fx->clip_var_fx ); + gp_clip_test_gain_pit_fx(st_fx->element_mode, st_fx->core_brate, gain_pit, st_fx->clip_var_fx ); Lgcode = L_shl(gain_code, Q_new); /* scaled gain_code with Qnew -> Q16*/ gcode16 = round_fx(Lgcode); diff --git a/lib_enc/enc_ppp_fx.c b/lib_enc/enc_ppp_fx.c index da31fa71d..2b2f7d90c 100644 --- a/lib_enc/enc_ppp_fx.c +++ b/lib_enc/enc_ppp_fx.c @@ -34,13 +34,13 @@ void E_LPC_f_lsp_a_conversion(const Word16 *lsp, Word16 *a, const Word16 m); /* _ (Word16) *exc2_fx, o : current enhanced excitation Q0 */ /* _ (Word16) *pitch_buf_fx, o : floating pitch values for each subframe Q6 */ /* _ (Word16) *synth_fx, o : core synthesis Q-1 */ -/* _ Encoder_State_fx *st_fx: */ +/* _ Encoder_State *st_fx: */ /* _ lastLgainE_fx - Q11 */ /* _ lastHgainE_fx - Q11 */ /* _ lasterbE_fx - Q13 */ /*---------------------------------------------------------------------------------------*/ /* INPUT/OUTPUT ARGUMENTS : */ -/* _ Encoder_State_fx *st_fx: */ +/* _ Encoder_State *st_fx: */ /* _ st_fx->dtfs_enc_xxxx */ /* _ a nd b in st_fx->dtfs_enc_Q */ /* rest all in Q0 */ @@ -53,7 +53,7 @@ void E_LPC_f_lsp_a_conversion(const Word16 *lsp, Word16 *a, const Word16 m); /* CALLED FROM : TX */ /*=======================================================================================*/ ivas_error encod_ppp_fx( - Encoder_State_fx* st_fx, /* i/o: state structure */ + Encoder_State* st_fx, /* i/o: state structure */ const Word16 speech_fx[], /* i : input speech Q_new*/ const Word16 Aw_fx[], /* i : weighted A(z) unquantized for subframes */ const Word16 Aq_fx[], /* i : 12k8 Lp coefficient */ @@ -126,7 +126,7 @@ ivas_error encod_ppp_fx( /* last frame-end lpc and curr frame-end lpc */ - IF((error = ppp_voiced_encoder_fx(hBstr, hSC_VBR, st_fx->bwidth_fx, st_fx->last_coder_type_raw_fx, st_fx->old_pitch_buf_fx, res_fx, + IF((error = ppp_voiced_encoder_fx(hBstr, hSC_VBR, st_fx->bwidth, st_fx->last_coder_type_raw, st_fx->old_pitch_buf_fx, res_fx, excQ_ppp_fx, st_fx->pitch_fx[1], LPC_de_old_fx, LPC_de_curr_fx, exc_fx, pitch_fx, Q_new)) != IVAS_ERR_OK) { return error; @@ -146,11 +146,11 @@ ivas_error encod_ppp_fx( * Gain clipping test to avoid unstable synthesis on frame erasure * or in case of floating point encoder & fixed p. decoder *-----------------------------------------------------------------*/ - gp_clip_fx(st_fx->element_mode, st_fx->core_brate_fx, st_fx->voicing_fx, i_subfr, st_fx->coder_type, xn_fx, st_fx->clip_var_fx, sub(shift_wsp,1)); + gp_clip_fx(st_fx->element_mode, st_fx->core_brate, st_fx->voicing_fx, i_subfr, st_fx->coder_type, xn_fx, st_fx->clip_var_fx, sub(shift_wsp,1)); /* run the above to maintain gain clipping memories */ - gp_clip_test_gain_pit_fx(st_fx->element_mode, st_fx->core_brate_fx, hSC_VBR->prev_ppp_gain_pit_fx, st_fx->clip_var_fx ); + gp_clip_test_gain_pit_fx(st_fx->element_mode, st_fx->core_brate, hSC_VBR->prev_ppp_gain_pit_fx, st_fx->clip_var_fx ); /*-----------------------------------------------------------------* @@ -172,7 +172,7 @@ ivas_error encod_ppp_fx( /* PPP failed, bump up */ hSC_VBR->ppp_mode = 0; move16(); - st_fx->core_brate_fx = ACELP_7k20; + st_fx->core_brate = ACELP_7k20; move16(); hSC_VBR->pppcountE = 0; move16(); diff --git a/lib_enc/enc_prm_fx.c b/lib_enc/enc_prm_fx.c index f8a51682a..ab499b0e3 100644 --- a/lib_enc/enc_prm_fx.c +++ b/lib_enc/enc_prm_fx.c @@ -19,7 +19,7 @@ static void enc_prm_hm( Word16 *prm_hm, - Encoder_State_fx *st, + Encoder_State *st, Word16 L_frame ) { @@ -64,7 +64,7 @@ static void enc_prm_hm( * encode RF parameters for ACELP and TCX partial copy * *-----------------------------------------------------------------*/ -void enc_prm_rf_fx( Encoder_State_fx *st, +void enc_prm_rf_fx( Encoder_State *st, const Word16 rf_frame_type, const Word16 fec_offset ) @@ -247,7 +247,7 @@ void enc_prm_fx( const Word16 coder_type, /* (i) : coding type */ Word16 param[], /* (i) : parameters */ Word16 param_lpc[], /* (i) : LPC parameters */ - Encoder_State_fx *st, /* i/o : quantization Analysis values */ + Encoder_State *st, /* i/o : quantization Analysis values */ Word16 L_frame, CONTEXT_HM_CONFIG hm_cfg[] ,Word16 * bits_param_lpc, @@ -296,8 +296,8 @@ void enc_prm_fx( move16(); move16(); nb_subfr = st->nb_subfr; - core = st->core_fx; - last_core = st->last_core_fx; + core = st->core; + last_core = st->last_core; /* Initialize pointers */ move16(); @@ -332,17 +332,17 @@ void enc_prm_fx( index = 3; move16(); test(); - IF( EQ_16(st->clas_fx, UNVOICED_CLAS)) + IF( EQ_16(st->clas, UNVOICED_CLAS)) { index = 0; move16(); } - ELSE IF( (EQ_16(st->clas_fx, VOICED_TRANSITION))||(EQ_16(st->clas_fx,UNVOICED_TRANSITION))) + ELSE IF( (EQ_16(st->clas, VOICED_TRANSITION))||(EQ_16(st->clas,UNVOICED_TRANSITION))) { index = 1; move16(); } - ELSE IF( EQ_16(st->clas_fx, VOICED_CLAS)) + ELSE IF( EQ_16(st->clas, VOICED_CLAS)) { index = 2; move16(); @@ -359,7 +359,7 @@ void enc_prm_fx( { /* find the section in the ACELP signalling table corresponding to bitrate */ idx = 0; - WHILE ( NE_32(acelp_sig_tbl[idx],st->total_brate_fx)) /* total bitrate is kept at 13.2kbps */ + WHILE ( NE_32(acelp_sig_tbl[idx],st->total_brate)) /* total bitrate is kept at 13.2kbps */ { idx = add(idx,1); } @@ -370,7 +370,7 @@ void enc_prm_fx( /* retrieve the signalling index */ idx = add(idx,1); start_idx = idx; - tmp32 = SIG2IND_fx(coder_type, st->bwidth_fx, st->sharpFlag, st->rf_mode); + tmp32 = SIG2IND_fx(coder_type, st->bwidth, st->sharpFlag, st->rf_mode); WHILE( NE_32(acelp_sig_tbl[idx], tmp32)) { idx = add(idx,1); @@ -406,7 +406,7 @@ void enc_prm_fx( { /* find the section in the ACELP signalling table corresponding to bitrate */ idx = 0; - WHILE (NE_32(acelp_sig_tbl[idx],st->total_brate_fx)) + WHILE (NE_32(acelp_sig_tbl[idx],st->total_brate)) { idx = add(idx,1); } @@ -430,7 +430,7 @@ void enc_prm_fx( /* retrieve the signalling index */ idx = add(idx,1); start_idx = idx; - tmp32 = SIG2IND_fx(st->hTcxCfg->coder_type, st->bwidth_fx, st->sharpFlag, st->rf_mode); + tmp32 = SIG2IND_fx(st->hTcxCfg->coder_type, st->bwidth, st->sharpFlag, st->rf_mode); WHILE( NE_32(acelp_sig_tbl[idx], tmp32)) { idx = add(idx,1); @@ -505,7 +505,7 @@ void enc_prm_fx( test(); test(); test(); - if (core != ACELP_CORE || EQ_16(coder_type,INACTIVE)||(st->last_core_fx==ACELP_CORE&&EQ_16(st->last_coder_type_raw_fx,INACTIVE))||st->glr_reset!=0) + if (core != ACELP_CORE || EQ_16(coder_type,INACTIVE)||(st->last_core==ACELP_CORE&&EQ_16(st->last_coder_type_raw,INACTIVE))||st->glr_reset!=0) { st->glr_idx[0] = 0; move16(); @@ -545,7 +545,7 @@ void enc_prm_fx( move16(); } - nbits_lpc = encode_lpc_avq_fx(hBstr, numlpc, param_lpc, st->core_fx, st->element_mode); + nbits_lpc = encode_lpc_avq_fx(hBstr, numlpc, param_lpc, st->core, st->element_mode); } ELSE IF (EQ_16(st->lpcQuantization, 1)) { @@ -742,7 +742,7 @@ void enc_prm_fx( { st->hIGFEnc->infoTotalBitsPerFrameWritten = 0; move16(); - IF (EQ_16(st->last_core_fx, ACELP_CORE)) + IF (EQ_16(st->last_core, ACELP_CORE)) { IGFEncWriteBitstream_fx( st->hIGFEnc, hBstr, &st->hIGFEnc->infoTotalBitsPerFrameWritten, IGF_GRID_LB_TRAN, 1 ); } diff --git a/lib_enc/enc_tran_fx.c b/lib_enc/enc_tran_fx.c index ac6d6e3bf..dad3acf3b 100644 --- a/lib_enc/enc_tran_fx.c +++ b/lib_enc/enc_tran_fx.c @@ -34,7 +34,7 @@ /* (Word16*) voice_factors : voicing factors Q15 */ /*---------------------------------------------------------------------------------*/ /* INPUT/OUTPUT ARGUMENTS : */ -/* Encoder_State_fx *st_fx :Encoder state structure */ +/* Encoder_State *st_fx :Encoder state structure */ /* (Word16*) syn_fx :core synthesis Qnew */ /* (Word16*) exc_fx :current non-enhanced excitation Q0 */ /* (Word16*) exc2_fx :current enhanced excitation Q0 */ @@ -46,7 +46,7 @@ /*---------------------------------------------------------------------------------*/ Word16 encod_tran_fx( - Encoder_State_fx *st_fx, /* i/o: state structure */ + Encoder_State *st_fx, /* i/o: state structure */ const Word16 speech_fx[], /* i : input speech */ const Word16 Aw_fx[], /* i : weighted A(z) unquantized for subframes */ const Word16 Aq_fx[], /* i : 12k8 Lp coefficient */ @@ -101,7 +101,7 @@ Word16 encod_tran_fx( SC_VBR_ENC_HANDLE hSC_VBR = st_fx->hSC_VBR; LPD_state_HANDLE hLPDmem = st_fx->hLPDmem; - L_frame_fx = st_fx->L_frame_fx; + L_frame_fx = st_fx->L_frame; move16(); /*------------------------------------------------------------------* * Initializations @@ -179,7 +179,7 @@ Word16 encod_tran_fx( * Transform domain contribution encoding - active frames *-----------------------------------------------------------------*/ - IF( GE_32(st_fx->core_brate_fx, MIN_BRATE_AVQ_EXC)) + IF( GE_32(st_fx->core_brate, MIN_BRATE_AVQ_EXC)) { transf_cdbk_enc_fx( st_fx, 0, i_subfr, cn, exc_fx, p_Aq, Aw_fx, h1, xn, xn2, y1, y2, Es_pred_fx, &gain_pit, gain_code, g_corr, clip_gain, &gain_preQ, code_preQ, unbits, Q_new, shift); @@ -189,13 +189,13 @@ Word16 encod_tran_fx( * ACELP codebook search + pitch sharpening *-----------------------------------------------------------------*/ - inov_encode_fx( st_fx, st_fx->core_brate_fx, 0, L_frame_fx, st_fx->last_L_frame_fx, st_fx->coder_type, st_fx->bwidth_fx, st_fx->sharpFlag, + inov_encode_fx( st_fx, st_fx->core_brate, 0, L_frame_fx, st_fx->last_L_frame, st_fx->coder_type, st_fx->bwidth, st_fx->sharpFlag, i_subfr, tc_subfr, p_Aq, gain_pit, cn, exc_fx, h2_fx, hLPDmem->tilt_code, *pt_pitch, xn2, code, y2, &unbits_PI, L_SUBFR, shift ); test(); test(); test(); - if( (EQ_16(st_fx->L_frame_fx,L_FRAME16k))&&(tc_subfr==0)&&(EQ_16(i_subfr,L_SUBFR))&&(EQ_16(T0,2*L_SUBFR))) + if( (EQ_16(st_fx->L_frame,L_FRAME16k))&&(tc_subfr==0)&&(EQ_16(i_subfr,L_SUBFR))&&(EQ_16(T0,2*L_SUBFR))) { Jopt_flag = 1; move16(); @@ -213,7 +213,7 @@ Word16 encod_tran_fx( } ELSE { - IF ( GT_32(st_fx->core_brate_fx,ACELP_32k)) + IF ( GT_32(st_fx->core_brate,ACELP_32k)) { /* SQ gain_pit and gain_code */ gain_enc_SQ_fx(hBstr, st_fx->acelp_cfg.gains_mode, i_subfr, xn, y1, y2, code, Es_pred_fx, @@ -226,7 +226,7 @@ Word16 encod_tran_fx( &gain_pit, &gain_code, &gain_inov, &norm_gain_code, g_corr, clip_gain ); } } - gp_clip_test_gain_pit_fx(st_fx->element_mode, st_fx->core_brate_fx, gain_pit, st_fx->clip_var_fx ); + gp_clip_test_gain_pit_fx(st_fx->element_mode, st_fx->core_brate, gain_pit, st_fx->clip_var_fx ); #ifdef BASOP_NOGLOB Lgcode = L_shl_o(gain_code, Q_new, &Overflow); /* scaled gain_code with Qnew -> Q16*/ @@ -301,7 +301,7 @@ Word16 encod_tran_fx( * Add the ACELP pre-quantizer contribution *-----------------------------------------------------------------*/ - IF( GE_32(st_fx->core_brate_fx, MIN_BRATE_AVQ_EXC)) + IF( GE_32(st_fx->core_brate, MIN_BRATE_AVQ_EXC)) { tmp1_fx = add(16-(2+Q_AVQ_OUT_DEC+1),Q_new); FOR( i = 0; i < L_SUBFR; i++ ) @@ -332,7 +332,7 @@ Word16 encod_tran_fx( *-----------------------------------------------------------------*/ prep_tbe_exc_fx( L_frame_fx, i_subfr, gain_pit, gain_code, code, voice_fac, &voice_factors[i_subfr/L_SUBFR], - bwe_exc_fx, gain_preQ, code_preQ, Q_new, T0, T0_frac, st_fx->coder_type, st_fx->core_brate_fx ); + bwe_exc_fx, gain_preQ, code_preQ, Q_new, T0, T0_frac, st_fx->coder_type, st_fx->core_brate ); /*-----------------------------------------------------------------* * Synthesize speech to update mem_syn[]. @@ -430,7 +430,7 @@ Word16 encod_tran_fx( } - IF(st_fx->Opt_SC_VBR_fx) + IF(st_fx->Opt_SC_VBR) { /* SC-VBR */ hSC_VBR->prev_ppp_gain_pit_fx = gain_pit; diff --git a/lib_enc/enc_uv_fx.c b/lib_enc/enc_uv_fx.c index 622502d10..1b7bcd264 100644 --- a/lib_enc/enc_uv_fx.c +++ b/lib_enc/enc_uv_fx.c @@ -18,7 +18,7 @@ *-------------------------------------------------------------------*/ /*fixed point implementation of unvoiced_encoder*/ void encod_unvoiced_fx( - Encoder_State_fx *st_fx, /* i/o: state structure */ + Encoder_State *st_fx, /* i/o: state structure */ const Word16 *speech_fx, /* i : Input speech */ const Word16 Aw_fx[], /* i : weighted A(z) unquantized for subframes */ const Word16 *Aq_fx, /* i : 12k8 Lp coefficient */ @@ -75,7 +75,7 @@ void encod_unvoiced_fx( test(); test(); test(); - IF( st_fx->Opt_SC_VBR_fx && st_fx->vad_flag == 0 && (EQ_16(hSC_VBR->last_ppp_mode,1) || EQ_16(hSC_VBR->last_nelp_mode,1))) + IF( st_fx->Opt_SC_VBR && st_fx->vad_flag == 0 && (EQ_16(hSC_VBR->last_ppp_mode,1) || EQ_16(hSC_VBR->last_nelp_mode,1))) { /* SC_VBR - reset the encoder, to avoid memory not updated issue for the case when UNVOICED mode is used to code inactive speech */ @@ -141,7 +141,7 @@ void encod_unvoiced_fx( * Encode the algebraic innovation * *----------------------------------------------------------------------*/ - E_ACELP_innovative_codebook_fx(exc_fx, *pt_pitch_fx, 0, 1, gain_pit_fx, hLPDmem->tilt_code, acelp_cfg, i_subfr, p_Aq_fx, h1_fx, xn_fx, cn_fx, y1, y2_fx, st_fx->acelp_autocorr, &prm, code_fx, shift, st_fx->L_frame_fx, st_fx->last_L_frame_fx, st_fx->total_brate_fx); + E_ACELP_innovative_codebook_fx(exc_fx, *pt_pitch_fx, 0, 1, gain_pit_fx, hLPDmem->tilt_code, acelp_cfg, i_subfr, p_Aq_fx, h1_fx, xn_fx, cn_fx, y1, y2_fx, st_fx->acelp_autocorr, &prm, code_fx, shift, st_fx->L_frame, st_fx->last_L_frame, st_fx->total_brate); E_ACELP_xy2_corr(xn_fx, y1, y2_fx, &g_corr, L_SUBFR, Q_xn); @@ -159,14 +159,14 @@ void encod_unvoiced_fx( *----------------------------------------------------------*/ index = gain_enc_uv_fx(code_fx, code2, L_SUBFR, &gain_pit_fx, &L_gain_code_fx, &gain_code2, - st_fx->flag_noisy_speech_snr, &g_corr, Es_pred, &norm_gain_code_fx, &gain_inov_fx, FUNC_GAIN_ENC_GACELP_UV); + st_fx->flag_noisy_speech_snr_fx, &g_corr, Es_pred, &norm_gain_code_fx, &gain_inov_fx, FUNC_GAIN_ENC_GACELP_UV); #ifdef DEBUGGING assert(st_fx->acelp_cfg.gains_mode[i_subfr_idx] == 7 && "Error: UC two-stage, only 5+2 gain Q is supported"); #endif push_indice_fx(st_fx->hBstr, IND_GAIN, index, st_fx->acelp_cfg.gains_mode[i_subfr_idx]); - gp_clip_test_gain_pit_fx(st_fx->element_mode, st_fx->core_brate_fx, gain_pit_fx, st_fx->clip_var_fx); + gp_clip_test_gain_pit_fx(st_fx->element_mode, st_fx->core_brate, gain_pit_fx, st_fx->clip_var_fx); gain_code_vect[0] = L_gain_code_fx; move32(); diff --git a/lib_enc/eval_pit_contr_fx.c b/lib_enc/eval_pit_contr_fx.c index f66c29876..c73e9fccb 100644 --- a/lib_enc/eval_pit_contr_fx.c +++ b/lib_enc/eval_pit_contr_fx.c @@ -51,7 +51,7 @@ /*=======================================================================*/ Word16 Pit_exc_contribution_len_fx( /* o : bin where pitch contribution is significant */ - Encoder_State_fx *st_fx, /* i/o: state structure */ + Encoder_State *st_fx, /* i/o: state structure */ const Word16 *dct_res, /* i : DCT of residual */ Word16 *dct_pitex, /* i/o: DCT of pitch contribution */ Word16 *pitch_buf, /* i/o: Pitch per subframe */ @@ -83,7 +83,7 @@ Word16 Pit_exc_contribution_len_fx( /* o : bin where pitch contribution is sign BSTR_ENC_HANDLE hBstr = st_fx->hBstr; GSC_ENC_HANDLE hGSCEnc = st_fx->hGSCEnc; - if( EQ_16(st_fx->L_frame_fx,L_FRAME16k)) + if( EQ_16(st_fx->L_frame,L_FRAME16k)) { Mbands_loc = MBANDS_LOC; move16(); @@ -93,7 +93,7 @@ Word16 Pit_exc_contribution_len_fx( /* o : bin where pitch contribution is sign exp1 = norm_s(low_pit); tmp = shl(low_pit,exp1); tmp_dec = 12800; move16(); - if (EQ_16(st_fx->L_frame_fx, L_FRAME16k)) + if (EQ_16(st_fx->L_frame, L_FRAME16k)) { tmp_dec = 16000; move16(); } @@ -173,13 +173,13 @@ Word16 Pit_exc_contribution_len_fx( /* o : bin where pitch contribution is sign move16(); av_corr = round_fx(L_shl(L_mult0(av_corr,6400),16-12)); /*Q14*Q0-12=Q2*/ - if (EQ_16(st_fx->L_frame_fx, L_FRAME16k)) + if (EQ_16(st_fx->L_frame, L_FRAME16k)) { /*av_corr *= 1.25f;*/ av_corr = add(av_corr, shr(av_corr, 2)); } test(); - if (GE_16(st_fx->GSC_IVAS_mode, 1)|| LT_32(st_fx->core_brate_fx, ACELP_9k60)) + if (GE_16(st_fx->GSC_IVAS_mode, 1)|| LT_32(st_fx->core_brate, ACELP_9k60)) { av_corr = shl(av_corr,1); /*Q2 Correlation really poor at low rate, time domain still valide*/ } @@ -213,12 +213,12 @@ Word16 Pit_exc_contribution_len_fx( /* o : bin where pitch contribution is sign test(); test(); test(); - IF( GT_16(last_pit_band,7+BAND1k2)&&(LT_32(st_fx->core_brate_fx,CFREQ_BITRATE)||EQ_16(st_fx->bwidth_fx,NB)))/*Added for 9.1*/ + IF( GT_16(last_pit_band,7+BAND1k2)&&(LT_32(st_fx->core_brate,CFREQ_BITRATE)||EQ_16(st_fx->bwidth,NB)))/*Added for 9.1*/ { last_pit_band = 7+BAND1k2; move16(); } - ELSE IF ( GT_16(last_pit_band,10+BAND1k2)&&GE_32(st_fx->core_brate_fx,CFREQ_BITRATE)) + ELSE IF ( GT_16(last_pit_band,10+BAND1k2)&&GE_32(st_fx->core_brate,CFREQ_BITRATE)) { last_pit_band = add(10,BAND1k2); } @@ -294,24 +294,24 @@ Word16 Pit_exc_contribution_len_fx( /* o : bin where pitch contribution is sign move16(); test(); test(); - IF( EQ_16(time_flg,1) || NE_16(st_fx->coder_type,INACTIVE) || st_fx->GSC_noisy_speech_fx) + IF( EQ_16(time_flg,1) || NE_16(st_fx->coder_type,INACTIVE) || st_fx->GSC_noisy_speech) { test(); test(); - /*if(st_fx->core_brate_fx core_brate_fx,ACELP_9k60) && LT_16(low_pit,4096)) + /*if(st_fx->core_brate core_brate,ACELP_9k60) && LT_16(low_pit,4096)) { last_pit_band = add(9 , BAND1k2); - if(EQ_16(st_fx->bwidth_fx,NB)) + if(EQ_16(st_fx->bwidth,NB)) { last_pit_band = add(7,BAND1k2); } } - ELSE IF(LT_32(st_fx->core_brate_fx,ACELP_9k60) && LT_16(low_pit,8192)) + ELSE IF(LT_32(st_fx->core_brate,ACELP_9k60) && LT_16(low_pit,8192)) { last_pit_band = add(5 , BAND1k2); } - ELSE IF(LT_32(st_fx->core_brate_fx,ACELP_9k60)) + ELSE IF(LT_32(st_fx->core_brate,ACELP_9k60)) { last_pit_band = add(3 , BAND1k2); } @@ -322,12 +322,12 @@ Word16 Pit_exc_contribution_len_fx( /* o : bin where pitch contribution is sign last_pit_bin = mfreq_loc_div_25[last_pit_band]; move16(); - st_fx->bpf_off_fx = 0; + st_fx->bpf_off = 0; move16(); - max_len = sub(st_fx->L_frame_fx,last_pit_bin); + max_len = sub(st_fx->L_frame,last_pit_bin); - if( EQ_16(st_fx->bwidth_fx,NB)) + if( EQ_16(st_fx->bwidth,NB)) { max_len = sub(160,last_pit_bin); } @@ -340,7 +340,7 @@ Word16 Pit_exc_contribution_len_fx( /* o : bin where pitch contribution is sign move16(); } test(); - IF((EQ_32(st_fx->core_brate_fx,ACELP_8k00)) && (NE_16(st_fx->bwidth_fx,NB))) + IF((EQ_32(st_fx->core_brate,ACELP_8k00)) && (NE_16(st_fx->bwidth,NB))) { move16(); /*ptr init*/ FOR (i=0; i < max_len; i++) @@ -368,8 +368,8 @@ Word16 Pit_exc_contribution_len_fx( /* o : bin where pitch contribution is sign } ELSE { - set16_fx(dct_pitex, 0, st_fx->L_frame_fx); - st_fx->bpf_off_fx = 1; + set16_fx(dct_pitex, 0, st_fx->L_frame); + st_fx->bpf_off = 1; move16(); last_pit_bin = 0; move16(); @@ -407,9 +407,9 @@ Word16 Pit_exc_contribution_len_fx( /* o : bin where pitch contribution is sign delete_indice(hBstr, i); #endif } - IF( LT_32(st_fx->core_brate_fx,CFREQ_BITRATE)) + IF( LT_32(st_fx->core_brate,CFREQ_BITRATE)) { - IF(LT_32(st_fx->core_brate_fx,ACELP_9k60)) + IF(LT_32(st_fx->core_brate,ACELP_9k60)) { if(pit_contr_idx>0) { diff --git a/lib_enc/evs_enc_fx.c b/lib_enc/evs_enc_fx.c index f2ad9d07c..922c70501 100644 --- a/lib_enc/evs_enc_fx.c +++ b/lib_enc/evs_enc_fx.c @@ -16,9 +16,9 @@ * Local function prototypes *-------------------------------------------------------------------*/ -static void initFrameHeader_loc( Encoder_State_fx *st ); -static void writeFrameHeader_loc(Encoder_State_fx *st ); -static void configure_core_coder_loc(Encoder_State_fx *st ); +static void initFrameHeader_loc( Encoder_State *st ); +static void writeFrameHeader_loc(Encoder_State *st ); +static void configure_core_coder_loc(Encoder_State *st ); /*-------------------------------------------------------------------* * evs_enc() @@ -27,7 +27,7 @@ static void configure_core_coder_loc(Encoder_State_fx *st ); *-------------------------------------------------------------------*/ ivas_error evs_enc_fx( - Encoder_State_fx *st, /* i/o: encoder state structure */ + Encoder_State *st, /* i/o: encoder state structure */ const Word16 *data, /* i : input signal */ Word32 * mem_hp20_in_fx, /* i/o: hp20 filter memory */ const Word16 n_samples /* i : number of input samples */ @@ -101,15 +101,15 @@ ivas_error evs_enc_fx( input_frame = st->input_frame_fx; move16(); - st->core_fx = -1; + st->core = -1; move16(); - st->extl_fx = -1; + st->extl = -1; move16(); - st->core_brate_fx = -1; + st->core_brate = -1; move32(); - st->input_bwidth_fx = st->last_input_bwidth_fx; + st->input_bwidth = st->last_input_bwidth; move16(); - st->bwidth_fx = st->last_bwidth_fx; + st->bwidth = st->last_bwidth; move16(); hq_core_type = -1; move16(); @@ -131,7 +131,7 @@ ivas_error evs_enc_fx( st->idchan = 0; move16(); - st->flag_ACELP16k = set_ACELP_flag(EVS_MONO, -1, st->total_brate_fx, 0, 0, -1, -1); + st->flag_ACELP16k = set_ACELP_flag(EVS_MONO, -1, st->total_brate, 0, 0, -1, -1); move16(); @@ -140,31 +140,31 @@ ivas_error evs_enc_fx( *----------------------------------------------------------------*/ /* get delay to synchronize ACELP and MDCT frame */ - delay = NS2SA_fx2(st->input_Fs_fx, DELAY_FIR_RESAMPL_NS); + delay = NS2SA_fx2(st->input_Fs, DELAY_FIR_RESAMPL_NS); - Copy( st->input - delay, st->old_input_signal_fx, input_frame+delay ); + Copy( st->input_fx - delay, st->old_input_signal_fx, input_frame+delay ); /*----------------------------------------------------------------* * convert 'short' input data to 'float' *----------------------------------------------------------------*/ - Copy(data, st->input, input_frame); + Copy(data, st->input_fx, input_frame); IF( LT_16(n_samples,input_frame)) { - set16_fx( st->input + n_samples, 0, sub(input_frame, n_samples) ); + set16_fx( st->input_fx + n_samples, 0, sub(input_frame, n_samples) ); } /*----------------------------------------------------------------* * HP filtering *----------------------------------------------------------------*/ - hp20( st->input, 1, input_frame, mem_hp20_in_fx, st->input_Fs_fx ); + hp20( st->input_fx, 1, input_frame, mem_hp20_in_fx, st->input_Fs ); /*----------------------------------------------------------------* * Updates in case of AMR-WB IO mode -> EVS primary mode switching *----------------------------------------------------------------*/ - IF( EQ_16(st->last_core_fx, AMR_WB_CORE)) + IF( EQ_16(st->last_core, AMR_WB_CORE)) { updt_IO_switch_enc_fx( st, input_frame ); set16_fx(hBWE_TD->old_speech_shb_fx, 0, L_LOOK_16k + L_SUBFR16k); @@ -180,8 +180,8 @@ PMT("find scaling factor for prev_enr_EnvSHBres, prev_pow_exc16kWhtnd and prev_m st->hBWE_TD->prev_mix_factor = 1.0f; st->hBWE_TD->prev_Env_error = 0; #endif - cldfb_reset_memory( st->cldfbAna_Fx ); - cldfb_reset_memory( st->cldfbSyn_Fx ); + cldfb_reset_memory( st->cldfbAnaEnc ); + cldfb_reset_memory( st->cldfbSynTd ); } /*---------------------------------------------------------------------* @@ -200,7 +200,7 @@ PMT("find scaling factor for prev_enr_EnvSHBres, prev_pow_exc16kWhtnd and prev_m IF (EQ_16(st->mdct_sw,MODE2)) { - Mpy_32_16_ss(st->total_brate_fx, 5243, &L_tmp, &lsb); /* 5243 is 1/50 in Q18. (0+18-15=3) */ + Mpy_32_16_ss(st->total_brate, 5243, &L_tmp, &lsb); /* 5243 is 1/50 in Q18. (0+18-15=3) */ st->bits_frame_nominal = extract_l(L_shr(L_tmp, 3)); /* Q0 */ initFrameHeader_loc( st ); @@ -209,9 +209,9 @@ PMT("find scaling factor for prev_enr_EnvSHBres, prev_pow_exc16kWhtnd and prev_m test(); test(); test(); - IF ((GT_32(st->total_brate_fx,ACELP_24k40)&<_32(st->total_brate_fx,HQ_96k))||(EQ_32(st->total_brate_fx,ACELP_24k40)&&GE_16(st->bwidth_fx,WB))) + IF ((GT_32(st->total_brate,ACELP_24k40)&<_32(st->total_brate,HQ_96k))||(EQ_32(st->total_brate,ACELP_24k40)&&GE_16(st->bwidth,WB))) { - st->L_frame_fx = L_FRAME16k; + st->L_frame = L_FRAME16k; move16(); st->gamma = GAMMA16k; move16(); @@ -220,7 +220,7 @@ PMT("find scaling factor for prev_enr_EnvSHBres, prev_pow_exc16kWhtnd and prev_m weight_a_subfr_fx( NB_SUBFR16k, A, Aw, GAMMA16k, M ); test(); - IF (EQ_16(st->last_L_frame_fx,L_FRAME)&&st->ini_frame_fx!=0) + IF (EQ_16(st->last_L_frame,L_FRAME)&&st->ini_frame!=0) { /* this is just an approximation, but it is sufficient */ Copy( st->lsp_old1_fx, st->lspold_enc_fx, M ); @@ -228,7 +228,7 @@ PMT("find scaling factor for prev_enr_EnvSHBres, prev_pow_exc16kWhtnd and prev_m } ELSE { - st->L_frame_fx = L_FRAME; + st->L_frame = L_FRAME; move16(); st->gamma = GAMMA1; move16(); @@ -236,8 +236,8 @@ PMT("find scaling factor for prev_enr_EnvSHBres, prev_pow_exc16kWhtnd and prev_m move16(); } - st->sr_core = L_mult0(FRAMES_PER_SEC,st->L_frame_fx); - st->core_brate_fx = st->total_brate_fx; + st->sr_core = L_mult0(FRAMES_PER_SEC,st->L_frame); + st->core_brate = st->total_brate; move32(); st->igf = 0; @@ -246,13 +246,13 @@ PMT("find scaling factor for prev_enr_EnvSHBres, prev_pow_exc16kWhtnd and prev_m move16(); test(); test(); - IF( (EQ_16(st->bwidth_fx,SWB)||EQ_16(st->bwidth_fx,WB))&&LE_32(st->total_brate_fx,LRMDCT_CROSSOVER_POINT)) + IF( (EQ_16(st->bwidth,SWB)||EQ_16(st->bwidth,WB))&&LE_32(st->total_brate,LRMDCT_CROSSOVER_POINT)) { /* note that FB (bitrate >= 24400bps) is always coded with NORMAL_HQ_CORE */ hq_core_type = LOW_RATE_HQ_CORE; move16(); } - ELSE IF( EQ_16(st->bwidth_fx,NB)) + ELSE IF( EQ_16(st->bwidth,NB)) { hq_core_type = LOW_RATE_HQ_CORE; move16(); @@ -277,7 +277,7 @@ PMT("find scaling factor for prev_enr_EnvSHBres, prev_pow_exc16kWhtnd and prev_m * ACELP core encoding *---------------------------------------------------------------------*/ - IF( EQ_16(st->core_fx,ACELP_CORE)) + IF( EQ_16(st->core,ACELP_CORE)) { acelp_core_enc_fx( st, inp, ener, A, Aw, epsP_h, epsP_l, lsp_new, lsp_mid, vad_hover_flag, attack_flag, bwe_exc_extended, voice_factors, old_syn_12k8_16k, pitch_buf, &unbits, Q_new, shift @@ -290,9 +290,9 @@ PMT("find scaling factor for prev_enr_EnvSHBres, prev_pow_exc16kWhtnd and prev_m * HQ core encoding *---------------------------------------------------------------------*/ - IF( EQ_16(st->core_fx,HQ_CORE)) + IF( EQ_16(st->core,HQ_CORE)) { - hq_core_enc_fx( st, st->input - delay, input_frame, hq_core_type, Voicing_flag, vad_hover_flag); + hq_core_enc_fx( st, st->input_fx - delay, input_frame, hq_core_type, Voicing_flag, vad_hover_flag); } /*---------------------------------------------------------------------* @@ -300,7 +300,7 @@ PMT("find scaling factor for prev_enr_EnvSHBres, prev_pow_exc16kWhtnd and prev_m *---------------------------------------------------------------------*/ core_switching_post_enc_fx( st, old_inp_12k8, old_inp_16k, A, shift, Q_new, st->Q_syn2, &Q_synth ); #ifndef FIX_I4_OL_PITCH - IF (EQ_16(st->core_fx, HQ_CORE)) + IF (EQ_16(st->core, HQ_CORE)) { Copy(pitch_orig, st->pitch_fx, 3); /* original open-loop pitch values might be altered in core_acelp_tcx20_switching_fx() */ } @@ -337,44 +337,44 @@ PMT("find scaling factor for prev_enr_EnvSHBres, prev_pow_exc16kWhtnd and prev_m *---------------------------------------------------------------------*/ /* TBE interface */ test(); - IF ( st->igf != 0 && GT_32(st->core_brate_fx,SID_2k40)) + IF ( st->igf != 0 && GT_32(st->core_brate,SID_2k40)) { - IF( EQ_16(st->core_fx,ACELP_CORE)) + IF( EQ_16(st->core,ACELP_CORE)) { - SWITCH (st->bwidth_fx) + SWITCH (st->bwidth) { case WB: - st->extl_fx = WB_TBE; + st->extl = WB_TBE; move16(); - st->extl_brate_fx = WB_TBE_0k35; + st->extl_brate = WB_TBE_0k35; move32(); BREAK; case SWB: - st->extl_fx = SWB_TBE; + st->extl = SWB_TBE; move16(); - st->extl_brate_fx = SWB_TBE_1k6; + st->extl_brate = SWB_TBE_1k6; move32(); - IF (LT_32(st->total_brate_fx, ACELP_13k20)) + IF (LT_32(st->total_brate, ACELP_13k20)) { - st->extl_brate_fx = SWB_TBE_0k95; + st->extl_brate = SWB_TBE_0k95; move32(); } - ELSE IF (GE_32(st->total_brate_fx, ACELP_24k40)) + ELSE IF (GE_32(st->total_brate, ACELP_24k40)) { - st->extl_brate_fx = SWB_TBE_2k8; + st->extl_brate = SWB_TBE_2k8; move32(); } BREAK; case FB: - st->extl_fx = FB_TBE; + st->extl = FB_TBE; move16(); - st->extl_brate_fx = FB_TBE_1k8; + st->extl_brate = FB_TBE_1k8; move32(); - if (GE_32(st->total_brate_fx, ACELP_24k40)) + if (GE_32(st->total_brate, ACELP_24k40)) { - st->extl_brate_fx = FB_TBE_3k0; + st->extl_brate = FB_TBE_3k0; move32(); } BREAK; @@ -384,18 +384,18 @@ PMT("find scaling factor for prev_enr_EnvSHBres, prev_pow_exc16kWhtnd and prev_m { st->coder_type = -1; move16(); - st->extl_fx = IGF_BWE; + st->extl = IGF_BWE; move16(); - st->extl_brate_fx = 0; + st->extl_brate = 0; move32(); } - st->core_brate_fx = L_sub(st->total_brate_fx, st->extl_brate_fx); + st->core_brate = L_sub(st->total_brate, st->extl_brate); IF( EQ_16(st->tec_tfa, 1)) { - st->core_brate_fx = L_sub(st->core_brate_fx, BITS_TEC); - st->core_brate_fx = L_sub(st->core_brate_fx, BITS_TFA); + st->core_brate = L_sub(st->core_brate, BITS_TEC); + st->core_brate = L_sub(st->core_brate, BITS_TFA); } } @@ -407,10 +407,10 @@ PMT("find scaling factor for prev_enr_EnvSHBres, prev_pow_exc16kWhtnd and prev_m test(); test(); - IF( st->igf != 0 && EQ_16(st->core_fx,ACELP_CORE)&>_32(st->core_brate_fx,SID_2k40)) + IF( st->igf != 0 && EQ_16(st->core,ACELP_CORE)&>_32(st->core_brate,SID_2k40)) { /* padBits = ((st->bits_frame+7)/8)*8 - (st->nb_bits_tot + (st->rf_target_bits_write - ((st->Opt_RF_ON==1)?1:0) ) + get_tbe_bits(st->total_brate, st->bwidth, st->rf_mode )); */ - tmp = add(get_tbe_bits_fx(st->total_brate_fx, st->bwidth_fx, st->rf_mode), sub(st->rf_target_bits_write, st->rf_mode)); + tmp = add(get_tbe_bits_fx(st->total_brate, st->bwidth, st->rf_mode), sub(st->rf_target_bits_write, st->rf_mode)); padBits = sub(sub(shl(shr(add(st->bits_frame,7),3),3), hBstr->nb_bits_tot_fx), tmp); } ELSE @@ -433,14 +433,14 @@ PMT("find scaling factor for prev_enr_EnvSHBres, prev_pow_exc16kWhtnd and prev_m *---------------------------------------------------------------------*/ test(); - IF ( GE_32(st->input_Fs_fx,16000 )&&(LT_16(st->bwidth_fx,SWB))) + IF ( GE_32(st->input_Fs,16000 )&&(LT_16(st->bwidth,SWB))) { /* Common pre-processing for WB TBE and WB BWE */ wb_pre_proc_fx( st, new_inp_resamp16k, hb_speech ); /* o: new_inp_resamp16k at Q = -1 */ } - IF ( EQ_16(st->extl_fx,WB_TBE)) + IF ( EQ_16(st->extl,WB_TBE)) { /* WB TBE encoder */ wb_tbe_enc_fx( st, st->coder_type, hb_speech, bwe_exc_extended, Q_new, voice_factors, pitch_buf, st->voicing_fx); @@ -450,7 +450,7 @@ PMT("find scaling factor for prev_enr_EnvSHBres, prev_pow_exc16kWhtnd and prev_m tbe_write_bitstream_fx( st ); } } - ELSE IF ( EQ_16(st->extl_fx, WB_BWE)) + ELSE IF ( EQ_16(st->extl, WB_BWE)) { /* WB BWE encoder */ wb_bwe_enc_fx( st, new_inp_resamp16k, st->coder_type ); @@ -462,12 +462,12 @@ PMT("find scaling factor for prev_enr_EnvSHBres, prev_pow_exc16kWhtnd and prev_m * SWB BWE encoding *---------------------------------------------------------------------*/ test(); - IF (!st->Opt_SC_VBR_fx && GE_32(st->input_Fs_fx,32000)) + IF (!st->Opt_SC_VBR && GE_32(st->input_Fs,32000)) { /* Common pre-processing for SWB(FB) TBE and SWB BWE */ - swb_pre_proc_fx(st, st->input, new_swb_speech, shb_speech, &Q_shb_spch, realBuffer, imagBuffer, &cldfbScale ); + swb_pre_proc_fx(st, st->input_fx, new_swb_speech, shb_speech, &Q_shb_spch, realBuffer, imagBuffer, &cldfbScale ); } - ELSE IF( GE_32(st->input_Fs_fx,32000)) + ELSE IF( GE_32(st->input_Fs,32000)) { set16_fx(hBWE_TD->old_speech_shb_fx, 0, L_LOOK_16k + L_SUBFR16k ); set16_fx( shb_speech, 0, L_FRAME16k ); @@ -490,17 +490,17 @@ PMT("find scaling factor for prev_enr_EnvSHBres, prev_pow_exc16kWhtnd and prev_m test(); test(); test(); - IF ( EQ_16(st->extl_fx, SWB_TBE)||EQ_16(st->extl_fx,FB_TBE)||(st->igf!=0&&EQ_16(st->core_fx,ACELP_CORE)&&NE_16(st->extl_fx,WB_TBE))) + IF ( EQ_16(st->extl, SWB_TBE)||EQ_16(st->extl,FB_TBE)||(st->igf!=0&&EQ_16(st->core,ACELP_CORE)&&NE_16(st->extl,WB_TBE))) { test(); - IF( NE_32(st->core_brate_fx,FRAME_NO_DATA)&&NE_32(st->core_brate_fx,SID_2k40)) + IF( NE_32(st->core_brate,FRAME_NO_DATA)&&NE_32(st->core_brate,SID_2k40)) { swb_tbe_enc_fx( st, st->coder_type, shb_speech, bwe_exc_extended, voice_factors, fb_exc, &Q_fb_exc, Q_new, Q_shb_spch, st->voicing_fx, pitch_buf ); - IF ( EQ_16(st->extl_fx,FB_TBE)) + IF ( EQ_16(st->extl,FB_TBE)) { /* FB TBE encoder */ - fb_tbe_enc_fx( st, st->input, fb_exc, Q_fb_exc ); + fb_tbe_enc_fx( st, st->input_fx, fb_exc, Q_fb_exc ); } IF( EQ_16(st->codec_mode,MODE2)) @@ -516,7 +516,7 @@ PMT("find scaling factor for prev_enr_EnvSHBres, prev_pow_exc16kWhtnd and prev_m st->hTECEnc->corrFlag = 0; move16(); } - st->tfa_flag = tfaEnc_TBE_fx( st->tfa_enr, st->last_core_fx, st->voicing_fx, pitch_buf, shl(Q_shb_spch, 1)); + st->tfa_flag = tfaEnc_TBE_fx( st->tfa_enr, st->last_core, st->voicing_fx, pitch_buf, shl(Q_shb_spch, 1)); set_TEC_TFA_code_fx( st->hTECEnc->corrFlag, &st->tec_flag, &st->tfa_flag ); } ELSE @@ -533,15 +533,15 @@ PMT("find scaling factor for prev_enr_EnvSHBres, prev_pow_exc16kWhtnd and prev_m } } } - ELSE IF ( EQ_16(st->extl_fx,SWB_BWE)||EQ_16(st->extl_fx,FB_BWE)) + ELSE IF ( EQ_16(st->extl,SWB_BWE)||EQ_16(st->extl,FB_BWE)) { /* SWB BWE encoder */ swb_bwe_enc_fx( st, old_inp_12k8, old_inp_16k, old_syn_12k8_16k, new_swb_speech, shb_speech, st->coder_type, Q_shb_spch, sub(Q_new, 1) ); } - ELSE IF( EQ_16(st->extl_fx,SWB_BWE_HIGHRATE)||EQ_16(st->extl_fx,FB_BWE_HIGHRATE)) + ELSE IF( EQ_16(st->extl,SWB_BWE_HIGHRATE)||EQ_16(st->extl,FB_BWE_HIGHRATE)) { /* SWB HR BWE encoder */ - swb_bwe_enc_hr_fx(st, st->input - delay, st->Q_syn2, input_frame, unbits ); + swb_bwe_enc_hr_fx(st, st->input_fx - delay, st->Q_syn2, input_frame, unbits ); } /*---------------------------------------------------------------------* @@ -549,7 +549,7 @@ PMT("find scaling factor for prev_enr_EnvSHBres, prev_pow_exc16kWhtnd and prev_m *---------------------------------------------------------------------*/ test(); - IF ( st->Opt_DTX_ON_fx && GE_16(input_frame,L_FRAME32k)) + IF ( st->Opt_DTX_ON && GE_16(input_frame,L_FRAME32k)) { swb_CNG_enc_fx( st, shb_speech, old_syn_12k8_16k ); } @@ -589,7 +589,7 @@ PMT("find scaling factor for prev_enr_EnvSHBres, prev_pow_exc16kWhtnd and prev_m st->rf_mode_last = st->rf_mode; IF(EQ_16(st->Opt_RF_ON,1)) { - st->L_frame_fx = L_FRAME; + st->L_frame = L_FRAME; st->rf_mode = 1; } #ifdef MY_DEBUG @@ -604,12 +604,12 @@ PMT("find scaling factor for prev_enr_EnvSHBres, prev_pow_exc16kWhtnd and prev_m * * Initialize MODE2 frame header *-------------------------------------------------------------------*/ -static void initFrameHeader_loc(Encoder_State_fx *st ) +static void initFrameHeader_loc(Encoder_State *st ) { Word16 n; - IF( EQ_32(st->core_brate_fx, SID_2k40)) + IF( EQ_32(st->core_brate, SID_2k40)) { /*Get size of frame*/ st->bits_frame = FRAME_2_4; @@ -618,7 +618,7 @@ static void initFrameHeader_loc(Encoder_State_fx *st ) st->frame_size_index = 2; move16(); } - ELSE IF( EQ_32(st->core_brate_fx,FRAME_NO_DATA)) + ELSE IF( EQ_32(st->core_brate,FRAME_NO_DATA)) { st->bits_frame = FRAME_0; move16(); @@ -652,26 +652,26 @@ static void initFrameHeader_loc(Encoder_State_fx *st ) * * Write MODE2 frame header *-------------------------------------------------------------------*/ -static void writeFrameHeader_loc(Encoder_State_fx *st ) +static void writeFrameHeader_loc(Encoder_State *st ) { BSTR_ENC_HANDLE hBstr = st->hBstr; - IF( NE_32(st->core_brate_fx,FRAME_NO_DATA)) + IF( NE_32(st->core_brate,FRAME_NO_DATA)) { /* SID flag at 2.4kbps */ - IF( EQ_32(st->core_brate_fx,SID_2k40)) + IF( EQ_32(st->core_brate,SID_2k40)) { - IF ( EQ_16(st->cng_type_fx,FD_CNG)) + IF ( EQ_16(st->cng_type,FD_CNG)) { /* write SID/CNG type flag */ push_next_indice_fx(hBstr, 1, 1 ); /* write bandwidth mode */ - push_next_indice_fx(hBstr, st->bwidth_fx, 2 ); + push_next_indice_fx(hBstr, st->bwidth, 2 ); /* write L_frame */ - IF( EQ_16(st->L_frame_fx,L_FRAME)) + IF( EQ_16(st->L_frame,L_FRAME)) { push_next_indice_fx(hBstr, 0, 1 ); } @@ -685,7 +685,7 @@ static void writeFrameHeader_loc(Encoder_State_fx *st ) { IF(st->rf_mode == 0) { - push_next_indice_fx(hBstr, sub(st->bwidth_fx,FrameSizeConfig[st->frame_size_index].bandwidth_min), FrameSizeConfig[st->frame_size_index].bandwidth_bits); + push_next_indice_fx(hBstr, sub(st->bwidth,FrameSizeConfig[st->frame_size_index].bandwidth_min), FrameSizeConfig[st->frame_size_index].bandwidth_bits); } } @@ -705,14 +705,14 @@ static void writeFrameHeader_loc(Encoder_State_fx *st ) *------------------------------------------------------------------------*/ static void configure_core_coder_loc( - Encoder_State_fx *st /* i/o: encoder state structure */ + Encoder_State *st /* i/o: encoder state structure */ ) { initFrameHeader_loc( st ); test(); - IF( NE_32(st->core_brate_fx, SID_2k40)&&NE_32(st->core_brate_fx,FRAME_NO_DATA)) + IF( NE_32(st->core_brate, SID_2k40)&&NE_32(st->core_brate,FRAME_NO_DATA)) { if( st->tcxonly ) { @@ -733,12 +733,12 @@ static void configure_core_coder_loc( } } - st->igf = getIgfPresent_fx(st->element_mode, st->total_brate_fx, st->bwidth_fx, st->rf_mode); + st->igf = getIgfPresent_fx(st->element_mode, st->total_brate, st->bwidth, st->rf_mode); test(); - if( NE_32(st->core_brate_fx,SID_2k40)&&NE_32(st->core_brate_fx,FRAME_NO_DATA)) + if( NE_32(st->core_brate,SID_2k40)&&NE_32(st->core_brate,FRAME_NO_DATA)) { - st->core_brate_fx = st->total_brate_fx; + st->core_brate = st->total_brate; move32(); } diff --git a/lib_enc/ext_sig_ana_fx.c b/lib_enc/ext_sig_ana_fx.c index 4da307b59..750a69b66 100644 --- a/lib_enc/ext_sig_ana_fx.c +++ b/lib_enc/ext_sig_ana_fx.c @@ -26,7 +26,7 @@ void core_signal_analysis_high_bitrate_fx( const Word16 T_op[3], /* i : open-loop pitch values for quantiz. */ Word16 lsp_new[], Word16 lsp_mid[], - Encoder_State_fx *st, + Encoder_State *st, Word16 pTnsSize[], Word16 pTnsBits[], Word16 param_core[], @@ -128,7 +128,7 @@ void core_signal_analysis_high_bitrate_fx( T_op[1], ¶m_core[1 + NOISE_FILL_RANGES], ltpBits, &hTcxEnc->tcxltp_pitch_int, &hTcxEnc->tcxltp_pitch_fr, &hTcxEnc->tcxltp_gain, &hTcxEnc->tcxltp_pitch_int_past, &hTcxEnc->tcxltp_pitch_fr_past, &hTcxEnc->tcxltp_gain_past, - &hTcxEnc->tcxltp_norm_corr_past, st->last_core_fx, st->pit_min, st->pit_fr1, + &hTcxEnc->tcxltp_norm_corr_past, st->last_core, st->pit_min, st->pit_fr1, st->pit_fr2, st->pit_max, st->pit_res_max, &st->transientDetection, tmp8, NULL, M); } @@ -140,7 +140,7 @@ void core_signal_analysis_high_bitrate_fx( T_op[1], ¶m_core[1 + NOISE_FILL_RANGES], ltpBits, &hTcxEnc->tcxltp_pitch_int, &hTcxEnc->tcxltp_pitch_fr, &hTcxEnc->tcxltp_gain, &hTcxEnc->tcxltp_pitch_int_past, &hTcxEnc->tcxltp_pitch_fr_past, &hTcxEnc->tcxltp_gain_past, - &hTcxEnc->tcxltp_norm_corr_past, st->last_core_fx, st->pit_min, st->pit_fr1, + &hTcxEnc->tcxltp_norm_corr_past, st->last_core, st->pit_min, st->pit_fr1, st->pit_fr2, st->pit_max, st->pit_res_max, &st->transientDetection, tmp8, NULL, M); } @@ -151,7 +151,7 @@ void core_signal_analysis_high_bitrate_fx( Copy(st->speech_enc + st->encoderLookahead_enc, st->new_speech_enc_pe, L_frame); Preemph_scaled(st->new_speech_enc_pe, Q_new, &(st->mem_preemph_enc), - st->Q_max_enc, st->preemph_fac, 1, 0, 2, L_frame, st->coder_type_raw_fx, 1); + st->Q_max_enc, st->preemph_fac, 1, 0, 2, L_frame, st->coder_type_raw, 1); } Q_exp = sub(*Q_new, st->prev_Q_new); move16(); @@ -436,7 +436,7 @@ void core_signal_analysis_high_bitrate_fx( IF(NE_16(st->element_mode, IVAS_CPE_MDCT)) { test(); test(); - IF(EQ_16(hTcxEnc->tcxMode, TCX_20) && ((LT_32(st->total_brate_fx, HQ_96k)) || st->igf)) + IF(EQ_16(hTcxEnc->tcxMode, TCX_20) && ((LT_32(st->total_brate, HQ_96k)) || st->igf)) { pMdstWin = tcx20Win; @@ -447,7 +447,7 @@ void core_signal_analysis_high_bitrate_fx( } /* Compute noise-measure flags for spectrum filling and quantization */ - AnalyzePowerSpectrum_fx(st, div_l(L_mult(L_subframe, st->L_frame_fx), hTcxEnc->L_frameTCX), + AnalyzePowerSpectrum_fx(st, div_l(L_mult(L_subframe, st->L_frame), hTcxEnc->L_frameTCX), L_subframe, left_overlap, right_overlap, spectrum[frameno], spectrum_e[frameno], pMdstWin, powerSpec, &powerSpec_e); } @@ -546,7 +546,7 @@ void core_signal_analysis_high_bitrate_fx( test(); TNSAnalysis_fx(st->hTcxCfg, L_frameTCX, st->hTcxCfg->tcx_coded_lines, - transform_type[frameno], (frameno == 0) && (st->last_core_fx == ACELP_CORE), + transform_type[frameno], (frameno == 0) && (st->last_core == ACELP_CORE), spectrum[frameno], &hTcxEnc->tnsData[frameno], &hTcxEnc->fUseTns_fx[frameno], NULL ); #ifdef IVAS_CODE @@ -595,7 +595,7 @@ void core_signal_analysis_high_bitrate_fx( } IF(st->igf) { - ProcessIGF_fx(st->hIGFEnc, st, spectrum[frameno], &(spectrum_e[frameno]), powerSpec, &powerSpec_e, transform_type[frameno] == TCX_20, hTcxEnc->fUseTns_fx[frameno], (st->last_core_fx == ACELP_CORE), frameno); + ProcessIGF_fx(st->hIGFEnc, st, spectrum[frameno], &(spectrum_e[frameno]), powerSpec, &powerSpec_e, transform_type[frameno] == TCX_20, hTcxEnc->fUseTns_fx[frameno], (st->last_core == ACELP_CORE), frameno); } /* Copy memory */ diff --git a/lib_enc/fd_cng_enc_fx.c b/lib_enc/fd_cng_enc_fx.c index 391184792..25e610e3d 100644 --- a/lib_enc/fd_cng_enc_fx.c +++ b/lib_enc/fd_cng_enc_fx.c @@ -29,12 +29,12 @@ /************************************* * Create an instance of type FD_CNG * *************************************/ -void createFdCngEnc_fx(HANDLE_FD_CNG_ENC_FX* hFdCngEnc) +void createFdCngEnc_fx(HANDLE_FD_CNG_ENC* hFdCngEnc) { - HANDLE_FD_CNG_ENC_FX hs; + HANDLE_FD_CNG_ENC hs; /* Allocate memory */ - hs = (HANDLE_FD_CNG_ENC_FX) calloc(1, sizeof (FD_CNG_ENC)); + hs = (HANDLE_FD_CNG_ENC) calloc(1, sizeof (FD_CNG_ENC)); move16(); @@ -45,7 +45,7 @@ void createFdCngEnc_fx(HANDLE_FD_CNG_ENC_FX* hFdCngEnc) return; } -void initFdCngEnc_fx(HANDLE_FD_CNG_ENC_FX hsEnc, Word32 input_Fs, Word16 scale) +void initFdCngEnc_fx(HANDLE_FD_CNG_ENC hsEnc, Word32 input_Fs, Word16 scale) { Word16 j; HANDLE_FD_CNG_COM hsCom = hsEnc->hFdCngCom; @@ -97,37 +97,37 @@ void initFdCngEnc_fx(HANDLE_FD_CNG_ENC_FX hsEnc, Word32 input_Fs, Word16 scale) } /* Initialize noise estimation algorithm */ - set32_fx( hsEnc->msPeriodog, 0, NPART ); - hsEnc->msPeriodog_exp_fft = 0; + set32_fx( hsEnc->msPeriodog_fx, 0, NPART ); + hsEnc->msPeriodog_fx_exp_fft = 0; move16(); - hsEnc->msPeriodog_exp_cldfb = 0; + hsEnc->msPeriodog_fx_exp_cldfb = 0; move16(); - set32_fx( hsEnc->msAlpha, 0, NPART ); - set32_fx( hsEnc->msBminWin, 0, NPART ); - set32_fx( hsEnc->msBminSubWin, 0, NPART ); + set32_fx( hsEnc->msAlpha_fx, 0, NPART ); + set32_fx( hsEnc->msBminWin_fx, 0, NPART ); + set32_fx( hsEnc->msBminSubWin_fx, 0, NPART ); - set32_fx( hsEnc->msNoiseEst, 0, NPART ); - hsEnc->msNoiseEst_exp = 0; + set32_fx( hsEnc->msNoiseEst_fx, 0, NPART ); + hsEnc->msNoiseEst_fx_exp = 0; move16(); - set32_fx( hsEnc->energy_ho, 0, NPART ); - set32_fx( hsEnc->msNoiseEst_old, 0, NPART ); - - set16_fx( hsEnc->msLogPeriodog, 0, NPART ); - set16_fx( hsEnc->msLogNoiseEst, 0, NPART ); - set16_fx( hsEnc->msPsd, 0, NPART ); - set16_fx( hsEnc->msNoiseFloor, 0, NPART ); - set32_fx( hsEnc->msMinBuf, 2147483647l/*1.0 Q31*/, MSNUMSUBFR*NPART ); - set32_fx( hsEnc->msCurrentMin, 2147483647l/*1.0 Q31*/, NPART ); - set32_fx( hsEnc->msCurrentMinOut, 2147483647l/*1.0 Q31*/, NPART ); - set32_fx( hsEnc->msCurrentMinSubWindow, 2147483647l/*1.0 Q31*/, NPART ); - set16_fx( hsEnc->msPsdFirstMoment, 0, NPART ); - set16_fx( hsEnc->msPeriodogBuf, 0, MSBUFLEN*NPART ); + set32_fx( hsEnc->energy_ho_fx, 0, NPART ); + set32_fx( hsEnc->msNoiseEst_old_fx, 0, NPART ); + + set16_fx( hsEnc->msLogPeriodog_fx, 0, NPART ); + set16_fx( hsEnc->msLogNoiseEst_fx, 0, NPART ); + set16_fx( hsEnc->msPsd_fx, 0, NPART ); + set16_fx( hsEnc->msNoiseFloor_fx, 0, NPART ); + set32_fx( hsEnc->msMinBuf_fx, 2147483647l/*1.0 Q31*/, MSNUMSUBFR*NPART ); + set32_fx( hsEnc->msCurrentMin_fx, 2147483647l/*1.0 Q31*/, NPART ); + set32_fx( hsEnc->msCurrentMinOut_fx, 2147483647l/*1.0 Q31*/, NPART ); + set32_fx( hsEnc->msCurrentMinSubWindow_fx, 2147483647l/*1.0 Q31*/, NPART ); + set16_fx( hsEnc->msPsdFirstMoment_fx, 0, NPART ); + set16_fx( hsEnc->msPeriodogBuf_fx, 0, MSBUFLEN*NPART ); set16_fx( hsEnc->msLocalMinFlag, 0, NPART ); set16_fx( hsEnc->msNewMinFlag, 0, NPART ); hsEnc->msPeriodogBufPtr = 0; move16(); - set32_fx( hsEnc->msPsdSecondMoment, 0, NPART ); + set32_fx( hsEnc->msPsdSecondMoment_fx, 0, NPART ); return; @@ -136,7 +136,7 @@ void initFdCngEnc_fx(HANDLE_FD_CNG_ENC_FX hsEnc, Word32 input_Fs, Word16 scale) /************************************ * Configure FD_CNG * ************************************/ -void configureFdCngEnc_fx(HANDLE_FD_CNG_ENC_FX hsEnc, /* i/o: Contains the variables related to the FD-based CNG process */ +void configureFdCngEnc_fx(HANDLE_FD_CNG_ENC hsEnc, /* i/o: Contains the variables related to the FD-based CNG process */ Word16 bandwidth, /* i: bandwidth */ Word32 bitrate ) @@ -265,10 +265,10 @@ void configureFdCngEnc_fx(HANDLE_FD_CNG_ENC_FX hsEnc, /* i/o: Contains the var /************************************** * Delete the instance of type FD_CNG * **************************************/ -void deleteFdCngEnc_fx(HANDLE_FD_CNG_ENC_FX * hFdCngEnc) +void deleteFdCngEnc_fx(HANDLE_FD_CNG_ENC * hFdCngEnc) { - HANDLE_FD_CNG_ENC_FX hsEnc; + HANDLE_FD_CNG_ENC hsEnc; hsEnc = *hFdCngEnc; move16(); IF (hsEnc != NULL) @@ -282,7 +282,7 @@ void deleteFdCngEnc_fx(HANDLE_FD_CNG_ENC_FX * hFdCngEnc) void resetFdCngEnc_fx( - Encoder_State_fx * st + Encoder_State * st ) { Word16 tmpTest; @@ -299,7 +299,7 @@ void resetFdCngEnc_fx( move16(); IF ( totalNoiseIncrease > 0 ) { - IF ( EQ_16(st->totalNoise_increase_len_fx,TOTALNOISE_HIST_SIZE)) + IF ( EQ_16(st->totalNoise_increase_len,TOTALNOISE_HIST_SIZE)) { FOR ( n = 0; n < TOTALNOISE_HIST_SIZE-1; n++ ) { @@ -311,35 +311,35 @@ void resetFdCngEnc_fx( } ELSE { - st->totalNoise_increase_hist_fx[st->totalNoise_increase_len_fx] = totalNoiseIncrease; + st->totalNoise_increase_hist_fx[st->totalNoise_increase_len] = totalNoiseIncrease; move16(); - st->totalNoise_increase_len_fx = add(st->totalNoise_increase_len_fx, 1); + st->totalNoise_increase_len = add(st->totalNoise_increase_len, 1); } } ELSE { - st->totalNoise_increase_len_fx = 0; + st->totalNoise_increase_len = 0; move16(); } totalNoiseIncrease = 0; move16(); - FOR ( n = 0; n < st->totalNoise_increase_len_fx; n++ ) + FOR ( n = 0; n < st->totalNoise_increase_len; n++ ) { totalNoiseIncrease = add(totalNoiseIncrease, st->totalNoise_increase_hist_fx[n]); } test(); test(); - tmpTest = ((GT_16 (totalNoiseIncrease,thresh) ) && (EQ_16(st->totalNoise_increase_len_fx,TOTALNOISE_HIST_SIZE)) && (GT_16(st->ini_frame_fx,150)) ); + tmpTest = ((GT_16 (totalNoiseIncrease,thresh) ) && (EQ_16(st->totalNoise_increase_len,TOTALNOISE_HIST_SIZE)) && (GT_16(st->ini_frame,150)) ); test(); - IF ( tmpTest || ( GT_16(st->input_bwidth_fx,st->last_input_bwidth_fx) ) || EQ_16(st->last_core_fx,AMR_WB_CORE)) + IF ( tmpTest || ( GT_16(st->input_bwidth,st->last_input_bwidth) ) || EQ_16(st->last_core,AMR_WB_CORE)) { st->fd_cng_reset_flag = 1; move16(); - st->hFdCngEnc_fx->hFdCngCom->msFrCnt_init_counter = 0; + st->hFdCngEnc->hFdCngCom->msFrCnt_init_counter = 0; move16(); - st->hFdCngEnc_fx->hFdCngCom->init_old = 32767; + st->hFdCngEnc->hFdCngCom->init_old = 32767; move16(); } ELSE IF ( s_and((st->fd_cng_reset_flag > 0),(Word16)(LT_16(st->fd_cng_reset_flag,10)))) @@ -376,7 +376,7 @@ void perform_noise_estimation_enc_fx(Word32 *band_energies, /* i: energy Word16 band_energies_exp, /* i: exponent for energy in critical bands without minimum noise floor MODE2_E_MIN */ Word32 *enerBuffer, Word16 enerBuffer_exp, - HANDLE_FD_CNG_ENC_FX st /* i/o: FD_CNG structure containing all buffers and variables */ + HANDLE_FD_CNG_ENC st /* i/o: FD_CNG structure containing all buffers and variables */ ) { Word16 i, j, s, s1, s2; @@ -407,7 +407,7 @@ void perform_noise_estimation_enc_fx(Word32 *band_energies, /* i: energy move16(); ptr_per = periodog; move16(); - msPeriodog = st->msPeriodog; + msPeriodog = st->msPeriodog_fx; move16(); assert(numSlots == 16); @@ -421,7 +421,7 @@ void perform_noise_estimation_enc_fx(Word32 *band_energies, /* i: energy } /* exponent for fft part of msPeriodog */ - st->msPeriodog_exp_fft = add(band_energies_exp, PREEMPH_COMPENSATION_EXP); + st->msPeriodog_fx_exp_fft = add(band_energies_exp, PREEMPH_COMPENSATION_EXP); move16(); numBands = sub(regularStopBand, numCoreBands); @@ -450,20 +450,20 @@ void perform_noise_estimation_enc_fx(Word32 *band_energies, /* i: energy st->hFdCngCom->nCLDFBpart, st->hFdCngCom->CLDFBpsize_inv, &msPeriodog[nFFTpart], - &st->msPeriodog_exp_cldfb + &st->msPeriodog_fx_exp_cldfb ); /* find common exponent for fft part and cldfb part of msperiodog */ s1 = getScaleFactor32 (msPeriodog,nFFTpart); s2 = getScaleFactor32 (&msPeriodog[nFFTpart],nCLDFBpart); - s = s_max(sub(st->msPeriodog_exp_fft,s1), sub(st->msPeriodog_exp_cldfb,s2)); - s1 = sub(s,st->msPeriodog_exp_fft); - s2 = sub(s,st->msPeriodog_exp_cldfb); + s = s_max(sub(st->msPeriodog_fx_exp_fft,s1), sub(st->msPeriodog_fx_exp_cldfb,s2)); + s1 = sub(s,st->msPeriodog_fx_exp_fft); + s2 = sub(s,st->msPeriodog_fx_exp_cldfb); - st->msPeriodog_exp_fft = s; + st->msPeriodog_fx_exp_fft = s; move16(); - st->msPeriodog_exp_cldfb = s; + st->msPeriodog_fx_exp_cldfb = s; move16(); FOR (i=0; i < nFFTpart; i++) @@ -480,39 +480,39 @@ void perform_noise_estimation_enc_fx(Word32 *band_energies, /* i: energy } /* exponent for entire msPeriodog vector */ - st->msPeriodog_exp = st->msPeriodog_exp_fft; + st->msPeriodog_fx_exp = st->msPeriodog_fx_exp_fft; move16(); /* Compress MS inputs */ - compress_range(st->msPeriodog, st->msPeriodog_exp, st->msLogPeriodog, st->hFdCngCom->npart); + compress_range(st->msPeriodog_fx, st->msPeriodog_fx_exp, st->msLogPeriodog_fx, st->hFdCngCom->npart); /* Call the minimum statistics routine for noise estimation */ minimum_statistics ( st->hFdCngCom->npart, st->hFdCngCom->nFFTpart, st->hFdCngCom->psize_norm, - st->msLogPeriodog, - st->msNoiseFloor, - st->msLogNoiseEst, - st->msAlpha, - st->msPsd, - st->msPsdFirstMoment, - st->msPsdSecondMoment, - st->msMinBuf, - st->msBminWin, - st->msBminSubWin, - st->msCurrentMin, - st->msCurrentMinOut, - st->msCurrentMinSubWindow, + st->msLogPeriodog_fx, + st->msNoiseFloor_fx, + st->msLogNoiseEst_fx, + st->msAlpha_fx, + st->msPsd_fx, + st->msPsdFirstMoment_fx, + st->msPsdSecondMoment_fx, + st->msMinBuf_fx, + st->msBminWin_fx, + st->msBminSubWin_fx, + st->msCurrentMin_fx, + st->msCurrentMinOut_fx, + st->msCurrentMinSubWindow_fx, st->msLocalMinFlag, st->msNewMinFlag, - st->msPeriodogBuf, + st->msPeriodogBuf_fx, &(st->msPeriodogBufPtr), st->hFdCngCom ); /* Expand MS outputs */ - expand_range(st->msLogNoiseEst, st->msNoiseEst, &st->msNoiseEst_exp, st->hFdCngCom->npart); + expand_range(st->msLogNoiseEst_fx, st->msNoiseEst_fx, &st->msNoiseEst_fx_exp, st->hFdCngCom->npart); } @@ -552,7 +552,7 @@ AdjustFirstSID_fx( Word32 *msNoiseEst_old, /* i/o : pointer to old estimated noise */ Word16 *msNoiseEst_old_exp, /* i/o : pointer to exponent of old estimated noise */ Word16 *active_frame_counter, /* i/o : pointer to active frame counter */ - Encoder_State_fx *stcod /* i : pointer to Coder_State_Plus structure */ + Encoder_State *stcod /* i : pointer to Coder_State_Plus structure */ ) { Word16 i, sc, s1, s2, lambda, lambdaM1, invFac; @@ -560,7 +560,7 @@ AdjustFirstSID_fx( DTX_ENC_HANDLE hDtxEnc = stcod->hDtxEnc; test(); - IF ( EQ_16(hDtxEnc->cnt_SID,1)&>_32(stcod->last_core_brate_fx,SID_2k40)) + IF ( EQ_16(hDtxEnc->cnt_SID,1)&>_32(stcod->last_core_brate,SID_2k40)) { /* Detect the hangover period and the first SID frame at the beginning of each CNG phase */ @@ -644,7 +644,7 @@ AdjustFirstSID_fx( move16(); } test(); - IF ( NE_32(stcod->core_brate_fx,SID_2k40)&&NE_32(stcod->core_brate_fx,FRAME_NO_DATA)) + IF ( NE_32(stcod->core_brate,SID_2k40)&&NE_32(stcod->core_brate,FRAME_NO_DATA)) { /* Count the number of active frames in a row */ *active_frame_counter = add(*active_frame_counter, 1); @@ -898,8 +898,8 @@ static void msvq_encoder (const Word16 * const cb[], /* i : Codebook (indexed c Returns: void */ -void FdCng_encodeSID_fx(HANDLE_FD_CNG_ENC_FX stenc, /* i/o: pointer to FD_CNG structure containing all buffers and variables */ - Encoder_State_fx *corest, +void FdCng_encodeSID_fx(HANDLE_FD_CNG_ENC stenc, /* i/o: pointer to FD_CNG structure containing all buffers and variables */ + Encoder_State *corest, Word16 preemph_fac /* i : preemphase factor */ ) { @@ -933,10 +933,10 @@ void FdCng_encodeSID_fx(HANDLE_FD_CNG_ENC_FX stenc, /* i/o: pointer to FD_CNG s /* Init */ st = stenc->hFdCngCom; - E_Exp = stenc->msNoiseEst_exp; + E_Exp = stenc->msNoiseEst_fx_exp; move16(); E_ExpLd64 = L_shl(E_Exp, WORD32_BITS-1-LD_DATA_SCALE); - E = stenc->msNoiseEst; + E = stenc->msNoiseEst_fx; N = stenc->npartDec; move16(); @@ -1133,8 +1133,8 @@ void FdCng_encodeSID_fx(HANDLE_FD_CNG_ENC_FX stenc, /* i/o: pointer to FD_CNG s ELSE { push_indice_fx( hBstr, IND_SID_TYPE, 1, 1 ); - push_indice_fx( hBstr, IND_ACELP_16KHZ, corest->bwidth_fx, 2 ); - IF (EQ_16(corest->L_frame_fx, L_FRAME16k)) + push_indice_fx( hBstr, IND_ACELP_16KHZ, corest->bwidth, 2 ); + IF (EQ_16(corest->L_frame, L_FRAME16k)) { push_indice_fx( hBstr, IND_ACELP_16KHZ, 1, 1 ); } @@ -1162,7 +1162,7 @@ void FdCng_encodeSID_fx(HANDLE_FD_CNG_ENC_FX stenc, /* i/o: pointer to FD_CNG s } -void generate_comfort_noise_enc_fx(Encoder_State_fx *stcod, +void generate_comfort_noise_enc_fx(Encoder_State *stcod, Word16 Q_new, Word16 gen_exc ) @@ -1183,7 +1183,7 @@ void generate_comfort_noise_enc_fx(Encoder_State_fx *stcod, Word32 *fftBuffer; Word16 old_syn_pe_tmp[16]; Word16 tcx_transition = 0; - HANDLE_FD_CNG_ENC_FX stenc = stcod->hFdCngEnc_fx; + HANDLE_FD_CNG_ENC stenc = stcod->hFdCngEnc; HANDLE_FD_CNG_COM st = stenc->hFdCngCom; DTX_ENC_HANDLE hDtxEnc = stcod->hDtxEnc; TD_CNG_ENC_HANDLE hTdCngEnc = stcod->hTdCngEnc; @@ -1272,12 +1272,12 @@ void generate_comfort_noise_enc_fx(Encoder_State_fx *stcod, fftBufferExp = add(shr(cngNoiseLevelExp,1),randGaussExp); /* If previous frame is active, reset the overlap-add buffer */ - IF ( GT_32(stcod->last_core_brate_fx,SID_2k40)) + IF ( GT_32(stcod->last_core_brate,SID_2k40)) { set16_fx(st->olapBufferSynth, 0, st->fftlen); test(); test(); - IF ( (GT_32(stcod->last_core_fx,ACELP_CORE)&&EQ_16(stcod->codec_mode,MODE2))||EQ_16(stcod->codec_mode,MODE1)) + IF ( (GT_32(stcod->last_core,ACELP_CORE)&&EQ_16(stcod->codec_mode,MODE2))||EQ_16(stcod->codec_mode,MODE1)) { tcx_transition = 1; move16(); @@ -1294,21 +1294,21 @@ void generate_comfort_noise_enc_fx(Encoder_State_fx *stcod, /* calculate the residual signal energy */ /*enr = dotp( st->exc_cng, st->exc_cng, st->frameSize ) / st->frameSize;*/ - Lener = Dot_productSq16HQ(1,st->exc_cng,stcod->L_frame_fx,&exp); + Lener = Dot_productSq16HQ(1,st->exc_cng,stcod->L_frame,&exp); exp = add(sub(shl(sub(15,Q_new),1),8),exp); /*8 = log2(256)*/ /* convert log2 of residual signal energy */ /*(float)log10( enr + 0.1f ) / (float)log10( 2.0f );*/ Lener = BASOP_Util_Log2(Lener); Lener = L_add(Lener,L_shl(L_deposit_l(exp),WORD32_BITS-1-LD_DATA_SCALE)); /*Q25*/ - if(EQ_16(stcod->L_frame_fx,L_FRAME16k)) + if(EQ_16(stcod->L_frame,L_FRAME16k)) { Lener = L_sub(Lener, 10802114l/*0.3219280949f Q25*/); /*log2(320) = 8.3219280949f*/ } /* decrease the energy in case of WB input */ - IF( NE_16(stcod->bwidth_fx, NB)) + IF( NE_16(stcod->bwidth, NB)) { - IF( EQ_16(stcod->bwidth_fx,WB)) + IF( EQ_16(stcod->bwidth,WB)) { IF(hDtxEnc->CNG_mode >= 0 ) { @@ -1338,7 +1338,7 @@ void generate_comfort_noise_enc_fx(Encoder_State_fx *stcod, /* Overlap-add when previous frame is active */ test(); - IF ( ( GT_32(stcod->last_core_brate_fx,SID_2k40))&&(EQ_16(stcod->codec_mode,MODE2))) + IF ( ( GT_32(stcod->last_core_brate,SID_2k40))&&(EQ_16(stcod->codec_mode,MODE2))) { Word32 old_exc_ener, gain, noise32; Word16 seed_loc, lpcorder, old_syn, tmp, gain16, N, N2, N4, N8; @@ -1358,7 +1358,7 @@ void generate_comfort_noise_enc_fx(Encoder_State_fx *stcod, move16(); N2 = shr(st->frameSize,1); - IF ( GT_16(stcod->last_core_fx,ACELP_CORE)) + IF ( GT_16(stcod->last_core,ACELP_CORE)) { Word16 left_overlap_mode; left_overlap_mode = stcod->hTcxCfg->tcx_last_overlap_mode; diff --git a/lib_enc/find_uv_fx.c b/lib_enc/find_uv_fx.c index d9ef93c1f..f3af4cfef 100644 --- a/lib_enc/find_uv_fx.c +++ b/lib_enc/find_uv_fx.c @@ -94,7 +94,7 @@ static Word16 find_ener_decrease_fx( /* o : maximum energy ratio Q10 *-------------------------------------------------------------------*/ Word16 find_uv_fx( /* o : coding type */ - Encoder_State_fx *st_fx, /* i/o: encoder state structure */ + Encoder_State *st_fx, /* i/o: encoder state structure */ const Word16 *T_op_fr, /* i : pointer to adjusted fractional pitch (4 val.) Q6*/ const Word16 *voicing_fr, /* i : refined correlation for each subframes Q15*/ const Word16 *speech, /* i : pointer to speech signal for E computation Q_new*/ @@ -258,7 +258,7 @@ Word16 find_uv_fx( /* o : coding type move32(); nb_cond = 1; move16(); /* no additional condition for WB input */ - IF ( EQ_16(st_fx->input_bwidth_fx,NB)) + IF ( EQ_16(st_fx->input_bwidth,NB)) { dE2_th = 21<<10; move32(); @@ -283,38 +283,38 @@ Word16 find_uv_fx( /* o : coding type { IF( LT_16(sub(shl(NB_SSF,1), ind_deltaMax),L_ENR)) { - st_fx->old_ind_deltaMax_fx = ind_deltaMax; + st_fx->old_ind_deltaMax = ind_deltaMax; move16(); Copy32( pt_enr_ssf, st_fx->old_enr_ssf_fx, 2*NB_SSF ); } ELSE { - st_fx->old_ind_deltaMax_fx = -1; + st_fx->old_ind_deltaMax = -1; move16(); dE2 = find_ener_decrease_fx( ind_deltaMax, pt_enr_ssf ); /*Q10*/ if( GT_32(dE2,dE2_th)) { - st_fx->spike_hyst_fx = 0; + st_fx->spike_hyst = 0; move16(); } } } ELSE { - IF( st_fx->old_ind_deltaMax_fx >= 0 ) + IF( st_fx->old_ind_deltaMax >= 0 ) { Copy32( st_fx->old_enr_ssf_fx, enr_ssf, 2*NB_SSF ); - dE2 = find_ener_decrease_fx( st_fx->old_ind_deltaMax_fx, enr_ssf ); + dE2 = find_ener_decrease_fx( st_fx->old_ind_deltaMax, enr_ssf ); if( GT_32(dE2,dE2_th)) { - st_fx->spike_hyst_fx = 1; + st_fx->spike_hyst = 1; move16(); } } - st_fx->old_ind_deltaMax_fx = -1; + st_fx->old_ind_deltaMax = -1; move16(); } @@ -325,7 +325,7 @@ Word16 find_uv_fx( /* o : coding type tmp_offset_flag = 1; move16(); - IF ( NE_16(st_fx->input_bwidth_fx, NB)) + IF ( NE_16(st_fx->input_bwidth, NB)) { ee0_th = 154; /*2.4 in Q6 */ move16(); voi_th = 24248; /*0.74f Q15 */ move16(); @@ -340,11 +340,11 @@ Word16 find_uv_fx( /* o : coding type test(); test(); #ifdef BASOP_NOGLOB - if( ( EQ_16(st_fx->last_coder_type_raw_fx,UNVOICED))|| /* previous frame was unvoiced */ + if( ( EQ_16(st_fx->last_coder_type_raw,UNVOICED))|| /* previous frame was unvoiced */ ( ( LT_32(ee[0],ee0_th) ) && ( GT_32(hp_E[0],L_shl(E_MIN_FX,Q_new)) ) && /* energy is concentrated in high frequencies provided that some energy is present in HF */ ( LT_16(add_o(st_fx->voicing_fx[0],corr_shift, &Overflow),voi_th)))) /* normalized correlation is low */ #else /* BASOP_NOGLOB */ - if( ( EQ_16(st_fx->last_coder_type_raw_fx,UNVOICED))|| /* previous frame was unvoiced */ + if( ( EQ_16(st_fx->last_coder_type_raw,UNVOICED))|| /* previous frame was unvoiced */ ( ( LT_32(ee[0],ee0_th) ) && ( GT_32(hp_E[0],L_shl(E_MIN_FX,Q_new)) ) && /* energy is concentrated in high frequencies provided that some energy is present in HF */ ( LT_16(add(st_fx->voicing_fx[0],corr_shift),voi_th)))) /* normalized correlation is low */ #endif /* BASOP_NOGLOB */ @@ -363,12 +363,12 @@ Word16 find_uv_fx( /* o : coding type flag_low_relE = 0; move16(); ee1_th = 608; /*9.5 Q6*/ move16(); - IF ( st_fx->Opt_SC_VBR_fx || (EQ_16(st_fx->idchan, 1) && EQ_16(st_fx->element_mode, IVAS_CPE_TD))) /* Allow the low energy flag for the secondary channel */ + IF ( st_fx->Opt_SC_VBR || (EQ_16(st_fx->idchan, 1) && EQ_16(st_fx->element_mode, IVAS_CPE_TD))) /* Allow the low energy flag for the secondary channel */ { ee1_th = 544; /*8.5f Q6*/ move16(); /* SC-VBR - determine the threshold on relative energy as a function of lp_noise */ - IF ( NE_16(st_fx->input_bwidth_fx,NB)) + IF ( NE_16(st_fx->input_bwidth,NB)) { /*relE_thres = 0.700f * st->lp_noise - 33.5f; (lp_noise in Q8, constant Q8<<16) */ L_tmp = L_mac(-562036736, 22938, st_fx->lp_noise_fx); @@ -397,7 +397,7 @@ Word16 find_uv_fx( /* o : coding type /* SC-VBR - correction of voicing threshold for NB inputs (important only in noisy conditions) */ test(); - if ( EQ_16(st_fx->input_bwidth_fx,NB)&<_16( vadnoise ,20<<8)) /* vadnoise in Q8, constant Q0<<8 */ + if ( EQ_16(st_fx->input_bwidth,NB)&<_16( vadnoise ,20<<8)) /* vadnoise in Q8, constant Q0<<8 */ { mean_voi3_offset = 1638; /*0.05f Q15*/ move16(); } @@ -407,7 +407,7 @@ Word16 find_uv_fx( /* o : coding type E_min_th = L_shl(E_MIN_FX,Q_new); coder_type = GENERIC; move16(); - IF ( EQ_16(st_fx->input_bwidth_fx,NB)) + IF ( EQ_16(st_fx->input_bwidth,NB)) { test(); test(); @@ -429,7 +429,7 @@ Word16 find_uv_fx( /* o : coding type /*( st_fx->music_hysteresis_fx == 0 ) &&*/ /* ... and in segment after AUDIO frames */ ( LE_32(dE1, 237568) ) && /* Avoid on sharp energy spikes */ ( LE_32(st_fx->old_dE1_fx,237568) ) && /* + one frame hysteresis */ - ( st_fx->spike_hyst_fx < 0 ) ) || /* Avoid after sharp energy spikes followed by decay (e.g. castanets) */ + ( st_fx->spike_hyst < 0 ) ) || /* Avoid after sharp energy spikes followed by decay (e.g. castanets) */ flag_low_relE ) /* low relative frame energy (only for SC-VBR) */ #else if( ( ( LT_16(add(mean_voi3, corr_shift),add(22282,mean_voi3_offset)))&& /* normalized correlation low */ @@ -440,7 +440,7 @@ Word16 find_uv_fx( /* o : coding type /*( st_fx->music_hysteresis_fx == 0 ) &&*/ /* ... and in segment after AUDIO frames */ ( LE_32(dE1, 237568) ) && /* Avoid on sharp energy spikes */ ( LE_32(st_fx->old_dE1_fx,237568) ) && /* + one frame hysteresis */ - ( st_fx->spike_hyst_fx < 0 ) ) || /* Avoid after sharp energy spikes followed by decay (e.g. castanets) */ + ( st_fx->spike_hyst < 0 ) ) || /* Avoid after sharp energy spikes followed by decay (e.g. castanets) */ flag_low_relE ) /* low relative frame energy (only for SC-VBR) */ #endif { @@ -474,7 +474,7 @@ Word16 find_uv_fx( /* o : coding type /*( st_fx->music_hysteresis_fx == 0 ) && */ /* ... and in segment after AUDIO frames */ ( LE_32(dE1, 245760) ) && /* Avoid on sharp energy spikes */ ( LE_32(st_fx->old_dE1_fx,245760) ) && /* + one frame hysteresis */ - ( st_fx->spike_hyst_fx < 0 ) ) /* Avoid after sharp energy spikes followed by decay (e.g. castanets) */ + ( st_fx->spike_hyst < 0 ) ) /* Avoid after sharp energy spikes followed by decay (e.g. castanets) */ || ( flag_low_relE && ( LE_32(st_fx->old_dE1_fx,245760) ) ) @@ -488,7 +488,7 @@ Word16 find_uv_fx( /* o : coding type /*-----------------------------------------------------------------* * Decision about VC *-----------------------------------------------------------------*/ - if (st_fx->Opt_SC_VBR_fx) + if (st_fx->Opt_SC_VBR) { hSC_VBR->set_ppp_generic = 0; } @@ -523,7 +523,7 @@ Word16 find_uv_fx( /* o : coding type coder_type = VOICED; move16(); } - ELSE IF ( st_fx->Opt_SC_VBR_fx && EQ_16(st_fx->input_bwidth_fx,NB) && LT_16(vadnoise,20<<8)) + ELSE IF ( st_fx->Opt_SC_VBR && EQ_16(st_fx->input_bwidth,NB) && LT_16(vadnoise,20<<8)) { test(); test(); @@ -592,7 +592,7 @@ Word16 find_uv_fx( /* o : coding type if( st_fx->rf_mode != st_fx->Opt_RF_ON ) { - core_coder_mode_switch_fx( st_fx, st_fx->last_total_brate_fx, 0, shift ); + core_coder_mode_switch_fx( st_fx, st_fx->last_total_brate, 0, shift ); } } } @@ -621,20 +621,20 @@ Word16 find_uv_fx( /* o : coding type /* update spike hysteresis parameters */ test(); - if( st_fx->spike_hyst_fx >= 0 && LT_16(st_fx->spike_hyst_fx,2)) + if( st_fx->spike_hyst >= 0 && LT_16(st_fx->spike_hyst,2)) { - st_fx->spike_hyst_fx = add(st_fx->spike_hyst_fx,1); + st_fx->spike_hyst = add(st_fx->spike_hyst,1); } /* reset spike hysteresis */ test(); test(); test(); - if( ( GT_16(st_fx->spike_hyst_fx,1))&& + if( ( GT_16(st_fx->spike_hyst,1))&& ( GT_16(dE3,5<<8) || /* energy increases */ ( GT_16(relE, -3328)&&(GT_16(add(mean_voi3,corr_shift),22774))))) /* normalized correlation is high */ { - st_fx->spike_hyst_fx = -1; + st_fx->spike_hyst = -1; move16(); } @@ -645,7 +645,7 @@ Word16 find_uv_fx( /* o : coding type move32(); /*Q13*/ /* save the raw coder_type for various modules later in the codec (the reason is that e.g. UNVOICED is lost at higher rates) */ - st_fx->coder_type_raw_fx = coder_type; + st_fx->coder_type_raw = coder_type; move16(); return coder_type; diff --git a/lib_enc/gaus_enc_fx.c b/lib_enc/gaus_enc_fx.c index f4ef82cdb..d37d3c2bc 100644 --- a/lib_enc/gaus_enc_fx.c +++ b/lib_enc/gaus_enc_fx.c @@ -40,7 +40,7 @@ static void gauss2v_fx(BSTR_ENC_HANDLE hBstr, const Word16 h[], const Word16 xn[ * - Updates *-------------------------------------------------------------------*/ Word16 gaus_encode_fx( - Encoder_State_fx *st_fx, /* i/o: encoder state structure */ + Encoder_State *st_fx, /* i/o: encoder state structure */ const Word16 i_subfr, /* i : subframe index */ const Word16 *h1, /* i : weighted filter input response */ const Word16 *xn, /* i : target vector */ diff --git a/lib_enc/gs_enc_fx.c b/lib_enc/gs_enc_fx.c index a32d48920..8ca6b2273 100644 --- a/lib_enc/gs_enc_fx.c +++ b/lib_enc/gs_enc_fx.c @@ -23,7 +23,7 @@ static Word16 edyn_fx(const Word16 *vec, const Word16 lvec, Word16 Qnew); * Encode audio (AC) frames *-------------------------------------------------------------------*/ void encod_audio_fx( - Encoder_State_fx *st_fx, /* i/o: State structure */ + Encoder_State *st_fx, /* i/o: State structure */ const Word16 speech[], /* i : input speech Q_new */ const Word16 Aw[], /* i : weighted A(z) unquantized for subframes */ const Word16 Aq[], /* i : 12k8 Lp coefficient */ @@ -98,16 +98,16 @@ void encod_audio_fx( test(); test(); test(); test();test();test(); - IF (GE_16(st_fx->GSC_IVAS_mode, 1) || (NE_16(st_fx->coder_type, INACTIVE) && ((EQ_16(st_fx->element_mode, EVS_MONO) && GE_32(st_fx->total_brate_fx, ACELP_13k20)) || - (GT_16(st_fx->element_mode, EVS_MONO) && GT_32(st_fx->total_brate_fx, MIN_BRATE_GSC_NOISY_FLAG) && GE_16(st_fx->bwidth_fx, SWB) && !st_fx->flag_ACELP16k)))) + IF (GE_16(st_fx->GSC_IVAS_mode, 1) || (NE_16(st_fx->coder_type, INACTIVE) && ((EQ_16(st_fx->element_mode, EVS_MONO) && GE_32(st_fx->total_brate, ACELP_13k20)) || + (GT_16(st_fx->element_mode, EVS_MONO) && GT_32(st_fx->total_brate, MIN_BRATE_GSC_NOISY_FLAG) && GE_16(st_fx->bwidth, SWB) && !st_fx->flag_ACELP16k)))) { - push_indice_fx(hBstr,IND_GSC_SWB_SPEECH, st_fx->GSC_noisy_speech_fx, 1); + push_indice_fx(hBstr,IND_GSC_SWB_SPEECH, st_fx->GSC_noisy_speech, 1); } /*---------------------------------------------------------------* * Find and encode the number of subframes *---------------------------------------------------------------*/ test(); - IF ( GE_32(st_fx->core_brate_fx,ACELP_9k60) && LE_32(st_fx->core_brate_fx,ACELP_13k20)) + IF ( GE_32(st_fx->core_brate,ACELP_9k60) && LE_32(st_fx->core_brate,ACELP_13k20)) { FOR( i = 0; i < 5; i++) { @@ -120,12 +120,12 @@ void encod_audio_fx( } } test(); - IF(GE_16(st_fx->GSC_IVAS_mode, 1) || (st_fx->GSC_noisy_speech_fx && st_fx->GSC_IVAS_mode == 0)) + IF(GE_16(st_fx->GSC_IVAS_mode, 1) || (st_fx->GSC_noisy_speech && st_fx->GSC_IVAS_mode == 0)) { nb_subfr = NB_SUBFR; move16(); test();test(); - if (st_fx->GSC_IVAS_mode > 0 && LT_16(st_fx->GSC_IVAS_mode, 3) && LT_32(st_fx->core_brate_fx, GSC_L_RATE_STG)) + if (st_fx->GSC_IVAS_mode > 0 && LT_16(st_fx->GSC_IVAS_mode, 3) && LT_32(st_fx->core_brate, GSC_L_RATE_STG)) { nb_subfr = 2; move16(); @@ -135,7 +135,7 @@ void encod_audio_fx( nb_subfr_flag = 1; move16(); } - ELSE IF (EQ_16(st_fx->L_frame_fx, L_FRAME16k) && (LE_32(st_fx->core_brate_fx, ACELP_13k20) || EQ_16(st_fx->coder_type, INACTIVE))) + ELSE IF (EQ_16(st_fx->L_frame, L_FRAME16k) && (LE_32(st_fx->core_brate, ACELP_13k20) || EQ_16(st_fx->coder_type, INACTIVE))) { hGSCEnc->cor_strong_limit = 0; nb_subfr = SWNB_SUBFR; @@ -147,7 +147,7 @@ void encod_audio_fx( { test(); test(); - IF( (hGSCEnc->cor_strong_limit == 0 || EQ_16(st_fx->coder_type,INACTIVE)) && GE_32(st_fx->core_brate_fx,ACELP_9k60)) + IF( (hGSCEnc->cor_strong_limit == 0 || EQ_16(st_fx->coder_type,INACTIVE)) && GE_32(st_fx->core_brate,ACELP_9k60)) { nb_subfr = 2; move16(); @@ -163,24 +163,24 @@ void encod_audio_fx( nb_subfr_flag = 1; move16(); } - IF (EQ_16(st_fx->L_frame_fx, L_FRAME16k) && (GT_16(hSpMusClas->mold_corr_fx, 26214) && GE_32(st_fx->core_brate_fx, MIN_RATE_4SBFR) && NE_16(st_fx->coder_type, INACTIVE))) + IF (EQ_16(st_fx->L_frame, L_FRAME16k) && (GT_16(hSpMusClas->mold_corr_fx, 26214) && GE_32(st_fx->core_brate, MIN_RATE_4SBFR) && NE_16(st_fx->coder_type, INACTIVE))) { nb_subfr = shl(nb_subfr, 1); nb_subfr_flag |= 0x2; logic16(); } - IF (EQ_16(st_fx->L_frame_fx, L_FRAME16k) && GE_32(st_fx->core_brate_fx, MIN_RATE_4SBFR)) + IF (EQ_16(st_fx->L_frame, L_FRAME16k) && GE_32(st_fx->core_brate, MIN_RATE_4SBFR)) { push_indice_fx(hBstr, IND_HF_NOISE, nb_subfr_flag, 2); } - ELSE IF( GE_32(st_fx->core_brate_fx,ACELP_9k60)) + ELSE IF( GE_32(st_fx->core_brate,ACELP_9k60)) { /* nb_subfr_flag can only have the value 0 or 1 */ push_indice_fx(hBstr, IND_HF_NOISE, nb_subfr_flag, 1); } } test(); - if (EQ_16(st_fx->L_frame_fx, L_FRAME16k) && EQ_16(nb_subfr, NB_SUBFR)) + if (EQ_16(st_fx->L_frame, L_FRAME16k) && EQ_16(nb_subfr, NB_SUBFR)) { nb_subfr = NB_SUBFR16k; move16(); @@ -191,9 +191,9 @@ void encod_audio_fx( *---------------------------------------------------------------*/ test(); - IF (!(st_fx->GSC_IVAS_mode > 0 && EQ_16(st_fx->L_frame_fx, i_mult(nb_subfr, 2 * L_SUBFR)) && LT_16(st_fx->GSC_IVAS_mode, 3)) && - ((GE_32(st_fx->core_brate_fx, MIN_RATE_FCB) || st_fx->GSC_noisy_speech_fx) && - ((EQ_16(nb_subfr, NB_SUBFR) && EQ_16(st_fx->L_frame_fx, L_FRAME)) || (EQ_16(nb_subfr, NB_SUBFR16k) && EQ_16(st_fx->L_frame_fx, L_FRAME16k))))) + IF (!(st_fx->GSC_IVAS_mode > 0 && EQ_16(st_fx->L_frame, i_mult(nb_subfr, 2 * L_SUBFR)) && LT_16(st_fx->GSC_IVAS_mode, 3)) && + ((GE_32(st_fx->core_brate, MIN_RATE_FCB) || st_fx->GSC_noisy_speech) && + ((EQ_16(nb_subfr, NB_SUBFR) && EQ_16(st_fx->L_frame, L_FRAME)) || (EQ_16(nb_subfr, NB_SUBFR16k) && EQ_16(st_fx->L_frame, L_FRAME16k))))) { IF (GT_16(st_fx->element_mode, EVS_MONO)) { @@ -201,10 +201,10 @@ void encod_audio_fx( } ELSE { - nb_bits = Es_pred_bits_tbl[BIT_ALLOC_IDX_fx(st_fx->core_brate_fx, GENERIC, -1, -1)]; + nb_bits = Es_pred_bits_tbl[BIT_ALLOC_IDX_fx(st_fx->core_brate, GENERIC, -1, -1)]; move16(); } - Es_pred_enc_fx(&Es_pred, &indice, st_fx->L_frame_fx, res, st_fx->voicing_fx, nb_bits, 0, Q_new); + Es_pred_enc_fx(&Es_pred, &indice, st_fx->L_frame, res, st_fx->voicing_fx, nb_bits, 0, Q_new); push_indice_fx(hBstr, IND_ES_PRED, indice, nb_bits ); } @@ -214,8 +214,8 @@ void encod_audio_fx( /*---------------------------------------------------------------* * DCT transform *---------------------------------------------------------------*/ - edct_16fx( exc, dct_epit, st_fx->L_frame_fx, 7, st_fx->element_mode); - edct_16fx( res, dct_res, st_fx->L_frame_fx, 7, st_fx->element_mode); + edct_16fx( exc, dct_epit, st_fx->L_frame, 7, st_fx->element_mode); + edct_16fx( res, dct_res, st_fx->L_frame, 7, st_fx->element_mode); /*---------------------------------------------------------------* * Calculate energy dynamics *---------------------------------------------------------------*/ @@ -254,18 +254,18 @@ void encod_audio_fx( hGSCEnc->noise_lev = NOISE_LEVEL_SP0; move16(); } - ELSE IF (st_fx->GSC_noisy_speech_fx == 0) + ELSE IF (st_fx->GSC_noisy_speech == 0) { hGSCEnc->noise_lev = NOISE_LEVEL_SP3; move16(); } } - ELSE IF( LE_32(st_fx->core_brate_fx,ACELP_8k00)) + ELSE IF( LE_32(st_fx->core_brate,ACELP_8k00)) { hGSCEnc->noise_lev = s_max(hGSCEnc->noise_lev, NOISE_LEVEL_SP2); push_indice_fx(hBstr, IND_NOISE_LEVEL, sub(hGSCEnc->noise_lev, NOISE_LEVEL_SP2), 2 ); } - ELSE IF( st_fx->GSC_noisy_speech_fx ) + ELSE IF( st_fx->GSC_noisy_speech ) { hGSCEnc->noise_lev = NOISE_LEVEL_SP3; move16(); @@ -301,13 +301,13 @@ void encod_audio_fx( move16(); - if( st_fx->extl_brate_fx > 0 ) + if( st_fx->extl_brate > 0 ) { /* subtract 1 bit for TBE/BWE BWE flag (bit counted in extl_brate) */ tmp_nb_bits_tot = sub(tmp_nb_bits_tot,1); } test(); test(); - if( EQ_16(st_fx->coder_type,INACTIVE) && LE_32(st_fx->core_brate_fx,ACELP_9k60) && st_fx->idchan == 0) + if( EQ_16(st_fx->coder_type,INACTIVE) && LE_32(st_fx->core_brate,ACELP_9k60) && st_fx->idchan == 0) { /* add 5 bits for noisiness */ tmp_nb_bits_tot = add(tmp_nb_bits_tot,5); @@ -319,20 +319,20 @@ void encod_audio_fx( * iDCT transform *--------------------------------------------------------------------------------------*/ - edct_16fx( dct_epit, exc, st_fx->L_frame_fx , 7, st_fx->element_mode); - edct_16fx( exc_wo_nf, exc_wo_nf, st_fx->L_frame_fx , 7, st_fx->element_mode); + edct_16fx( dct_epit, exc, st_fx->L_frame , 7, st_fx->element_mode); + edct_16fx( exc_wo_nf, exc_wo_nf, st_fx->L_frame , 7, st_fx->element_mode); /*--------------------------------------------------------------------------------------* * Remove potential pre-echo in case an onset has been detected *--------------------------------------------------------------------------------------*/ - pre_echo_att_fx( &hGSCEnc->Last_frame_ener_fx, exc, attack_flag, Q_new, st_fx->last_coder_type_fx, st_fx->L_frame_fx); + pre_echo_att_fx( &hGSCEnc->Last_frame_ener_fx, exc, attack_flag, Q_new, st_fx->last_coder_type, st_fx->L_frame); /*--------------------------------------------------------------------------------------* * Update BWE excitation *--------------------------------------------------------------------------------------*/ IF (st_fx->hBWE_TD != NULL) { - IF (EQ_16(st_fx->L_frame_fx, L_FRAME16k)) + IF (EQ_16(st_fx->L_frame, L_FRAME16k)) { set16_fx(voice_factors, 0, NB_SUBFR16k); interp_code_4over2_fx(exc, bwe_exc, L_FRAME16k); @@ -348,7 +348,7 @@ void encod_audio_fx( *--------------------------------------------------------------------------------------*/ p_Aq = Aq; - FOR (i_subfr=0; i_subfr< st_fx->L_frame_fx; i_subfr+=L_SUBFR) + FOR (i_subfr=0; i_subfr< st_fx->L_frame; i_subfr+=L_SUBFR) { Syn_filt_s( 1, p_Aq, M, &exc_wo_nf[i_subfr], &synth[i_subfr], L_SUBFR, hLPDmem->mem_syn, 1 ); p_Aq += (M+1); @@ -360,7 +360,7 @@ void encod_audio_fx( hLPDmem->mem_w0 = hGSCEnc->mem_w0_tmp_fx; /*_DIFF_FLOAT_FIX_ The way it is written in the original fix point is that at this point mem_w0 falls back to its original value (before enc_pit_exc, seems not the case in float */ move16(); - Copy( exc_wo_nf, exc, st_fx->L_frame_fx); + Copy( exc_wo_nf, exc, st_fx->L_frame); return; } @@ -382,7 +382,7 @@ void encod_audio_fx( /* _ None */ /*--------------------------------------------------------------------------------*/ /* INPUT/OUTPUT ARGUMENTS : */ -/* Encoder_State_fx *st_fx:Encoder State Structure */ +/* Encoder_State *st_fx:Encoder State Structure */ /* _ (Word16[]) exc_dct_in : dctof pitch-only excitation / total excitation Q_exc */ /*--------------------------------------------------------------------------------*/ /* RETURN ARGUMENTS : */ @@ -391,7 +391,7 @@ void encod_audio_fx( void gsc_enc_fx( - Encoder_State_fx *st_fx, /* i/o: State structure */ + Encoder_State *st_fx, /* i/o: State structure */ Word16 res_dct_in[], /* i : dct of residual signal */ Word16 exc_dct_in[], /* i/o: dct of pitch-only excitation / total excitation */ const Word16 Diff_len, @@ -439,20 +439,20 @@ void gsc_enc_fx( bit = bits_used; test();test();test(); - if (EQ_16(st_fx->coder_type, INACTIVE) && (EQ_16(st_fx->tdm_LRTD_flag, 1) || EQ_16(st_fx->element_mode, IVAS_SCE)) && LE_32(st_fx->core_brate_fx, GSC_LRES_GAINQ_LIMIT)) + if (EQ_16(st_fx->coder_type, INACTIVE) && (EQ_16(st_fx->tdm_LRTD_flag, 1) || EQ_16(st_fx->element_mode, IVAS_SCE)) && LE_32(st_fx->core_brate, GSC_LRES_GAINQ_LIMIT)) { bit = add(bit, GSC_LRES_NB_NITS); } move16(); - set16_fx( exc_diffQ, 0, st_fx->L_frame_fx ); - set16_fx( y2_filt, 0, st_fx->L_frame_fx ); + set16_fx( exc_diffQ, 0, st_fx->L_frame ); + set16_fx( y2_filt, 0, st_fx->L_frame ); /*--------------------------------------------------------------------------------------* * Calculate the difference between the residual spectrum and the spectrum of adaptive excitation * (non valuable temporal content present in exc_dct_in is already zeroed) *--------------------------------------------------------------------------------------*/ - Vr_subt( res_dct_in, exc_dct_in, exc_diff, st_fx->L_frame_fx ); + Vr_subt( res_dct_in, exc_dct_in, exc_diff, st_fx->L_frame ); exc_diff[0] = 0; move16(); @@ -472,30 +472,30 @@ void gsc_enc_fx( move16(); } - Ener_per_band_comp_fx( exc_diff, Ener_per_bd_iQ, Q_exc, MBANDS_GN, 1/*, st_fx->L_frame_fx IVAS_CODE*/ ); + Ener_per_band_comp_fx( exc_diff, Ener_per_bd_iQ, Q_exc, MBANDS_GN, 1/*, st_fx->L_frame IVAS_CODE*/ ); /*--------------------------------------------------------------------------------------* * Gain quantizaion *--------------------------------------------------------------------------------------*/ #if 0 - mean_gain = gsc_gainQ_fx(hBstr, Ener_per_bd_iQ, Ener_per_bd_iQ, st_fx->core_brate_fx, st_fx->coder_type, st_fx->bwidth_fx ); + mean_gain = gsc_gainQ_fx(hBstr, Ener_per_bd_iQ, Ener_per_bd_iQ, st_fx->core_brate, st_fx->coder_type, st_fx->bwidth ); #else i = 0; move16(); WHILE (LT_16(i, SIZE_BRATE_INTERMED_TBL)) { - IF (LE_32(st_fx->core_brate_fx, brate_intermed_tbl[i])) + IF (LE_32(st_fx->core_brate, brate_intermed_tbl[i])) { break; } i++; } if (GT_16(st_fx->element_mode, EVS_MONO) && EQ_16(st_fx->coder_type, AUDIO) && - LE_32(st_fx->core_brate_fx, STEREO_GSC_BIT_RATE_ALLOC) && EQ_32(brate_intermed_tbl[i], ACELP_9k60)) /* Bit allocation should be mapped to 8 kb/s instead of 9.6 kb/s in this case */ + LE_32(st_fx->core_brate, STEREO_GSC_BIT_RATE_ALLOC) && EQ_32(brate_intermed_tbl[i], ACELP_9k60)) /* Bit allocation should be mapped to 8 kb/s instead of 9.6 kb/s in this case */ { i--; } - mean_gain = gsc_gainQ_fx(hBstr, /*st_fX->element_mode, st_fx->idchan,IVAS_CODE*/ Ener_per_bd_iQ, Ener_per_bd_iQ, brate_intermed_tbl[i], st_fx->coder_type, st_fx->bwidth_fx/*, st_fx->L_frame_fx, st_fx->tdm_LRTD_flag, st_fx->core_brate_fx*/); + mean_gain = gsc_gainQ_fx(hBstr, /*st_fX->element_mode, st_fx->idchan,IVAS_CODE*/ Ener_per_bd_iQ, Ener_per_bd_iQ, brate_intermed_tbl[i], st_fx->coder_type, st_fx->bwidth/*, st_fx->L_frame, st_fx->tdm_LRTD_flag, st_fx->core_brate*/); #endif *tmp_noise = mult_r(320,mean_gain); /*10 in Q5 lp_gainc in Q3 */ @@ -504,9 +504,9 @@ void gsc_enc_fx( * Frequency encoder *--------------------------------------------------------------------------------------*/ - bands_and_bit_alloc_fx(hGSCEnc->cor_strong_limit, hGSCEnc->noise_lev, st_fx->core_brate_fx, Diff_len, bit, &bit, Ener_per_bd_iQ, - max_ener_band, bits_per_bands, &nb_subbands, exc_diff, concat_in, &pvq_len, st_fx->coder_type, st_fx->bwidth_fx, - st_fx->GSC_noisy_speech_fx, st_fx->L_frame_fx, st_fx->element_mode, st_fx->GSC_IVAS_mode); + bands_and_bit_alloc_fx(hGSCEnc->cor_strong_limit, hGSCEnc->noise_lev, st_fx->core_brate, Diff_len, bit, &bit, Ener_per_bd_iQ, + max_ener_band, bits_per_bands, &nb_subbands, exc_diff, concat_in, &pvq_len, st_fx->coder_type, st_fx->bwidth, + st_fx->GSC_noisy_speech, st_fx->L_frame, st_fx->element_mode, st_fx->GSC_IVAS_mode); Q_tmp = Q_exc; move16(); @@ -539,7 +539,7 @@ void gsc_enc_fx( max_eq = 0; max_eq_val = 1.0f; - IF ((((LT_32(st_fx->core_brate_fx, ACELP_7k20) && EQ_16(st_fx->GSC_noisy_speech_fx, 1)) || LT_32(st_fx->core_brate_fx, 6000)) && LE_16(st_fx->coder_type, UNVOICED)) || GE_16(st_fx->GSC_IVAS_mode, 1)) + IF ((((LT_32(st_fx->core_brate, ACELP_7k20) && EQ_16(st_fx->GSC_noisy_speech, 1)) || LT_32(st_fx->core_brate, 6000)) && LE_16(st_fx->coder_type, UNVOICED)) || GE_16(st_fx->GSC_IVAS_mode, 1)) { j = emaximum(concat_out, nb_subbands * 16, &max_eq); max_eq = max_eq_val / (fabsf(concat_out[j]) + 0.01f); @@ -560,8 +560,8 @@ void gsc_enc_fx( move16(); } test(); - IF( NE_16(st_fx->last_coder_type_fx, AUDIO) /* First audio frame */ - && NE_16(st_fx->last_coder_type_fx, UNVOICED) )/* last_coder_type == INACTIVE is overwritten in update_enc to UNVOICED */ + IF( NE_16(st_fx->last_coder_type, AUDIO) /* First audio frame */ + && NE_16(st_fx->last_coder_type, UNVOICED) )/* last_coder_type == INACTIVE is overwritten in update_enc to UNVOICED */ { FOR( j = 0; j < shl(nb_subbands,4); j++ ) { @@ -579,7 +579,7 @@ void gsc_enc_fx( move16(); } test(); - IF( EQ_32(st_fx->core_brate_fx,ACELP_8k00)&&NE_16(st_fx->bwidth_fx,NB)) + IF( EQ_32(st_fx->core_brate,ACELP_8k00)&&NE_16(st_fx->bwidth,NB)) { bitallocation_exc[0] = 0; move16(); @@ -604,14 +604,14 @@ void gsc_enc_fx( *--------------------------------------------------------------------------------------*/ #ifdef ADD_LRTD test();test();test(); - IF (GE_16(st_fx->GSC_IVAS_mode, 1) && EQ_16(st_fx->GSC_noisy_speech_fx, 1)) + IF (GE_16(st_fx->GSC_IVAS_mode, 1) && EQ_16(st_fx->GSC_noisy_speech, 1)) { FOR (i = 64; i < st->L_frame; i++) { exc_diffQ[i] *= max_eq; } } - ELSE IF (LT_32(st_fx->core_brate_fx, ACELP_7k20) && EQ_16(st_fx->GSC_noisy_speech_fx, 1) && LE_16(st_fx->coder_type, UNVOICED)) + ELSE IF (LT_32(st_fx->core_brate, ACELP_7k20) && EQ_16(st_fx->GSC_noisy_speech, 1) && LE_16(st_fx->coder_type, UNVOICED)) { FOR (i = 0; i < L_FRAME; i++) { @@ -621,16 +621,16 @@ void gsc_enc_fx( else #endif { - freq_dnw_scaling_fx(hGSCEnc->cor_strong_limit, st_fx->coder_type, hGSCEnc->noise_lev, st_fx->core_brate_fx, exc_diffQ, Q_PVQ_OUT, st_fx->L_frame_fx); + freq_dnw_scaling_fx(hGSCEnc->cor_strong_limit, st_fx->coder_type, hGSCEnc->noise_lev, st_fx->core_brate, exc_diffQ, Q_PVQ_OUT, st_fx->L_frame); } /*--------------------------------------------------------------------------------------* * Estimate noise level *--------------------------------------------------------------------------------------*/ - highband_exc_dct_in_fx( st_fx->core_brate_fx, mfreq_bindiv_loc, last_bin, Diff_len, hGSCEnc->noise_lev, tmp_band, exc_diffQ, - &hGSCEnc->seed_tcx, Ener_per_bd_iQ, nb_subfr, exc_dct_in, st_fx->last_coder_type_fx, bitallocation_band, lsf_new, + highband_exc_dct_in_fx( st_fx->core_brate, mfreq_bindiv_loc, last_bin, Diff_len, hGSCEnc->noise_lev, tmp_band, exc_diffQ, + &hGSCEnc->seed_tcx, Ener_per_bd_iQ, nb_subfr, exc_dct_in, st_fx->last_coder_type, bitallocation_band, lsf_new, hGSCEnc->last_exc_dct_in_fx, &st_fx->last_ener_fx, hGSCEnc->last_bitallocation_band, bitallocation_exc, 0, st_fx->coder_type, - st_fx->bwidth_fx, exc_wo_nf, Q_PVQ_OUT, Q_exc, st_fx->GSC_noisy_speech_fx, NULL, st_fx->L_frame_fx, st_fx->element_mode, st_fx->GSC_IVAS_mode); + st_fx->bwidth, exc_wo_nf, Q_PVQ_OUT, Q_exc, st_fx->GSC_noisy_speech, NULL, st_fx->L_frame, st_fx->element_mode, st_fx->GSC_IVAS_mode); exc_dct_in[0] = 0; move16(); diff --git a/lib_enc/guided_plc_enc_fx.c b/lib_enc/guided_plc_enc_fx.c index 4b1decb7e..a21606c1a 100644 --- a/lib_enc/guided_plc_enc_fx.c +++ b/lib_enc/guided_plc_enc_fx.c @@ -205,7 +205,7 @@ void coderLookAheadInnovation( *-------------------------------------------------------------------*/ void enc_prm_side_Info_fx( PLC_ENC_EVS_HANDLE hPlc_Ext, - Encoder_State_fx *st + Encoder_State *st ) { Word16 diff_pitch; @@ -245,7 +245,7 @@ void enc_prm_side_Info_fx( * Encoder side loss simulation *-------------------------------------------------------------------*/ void encoderSideLossSimulation_fx( - Encoder_State_fx *st, + Encoder_State *st, PLC_ENC_EVS_HANDLE hPlc_Ext, Word16 *lsf_q, /* Q1*1.28 */ const Word16 stab_fac, /* Q15 */ @@ -288,7 +288,7 @@ void encoderSideLossSimulation_fx( IF (calcOnlyISF != 0) { /* ISF concealment simulation */ - getConcealedLSF( hPlc_Ext, xsfBase, st->clas_fx, L_frame ); + getConcealedLSF( hPlc_Ext, xsfBase, st->clas, L_frame ); hPlc_Ext->T0 = hPlc_Ext->T0_4th; move16(); } @@ -306,7 +306,7 @@ void encoderSideLossSimulation_fx( Scale_sig( old_exc_Qx, 8, hPlc_Ext->Q_exp ); /* ISF concealment simulation */ - getConcealedLP( hPlc_Ext, A_3Q12, xsfBase, st->clas_fx, L_frame ); + getConcealedLP( hPlc_Ext, A_3Q12, xsfBase, st->clas, L_frame ); /* apply encoder side PLC simulation */ hPlc_Ext->pit_min = st->pit_min; @@ -325,7 +325,7 @@ void encoderSideLossSimulation_fx( *-------------------------------------------------------------------*/ void GplcTcxEncSetup_fx( - Encoder_State_fx *st, + Encoder_State *st, PLC_ENC_EVS_HANDLE hPlc_Ext, Word16 Q_new ) @@ -448,7 +448,7 @@ Word16 encSideSpecPowDiffuseDetector_fx( * *-------------------------------------------------------------------*/ void updateSpecPowDiffuseIdx_fx( - Encoder_State_fx *st + Encoder_State *st ) { Word16 min_gp; diff --git a/lib_enc/hq_classifier_enc_fx.c b/lib_enc/hq_classifier_enc_fx.c index 75422d569..aec5d03ee 100644 --- a/lib_enc/hq_classifier_enc_fx.c +++ b/lib_enc/hq_classifier_enc_fx.c @@ -38,7 +38,7 @@ void hvq_classifier_fx( const Word32 *input, Word16 *prev_Npeaks, Word16 *prev_p *--------------------------------------------------------------------------*/ Word16 hq_classifier_enc_fx( /* o : Consumed bits Q0 */ - Encoder_State_fx *st_fx, /* i/o: encoder state structure */ + Encoder_State *st_fx, /* i/o: encoder state structure */ const Word16 length, /* i : Frame length Q0 */ const Word32 *coefs, /* i : Spectral coefficients Q12 */ const Word16 is_transient, /* i : Transient flag Q0 */ @@ -64,38 +64,38 @@ Word16 hq_classifier_enc_fx( /* o : Consumed bits Q0 */ test(); test(); test(); - IF(EQ_16(length, L_FRAME32k) && NE_16(is_transient, 1) && LE_32(st_fx->core_brate_fx, HQ_32k) && EQ_16(st_fx->bwidth_fx, st_fx->last_bwidth_fx)) + IF(EQ_16(length, L_FRAME32k) && NE_16(is_transient, 1) && LE_32(st_fx->core_brate, HQ_32k) && EQ_16(st_fx->bwidth, st_fx->last_bwidth)) { /* Detect HQ_HARMONIC mode */ - *hqswb_clas = peak_avrg_ratio_fx(st_fx->total_brate_fx, coefs, NUMC_N + 96, &hHQ_core->mode_count, &hHQ_core->mode_count1, 12); + *hqswb_clas = peak_avrg_ratio_fx(st_fx->total_brate, coefs, NUMC_N + 96, &hHQ_core->mode_count, &hHQ_core->mode_count1, 12); /* Detect harmonic VQ mode HQ_HVQ */ - hvq_classifier_fx(coefs, &hHQ_core->prev_Npeaks, hHQ_core->prev_peaks, hqswb_clas, Npeaks, peaks, st_fx->core_brate_fx, st_fx->last_core_fx, + hvq_classifier_fx(coefs, &hHQ_core->prev_Npeaks, hHQ_core->prev_peaks, hqswb_clas, Npeaks, peaks, st_fx->core_brate, st_fx->last_core, nf_gains, &hHQ_core->hvq_hangover, pe_gains); } test(); test(); test(); - IF(EQ_16(length, L_FRAME48k) && NE_16(is_transient, 1) && LE_32(st_fx->core_brate_fx, HQ_32k) && EQ_16(st_fx->bwidth_fx, st_fx->last_bwidth_fx)) + IF(EQ_16(length, L_FRAME48k) && NE_16(is_transient, 1) && LE_32(st_fx->core_brate, HQ_32k) && EQ_16(st_fx->bwidth, st_fx->last_bwidth)) { /* Detect HQ_HARMONIC mode */ - *hqswb_clas = peak_avrg_ratio_fx(st_fx->total_brate_fx, coefs, NUMC_N + 96, &hHQ_core->mode_count, &hHQ_core->mode_count1, 12); + *hqswb_clas = peak_avrg_ratio_fx(st_fx->total_brate, coefs, NUMC_N + 96, &hHQ_core->mode_count, &hHQ_core->mode_count1, 12); /* Detect harmonic VQ mode HQ_HVQ */ hvq_classifier_fx(coefs, &hHQ_core->prev_Npeaks, hHQ_core->prev_peaks, hqswb_clas, Npeaks, peaks, - st_fx->core_brate_fx, st_fx->last_core_fx, nf_gains, &hHQ_core->hvq_hangover, pe_gains); + st_fx->core_brate, st_fx->last_core, nf_gains, &hHQ_core->hvq_hangover, pe_gains); } test(); test(); - IF(EQ_16(length, L_FRAME48k) && LE_32(st_fx->core_brate_fx, HQ_32k) && EQ_16(*hqswb_clas, HQ_NORMAL)) + IF(EQ_16(length, L_FRAME48k) && LE_32(st_fx->core_brate, HQ_32k) && EQ_16(*hqswb_clas, HQ_NORMAL)) { *hqswb_clas = HQ_GEN_FB; move16(); } test(); - IF(GE_16(length, L_FRAME32k) && LE_32(st_fx->core_brate_fx, HQ_32k)) + IF(GE_16(length, L_FRAME32k) && LE_32(st_fx->core_brate, HQ_32k)) { bits = 2; move16(); @@ -107,7 +107,7 @@ Word16 hq_classifier_enc_fx( /* o : Consumed bits Q0 */ } test(); - IF(EQ_16(length, L_FRAME48k) && LE_32(st_fx->core_brate_fx, HQ_32k)) + IF(EQ_16(length, L_FRAME48k) && LE_32(st_fx->core_brate, HQ_32k)) { IF(GE_16(*hqswb_clas, HQ_GEN_SWB)) { @@ -125,7 +125,7 @@ Word16 hq_classifier_enc_fx( /* o : Consumed bits Q0 */ test(); test(); - IF(EQ_16(*hqswb_clas, HQ_NORMAL) && EQ_16(length, L_FRAME32k) && LE_32(st_fx->core_brate_fx, HQ_32k)) + IF(EQ_16(*hqswb_clas, HQ_NORMAL) && EQ_16(length, L_FRAME32k) && LE_32(st_fx->core_brate, HQ_32k)) { *hqswb_clas = HQ_GEN_SWB; move16(); @@ -157,13 +157,13 @@ Word16 hq_classifier_enc_fx( /* o : Consumed bits Q0 */ test(); IF (EQ_16(length, L_SPEC32k) || EQ_16(length, L_SPEC48k)) { - IF(LE_32(st_fx->core_brate_fx, max_brate)) + IF(LE_32(st_fx->core_brate, max_brate)) { test(); - IF(!is_transient && EQ_16(st_fx->bwidth_fx, st_fx->last_bwidth_fx)) + IF(!is_transient && EQ_16(st_fx->bwidth, st_fx->last_bwidth)) { /* Detect HQ_HARMONIC mode */ - *hqswb_clas = peak_avrg_ratio_fx(st_fx->total_brate_fx, coefs, NUMC_N + 96, &hHQ_core->mode_count, &hHQ_core->mode_count1, 12); + *hqswb_clas = peak_avrg_ratio_fx(st_fx->total_brate, coefs, NUMC_N + 96, &hHQ_core->mode_count, &hHQ_core->mode_count1, 12); #ifdef ADD_IVAS_HQ_CODE harmonic_decision = hf_spectrum_sparseness(st, coefs); @@ -179,7 +179,7 @@ Word16 hq_classifier_enc_fx( /* o : Consumed bits Q0 */ ELSE { /* Detect harmonic VQ mode HQ_HVQ */ - hvq_classifier_fx(coefs, &hHQ_core->prev_Npeaks, hHQ_core->prev_peaks, hqswb_clas, Npeaks, peaks, st_fx->core_brate_fx, st_fx->last_core_fx, + hvq_classifier_fx(coefs, &hHQ_core->prev_Npeaks, hHQ_core->prev_peaks, hqswb_clas, Npeaks, peaks, st_fx->core_brate, st_fx->last_core, nf_gains, &hHQ_core->hvq_hangover, pe_gains); } } @@ -194,7 +194,7 @@ Word16 hq_classifier_enc_fx( /* o : Consumed bits Q0 */ /* write signalling info to the bitstream */ push_indice_fx(st_fx->hBstr, IND_HQ_SWB_CLAS, *hqswb_clas, bits); - IF (LE_32(st_fx->core_brate_fx, HQ_32k) && EQ_16(*hqswb_clas, HQ_NORMAL)) + IF (LE_32(st_fx->core_brate, HQ_32k) && EQ_16(*hqswb_clas, HQ_NORMAL)) { IF (EQ_16(length, L_SPEC32k)) { @@ -781,7 +781,7 @@ void hvq_classifier_fx( *--------------------------------------------------------------------------*/ /*! r: Harmonic decision for high band */ static int16_t hf_spectrum_sparseness( - Encoder_State_fx* st, /* i/o: encoder state structure */ + Encoder_State* st, /* i/o: encoder state structure */ const float* coefs /* i : MDCT spectrum */ ) { diff --git a/lib_enc/hq_core_enc_fx.c b/lib_enc/hq_core_enc_fx.c index f280eac79..0a89fb5d6 100644 --- a/lib_enc/hq_core_enc_fx.c +++ b/lib_enc/hq_core_enc_fx.c @@ -18,7 +18,7 @@ *--------------------------------------------------------------------------*/ void hq_core_enc_fx( - Encoder_State_fx *st_fx, + Encoder_State *st_fx, const Word16 *audio, /* i : input audio signal Q0 */ const Word16 input_frame_orig, /* i : frame length */ const Word16 hq_core_type, /* i : HQ core type */ @@ -49,7 +49,7 @@ void hq_core_enc_fx( BSTR_ENC_HANDLE hBstr = st_fx->hBstr; set32_fx( t_audio, 0, L_FRAME48k ); - st_fx->Nb_ACELP_frames_fx = 0; + st_fx->Nb_ACELP_frames = 0; move16(); /* set input_frame length */ @@ -76,7 +76,7 @@ void hq_core_enc_fx( *--------------------------------------------------------------------------*/ /*num_bits = (short)(st->total_brate / 50); */ - Mpy_32_16_ss(st_fx->total_brate_fx, 5243, &L_tmp, &lsb); /* 5243 is 1/50 in Q18. (0+18-15=3) */ + Mpy_32_16_ss(st_fx->total_brate, 5243, &L_tmp, &lsb); /* 5243 is 1/50 in Q18. (0+18-15=3) */ num_bits = extract_l(L_shr(L_tmp, 3)); /*Q0 */ extra_unused = 0; move16(); @@ -89,7 +89,7 @@ void hq_core_enc_fx( #ifdef ADD_IVAS_HQ_CODE test();test();test(); - IF (GT_16(st_fx->element_mode, EVS_MONO) && (EQ_16(st_fx->last_core_fx, ACELP_CORE) || EQ_16(st_fx->last_core_fx, AMR_WB_CORE))) + IF (GT_16(st_fx->element_mode, EVS_MONO) && (EQ_16(st_fx->last_core, ACELP_CORE) || EQ_16(st_fx->last_core, AMR_WB_CORE))) { /*-------------------------------------------------------------------------- * IVAS switching frame @@ -104,8 +104,8 @@ void hq_core_enc_fx( Q_audio = 16; move16(); /*tbv inspired from core_enc_ol*/ TCX_MDCT(wtda_audio, t_audio, &Q_audio, left_overlap, sub(L_spec, shr( add(left_overlap, right_overlap), 1)), right_overlap, st_fx->element_mode); - inner_frame = inner_frame_tbl[st_fx->bwidth_fx]; - L_spec = l_spec_ext_tbl[st_fx->bwidth_fx]; + inner_frame = inner_frame_tbl[st_fx->bwidth]; + L_spec = l_spec_ext_tbl[st_fx->bwidth]; is_transient = 0; move16();move16();move16(); } @@ -124,7 +124,7 @@ void hq_core_enc_fx( st_fx->hTcxCfg->tcx_last_overlap_mode, st_fx->hTcxCfg->tcx_curr_overlap_mode, input_frame); test(); - IF(st_fx->last_core_fx == ACELP_CORE || EQ_16(st_fx->last_core_fx, AMR_WB_CORE)) + IF(st_fx->last_core == ACELP_CORE || EQ_16(st_fx->last_core, AMR_WB_CORE)) { /* Preprocessing in the first HQ frame after ACELP frame */ core_switching_hq_prepare_enc_fx(st_fx, &num_bits, input_frame, wtda_audio, two_frames_buffer + input_frame); @@ -164,10 +164,10 @@ void hq_core_enc_fx( } /* limit encoded band-width according to the command-line OR BWD limitation */ - inner_frame = inner_frame_tbl[st_fx->bwidth_fx]; + inner_frame = inner_frame_tbl[st_fx->bwidth]; move16(); #ifdef ADD_IVAS_HQ_CODE_L_SPEC - L_spec = l_spec_tbl[st_fx->bwidth_fx]; + L_spec = l_spec_tbl[st_fx->bwidth]; move16(); #endif IF(GT_16(input_frame, inner_frame)) @@ -215,7 +215,7 @@ void hq_core_enc_fx( *--------------------------------------------------------------------------*/ test(); - IF ((EQ_16(st_fx->last_core_fx, TCX_20_CORE) || EQ_16(st_fx->last_core_fx, TCX_10_CORE) || EQ_16(st_fx->last_core_fx, HQ_CORE)) && GT_32(st_fx->core_brate_fx, MINIMUM_RATE_TO_ENCODE_VOICING_FLAG)) + IF ((EQ_16(st_fx->last_core, TCX_20_CORE) || EQ_16(st_fx->last_core, TCX_10_CORE) || EQ_16(st_fx->last_core, HQ_CORE)) && GT_32(st_fx->core_brate, MINIMUM_RATE_TO_ENCODE_VOICING_FLAG)) { IF ( Voicing_flag > 0 ) { diff --git a/lib_enc/hq_hr_enc_fx.c b/lib_enc/hq_hr_enc_fx.c index 912f6dd63..af7df7e62 100644 --- a/lib_enc/hq_hr_enc_fx.c +++ b/lib_enc/hq_hr_enc_fx.c @@ -17,7 +17,7 @@ * HQ High rate encoding routine *--------------------------------------------------------------------------*/ void hq_hr_enc_fx( - Encoder_State_fx *st_fx, /* i/o: encoder state structure fx */ + Encoder_State *st_fx, /* i/o: encoder state structure fx */ Word32 *t_audio, /* i/o: transform-domain coefficients Q12 */ const Word16 length, /* i : length of spectrum Q0 */ Word16 *num_bits, /* i : number of available bits Q0 */ @@ -96,7 +96,7 @@ void hq_hr_enc_fx( * set quantization parameters *------------------------------------------------------------------*/ - hq_configure_evs_fx( length, hqswb_clas, st_fx->core_brate_fx, &num_sfm, &nb_sfm, &start_norm, &num_env_bands, &numnrmibits, &hq_generic_offset, + hq_configure_evs_fx( length, hqswb_clas, st_fx->core_brate, &num_sfm, &nb_sfm, &start_norm, &num_env_bands, &numnrmibits, &hq_generic_offset, sfmsize, sfm_start, sfm_end ); /*------------------------------------------------------------------* @@ -152,7 +152,7 @@ void hq_hr_enc_fx( * Bit allocation *------------------------------------------------------------------*/ - hq_bit_allocation_fx( st_fx->core_brate_fx, length, hqswb_clas, num_bits, normqlg2, nb_sfm, sfmsize, noise_level, + hq_bit_allocation_fx( st_fx->core_brate, length, hqswb_clas, num_bits, normqlg2, nb_sfm, sfmsize, noise_level, R, Rsubband, &sum, &core_sfm, num_env_bands ); /*------------------------------------------------------------------* @@ -175,7 +175,7 @@ void hq_hr_enc_fx( *------------------------------------------------------------------*/ IF( EQ_16( hqswb_clas, HQ_HVQ)) { - sum = hvq_enc_fx( st_fx, st_fx->core_brate_fx, *num_bits, Npeaks, ynrm, R, peaks, nf_gains, noise_level, pe_gains, t_audio, t_audio_q ); + sum = hvq_enc_fx( st_fx, st_fx->core_brate, *num_bits, Npeaks, ynrm, R, peaks, nf_gains, noise_level, pe_gains, t_audio, t_audio_q ); *num_bits = sub(*num_bits, sum); } ELSE @@ -219,7 +219,7 @@ void hq_hr_enc_fx( test(); test(); test(); - IF ( NE_16(is_transient,1 ) && NE_16(hqswb_clas,HQ_HVQ) && !(EQ_16(length,L_FRAME16k) && LE_32(st_fx->core_brate_fx,HQ_32k))) + IF ( NE_16(is_transient,1 ) && NE_16(hqswb_clas,HQ_HVQ) && !(EQ_16(length,L_FRAME16k) && LE_32(st_fx->core_brate,HQ_32k))) { test(); IF (EQ_16(hqswb_clas, HQ_GEN_SWB)||EQ_16(hqswb_clas,HQ_GEN_FB)) diff --git a/lib_enc/hq_lr_enc_fx.c b/lib_enc/hq_lr_enc_fx.c index 3b1730bef..9c041f35c 100644 --- a/lib_enc/hq_lr_enc_fx.c +++ b/lib_enc/hq_lr_enc_fx.c @@ -24,7 +24,7 @@ static Word16 band_energy_quant_fx(BSTR_ENC_HANDLE hBstr, const Word32 *L_t_aud static Word16 p2a_threshold_quant_fx(BSTR_ENC_HANDLE hBstr, const Word32 *L_t_audio, const Word16 band_start[], const Word16 band_end[], const Word16 band_width[], const Word16 bands, const Word16 p2a_bands, const Word16 p2a_th, Word16 *p2a_flags ); -static void mdct_spectrum_fine_gain_enc_fx( Encoder_State_fx *st_fx, const Word32 L_ybuf[], Word32 L_y2[], const Word16 band_start[], const Word16 band_end[], +static void mdct_spectrum_fine_gain_enc_fx( Encoder_State *st_fx, const Word32 L_ybuf[], Word32 L_y2[], const Word16 band_start[], const Word16 band_end[], const Word16 k_sort[], const Word16 bands, const Word32 L_qint, const Word16 Ngq, const Word16 gqlevs, const Word16 gqbits ); /*--------------------------------------------------------------------------* @@ -34,7 +34,7 @@ static void mdct_spectrum_fine_gain_enc_fx( Encoder_State_fx *st_fx, const Word *--------------------------------------------------------------------------*/ static void spt_shorten_domain_set_fx( - Encoder_State_fx *st_fx, /* i: encoder state structure */ + Encoder_State *st_fx, /* i: encoder state structure */ const Word32 L_t_audio[], /* i: input spectrum */ const Word16 p2a_flags[], /* i: p2a anlysis information */ const Word16 new_band_start[], /* i: new band start position */ @@ -108,7 +108,7 @@ static void spt_shorten_domain_set_fx( *--------------------------------------------------------------------------*/ void hq_lr_enc_fx( - Encoder_State_fx *st_fx, /* i/o: : encoder state structure */ + Encoder_State *st_fx, /* i/o: : encoder state structure */ Word32 L_t_audio[], /* i/o: Q12 : transform-domain coefs. */ const Word16 inner_frame_fx,/* i : Q0 : inner frame length */ Word16 *num_bits_fx, /* i/o: Q0 : number of available bits */ @@ -195,12 +195,12 @@ void hq_lr_enc_fx( tmp2 = 0; /* to avoid compilation warnings */ - L_bwe_br = L_add(st_fx->core_brate_fx, 0); + L_bwe_br = L_add(st_fx->core_brate, 0); hqswb_clas_fx = HQ_NORMAL; move16(); test(); test(); - IF( EQ_16(st_fx->bwidth_fx, SWB)&&(EQ_32(L_bwe_br,HQ_16k40)||EQ_32(L_bwe_br,HQ_13k20))) + IF( EQ_16(st_fx->bwidth, SWB)&&(EQ_32(L_bwe_br,HQ_16k40)||EQ_32(L_bwe_br,HQ_13k20))) { IF ( EQ_16(is_transient_fx, 1)) { @@ -209,7 +209,7 @@ void hq_lr_enc_fx( } ELSE { - hqswb_clas_fx = peak_avrg_ratio_fx( st_fx->total_brate_fx, L_t_audio, NUMC_N, &hHQ_core->mode_count, &hHQ_core->mode_count1, SWB_BWE_LR_Qs ); + hqswb_clas_fx = peak_avrg_ratio_fx( st_fx->total_brate, L_t_audio, NUMC_N, &hHQ_core->mode_count, &hHQ_core->mode_count1, SWB_BWE_LR_Qs ); } /* write the classification information into the bitstream */ @@ -242,7 +242,7 @@ void hq_lr_enc_fx( test(); test(); test(); - IF( EQ_16(st_fx->bwidth_fx, SWB)&&is_transient_fx==0&&(EQ_32(L_bwe_br,HQ_16k40)||EQ_32(L_bwe_br,HQ_13k20))) + IF( EQ_16(st_fx->bwidth, SWB)&&is_transient_fx==0&&(EQ_32(L_bwe_br,HQ_16k40)||EQ_32(L_bwe_br,HQ_13k20))) { /* reserve bits for HQ_NORMAL2 and HQ_HARMONIC modes */ test(); @@ -254,7 +254,7 @@ void hq_lr_enc_fx( test(); test(); - IF(( EQ_32(L_bwe_br, HQ_16k40)||EQ_32(L_bwe_br,HQ_13k20))&&EQ_16(st_fx->bwidth_fx,SWB)) + IF(( EQ_32(L_bwe_br, HQ_16k40)||EQ_32(L_bwe_br,HQ_13k20))&&EQ_16(st_fx->bwidth,SWB)) { IF( NE_16(hHQ_core->prev_hqswb_clas, HQ_NORMAL)) { @@ -307,7 +307,7 @@ void hq_lr_enc_fx( test(); test(); - IF( EQ_16(st_fx->bwidth_fx, SWB)&&(EQ_32(L_bwe_br,HQ_16k40)||EQ_32(L_bwe_br,HQ_13k20))) + IF( EQ_16(st_fx->bwidth, SWB)&&(EQ_32(L_bwe_br,HQ_16k40)||EQ_32(L_bwe_br,HQ_13k20))) { IF( EQ_16(hqswb_clas_fx, HQ_HARMONIC)) { @@ -386,7 +386,7 @@ void hq_lr_enc_fx( test(); test(); test(); - IF ( is_transient_fx == 0 && EQ_16(inner_frame_fx, L_FRAME8k)&&LE_32(st_fx->core_brate_fx,ACELP_13k20)) + IF ( is_transient_fx == 0 && EQ_16(inner_frame_fx, L_FRAME8k)&&LE_32(st_fx->core_brate,ACELP_13k20)) { lowband = 6; move16(); @@ -399,7 +399,7 @@ void hq_lr_enc_fx( set16_fx( &p2a_flags_tmp[sub(bands_fx,trans_bit)], 0, 2 ); - IF( EQ_32(st_fx->core_brate_fx, ACELP_13k20)) + IF( EQ_32(st_fx->core_brate, ACELP_13k20)) { beta_fx = 13107; move16();/*14 1.25f; */ @@ -439,7 +439,7 @@ void hq_lr_enc_fx( test(); test(); test(); - IF(( (LT_32(L_tmp, L_shr(Ep_avrgL_fx,1))&&EQ_32(st_fx->core_brate_fx,ACELP_13k20))||LT_32(st_fx->core_brate_fx,ACELP_13k20))&& + IF(( (LT_32(L_tmp, L_shr(Ep_avrgL_fx,1))&&EQ_32(st_fx->core_brate,ACELP_13k20))||LT_32(st_fx->core_brate,ACELP_13k20))&& LT_32(L_tmp2, L_tmp3) && GT_32(L_tmp2, L_shr(Ep_avrg_fx,7)) ) { FOR(i = lowband; i < bands_fx; i++) @@ -643,7 +643,7 @@ void hq_lr_enc_fx( } } hq2_bit_alloc_fx( L_band_energy_tmp, bands_fx, L_Rk, &bit_budget_fx, p2a_flags_fx, bit_alloc_weight_fx, band_width, - *num_bits_fx, hqswb_clas_fx, st_fx->bwidth_fx, is_transient_fx ); + *num_bits_fx, hqswb_clas_fx, st_fx->bwidth, is_transient_fx ); /* encode the last p2a_bands-1 subbands bit-allocation index of the previous frame */ FOR(i = 0; i < 2; i++) @@ -662,7 +662,7 @@ void hq_lr_enc_fx( Ep_tmp_fx[i] = L_shl(Ep_tmp_fx[i],2); #endif /* BASOP_NOGLOB */ } - IF( EQ_32( st_fx->core_brate_fx, ACELP_13k20 )) + IF( EQ_32( st_fx->core_brate, ACELP_13k20 )) { lowband = 8; move16(); @@ -889,7 +889,7 @@ void hq_lr_enc_fx( } hq2_bit_alloc_fx( L_band_energy_tmp, bands_fx, L_Rk, &bit_budget_fx, p2a_flags_fx, bit_alloc_weight_fx, band_width, - *num_bits_fx, hqswb_clas_fx, st_fx->bwidth_fx, is_transient_fx ); + *num_bits_fx, hqswb_clas_fx, st_fx->bwidth, is_transient_fx ); /* encode the last p2a_bands-1 subbands bit-allocation index of the previous frame */ FOR(i = 0; i < 2; i++) @@ -897,7 +897,7 @@ void hq_lr_enc_fx( push_indice_fx( st_fx->hBstr, IND_HQ2_LAST_BA_MAX_BAND, hHQ_core->last_bitalloc_max_band[i], 1 ); } } - ELSE IF( EQ_16(st_fx->bwidth_fx, SWB)&&EQ_16(hqswb_clas_fx,HQ_HARMONIC)&&(EQ_32(L_bwe_br,HQ_16k40)||EQ_32(L_bwe_br,HQ_13k20))) + ELSE IF( EQ_16(st_fx->bwidth, SWB)&&EQ_16(hqswb_clas_fx,HQ_HARMONIC)&&(EQ_32(L_bwe_br,HQ_16k40)||EQ_32(L_bwe_br,HQ_13k20))) { /* bit allocation for harmonic mode */ hq2_bit_alloc_har_fx( L_band_energy, bit_budget_fx, bands_fx, L_Rk, p2a_bands_fx, L_bwe_br, p2a_flags_fx, band_width ); @@ -908,13 +908,13 @@ void hq_lr_enc_fx( /* estimate number of bits per band */ hq2_bit_alloc_fx( L_band_energy, bands_fx, L_Rk, &bit_budget_fx, p2a_flags_fx, bit_alloc_weight_fx, band_width, - *num_bits_fx, hqswb_clas_fx, st_fx->bwidth_fx, is_transient_fx ); + *num_bits_fx, hqswb_clas_fx, st_fx->bwidth, is_transient_fx ); } tcq_core_LR_enc_fx( hBstr, /*st_fx->idchan, */inp_vector_fx, /*t_audio, */L_t_audio, /*y2, */L_y2, bit_budget_fx, bands_fx, band_start, band_end, band_width, /*Rk*/L_Rk, npulses_fx, k_sort_fx, p2a_flags_fx, p2a_bands_fx, hHQ_core->last_bitalloc_max_band, inner_frame_fx, adjustFlag, is_transient_fx ); - IF((EQ_16(inner_frame_fx, L_FRAME8k)&&LE_32(st_fx->core_brate_fx,ACELP_13k20))||EQ_16(inner_frame_fx,L_FRAME16k)) + IF((EQ_16(inner_frame_fx, L_FRAME8k)&&LE_32(st_fx->core_brate,ACELP_13k20))||EQ_16(inner_frame_fx,L_FRAME16k)) { j = 0; FOR(i = 2; i > 0; i--) @@ -951,11 +951,11 @@ void hq_lr_enc_fx( Copy32(L_y2, L_y2_ni, band_end[bands_fx-1]+1); hq2_noise_inject_fx( L_y2_ni, band_start, band_end, band_width, Ep_fx, L_Rk, npulses_fx, ni_seed_fx, bands_fx, 0, bw_low, bw_high, enerL_fx, enerH_fx, hHQ_core->last_ni_gain_fx, hHQ_core->last_env_fx, &hHQ_core->last_max_pos_pulse, p2a_flags_fx, p2a_bands_fx, - hqswb_clas_fx, st_fx->bwidth_fx, L_bwe_br ); + hqswb_clas_fx, st_fx->bwidth, L_bwe_br ); test(); test(); - IF( EQ_16(st_fx->bwidth_fx, SWB)&&(EQ_32(L_bwe_br,HQ_16k40)||EQ_32(L_bwe_br,HQ_13k20))) + IF( EQ_16(st_fx->bwidth, SWB)&&(EQ_32(L_bwe_br,HQ_16k40)||EQ_32(L_bwe_br,HQ_13k20))) { test(); IF( EQ_16(hqswb_clas_fx, HQ_NORMAL)||EQ_16(hqswb_clas_fx,HQ_HARMONIC)) @@ -989,10 +989,10 @@ void hq_lr_enc_fx( } } - updat_prev_frm_fx( L_y2, L_t_audio, L_bwe_br, length_fx, inner_frame_fx, bands_fx, st_fx->bwidth_fx, is_transient_fx, hqswb_clas_fx, &hHQ_core->prev_hqswb_clas, + updat_prev_frm_fx( L_y2, L_t_audio, L_bwe_br, length_fx, inner_frame_fx, bands_fx, st_fx->bwidth, is_transient_fx, hqswb_clas_fx, &hHQ_core->prev_hqswb_clas, hHQ_core->prev_SWB_peak_pos, prev_SWB_peak_pos_tmp_fx, &hHQ_core->prev_frm_hfe2, &hHQ_core->prev_stab_hfe2, 0 ); - IF( NE_16(st_fx->bwidth_fx, SWB)) + IF( NE_16(st_fx->bwidth, SWB)) { /* reset HQ classifier memories */ hHQ_core->mode_count = 0; @@ -1004,7 +1004,7 @@ void hq_lr_enc_fx( test(); test(); test(); - IF( NE_16(hqswb_clas_fx, HQ_HARMONIC)&&(EQ_32(L_bwe_br,HQ_16k40)||EQ_32(L_bwe_br,HQ_13k20))&&EQ_16(st_fx->bwidth_fx,SWB)) + IF( NE_16(hqswb_clas_fx, HQ_HARMONIC)&&(EQ_32(L_bwe_br,HQ_16k40)||EQ_32(L_bwe_br,HQ_13k20))&&EQ_16(st_fx->bwidth,SWB)) { hHQ_core->prev_frm_index[0] = -1; move16(); @@ -1815,7 +1815,7 @@ static Word16 p2a_threshold_quant_fx( *-------------------------------------------------------------------*/ static void mdct_spectrum_fine_gain_enc_fx( - Encoder_State_fx *st_fx, /* i/o: encoder state structure */ + Encoder_State *st_fx, /* i/o: encoder state structure */ const Word32 L_ybuf[], /* i : Q12 : input spectrum */ Word32 L_y2[], /* i/o: Q12 : decoded spectrum */ const Word16 band_start[], /* i : Q0 : table of start freq for every subband */ diff --git a/lib_enc/hvq_enc_fx.c b/lib_enc/hvq_enc_fx.c index af93e08ab..74e0a4cce 100644 --- a/lib_enc/hvq_enc_fx.c +++ b/lib_enc/hvq_enc_fx.c @@ -23,7 +23,7 @@ static Word16 quant_lc(const Word16, Word16 *); *--------------------------------------------------------------------------*/ Word16 hvq_enc_fx( /*o : Consumed bits */ - Encoder_State_fx *st_fx, /*i/o: encoder state structure */ + Encoder_State *st_fx, /*i/o: encoder state structure */ const Word32 core_brate, /*i : Total bit rate */ const Word16 hvq_bits, /*i : HVQ bit budget */ const Word16 Npeaks, /*i : Number of peaks */ @@ -203,7 +203,7 @@ Word16 hvq_enc_fx( /*o : Consumed bits move16(); } } - nBits = peak_vq_enc_fx( st_fx->hBstr, st_fx->bwidth_fx, coefs, coefs_out, core_brate, sub(hvq_bits, bits_used), + nBits = peak_vq_enc_fx( st_fx->hBstr, st_fx->bwidth, coefs, coefs_out, core_brate, sub(hvq_bits, bits_used), Npeaks, ynrm, R, peaks, &nf_gains[0] ); bits_used = add(bits_used, nBits); return bits_used; diff --git a/lib_enc/igf_enc_fx.c b/lib_enc/igf_enc_fx.c index 1efb50d02..7e62c9b4a 100644 --- a/lib_enc/igf_enc_fx.c +++ b/lib_enc/igf_enc_fx.c @@ -1381,7 +1381,7 @@ apply the IGF encoder, main encoder interface **************************************************************************/ void IGFEncApplyMono_fx(const IGF_ENC_INSTANCE_HANDLE hInstance, /**< in: | instance handle of IGF Encoder */ const Word16 igfGridIdx, /**< in: Q0 | IGF grid index */ - Encoder_State_fx *st, /**< in: | Encoder state */ + Encoder_State *st, /**< in: | Encoder state */ Word32 *pMDCTSpectrum, /**< in: Q31 | MDCT spectrum */ Word16 MDCTSpectrum_e, /**< in: | exponent of MDCT spectrum */ Word32 *pPowerSpectrum, /**< in: Q31 | MDCT^2 + MDST^2 spectrum, or estimate */ diff --git a/lib_enc/init_enc_fx.c b/lib_enc/init_enc_fx.c index e0d27edc0..ed557457d 100644 --- a/lib_enc/init_enc_fx.c +++ b/lib_enc/init_enc_fx.c @@ -21,7 +21,7 @@ * Initialization of state variables *-----------------------------------------------------------------------*/ ivas_error init_encoder_fx( - Encoder_State_fx *st_fx /* i/o: Encoder static variables structure */ + Encoder_State *st_fx /* i/o: Encoder static variables structure */ ) { Word16 i; @@ -64,16 +64,16 @@ ISM_MODE ism_mode = ISM_MODE_NONE; set32_fx(st_fx->Bin_E_old_fx, 0, L_FFT/2); - st_fx->input_buff = st_fx->hSignalBuf->input_buff; - set16_fx(st_fx->input_buff, 0, L_FRAME48k + L_FRAME48k + NS2SA(48000, DELAY_FIR_RESAMPL_NS)); - st_fx->old_input_signal_fx = st_fx->input_buff; + st_fx->input_buff_fx = st_fx->hSignalBuf->input_buff; + set16_fx(st_fx->input_buff_fx, 0, L_FRAME48k + L_FRAME48k + NS2SA(48000, DELAY_FIR_RESAMPL_NS)); + st_fx->old_input_signal_fx = st_fx->input_buff_fx; IF (EQ_16(st_fx->element_mode, EVS_MONO)) { - st_fx->input = st_fx->input_buff + st_fx->input_Fs_fx / FRAMES_PER_SEC + NS2SA(st_fx->input_Fs_fx, DELAY_FIR_RESAMPL_NS); + st_fx->input_fx = st_fx->input_buff_fx + st_fx->input_Fs / FRAMES_PER_SEC + NS2SA(st_fx->input_Fs, DELAY_FIR_RESAMPL_NS); } ELSE { - st_fx->input = st_fx->input_buff + st_fx->input_Fs_fx / FRAMES_PER_SEC; + st_fx->input_fx = st_fx->input_buff_fx + st_fx->input_Fs / FRAMES_PER_SEC; } } else @@ -88,35 +88,35 @@ ISM_MODE ism_mode = ISM_MODE_NONE; st_fx->buf_synth = NULL; st_fx->buf_speech_enc = NULL; st_fx->buf_wspeech_enc = NULL; - st_fx->input_buff = NULL; + st_fx->input_buff_fx = NULL; } /*-----------------------------------------------------------------* * ACELP core parameters *-----------------------------------------------------------------*/ - st_fx->last_core_fx = -1; + st_fx->last_core = -1; move16(); - if ( st_fx->Opt_AMR_WB_fx ) + if ( st_fx->Opt_AMR_WB ) { - st_fx->last_core_fx = AMR_WB_CORE; + st_fx->last_core = AMR_WB_CORE; move16(); } - st_fx->L_frame_fx = L_FRAME; + st_fx->L_frame = L_FRAME; move16(); - st_fx->last_coder_type_fx = GENERIC; + st_fx->last_coder_type = GENERIC; move16(); - st_fx->last_total_brate_fx = st_fx->total_brate_fx; + st_fx->last_total_brate = st_fx->total_brate; move32(); - st_fx->last_total_brate_cng_fx = -1; + st_fx->last_total_brate_cng = -1; move32(); - st_fx->last_core_brate_fx = st_fx->total_brate_fx; + st_fx->last_core_brate = st_fx->total_brate; move32(); - st_fx->extl_fx = -1; + st_fx->extl = -1; move16(); - st_fx->last_extl_fx = -1; + st_fx->last_extl = -1; move16(); - st_fx->last_L_frame_fx = L_FRAME; + st_fx->last_L_frame = L_FRAME; move16(); st_fx->rate_switching_reset = 0; move16(); @@ -166,13 +166,13 @@ ISM_MODE ism_mode = ISM_MODE_NONE; set16_fx( st_fx->mem_MA_fx, 0, M ); init_gp_clip_fx( st_fx->clip_var_fx ); - pitch_ol_init_fx( &st_fx->old_thres_fx, &st_fx->old_pitch, &st_fx->delta_pit_fx, &st_fx->old_corr_fx ) ; + pitch_ol_init_fx( &st_fx->old_thres_fx, &st_fx->old_pitch, &st_fx->delta_pit, &st_fx->old_corr_fx ) ; /*-----------------------------------------------------------------* * AMR-WB IO initialization *-----------------------------------------------------------------*/ test(); - IF (st_fx->Opt_AMR_WB_fx || EQ_16(st_fx->element_mode, EVS_MONO)) + IF (st_fx->Opt_AMR_WB || EQ_16(st_fx->element_mode, EVS_MONO)) { IF ((st_fx->hAmrwb_IO = (AMRWB_IO_ENC_HANDLE)count_malloc(sizeof(AMRWB_IO_ENC_DATA))) == NULL) { @@ -185,7 +185,7 @@ ISM_MODE ism_mode = ISM_MODE_NONE; { st_fx->hAmrwb_IO = NULL; } - st_fx->clas_fx = UNVOICED_CLAS; + st_fx->clas = UNVOICED_CLAS; move16(); set16_fx( st_fx->old_wsp2_fx, 0, (L_WSP_MEM - L_INTERPOL)/OPL_DECIM ); set16_fx( st_fx->old_wsp_fx, 0, L_WSP_MEM ); @@ -203,7 +203,7 @@ ISM_MODE ism_mode = ISM_MODE_NONE; move16(); st_fx->mem_deemp_preQ_fx = 0; move16(); - st_fx->last_nq_preQ_fx = 0; + st_fx->last_nq_preQ = 0; move16(); st_fx->use_acelp_preq = 0; move16(); @@ -218,13 +218,13 @@ ISM_MODE ism_mode = ISM_MODE_NONE; set16_fx( st_fx->mem_decim2_fx, 0, 3 ); set16_fx( st_fx->lgBin_E_fx, 0, L_FFT/2 ); - st_fx->ini_frame_fx = 0; + st_fx->ini_frame = 0; move16(); st_fx->ee_old_fx = 640; move32();/*chk //10 in Q6 */ - st_fx->Nb_ACELP_frames_fx = 0; + st_fx->Nb_ACELP_frames = 0; move16(); - st_fx->audio_frame_cnt_fx = AUDIO_COUNTER_INI; + st_fx->audio_frame_cnt = AUDIO_COUNTER_INI; move16();/* Initializatin of the audio frame counter mildly into the audio mode */ /* adaptive lag window memory */ @@ -244,21 +244,21 @@ ISM_MODE ism_mode = ISM_MODE_NONE; move16(); - IF( EQ_32(st_fx->input_Fs_fx,8000)) + IF( EQ_32(st_fx->input_Fs,8000)) { - st_fx->min_band_fx = 1; + st_fx->min_band = 1; move16(); - st_fx->max_band_fx = 16; + st_fx->max_band = 16; move16(); } ELSE { - st_fx->min_band_fx = 0; + st_fx->min_band = 0; move16(); - st_fx->max_band_fx = 19; + st_fx->max_band = 19; move16(); } - IF ( st_fx->Opt_AMR_WB_fx ) + IF ( st_fx->Opt_AMR_WB ) { Copy( mean_isf_amr_wb_fx, st_fx->lsf_old_fx, M ); E_LPC_isf_isp_conversion( st_fx->lsf_old_fx, st_fx->lsp_old1_fx, M); @@ -277,11 +277,11 @@ ISM_MODE ism_mode = ISM_MODE_NONE; st_fx->stab_fac_fx = 0; move16(); /* Bass post-filter memories - encoder side of MODE2 */ - st_fx->bpf_off_fx = 0; + st_fx->bpf_off = 0; move16(); /* TC mode */ - st_fx->tc_cnt_fx = 0; + st_fx->tc_cnt = 0; move16(); st_fx->mCb1_fx = 0; move16(); @@ -315,20 +315,20 @@ ISM_MODE ism_mode = ISM_MODE_NONE; st_fx->old_dE1_fx = 0; move16(); - st_fx->old_ind_deltaMax_fx = 0; + st_fx->old_ind_deltaMax = 0; move32(); set32_fx( st_fx->old_enr_ssf_fx, 0, 2*NB_SSF ); - st_fx->spike_hyst_fx = -1; + st_fx->spike_hyst = -1; move16(); st_fx->music_hysteresis_fx = 0; move16(); /* Counter of frames after AUDIO frame to prevent UC */ - st_fx->last_harm_flag_acelp_fx = 0; + st_fx->last_harm_flag_acelp = 0; move16(); - st_fx->GSC_noisy_speech_fx = 0; + st_fx->GSC_noisy_speech = 0; move16(); /* speech/music classifier */ - st_fx->Last_pulse_pos_fx = 0; + st_fx->Last_pulse_pos = 0; move16(); st_fx->last_vad_spa_fx = 0; @@ -439,25 +439,25 @@ ISM_MODE ism_mode = ISM_MODE_NONE; move16(); st_fx->lt_mean_SWB_fx = 0; move16(); - st_fx->count_WB_fx = BWD_COUNT_MAX; + st_fx->count_WB = BWD_COUNT_MAX; move16(); - st_fx->count_SWB_fx = BWD_COUNT_MAX; + st_fx->count_SWB = BWD_COUNT_MAX; move16(); - st_fx->count_FB_fx = BWD_COUNT_MAX; + st_fx->count_FB = BWD_COUNT_MAX; move16(); - st_fx->bwidth_fx = st_fx->max_bwidth_fx; + st_fx->bwidth = st_fx->max_bwidth; move16(); - st_fx->last_input_bwidth_fx = st_fx->bwidth_fx; + st_fx->last_input_bwidth = st_fx->bwidth; move16(); - st_fx->last_bwidth_fx = st_fx->bwidth_fx; + st_fx->last_bwidth = st_fx->bwidth; move16(); - st_fx->last_bwidth_cng_fx = st_fx->bwidth_fx; + st_fx->last_bwidth_cng = st_fx->bwidth; move16(); move16(); - st_fx->coder_type_raw_fx = VOICED; - st_fx->last_coder_type_raw_fx = st_fx->coder_type_raw_fx; + st_fx->coder_type_raw = VOICED; + st_fx->last_coder_type_raw = st_fx->coder_type_raw; st_fx->is_ism_format = 0; move16(); if (NE_16(ism_mode, ISM_MODE_NONE) ) @@ -467,12 +467,12 @@ ISM_MODE ism_mode = ISM_MODE_NONE; /* Stationary noise UV modification */ st_fx->ge_sm_fx = 640; move32();/*Q(GE_SHIFT) */ - st_fx->uv_count_fx = 0; + st_fx->uv_count = 0; move16(); - st_fx->act_count_fx = 3; + st_fx->act_count = 3; move16(); Copy(st_fx->lsp_old_fx, st_fx->lspold_s_fx, M); - st_fx->noimix_seed_fx = RANDOM_INITSEED; + st_fx->noimix_seed = RANDOM_INITSEED; move16(); st_fx->min_alpha_fx = 1; move16(); @@ -484,7 +484,7 @@ ISM_MODE ism_mode = ISM_MODE_NONE; move16(); test();test(); - IF (((idchan == 0 && st_fx->Opt_DTX_ON_fx) || EQ_16(st_fx->element_mode, EVS_MONO)) || (EQ_16(st_fx->element_mode, IVAS_CPE_MDCT) && st_fx->Opt_DTX_ON_fx)) + IF (((idchan == 0 && st_fx->Opt_DTX_ON) || EQ_16(st_fx->element_mode, EVS_MONO)) || (EQ_16(st_fx->element_mode, IVAS_CPE_MDCT) && st_fx->Opt_DTX_ON)) { if ((st_fx->hDtxEnc = (DTX_ENC_HANDLE)count_malloc(sizeof(DTX_ENC_DATA))) == NULL) { @@ -501,13 +501,13 @@ ISM_MODE ism_mode = ISM_MODE_NONE; st_fx->fd_cng_reset_flag = 0; move16(); - IF( st_fx->Opt_DTX_ON_fx ) + IF( st_fx->Opt_DTX_ON ) { move16(); } st_fx->active_fr_cnt_fx = 0; move16(); - st_fx->cng_type_fx = -1; + st_fx->cng_type = -1; move16(); @@ -516,14 +516,14 @@ ISM_MODE ism_mode = ISM_MODE_NONE; *-----------------------------------------------------------------*/ test();test();test(); - IF (((idchan == 0 && st_fx->Opt_DTX_ON_fx && NE_16(st_fx->element_mode, IVAS_CPE_MDCT)) || EQ_16(st_fx->element_mode, EVS_MONO)) && !(EQ_16(ism_mode, ISM_MODE_PARAM) || EQ_16(ism_mode, ISM_MODE_DISC))) + IF (((idchan == 0 && st_fx->Opt_DTX_ON && NE_16(st_fx->element_mode, IVAS_CPE_MDCT)) || EQ_16(st_fx->element_mode, EVS_MONO)) && !(EQ_16(ism_mode, ISM_MODE_PARAM) || EQ_16(ism_mode, ISM_MODE_DISC))) { IF ((st_fx->hTdCngEnc = (TD_CNG_ENC_HANDLE)count_malloc(sizeof(TD_CNG_ENC_DATA))) == NULL) { return (IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DTX/TD CNG\n")); } - td_cng_enc_init_fx(st_fx->hTdCngEnc, st_fx->Opt_DTX_ON_fx, st_fx->max_bwidth_fx); + td_cng_enc_init_fx(st_fx->hTdCngEnc, st_fx->Opt_DTX_ON, st_fx->max_bwidth); } ELSE { @@ -551,7 +551,7 @@ ISM_MODE ism_mode = ISM_MODE_NONE; } /* FEC */ - st_fx->last_clas_fx = UNVOICED_CLAS; + st_fx->last_clas = UNVOICED_CLAS; move16(); FOR (i=0; i<2*NB_SUBFR16k; i++) @@ -570,12 +570,12 @@ ISM_MODE ism_mode = ISM_MODE_NONE; *-----------------------------------------------------------------*/ /* open analysis for input SR */ - if ((error = openCldfb ( &st_fx->cldfbAna_Fx, CLDFB_ANALYSIS, CLDFB_getNumChannels(st_fx->input_Fs_fx), st_fx->input_frame_fx )) != IVAS_ERR_OK) + if ((error = openCldfb ( &st_fx->cldfbAnaEnc, CLDFB_ANALYSIS, CLDFB_getNumChannels(st_fx->input_Fs), st_fx->input_frame_fx)) != IVAS_ERR_OK) { return error; } - if ((error = openCldfb ( &st_fx->cldfbSyn_Fx, CLDFB_SYNTHESIS, CLDFB_getNumChannels(16000), L_FRAME16k)) != IVAS_ERR_OK) + if ((error = openCldfb ( &st_fx->cldfbSynTd, CLDFB_SYNTHESIS, CLDFB_getNumChannels(16000), L_FRAME16k)) != IVAS_ERR_OK) { return error; } @@ -592,7 +592,7 @@ ISM_MODE ism_mode = ISM_MODE_NONE; move16(); st_fx->LF_EnergyRatio_sm_fx = 128; move16(); - st_fx->predecision_flag_fx = 0; + st_fx->predecision_flag = 0; move16(); st_fx->diff_sm_fx = 0; move32(); @@ -603,7 +603,7 @@ ISM_MODE ism_mode = ISM_MODE_NONE; * SC-VBR parameters *-----------------------------------------------------------------*/ test(); - IF (st_fx->Opt_SC_VBR_fx || EQ_16(st_fx->element_mode, EVS_MONO)) + IF (st_fx->Opt_SC_VBR || EQ_16(st_fx->element_mode, EVS_MONO)) { IF ((st_fx->hSC_VBR = (SC_VBR_ENC_HANDLE)count_malloc(sizeof(SC_VBR_ENC_DATA))) == NULL) { @@ -679,7 +679,7 @@ ISM_MODE ism_mode = ISM_MODE_NONE; st_fx->prev_Q_shb = 0; move16(); - st_fx->last_Opt_SC_VBR_fx = 0; + st_fx->last_Opt_SC_VBR = 0; move16(); /*-----------------------------------------------------------------* @@ -716,7 +716,7 @@ ISM_MODE ism_mode = ISM_MODE_NONE; } /* initialize RF indice buffers */ - reset_rf_indices_fx(st_fx/*->hRF, st_fx->L_frame_fx, &st->rf_target_bits_write*/); + reset_rf_indices_fx(st_fx/*->hRF, st_fx->L_frame, &st->rf_target_bits_write*/); } ELSE { @@ -728,9 +728,9 @@ ISM_MODE ism_mode = ISM_MODE_NONE; * HQ core parameters *-----------------------------------------------------------------*/ - st_fx->input = st_fx->input_buff+L_FRAME48k+NS2SA(48000, DELAY_FIR_RESAMPL_NS); - set16_fx( st_fx->input_buff+L_FRAME48k, 0, L_FRAME48k+NS2SA(48000, DELAY_FIR_RESAMPL_NS) ); - st_fx->old_input_signal_fx = st_fx->input - add(NS2SA_fx2(st_fx->input_Fs_fx, DELAY_FIR_RESAMPL_NS), st_fx->input_frame_fx); + st_fx->input_fx = st_fx->input_buff_fx +L_FRAME48k+NS2SA(48000, DELAY_FIR_RESAMPL_NS); + set16_fx( st_fx->input_buff_fx +L_FRAME48k, 0, L_FRAME48k+NS2SA(48000, DELAY_FIR_RESAMPL_NS) ); + st_fx->old_input_signal_fx = st_fx->input_fx - add(NS2SA_fx2(st_fx->input_Fs, DELAY_FIR_RESAMPL_NS), st_fx->input_frame_fx); st_fx->Energy_Old_fx = 0; @@ -741,7 +741,7 @@ ISM_MODE ism_mode = ISM_MODE_NONE; move32(); st_fx->EnergyLT_fx_exp = 30; move16(); /* Set to a High Exponent so it is 1^-30 */ - st_fx->TransientHangOver_fx = 0; + st_fx->TransientHangOver = 0; move16(); /*-----------------------------------------------------------------* @@ -810,7 +810,7 @@ ISM_MODE ism_mode = ISM_MODE_NONE; test(); test(); test(); - IF( st_fx->Opt_RF_ON == 0 || (NE_16(st_fx->bwidth_fx,WB)&&NE_16(st_fx->bwidth_fx,SWB))||NE_32(st_fx->total_brate_fx,ACELP_13k20)) + IF( st_fx->Opt_RF_ON == 0 || (NE_16(st_fx->bwidth,WB)&&NE_16(st_fx->bwidth,SWB))||NE_32(st_fx->total_brate,ACELP_13k20)) { IF (EQ_16(st_fx->Opt_RF_ON,1)) { @@ -838,7 +838,7 @@ ISM_MODE ism_mode = ISM_MODE_NONE; * MODE2 initialization *-----------------------------------------------------------------*/ - st_fx->last_sr_core = i_mult2 (st_fx->last_L_frame_fx, 50); + st_fx->last_sr_core = i_mult2 (st_fx->last_L_frame, 50); /*-----------------------------------------------------------------* * IGF @@ -860,7 +860,7 @@ ISM_MODE ism_mode = ISM_MODE_NONE; IF( EQ_16(st_fx->codec_mode, MODE2)) { - st_fx->igf = getIgfPresent_fx(st_fx->element_mode, st_fx->total_brate_fx, st_fx->bwidth_fx, st_fx->rf_mode); + st_fx->igf = getIgfPresent_fx(st_fx->element_mode, st_fx->total_brate, st_fx->bwidth, st_fx->rf_mode); } ELSE { @@ -869,27 +869,27 @@ ISM_MODE ism_mode = ISM_MODE_NONE; } /* FD-CNG encoder */ - createFdCngEnc_fx(&st_fx->hFdCngEnc_fx); - initFdCngEnc_fx(st_fx->hFdCngEnc_fx, st_fx->input_Fs_fx, st_fx->cldfbAna_Fx->scale); - L_tmp = st_fx->total_brate_fx; + createFdCngEnc_fx(&st_fx->hFdCngEnc); + initFdCngEnc_fx(st_fx->hFdCngEnc, st_fx->input_Fs, st_fx->cldfbAnaEnc->scale); + L_tmp = st_fx->total_brate; move32(); test(); - if( st_fx->rf_mode && EQ_32(st_fx->total_brate_fx,ACELP_13k20)) + if( st_fx->rf_mode && EQ_32(st_fx->total_brate,ACELP_13k20)) { L_tmp = ACELP_9k60; move32(); } - configureFdCngEnc_fx( st_fx->hFdCngEnc_fx, st_fx->bwidth_fx, L_tmp ); + configureFdCngEnc_fx( st_fx->hFdCngEnc, st_fx->bwidth, L_tmp ); st_fx->last_totalNoise_fx = 0; move16(); set16_fx( st_fx->totalNoise_increase_hist_fx, 0, TOTALNOISE_HIST_SIZE ); - st_fx->totalNoise_increase_len_fx = 0; + st_fx->totalNoise_increase_len = 0; move16(); - init_coder_ace_plus_fx( st_fx, st_fx->last_total_brate_fx, 0, -10 /*hack*/); + init_coder_ace_plus_fx( st_fx, st_fx->last_total_brate, 0, -10 /*hack*/); //PMT("Transient detector init needs review, handle hTranDet is missing") - InitTransientDetection_fx( extract_l(Mult_32_16(st_fx->input_Fs_fx, 0x0290)), - NS2SA_fx2(st_fx->input_Fs_fx, DELAY_FIR_RESAMPL_NS), + InitTransientDetection_fx( extract_l(Mult_32_16(st_fx->input_Fs, 0x0290)), + NS2SA_fx2(st_fx->input_Fs, DELAY_FIR_RESAMPL_NS), &st_fx->transientDetection ); //reset_indices_enc_fx( st_fx->hBstr); @@ -979,13 +979,13 @@ void LPDmem_enc_init_fx( *-----------------------------------------------------------------------*/ void destroy_encoder_fx( - Encoder_State_fx *st_fx /* i/o: Encoder static variables structure */ + Encoder_State *st_fx /* i/o: Encoder static variables structure */ ) { - deleteCldfb( &st_fx->cldfbAna_Fx ); - deleteCldfb( &st_fx->cldfbSyn_Fx ); + deleteCldfb( &st_fx->cldfbAnaEnc ); + deleteCldfb( &st_fx->cldfbSynTd ); - deleteFdCngEnc_fx( &st_fx->hFdCngEnc_fx ); + deleteFdCngEnc_fx( &st_fx->hFdCngEnc ); return; } diff --git a/lib_enc/inov_enc_fx.c b/lib_enc/inov_enc_fx.c index 9e7eafe83..79b4889cf 100644 --- a/lib_enc/inov_enc_fx.c +++ b/lib_enc/inov_enc_fx.c @@ -58,7 +58,7 @@ /*==============================================================================*/ Word16 inov_encode_fx( - Encoder_State_fx *st_fx, /* i/o: encoder state structure */ + Encoder_State *st_fx, /* i/o: encoder state structure */ const Word32 core_brate, /* i : core bitrate */ const Word16 Opt_AMR_WB, /* i : flag indicating AMR-WB IO mode */ const Word16 L_frame, /* i : length of the frame */ @@ -248,7 +248,7 @@ Word16 inov_encode_fx( test(); test(); test(); - IF( NE_16(L_frame,st_fx->last_L_frame_fx)&>_32(core_brate,ACELP_13k20)&&(LT_32(core_brate,ACELP_32k)||EQ_16(bwidth,WB))) + IF( NE_16(L_frame,st_fx->last_L_frame)&>_32(core_brate,ACELP_13k20)&&(LT_32(core_brate,ACELP_32k)||EQ_16(bwidth,WB))) { if( GT_16(cmpl_flag,1)) { diff --git a/lib_enc/isf_enc_amr_wb_fx.c b/lib_enc/isf_enc_amr_wb_fx.c index a758982ee..d626734f6 100644 --- a/lib_enc/isf_enc_amr_wb_fx.c +++ b/lib_enc/isf_enc_amr_wb_fx.c @@ -74,7 +74,7 @@ static Word16 sub_VQ_fx(Word16 *x, const Word16 *dico, const Word16 dim, const W *-------------------------------------------------------------------*/ void isf_enc_amr_wb_fx( - Encoder_State_fx *st, /* i/o: state structure */ + Encoder_State *st, /* i/o: state structure */ Word16 *isf_new, /* i/o: quantized ISF vector */ Word16 *isp_new, /* i/o: ISP vector to quantize/quantized */ Word16 *Aq /* o : quantized A(z) for 4 subframes */ @@ -86,7 +86,7 @@ void isf_enc_amr_wb_fx( * ISF quantization of SID frames *---------------------------------*/ - IF(EQ_32(st->core_brate_fx, SID_1k75)) + IF(EQ_32(st->core_brate, SID_1k75)) { qisf_ns_28b_fx(hBstr, isf_new); @@ -99,17 +99,17 @@ void isf_enc_amr_wb_fx( } /* check resonance for pitch clipping algorithm */ - gp_clip_test_isf_fx(st->element_mode, st->core_brate_fx, isf_new, st->clip_var_fx, 1); + gp_clip_test_isf_fx(st->element_mode, st->core_brate, isf_new, st->clip_var_fx, 1); /*---------------------------------------* * ISF quantization of all other frames *---------------------------------------*/ - IF(EQ_32(st->core_brate_fx, ACELP_6k60)) + IF(EQ_32(st->core_brate, ACELP_6k60)) { qisf_2s_36b_fx(hBstr, isf_new, 4, st->mem_AR_fx, st->mem_MA_fx); } - ELSE IF(GE_32(st->core_brate_fx, ACELP_8k85)) + ELSE IF(GE_32(st->core_brate, ACELP_8k85)) { qisf_2s_46b_fx(hBstr, isf_new, 4, st->mem_AR_fx, st->mem_MA_fx); } @@ -134,7 +134,7 @@ void isf_enc_amr_wb_fx( /*------------------------------------------------------------------* * Calculate ISF stability (distance between old ISF and current ISF) *------------------------------------------------------------------*/ - IF(NE_32(st->last_core_brate_fx, SID_1k75)) + IF(NE_32(st->last_core_brate, SID_1k75)) { st->stab_fac_fx = lsf_stab_fx(isf_new, st->lsf_old_fx, 1, L_FRAME); } diff --git a/lib_enc/ivas_init_enc.c b/lib_enc/ivas_init_enc.c index 9f6afe218..1623fc44a 100644 --- a/lib_enc/ivas_init_enc.c +++ b/lib_enc/ivas_init_enc.c @@ -278,27 +278,27 @@ void copy_encoder_config( void copy_encoder_config_fx( Encoder_Struct *st_ivas, /* i : IVAS encoder structure */ - Encoder_State_fx *st_fx, /* o : encoder state structure */ + Encoder_State *st_fx, /* o : encoder state structure */ const int16_t flag_all /* i : flag 1==update all, 0=partial update*/ ) { if ( flag_all ) { - st_fx->input_Fs_fx = st_ivas->hEncoderConfig->input_Fs; + st_fx->input_Fs = st_ivas->hEncoderConfig->input_Fs; st_fx->last_codec_mode = st_ivas->last_codec_mode; - st_fx->last_total_brate_fx = st_ivas->hEncoderConfig->last_ivas_total_brate; + st_fx->last_total_brate = st_ivas->hEncoderConfig->last_ivas_total_brate; - st_fx->Opt_DTX_ON_fx = st_ivas->hEncoderConfig->Opt_DTX_ON; + st_fx->Opt_DTX_ON = st_ivas->hEncoderConfig->Opt_DTX_ON; - st_fx->last_Opt_SC_VBR_fx = st_ivas->hEncoderConfig->last_Opt_SC_VBR; + st_fx->last_Opt_SC_VBR = st_ivas->hEncoderConfig->last_Opt_SC_VBR; } - st_fx->Opt_AMR_WB_fx = st_ivas->hEncoderConfig->Opt_AMR_WB; - st_fx->Opt_SC_VBR_fx = st_ivas->hEncoderConfig->Opt_SC_VBR; + st_fx->Opt_AMR_WB = st_ivas->hEncoderConfig->Opt_AMR_WB; + st_fx->Opt_SC_VBR = st_ivas->hEncoderConfig->Opt_SC_VBR; st_fx->codec_mode = st_ivas->codec_mode; - st_fx->max_bwidth_fx = st_ivas->hEncoderConfig->max_bwidth; + st_fx->max_bwidth = st_ivas->hEncoderConfig->max_bwidth; st_fx->Opt_RF_ON = st_ivas->hEncoderConfig->Opt_RF_ON; st_fx->rf_fec_offset = st_ivas->hEncoderConfig->rf_fec_offset; @@ -508,12 +508,13 @@ ivas_error ivas_init_encoder( st_ivas->nCPE = 0; st_ivas->nchan_transport = 1; sce_id = 0; +#ifdef EVS_FLOAT_ENC if ( ( error = create_sce_enc( st_ivas, sce_id, ivas_total_brate ) ) != IVAS_ERR_OK ) { return error; } -#ifndef EVS_FLOAT_ENC - if ( ( error = create_evs_sce_enc( st_ivas, sce_id ) ) != IVAS_ERR_OK ) +#else + if ( ( error = create_evs_sce_enc( st_ivas, sce_id, ivas_total_brate) ) != IVAS_ERR_OK ) { return error; } diff --git a/lib_enc/ivas_sce_enc.c b/lib_enc/ivas_sce_enc.c index 32f5ec368..4088a526c 100644 --- a/lib_enc/ivas_sce_enc.c +++ b/lib_enc/ivas_sce_enc.c @@ -369,57 +369,91 @@ ivas_error create_sce_enc( ivas_error create_evs_sce_enc( Encoder_Struct *st_ivas, /* i/o: IVAS encoder structure */ - const int16_t sce_id /* i : SCE # identifier */ + const int16_t sce_id, /* i : SCE # identifier */ + const int32_t element_brate /* i : element bitrate */ ) { SCE_ENC_HANDLE hSCE = st_ivas->hSCE[sce_id]; - Encoder_State_fx *st_fx; + Encoder_State *st_fx; ivas_error error; error = IVAS_ERR_OK; + /*-----------------------------------------------------------------* + * Allocate SCE handle + *-----------------------------------------------------------------*/ + + if ((hSCE = (SCE_ENC_HANDLE)malloc(sizeof(SCE_ENC_DATA))) == NULL) + { + return (IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SCE\n")); + } + + /*-----------------------------------------------------------------* + * Initialization - general parameters + *-----------------------------------------------------------------*/ + + hSCE->sce_id = sce_id; + hSCE->element_brate = element_brate; + hSCE->last_element_brate = hSCE->element_brate; + + /*-----------------------------------------------------------------* + * Metadata: allocate and initialize + *-----------------------------------------------------------------*/ + + if (st_ivas->hEncoderConfig->ivas_format != MONO_FORMAT && sce_id == (st_ivas->nSCE - 1)) + { + if ((error = ivas_initialize_MD_bstr_enc(&(hSCE->hMetaData), st_ivas)) != IVAS_ERR_OK) + { + return error; + } + } + else + { + hSCE->hMetaData = NULL; + } + /*-----------------------------------------------------------------* * Core Coder, 1 instance: allocate and initialize *-----------------------------------------------------------------*/ - if ( ( st_fx = (ENC_CORE_HANDLE_FX) malloc( sizeof( Encoder_State_fx ) ) ) == NULL ) + if ( ( st_fx = (ENC_CORE_HANDLE) malloc( sizeof( Encoder_State ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for CoreCoder structure\n" ) ); } - memset( st_fx, 0, sizeof( Encoder_State_fx ) ); - st_fx->input_Fs_fx = 16000; - st_fx->total_brate_fx = ACELP_12k65; + memset( st_fx, 0, sizeof( Encoder_State ) ); + st_fx->input_Fs = 16000; + st_fx->total_brate = ACELP_12k65; - st_fx->Opt_AMR_WB_fx = 0; + st_fx->Opt_AMR_WB = 0; st_fx->Opt_RF_ON = 0; st_fx->rf_fec_offset = 0; st_fx->rf_fec_indicator = 1; - st_fx->max_bwidth_fx = SWB; + st_fx->max_bwidth = SWB; st_fx->interval_SID_fx = FIXED_SID_RATE; st_fx->var_SID_rate_flag_fx = 1; st_fx->Opt_HE_SAD_ON_fx = 0; - st_fx->Opt_SC_VBR_fx = 0; - st_fx->last_Opt_SC_VBR_fx = 0; + st_fx->Opt_SC_VBR = 0; + st_fx->last_Opt_SC_VBR = 0; st_fx->bitstreamformat = G192; // copy_encoder_config_fx( st_ivas, st_fx, 1 ); - st_fx->max_bwidth_fx = st_ivas->hEncoderConfig->max_bwidth; - st_fx->Opt_DTX_ON_fx = st_ivas->hEncoderConfig->Opt_DTX_ON; + st_fx->max_bwidth = st_ivas->hEncoderConfig->max_bwidth; + st_fx->Opt_DTX_ON = st_ivas->hEncoderConfig->Opt_DTX_ON; st_fx->var_SID_rate_flag_fx = st_ivas->hEncoderConfig->var_SID_rate_flag; st_fx->interval_SID_fx = st_ivas->hEncoderConfig->interval_SID; st_fx->Opt_RF_ON = st_ivas->hEncoderConfig->Opt_RF_ON; st_fx->rf_fec_indicator = st_ivas->hEncoderConfig->rf_fec_indicator; st_fx->rf_fec_offset = st_ivas->hEncoderConfig->rf_fec_offset; // st_fx->bitstreamformat = st->bitstreamformat; - st_fx->total_brate_fx = st_ivas->hEncoderConfig->ivas_total_brate; - st_fx->Opt_SC_VBR_fx = st_ivas->hEncoderConfig->Opt_SC_VBR; - st_fx->last_Opt_SC_VBR_fx = st_ivas->hEncoderConfig->last_Opt_SC_VBR; - st_fx->Opt_AMR_WB_fx = st_ivas->hEncoderConfig->Opt_AMR_WB; - st_fx->input_Fs_fx = st_ivas->hEncoderConfig->input_Fs; + st_fx->total_brate = st_ivas->hEncoderConfig->ivas_total_brate; + st_fx->Opt_SC_VBR = st_ivas->hEncoderConfig->Opt_SC_VBR; + st_fx->last_Opt_SC_VBR = st_ivas->hEncoderConfig->last_Opt_SC_VBR; + st_fx->Opt_AMR_WB = st_ivas->hEncoderConfig->Opt_AMR_WB; + st_fx->input_Fs = st_ivas->hEncoderConfig->input_Fs; st_fx->codec_mode = st_ivas->codec_mode; st_fx->last_codec_mode = st_ivas->last_codec_mode; - st_fx->input_frame_fx = extract_l( Mult_32_16( st_fx->input_Fs_fx, 0x0290 ) ); + st_fx->input_frame_fx = extract_l( Mult_32_16( st_fx->input_Fs, 0x0290 ) ); if ( ( error = init_encoder_fx( st_fx ) ) != IVAS_ERR_OK ) { return error; @@ -427,7 +461,9 @@ ivas_error create_evs_sce_enc( st_fx->hBstr->ind_list_fx = ind_list; // st_fx->hBstr->ind_list_fx = st->hBstr->ind_list; reset_indices_enc_fx( st_fx->hBstr ); - hSCE->hCoreCoder_fx[0] = st_fx; + hSCE->hCoreCoder[0] = st_fx; + + st_ivas->hSCE[sce_id] = hSCE; return error; } @@ -446,18 +482,19 @@ void destroy_sce_enc( st = hSCE->hCoreCoder[0]; - if ( st != NULL ) +#ifndef EVS_FLOAT_ENC + if (st != NULL && hSCE->hCoreCoder[0]->element_mode == EVS_MONO) { - destroy_core_enc( st ); + destroy_encoder_fx(hSCE->hCoreCoder[0]); st = NULL; } -#ifndef EVS_FLOAT_ENC + else +#endif if ( st != NULL ) { - destroy_encoder_fx( hSCE->hCoreCoder_fx[0] ); + destroy_core_enc( st ); st = NULL; } -#endif ivas_destroy_MD_bstr_enc( &( hSCE->hMetaData ) ); diff --git a/lib_enc/ivas_stat_enc.h b/lib_enc/ivas_stat_enc.h index 31dc93b72..a248a787d 100644 --- a/lib_enc/ivas_stat_enc.h +++ b/lib_enc/ivas_stat_enc.h @@ -699,7 +699,7 @@ typedef struct ivas_spar_enc_lib_t FRONT_VAD_ENC_HANDLE hFrontVad; /* front-VAD handle */ ENC_CORE_HANDLE hCoreCoderVAD; /* core-coder handle for front-VAD module */ #ifndef EVS_FLOAT_ENC - ENC_CORE_HANDLE_FX hCoreCoderVAD_fx; /* core coder handle */ + //ENC_CORE_HANDLE_FX hCoreCoderVAD_fx; /* core coder handle */ #endif int16_t spar_reconfig_flag; @@ -969,10 +969,6 @@ typedef struct sce_enc_data_structure BSTR_ENC_HANDLE hMetaData; /* Metadata bitstream handle */ ENC_CORE_HANDLE hCoreCoder[1]; /* core coder handle */ -#ifndef EVS_FLOAT_ENC - ENC_CORE_HANDLE_FX hCoreCoder_fx[1]; /* core coder handle */ -#endif - } SCE_ENC_DATA, *SCE_ENC_HANDLE; diff --git a/lib_enc/lib_enc.c b/lib_enc/lib_enc.c index c225f0734..273fecc74 100644 --- a/lib_enc/lib_enc.c +++ b/lib_enc/lib_enc.c @@ -50,7 +50,6 @@ struct IVAS_ENC { Encoder_Struct *st_ivas; ENC_CORE_HANDLE hCoreCoder; - ENC_CORE_HANDLE_FX hCoreCoder_fx; bool isConfigured; bool switchingActive; /* flag for configuration changes during encoding - currently only used with mono */ int16_t Opt_RF_ON_loc; @@ -59,7 +58,6 @@ struct IVAS_ENC bool maxBandwidthUser; /* Was a specific max bandwith selected by the user? */ IVAS_ENC_BANDWIDTH newBandwidthApi; /* maximum encoded bandwidth, as set on API level */ bool extMetadataApi; /* External metadata requested, to be checked against current bit rate */ - bool isRawFile; }; /*---------------------------------------------------------------------* @@ -108,7 +106,6 @@ ivas_error IVAS_ENC_Open( } ( *phIvasEnc )->hCoreCoder = NULL; - ( *phIvasEnc )->hCoreCoder_fx = NULL; ( *phIvasEnc )->isConfigured = false; ( *phIvasEnc )->switchingActive = false; ( *phIvasEnc )->maxBandwidthUser = false; @@ -934,9 +931,6 @@ static ivas_error configureEncoder( if ( hEncoderConfig->ivas_format == MONO_FORMAT ) { hIvasEnc->hCoreCoder = st_ivas->hSCE[0]->hCoreCoder[0]; /* Note: this is needed for switching in EVS mono */ -#ifndef EVS_FLOAT_ENC - hIvasEnc->hCoreCoder_fx = st_ivas->hSCE[0]->hCoreCoder_fx[0]; -#endif } else { @@ -1081,9 +1075,6 @@ ivas_error IVAS_ENC_EncodeFrameToSerial( st_ivas = hIvasEnc->st_ivas; hEncoderConfig = st_ivas->hEncoderConfig; ENC_CORE_HANDLE hCoreCoder = hIvasEnc->hCoreCoder; -#ifndef EVS_FLOAT_ENC - ENC_CORE_HANDLE_FX hCoreCoder_fx = hIvasEnc->hCoreCoder_fx; -#endif if ( inputBufferSize != getInputBufferSize( st_ivas ) ) { @@ -1112,16 +1103,11 @@ ivas_error IVAS_ENC_EncodeFrameToSerial( if ( hEncoderConfig->ivas_total_brate == ACELP_13k20 && hEncoderConfig->ivas_format == MONO_FORMAT ) { st_ivas->codec_mode = MODE1; -#ifndef EVS_FLOAT_ENC - if ( hIvasEnc->isRawFile ) - { - reset_rf_indices_fx( hCoreCoder_fx ); - } - else +#ifdef EVS_FLOAT_ENC + reset_rf_indices( hCoreCoder->hRF, hCoreCoder->L_frame, &( hCoreCoder->rf_target_bits_write ) ); +#else + reset_rf_indices_fx( hCoreCoder ); #endif - { - reset_rf_indices( hCoreCoder->hRF, hCoreCoder->L_frame, &( hCoreCoder->rf_target_bits_write ) ); - } } hEncoderConfig->Opt_RF_ON = 0; hEncoderConfig->rf_fec_offset = 0; @@ -1133,16 +1119,11 @@ ivas_error IVAS_ENC_EncodeFrameToSerial( st_ivas->codec_mode = MODE2; if ( hEncoderConfig->Opt_RF_ON == 0 && hEncoderConfig->ivas_format == MONO_FORMAT ) { -#ifndef EVS_FLOAT_ENC - if ( hIvasEnc->isRawFile ) - { - reset_rf_indices_fx( hCoreCoder_fx ); - } - else +#ifdef EVS_FLOAT_ENC + reset_rf_indices( hCoreCoder->hRF, hCoreCoder->L_frame, &( hCoreCoder->rf_target_bits_write ) ); +#else + reset_rf_indices_fx( hCoreCoder ); #endif - { - reset_rf_indices( hCoreCoder->hRF, hCoreCoder->L_frame, &( hCoreCoder->rf_target_bits_write ) ); - } } hEncoderConfig->Opt_RF_ON = 1; hEncoderConfig->rf_fec_offset = hIvasEnc->rf_fec_offset_loc; @@ -1243,32 +1224,18 @@ ivas_error IVAS_ENC_EncodeFrameToSerial( if ( hIvasEnc->switchingActive && hEncoderConfig->ivas_format == MONO_FORMAT ) { -#ifndef EVS_FLOAT_ENC - if ( hIvasEnc->isRawFile ) - { - copy_encoder_config_fx( st_ivas, hCoreCoder_fx, 0 ); - } - else +#ifdef EVS_FLOAT_ENC + copy_encoder_config(st_ivas, hCoreCoder, 0); +#else + copy_encoder_config_fx(st_ivas, hCoreCoder, 0); #endif - { - copy_encoder_config( st_ivas, hCoreCoder, 0 ); - } hEncoderConfig->last_ivas_total_brate = hEncoderConfig->ivas_total_brate; } /* run the main encoding routine */ if ( hEncoderConfig->ivas_format == MONO_FORMAT ) /* EVS mono */ { -#ifndef EVS_FLOAT_ENC - if ( hIvasEnc->isRawFile ) - { - hCoreCoder_fx->total_brate_fx = hEncoderConfig->ivas_total_brate; /* needed in case of bitrate switching */ - } - else -#endif - { - hCoreCoder->total_brate = hEncoderConfig->ivas_total_brate; /* needed in case of bitrate switching */ - } + hCoreCoder->total_brate = hEncoderConfig->ivas_total_brate; /* needed in case of bitrate switching */ if ( hEncoderConfig->stereo_dmx_evs == 1 ) { @@ -1278,36 +1245,26 @@ ivas_error IVAS_ENC_EncodeFrameToSerial( if ( hEncoderConfig->Opt_AMR_WB ) { -#ifndef EVS_FLOAT_ENC - if ( hIvasEnc->isRawFile ) - { - amr_wb_enc_fx( hCoreCoder_fx, inputBuffer, inputBufferSize ); - } - else +#ifdef EVS_FLOAT_ENC + amr_wb_enc( hCoreCoder, inputBuffer, st_ivas->mem_hp20_in[0], inputBufferSize ); +#else + amr_wb_enc_fx( hCoreCoder, inputBuffer, inputBufferSize ); #endif - { - amr_wb_enc( hCoreCoder, inputBuffer, st_ivas->mem_hp20_in[0], inputBufferSize ); - } } else { -#ifndef EVS_FLOAT_ENC - if ( hIvasEnc->isRawFile ) +#ifdef EVS_FLOAT_ENC + if ( ( error = evs_enc( hCoreCoder, inputBuffer, st_ivas->mem_hp20_in[0], inputBufferSize ) ) != IVAS_ERR_OK ) { - hCoreCoder_fx->input_frame_fx = inputBufferSize; - if ( ( error = evs_enc_fx( hCoreCoder_fx, inputBuffer, hCoreCoder_fx->mem_hp20_in_fx, inputBufferSize ) ) != IVAS_ERR_OK ) - { - return error; - } + return error; } - else -#endif +#else + hCoreCoder->input_frame_fx = inputBufferSize; + if ( ( error = evs_enc_fx(hCoreCoder, inputBuffer, hCoreCoder->mem_hp20_in_fx, inputBufferSize ) ) != IVAS_ERR_OK ) { - if ( ( error = evs_enc( hCoreCoder, inputBuffer, st_ivas->mem_hp20_in[0], inputBufferSize ) ) != IVAS_ERR_OK ) - { - return error; - } + return error; } +#endif } } else /* IVAS */ @@ -1320,12 +1277,12 @@ ivas_error IVAS_ENC_EncodeFrameToSerial( /* write indices into bitstream buffer */ #ifndef EVS_FLOAT_ENC - if ( hEncoderConfig->ivas_format == MONO_FORMAT && hIvasEnc->isRawFile ) + if ( hEncoderConfig->ivas_format == MONO_FORMAT && hCoreCoder->element_mode == EVS_MONO) { /* write indices into bitstream file */ UWord8 pFrame[( MAX_BITS_PER_FRAME + 7 ) >> 3]; Word16 pFrame_size = 0; - write_indices_buf_fx( hCoreCoder_fx, hCoreCoder_fx->hBstr, outputBitStream, pFrame, pFrame_size, numOutBits ); + write_indices_buf_fx(hCoreCoder, hCoreCoder->hBstr, outputBitStream, pFrame, pFrame_size, numOutBits ); } else #endif @@ -2257,8 +2214,3 @@ static void init_encoder_config( return; } - -void set_raw_file_flag( const IVAS_ENC_HANDLE hIvasEnc, short isRaw ) -{ - hIvasEnc->isRawFile = isRaw; -} \ No newline at end of file diff --git a/lib_enc/lib_enc.h b/lib_enc/lib_enc.h index 632e473e2..a3a4fee89 100644 --- a/lib_enc/lib_enc.h +++ b/lib_enc/lib_enc.h @@ -332,8 +332,6 @@ void IVAS_ENC_PrintDisclaimer( void ); -void set_raw_file_flag( const IVAS_ENC_HANDLE hIvasEnc, short isRaw ); - /* clang-format on */ #endif /* LIB_ENC_H */ diff --git a/lib_enc/long_enr_fx.c b/lib_enc/long_enr_fx.c index 1fad3dac4..d86f25d39 100644 --- a/lib_enc/long_enr_fx.c +++ b/lib_enc/long_enr_fx.c @@ -18,7 +18,7 @@ * Compute relative energy, long-term average total noise energy and total active speech energy *-------------------------------------------------------------------*/ void long_enr_fx( - Encoder_State_fx *st_fx, /* i/o: state structure */ + Encoder_State *st_fx, /* i/o: state structure */ const Word16 Etot, /* i : total channel E (see lib_enc\analy_sp.c) */ const Word16 localVAD_HE_SAD, /* i : HE-SAD flag without hangover */ Word16 high_lpn_flag /* i : sp/mus LPN flag */ @@ -91,7 +91,7 @@ void long_enr_fx( else #endif { - IF(LT_16(st_fx->ini_frame_fx, 4)) + IF(LT_16(st_fx->ini_frame, 4)) { st_fx->lp_noise_fx = hNoiseEst->totalNoise_fx; move16(); @@ -107,7 +107,7 @@ void long_enr_fx( } */ alpha = 655; move16();/* 0.02 Q15 */ - if (LT_16(st_fx->ini_frame_fx, 150)) /* should match HE_LT_CNT_INIT_FX */ + if (LT_16(st_fx->ini_frame, 150)) /* should match HE_LT_CNT_INIT_FX */ { alpha = 1638; move16(); /* 0.05 Q15 */ diff --git a/lib_enc/lsf_enc_fx.c b/lib_enc/lsf_enc_fx.c index 9d4eb808c..96cbde993 100644 --- a/lib_enc/lsf_enc_fx.c +++ b/lib_enc/lsf_enc_fx.c @@ -64,7 +64,7 @@ static void lsf_mid_enc_fx(BSTR_ENC_HANDLE hBstr, int16_t nb_bits, const Word16 /* _ None */ /*===========================================================================*/ void lsf_enc_fx( - Encoder_State_fx *st_fx, /* i/o: state structure */ + Encoder_State *st_fx, /* i/o: state structure */ Word16 *lsf_new, /* o : quantized LSF vector */ Word16 *lsp_new, /* i/o: LSP vector to quantize/quantized */ Word16 *lsp_mid, /* i/o : mid-frame LSP vector */ @@ -95,7 +95,7 @@ void lsf_enc_fx( Word16 coder_type, ppp_mode, nelp_mode; test(); - IF (EQ_32(st_fx->core_brate_fx, SID_2k40) || EQ_32(st_fx->core_brate_fx, SID_1k75)) + IF (EQ_32(st_fx->core_brate, SID_2k40) || EQ_32(st_fx->core_brate, SID_1k75)) { coder_type = INACTIVE; move16(); @@ -119,7 +119,7 @@ void lsf_enc_fx( #endif move16(); - IF (st_fx->Opt_SC_VBR_fx) + IF (st_fx->Opt_SC_VBR) { ppp_mode = st_fx->hSC_VBR->ppp_mode; nelp_mode = st_fx->hSC_VBR->nelp_mode; @@ -154,7 +154,7 @@ void lsf_enc_fx( /* Find the number of bits for LSF quantization */ nBits = 0; move16(); - IF ( EQ_32(st_fx->core_brate_fx, SID_2k40)) + IF ( EQ_32(st_fx->core_brate, SID_2k40)) { nBits = LSF_BITS_CNG; move16(); @@ -172,7 +172,7 @@ void lsf_enc_fx( nBits = 30; move16(); - if ( EQ_16(st_fx->bwidth_fx,NB)) + if ( EQ_16(st_fx->bwidth,NB)) { nBits = 32; move16(); @@ -187,7 +187,7 @@ void lsf_enc_fx( force_sf = 0; move16(); /* first three ACELP frames after an HQ frame shall be processed only with safety-net quantizer */ test(); - if( LT_16(Nb_ACELP_frames, 3) && NE_32(st_fx->core_brate_fx, SID_2k40) ) + if( LT_16(Nb_ACELP_frames, 3) && NE_32(st_fx->core_brate, SID_2k40) ) { force_sf = 1; move16(); @@ -210,13 +210,13 @@ void lsf_enc_fx( force_sf, NULL, NULL, NULL, st_fx->coder_type_raw_fxtdm_lsfQ_PCh); #else lsf_end_enc_fx( st_fx, lsf_new, lsf_new, nBits, coder_type, Q_new+QSCALE-2, - force_sf, NULL, NULL, NULL, st_fx->coder_type_raw_fx); + force_sf, NULL, NULL, NULL, st_fx->coder_type_raw); #endif /* convert quantized LSFs back to LSPs */ lsf2lsp_fx( lsf_new, lsp_new, M, int_fs); test(); - IF ( EQ_16(st_fx->last_core_fx, HQ_CORE)&&EQ_16(st_fx->core_fx,ACELP_CORE)) + IF ( EQ_16(st_fx->last_core, HQ_CORE)&&EQ_16(st_fx->core,ACELP_CORE)) { /* don't use old LSF values if this is the first ACELP frame after HQ frames */ Copy( lsf_new, st_fx->lsf_old_fx, M ); @@ -234,7 +234,7 @@ void lsf_enc_fx( } } #endif - IF ( EQ_32(st_fx->core_brate_fx, SID_2k40)) + IF ( EQ_32(st_fx->core_brate, SID_2k40)) { /* return if SID frame (conversion to A(z) done in the calling function) */ return; @@ -244,7 +244,7 @@ void lsf_enc_fx( * FEC - enforce safety-net in the next frame in case of unstable filter *-------------------------------------------------------------------------------------*/ - IF( NE_16(st_fx->last_L_frame_fx, st_fx->L_frame_fx)) + IF( NE_16(st_fx->last_L_frame, st_fx->L_frame)) { /* FEC - in case of core switching, use old LSFs */ Copy( st_fx->lsf_old_fx, st_fx->lsfoldbfi1_fx, M ); @@ -255,18 +255,18 @@ void lsf_enc_fx( FEC_lsf_estim_enc_fx( st_fx, fec_lsf ); /* in case of FEC in decoder - calculate LSF stability */ - stab = lsf_stab_fx( lsf_new, fec_lsf, 0, st_fx->L_frame_fx ); + stab = lsf_stab_fx( lsf_new, fec_lsf, 0, st_fx->L_frame ); test(); test(); test(); /* If decoder FEC frame may be unstable force safety-net usage */ - IF ( (EQ_16(st_fx->L_frame_fx, L_FRAME16k))&&(LT_16(stab,STAB_FAC_LIMIT_FX))&&(EQ_16(coder_type,GENERIC))) + IF ( (EQ_16(st_fx->L_frame, L_FRAME16k))&&(LT_16(stab,STAB_FAC_LIMIT_FX))&&(EQ_16(coder_type,GENERIC))) { st_fx->next_force_safety_net_fx = 1; move16(); } - ELSE IF((LT_16(stab, STAB_FAC_LIMIT_FX))&&(EQ_16(st_fx->clas_fx,VOICED_CLAS)||(LT_16(st_fx->clas_fx,VOICED_CLAS)&&EQ_16(coder_type,AUDIO)))) + ELSE IF((LT_16(stab, STAB_FAC_LIMIT_FX))&&(EQ_16(st_fx->clas,VOICED_CLAS)||(LT_16(st_fx->clas,VOICED_CLAS)&&EQ_16(coder_type,AUDIO)))) { st_fx->next_force_safety_net_fx = 1; move16(); @@ -298,10 +298,10 @@ void lsf_enc_fx( Copy( lsf_new, st_fx->lsf_old_fx, M ); } /* Mid-frame LSF encoding */ - lsf_mid_enc_fx(st_fx->hBstr, st_fx->acelp_cfg.mid_lsf_bits, int_fs, st_fx->lsp_old_fx, lsp_new, lsp_mid, coder_type, st_fx->bwidth_fx, st_fx->Bin_E_old_fx, st_fx->Bin_E_fx, Q_new+QSCALE-2, ppp_mode, nelp_mode); + lsf_mid_enc_fx(st_fx->hBstr, st_fx->acelp_cfg.mid_lsf_bits, int_fs, st_fx->lsp_old_fx, lsp_new, lsp_mid, coder_type, st_fx->bwidth, st_fx->Bin_E_old_fx, st_fx->Bin_E_fx, Q_new+QSCALE-2, ppp_mode, nelp_mode); test(); - IF ( EQ_16(st_fx->last_core_fx,HQ_CORE)&&EQ_16(st_fx->core_fx,ACELP_CORE)) + IF ( EQ_16(st_fx->last_core,HQ_CORE)&&EQ_16(st_fx->core,ACELP_CORE)) { /* don't use old LSP/LSF values if this is the first ACELP frame after HQ frames */ Copy( lsp_mid, st_fx->lsp_old_fx, M ); @@ -321,19 +321,19 @@ void lsf_enc_fx( } /* LSP interpolation and conversion of LSPs to A(z) - two-subframe mode */ - int_lsp4_fx(st_fx->L_frame_fx, st_fx->lsp_old_fx, lsp_mid, lsp_new, Aq, M, -2); + int_lsp4_fx(st_fx->L_frame, st_fx->lsp_old_fx, lsp_mid, lsp_new, Aq, M, -2); } ELSE #endif { - int_lsp4_fx(st_fx->L_frame_fx, st_fx->lsp_old_fx, lsp_mid, lsp_new, Aq, M, 0); + int_lsp4_fx(st_fx->L_frame, st_fx->lsp_old_fx, lsp_mid, lsp_new, Aq, M, 0); } /*------------------------------------------------------------------* * Check LSF stability (distance between old LSFs and current LSFs) *------------------------------------------------------------------*/ - IF (NE_32(st_fx->core_brate_fx, SID_2k40)) + IF (NE_32(st_fx->core_brate, SID_2k40)) { - st_fx->stab_fac_fx = lsf_stab_fx(lsf_new, st_fx->lsf_old_fx, 0, st_fx->L_frame_fx); + st_fx->stab_fac_fx = lsf_stab_fx(lsf_new, st_fx->lsf_old_fx, 0, st_fx->L_frame); } return; } @@ -550,7 +550,7 @@ static Word16 qlsf_Mode_Select_fx( /* _ None */ /*========================================================================*/ void lsf_end_enc_fx( - Encoder_State_fx *st, /* i/o: encoder state structure */ + Encoder_State *st, /* i/o: encoder state structure */ const Word16 *lsf, /* i : LSF in the frequency domain (0..6400) */ Word16 *qlsf, /* o : quantized LSF */ const Word16 nBits_in, /* i : number of bits to spend on ISF quantization */ @@ -642,7 +642,7 @@ void lsf_end_enc_fx( * Calculate the number of stages and levels for each stage based on allowed bit budget * Set absolute threshold for codebook-type decision logic depending on signal bandwidth *------------------------------------------------------------------------------------ -*/ - IF ( EQ_16(st->bwidth_fx, NB)) + IF ( EQ_16(st->bwidth, NB)) { abs_threshold = L_add(SFNETLOWLIMIT_NB, 0); } @@ -651,12 +651,12 @@ void lsf_end_enc_fx( abs_threshold = L_add(SFNETLOWLIMIT_WB, 0); } /* Calculate LSF weighting coefficients */ - Unified_weighting_fx(&st->Bin_E_fx[L_FFT/2], Q_ener, lsf, wghts, (Word16)EQ_16(st->bwidth_fx, NB), (Word16)EQ_16(coder_type,UNVOICED),st->sr_core,M); + Unified_weighting_fx(&st->Bin_E_fx[L_FFT/2], Q_ener, lsf, wghts, (Word16)EQ_16(st->bwidth, NB), (Word16)EQ_16(coder_type,UNVOICED),st->sr_core,M); /*--------------------------------------------------------------------------------* * LSF quantization of SID frames *--------------------------------------------------------------------------------*/ - IF ( EQ_32(st->core_brate_fx, SID_2k40)) + IF ( EQ_32(st->core_brate, SID_2k40)) { lsfq_CNG_fx(hBstr, lsf, wghts, qlsf, &st->offset_scale1_fx[0][0], &st->offset_scale2_fx[0][0], &st->no_scales_fx[0][0] ); sort_fx( qlsf, 0, M-1 ); @@ -665,7 +665,7 @@ void lsf_end_enc_fx( return; } /* Find allowed predictor mode for current coder_type. (SN only (0), SN/AR switched (2) or MA predictive (1) */ - find_pred_mode(&predmode, coder_type, st->bwidth_fx, st->sr_core, &mode_lvq, &mode_lvq_p,st->total_brate_fx); + find_pred_mode(&predmode, coder_type, st->bwidth, st->sr_core, &mode_lvq, &mode_lvq_p,st->total_brate); /*----------------------------------------------------------------* * Calculate number of stages and levels for each stage based on the allowed bit allocation @@ -903,7 +903,7 @@ void lsf_end_enc_fx( * Write indices to array *--------------------------------------------------------------------------*/ - IF (EQ_16(st->codec_mode, MODE1) && EQ_16(st->core_fx, ACELP_CORE)) + IF (EQ_16(st->codec_mode, MODE1) && EQ_16(st->core, ACELP_CORE)) { /* write coder_type bit for VOICED@16kHz or GENERIC@16kHz */ test(); diff --git a/lib_enc/mdct_classifier_fx.c b/lib_enc/mdct_classifier_fx.c index 627bee610..d6f4d2c88 100644 --- a/lib_enc/mdct_classifier_fx.c +++ b/lib_enc/mdct_classifier_fx.c @@ -87,7 +87,7 @@ static void dft_mag_square_fx( Word16 mdct_classifier_fx( /* o: MDCT A/B decision */ const Word16 * fft_buff, /* i: re[0], re[1], ..., re[n/2], im[n/2 - 1], im[n/2 - 2], ..., im[1] */ - Encoder_State_fx *st_fx, /* i/o: Encoder state variable */ + Encoder_State *st_fx, /* i/o: Encoder state variable */ Word32 *cldfbBuf_Ener, Word16 enerBuffer_exp, const Word32 brate /* i : current brate, IVAS: nominal bitrate, EVS: st->total_brate */ @@ -126,7 +126,7 @@ Word16 mdct_classifier_fx( /* o: MDCT A/B decision #endif test(); #ifdef IVAS_CODE - IF (EQ_32(st_fx->input_Fs_fx, 32000) || EQ_32(st_fx->input_Fs_fx, 48000)) + IF (EQ_32(st_fx->input_Fs, 32000) || EQ_32(st_fx->input_Fs, 48000)) { gain2_start = GAIN2_START_SWB; gain2_start_rs = GAIN2_START_SWB_RS; @@ -139,7 +139,7 @@ Word16 mdct_classifier_fx( /* o: MDCT A/B decision H_length = H_LENGTH_SWB; move16();move16();move16();move16();move16();move16(); } - ELSE IF (EQ_32(st_fx->input_Fs_fx, 16000)) + ELSE IF (EQ_32(st_fx->input_Fs, 16000)) { gain2_start = GAIN2_START_WB; gain2_start_rs = GAIN2_START_SWB_RS; @@ -479,8 +479,8 @@ Word16 mdct_classifier_fx( /* o: MDCT A/B decision test(); test(); test(); - IF ((GE_32(brate, HQ_MDCTCLASS_CROSSOVER_BRATE) && GT_32(st_fx->input_Fs_fx, 16000) && (s_xor(condition1,condition2)!=0||condition3)) - || ((LT_32(brate, HQ_MDCTCLASS_CROSSOVER_BRATE) || EQ_32(st_fx->input_Fs_fx,16000) ) && condition4)) + IF ((GE_32(brate, HQ_MDCTCLASS_CROSSOVER_BRATE) && GT_32(st_fx->input_Fs, 16000) && (s_xor(condition1,condition2)!=0||condition3)) + || ((LT_32(brate, HQ_MDCTCLASS_CROSSOVER_BRATE) || EQ_32(st_fx->input_Fs,16000) ) && condition4)) { c = MDCT_CLASSIFER_HQ_LOCAL; /* Q13 */ move16(); } @@ -550,7 +550,7 @@ Word16 mdct_classifier_fx( /* o: MDCT A/B decision test(); test(); /* Prevent the usage of MDCTA on noisy-speech or inactive */ - if ( EQ_16(st_fx->mdct_sw_enable, MODE2) && (EQ_16(st_fx->flag_noisy_speech_snr,1) || st_fx->vad_flag==0) && EQ_16(clas_final,HQ_CORE)) + if ( EQ_16(st_fx->mdct_sw_enable, MODE2) && (EQ_16(st_fx->flag_noisy_speech_snr_fx,1) || st_fx->vad_flag==0) && EQ_16(clas_final,HQ_CORE)) { clas_final = TCX_20_CORE; move16(); @@ -559,7 +559,7 @@ Word16 mdct_classifier_fx( /* o: MDCT A/B decision /* EVS: brate == st->total_brate */ /* IVAS: brate is the nominal bitrate while st->total_brate may fluctuate. This sets a hard limit for HQ at HQ_16k40 */ test();test();test(); - if (LE_32(st_fx->total_brate_fx, HQ_16k40) || LT_32(brate, HQ_16k40) || EQ_16(st_fx->bwidth_fx, NB) || GT_32(brate, IVAS_48k)) + if (LE_32(st_fx->total_brate, HQ_16k40) || LT_32(brate, HQ_16k40) || EQ_16(st_fx->bwidth, NB) || GT_32(brate, IVAS_48k)) { clas_final = TCX_20_CORE; move16(); diff --git a/lib_enc/mdct_selector_fx.c b/lib_enc/mdct_selector_fx.c index 9d86ec941..20bc21392 100644 --- a/lib_enc/mdct_selector_fx.c +++ b/lib_enc/mdct_selector_fx.c @@ -113,7 +113,7 @@ static Word16 get_mean_ener( /* Returns mean energy in dB (Q8) */ *--------------------------------------------------------------------------*/ void MDCT_selector_fx( - Encoder_State_fx *st, /* i/o: Encoder State */ + Encoder_State *st, /* i/o: Encoder State */ Word16 sp_floor, /* i : Noise floor estimate Q7 */ const Word16 Etot, /* i : Total energy Q8 */ const Word16 cor_map_sum, /* i : harmonicity factor Q8 */ @@ -135,7 +135,7 @@ void MDCT_selector_fx( sp_floor = shl(sp_floor, 1); /* convert to Q8 */ - IF (EQ_16(st->bwidth_fx, NB)) + IF (EQ_16(st->bwidth, NB)) { lob_cldfb = 3200/400; move16(); @@ -144,7 +144,7 @@ void MDCT_selector_fx( lob_fft = (L_FFT/2)/2; /* 3.2 KHz */ move16(); hib_fft = (40*(L_FFT/2))/64; /* 4.0 KHz */ move16(); } - ELSE IF (EQ_16(st->bwidth_fx, WB)) + ELSE IF (EQ_16(st->bwidth, WB)) { lob_cldfb = 4800/400; move16(); @@ -159,7 +159,7 @@ void MDCT_selector_fx( move16(); hib_cldfb = 16000/400; move16(); - if (EQ_16(st->bwidth_fx, FB)) + if (EQ_16(st->bwidth, FB)) { hib_cldfb = 24000/400; move16(); @@ -168,8 +168,8 @@ void MDCT_selector_fx( hib_fft = L_FFT/2; /* 6.4 KHz (should be 8 KHz) */ move16(); } - /* st->last_core_fx is reset to TCX_20_CORE in init_acelp() => fix it here */ - last_core = st->last_core_fx; + /* st->last_core is reset to TCX_20_CORE in init_acelp() => fix it here */ + last_core = st->last_core; move16(); test(); if (EQ_16(st->last_codec_mode, MODE1)&&EQ_16(last_core,TCX_20_CORE)) @@ -188,7 +188,7 @@ void MDCT_selector_fx( hi_ener = get_mean_ener(&enerBuffer[lob_cldfb], enerBuffer_exp, sub(hib_cldfb, lob_cldfb)); /* Hi band sparseness */ - IF (GE_16(st->bwidth_fx, SWB)) + IF (GE_16(st->bwidth, SWB)) { /* For SWB, assume hi band sparseness based on 4.8 KHz-6.4 KHz band */ lob_fft = 3*L_FFT/2/4; /* 4.8 KHz */ move16(); @@ -325,18 +325,18 @@ void MDCT_selector_fx( { IF (prefer_tcx) { - st->core_fx = TCX_20_CORE; + st->core = TCX_20_CORE; move16(); } ELSE /* prefer_hq_core */ { - st->core_fx = HQ_CORE; + st->core = HQ_CORE; move16(); } } ELSE IF (EQ_16(last_core, HQ_CORE)||EQ_16(last_core,TCX_20_CORE)) { - st->core_fx = last_core; + st->core = last_core; move16(); } @@ -344,9 +344,9 @@ void MDCT_selector_fx( test(); test(); /* Prevent the usage of HQ_CORE on noisy-speech or inactive */ - IF (EQ_16(st->mdct_sw_enable, MODE2)&&EQ_16(st->core_fx,HQ_CORE)&&(EQ_16(st->flag_noisy_speech_snr,1)||st->vad_flag==0)) + IF (EQ_16(st->mdct_sw_enable, MODE2)&&EQ_16(st->core,HQ_CORE)&&(EQ_16(st->flag_noisy_speech_snr_fx,1)||st->vad_flag==0)) { - st->core_fx = TCX_20_CORE; + st->core = TCX_20_CORE; move16(); } diff --git a/lib_enc/nelp_enc_fx.c b/lib_enc/nelp_enc_fx.c index 018c055a9..779fb8d15 100644 --- a/lib_enc/nelp_enc_fx.c +++ b/lib_enc/nelp_enc_fx.c @@ -295,7 +295,7 @@ static void normalize_arr(Word16 *arr, Word16 *qf, Word16 size, Word16 hdr) /*===================================================================*/ void nelp_encoder_fx( - Encoder_State_fx *st_fx,/* i/o: encoder state */ + Encoder_State *st_fx,/* i/o: encoder state */ Word16 *in_fx, /* i : residual signal */ Word16 *exc_fx, /* o : NELP quantized excitation signal */ Word16 *qIn1, @@ -336,7 +336,7 @@ void nelp_encoder_fx( rf_flag = st_fx->rf_mode; - if (EQ_16(hSC_VBR->last_nelp_mode, 1) && NE_16(st_fx->bwidth_fx, st_fx->last_bwidth_fx)) + if (EQ_16(hSC_VBR->last_nelp_mode, 1) && NE_16(st_fx->bwidth, st_fx->last_bwidth)) { hSC_VBR->last_nelp_mode = 0; } @@ -344,7 +344,7 @@ void nelp_encoder_fx( qIn = *qIn1; move16(); test(); - IF(EQ_16(st_fx->bwidth_fx, NB)) + IF(EQ_16(st_fx->bwidth, NB)) { IF(hSC_VBR->last_nelp_mode != 1) { @@ -355,7 +355,7 @@ void nelp_encoder_fx( move16(); } } - ELSE IF(EQ_16(st_fx->bwidth_fx, WB) || EQ_16(st_fx->bwidth_fx, SWB)) + ELSE IF(EQ_16(st_fx->bwidth, WB) || EQ_16(st_fx->bwidth, SWB)) { IF(hSC_VBR->last_nelp_mode != 1) { @@ -368,7 +368,7 @@ void nelp_encoder_fx( IF(hSC_VBR->last_nelp_mode != 1) { test(); - IF(st_fx->bwidth_fx == WB || EQ_16(st_fx->bwidth_fx, SWB)) + IF(st_fx->bwidth == WB || EQ_16(st_fx->bwidth, SWB)) { set16_fx(hSC_VBR->shape1_filt_mem_fx, 0, 10); set16_fx(hSC_VBR->shape2_filt_mem_fx, 0, 10); @@ -386,7 +386,7 @@ void nelp_encoder_fx( /* Start Unvoiced/NELP Processing */ test(); - IF(EQ_16(st_fx->bwidth_fx, WB) || EQ_16(st_fx->bwidth_fx, SWB)) + IF(EQ_16(st_fx->bwidth, WB) || EQ_16(st_fx->bwidth, SWB)) { qE1 = qIn; move16(); @@ -676,7 +676,7 @@ void nelp_encoder_fx( qGain = 0; move16(); - quantize_uvg_fx(Gains_fx, &iG1_fx, iG2_fx, Gains_fx, st_fx->bwidth_fx); + quantize_uvg_fx(Gains_fx, &iG1_fx, iG2_fx, Gains_fx, st_fx->bwidth); IF(EQ_16(rf_flag, 1)) { @@ -692,7 +692,7 @@ void nelp_encoder_fx( } test(); - IF(EQ_16(st_fx->bwidth_fx, WB) || EQ_16(st_fx->bwidth_fx, SWB)) + IF(EQ_16(st_fx->bwidth, WB) || EQ_16(st_fx->bwidth, SWB)) { gain_fac_fx = 19005; move16();/* 1.16f in Q14 */ @@ -709,14 +709,14 @@ void nelp_encoder_fx( generate_nelp_excitation_fx(&(hSC_VBR->nelp_enc_seed), Gains_fx, ptr_fx, gain_fac_fx); test(); - IF(EQ_16(st_fx->bwidth_fx, WB) || EQ_16(st_fx->bwidth_fx, SWB)) + IF(EQ_16(st_fx->bwidth, WB) || EQ_16(st_fx->bwidth, SWB)) { BP1_ORDER = 4; Scale_sig(hSC_VBR->bp1_filt_mem_wb_fx, BP1_ORDER * 2, qGain - hSC_VBR->qprevGain_fx);/*qf-qAdj */ pz_filter_sp_fx(bp1_num_coef_wb_fx, bp1_den_coef_wb_fx, ptr_fx, ptr_tmp_fx, hSC_VBR->bp1_filt_mem_wb_fx, BP1_ORDER, BP1_ORDER, L_FRAME, 2); Copy(ptr_tmp_fx, ptr_fx, L_FRAME); } - ELSE IF(EQ_16(st_fx->bwidth_fx, NB)) + ELSE IF(EQ_16(st_fx->bwidth, NB)) { BP1_ORDER = 7; move16(); @@ -736,7 +736,7 @@ void nelp_encoder_fx( qE3 = 2 * qGain + 1; move16(); test(); - IF(st_fx->bwidth_fx == WB || EQ_16(st_fx->bwidth_fx, SWB)) + IF(st_fx->bwidth == WB || EQ_16(st_fx->bwidth, SWB)) { Scale_sig(hSC_VBR->shape1_filt_mem_fx, 10, (qGain - hSC_VBR->qprevGain_fx)); pz_filter_sp_fx(shape1_num_coef_fx, shape1_den_coef_fx, ptr_fx, ptr_tmp_fx, hSC_VBR->shape1_filt_mem_fx, 10, 10, L_FRAME, 1);/*1 = (16-qformat of shape1 cofficient) */ diff --git a/lib_enc/nois_est_fx.c b/lib_enc/nois_est_fx.c index 724aef595..14f8468c8 100644 --- a/lib_enc/nois_est_fx.c +++ b/lib_enc/nois_est_fx.c @@ -521,7 +521,7 @@ void noise_est_down_fx( * Noise energy estimation (noise energy is updated in case of noise-only frame) *-----------------------------------------------------------------*/ void noise_est_fx( - Encoder_State_fx *st_fx, /* i/o: state structure */ + Encoder_State *st_fx, /* i/o: state structure */ const Word16 old_pitch1, /* i : previous frame OL pitch[1] */ const Word32 tmpN[], /* i : temporary noise update Q_new + QSCALE */ const Word16 epsP_h[], /* i : msb prediction error energies Q_r-1 */ @@ -616,7 +616,7 @@ void noise_est_fx( /*-----------------------------------------------------------------* * Initialization *-----------------------------------------------------------------*/ - vad_bwidth_fx = st_fx->input_bwidth_fx; + vad_bwidth_fx = st_fx->input_bwidth; move16(); /*st_fx->ener_RAT = 10.0f * (float)log10( mean(lf_E, 8));*/ @@ -735,8 +735,8 @@ void noise_est_fx( IF (st_fx->hSpMusClas != NULL) { i = 0; move16(); - *loc_harm = multi_harm_fx(EspecdB, hNoiseEst->old_S_fx, hNoiseEst->cor_map_fx, &hNoiseEst->multi_harm_limit_fx, st_fx->total_brate_fx, - st_fx->bwidth_fx, (st_fx->hGSCEnc != NULL) ? &hGSCEnc->cor_strong_limit : &i, &hSpMusClas->mean_avr_dyn_fx, &hSpMusClas->last_sw_dyn_fx, cor_map_sum, sp_floor, S_map); + *loc_harm = multi_harm_fx(EspecdB, hNoiseEst->old_S_fx, hNoiseEst->cor_map_fx, &hNoiseEst->multi_harm_limit_fx, st_fx->total_brate, + st_fx->bwidth, (st_fx->hGSCEnc != NULL) ? &hGSCEnc->cor_strong_limit : &i, &hSpMusClas->mean_avr_dyn_fx, &hSpMusClas->last_sw_dyn_fx, cor_map_sum, sp_floor, S_map); } } /*-----------------------------------------------------------------* @@ -753,7 +753,7 @@ void noise_est_fx( ExpLmax = sub(30, norm_l(fr_bands[10])); ExpLmax2 = sub(30, norm_l(hNoiseEst->fr_bands2_fx[10])); tmpExp = s_max(tmpExp, sub(shl(s_max(ExpLmax,ExpLmax2), 1), s_min(ExpLmax, ExpLmax2))); - FOR (i = 11; i<= st_fx->max_band_fx; i++) + FOR (i = 11; i<= st_fx->max_band; i++) { ExpLmax = sub(30, norm_l(fr_bands[i])); ExpLmax2 = sub(30, norm_l(hNoiseEst->fr_bands2_fx[i])); @@ -763,7 +763,7 @@ void noise_est_fx( pt1 = fr_bands + 10; pt2 = hNoiseEst->fr_bands2_fx + 10; - FOR (i=10; i<=st_fx->max_band_fx; i++) + FOR (i=10; i<=st_fx->max_band; i++) { Lnum = L_max(*pt1, *pt2); /* Don't need if anymore */ #ifdef BASOP_NOGLOB @@ -821,10 +821,10 @@ void noise_est_fx( *-----------------------------------------------------------------*/ /* calculation of energy in first 10 critical bands */ - Ltmp = sum32_fx( &fr_bands[st_fx->min_band_fx], sub(10, st_fx->min_band_fx) ); + Ltmp = sum32_fx( &fr_bands[st_fx->min_band], sub(10, st_fx->min_band) ); /* calculation of energy in the rest of bands */ - Ltmp2 = sum32_fx( &fr_bands[10], sub(st_fx->max_band_fx,9) ); + Ltmp2 = sum32_fx( &fr_bands[10], sub(st_fx->max_band,9) ); #ifdef BASOP_NOGLOB wtmp = shl_o(1, sub(add(Q_new, QSCALE), 1), &Overflow); @@ -933,7 +933,7 @@ void noise_est_fx( non_staB = 0; move16(); - FOR( i = st_fx->min_band_fx; i <= st_fx->max_band_fx; i++ ) + FOR( i = st_fx->min_band; i <= st_fx->max_band; i++ ) { /* + 1.0f added to reduce sensitivity to non stationarity in low energies */ /* tmp_enr = enr[i] + 1.0f; */ @@ -1072,7 +1072,7 @@ void noise_est_fx( } } - } /* end of band loop FOR( i = st_fx->min_band_fx; i <= st_fx->max_band_fx; i++ ) */ + } /* end of band loop FOR( i = st_fx->min_band; i <= st_fx->max_band; i++ ) */ IF (LT_16(Etot,-1280)) { @@ -1083,7 +1083,7 @@ void noise_est_fx( lim_Etot_fx = s_max(5120,Etot); /* 20.0f Q8 */ lim_Etot_sq_fx = extract_h(L_shl_r(L_mult(lim_Etot_fx,lim_Etot_fx),1)); /* Q2 */ - if ( st_fx->ini_frame_fx < 150 ) + if ( st_fx->ini_frame < 150 ) { /* Allow use of quicker filter during init - if needed */ /* st->Etot_st_est = 0.25f * lim_Etot + (1.0f-0.25F) * st->Etot_st_est; */ @@ -1124,7 +1124,7 @@ void noise_est_fx( } IF( (GT_16(*st_harm_cor_cnt,1))&&((LT_16(Etot,3840))||/* 15 in Q8 */ - ( GT_16(st_fx->ini_frame_fx,10) && + ( GT_16(st_fx->ini_frame,10) && GT_16(sub(Etot, hNoiseEst->Etot_lp_fx),1792) )) /* 7 in Q8 */ ) { @@ -1398,7 +1398,7 @@ void noise_est_fx( if( ( ( LT_16(*st_harm_cor_cnt, (3*HC_CNT_SLOW_FX) )) && ( ( GT_32(non_sta, th_sta) ) || (LT_16(tmp_pc, TH_PC_FX) ) || ( GT_16(noise_char ,0)) ) ) || - ( (GT_16(st_fx->ini_frame_fx, HE_LT_CNT_INIT_FX ) ) && ( GT_16(sub(Etot, Etot_l_lp), 2560) ) ) || + ( (GT_16(st_fx->ini_frame, HE_LT_CNT_INIT_FX ) ) && ( GT_16(sub(Etot, Etot_l_lp), 2560) ) ) || ( GT_16(cor_tmp, cor_max) ) || /* Q15 */ ( GT_32(LepsP, th_eps) ) || /* Q11 */ ( GT_16(*loc_harm,0)) || @@ -1711,7 +1711,7 @@ void noise_est_fx( move16(); test(); test(); - if ( ( LT_16(st_fx->ini_frame_fx, HE_LT_CNT_INIT_FX )) + if ( ( LT_16(st_fx->ini_frame, HE_LT_CNT_INIT_FX )) && ( GT_16(hNoiseEst->harm_cor_cnt,5)) /* > 5 Q0 */ && ( LT_16(sub(Etot, hNoiseEst->Etot_lp_fx),1792 )) /* 7 in Q8 */ && ( NE_16(tmp, 0)) ) diff --git a/lib_enc/ppp_enc_fx.c b/lib_enc/ppp_enc_fx.c index b28fc5265..f509b0dd9 100644 --- a/lib_enc/ppp_enc_fx.c +++ b/lib_enc/ppp_enc_fx.c @@ -213,7 +213,7 @@ ivas_error ppp_quarter_encoder_fx( * Impose PPP - CELP - CELP pattern *-------------------------------------------------------------------*/ void set_ppp_mode_fx( - Encoder_State_fx *st_fx, /* i/o: state structure */ + Encoder_State *st_fx, /* i/o: state structure */ const Word16 noisy_speech_HO, /* i : SC-VBR noisy speech HO flag */ const Word16 clean_speech_HO, /* i : SC-VBR clean speech HO flag */ const Word16 NB_speech_HO, /* i : SC-VBR NB speech HO flag */ @@ -249,7 +249,7 @@ void set_ppp_mode_fx( /* force the coder to NELP mode during the first five frames */ /* this will indicate the decoder that the coder is operating in the VBR mode */ - IF ( LT_16( st_fx->ini_frame_fx, 5)) + IF ( LT_16( st_fx->ini_frame, 5)) { st_fx->coder_type = UNVOICED; move16(); @@ -258,7 +258,7 @@ void set_ppp_mode_fx( } /* Pattern PPP-CELP-CELP (pppcountE holds number of consecutive PPP frames) */ test(); - IF ( NE_16( st_fx->coder_type, VOICED )||EQ_16(st_fx->last_coder_type_fx,TRANSITION)) + IF ( NE_16( st_fx->coder_type, VOICED )||EQ_16(st_fx->last_coder_type,TRANSITION)) { /* ensure no transient to PPP transition */ hSC_VBR->pppcountE = 0; @@ -277,7 +277,7 @@ void set_ppp_mode_fx( { hSC_VBR->ppp_mode = 1; move16(); - st_fx->core_brate_fx = PPP_NELP_2k80; + st_fx->core_brate = PPP_NELP_2k80; move32(); } ELSE IF ( EQ_16(hSC_VBR->pppcountE, 2 )) @@ -294,7 +294,7 @@ void set_ppp_mode_fx( /* QQF Mode */ hSC_VBR->ppp_mode = 1; move16(); - st_fx->core_brate_fx = PPP_NELP_2k80; + st_fx->core_brate = PPP_NELP_2k80; move32(); } } @@ -317,7 +317,7 @@ void set_ppp_mode_fx( move16(); } - IF ( st_fx->last_core_fx == HQ_CORE ) + IF ( st_fx->last_core == HQ_CORE ) { hSC_VBR->ppp_mode = 0; move16(); @@ -332,7 +332,7 @@ void set_ppp_mode_fx( test(); test(); IF ( (hSC_VBR->last_ppp_mode != 0 ) && (hSC_VBR->ppp_mode == 0 ) && ( st_fx->sp_aud_decision1 != 0) - && EQ_16(st_fx->bwidth_fx, NB)&&st_fx->Opt_SC_VBR_fx!=0) /*if it were about to go from ppp->HQ*/ + && EQ_16(st_fx->bwidth, NB)&&st_fx->Opt_SC_VBR!=0) /*if it were about to go from ppp->HQ*/ { hSC_VBR->avoid_HQ_VBR_NB = 1; move16(); @@ -343,7 +343,7 @@ void set_ppp_mode_fx( test(); test(); test(); - IF ( (hSC_VBR->last_nelp_mode != 0) && ( st_fx->sp_aud_decision1 != 0) && EQ_16( st_fx->bwidth_fx, NB)&&(st_fx->Opt_SC_VBR_fx!=0)) /*if it were about to go from nelp->HQ*/ + IF ( (hSC_VBR->last_nelp_mode != 0) && ( st_fx->sp_aud_decision1 != 0) && EQ_16( st_fx->bwidth, NB)&&(st_fx->Opt_SC_VBR!=0)) /*if it were about to go from nelp->HQ*/ { hSC_VBR->avoid_HQ_VBR_NB = 1; move16(); @@ -356,12 +356,12 @@ void set_ppp_mode_fx( test(); test(); if( ( GT_16(st_fx->old_pitch_buf_fx[(2*NB_SUBFR)-1], PPP_LAG_THRLD_Q6)|| - GT_16(st_fx->pitch_fx[1], PPP_LAG_THRLD) || !st_fx->last_Opt_SC_VBR_fx ) && + GT_16(st_fx->pitch_fx[1], PPP_LAG_THRLD) || !st_fx->last_Opt_SC_VBR ) && EQ_16(hSC_VBR->ppp_mode,1) ) { hSC_VBR->ppp_mode=0; move16(); - st_fx->core_brate_fx = ACELP_7k20; + st_fx->core_brate = ACELP_7k20; move32(); } diff --git a/lib_enc/pre_proc_fx.c b/lib_enc/pre_proc_fx.c index c4fef154b..c4991420c 100644 --- a/lib_enc/pre_proc_fx.c +++ b/lib_enc/pre_proc_fx.c @@ -21,7 +21,7 @@ *--------------------------------------------------------------------*/ void pre_proc_fx( - Encoder_State_fx* st, /* i/o: encoder state structure */ + Encoder_State* st, /* i/o: encoder state structure */ const Word16 input_frame, /* i : frame length */ Word16 old_inp_12k8[], /* i/o: buffer of old input signal */ Word16 old_inp_16k[], /* i/o: buffer of old input signal @ 16kHz */ @@ -133,7 +133,7 @@ void pre_proc_fx( /*------------------------------------------------------------------* * Initializations *------------------------------------------------------------------*/ - signal_in = st->input; + signal_in = st->input_fx; vad_flag_dtx = 0; move16(); @@ -193,7 +193,7 @@ void pre_proc_fx( st->rf_mode = st->Opt_RF_ON; move16(); - last_core_orig = st->last_core_fx; + last_core_orig = st->last_core; move16(); /*--------------------------------------------------------------* @@ -212,7 +212,7 @@ void pre_proc_fx( * Change the sampling frequency to 12.8 kHz *----------------------------------------------------------------*/ - modify_Fs_fx( signal_in, input_frame, st->input_Fs_fx, new_inp_12k8, INT_FS_12k8, st->mem_decim_fx, (const Word16)(EQ_16(st->max_bwidth_fx,NB))); + modify_Fs_fx( signal_in, input_frame, st->input_Fs, new_inp_12k8, INT_FS_12k8, st->mem_decim_fx, (const Word16)(EQ_16(st->max_bwidth,NB))); Copy( new_inp_12k8, st->buf_speech_enc+L_FRAME32k, L_FRAME ); Scale_sig( st->buf_speech_enc+L_FRAME32k, L_FRAME, 1 ); /*------------------------------------------------------------------* @@ -227,13 +227,13 @@ void pre_proc_fx( test(); test(); /* reserve an extra bit of headroom in case of NB coding and if there is a chance of energy above 4 kHz */ - /* st->bwidth_fx refers to the coded bandwidth of the previous frame */ - if( ((EQ_16(st->bwidth_fx, NB))||(EQ_16(st->max_bwidth_fx,NB)))&&(GT_32(st->input_Fs_fx,8000))) + /* st->bwidth refers to the coded bandwidth of the previous frame */ + if( ((EQ_16(st->bwidth, NB))||(EQ_16(st->max_bwidth,NB)))&&(GT_32(st->input_Fs,8000))) { headroom = add(headroom, 1); } Preemph_scaled( new_inp_12k8, Q_new, &st->mem_preemph_fx, st->Q_max, - PREEMPH_FAC, 0, headroom, L_Q_MEM, L_FRAME, st->last_coder_type_fx, 1 ); + PREEMPH_FAC, 0, headroom, L_Q_MEM, L_FRAME, st->last_coder_type, 1 ); Q_exp = sub(*Q_new, st->Q_old); st->prev_Q_old=st->Q_old; @@ -245,7 +245,7 @@ void pre_proc_fx( * Scaling of memories *-----------------------------------------------------------------*/ - Le_min_scaled = Scale_mem_pre_proc( st->ini_frame_fx, Q_exp, Q_new, old_inp_12k8, &(st->mem_wsp_fx), hNoiseEst->enrO_fx, hNoiseEst->bckr_fx, + Le_min_scaled = Scale_mem_pre_proc( st->ini_frame, Q_exp, Q_new, old_inp_12k8, &(st->mem_wsp_fx), hNoiseEst->enrO_fx, hNoiseEst->bckr_fx, hNoiseEst->ave_enr_fx, hNoiseEst->ave_enr2_fx, hNoiseEst->fr_bands1_fx, hNoiseEst->fr_bands2_fx, st->Bin_E_old_fx ); /*-------------------------------------------------------------------------* @@ -256,7 +256,7 @@ void pre_proc_fx( #ifdef IVAS_CODE_CPE NULL, #endif - st->input_Fs_fx, inp_12k8, *Q_new, fr_bands, lf_E, Etot, st->min_band_fx, st->max_band_fx, Le_min_scaled, Scale_fac, st->Bin_E_fx, st->Bin_E_old_fx, + st->input_Fs, inp_12k8, *Q_new, fr_bands, lf_E, Etot, st->min_band, st->max_band, Le_min_scaled, Scale_fac, st->Bin_E_fx, st->Bin_E_old_fx, PS, st->lgBin_E_fx, st->band_energies, fft_buff ); st->band_energies_exp = sub(sub(WORD32_BITS-1,*Q_new),QSCALE); @@ -266,14 +266,14 @@ void pre_proc_fx( * SAD (1-signal, 0-noise) *----------------------------------------------------------------*/ - noise_est_pre_fx( *Etot, st->ini_frame_fx, hNoiseEst, 0, EVS_MONO, EVS_MONO); + noise_est_pre_fx( *Etot, st->ini_frame, hNoiseEst, 0, EVS_MONO, EVS_MONO); st->vad_flag = wb_vad_fx( st, fr_bands, &noisy_speech_HO, &clean_speech_HO, &NB_speech_HO, - &snr_sum_he, &localVAD_HE_SAD, &(st->flag_noisy_speech_snr), *Q_new + &snr_sum_he, &localVAD_HE_SAD, &(st->flag_noisy_speech_snr_fx), *Q_new , hVAD, hNoiseEst, st->lp_speech_fx, st->lp_noise_fx); vad_flag_cldfb = vad_proc_fx(&(st->vad_st), realBuffer, imagBuffer, cldfbScale->lb_scale, &cldfb_addition, - enerBuffer, enerBuffer_exp, st->cldfbAna_Fx->no_channels, st->vad_flag); + enerBuffer, enerBuffer_exp, st->cldfbAnaEnc->no_channels, st->vad_flag); IF ( LT_16( st->Pos_relE_cnt, 20) ) /* Ensure the level is high enough and cldfb decision is reliable */ { @@ -310,7 +310,7 @@ void pre_proc_fx( * Correlation correction as a function of total noise level *----------------------------------------------------------------*/ - noise_est_down_fx( fr_bands, hNoiseEst->bckr_fx, tmpN, tmpE, st->min_band_fx, st->max_band_fx, &hNoiseEst->totalNoise_fx, + noise_est_down_fx( fr_bands, hNoiseEst->bckr_fx, tmpN, tmpE, st->min_band, st->max_band, &hNoiseEst->totalNoise_fx, *Etot, &hNoiseEst->Etot_last_fx, &hNoiseEst->Etot_v_h2_fx, *Q_new , Le_min_scaled ); relE = sub(*Etot, st->lp_speech_fx); /* Q8 */ /* relE = *Etot - st->lp_speech;*/ @@ -333,7 +333,7 @@ void pre_proc_fx( *----------------------------------------------------------------*/ resetFdCngEnc_fx( st ); - perform_noise_estimation_enc_fx( st->band_energies, st->band_energies_exp, enerBuffer, enerBuffer_exp, st->hFdCngEnc_fx ); + perform_noise_estimation_enc_fx( st->band_energies, st->band_energies_exp, enerBuffer, enerBuffer_exp, st->hFdCngEnc ); /*-----------------------------------------------------------------* * Select SID or FRAME_NO_DATA frame if DTX enabled @@ -345,24 +345,24 @@ void pre_proc_fx( * Adjust FD-CNG Noise Estimator *----------------------------------------------------------------*/ test(); - IF( (NE_32(st->last_total_brate_fx,st->total_brate_fx))||(NE_16(st->last_bwidth_fx,st->bwidth_fx))) + IF( (NE_32(st->last_total_brate,st->total_brate))||(NE_16(st->last_bwidth,st->bwidth))) { - L_tmp = st->total_brate_fx; + L_tmp = st->total_brate; move32(); test(); - if( st->rf_mode && EQ_32(st->total_brate_fx,ACELP_13k20)) + if( st->rf_mode && EQ_32(st->total_brate,ACELP_13k20)) { L_tmp = ACELP_9k60; move32(); } - configureFdCngEnc_fx( st->hFdCngEnc_fx, st->bwidth_fx, L_tmp ); + configureFdCngEnc_fx( st->hFdCngEnc, st->bwidth, L_tmp ); } test(); - IF ( st->hFdCngEnc_fx!=NULL && st->Opt_DTX_ON_fx ) + IF ( st->hFdCngEnc!=NULL && st->Opt_DTX_ON ) { - AdjustFirstSID_fx( st->hFdCngEnc_fx->hFdCngCom->npart, st->hFdCngEnc_fx->msPeriodog, st->hFdCngEnc_fx->msPeriodog_exp, st->hFdCngEnc_fx->energy_ho, - &st->hFdCngEnc_fx->energy_ho_exp,st->hFdCngEnc_fx->msNoiseEst, &st->hFdCngEnc_fx->msNoiseEst_exp, st->hFdCngEnc_fx->msNoiseEst_old, - &st->hFdCngEnc_fx->msNoiseEst_old_exp, &(st->hFdCngEnc_fx->hFdCngCom->active_frame_counter), st ); + AdjustFirstSID_fx( st->hFdCngEnc->hFdCngCom->npart, st->hFdCngEnc->msPeriodog_fx, st->hFdCngEnc->msPeriodog_fx_exp, st->hFdCngEnc->energy_ho_fx, + &st->hFdCngEnc->energy_ho_fx_exp,st->hFdCngEnc->msNoiseEst_fx, &st->hFdCngEnc->msNoiseEst_fx_exp, st->hFdCngEnc->msNoiseEst_old_fx, + &st->hFdCngEnc->msNoiseEst_old_fx_exp, &(st->hFdCngEnc->hFdCngCom->active_frame_counter), st ); } /*----------------------------------------------------------------* @@ -371,10 +371,10 @@ void pre_proc_fx( IF ( EQ_16(st->codec_mode,MODE2)) { - SetModeIndex_fx( st, st->last_total_brate_fx, EVS_MONO, 0, *shift); + SetModeIndex_fx( st, st->last_total_brate, EVS_MONO, 0, *shift); } - calcLoEnvCheckCorrHiLo_Fix( st->cldfbAna_Fx->no_col, freqTable_local, st->hTECEnc->loBuffer, st->hTECEnc->loTempEnv, + calcLoEnvCheckCorrHiLo_Fix( st->cldfbAnaEnc->no_col, freqTable_local, st->hTECEnc->loBuffer, st->hTECEnc->loTempEnv, st->hTECEnc->loTempEnv_ns, st->hTECEnc->hiTempEnv, &(st->hTECEnc->corrFlag) ); /*---------------------------------------------------------------* @@ -441,12 +441,12 @@ void pre_proc_fx( IF( st->vad_flag == 0 ) { /* reset the OL pitch tracker memories during inactive frames */ - pitch_ol_init_fx( &st->old_thres_fx, &st->old_pitch, &st->delta_pit_fx, &st->old_corr_fx) ; + pitch_ol_init_fx( &st->old_thres_fx, &st->old_pitch, &st->delta_pit, &st->old_corr_fx) ; } old_pitch1 = st->pitch_fx[1]; pitch_ol_fx( st->pitch_fx, st->voicing_fx, &st->old_pitch, &st->old_corr_fx, corr_shift, &st->old_thres_fx, - &st->delta_pit_fx, st->old_wsp2_fx, wsp, st->mem_decim2_fx, relE, st->clas_fx, st->bwidth_fx, st->Opt_SC_VBR_fx ); + &st->delta_pit, st->old_wsp2_fx, wsp, st->mem_decim2_fx, relE, st->clas, st->bwidth, st->Opt_SC_VBR ); /* Updates for adaptive lag window memory */ st->old_pitch_la = st->pitch_fx[2]; @@ -456,10 +456,10 @@ void pre_proc_fx( /* Detection of very short stable st->pitch_fx period (MODE1 bit-rates) */ StableHighPitchDetect_fx( &flag_spitch, st->pitch_fx, st->voicing_fx, wsp, st->localVAD, &st->voicing_sm_fx, &st->voicing0_sm_fx, - &st->LF_EnergyRatio_sm_fx, &st->predecision_flag_fx, &st->diff_sm_fx, &st->energy_sm_fx,*Q_new,st->lgBin_E_fx); + &st->LF_EnergyRatio_sm_fx, &st->predecision_flag, &st->diff_sm_fx, &st->energy_sm_fx,*Q_new,st->lgBin_E_fx); /* 1/4 pitch precision improvement */ - IF( LE_32(st->total_brate_fx,ACELP_24k40)) + IF( LE_32(st->total_brate,ACELP_24k40)) { /* 1/4 pitch precision improvement */ pitch_ol2_fx( PIT_MIN_EXTEND, st->pitch_fx[0], &pitch_fr[0], &voicing_fr[0], 0, wsp, 7 ); @@ -500,7 +500,7 @@ void pre_proc_fx( #ifdef IVAS_CODE NULL, NULL, #endif - st->ini_frame_fx); + st->ini_frame); /*------------------------------------------------------------------* * Update parameters used in the VAD and DTX @@ -512,8 +512,8 @@ void pre_proc_fx( * UC and VC frame selection *-----------------------------------------------------------------*/ - find_tilt_fx( fr_bands, hNoiseEst->bckr_fx, ee, st->pitch_fx, st->voicing_fx, lf_E, corr_shift, st->input_bwidth_fx, - st->max_band_fx, hp_E, st->codec_mode, *Q_new, &(st->bckr_tilt_lt), st->Opt_SC_VBR_fx ); + find_tilt_fx( fr_bands, hNoiseEst->bckr_fx, ee, st->pitch_fx, st->voicing_fx, lf_E, corr_shift, st->input_bwidth, + st->max_band, hp_E, st->codec_mode, *Q_new, &(st->bckr_tilt_lt), st->Opt_SC_VBR ); st->coder_type = find_uv_fx( st, pitch_fr, voicing_fr, inp_12k8, ee, #ifdef IVAS_CODE @@ -536,7 +536,7 @@ void pre_proc_fx( st->rf_mode = 0; st->rf_target_bits_write = 0; } - ELSE IF( st->rf_mode && NE_32(st->core_brate_fx,FRAME_NO_DATA)&&NE_32(st->core_brate_fx,SID_2k40)) + ELSE IF( st->rf_mode && NE_32(st->core_brate,FRAME_NO_DATA)&&NE_32(st->core_brate,SID_2k40)) { /* the RF config is for (n- fec_offset)th frame that will be packed along with the n-th frame bitstream */ st->rf_mode = 1; @@ -560,15 +560,15 @@ void pre_proc_fx( * TC frame selection *-----------------------------------------------------------------*/ - st->clas_fx = signal_clas_fx( st, inp_12k8, ee, relE, L_look, &clas_mod); + st->clas = signal_clas_fx( st, inp_12k8, ee, relE, L_look, &clas_mod); - select_TC_fx(st->codec_mode, st->tc_cnt_fx, &st->coder_type, st->localVAD); + select_TC_fx(st->codec_mode, st->tc_cnt, &st->coder_type, st->localVAD); /* limit coder_type depending on the bitrate */ coder_type_modif_fx(st, relE); - if (st->Opt_SC_VBR_fx) + if (st->Opt_SC_VBR) { hSC_VBR->Local_VAD = st->localVAD; move16(); @@ -599,7 +599,7 @@ void pre_proc_fx( * Rewrite the VAD flag by VAD flag with DTX hangover for further processing) *----------------------------------------------------------------*/ - if( st->Opt_DTX_ON_fx ) + if( st->Opt_DTX_ON ) { st->vad_flag = vad_flag_dtx; move16(); /* flag now with the DTX-HO for use in further high rate encoding below */ @@ -613,38 +613,38 @@ void pre_proc_fx( { test();test();test();test(); test();test();test();test();test();test();test();test();test();test(); - IF( EQ_32(st->core_brate_fx,FRAME_NO_DATA)) + IF( EQ_32(st->core_brate,FRAME_NO_DATA)) { /* prevent "L_frame" changes in CNG segments */ - st->L_frame_fx = st->last_L_frame_fx; + st->L_frame = st->last_L_frame; move16(); } - ELSE IF ( EQ_32(st->core_brate_fx,SID_2k40) && GE_16(st->bwidth_fx,WB) && hDtxEnc->first_CNG && (hTdCngEnc != NULL && LT_16(hTdCngEnc->act_cnt2,MIN_ACT_CNG_UPD))) + ELSE IF ( EQ_32(st->core_brate,SID_2k40) && GE_16(st->bwidth,WB) && hDtxEnc->first_CNG && (hTdCngEnc != NULL && LT_16(hTdCngEnc->act_cnt2,MIN_ACT_CNG_UPD))) { /* prevent "L_frame" changes in SID frame after short segment of active frames */ - st->L_frame_fx = hDtxEnc->last_CNG_L_frame; + st->L_frame = hDtxEnc->last_CNG_L_frame; move16(); } - ELSE IF ( ( EQ_32(st->core_brate_fx,SID_2k40)&&GE_32(st->total_brate_fx,ACELP_9k60)&&((EQ_16(st->bwidth_fx,WB)&&!(EQ_32(st->total_brate_fx,ACELP_13k20)&&EQ_16(st->cng_type_fx,FD_CNG)))||(EQ_16(st->cng_type_fx,LP_CNG)&>_16(st->bwidth_fx,WB)&&GE_32(st->total_brate_fx,ACELP_16k40))))|| - ( GT_32(st->total_brate_fx,ACELP_24k40) && LT_32(st->total_brate_fx,HQ_96k) ) || ( EQ_32(st->total_brate_fx,ACELP_24k40) && GE_16(st->bwidth_fx,WB) ) ) + ELSE IF ( ( EQ_32(st->core_brate,SID_2k40)&&GE_32(st->total_brate,ACELP_9k60)&&((EQ_16(st->bwidth,WB)&&!(EQ_32(st->total_brate,ACELP_13k20)&&EQ_16(st->cng_type,FD_CNG)))||(EQ_16(st->cng_type,LP_CNG)&>_16(st->bwidth,WB)&&GE_32(st->total_brate,ACELP_16k40))))|| + ( GT_32(st->total_brate,ACELP_24k40) && LT_32(st->total_brate,HQ_96k) ) || ( EQ_32(st->total_brate,ACELP_24k40) && GE_16(st->bwidth,WB) ) ) { - st->L_frame_fx = L_FRAME16k; + st->L_frame = L_FRAME16k; move16(); } ELSE { - st->L_frame_fx = L_FRAME; + st->L_frame = L_FRAME; move16(); } - if( st->ini_frame_fx == 0 ) + if( st->ini_frame == 0 ) { /* avoid switching of internal ACELP Fs in the very first frame */ - st->last_L_frame_fx = st->L_frame_fx; + st->last_L_frame = st->L_frame; move16(); } - IF( EQ_16(st->L_frame_fx,L_FRAME)) + IF( EQ_16(st->L_frame,L_FRAME)) { st->gamma = GAMMA1; move16(); @@ -659,10 +659,10 @@ void pre_proc_fx( move16(); } - st->sr_core = L_mult0(FRAMES_PER_SEC,st->L_frame_fx); + st->sr_core = L_mult0(FRAMES_PER_SEC,st->L_frame); st->encoderLookahead_enc = NS2SA_fx2(st->sr_core, ACELP_LOOK_NS); move16(); - st->encoderPastSamples_enc = shr(imult1616(st->L_frame_fx, 9), 4); + st->encoderPastSamples_enc = shr(imult1616(st->L_frame, 9), 4); } /*-----------------------------------------------------------------* @@ -676,19 +676,19 @@ void pre_proc_fx( /* enforce TRANSITION frames */ test();test();test();test();test();test();test();test(); test();test();test();test();test(); - IF( NE_16(st->last_L_frame_fx,st->L_frame_fx) && NE_32(st->core_brate_fx,FRAME_NO_DATA) && NE_32(st->core_brate_fx,SID_2k40) && (NE_16(st->coder_type_raw_fx,VOICED))) + IF( NE_16(st->last_L_frame,st->L_frame) && NE_32(st->core_brate,FRAME_NO_DATA) && NE_32(st->core_brate,SID_2k40) && (NE_16(st->coder_type_raw,VOICED))) { /* enforce TC frame in case of ACELP@12k8 <-> ACELP@16k core switching */ st->coder_type = TRANSITION; move16(); } - ELSE IF( EQ_16(st->last_core_fx,HQ_CORE) || EQ_16(st->last_core_fx,TCX_10_CORE) || EQ_16(st->last_core_fx,TCX_20_CORE)) + ELSE IF( EQ_16(st->last_core,HQ_CORE) || EQ_16(st->last_core,TCX_10_CORE) || EQ_16(st->last_core,TCX_20_CORE)) { /* enforce TC frame in case of HQ/TCX -> ACELP core switching */ st->coder_type = TRANSITION; move16(); } - ELSE IF( LE_32(st->last_core_brate_fx,SID_2k40) && EQ_16(st->cng_type_fx,FD_CNG)) + ELSE IF( LE_32(st->last_core_brate,SID_2k40) && EQ_16(st->cng_type,FD_CNG)) { /* enforce TC frame in case of FD_CNG -> ACELP switching (past excitation not available) */ st->coder_type = TRANSITION; @@ -696,12 +696,12 @@ void pre_proc_fx( } /* select INACTIVE frames */ - ELSE IF( LE_32(st->total_brate_fx,ACELP_24k40) && st->vad_flag==0) + ELSE IF( LE_32(st->total_brate,ACELP_24k40) && st->vad_flag==0) { /* inactive frames will be coded by GSC technology */ /* except for the VBR mode. VBR mode uses NELP for that */ test(); - IF ( !( EQ_16(st->Opt_SC_VBR_fx, 1) && EQ_16(vad_flag_dtx,1))) + IF ( !( EQ_16(st->Opt_SC_VBR, 1) && EQ_16(vad_flag_dtx,1))) { st->coder_type = INACTIVE; move16(); @@ -709,8 +709,8 @@ void pre_proc_fx( move16(); } } - ELSE IF( GT_32(st->total_brate_fx,ACELP_24k40)&& - ( (st->vad_flag == 0 && GE_16(st->bwidth_fx,SWB) && GE_16(st->max_bwidth_fx,SWB) ) || (st->localVAD == 0 && (LE_16(st->bwidth_fx,WB) || LE_16(st->max_bwidth_fx,WB))) ) + ELSE IF( GT_32(st->total_brate,ACELP_24k40)&& + ( (st->vad_flag == 0 && GE_16(st->bwidth,SWB) && GE_16(st->max_bwidth,SWB) ) || (st->localVAD == 0 && (LE_16(st->bwidth,WB) || LE_16(st->max_bwidth,WB))) ) ) { /* inactive frames will be coded by AVQ technology */ @@ -736,21 +736,21 @@ void pre_proc_fx( * SC-VBR - decision about PPP/NELP mode *---------------------------------------------------------------*/ - IF( st->Opt_SC_VBR_fx ) + IF( st->Opt_SC_VBR ) { set_ppp_mode_fx( st, noisy_speech_HO, clean_speech_HO, NB_speech_HO, localVAD_HE_SAD); } test(); - IF ( !st->Opt_AMR_WB_fx && !st->rf_mode ) + IF ( !st->Opt_AMR_WB && !st->rf_mode ) { test(); test(); - IF ( EQ_32(st->total_brate_fx,ACELP_13k20)||EQ_32(st->total_brate_fx,ACELP_32k)) + IF ( EQ_32(st->total_brate,ACELP_13k20)||EQ_32(st->total_brate,ACELP_32k)) { st->mdct_sw_enable = MODE1; move16(); } - ELSE IF ( LE_32(ACELP_16k40,st->total_brate_fx)&&LE_32(st->total_brate_fx,ACELP_24k40)) + ELSE IF ( LE_32(ACELP_16k40,st->total_brate)&&LE_32(st->total_brate,ACELP_24k40)) { st->mdct_sw_enable = MODE2; move16(); @@ -766,17 +766,17 @@ void pre_proc_fx( decision_matrix_enc_fx( st, hq_core_type ); /* HQ_CORE/TCX_20_CORE decision */ - IF ( EQ_16(st->core_fx,HQ_CORE)) /* Decision matrix decided for MDCT coding */ + IF ( EQ_16(st->core,HQ_CORE)) /* Decision matrix decided for MDCT coding */ { test(); test(); - IF( (EQ_16(st->bwidth_fx,SWB) || EQ_16(st->bwidth_fx,FB)) && EQ_32(st->total_brate_fx, ACELP_32k)) + IF( (EQ_16(st->bwidth,SWB) || EQ_16(st->bwidth,FB)) && EQ_32(st->total_brate, ACELP_32k)) { /* Select MDCT Core */ - st->core_fx = mdct_classifier_fx(fft_buff,st, enerBuffer,sub(enerBuffer_exp, 31), st->total_brate_fx); + st->core = mdct_classifier_fx(fft_buff,st, enerBuffer,sub(enerBuffer_exp, 31), st->total_brate); } test(); - IF( (EQ_32(st->total_brate_fx, ACELP_13k20)) && (NE_16(st->bwidth_fx,FB))) + IF( (EQ_32(st->total_brate, ACELP_13k20)) && (NE_16(st->bwidth,FB))) { MDCT_selector_fx( st, sp_floor, *Etot, cor_map_sum, enerBuffer, enerBuffer_exp); } @@ -787,30 +787,30 @@ void pre_proc_fx( } /* Switch to MODE2 if TCX_20_CORE */ - IF( EQ_16(st->core_fx,TCX_20_CORE)) + IF( EQ_16(st->core,TCX_20_CORE)) { st->codec_mode = MODE2; move16(); IF( EQ_16(st->last_codec_mode,MODE1)) { - Word32 last_total_brate = L_add(st->last_total_brate_fx, 0); - st->last_total_brate_fx = -1; + Word32 last_total_brate = L_add(st->last_total_brate, 0); + st->last_total_brate = -1; move32(); - SetModeIndex_fx( st, st->last_total_brate_fx, EVS_MONO, 0, *shift ); - st->last_total_brate_fx = last_total_brate; + SetModeIndex_fx( st, st->last_total_brate, EVS_MONO, 0, *shift ); + st->last_total_brate = last_total_brate; move32(); } ELSE { - SetModeIndex_fx( st, st->last_total_brate_fx, EVS_MONO, 0, *shift); - st->sr_core = getCoreSamplerateMode2(st->element_mode, st->total_brate_fx, st->bwidth_fx, st->flag_ACELP16k, st->rf_mode, 0 ); + SetModeIndex_fx( st, st->last_total_brate, EVS_MONO, 0, *shift); + st->sr_core = getCoreSamplerateMode2(st->element_mode, st->total_brate, st->bwidth, st->flag_ACELP16k, st->rf_mode, 0 ); Mpy_32_16_ss(st->sr_core, 5243, &L_tmp, &lsb); /* 5243 is 1/50 in Q18. (0+18-15=3) */ - st->L_frame_fx = extract_l(L_shr(L_tmp, 3)); /* Q0 */ + st->L_frame = extract_l(L_shr(L_tmp, 3)); /* Q0 */ st->encoderLookahead_enc = NS2SA_fx2(st->sr_core, ACELP_LOOK_NS); move16(); - st->encoderPastSamples_enc = shr(imult1616(st->L_frame_fx, 9), 4); - assert(st->L_frame_fx == st->sr_core / 50); + st->encoderPastSamples_enc = shr(imult1616(st->L_frame, 9), 4); + assert(st->L_frame == st->sr_core / 50); IF ( EQ_32(st->sr_core, INT_FS_12k8)) { @@ -827,10 +827,10 @@ void pre_proc_fx( move16(); } - st->igf = getIgfPresent_fx(st->element_mode, st->total_brate_fx, st->bwidth_fx, st->rf_mode); + st->igf = getIgfPresent_fx(st->element_mode, st->total_brate, st->bwidth, st->rf_mode); } - st->coder_type = st->coder_type_raw_fx; + st->coder_type = st->coder_type_raw; move16(); IF( st->vad_flag == 0 ) @@ -855,15 +855,15 @@ void pre_proc_fx( test();test(); test();test(); - IF( EQ_32(st->total_brate_fx, ACELP_32k)&&EQ_16(loc_harm,1)&>_16(cor_map_sum,50<<8) - && EQ_16(st->clas_fx, VOICED_CLAS) && EQ_16(st->coder_type,GENERIC) ) + IF( EQ_32(st->total_brate, ACELP_32k)&&EQ_16(loc_harm,1)&>_16(cor_map_sum,50<<8) + && EQ_16(st->clas, VOICED_CLAS) && EQ_16(st->coder_type,GENERIC) ) { - st->last_harm_flag_acelp_fx = add(st->last_harm_flag_acelp_fx,1); - st->last_harm_flag_acelp_fx = s_min(st->last_harm_flag_acelp_fx,10); + st->last_harm_flag_acelp = add(st->last_harm_flag_acelp,1); + st->last_harm_flag_acelp = s_min(st->last_harm_flag_acelp,10); } ELSE { - st->last_harm_flag_acelp_fx = 0; + st->last_harm_flag_acelp = 0; move16(); } @@ -873,15 +873,15 @@ void pre_proc_fx( IF( EQ_16(st->coder_type,AUDIO)) { - st->audio_frame_cnt_fx = add(st->audio_frame_cnt_fx,AUDIO_COUNTER_STEP); + st->audio_frame_cnt = add(st->audio_frame_cnt,AUDIO_COUNTER_STEP); } ELSE IF (NE_16(st->coder_type,INACTIVE)) { - st->audio_frame_cnt_fx = sub(st->audio_frame_cnt_fx,1); + st->audio_frame_cnt = sub(st->audio_frame_cnt,1); } - st->audio_frame_cnt_fx = s_min(st->audio_frame_cnt_fx,AUDIO_COUNTER_MAX); - st->audio_frame_cnt_fx = s_max(st->audio_frame_cnt_fx,0); + st->audio_frame_cnt = s_min(st->audio_frame_cnt,AUDIO_COUNTER_MAX); + st->audio_frame_cnt = s_max(st->audio_frame_cnt,0); /*-----------------------------------------------------------------* * Set formant sharpening flag @@ -892,9 +892,9 @@ void pre_proc_fx( IF( EQ_16(st->coder_type,TRANSITION)) { test();test();test();test();test(); - IF( ( GT_32(st->total_brate_fx,ACELP_48k)&<_16(st->bwidth_fx,SWB))|| /* Deactivate for core bitrates higher than 48.0 kb/s */ - ( GE_32(st->total_brate_fx,ACELP_13k20) && LE_32(st->total_brate_fx,ACELP_16k40) ) || /* Deactivate for bitrates <13.2, 16.4> kb/s (this is basically due to lack of signaling configurations */ - ( GT_32(st->total_brate_fx,ACELP_16k40)&>_16(st->lp_noise_fx,FORMANT_SHARPENING_NOISE_THRESHOLD_FX))) /* Deactivate for bitrates >= 24.4 kb/s if the long-term noise level exceeds 34 dB */ + IF( ( GT_32(st->total_brate,ACELP_48k)&<_16(st->bwidth,SWB))|| /* Deactivate for core bitrates higher than 48.0 kb/s */ + ( GE_32(st->total_brate,ACELP_13k20) && LE_32(st->total_brate,ACELP_16k40) ) || /* Deactivate for bitrates <13.2, 16.4> kb/s (this is basically due to lack of signaling configurations */ + ( GT_32(st->total_brate,ACELP_16k40)&>_16(st->lp_noise_fx,FORMANT_SHARPENING_NOISE_THRESHOLD_FX))) /* Deactivate for bitrates >= 24.4 kb/s if the long-term noise level exceeds 34 dB */ { st->sharpFlag= 0; move16(); @@ -911,9 +911,9 @@ void pre_proc_fx( { test();test();test();test();test(); IF( *vad_hover_flag || - ( GT_32(st->total_brate_fx,ACELP_48k) && LT_16(st->bwidth_fx,SWB) ) || /* Deactivate for core bitrates higher than 48.0 kb/s */ - ( GE_32(st->total_brate_fx,ACELP_13k20)&>_16(st->lp_noise_fx,FORMANT_SHARPENING_NOISE_THRESHOLD_FX) /* Deactivate for bitrates >= 13.2 kb/s if the long-term noise level exceeds 34 dB */ - && GT_32(st->total_brate_fx,CNA_MAX_BRATE) ) ) + ( GT_32(st->total_brate,ACELP_48k) && LT_16(st->bwidth,SWB) ) || /* Deactivate for core bitrates higher than 48.0 kb/s */ + ( GE_32(st->total_brate,ACELP_13k20)&>_16(st->lp_noise_fx,FORMANT_SHARPENING_NOISE_THRESHOLD_FX) /* Deactivate for bitrates >= 13.2 kb/s if the long-term noise level exceeds 34 dB */ + && GT_32(st->total_brate,CNA_MAX_BRATE) ) ) { st->sharpFlag = 0; move16(); @@ -958,7 +958,7 @@ void pre_proc_fx( move32(); } - L_frame_tmp = s_max(L_FRAME16k,st->L_frame_fx); + L_frame_tmp = s_max(L_FRAME16k,st->L_frame); if( EQ_16(st->codec_mode,MODE1)) { L_frame_tmp = L_FRAME16k; @@ -976,22 +976,22 @@ void pre_proc_fx( *----------------------------------------------------------------*/ test(); - IF( EQ_32(st->input_Fs_fx,sr_core_tmp)) + IF( EQ_32(st->input_Fs,sr_core_tmp)) { /* no resampling needed, only delay adjustement to account for the FIR resampling delay */ - delay = NS2SA_fx2(st->input_Fs_fx, DELAY_FIR_RESAMPL_NS); + delay = NS2SA_fx2(st->input_Fs, DELAY_FIR_RESAMPL_NS); Copy_Scale_sig( st->mem_decim16k_fx + delay, new_inp_16k, delay, -1 ); /* Input in Q0 -> Output in Q-1 to mimic the resampling filter */ Copy_Scale_sig( signal_in, new_inp_16k + delay, input_frame - delay, -1 ); /* Input in Q0 -> Output in Q-1 to mimic the resampling filter */ Copy( signal_in + input_frame - shl(delay,1), st->mem_decim16k_fx, shl(delay,1) ); /* memory still in Q0 */ } - ELSE IF( EQ_32(st->input_Fs_fx,32000)||EQ_32(st->input_Fs_fx,48000)) + ELSE IF( EQ_32(st->input_Fs,32000)||EQ_32(st->input_Fs,48000)) { - modify_Fs_fx( signal_in, input_frame, st->input_Fs_fx, new_inp_16k, sr_core_tmp, st->mem_decim16k_fx, 0 ); + modify_Fs_fx( signal_in, input_frame, st->input_Fs, new_inp_16k, sr_core_tmp, st->mem_decim16k_fx, 0 ); } ELSE /* keep memories up-to-date in case of bitrate switching */ { /* no resampling needed, only delay adjustement to account for the FIR resampling delay */ - delay = NS2SA_fx2(st->input_Fs_fx, DELAY_FIR_RESAMPL_NS); + delay = NS2SA_fx2(st->input_Fs, DELAY_FIR_RESAMPL_NS); Copy( st->mem_decim16k_fx + delay, new_inp_16k, delay ); Copy( signal_in, new_inp_16k + delay, sub(input_frame, delay) ); Copy( signal_in + sub(input_frame, shl(delay,1)), st->mem_decim16k_fx, shl(delay,1) ); @@ -1014,7 +1014,7 @@ void pre_proc_fx( test(); test(); - IF( ((st->tcxonly == 0) || (EQ_16(st->codec_mode,MODE1)))&>_32(st->input_Fs_fx,8000)) + IF( ((st->tcxonly == 0) || (EQ_16(st->codec_mode,MODE1)))&>_32(st->input_Fs,8000)) { #ifdef BASOP_NOGLOB st->mem_preemph_enc = shl_o(new_inp_16k[sub(L_frame_tmp,1)],1, &Overflow); @@ -1024,11 +1024,11 @@ void pre_proc_fx( } test(); - IF( GT_32(st->input_Fs_fx,8000)&&EQ_32(sr_core_tmp, INT_FS_16k)) + IF( GT_32(st->input_Fs,8000)&&EQ_32(sr_core_tmp, INT_FS_16k)) { - Preemph_scaled( new_inp_16k, &Q_new_16k, &(st->mem_preemph16k_fx), st->Q_max_16k, PREEMPH_FAC_16k, 0, 1, L_Q_MEM, L_FRAME16k, st->last_coder_type_fx, 1); + Preemph_scaled( new_inp_16k, &Q_new_16k, &(st->mem_preemph16k_fx), st->Q_max_16k, PREEMPH_FAC_16k, 0, 1, L_Q_MEM, L_FRAME16k, st->last_coder_type, 1); } - ELSE IF( GT_32(st->input_Fs_fx,8000)) /* keep memory up-to-date in case of bit-rate switching */ + ELSE IF( GT_32(st->input_Fs,8000)) /* keep memory up-to-date in case of bit-rate switching */ { st->mem_preemph16k_fx = new_inp_16k[sub(L_frame_tmp,1)]; move16(); @@ -1039,15 +1039,15 @@ void pre_proc_fx( *-----------------------------------------------------------------*/ test();test();test();test();test();test(); - IF( ( ((st->tcxonly == 0) || !(NE_32(st->core_brate_fx,FRAME_NO_DATA) || NE_32(st->core_brate_fx,SID_2k40))) && EQ_16(st->L_frame_fx,L_FRAME16k) && EQ_16(st->codec_mode,MODE2)) || - ( EQ_16(st->L_frame_fx,L_FRAME16k) && EQ_16(st->codec_mode,MODE1) ) ) + IF( ( ((st->tcxonly == 0) || !(NE_32(st->core_brate,FRAME_NO_DATA) || NE_32(st->core_brate,SID_2k40))) && EQ_16(st->L_frame,L_FRAME16k) && EQ_16(st->codec_mode,MODE2)) || + ( EQ_16(st->L_frame,L_FRAME16k) && EQ_16(st->codec_mode,MODE1) ) ) { *Q_new = Q_new_16k; move16(); } ELSE { - IF( GT_32(st->input_Fs_fx,8000)&&EQ_32(sr_core_tmp,16000)) + IF( GT_32(st->input_Fs,8000)&&EQ_32(sr_core_tmp,16000)) { Scale_sig(new_inp_16k, L_FRAME16k, sub(*Q_new,Q_new_16k)); } @@ -1074,9 +1074,9 @@ void pre_proc_fx( test(); test(); #ifndef CR_2109_to_2112_cd0_ce0 - IF((((st->tcxonly == 0) || !(NE_32(st->core_brate_fx, FRAME_NO_DATA) || NE_32(st->core_brate_fx, SID_2k40))) && EQ_16(st->L_frame_fx, L_FRAME16k) && EQ_16(st->codec_mode, MODE2)) || (EQ_16(st->L_frame_fx, L_FRAME16k) && EQ_16(st->codec_mode, MODE1)) ) + IF((((st->tcxonly == 0) || !(NE_32(st->core_brate, FRAME_NO_DATA) || NE_32(st->core_brate, SID_2k40))) && EQ_16(st->L_frame, L_FRAME16k) && EQ_16(st->codec_mode, MODE2)) || (EQ_16(st->L_frame, L_FRAME16k) && EQ_16(st->codec_mode, MODE1)) ) #else - IF((((st->tcxonly == 0) || !(NE_32(st->core_brate_fx,FRAME_NO_DATA) && NE_32(st->core_brate_fx,SID_2k40))) && EQ_16(st->L_frame_fx,L_FRAME16k) && EQ_16(st->codec_mode,MODE2)) || ( EQ_16(st->L_frame_fx,L_FRAME16k) && EQ_16(st->codec_mode,MODE1))) + IF((((st->tcxonly == 0) || !(NE_32(st->core_brate,FRAME_NO_DATA) && NE_32(st->core_brate,SID_2k40))) && EQ_16(st->L_frame,L_FRAME16k) && EQ_16(st->codec_mode,MODE2)) || ( EQ_16(st->L_frame,L_FRAME16k) && EQ_16(st->codec_mode,MODE1))) #endif { /* update signal buffers */ @@ -1094,7 +1094,7 @@ void pre_proc_fx( *---------------------------------------------------------------*/ test(); - IF( EQ_16(st->last_L_frame_fx,L_FRAME)&&EQ_16(st->codec_mode,MODE1)) + IF( EQ_16(st->last_L_frame,L_FRAME)&&EQ_16(st->codec_mode,MODE1)) { /* this is just an approximation, but it is sufficient */ Copy( st->lsp_old1_fx, st->lspold_enc_fx, M ); @@ -1122,12 +1122,12 @@ void pre_proc_fx( ELSE { /* update signal buffers */ - Copy( new_inp_12k8, st->buf_speech_enc_pe+st->L_frame_fx, L_FRAME ); - Copy( st->buf_speech_enc+L_FRAME32k, st->buf_speech_enc+st->L_frame_fx, L_FRAME ); + Copy( new_inp_12k8, st->buf_speech_enc_pe+st->L_frame, L_FRAME ); + Copy( st->buf_speech_enc+L_FRAME32k, st->buf_speech_enc+st->L_frame, L_FRAME ); if ( st->tcxonly == 0 ) { - Copy( wsp, st->buf_wspeech_enc+st->L_frame_fx+L_SUBFR, L_FRAME + L_LOOK_12k8 ); + Copy( wsp, st->buf_wspeech_enc+st->L_frame+L_SUBFR, L_FRAME + L_LOOK_12k8 ); } test(); test(); @@ -1167,11 +1167,11 @@ void pre_proc_fx( { IF (Q_wsp_exp != 0) { - Scale_sig(st->buf_wspeech_enc, st->L_frame_fx+L_SUBFR, Q_wsp_exp); + Scale_sig(st->buf_wspeech_enc, st->L_frame+L_SUBFR, Q_wsp_exp); } IF( EQ_16(excitation_max_test,1)) { - Scale_sig( st->buf_wspeech_enc, st->L_frame_fx+L_SUBFR+st->L_frame_fx+st->encoderLookahead_enc, -1 ); + Scale_sig( st->buf_wspeech_enc, st->L_frame+L_SUBFR+st->L_frame+st->encoderLookahead_enc, -1 ); } } @@ -1186,7 +1186,7 @@ void pre_proc_fx( { test(); test(); - IF((NE_32(st->core_brate_fx,FRAME_NO_DATA)&&NE_32(st->core_brate_fx,SID_2k40)&&st->tcxonly==0)) + IF((NE_32(st->core_brate,FRAME_NO_DATA)&&NE_32(st->core_brate,SID_2k40)&&st->tcxonly==0)) { core_acelp_tcx20_switching_fx( st, non_staX, pitch_fr, voicing_fr, currFlatness, lsp_mid, stab_fac, *Q_new, *shift ); } @@ -1194,17 +1194,17 @@ void pre_proc_fx( test(); IF (EQ_16(st->mdct_sw_enable,MODE2)&&!st->rf_mode) { - IF (EQ_16(st->core_fx,TCX_20_CORE)) /* Switching only possible from TCX_20 frames, not from TCX_10 frames */ + IF (EQ_16(st->core,TCX_20_CORE)) /* Switching only possible from TCX_20 frames, not from TCX_10 frames */ { /* Select MDCT Core */ test(); test(); - IF ((EQ_16(st->bwidth_fx,SWB) || EQ_16(st->bwidth_fx,FB)) && EQ_32(st->total_brate_fx, ACELP_24k40)) + IF ((EQ_16(st->bwidth,SWB) || EQ_16(st->bwidth,FB)) && EQ_32(st->total_brate, ACELP_24k40)) { - st->core_fx = mdct_classifier_fx(fft_buff,st, enerBuffer, sub(enerBuffer_exp, 31), st->total_brate_fx); + st->core = mdct_classifier_fx(fft_buff,st, enerBuffer, sub(enerBuffer_exp, 31), st->total_brate); } test(); - IF ((EQ_32(st->total_brate_fx, ACELP_16k40)) && (NE_16(st->bwidth_fx,FB))) + IF ((EQ_32(st->total_brate, ACELP_16k40)) && (NE_16(st->bwidth,FB))) { MDCT_selector_fx( st, sp_floor, *Etot, cor_map_sum, enerBuffer, enerBuffer_exp ); } @@ -1216,21 +1216,21 @@ void pre_proc_fx( /* Do the switching that was decided in the MDCT selector */ test(); - IF( EQ_16(st->core_fx,HQ_CORE)) + IF( EQ_16(st->core,HQ_CORE)) { st->codec_mode = MODE1; move16(); st->mdct_sw = MODE2; move16(); } - ELSE IF( EQ_16(st->last_codec_mode,MODE1)&&EQ_16(st->last_core_fx,HQ_CORE)) + ELSE IF( EQ_16(st->last_codec_mode,MODE1)&&EQ_16(st->last_core,HQ_CORE)) { - Word16 L_frame_old = st->last_L_frame_fx; + Word16 L_frame_old = st->last_L_frame; move16(); - st->last_L_frame_fx = st->L_frame_fx; + st->last_L_frame = st->L_frame; move16(); - SetModeIndex_fx( st, st->last_total_brate_fx, EVS_MONO, 0, *shift); - st->last_L_frame_fx = L_frame_old; + SetModeIndex_fx( st, st->last_total_brate, EVS_MONO, 0, *shift); + st->last_L_frame = L_frame_old; move16(); } } @@ -1254,11 +1254,11 @@ void pre_proc_fx( /* update old input signal @16kHz buffer */ test(); - IF( GT_32(st->input_Fs_fx,8000)&&EQ_32(sr_core_tmp, INT_FS_16k)) + IF( GT_32(st->input_Fs,8000)&&EQ_32(sr_core_tmp, INT_FS_16k)) { Copy( &old_inp_16k[L_frame_tmp], st->old_inp_16k_fx, L_INP_MEM ); } - ELSE IF( GT_32(st->input_Fs_fx,8000)) + ELSE IF( GT_32(st->input_Fs,8000)) { lerp( st->old_inp_12k8_fx+L_INP_MEM-L_INP_MEM*4/5, st->old_inp_16k_fx, L_INP_MEM, L_INP_MEM*4/5); Scale_sig(st->old_inp_16k_fx, L_INP_MEM, sub(*Q_new,st->Q_old)); @@ -1277,19 +1277,19 @@ void pre_proc_fx( /* set the pointer of the current frame for the ACELP core */ *inp = inp_16k; - if ( EQ_16(st->L_frame_fx,L_FRAME)) + if ( EQ_16(st->L_frame,L_FRAME)) { *inp = inp_12k8; } /* Update vAD hangover frame counter in active frames */ - if ((NE_16(st->core_fx, HQ_CORE) && st->tcxonly == 0) || EQ_16(st->core_fx, ACELP_CORE)) + if ((NE_16(st->core, HQ_CORE) && st->tcxonly == 0) || EQ_16(st->core, ACELP_CORE)) { - IF(!(EQ_32(st->core_brate_fx, SID_2k40) || EQ_32(st->core_brate_fx, FRAME_NO_DATA))) + IF(!(EQ_32(st->core_brate, SID_2k40) || EQ_32(st->core_brate, FRAME_NO_DATA))) { test(); - IF(st->Opt_DTX_ON_fx != 0 && *vad_hover_flag != 0) + IF(st->Opt_DTX_ON != 0 && *vad_hover_flag != 0) { hTdCngEnc->burst_ho_cnt = add(hTdCngEnc->burst_ho_cnt, 1); hTdCngEnc->burst_ho_cnt = s_min(hTdCngEnc->burst_ho_cnt, HO_HIST_SIZE); diff --git a/lib_enc/prot_fx_enc.h b/lib_enc/prot_fx_enc.h index 7b5d33540..28916532d 100644 --- a/lib_enc/prot_fx_enc.h +++ b/lib_enc/prot_fx_enc.h @@ -45,7 +45,7 @@ * Prototypes of RAM counting tool macros *----------------------------------------------------------------------------------*/ ivas_error acelp_core_enc_fx( - Encoder_State_fx *st_fx, /* i/o: encoder state structure */ + Encoder_State *st_fx, /* i/o: encoder state structure */ const Word16 inp_fx[], /* i : i signal of the current frame */ const Word32 ener_fx, /* i : residual energy from Levinson-Durbin*/ Word16 A_fx[NB_SUBFR16k*(M + 1)], /* i : A(z) unquantized for the 4 subframes*/ @@ -110,7 +110,7 @@ void AVQ_encmux_fx( ); void bw_detect_fx( - Encoder_State_fx* st, /* i/o: Encoder State */ + Encoder_State* st, /* i/o: Encoder State */ const Word16 signal_in[], /* i : i signal */ Word16* spectrum, /* i : MDCT spectrum */ const Word32* enerBuffer, /* i : CLDFB Energy Q31 */ @@ -120,7 +120,7 @@ void bw_detect_fx( ); void core_switching_post_enc_fx( /*done */ - Encoder_State_fx *st_fx, /* i/o: encoder state structure */ + Encoder_State *st_fx, /* i/o: encoder state structure */ const Word16 inp12k8[], /* i : i signal @12.8 kHz */ const Word16 inp16k[], /* i : i signal @16 kHz */ const Word16 A[], /* i : unquant. LP filter coefs. (Q12) */ @@ -131,7 +131,7 @@ void core_switching_post_enc_fx( /*done */ ); void core_switching_pre_enc_fx( - Encoder_State_fx* st_fx, /* i/o: encoder state structure */ + Encoder_State* st_fx, /* i/o: encoder state structure */ const Word16* old_inp_12k8, /* i : old i signal @12.8kHz */ const Word16* old_inp_16k, /* i : old i signal @16kHz */ const Word16 active_cnt, /* i : active frame counter */ @@ -143,7 +143,7 @@ Word16 correlation_shift_fx( /* o : noise dependent voicing correction Q15 ); void dtx_fx( - Encoder_State_fx *st_fx, /* i/o: encoder state structure */ + Encoder_State *st_fx, /* i/o: encoder state structure */ const Word16 vad, /* i : vad flag */ const Word16 speech[], /* i : Pointer to the speech frame */ Word16 Q_speech /* i : Q factor for speech */ @@ -151,7 +151,7 @@ void dtx_fx( ); Word16 dtx_hangover_addition_fx( - Encoder_State_fx* st_fx, /* i/o: encoder state structure */ + Encoder_State* st_fx, /* i/o: encoder state structure */ const Word16 vad_flag, /* i Q0 */ const Word16 lp_snr, /* i Q8 */ const Word16 cldfb_subtraction, /* i Q0 number of DTX-HO frames CLDFB wants to reduce */ @@ -161,7 +161,7 @@ Word16 dtx_hangover_addition_fx( ); void fb_tbe_enc_fx( - Encoder_State_fx *st, /* i/o: encoder state structure */ + Encoder_State *st, /* i/o: encoder state structure */ const Word16 new_input[], /* i : i speech at 48 kHz sample rate */ const Word16 fb_exc[], /* i : FB excitation from the SWB part */ Word16 Q_fb_exc @@ -197,7 +197,7 @@ void find_tilt_fx( ); Word16 find_uv_fx( /* o : coding type */ - Encoder_State_fx* st_fx, /* i/o: encoder state structure */ + Encoder_State* st_fx, /* i/o: encoder state structure */ const Word16* T_op_fr, /* i : pointer to adjusted fractional pitch (4 val.) Q6*/ const Word16* voicing_fr, /* i : refined correlation for each subframes Q15*/ const Word16* speech, /* i : pointer to speech signal for E computation Q_new*/ @@ -228,7 +228,7 @@ void fine_gain_quant_fx( ); void hq_core_enc_fx( - Encoder_State_fx* st_fx, + Encoder_State* st_fx, const Word16* audio, /* i : i audio signal Q0 */ const Word16 input_frame_orig, /* i : frame length */ const Word16 hq_core_type, /* i : HQ core type */ @@ -237,7 +237,7 @@ void hq_core_enc_fx( ); void long_enr_fx( - Encoder_State_fx *st_fx, /* i/o: state structure */ + Encoder_State *st_fx, /* i/o: state structure */ const Word16 Etot, /* i : total channel E (see lib_enc\analy_sp.c) */ const Word16 localVAD_HE_SAD, /* i : HE-SAD flag without hangover */ Word16 high_lpn_flag @@ -245,7 +245,7 @@ void long_enr_fx( Word16 mdct_classifier_fx( /* o: MDCT A/B decision */ const Word16 *Y, /* i: re[0], re[1], ..., re[n/2], im[n/2 - 1], im[n/2 - 2], ..., im[1] */ - Encoder_State_fx *st_fx, /* i/o: Encoder state variable */ + Encoder_State *st_fx, /* i/o: Encoder state variable */ Word32 *cldfbBuf_Ener, Word16 enerBuffer_exp, const Word32 brate /* i : current brate, IVAS: nominal bitrate, EVS: st->total_brate */ @@ -267,7 +267,7 @@ void noise_est_down_fx( ); void noise_est_fx( - Encoder_State_fx* st_fx, /* i/o: state structure */ + Encoder_State* st_fx, /* i/o: state structure */ const Word16 old_pitch1, /* i : previous frame OL pitch[1] */ const Word32 tmpN[], /* i : temporary noise update Q_new + QSCALE */ const Word16 epsP_h[], /* i : msb prediction error energies Q_r-1 */ @@ -399,7 +399,7 @@ void Scale_wsp( ); Word16 signal_clas_fx( /* o : classification for current frames */ - Encoder_State_fx* st, /* i/o: encoder state structure */ + Encoder_State* st, /* i/o: encoder state structure */ const Word16* speech, /* i : pointer to speech signal for E computation */ const Word32* ee, /* i : lf/hf E ration for 2 half-frames */ const Word16 relE, /* i : frame relative E to the long term average */ @@ -408,7 +408,7 @@ Word16 signal_clas_fx( /* o : classification for current frames ); void speech_music_classif_fx( - Encoder_State_fx* st, /* i/o: state structure */ + Encoder_State* st, /* i/o: state structure */ const Word16* new_inp, /* i : new input signal */ const Word16* inp, /* i : input signal to locate attach position */ const Word16 localVAD_HE_SAD, /* i : HE-SAD flag without hangover */ @@ -444,7 +444,7 @@ void StableHighPitchDetect_fx( ); void swb_bwe_enc_fx( - Encoder_State_fx *st_fx, /* i/o: encoder state structure */ + Encoder_State *st_fx, /* i/o: encoder state structure */ Word16 *old_input_12k8_fx, /* i : i signal @12.8kHz for SWB BWE */ Word16 *old_input_16k_fx, /* i : i signal @16kHz for SWB BWE */ const Word16 *old_syn_12k8_16k_fx, /* i : ACELP core synthesis at 12.8kHz or 16kHz */ @@ -456,13 +456,13 @@ void swb_bwe_enc_fx( ); void swb_CNG_enc_fx( - Encoder_State_fx *st_fx, /* i/o: State structure */ + Encoder_State *st_fx, /* i/o: State structure */ const Word16 *shb_speech_fx, /* i : SHB target signal (6-14kHz) at 16kHz */ const Word16 *syn_12k8_16k_fx /* i : ACELP core synthesis at 12.8kHz or 16kHz */ ); void swb_pre_proc_fx( - Encoder_State_fx *st_fx, /* i/o: encoder state structure */ + Encoder_State *st_fx, /* i/o: encoder state structure */ const Word16 *input_fx, /* i : original i signal */ Word16 *new_swb_speech_fx, /* o : original i signal at 32kHz */ Word16 *shb_speech_fx, /* o : SHB target signal (6-14kHz) at 16kHz */ @@ -473,7 +473,7 @@ void swb_pre_proc_fx( ); void swb_tbe_enc_fx( - Encoder_State_fx *st_fx, /* i/o: encoder state structure */ + Encoder_State *st_fx, /* i/o: encoder state structure */ const Word16 coder_type_fx, /* i : coding type */ Word16 *new_speech_fx, /* i : original i signal */ Word32 *bwe_exc_extended_fx, /* i : bandwidth extended excitation */ @@ -487,7 +487,7 @@ void swb_tbe_enc_fx( ); void tbe_write_bitstream_fx( - Encoder_State_fx *st_fx /* i/o: encoder state structure */ + Encoder_State *st_fx /* i/o: encoder state structure */ ); Word16 tfaEnc_TBE_fx( @@ -517,7 +517,7 @@ Word32 VAD_L_div(Word32 L_var1, ); void vad_param_updt_fx( - Encoder_State_fx* st_fx, /* i/o: state structure */ + Encoder_State* st_fx, /* i/o: state structure */ const Word16 old_pitch1, /* i : OL pitch value from last frame */ const Word16 corr_shift, /* i : correlation shift Q15*/ const Word16 corr_shiftR, /* i : correlation shift */ @@ -526,19 +526,19 @@ void vad_param_updt_fx( const Word16 n_channels /* i : number of channels */ ); void wb_bwe_enc_fx( - Encoder_State_fx *st_fx, /* i/o: encoder state structure */ + Encoder_State *st_fx, /* i/o: encoder state structure */ const Word16 *new_wb_speech_fx, /* i : original i signal at 16kHz */ Word16 coder_type /* i : coding type */ ); void wb_pre_proc_fx( - Encoder_State_fx *st_fx, /* i/o: encoder state structure */ + Encoder_State *st_fx, /* i/o: encoder state structure */ const Word16 *new_inp_resamp16k, /* i : original i signal */ Word16 *hb_speech /* o : HB target signal (6-8kHz) at 16kHz */ ); void wb_tbe_enc_fx( - Encoder_State_fx *st_fx, /* i/o: encoder state structure */ + Encoder_State *st_fx, /* i/o: encoder state structure */ const Word16 coder_type, /* i : coding type */ const Word16 *hb_speech, /* i : HB target signal (6-8kHz) at 16kHz */ const Word32 *bwe_exc_extended, /* i : bandwidth extended exciatation */ @@ -549,7 +549,7 @@ void wb_tbe_enc_fx( ); Word16 wb_vad_fx( - Encoder_State_fx* st_fx, /* i/o: encoder state structure */ + Encoder_State* st_fx, /* i/o: encoder state structure */ const Word32 fr_bands[], /* i : per band i energy (contains 2 vectors) Q_new+QSCALE*/ Word16* noisy_speech_HO, /* o : SC-VBR noisy speech HO flag */ Word16* clean_speech_HO, /* o : SC-VBR clean speech HO flag */ @@ -579,7 +579,7 @@ void sc_vbr_enc_init_fx( ); void updt_enc_common_fx( - Encoder_State_fx* st, /* i/o: encoder state structure */ + Encoder_State* st, /* i/o: encoder state structure */ const Word16 Etot, /* i : total energy */ const Word16 Q_new /* i : CUrrent frame scaling */ ); @@ -609,7 +609,7 @@ Word16 gain_quant_fx( /* o: quantization index */ Word16 *expg ); void gsc_enc_fx( - Encoder_State_fx* st_fx, /* i/o: State structure */ + Encoder_State* st_fx, /* i/o: State structure */ Word16 res_dct_in[], /* i : dct of residual signal */ Word16 exc_dct_in[], /* i/o: dct of pitch-only excitation / total excitation */ const Word16 Diff_len, @@ -626,7 +626,7 @@ void LPDmem_enc_init_fx( ); void lsf_end_enc_fx( - Encoder_State_fx* st, /* i/o: encoder state structure */ + Encoder_State* st, /* i/o: encoder state structure */ const Word16* lsf, /* i : LSF in the frequency domain (0..6400) */ Word16* qlsf, /* o : quantized LSF */ const Word16 nBits_in, /* i : number of bits to spend on ISF quantization */ @@ -723,7 +723,7 @@ void PsychAdaptLowFreqEmph_fx(Word32 x[], void set_bw_fx( const Word16 element_mode, /* i : element mode */ const Word32 element_brate, /* i : element bitrate */ - Encoder_State_fx* st, /* i/o: Encoder State */ + Encoder_State* st, /* i/o: Encoder State */ const Word16 codec_mode /* i : codec mode */ ); @@ -731,13 +731,13 @@ Word16 WB_BWE_encoding_fx( /* o : classification of wb signal * const Word16 coder_type, /* i : coder type */ const Word16 *yos_fx, /* i : MDCT coefficients of weighted original */ Word16 *WB_fenv_fx, /* i/o: energy of WB envelope */ - Encoder_State_fx *st_fx, /* i/o: Encoder structure */ + Encoder_State *st_fx, /* i/o: Encoder structure */ Word16 Q_synth, Word16 Q_synth_lf ); void calculate_hangover_attenuation_gain_fx( - Encoder_State_fx* st, /* i : encoder state structure */ + Encoder_State* st, /* i : encoder state structure */ Word16* att, /* o : attenuation factor */ const Word16 vad_hover_flag /* i : VAD hangover flag */ ); @@ -788,7 +788,7 @@ Word16 GetTCXMaxenergyChange_fx(struct TransientDetection const * pTransientDete * @param prevEnergyHF previous HF energy. Exponent must be the same as for currEnergyHF. * @param currEnergyHF current HF energy. Exponent must be the same as for prevEnergyHF. */ -void SetTCXModeInfo_fx(Encoder_State_fx *st, +void SetTCXModeInfo_fx(Encoder_State *st, struct TransientDetection const * pTransientDetection, Word16 * tcxModeOverlap); @@ -802,7 +802,7 @@ void td_cng_enc_init_fx( ); void dtx_enc_init_fx( - Encoder_State_fx* st, /* i : Encoder state handle */ + Encoder_State* st, /* i : Encoder state handle */ const Word16 var_SID_rate_flag, /* i : flag for variable SID update rate */ const Word16 interval_SID /* i : interval for SID update */ ); @@ -813,7 +813,7 @@ void select_TC_fx( const Word16 localVAD /* i : VAD without hangover */ ); void coder_type_modif_fx( - Encoder_State_fx* st, /* i/o: encoder state structure */ + Encoder_State* st, /* i/o: encoder state structure */ const Word16 relE /* i : frame relative E to the long term average */ ); @@ -843,7 +843,7 @@ void AVQ_cod_lpc_fx( ); void ProcessIGF_fx( IGF_ENC_INSTANCE_HANDLE const hInstance, /**< in: instance handle of IGF Encoder */ - Encoder_State_fx *st, /**< in: Encoder state */ + Encoder_State *st, /**< in: Encoder state */ Word32 pMDCTSpectrum[], /**< in: MDCT spectrum */ Word16 *pMDCTSpectrum_e, Word32 pPowerSpectrum[], /**< in: MDCT^2 + MDST^2 spectrum, or estimate */ @@ -854,7 +854,7 @@ void ProcessIGF_fx( Word16 frameno /**< in: flag indicating index of current subframe */ ); void AnalyzePowerSpectrum_fx( - Encoder_State_fx *st, /* i/o: encoder states */ + Encoder_State *st, /* i/o: encoder states */ Word16 L_frame, /* i : frame length */ Word16 L_frameTCX, /* i : full band frame length */ Word16 left_overlap, /* i : left overlap length */ @@ -935,7 +935,7 @@ void tcx_encoder_memory_update_fx( const Word16 *A, /* i: Quantized LPC coefficients */ Word16 preemph, /* i: preemphasis factor*/ LPD_state *LPDmem, /* i/o: coder memory state */ - Encoder_State_fx *st, + Encoder_State *st, Word16 *synthout, /* o: synthesis signal */ Word16 Q_new, Word16 shift @@ -989,7 +989,7 @@ void ComputeSpectrumNoiseMeasure_fx(const Word32 *powerSpec, Word16 lowpassLine); void lpc_quantization_fx( - Encoder_State_fx* st, + Encoder_State* st, const Word16 lsp[], const Word16 lspmid[], Word16 lsp_q[], @@ -1107,7 +1107,7 @@ Word16 EncodeTnsData_fx(STnsConfig const * pTnsConfig, Word16 WriteTnsData_fx(STnsConfig const * pTnsConfig, Word16 const * stream, Word16 * pnSize, - Encoder_State_fx *st, + Encoder_State *st, Word16 * pnBits); void subband_FFT_fx( @@ -1183,11 +1183,11 @@ Word16 ari_done_encoding_14bits_fx( ); void reset_rf_indices_fx( - Encoder_State_fx *st /* i: state structure - contains partial RF indices */ + Encoder_State *st /* i: state structure - contains partial RF indices */ ); void CNG_enc_fx( - Encoder_State_fx* st_fx,/* i/o: State structure */ + Encoder_State* st_fx,/* i/o: State structure */ Word16 Aq[], /* o : LP coefficients Q12 */ const Word16* speech, /* i : pointer to current frame i speech buffer Q_new */ Word32 L_enr, /* i : residual energy from Levinson-Durbin Q6 */ @@ -1201,13 +1201,13 @@ void CNG_enc_fx( ); /* Generate a bitstream out of the partition levels */ -void FdCng_encodeSID_fx(HANDLE_FD_CNG_ENC_FX st, /* i/o: FD_CNG structure containing all buffers and variables */ - Encoder_State_fx *corest, +void FdCng_encodeSID_fx(HANDLE_FD_CNG_ENC st, /* i/o: FD_CNG structure containing all buffers and variables */ + Encoder_State *corest, Word16 preemph_fac /* i : preemphase factor */ ); /* Generate the comfort noise based on the target noise level */ -void generate_comfort_noise_enc_fx(Encoder_State_fx *stcod, +void generate_comfort_noise_enc_fx(Encoder_State *stcod, Word16 Q_new, Word16 gen_exc ); @@ -1223,7 +1223,7 @@ Word16 cng_energy_fx( ); void CNG_reset_enc_fx( - Encoder_State_fx *st_fx, /* i/o: encoder state structure */ + Encoder_State *st_fx, /* i/o: encoder state structure */ LPD_state_HANDLE hLPDmemm, /* i/o: acelp memories */ Word16 *pitch_buf, /* o : floating pitch for each subframe */ Word16 *voice_factors /* o : voicing factors */ @@ -1231,7 +1231,7 @@ void CNG_reset_enc_fx( ); void lsf_enc_fx( - Encoder_State_fx* st_fx, /* i/o: state structure */ + Encoder_State* st_fx, /* i/o: state structure */ Word16* lsf_new, /* o : quantized LSF vector */ Word16* lsp_new, /* i/o: LSP vector to quantize/quantized */ Word16* lsp_mid, /* i/o : mid-frame LSP vector */ @@ -1257,7 +1257,7 @@ void Es_pred_enc_fx( ); void encod_nelp_fx( - Encoder_State_fx* st_fx, /* i/o: state structure */ + Encoder_State* st_fx, /* i/o: state structure */ const Word16* speech_fx, /* i : i speech */ const Word16 Aw_fx[], /* i : weighted A(z) unquantized for subframes */ const Word16 Aq_fx[], /* i : 12k8 Lp coefficient */ @@ -1275,7 +1275,7 @@ void encod_nelp_fx( ); Word16 encod_tran_fx( - Encoder_State_fx *st_fx, /* i/o: state structure */ + Encoder_State *st_fx, /* i/o: state structure */ const Word16 speech_fx[], /* i : i speech */ const Word16 Aw_fx[], /* i : weighted A(z) unquantized for subframes */ const Word16 Aq_fx[], /* i : 12k8 Lp coefficient */ @@ -1295,7 +1295,7 @@ Word16 encod_tran_fx( ); /* Delete the instance of type FD_CNG */ -void deleteFdCngEnc_fx(HANDLE_FD_CNG_ENC_FX * hFdCngEnc); +void deleteFdCngEnc_fx(HANDLE_FD_CNG_ENC * hFdCngEnc); void coder_acelp_rf_fx( ACELP_config *acelp_cfg_rf, /*i /o : configuration of the ACELP coding*/ @@ -1306,7 +1306,7 @@ void coder_acelp_rf_fx( const Word16 voicing[], /* i : open-loop LTP gain */ const Word16 T_op[], /* i : open-loop LTP lag */ Word16 stab_fac, - Encoder_State_fx *st, + Encoder_State *st, Word16 target_bits, /* i/o : coder memory state */ const Word16 rf_frame_type, /* i : rf_frame_type */ Word16 *exc_rf, /* i/o: pointer to RF excitation */ @@ -1315,12 +1315,12 @@ void coder_acelp_rf_fx( Word16 shift ); /* Create an instance of type FD_CNG */ -void createFdCngEnc_fx(HANDLE_FD_CNG_ENC_FX* hFdCngEnc); +void createFdCngEnc_fx(HANDLE_FD_CNG_ENC* hFdCngEnc); -void initFdCngEnc_fx(HANDLE_FD_CNG_ENC_FX hsEnc, Word32 input_Fs, Word16 scale); +void initFdCngEnc_fx(HANDLE_FD_CNG_ENC hsEnc, Word32 input_Fs, Word16 scale); /* Configure CLDFB-CNG */ -void configureFdCngEnc_fx(HANDLE_FD_CNG_ENC_FX hs, /* i/o: Contains the variables related to the CLDFB-based CNG process */ +void configureFdCngEnc_fx(HANDLE_FD_CNG_ENC hs, /* i/o: Contains the variables related to the CLDFB-based CNG process */ Word16 bandwidth, /* i: bandwidth */ Word32 bitrate); @@ -1330,7 +1330,7 @@ void perform_noise_estimation_enc_fx( Word16 exp_band_energies, Word32 *enerBuffer, Word16 enerBuffer_exp, - HANDLE_FD_CNG_ENC_FX st); /* i/o: FD_CNG structure containing all buffers and variables */ + HANDLE_FD_CNG_ENC st); /* i/o: FD_CNG structure containing all buffers and variables */ /* Adjust the noise estimator at the beginning of each CNG phase (encoder-side) */ Word16 @@ -1344,13 +1344,13 @@ AdjustFirstSID_fx(Word16 npart, Word32 *msNoiseEst_old, Word16 *msNoiseEst_old_exp, Word16 *active_frame_counter, - Encoder_State_fx *stcod + Encoder_State *stcod ); -void resetFdCngEnc_fx(Encoder_State_fx * st); +void resetFdCngEnc_fx(Encoder_State * st); void encod_unvoiced_fx( - Encoder_State_fx* st_fx, /* i/o: state structure */ + Encoder_State* st_fx, /* i/o: state structure */ const Word16* speech_fx, /* i : Input speech */ const Word16 Aw_fx[], /* i : weighted A(z) unquantized for subframes */ const Word16* Aq_fx, /* i : 12k8 Lp coefficient */ @@ -1369,7 +1369,7 @@ void encod_unvoiced_fx( void enc_acelp_tcx_main_fx( const Word16 new_samples[], /* i : new samples */ - Encoder_State_fx* st, /* i/o: encoder state structure */ + Encoder_State* st, /* i/o: encoder state structure */ Word16 Aw[NB_SUBFR16k * (M + 1)], /* i : weighted A(z) unquant. for subframes*/ const Word16 lsp_new[M], /* i : LSPs at the end of the frame */ const Word16 lsp_mid[M], /* i : LSPs at the middle of the frame */ @@ -1381,7 +1381,7 @@ void enc_acelp_tcx_main_fx( Word16* shift ); ivas_error encod_ppp_fx( - Encoder_State_fx* st_fx, /* i/o: state structure */ + Encoder_State* st_fx, /* i/o: state structure */ const Word16 speech_fx[], /* i : i speech Q_new*/ const Word16 Aw_fx[], /* i : weighted A(z) unquantized for subframes */ const Word16 Aq_fx[], /* i : 12k8 Lp coefficient */ @@ -1396,7 +1396,7 @@ ivas_error encod_ppp_fx( Word16 shift ); void encod_gen_voic_fx( - Encoder_State_fx* st_fx, /* i/o: state structure */ + Encoder_State* st_fx, /* i/o: state structure */ const Word16 speech_fx[], /* i : i speech */ const Word16 Aw_fx[], /* i : weighted A(z) unquantized for subframes */ const Word16 Aq_fx[], /* i : 12k8 Lp coefficient */ @@ -1416,7 +1416,7 @@ void encod_gen_voic_fx( ); void encod_audio_fx( - Encoder_State_fx* st_fx, /* i/o: State structure */ + Encoder_State* st_fx, /* i/o: State structure */ const Word16 speech[], /* i : i speech Q_new */ const Word16 Aw[], /* i : weighted A(z) unquantized for subframes */ const Word16 Aq[], /* i : 12k8 Lp coefficient */ @@ -1435,7 +1435,7 @@ void encod_audio_fx( Word16 shift ); void stat_noise_uv_enc_fx( - Encoder_State_fx* st_fx, /* i/o: state structure */ + Encoder_State* st_fx, /* i/o: state structure */ const Word32* LepsP, /* i : LP prediction errors */ const Word16* isp_new, /* i : immittance spectral pairs at 4th sfr */ const Word16* isp_mid, /* i : immittance spectral pairs at 2nd sfr */ @@ -1590,7 +1590,7 @@ void tcx_arith_encode_envelope_fx( Word16 signs[], /* o: signs (spectrum[.]<0) Q0 */ const Word16 L_frame, /* i: frame or MDCT length Q0 */ const Word16 L_spec, /* i: frame or MDCT length Q0 */ - Encoder_State_fx* st, /* i/o: coder state */ + Encoder_State* st, /* i/o: coder state */ const Word16 A_ind[], /* i: quantised LPC coefficients Q12 */ Word16 target_bits, /* i: number of available bits Q0 */ Word16 prm[], /* o: bitstream parameters Q0 */ @@ -1617,7 +1617,7 @@ void core_signal_analysis_high_bitrate_fx( const Word16 T_op[3], /* i : open-loop pitch values for quantiz. */ Word16 lsp_new[], Word16 lsp_mid[], - Encoder_State_fx* st, + Encoder_State* st, Word16 pTnsSize[], Word16 pTnsBits[], Word16 param_core[], @@ -1640,7 +1640,7 @@ void ShapeSpectrum_fx( Word16 L_spec, Word32 spectrum[], /* i/o: MDCT spectrum */ Word8 pfUseTns, /* o : Flag indicating if TNS is used */ - Encoder_State_fx *st + Encoder_State *st ); void QuantizeSpectrum_fx( @@ -1662,12 +1662,12 @@ void QuantizeSpectrum_fx( Word16 tnsSize, /* i : number of tns parameters put into prm */ Word16 prm[], /* o : tcx parameters */ Word16 frame_cnt, /* i : frame counter in the super_frame */ - Encoder_State_fx *st, + Encoder_State *st, CONTEXT_HM_CONFIG *hm_cfg ); void coder_tcx_post_fx( - Encoder_State_fx *st, + Encoder_State *st, LPD_state *LPDmem, TCX_CONFIG_HANDLE hTcxCfg, /* i : configuration of TCX */ Word16 *synth, @@ -1682,7 +1682,7 @@ void enc_prm_fx( const Word16 coder_type, /* (i) : coding type */ Word16 param[], /* (i) : parameters */ Word16 param_lpc[], /* (i) : LPC parameters */ - Encoder_State_fx *st, /* io: quantization Analysis values */ + Encoder_State *st, /* io: quantization Analysis values */ Word16 L_Frame, CONTEXT_HM_CONFIG hm_cfg[], Word16 * bits_param_lpc, @@ -1704,7 +1704,7 @@ void init_PLC_enc_fx( Word32 sampleRate ); void core_coder_reconfig_fx( - Encoder_State_fx* st, + Encoder_State* st, const Word32 last_total_brate ); @@ -1715,7 +1715,7 @@ Word16 coder_acelp_fx( /* o : SEGSNR for CL decision */ const Word16 speech[], /* i : speech[-M..lg] */ Word16* prm, /* o : acelp parameters */ Word16 stab_fac, - Encoder_State_fx* st, + Encoder_State* st, PLC_ENC_EVS_HANDLE hPlc_Ext, const Word16 target_bits, /* i/o: coder memory state */ const Word16 Q_new, @@ -1734,10 +1734,10 @@ Word16 encSideSpecPowDiffuseDetector_fx( , const Word16 coder_type ); -void updateSpecPowDiffuseIdx_fx(Encoder_State_fx *st); +void updateSpecPowDiffuseIdx_fx(Encoder_State *st); void encoderSideLossSimulation_fx( - Encoder_State_fx* st, + Encoder_State* st, PLC_ENC_EVS_HANDLE hPlc_Ext, Word16* lsf_q, /* Q1*1.28 */ const Word16 stab_fac, /* Q15 */ @@ -1761,7 +1761,7 @@ Word16 Q_lsf_tcxlpc_fx( ); Word16 signalling_mode1_tcx20_enc( - Encoder_State_fx *st, /* i : encoder state structure */ + Encoder_State *st, /* i : encoder state structure */ Word16 push ); @@ -1779,11 +1779,11 @@ void coder_tcx_fx( Word32 spectrum[], /* i/o: MDCT spectrum */ Word16 *spectrum_e, /* i/o: MDCT spectrum exponent */ Word16 prm[], /* o : tcx parameters */ - Encoder_State_fx *st, + Encoder_State *st, CONTEXT_HM_CONFIG *hm_cfg ); -void GplcTcxEncSetup_fx(Encoder_State_fx *st, +void GplcTcxEncSetup_fx(Encoder_State *st, PLC_ENC_EVS_HANDLE hPlc_Ext, Word16 Q_new); @@ -1836,14 +1836,14 @@ void tcx_ltp_encode_fx(Word16 tcxltp_on, ); void init_coder_ace_plus_fx( - Encoder_State_fx* st, + Encoder_State* st, const Word32 last_total_brate, /* i : last total bitrate */ const Word16 shift, const Word16 MCT_flag /* i : hMCT handle allocated (1) or not (0) */ ); void enc_prm_rf_fx( - Encoder_State_fx *st, + Encoder_State *st, const Word16 rf_frame_type, const Word16 fec_offset ); @@ -1883,7 +1883,7 @@ void gPLC_encInfo_fx( ); void core_encode_openloop_fx( - Encoder_State_fx *st, /* i/o: encoder state structure */ + Encoder_State *st, /* i/o: encoder state structure */ const Word16 coder_type, /* i : coding type */ const Word16 Aw[NB_SUBFR16k*(M + 1)], /* i : weighted A(z) unquant. for subframes*/ const Word16 *lsp_new, /* i : LSPs at the end of the frame */ @@ -1899,7 +1899,7 @@ void core_encode_openloop_fx( void core_encode_twodiv_fx( const Word16 new_samples[], /* i : new samples */ - Encoder_State_fx* st, /* i/o: coder memory state */ + Encoder_State* st, /* i/o: coder memory state */ const Word16 coder_type, /* i : coding type */ Word16 Aw[NB_SUBFR16k * (M + 1)], /* i : weighted A(z) unquant. for subframes*/ const Word16 vad_hover_flag, /* i : VAD hangover flag */ @@ -1907,9 +1907,9 @@ void core_encode_twodiv_fx( Word16* shift ); -void core_encode_update_fx(Encoder_State_fx *st); +void core_encode_update_fx(Encoder_State *st); -void core_encode_update_cng_fx(Encoder_State_fx *st, +void core_encode_update_cng_fx(Encoder_State *st, Word16 *timeDomainBuffer, Word16 *A, Word16 *Aw, @@ -1922,7 +1922,7 @@ Word16 EncodeIndex_fx( Word16 PeriodicityIndex, BSTR_ENC_HANDLE hBst /* i/o: bitstream handle */ ); -void enc_prm_side_Info_fx(PLC_ENC_EVS_HANDLE hPlc_Ext, Encoder_State_fx *st); +void enc_prm_side_Info_fx(PLC_ENC_EVS_HANDLE hPlc_Ext, Encoder_State *st); /* Returns: number of bits written */ Word16 enc_lsf_tcxlpc_fx( @@ -1978,7 +1978,7 @@ Word16 IGFEncWriteConcatenatedBitstream_fx( ); void signalling_enc_rf( - Encoder_State_fx *st /* i : encoder state structure */ + Encoder_State *st /* i : encoder state structure */ ); void IGFEncResetTCX10BitCounter_fx(const IGF_ENC_INSTANCE_HANDLE hInstance /**< in: | instance handle of IGF Encoder */ @@ -2007,7 +2007,7 @@ void HBAutocorrelation_fx( ); void core_coder_mode_switch_fx( - Encoder_State_fx* st, + Encoder_State* st, const Word32 last_total_bitrate, const Word16 is_mct, const Word16 shift @@ -2034,7 +2034,7 @@ void qlpc_avq_fx( /* IGFEnc.c */ void IGFEncApplyMono_fx(const IGF_ENC_INSTANCE_HANDLE hInstance, /**< in: | instance handle of IGF Encoder */ const Word16 igfGridIdx, /**< in: Q0 | IGF grid index */ - Encoder_State_fx *st, /**< in: | Encoder state */ + Encoder_State *st, /**< in: | Encoder state */ Word32 *pMDCTSpectrum, /**< in: Q31 | MDCT spectrum */ Word16 MDCTSpectrum_e, /**< in: | exponent of MDCT spectrum */ Word32 *pPowerSpectrum, /**< in: Q31 | MDCT^2 + MDST^2 spectrum, or estimate */ @@ -2164,7 +2164,7 @@ void spec_flatness_fx(Word32 *spec_amp, /*(i) spectral amplitude*/ ); void SetModeIndex_fx( - Encoder_State_fx* st, + Encoder_State* st, Word32 last_total_brate, const Word16 last_element_mode, const Word16 is_mct, @@ -2172,7 +2172,7 @@ void SetModeIndex_fx( ); void MDCT_selector_fx( - Encoder_State_fx* st, /* i/o: Encoder State */ + Encoder_State* st, /* i/o: Encoder State */ Word16 sp_floor, /* i : Noise floor estimate Q7 */ const Word16 Etot, /* i : Total energy Q8 */ const Word16 cor_map_sum, /* i : harmonicity factor Q8 */ @@ -2265,7 +2265,7 @@ Word16 E_GAIN_closed_loop_search_fx(Word16 exc[], Word16 i_subfr, Word16 pit_min, Word16 pit_fr2, Word16 pit_fr1, Word16 L_subfr); void core_acelp_tcx20_switching_fx( - Encoder_State_fx *st, /* i/o: encoder state structure */ + Encoder_State *st, /* i/o: encoder state structure */ Word16 non_staX, Word16 *pitch_fr, /* i/o: fraction pitch values */ Word16 *voicing_fr, /* i/o: fractional voicing values */ @@ -2318,7 +2318,7 @@ void FEC_encode_fx( ); void updt_enc_fx( - Encoder_State_fx* st, /* i/o: state structure */ + Encoder_State* st, /* i/o: state structure */ const Word16* old_exc, /* i : buffer of excitation */ const Word16* pitch_buf, /* i : floating pitch for each subframe */ const Word16 Es_pred, /* i : predicited scaled innovation energy */ @@ -2329,7 +2329,7 @@ void updt_enc_fx( ); void dtx_hangover_control_fx( - Encoder_State_fx *st_fx, /* i/o: encoder state structure */ + Encoder_State *st_fx, /* i/o: encoder state structure */ const Word16 lsp_new_fx[M] /* i : current frame LSPs */ ); @@ -2377,7 +2377,7 @@ Word16 lp_filt_exc_enc_fx( ); Word16 inov_encode_fx( - Encoder_State_fx* st_fx, /* i/o: encoder state structure */ + Encoder_State* st_fx, /* i/o: encoder state structure */ const Word32 core_brate, /* i : core bitrate */ const Word16 Opt_AMR_WB, /* i : flag indicating AMR-WB IO mode */ const Word16 L_frame, /* i : length of the frame */ @@ -2423,7 +2423,7 @@ void gain_enc_mless_fx( const Word16 clip_gain /* i : gain pitch clipping flag (1 = clipping) */ ); void updt_IO_switch_enc_fx( - Encoder_State_fx *st, /* i/o: state structure */ + Encoder_State *st, /* i/o: state structure */ const Word16 input_frame /* i : i frame length */ ); @@ -2451,7 +2451,7 @@ void analy_lp_AMR_WB_fx( ); void encod_amr_wb_fx( - Encoder_State_fx* st, /* i/o: state structure */ + Encoder_State* st, /* i/o: state structure */ const Word16 speech[], /* i : i speech */ const Word16 Aw[], /* i : weighted A(z) unquantized for subframes */ const Word16 Aq[], /* i : 12k8 Lp coefficient */ @@ -2474,12 +2474,12 @@ void re8_cod_fx( ); void TBEreset_enc_fx( - Encoder_State_fx *st_fx, /* i/o: encoder state structure */ + Encoder_State *st_fx, /* i/o: encoder state structure */ Word16 bandwidth /* i : bandwidth mode */ ); void acelp_core_switch_enc_fx( - Encoder_State_fx* st_fx, /* i/o: encoder state structure */ + Encoder_State* st_fx, /* i/o: encoder state structure */ const Word16 inp12k8[], /* i : i signal @12.8 kHz Q0 */ const Word16 inp16k[], /* i : i signal @16 kHz Q0 */ const Word16 A[NB_SUBFR16k * (M + 1)], /* i : A(z) unquantized for the 4 subframes Q12*/ @@ -2524,7 +2524,7 @@ void hf_cod_fx( ); void transf_cdbk_enc_fx( - Encoder_State_fx* st_fx, /* i/o: encoder state structure */ + Encoder_State* st_fx, /* i/o: encoder state structure */ const Word16 harm_flag_acelp,/* i : harmonic flag for higher rates ACELP */ const Word16 i_subfr, /* i : subframe index */ Word16 cn[], /* i/o: target vector in residual domain */ @@ -2631,11 +2631,11 @@ ivas_error ppp_voiced_encoder_fx( ); void signalling_enc_fx( - Encoder_State_fx *st_fx /* i : encoder state structure */ + Encoder_State *st_fx /* i : encoder state structure */ ); void transition_enc_fx( - Encoder_State_fx *st_fx, /* i/o: encoder state structure */ + Encoder_State *st_fx, /* i/o: encoder state structure */ const Word16 i_subfr, /* i : subframe index */ Word16 *tc_subfr, /* i/o: TC subframe index */ Word16 *Jopt_flag, /* i : joint optimization flag */ @@ -2662,7 +2662,7 @@ void transition_enc_fx( ); void transf_cdbk_enc_fx( - Encoder_State_fx* st_fx, /* i/o: encoder state structure */ + Encoder_State* st_fx, /* i/o: encoder state structure */ const Word16 harm_flag_acelp,/* i : harmonic flag for higher rates ACELP */ const Word16 i_subfr, /* i : subframe index */ Word16 cn[], /* i/o: target vector in residual domain */ @@ -2701,7 +2701,7 @@ void gain_enc_tc_fx( ); Word16 gaus_encode_fx( - Encoder_State_fx* st_fx, /* i/o: encoder state structure */ + Encoder_State* st_fx, /* i/o: encoder state structure */ const Word16 i_subfr, /* i : subframe index */ const Word16* h1, /* i : weighted filter i response */ const Word16* xn, /* i : target vector */ @@ -2720,7 +2720,7 @@ Word16 gaus_encode_fx( Word32* norm_gain_code /* o : normalized innovative cb. gain Q16 */ ); void pre_proc_fx( - Encoder_State_fx *st, /* i/o: encoder state structure */ + Encoder_State *st, /* i/o: encoder state structure */ const Word16 input_frame, /* i : frame length */ Word16 old_inp_12k8[], /* i/o: buffer of old i signal */ Word16 old_inp_16k[], /* i/o: buffer of old i signal @ 16kHz */ @@ -2754,7 +2754,7 @@ void pre_proc_fx( ); void swb_bwe_enc_hr_fx( - Encoder_State_fx* st_fx, /* i/o: encoder state structure */ + Encoder_State* st_fx, /* i/o: encoder state structure */ Word16* new_input_fx, /* i : i signal */ Word16 new_input_fx_exp, /* i : Exponent of i signal */ const Word16 input_frame, /* i : frame length */ @@ -2769,7 +2769,7 @@ Word16 gain_enc_gaus_fx( /* o : Return index of quantization const Word16 inv_stepSize /* i : Step size choice Q15 */ ); void enc_pit_exc_fx( - Encoder_State_fx* st_fx, /* i/o: State structure */ + Encoder_State* st_fx, /* i/o: State structure */ const Word16* speech, /* i : Input speech */ const Word16 Aw[], /* i : weighted A(z) unquantized for subframes */ const Word16 Aq[], /* i : 12k8 Lp coefficient */ @@ -2789,7 +2789,7 @@ void enc_pit_exc_fx( Word16 shift ); Word16 Pit_exc_contribution_len_fx( /* o : bin where pitch contribution is significant */ - Encoder_State_fx *st_fx, /* i/o: state structure */ + Encoder_State *st_fx, /* i/o: state structure */ const Word16 *dct_res, /* i : DCT of residual */ Word16 *dct_pitex, /* i/o: DCT of pitch contribution */ Word16 *pitch_buf, /* i/o: Pitch per subframe */ @@ -2816,7 +2816,7 @@ Word16 pvq_core_enc_fx( ); void core_switching_hq_prepare_enc_fx( - Encoder_State_fx *st_fx, /* i/o: encoder state structure */ + Encoder_State *st_fx, /* i/o: encoder state structure */ Word16 *num_bits, /* i/o: bit budget update */ const Word16 input_frame, /* i : frame length */ Word32 *wtda_audio, /* shall be q_audio + 15, audio allready scalled in wtda function */ @@ -2824,7 +2824,7 @@ void core_switching_hq_prepare_enc_fx( ); void hq_lr_enc_fx( - Encoder_State_fx *st_fx, /* i/o: : encoder state structure */ + Encoder_State *st_fx, /* i/o: : encoder state structure */ Word32 L_t_audio[], /* i/o: Q12 : transform-domain coefs. */ const Word16 inner_frame_fx, /* i : Q0 : inner frame length */ Word16 *num_bits_fx, /* i/o: Q0 : number of available bits */ @@ -2832,7 +2832,7 @@ void hq_lr_enc_fx( ); void hq_hr_enc_fx( - Encoder_State_fx* st_fx, /* i/o: encoder state structure fx */ + Encoder_State* st_fx, /* i/o: encoder state structure fx */ Word32* t_audio, /* i/o: transform-domain coefficients Q12 */ const Word16 length, /* i : length of spectrum Q0 */ Word16* num_bits, /* i : number of available bits Q0 */ @@ -2855,7 +2855,7 @@ void diffcod_fx( ); Word16 hq_classifier_enc_fx( /* o : Consumed bits Q0 */ - Encoder_State_fx *st_fx, /* i/o: encoder state structure */ + Encoder_State *st_fx, /* i/o: encoder state structure */ const Word16 length, /* i : Frame length Q0 */ const Word32 *coefs, /* i : Spectral coefficients Q12 */ const Word16 is_transient, /* i : Transient flag Q0 */ @@ -2891,7 +2891,7 @@ void hq_generic_encoding_fx( const Word32 *coefs_fx, /* i : MDCT coefficients of weighted original */ Word16 *hq_generic_fenv_fx, /* i/o: energy of SWB envelope */ const Word16 hq_generic_offset, /* i : frequency offset for extracting energy */ - Encoder_State_fx *st_fx, /* i/o: encoder state structure */ + Encoder_State *st_fx, /* i/o: encoder state structure */ Word16 *hq_generic_exc_clas /* o : bwe excitation class */ ); @@ -2905,7 +2905,7 @@ void normalizecoefs_fx( ); Word16 hvq_enc_fx( /* o : Consumed bits */ - Encoder_State_fx *st_fx, /* i/o: encoder state structure */ + Encoder_State *st_fx, /* i/o: encoder state structure */ const Word32 brate, /* i : Total bit rate */ const Word16 hvq_bits, /* i : HVQ bit budget */ const Word16 Npeaks, /* i : Number of peaks */ @@ -3006,11 +3006,11 @@ void noise_est_init_fx( ); void InitSWBencBuffer_fx( - Encoder_State_fx* st_fx /* i/o: SHB encoder structure */ + Encoder_State* st_fx /* i/o: SHB encoder structure */ ); void ResetSHBbuffer_Enc_fx( - Encoder_State_fx* st_fx /* i/o: SHB encoder structure */ + Encoder_State* st_fx /* i/o: SHB encoder structure */ ); Word16 E_ACELP_hh_corr(Word16 *x, Word16 *y, Word16 L_subfr, Word16 bits); @@ -3046,7 +3046,7 @@ Word16 acelp_4t64_fx( ); ivas_error evs_enc_fx( - Encoder_State_fx* st, /* i/o: encoder state structure */ + Encoder_State* st, /* i/o: encoder state structure */ const Word16* data, /* i : i signal */ Word32* mem_hp20_in_fx, /* i/o: hp20 filter memory */ const Word16 n_samples /* i : number of i samples */ @@ -3059,7 +3059,7 @@ Word16 noise_est_AR1_Qx( /* o: Qx y(n) */ Word16 alpha /*i : Q15 scaling of driving x(n) */ ); void FEC_lsf_estim_enc_fx( - Encoder_State_fx *st_fx, /* i : Encoder static memory */ + Encoder_State *st_fx, /* i : Encoder static memory */ Word16 *lsf /* o : estimated LSF vector */ ); @@ -3145,7 +3145,7 @@ Word16 Interpol_4( /* o : interpolated value */ ); void set_ppp_mode_fx( - Encoder_State_fx* st_fx, /* i/o: state structure */ + Encoder_State* st_fx, /* i/o: state structure */ const Word16 noisy_speech_HO, /* i : SC-VBR noisy speech HO flag */ const Word16 clean_speech_HO, /* i : SC-VBR clean speech HO flag */ const Word16 NB_speech_HO, /* i : SC-VBR NB speech HO flag */ @@ -3153,7 +3153,7 @@ void set_ppp_mode_fx( ); void decision_matrix_enc_fx( - Encoder_State_fx *st_fx, /* i : encoder state structure */ + Encoder_State *st_fx, /* i : encoder state structure */ Word16 *hq_core_type /* o : HQ core_fx type */ ); @@ -3265,21 +3265,21 @@ void index_lvq_fx( ); ivas_error init_encoder_fx( - Encoder_State_fx *st_fx /* i/o: Encoder static variables structure */ + Encoder_State *st_fx /* i/o: Encoder static variables structure */ ); void copy_encoder_config_fx( Encoder_Struct *st_ivas, /* i : IVAS encoder structure */ - Encoder_State_fx *st, /* o : encoder state structure */ + Encoder_State *st, /* o : encoder state structure */ const int16_t flag_all /* i : flag 1==update all, 0=partial update*/ ); void destroy_encoder_fx( - Encoder_State_fx *st_fx /* i/o: Encoder static variables structure */ + Encoder_State *st_fx /* i/o: Encoder static variables structure */ ); void amr_wb_enc_fx( - Encoder_State_fx *st, /* i/o: encoder state structure */ + Encoder_State *st, /* i/o: encoder state structure */ const Word16 input_sp[], /* i : i signal */ const Word16 n_samples /* i : number of i samples */ ); diff --git a/lib_enc/qlpc_stoch_fx.c b/lib_enc/qlpc_stoch_fx.c index 1392b6938..32244b2b7 100644 --- a/lib_enc/qlpc_stoch_fx.c +++ b/lib_enc/qlpc_stoch_fx.c @@ -30,7 +30,7 @@ * *--------------------------------------------------------------------*/ void lpc_quantization_fx( - Encoder_State_fx * st, + Encoder_State * st, const Word16 lsp[], const Word16 lspmid[], Word16 lsp_q[], @@ -72,17 +72,17 @@ void lpc_quantization_fx( /* check resonance for pitch clipping algorithm */ gp_clip_test_lsf_fx(st->element_mode, lsf, clip_var, M ); - IF ( (EQ_16(st->core_fx, TCX_10_CORE))) + IF ( (EQ_16(st->core, TCX_10_CORE))) { E_LPC_lsp_lsf_conversion(lspmid, lsfmid, M); } /* LPC quantizer */ - qlpc_avq_fx(lsf, lsfmid, lsf_q, lsfmid_q, param_lpc, &nb_indices, nbits_lpc, st->core_fx, st->sr_core); + qlpc_avq_fx(lsf, lsfmid, lsf_q, lsfmid_q, param_lpc, &nb_indices, nbits_lpc, st->core, st->sr_core); E_LPC_lsf_lsp_conversion(lsf_q, lsp_q, M); - IF( EQ_16(st->core_fx, TCX_10_CORE)) + IF( EQ_16(st->core, TCX_10_CORE)) { E_LPC_lsf_lsp_conversion( lsfmid_q, lspmid_q, M ); } @@ -105,7 +105,7 @@ void lpc_quantization_fx( /*Force safety net when possible in case of transitions*/ test(); test(); - IF( st->tc_cnt_fx >= 1 || LE_32(st->last_core_brate_fx,SID_2k40) || (EQ_16(st->next_force_safety_net_fx,1))) + IF( st->tc_cnt >= 1 || LE_32(st->last_core_brate,SID_2k40) || (EQ_16(st->next_force_safety_net_fx,1))) { force_sf = 1; move16(); @@ -140,7 +140,7 @@ void lpc_quantization_fx( FEC_lsf_estim_enc_fx( st, fec_lsf ); /* FEC - calculate LSF stability */ - stab = lsf_stab_fx( lsf_q, fec_lsf, 0, st->L_frame_fx); /*Q15*/ + stab = lsf_stab_fx( lsf_q, fec_lsf, 0, st->L_frame); /*Q15*/ test(); diff --git a/lib_enc/rst_enc_fx.c b/lib_enc/rst_enc_fx.c index 94703a086..62da4c54a 100644 --- a/lib_enc/rst_enc_fx.c +++ b/lib_enc/rst_enc_fx.c @@ -19,7 +19,7 @@ *-------------------------------------------------------------------*/ void CNG_reset_enc_fx( - Encoder_State_fx *st_fx, /* i/o: encoder state structure */ + Encoder_State *st_fx, /* i/o: encoder state structure */ LPD_state_HANDLE hLPDmem, /* i/o: acelp memories */ Word16 *pitch_buf, /* o : floating pitch for each subframe */ Word16 *voice_factors, /* o : voicing factors */ @@ -48,11 +48,11 @@ void CNG_reset_enc_fx( move16(); /* last good received frame for FEC in ACELP */ - st_fx->clas_fx = UNVOICED_CLAS; + st_fx->clas = UNVOICED_CLAS; move16(); /* reset the pitch buffer in case of FRAME_NO_DATA or SID frames */ - IF( EQ_16(st_fx->L_frame_fx,L_FRAME)) + IF( EQ_16(st_fx->L_frame,L_FRAME)) { set16_fx( pitch_buf, L_SUBFR, NB_SUBFR ); } @@ -64,7 +64,7 @@ void CNG_reset_enc_fx( set16_fx( voice_factors, 1, NB_SUBFR16k ); /* deactivate bass post-filter */ - st_fx->bpf_off_fx = 1; + st_fx->bpf_off = 1; move16(); /* Reset active frame counter */ diff --git a/lib_enc/setmodeindex_fx.c b/lib_enc/setmodeindex_fx.c index b8b900bdc..48925697b 100644 --- a/lib_enc/setmodeindex_fx.c +++ b/lib_enc/setmodeindex_fx.c @@ -23,36 +23,36 @@ ---------------------------------------------------------------------------*/ void SetModeIndex_fx( - Encoder_State_fx *st, + Encoder_State *st, Word32 last_total_brate, const Word16 last_element_mode, const Word16 is_mct, const Word16 shift ) { - Word16 ini_frame_loc = st->ini_frame_fx; + Word16 ini_frame_loc = st->ini_frame; test();test(); if (EQ_16(st->element_mode, IVAS_CPE_MDCT) && EQ_16(last_element_mode, IVAS_CPE_MDCT) && EQ_16(st->idchan, 1)) { - st->ini_frame_fx = 0; + st->ini_frame = 0; move16(); } /* Reconfigure the core coder */ test();test();test(); IF( - (NE_32(last_total_brate,st->total_brate_fx) ) || - (NE_16(st->last_bwidth_fx,st->bwidth_fx) ) || + (NE_32(last_total_brate,st->total_brate) ) || + (NE_16(st->last_bwidth,st->bwidth) ) || (EQ_16(st->last_codec_mode,MODE1) && EQ_16(st->element_mode, EVS_MONO) ) || - ( (NE_16(st->last_core_fx, TCX_20_CORE) && NE_16(st->last_core_fx, TCX_10_CORE)) && GT_16(st->element_mode, EVS_MONO)) || + ( (NE_16(st->last_core, TCX_20_CORE) && NE_16(st->last_core, TCX_10_CORE)) && GT_16(st->element_mode, EVS_MONO)) || (NE_16(st->rf_mode_last,st->rf_mode) ) || - (GT_16(st->element_mode, EVS_MONO) && st->ini_frame_fx == 0) + (GT_16(st->element_mode, EVS_MONO) && st->ini_frame == 0) ) { core_coder_mode_switch_fx( st, last_total_brate, is_mct, shift); } - st->ini_frame_fx = ini_frame_loc; + st->ini_frame = ini_frame_loc; return; } diff --git a/lib_enc/sig_clas_fx.c b/lib_enc/sig_clas_fx.c index fe9626b8d..95ea8bbc5 100644 --- a/lib_enc/sig_clas_fx.c +++ b/lib_enc/sig_clas_fx.c @@ -44,7 +44,7 @@ *-------------------------------------------------------------------*/ Word16 signal_clas_fx( /* o : classification for current frames */ - Encoder_State_fx* st, /* i/o: encoder state structure */ + Encoder_State* st, /* i/o: encoder state structure */ const Word16* speech, /* i : pointer to speech signal for E computation */ const Word32* ee, /* i : lf/hf E ration for 2 half-frames */ const Word16 relE, /* i : frame relative E to the long term average */ @@ -180,7 +180,7 @@ Word16 signal_clas_fx( /* o : classification for current frames } ELSE { - SWITCH(st->last_clas_fx) + SWITCH(st->last_clas) { case VOICED_CLAS: case ONSET: @@ -261,8 +261,8 @@ Word16 signal_clas_fx( /* o : classification for current frames test(); test(); if (((EQ_16(*coder_type, UNVOICED)) || - (NE_16(st->input_bwidth_fx, NB) && LT_16(fmerit1, 13435) && GT_16(st->mold_corr_fx, 21299)) || /* WB case */ - (EQ_16(st->input_bwidth_fx, NB) && LT_16(mult_r(fmerit1, 28836), 13435) && GT_16(st->mold_corr_fx, 18022))) && /* NB case */ + (NE_16(st->input_bwidth, NB) && LT_16(fmerit1, 13435) && GT_16(st->mold_corr_fx, 21299)) || /* WB case */ + (EQ_16(st->input_bwidth, NB) && LT_16(mult_r(fmerit1, 28836), 13435) && GT_16(st->mold_corr_fx, 18022))) && /* NB case */ GT_16(relE, -3840) && LT_16(st->lt_dec_thres_fx, 768)) /* to compute unvoiced on frame that tends to speech */ { *uc_clas = UNVOICED_CLAS; @@ -278,20 +278,20 @@ Word16 signal_clas_fx( /* o : classification for current frames if (EQ_16(clas, UNVOICED_CLAS)) { - st->tc_cnt_fx = 0; + st->tc_cnt = 0; move16(); } test(); - if (GE_16(clas, VOICED_TRANSITION) && st->tc_cnt_fx >= 0) + if (GE_16(clas, VOICED_TRANSITION) && st->tc_cnt >= 0) { - st->tc_cnt_fx = add(st->tc_cnt_fx, 1); + st->tc_cnt = add(st->tc_cnt, 1); move16(); } - if (GT_16(st->tc_cnt_fx, 2)) + if (GT_16(st->tc_cnt, 2)) { - st->tc_cnt_fx = -1; + st->tc_cnt = -1; move16(); } return clas; @@ -344,7 +344,7 @@ void select_TC_fx( *-------------------------------------------------------------------*/ void coder_type_modif_fx( - Encoder_State_fx* st, /* i/o: encoder state structure */ + Encoder_State* st, /* i/o: encoder state structure */ const Word16 relE /* i : frame relative E to the long term average */ ) { @@ -353,7 +353,7 @@ void coder_type_modif_fx( SC_VBR_ENC_HANDLE hSC_VBR = st->hSC_VBR; - IF (st->Opt_SC_VBR_fx) + IF (st->Opt_SC_VBR) { vbr_generic_ho = hSC_VBR->vbr_generic_ho; move16(); @@ -376,8 +376,8 @@ void coder_type_modif_fx( /* At higher rates, use GC coding instead of UC coding to improve quality */ test(); - if( (EQ_16(st->element_mode, EVS_MONO) && GT_32(st->total_brate_fx,ACELP_9k60) && EQ_16(st->coder_type,UNVOICED)) || - (GT_16(st->element_mode, EVS_MONO) && GT_32(st->total_brate_fx, MAX_UNVOICED_BRATE) && EQ_16(st->coder_type, UNVOICED)) ) + if( (EQ_16(st->element_mode, EVS_MONO) && GT_32(st->total_brate,ACELP_9k60) && EQ_16(st->coder_type,UNVOICED)) || + (GT_16(st->element_mode, EVS_MONO) && GT_32(st->total_brate, MAX_UNVOICED_BRATE) && EQ_16(st->coder_type, UNVOICED)) ) { st->coder_type = GENERIC; move16(); @@ -386,7 +386,7 @@ void coder_type_modif_fx( /* Prevent UC coding on mixed content at 9.6 kb/s */ test(); test(); - if( GE_32(st->total_brate_fx,ACELP_9k60) && EQ_16(st->coder_type,UNVOICED) && st->audio_frame_cnt_fx!=0) + if( GE_32(st->total_brate,ACELP_9k60) && EQ_16(st->coder_type,UNVOICED) && st->audio_frame_cnt!=0) { st->coder_type = GENERIC; move16(); @@ -401,7 +401,7 @@ void coder_type_modif_fx( if( st->localVAD == 0 && ( ( EQ_16(st->coder_type,UNVOICED) - && ( ( st->Opt_SC_VBR_fx == 0) || ( ( EQ_16(st->Opt_SC_VBR_fx, 1) ) && vbr_generic_ho == 0 && GT_16(st->last_coder_type_fx,UNVOICED) )) ) + && ( ( st->Opt_SC_VBR == 0) || ( ( EQ_16(st->Opt_SC_VBR, 1) ) && vbr_generic_ho == 0 && GT_16(st->last_coder_type,UNVOICED) )) ) || EQ_16(st->coder_type,TRANSITION) || EQ_16(st->coder_type,VOICED) ) ) @@ -412,7 +412,7 @@ void coder_type_modif_fx( test(); test(); - IF(EQ_16(st->Opt_SC_VBR_fx, 1)) + IF(EQ_16(st->Opt_SC_VBR, 1)) { if (EQ_16(st->coder_type, GENERIC) && EQ_16(unmod_coder_type, UNVOICED) ) { @@ -442,7 +442,7 @@ void coder_type_modif_fx( { /* At higher rates and with 16kHz core, allow only GC and TC coder type */ test(); test(); test(); - if (GT_32(st->total_brate_fx, ACELP_16k40) && NE_16(st->coder_type, GENERIC) && NE_16(st->coder_type, TRANSITION)) + if (GT_32(st->total_brate, ACELP_16k40) && NE_16(st->coder_type, GENERIC) && NE_16(st->coder_type, TRANSITION)) { /* onset/transition frame is always coded using GC mode */ st->coder_type = GENERIC; @@ -452,8 +452,8 @@ void coder_type_modif_fx( ELSE /*IVAS*/ { /* At higher bitrates, disable UC and VC coder type; note that IC coder type is classified later */ - if ((GT_32(st->total_brate_fx, MAX_VOICED_BRATE) && EQ_16(st->coder_type, VOICED)) || - (GT_32(st->total_brate_fx, MAX_UNVOICED_BRATE) && EQ_16(st->coder_type, UNVOICED))) + if ((GT_32(st->total_brate, MAX_VOICED_BRATE) && EQ_16(st->coder_type, VOICED)) || + (GT_32(st->total_brate, MAX_UNVOICED_BRATE) && EQ_16(st->coder_type, UNVOICED))) { st->coder_type = GENERIC; move16(); @@ -463,7 +463,7 @@ void coder_type_modif_fx( /* Patch for certain low-level signals for which the gain quantizer sometimes goes out of its dynamic range */ test();test();test(); - if( EQ_16(st->coder_type,VOICED) && EQ_16(st->input_bwidth_fx,NB) && LT_16(relE,-2560) && LE_32(st->total_brate_fx,ACELP_8k00)) + if( EQ_16(st->coder_type,VOICED) && EQ_16(st->input_bwidth,NB) && LT_16(relE,-2560) && LE_32(st->total_brate,ACELP_8k00)) { st->coder_type = GENERIC; move16(); diff --git a/lib_enc/speech_music_classif_fx.c b/lib_enc/speech_music_classif_fx.c index 57145de95..edbfea956 100644 --- a/lib_enc/speech_music_classif_fx.c +++ b/lib_enc/speech_music_classif_fx.c @@ -29,17 +29,17 @@ * Local functions *---------------------------------------------------------------------*/ -static Word16 sp_mus_classif_gmm_fx( Encoder_State_fx *st_fx, const Word16 localVAD_HE_SAD, const Word16 lsp_new[M], const Word16 cor_map_sum, const Word32 epsP[M+1], const Word32 PS[], +static Word16 sp_mus_classif_gmm_fx( Encoder_State *st_fx, const Word16 localVAD_HE_SAD, const Word16 lsp_new[M], const Word16 cor_map_sum, const Word32 epsP[M+1], const Word32 PS[], Word16 non_sta, Word16 relE, Word16 *voi_fv, Word16 *cor_map_sum_fv, Word16 *LPCErr, Word16 Q_esp , Word16 *high_lpn_flag_ptr); -static void sp_mus_classif_2nd_fx(Encoder_State_fx* st, const Word16 Etot, Word16* attack_flag, const Word16* inp, const Word16 Qx); +static void sp_mus_classif_2nd_fx(Encoder_State* st, const Word16 Etot, Word16* attack_flag, const Word16* inp, const Word16 Qx); -static void music_mixed_classif_improv_fx( Encoder_State_fx *st, const Word16 *new_inp, const Word32 *epsP, Word16 Q_epsP, Word16 etot, Word16 old_cor,Word16 cor_map_sum ); +static void music_mixed_classif_improv_fx( Encoder_State *st, const Word16 *new_inp, const Word32 *epsP, Word16 Q_epsP, Word16 etot, Word16 old_cor,Word16 cor_map_sum ); -static void tonal_context_improv_fx( Encoder_State_fx *st_fx, const Word32 PS[], const Word16 voi_fv, const Word16 cor_map_sum_fv, const Word16 LPCErr, const Word16 Qx ); +static void tonal_context_improv_fx( Encoder_State *st_fx, const Word32 PS[], const Word16 voi_fv, const Word16 cor_map_sum_fv, const Word16 LPCErr, const Word16 Qx ); static void var_cor_calc_fx( const Word16 old_corr, Word16 *mold_corr, Word16 var_cor_t[], Word16 *high_stable_cor ); @@ -52,7 +52,7 @@ static Word16 attack_det_fx(const Word16* inp, const Word16 Qx, const Word16 las static void order_spectrum_fx( Word16 *vec, Word16 len ); -static void detect_sparseness_fx( Encoder_State_fx *st_fx, const Word16 localVAD_HE_SAD, const Word16 voi_fv ); +static void detect_sparseness_fx( Encoder_State *st_fx, const Word16 localVAD_HE_SAD, const Word16 voi_fv ); /*---------------------------------------------------------------------* * speech_music_clas_init_fx() * @@ -257,7 +257,7 @@ void speech_music_clas_init_fx( *---------------------------------------------------------------------*/ void speech_music_classif_fx( - Encoder_State_fx *st, /* i/o: state structure */ + Encoder_State *st, /* i/o: state structure */ const Word16 *new_inp, /* i : new input signal */ const Word16 *inp, /* i : input signal to locate attach position */ const Word16 localVAD_HE_SAD, /* i : HE-SAD flag without hangover */ @@ -290,7 +290,7 @@ void speech_music_classif_fx( /* Improvement of the 1st stage decision on mixed/music content */ test(); - IF ( st->Opt_SC_VBR_fx == 0 && NE_32(st->total_brate_fx, ACELP_24k40)) + IF ( st->Opt_SC_VBR == 0 && NE_32(st->total_brate, ACELP_24k40)) { music_mixed_classif_improv_fx( st, new_inp, epsP, Q_esp, Etot, old_cor, cor_map_sum ); } @@ -302,7 +302,7 @@ void speech_music_classif_fx( st->sp_aud_decision2 = st->sp_aud_decision1; move16(); - IF ( GT_16(st->bwidth_fx,NB)) + IF ( GT_16(st->bwidth,NB)) { sp_mus_classif_2nd_fx( st, Etot, attack_flag, inp, Q_inp-1); @@ -310,7 +310,7 @@ void speech_music_classif_fx( and/or stable pitch with high correlation at low bitrates*/ test(); test(); - IF ( flag_spitch && EQ_16(st->bwidth_fx,WB) && LT_32(st->total_brate_fx,ACELP_13k20)) + IF ( flag_spitch && EQ_16(st->bwidth,WB) && LT_32(st->total_brate,ACELP_13k20)) { st->sp_aud_decision2 = 0; move16(); @@ -321,7 +321,7 @@ void speech_music_classif_fx( /* Context-based improvement of 1st and 2nd stage decision on stable tonal signals */ test(); - IF ( st->Opt_SC_VBR_fx == 0 && NE_32(st->total_brate_fx, ACELP_24k40)) + IF ( st->Opt_SC_VBR == 0 && NE_32(st->total_brate, ACELP_24k40)) { tonal_context_improv_fx( st, PS, voi_fv, cor_map_sum_fv, LPCErr, Q_inp + QSCALE -2 ); } @@ -331,8 +331,8 @@ void speech_music_classif_fx( test(); test(); test(); - IF ( !st->Opt_SC_VBR_fx && EQ_32(st->total_brate_fx, ACELP_13k20) && EQ_16(st->vad_flag,1)&& - ( EQ_16(st->bwidth_fx, WB) || EQ_16(st->bwidth_fx, SWB)) ) + IF ( !st->Opt_SC_VBR && EQ_32(st->total_brate, ACELP_13k20) && EQ_16(st->vad_flag,1)&& + ( EQ_16(st->bwidth, WB) || EQ_16(st->bwidth, SWB)) ) { detect_sparseness_fx( st, localVAD_HE_SAD, voi_fv ); } @@ -349,22 +349,22 @@ void speech_music_classif_fx( /* select GSC on SWB noisy speech (only on active unvoiced SWB noisy speech segments) */ - st->GSC_noisy_speech_fx = 0; + st->GSC_noisy_speech = 0; move16(); test();test();test();test();test();test(); - IF ( EQ_16(st->vad_flag,1)&&GE_32(st->total_brate_fx,ACELP_13k20)&<_32(st->total_brate_fx,ACELP_24k40)&& - GT_16(st->lp_noise_fx,3072) && st->sp_aud_decision1 == 0 && GE_16(st->bwidth_fx,SWB) && - EQ_16(st->coder_type_raw_fx,UNVOICED)) + IF ( EQ_16(st->vad_flag,1)&&GE_32(st->total_brate,ACELP_13k20)&<_32(st->total_brate,ACELP_24k40)&& + GT_16(st->lp_noise_fx,3072) && st->sp_aud_decision1 == 0 && GE_16(st->bwidth,SWB) && + EQ_16(st->coder_type_raw,UNVOICED)) { - st->GSC_noisy_speech_fx = 1; + st->GSC_noisy_speech = 1; move16(); } /* Select AUDIO frames */ test();test(); test();test(); - IF ( EQ_16(st->codec_mode,MODE1) && (st->sp_aud_decision2 || st->GSC_noisy_speech_fx)) + IF ( EQ_16(st->codec_mode,MODE1) && (st->sp_aud_decision2 || st->GSC_noisy_speech)) { st->coder_type = AUDIO; move16(); @@ -389,7 +389,7 @@ void speech_music_classif_fx( *---------------------------------------------------------------------*/ static Word16 sp_mus_classif_gmm_fx( /* o : decision flag (1-music, 0-speech or noise) */ - Encoder_State_fx *st_fx, /* i/o: state structure */ + Encoder_State *st_fx, /* i/o: state structure */ const Word16 localVAD_HE_SAD, /* i : local VAD HE flag */ const Word16 lsp_new[M], /* i : LSPs in current frame Q15 */ const Word16 cor_map_sum, /* i : correlation map sum (from multi-harmonic anal.)Q8 */ @@ -454,7 +454,7 @@ static Word16 sp_mus_classif_gmm_fx( /* o : decision flag (1-music, 0-speech L_tmp = L_mac(L_tmp, st_fx->pitch_fx[2], 10923); test(); - IF ( EQ_16(st_fx->tc_cnt_fx,1)||EQ_16(st_fx->tc_cnt_fx,2)) + IF ( EQ_16(st_fx->tc_cnt,1)||EQ_16(st_fx->tc_cnt,2)) { *pFV++ = st_fx->pitch_fx[2]; move16(); @@ -467,7 +467,7 @@ static Word16 sp_mus_classif_gmm_fx( /* o : decision flag (1-music, 0-speech /* [1] voicing Q15 */ /*(float)(voicing[0] + voicing[1] + voicing[2]) / 3.0f*/ test(); - IF ( EQ_16(st_fx->tc_cnt_fx,1)||EQ_16(st_fx->tc_cnt_fx,2)) + IF ( EQ_16(st_fx->tc_cnt,1)||EQ_16(st_fx->tc_cnt,2)) { *pFV++ = st_fx->voicing_fx[2]; move16(); @@ -509,7 +509,7 @@ static Word16 sp_mus_classif_gmm_fx( /* o : decision flag (1-music, 0-speech move16(); /* [9] epsP Q10 */ - IF ( EQ_16(st_fx->bwidth_fx,NB)) + IF ( EQ_16(st_fx->bwidth,NB)) { *pFV++ = -1687; move16(); /*Q10*/ @@ -700,7 +700,7 @@ static Word16 sp_mus_classif_gmm_fx( /* o : decision flag (1-music, 0-speech pFV = FV; move16(); - IF ( EQ_16(st_fx->bwidth_fx,NB)) + IF ( EQ_16(st_fx->bwidth,NB)) { pSF_m = SF_8k_mult_fx; pSF_a = SF_8k_add_fx; @@ -1103,7 +1103,7 @@ static Word16 sp_mus_classif_gmm_fx( /* o : decision flag (1-music, 0-speech *---------------------------------------------------------------------*/ static void sp_mus_classif_2nd_fx( - Encoder_State_fx *st, /* i/o: Encoder state structure */ + Encoder_State *st, /* i/o: Encoder state structure */ const Word16 Etot, /* i : total frame energy */ Word16 *attack_flag, /* i/o: attack flag (GSC or TC) */ const Word16 *inp, /* i : input signal */ @@ -1125,9 +1125,9 @@ static void sp_mus_classif_2nd_fx( var_cor_calc_fx( st->old_corr_fx, &hSpMusClas->mold_corr_fx, hSpMusClas->var_cor_t_fx, &hSpMusClas->high_stable_cor ); /* attack detection */ - attack = attack_det_fx( inp, Qx, st->clas_fx, st->localVAD, st->coder_type, st->total_brate_fx + attack = attack_det_fx( inp, Qx, st->clas, st->localVAD, st->coder_type, st->total_brate #ifdef IVAS_CODE - , EVS_MONO, st->clas_fx, hSpMusClas->finc_prev, &hSpMusClas->lt_finc, &hSpMusClas->last_strong_attack + , EVS_MONO, st->clas, hSpMusClas->finc_prev, &hSpMusClas->lt_finc, &hSpMusClas->last_strong_attack #endif ); @@ -1164,7 +1164,7 @@ static void sp_mus_classif_2nd_fx( ELSE IF( GT_16(hSpMusClas->gsc_lt_diff_etot_fx[MAX_LT-1],1152) && GT_16(sub(hSpMusClas->gsc_lt_diff_etot_fx[MAX_LT-1], hSpMusClas->gsc_lt_diff_etot_fx[MAX_LT-2]),2560)) /* 10.0f in Q8 */ { - IF ( EQ_16(st->tc_cnt_fx,1)) + IF ( EQ_16(st->tc_cnt,1)) { st->sp_aud_decision2 = 0; move16(); @@ -1203,8 +1203,8 @@ static void sp_mus_classif_2nd_fx( } } ELSE IF( EQ_16(st->localVAD,1)&&EQ_16(st->coder_type,GENERIC)&& - ( (GE_16(attack,ATT_3LSUB_POS) && LT_32(st->total_brate_fx,ACELP_24k40)) || - (GE_16(attack,ATT_3LSUB_POS_16k) && GE_32(st->total_brate_fx,ACELP_24k40) && LT_32(st->total_brate_fx,ACELP_48k)) ) + ( (GE_16(attack,ATT_3LSUB_POS) && LT_32(st->total_brate,ACELP_24k40)) || + (GE_16(attack,ATT_3LSUB_POS_16k) && GE_32(st->total_brate,ACELP_24k40) && LT_32(st->total_brate,ACELP_48k)) ) ) { /* do TC coding if attack is located in the last subframe */ @@ -2382,7 +2382,7 @@ void ivas_smc_mode_selection( *---------------------------------------------------------------------*/ static Word16 mode_decision_fx( - Encoder_State_fx *st, /* i : endoer state structure */ + Encoder_State *st, /* i : endoer state structure */ Word16 len, /* i : buffering status */ Word16 *dec_mov, /* i/o: moving average of classifier decision Q15*/ Word16 *buf_flux, /* i : buffer storing spectral energy fluctuation Q7*/ @@ -2943,7 +2943,7 @@ static void spec_analysis_fx( } static void music_mixed_classif_improv_fx( - Encoder_State_fx *st, /* i : encoder state structure */ + Encoder_State *st, /* i : encoder state structure */ const Word16 *new_inp, /* i : new input signal */ const Word32 *epsP, /* i : LP prediciton error Q_epsP*/ Word16 Q_epsP, @@ -3264,7 +3264,7 @@ static void music_mixed_classif_improv_fx( test(); test(); test(); - IF ( (EQ_16(st->coder_type_raw_fx,UNVOICED)||EQ_16(st->coder_type_raw_fx,INACTIVE))&& + IF ( (EQ_16(st->coder_type_raw,UNVOICED)||EQ_16(st->coder_type_raw,INACTIVE))&& GT_16(etot,384) && LT_16(hSpMusClas->buf_Ntonal2_fx[59],2) ) { hSpMusClas->UV_cnt1 = sub(hSpMusClas->UV_cnt1,8); @@ -3308,7 +3308,7 @@ static void music_mixed_classif_improv_fx( *----------------------------------------------------------------------------------*/ static void tonal_context_improv_fx( - Encoder_State_fx *st_fx, /* i/o: Encoder state structure */ + Encoder_State *st_fx, /* i/o: Encoder state structure */ const Word32 PS[], /* i : energy spectrum */ const Word16 voi_fv, /* i : scaled voicing feature */ const Word16 cor_map_sum_fv, /* i : scaled correlation map feature */ @@ -3653,7 +3653,7 @@ static void tonal_context_improv_fx( * *----------------------------------------------------------------------------------*/ static void detect_sparseness_fx( - Encoder_State_fx *st_fx, /* i/o: encoder state structure */ + Encoder_State *st_fx, /* i/o: encoder state structure */ const Word16 localVAD_HE_SAD, /* i : HE-SAD flag without hangover */ const Word16 voi_fv /* i : scaled voicing feature */ ) @@ -3728,7 +3728,7 @@ static void detect_sparseness_fx( hSpMusClas->sparse_buf_fx[i] = sparse; move16(); - IF (EQ_16(st_fx->bwidth_fx, WB)) + IF (EQ_16(st_fx->bwidth, WB)) { Msp = 0; move16(); @@ -3896,7 +3896,7 @@ static void detect_sparseness_fx( { tmp = 91; move16(); - if (EQ_16(st_fx->bwidth_fx, WB)) + if (EQ_16(st_fx->bwidth, WB)) { tmp = 90; } @@ -3940,7 +3940,7 @@ static void detect_sparseness_fx( } } - IF (EQ_16(st_fx->bwidth_fx, WB)) + IF (EQ_16(st_fx->bwidth, WB)) { test();test();test();test();test();test();test();test();test(); IF (GT_16(hSpMusClas->LT_sparse_fx, 15360) && GT_16(sparse,50) && LT_16(Mlpe,-1331) && GT_16(Mv,27853) && diff --git a/lib_enc/stat_enc.h b/lib_enc/stat_enc.h index 1dfe1cbe7..67531bda9 100644 --- a/lib_enc/stat_enc.h +++ b/lib_enc/stat_enc.h @@ -476,8 +476,23 @@ typedef struct fd_cng_enc_structure float msCurrentMinOut[NPART]; float msCurrentMin[NPART]; float msCurrentMinSubWindow[NPART]; + + Word32 msPeriodog_fx[NPART]; /* Periodogram */ + Word16 msPeriodog_fx_exp; /* Common exponent for fft and cldfb energies */ + Word16 msPeriodog_fx_exp_fft; + Word16 msPeriodog_fx_exp_cldfb; + Word32 msBminWin_fx[NPART]; + Word32 msBminSubWin_fx[NPART]; + Word16 msPsd_fx[NPART]; /* Power Spectral Density estimate (i.e., smoothed periodogram) */ + Word32 msAlpha_fx[NPART]; /* Optimal smoothing parameter */ + Word32 msMinBuf_fx[MSNUMSUBFR*NPART]; /* Buffer of minima */ + Word32 msCurrentMinOut_fx[NPART]; + Word32 msCurrentMin_fx[NPART]; + Word32 msCurrentMinSubWindow_fx[NPART]; + int16_t msLocalMinFlag[NPART]; int16_t msNewMinFlag[NPART]; + float msPsdFirstMoment[NPART]; float msPsdSecondMoment[NPART]; float msNoiseFloor[NPART]; /* Estimated noise floor */ @@ -487,7 +502,18 @@ typedef struct fd_cng_enc_structure float msLogPeriodog[NPART]; /* Periodogram */ float msLogNoiseEst[NPART]; /* Estimated noise level */ + Word16 msPsdFirstMoment_fx[NPART]; + Word32 msPsdSecondMoment_fx[NPART]; + Word16 msNoiseFloor_fx[NPART]; /* Estimated noise floor */ + Word32 msNoiseEst_fx[NPART]; /* Estimated noise level */ + Word16 msNoiseEst_fx_exp; + Word32 energy_ho_fx[NPART]; + Word16 energy_ho_fx_exp; + Word32 msNoiseEst_old_fx[NPART]; + Word16 msNoiseEst_old_fx_exp; + float msPeriodogBuf[MSBUFLEN * NPART]; + Word16 msPeriodogBuf_fx[MSBUFLEN*NPART]; int16_t msPeriodogBufPtr; int16_t stopFFTbinDec; @@ -498,53 +524,56 @@ typedef struct fd_cng_enc_structure int16_t nFFTpartDec; int16_t partDec[NPART]; + Word16 msLogPeriodog_fx[NPART]; + Word16 msLogNoiseEst_fx[NPART]; + float mem_coherence[4]; } FD_CNG_ENC, *HANDLE_FD_CNG_ENC; -typedef struct -{ - HANDLE_FD_CNG_COM hFdCngCom; - - Word32 msPeriodog[NPART]; /* Periodogram */ - Word16 msPeriodog_exp; /* Common exponent for fft and cldfb energies */ - Word16 msPeriodog_exp_fft; - Word16 msPeriodog_exp_cldfb; - Word32 msBminWin[NPART]; - Word32 msBminSubWin[NPART]; - Word16 msPsd[NPART]; /* Power Spectral Density estimate (i.e., smoothed periodogram) */ - Word32 msAlpha[NPART]; /* Optimal smoothing parameter */ - Word32 msMinBuf[MSNUMSUBFR*NPART]; /* Buffer of minima */ - Word32 msCurrentMinOut[NPART]; - Word32 msCurrentMin[NPART]; - Word32 msCurrentMinSubWindow[NPART]; - Word16 msLocalMinFlag[NPART]; - Word16 msNewMinFlag[NPART]; - Word16 msPsdFirstMoment[NPART]; - Word32 msPsdSecondMoment[NPART]; - Word16 msNoiseFloor[NPART]; /* Estimated noise floor */ - Word32 msNoiseEst[NPART]; /* Estimated noise level */ - Word16 msNoiseEst_exp; - Word32 energy_ho[NPART]; - Word16 energy_ho_exp; - Word32 msNoiseEst_old[NPART]; - Word16 msNoiseEst_old_exp; - - Word16 msPeriodogBuf[MSBUFLEN*NPART]; - Word16 msPeriodogBufPtr; - - Word16 stopFFTbinDec; - Word16 startBandDec; - Word16 stopBandDec; - Word16 npartDec; - Word16 midbandDec[NPART]; - Word16 nFFTpartDec; - Word16 partDec[NPART]; - - Word16 msLogPeriodog[NPART]; - Word16 msLogNoiseEst[NPART]; -} -FD_CNG_ENC_FX; -typedef FD_CNG_ENC_FX *HANDLE_FD_CNG_ENC_FX; +//typedef struct +//{ +// HANDLE_FD_CNG_COM hFdCngCom; +// +// Word32 msPeriodog[NPART]; /* Periodogram */ +// Word16 msPeriodog_exp; /* Common exponent for fft and cldfb energies */ +// Word16 msPeriodog_exp_fft; +// Word16 msPeriodog_exp_cldfb; +// Word32 msBminWin[NPART]; +// Word32 msBminSubWin[NPART]; +// Word16 msPsd[NPART]; /* Power Spectral Density estimate (i.e., smoothed periodogram) */ +// Word32 msAlpha[NPART]; /* Optimal smoothing parameter */ +// Word32 msMinBuf[MSNUMSUBFR*NPART]; /* Buffer of minima */ +// Word32 msCurrentMinOut[NPART]; +// Word32 msCurrentMin[NPART]; +// Word32 msCurrentMinSubWindow[NPART]; +// Word16 msLocalMinFlag[NPART]; +// Word16 msNewMinFlag[NPART]; +// Word16 msPsdFirstMoment[NPART]; +// Word32 msPsdSecondMoment[NPART]; +// Word16 msNoiseFloor[NPART]; /* Estimated noise floor */ +// Word32 msNoiseEst[NPART]; /* Estimated noise level */ +// Word16 msNoiseEst_exp; +// Word32 energy_ho[NPART]; +// Word16 energy_ho_exp; +// Word32 msNoiseEst_old[NPART]; +// Word16 msNoiseEst_old_exp; +// +// Word16 msPeriodogBuf[MSBUFLEN*NPART]; +// Word16 msPeriodogBufPtr; +// +// Word16 stopFFTbinDec; +// Word16 startBandDec; +// Word16 stopBandDec; +// Word16 npartDec; +// Word16 midbandDec[NPART]; +// Word16 nFFTpartDec; +// Word16 partDec[NPART]; +// +// Word16 msLogPeriodog[NPART]; +// Word16 msLogNoiseEst[NPART]; +//} +//FD_CNG_ENC_FX; +//typedef FD_CNG_ENC_FX *HANDLE_FD_CNG_ENC_FX; /*------------------------------------------------------------------------------------------* * Structure for DTX-related variables used in both FD- and TD-CNG *------------------------------------------------------------------------------------------*/ @@ -1574,6 +1603,16 @@ typedef struct tcx_enc_structure } TCX_ENC_DATA, *TCX_ENC_HANDLE; +typedef struct TransientDetection +{ + /** Transient detector. */ + TransientDetector transientDetector; + /** Delay buffer used by the transient detectors. */ + DelayBuffer delayBuffer; + /** Subblock energies used by the transient detector. */ + SubblockEnergies subblockEnergies; +} TransientDetection; + /*----------------------------------------------------------------------------------* * * Main Core encoder structure @@ -1589,6 +1628,7 @@ typedef struct enc_core_structure int16_t idchan; /* channel ID (audio channel number) */ Word16 id_element; /* element ID */ int16_t element_mode; /* element mode */ + Word16 last_element_mode; /* element mode */ int32_t element_brate; /* element bitrate */ Word16 extl_orig; /* extension layer */ Word32 extl_brate_orig; /* extension layer bitrate */ @@ -1603,6 +1643,7 @@ typedef struct enc_core_structure BSTR_ENC_HANDLE hBstr; /* encoder bitstream handle */ Word16 last_enerBuffer_exp; int16_t bitstreamformat; /* Bitstream format flag (G.192/MIME) */ + Word16 next_bit_pos_fx; /* position of the next bit to be written in the bitstream */ int32_t input_Fs; /* input signal sampling frequency in Hz */ int32_t total_brate; /* total bitrate in kbps of the codec */ @@ -1644,7 +1685,7 @@ typedef struct enc_core_structure //Word16 core_fx; /* core (ACELP_CORE, TCX_20_CORE, TCX_10_CORE, HQ_CORE, AMR_WB_CORE) */ //Word32 core_brate_fx; /* core bitrate */ //Word32 last_core_brate_fx; /* previous frame core bitrate */ - //Word16 input_frame_fx; /* Frame lenght (function of input_Fs) */ + Word16 input_frame_fx; /* Frame lenght (function of input_Fs) */ //Word16 extl_fx; /* extension layer */ //Word16 last_extl_fx; /* previous extension layer */ //Word32 extl_brate_fx; /* extension layer bitrate */ @@ -1658,7 +1699,7 @@ typedef struct enc_core_structure //Word16 Opt_AMR_WB; /* flag indicating AMR-WB IO mode */ //Word16 Opt_DTX_ON_fx; /* flag indicating DTX operation */ //Word16 cng_type; /* flag indicating LP or CLDFB based SID/CNG */ - //Word16 active_fr_cnt_fx; /* counter of active frames */ + Word16 active_fr_cnt_fx; /* counter of active frames */ //Word16 Opt_SC_VBR_fx; /* flag indicating SC-VBR mode */ //Word16 last_Opt_SC_VBR_fx; /* flag indicating SC-VBR mode in the last frame */ @@ -1783,6 +1824,9 @@ typedef struct enc_core_structure float old_Es_pred; /* old Es_pred for core switching */ Word16 old_Aq_12_8_fx[M + 1]; /* Q12 old Aq[] for core switching */ Word16 old_Es_pred_fx; /* Q8 old Es_pred for core switching */ + Word16 music_hysteresis_fx; /* Counter of frames after AUDIO coding mode to prevent UC */ + Word16 last_vad_spa_fx; + int16_t last_L_frame; /* ACELP@16kHz - last L_frame value */ float mem_preemph16k; /* ACELP@16kHz - preemphasis filter memory @16kHz */ @@ -1816,6 +1860,7 @@ typedef struct enc_core_structure Word16 finalVAD; int16_t flag_noisy_speech_snr; /* encoder detector for noisy speech */ + Word8 flag_noisy_speech_snr_fx; /*encoder detector for noisy speech*/ int16_t Pos_relE_cnt; /* Number of frames between relE */ int16_t tdm_pc; /* pitch stability - used in TD stereo */ @@ -1828,6 +1873,11 @@ typedef struct enc_core_structure float *input; float *old_input_signal; + Word16* input_buff_fx; + Word16 * input_fx; + Word16 * old_input_signal_fx; + Word16 Q_old_wtda; + SIGNAL_BUFFERS_ENC_HANDLE hSignalBuf; float *Bin_E_old; /* per bin energy of old 2nd frames */ @@ -1862,6 +1912,8 @@ typedef struct enc_core_structure SP_MUS_CLAS_HANDLE hSpMusClas; + Word16 lgBin_E_fx[L_FFT / 2]; /* Q8 per bin energy of two frames */ + int16_t sp_aud_decision0; /* 1st stage speech/music decision flag */ int16_t sp_aud_decision1; /* 1st stage speech/music classification flag */ int16_t sp_aud_decision2; /* 2nd stage speech/music classification flag */ @@ -1873,6 +1925,8 @@ typedef struct enc_core_structure VAD_HANDLE hVAD; VAD_CLDFB_HANDLE hVAD_CLDFB; + VAD_CLDFB_HANDLE_FX hVAD_CLDFB_fx; + T_CldfbVadState_fx vad_st; int16_t vad_flag; /* i : VAD flag */ int16_t sharpFlag; @@ -2058,7 +2112,7 @@ typedef struct enc_core_structure Word16 inv_gamma; TRAN_DET_HANDLE hTranDet; - //TransientDetection transientDetection; + TransientDetection transientDetection; Word16 transient_info[3]; int16_t acelpFramesCount; float prevTempFlatness; @@ -2109,6 +2163,15 @@ typedef struct enc_core_structure Word16 bpf_T[NB_SUBFR16k]; Word16 bpf_gainT[NB_SUBFR16k]; + struct MEM_BPF + { + Word16 noise_buf[2 * L_FILT16k]; + Word16 error_buf[L_FILT16k]; + Word32 lp_error; + Word32 lp_error_ener; + Word16 noise_shift_old; + } mem_bpf_fx; + int16_t glr; int16_t glr_idx[2]; float mean_gc_flt[2]; @@ -2120,6 +2183,8 @@ typedef struct enc_core_structure float last_stab_fac_flt; Word16 last_stab_fac; + Word32 gain_code[NB_SUBFR16k]; + /*for rate switching*/ int16_t rate_switching_reset; /*Rate switching flag requiring a reset of memories at least partially */ int16_t rate_switching_reset_16kHz; @@ -2172,6 +2237,8 @@ typedef struct enc_core_structure * Fixed point only variables *----------------------------------------------------------------------------------*/ + Word16 last_ener_fx; /* AC mode (GSC) - previous energy */ + Word16 prev_Q_bwe_exc; Word16 prev_Q_bwe_syn; Word16 Q_stat_noise_ge; @@ -2186,6 +2253,7 @@ typedef struct enc_core_structure Word16 old_wsp_shift; /* Last wsp scaling */ Word16 prev_Q_new; Word16 prev_Q_shb; + Word16 Q_max_enc[2]; Word16 EnergyLT_fx_exp; Word16 prev_lsp_wb_fx[LPC_SHB_ORDER_WB]; @@ -2196,542 +2264,532 @@ typedef struct enc_core_structure } Encoder_State, *ENC_CORE_HANDLE; -typedef struct TransientDetection -{ - /** Transient detector. */ - TransientDetector transientDetector; - /** Delay buffer used by the transient detectors. */ - DelayBuffer delayBuffer; - /** Subblock energies used by the transient detector. */ - SubblockEnergies subblockEnergies; -} TransientDetection; - -typedef struct Encoder_State_fx -{ - - /*----------------------------------------------------------------------------------* - * Common parameters - *----------------------------------------------------------------------------------*/ - /*----------------------------------------------------------------------------------* - * Stereo/IVAS parameters - *----------------------------------------------------------------------------------*/ - Word16 flag_ACELP16k; /* flag indicating use of ACELP core at 16kHz internal sampling rate */ - - Word16 tdm_LRTD_flag; /* LRTD stereo mode flag */ - Word16 cna_dirac_flag; /* CNA in DirAC flag */ - Word16 cng_sba_flag; /* CNG in SBA flag */ - Word16 idchan; /* channel ID (audio channel number) */ - Word16 element_mode; /* element mode */ - Word16 last_element_mode; /* element mode */ - Word16 low_rate_mode; /* low-rate mode flag */ - MCT_CHAN_MODE mct_chan_mode; - Word16 GSC_IVAS_mode; - Word16 is_ism_format; /* Indication whether the codec operates in ISM format */ - Word16 dtx_sce_sba; /* enable use of FD CNG with transform domain cores in SCE SBA */ - - - //#ifdef IVAS_CODE - -#ifdef DEBUGGING - Word16 id_element; /* element ID */ -#endif - Word32 element_brate; /* element bitrate */ - Word16 extl_orig; /* extension layer */ - Word32 extl_brate_orig; /* extension layer bitrate */ - /*----------------------- End of IVAS specific--------------------------------------*/ - - - Word16 codec_mode; /* MODE1 or MODE2 */ - Word16 last_codec_mode; /* Previous Codec Mode*/ - Word16 last_codec_mode_cng; /* Codec Mode of the last inactive frame*/ - Word16 mdct_sw_enable; /* MDCT switching enable flag */ - Word16 mdct_sw; /* MDCT switching indicator */ - Word16 last_enerBuffer_exp; - Word16 next_bit_pos_fx; /* position of the next bit to be written in the bitstream */ - Word16 bitstreamformat; /* Bitstream format flag (G.192/MIME) */ - - BSTR_ENC_HANDLE hBstr; /* encoder bitstream handle */ - - - LPD_state_HANDLE hLPDmem; /* ACELP LPDmem memories */ - - - Word32 input_Fs_fx; /* input signal sampling frequency in Hz */ - Word32 total_brate_fx; /* total bitrate in kbps of the codec */ - Word32 last_total_brate_fx; /* total bitrate in kbps of the codec */ - Word32 last_total_brate_cng_fx; /* total bitrate in kbps of the last inactive frame */ - Word16 core_fx; /* core (ACELP_CORE, TCX_20_CORE, TCX_10_CORE, HQ_CORE, AMR_WB_CORE) */ - Word32 core_brate_fx; /* core bitrate */ - Word32 last_core_brate_fx; /* previous frame core bitrate */ - Word16 input_frame_fx; /* Frame lenght (function of input_Fs) */ - Word16 extl_fx; /* extension layer */ - Word16 last_extl_fx; /* previous extension layer */ - Word32 extl_brate_fx; /* extension layer bitrate */ - Word16 input_bwidth_fx; /* input signal bandwidth */ - Word16 last_input_bwidth_fx; /* input signal bandwidth in the previous frame */ - Word16 bwidth_fx; /* encoded bandwidth NB, WB, SWB or FB */ - Word16 max_bwidth_fx; /* maximum encoded bandwidth */ - Word16 last_bwidth_fx; /* input signal bandwidth in the previous frame */ - Word16 last_bwidth_cng_fx; /* input signal bandwidth in the previous inactive frame */ - Word16 L_frame_fx; /* ACELP core internal frame length */ - Word16 Opt_AMR_WB_fx; /* flag indicating AMR-WB IO mode */ - Word16 Opt_DTX_ON_fx; /* flag indicating DTX operation */ - Word16 cng_type_fx; /* flag indicating LP or CLDFB based SID/CNG */ - Word16 active_fr_cnt_fx; /* counter of active frames */ - Word16 Opt_SC_VBR_fx; /* flag indicating SC-VBR mode */ - Word16 last_Opt_SC_VBR_fx; /* flag indicating SC-VBR mode in the last frame */ - /*----------------------------------------------------------------------------------* - * ACELP core parameters - *----------------------------------------------------------------------------------*/ - - Word16 clas_fx; /* current frame clas */ - Word16 last_clas_fx; /* previous frame signal classification */ - Word32 Bin_E_fx[L_FFT]; /* Q_new + Q_SCALE -2 per bin energy of two frames */ - - /*----------------------------------------------------------------------------------* - * General signal buffers - *----------------------------------------------------------------------------------*/ - Word16* input_buff; - /*Word16* input; - Word16* old_input_signal;*/ - - SIGNAL_BUFFERS_ENC_HANDLE hSignalBuf; - - Word32* Bin_E_old_fx; /* per bin energy of old 2nd frames */ - Word16* mem_decim_fx; /* decimation filter memory */ - Word16* mem_decim16k_fx; /* ACELP@16kHz - decimation filter memory @16kHz */ - Word16* old_inp_12k8_fx; /* memory of input signal at 12.8kHz */ - Word16* old_inp_16k_fx; /* ACELP@16kHz - memory of input signal @16 kHz */ - - Word16* buf_speech_enc_pe; - Word16* buf_synth; /*can be reduced to PIT_MAX_MAX+L_FRAME_MAX if no rate switching*/ - Word16* buf_speech_enc; - Word16* buf_wspeech_enc; - - - Word16 lsp_old1_fx[M]; /* old unquantized LSP vector at the end of the frame */ - Word16 lsf_old1_fx[M]; /* old LSF vector at the end of the frame */ - Word16 lsp_old_fx[M]; /* old LSP vector at the end of the frame */ - Word16 lsf_old_fx[M]; /* old LSF vector at the end of the frame */ - Word16 lsp_old16k_fx[M]; /* old LSP vector at the end of the frame @16kHz */ - Word16 lspold_enc_fx[M]; /* old LSP vector at the end of the frame @16kHz */ - Word16 pstreaklen_fx; /* LSF quantizer */ - Word16 streaklimit_fx; /* LSF quantizer */ - Word32 offset_scale1_fx[MAX_NO_MODES + 1][MAX_NO_SCALES + 1]; /* offsets for LSF LVQ structure 1st 8-dim subvector*/ - Word32 offset_scale2_fx[MAX_NO_MODES + 1][MAX_NO_SCALES + 1]; /* offsets for LSF LVQ structure 2nd 8-dim subvector*/ - Word32 offset_scale1_p_fx[MAX_NO_MODES_p + 1][MAX_NO_SCALES + 1]; /* offsets for LSF LVQ structure, pred. case, 1st 8-dim subvector*/ - Word32 offset_scale2_p_fx[MAX_NO_MODES_p + 1][MAX_NO_SCALES + 1]; /* offsets for LSF LVQ structure, pred. case, 2nd 8-dim subvector*/ - Word16 no_scales_fx[MAX_NO_MODES][2]; /* LSF LVQ structure Q0*/ - Word16 no_scales_p_fx[MAX_NO_MODES_p][2]; /* LSF LVQ structure Q0*/ - Word16 stab_fac_fx; /* LSF stability factor */ - Word16 mem_deemph_fx; /* deemphasis filter memory */ - Word16 mem_preemph_fx; /* preemphasis filter memory */ - Word32 mem_hp20_in_fx[5]; /* HP filter memory for AMR-WB IO */ - Word16 old_wsp_fx[L_WSP_MEM]; /* old weighted signal vector */ - /*Word16 old_exc_fx[L_EXC_MEM];*/ /* old excitation vector */ - Word16 old_wsp2_fx[(L_WSP_MEM - L_INTERPOL) / OPL_DECIM]; /* old decimated weighted signal vector qwsp */ - - /*----------------------------------------------------------------------------------* - * Noise estimation - *----------------------------------------------------------------------------------*/ - - NOISE_EST_HANDLE hNoiseEst; - - Word16 mem_wsp_fx; /* weighted signal vector memory */ - Word16 mem_decim2_fx[3]; /* weighted signal decimation filter memory qwsp */ - Word16 clip_var_fx[6]; - Word16 mem_AR_fx[M]; /* AR memory of LSF quantizer (past quantized LSFs without mean) */ - Word16 mem_MA_fx[M]; /* MA memory of LSF quantizer (past quantized residual) (used also in AMR-WB IO mode) */ - Word16 mCb1_fx; /* LSF quantizer - counter of stationary frames after a transition frame */ - Word16 coder_type_raw_fx; - Word16 last_coder_type_raw_fx; /* raw last_coder_type (coming from the sigal classification) */ - Word16 last_coder_type_fx; /*Q0 previous coding type */ - Word16 ini_frame_fx; /* initialization frames counter */ - Word16 old_thres_fx; /* normalized correlation weighting in open-loop pitch Q15 */ - Word16 old_corr_fx; /* normalized correlation in previous frame (mean value) Q15 */ - Word16 old_pitch; /* previous pitch for open-loop pitch search Q0 */ - Word16 delta_pit_fx; /* open-loop pitch extrapolation correction Q0 */ - Word32 ee_old_fx; - Word16 min_band_fx; /* Q0 minimum critical band of useful bandwidth */ - Word16 max_band_fx; /* Q0 maximum critical band of useful bandwidth */ - Word16 tc_cnt_fx; /* TC frame counter */ - Word16 audio_frame_cnt_fx; /* Counter of relative presence of audio frames */ - Word32 old_dE1_fx; /* Maximum energy increase in previous frame */ - Word16 old_ind_deltaMax_fx; /* Index of the sub-subframe of maximum energy in previous frame */ - Word32 old_enr_ssf_fx[2 * NB_SSF]; /* Maxima of energies per sub-subframes of previous frame */ - Word16 spike_hyst_fx; /* Hysteresis to prevent UC after sharp energy spike */ - Word16 music_hysteresis_fx; /* Counter of frames after AUDIO coding mode to prevent UC */ - Word16 last_harm_flag_acelp_fx; /* harmonicity flag for ACELP @32kbps rate */ - Word16 old_Aq_12_8_fx[M + 1]; /* Q12 old Aq[] for core switching */ - Word16 old_Es_pred_fx; /* Q8 old Es_pred for core switching */ - - GSC_ENC_HANDLE hGSCEnc; - - - Word16 GSC_noisy_speech_fx; /* AC mode (GSC) - flag to indicate GSC on SWB noisy speech */ - - SP_MUS_CLAS_HANDLE hSpMusClas; - - Word16 lgBin_E_fx[L_FFT / 2]; /* Q8 per bin energy of two frames */ - - /* speech/music classifier improvement parameters */ - Word16 last_vad_spa_fx; - - - Word16 Last_pulse_pos_fx; /* FEC - last position of the first glotal pulse in the frame */ - Word16 lsfoldbfi0_fx[M]; /* FEC - LSF vector of the previous frame */ - Word16 lsfoldbfi1_fx[M]; /* FEC - LSF vector of the past previous frame */ - Word16 lsf_adaptive_mean_fx[M]; /* FEC - adaptive mean LSF vector for FEC */ - Word16 next_force_safety_net_fx; /* FEC - flag to force safety net in next frame */ - - - /*----------------------------------------------------------------------------------* - * VAD/DTX/CNG - *----------------------------------------------------------------------------------*/ - - VAD_HANDLE hVAD; - - VAD_CLDFB_HANDLE_FX hVAD_CLDFB; - Word16 lp_speech_fx; - Word16 Opt_HE_SAD_ON_fx; - Word16 nb_active_frames_HE_SAD_fx; - - - - - Word16 voicing_old_fx; - - - Word32 bckr_tilt_lt; - - - TD_CNG_ENC_HANDLE hTdCngEnc; - - DTX_ENC_HANDLE hDtxEnc; - Word16 var_SID_rate_flag_fx; /* CNG and DTX - flag for variable SID rate */ - Word16 interval_SID_fx; /* CNG and DTX - interval of SID update, default 8 */ - - Word16 lp_noise_fx; /* CNG and DTX - LP filtered total noise estimation */ - - Word16 uv_count_fx; /*Q0*/ /* Stationary noise UV modification - unvoiced counter */ - Word16 act_count_fx; /*Q0*/ /* Stationary noise UV modification - activation counter */ - Word32 ge_sm_fx; /* Stationary noise UV modification - smoothed excitation gain */ - Word16 lspold_s_fx[M]; /*Q15*/ /* Stationary noise UV modification - old LSP vector */ - Word16 noimix_seed_fx; /*Q0*/ /* Stationary noise UV modification - mixture seed */ - Word16 min_alpha_fx; /*Q15*/ /* Stationary noise UV modification - minimum alpha */ - Word16 exc_pe_fx; /* Stationary noise UV modification - memory of the preemphasis filter */ - - Word16 last_L_frame_fx; /* ACELP@16kHz - last L_frame value */ - Word16 mem_preemph16k_fx; /* ACELP@16kHz - preemphasis filter memory @16kHz */ - Word16 mem_deemp_preQ_fx; /* ACELP@16kHz - prequantizer deemhasis memory */ - Word16 mem_preemp_preQ_fx; /* ACELP@16kHz - prequantizer preemhasis memory */ - Word16 last_nq_preQ_fx; /* ACELP@16kHz - AVQ subquantizer number of the last sub-band of the last subframe */ - Word16 use_acelp_preq; /* ACELP@16kHz - flag of prequantizer usage */ - - Word16 bpf_off_fx; - Word16 old_pitch_buf_fx[2 * NB_SUBFR16k]; /*Q6 Bass post-filter - buffer of old subframe pitch values */ - - - /* stable short pitch detection */ - Word16 voicing0_sm_fx; - Word16 voicing_sm_fx; - Word16 LF_EnergyRatio_sm_fx; - Word16 predecision_flag_fx; - Word32 diff_sm_fx; - Word32 energy_sm_fx; - - Word16 last_ener_fx; /* AC mode (GSC) - previous energy */ - - /*----------------------------------------------------------------------------------* - * AMR-WB IO handle - *----------------------------------------------------------------------------------*/ - - AMRWB_IO_ENC_HANDLE hAmrwb_IO; /* AMR-WB IO encoder handle */ - - /*----------------------------------------------------------------------------------* - * CLDFB analysis - *----------------------------------------------------------------------------------*/ - HANDLE_CLDFB_FILTER_BANK cldfbAna_Fx; - - HANDLE_CLDFB_FILTER_BANK cldfbSyn_Fx; - - /*----------------------------------------------------------------------------------* - * FD CNG handle - *----------------------------------------------------------------------------------*/ - HANDLE_FD_CNG_ENC_FX hFdCngEnc_fx; - Word16 fd_cng_reset_flag; - Word16 last_totalNoise_fx; - Word16 totalNoise_increase_hist_fx[TOTALNOISE_HIST_SIZE]; - Word16 totalNoise_increase_len_fx; - /*----------------------------------------------------------------------------------* - * SC-VBR parameters - *----------------------------------------------------------------------------------*/ - - /*----------------------------------------------------------------------------------* - * SC-VBR parameters - *----------------------------------------------------------------------------------*/ - - SC_VBR_ENC_HANDLE hSC_VBR; - - /*----------------------------------------------------------------------------------* - * HQ core parameters - *----------------------------------------------------------------------------------*/ - Word16 * input; - Word16 * old_input_signal_fx; - Word16 Q_old_wtda; - Word16 old_hpfilt_in_fx; - Word16 old_hpfilt_out_fx; - Word32 EnergyLT_fx; - Word32 Energy_Old_fx; - Word16 TransientHangOver_fx; - Word16 last_core_fx; - - HQ_ENC_HANDLE hHQ_core; /* HQ core encoder handle */ - - Word16 Nb_ACELP_frames_fx; - - PVQ_ENC_HANDLE hPVQ; - - /*----------------------------------------------------------------------------------* - * TD BWE parameters - *----------------------------------------------------------------------------------*/ - - TD_BWE_ENC_HANDLE hBWE_TD; - - /*----------------------------------------------------------------------------------* - * FD BWE parameters - *----------------------------------------------------------------------------------*/ - - FD_BWE_ENC_HANDLE hBWE_FD; - - /*----------------------------------------------------------------------------------* - * WB, SWB and FB bandwidth detector - *----------------------------------------------------------------------------------*/ - - Word16 lt_mean_NB_fx; - Word16 lt_mean_WB_fx; - Word16 lt_mean_SWB_fx; - Word16 count_WB_fx; - Word16 count_SWB_fx; - Word16 count_FB_fx; - - RF_ENC_HANDLE hRF; /* RF encoder handle */ - - Word16 rf_mode; - Word16 rf_target_bits_write; - Word16 rf_mode_last; - Word16 last_rf_mode_cng; - Word16 Opt_RF_ON; - Word16 rf_fec_offset; - Word16 rf_fec_indicator; - - /*----------------------------------------------------------------------------------* - * Fixed point only variables - *----------------------------------------------------------------------------------*/ - - Word16 prev_Q_bwe_exc; - Word16 prev_Q_bwe_syn; - Word16 Q_stat_noise_ge; - Word16 Q_stat_noise; - Word16 Q_syn2; - Word16 Q_syn; - Word16 Q_max[L_Q_MEM]; - Word16 Q_max_16k[L_Q_MEM]; - Word16 Q_old; - Word16 prev_Q_old; - Word16 old_wsp_max; /* Last weigthed speech maximal value */ - Word16 old_wsp_shift; /* Last wsp scaling */ - Word16 prev_Q_new; - Word16 prev_Q_shb; - - /*----------------------------------------------------------------------------------* - * - *----------------------------------------------------------------------------------*/ - - Word16 EnergyLT_fx_exp; - Word16 prev_lsp_wb_fx[LPC_SHB_ORDER_WB]; - Word16 prev_lpc_wb_fx[LPC_SHB_ORDER_WB]; - Word16 prev_lsp_wb_temp_fx[LPC_SHB_ORDER_WB]; - - Word16 frame_size_index; /* 0-FRAME_SIZE_NB-1: index determining the frame size */ - Word16 bits_frame_nominal; /* avg bits per frame on active frame */ - Word16 bits_frame; /* total bits per frame */ - Word16 bits_frame_core; /* bits per frame for the core */ - Word8 narrowBand; - - /*ACELP config*/ - ACELP_config acelp_cfg; /* configuration set for each frame */ - - ACELP_config acelp_cfg_rf; /* configuration for RF frame */ - - Word16 mode_index; /* Mode Index for LPD core */ - - /*TCX config*/ - TCX_CONFIG_HANDLE hTcxCfg; - /*----------------------------------------------------------------------------------* - * TCX core encoder handle - *----------------------------------------------------------------------------------*/ - - TCX_ENC_HANDLE hTcxEnc; - - /* cod_main.c */ - Word16 mem_preemph_enc; /* speech preemph filter memory (at encoder-sampling-rate) */ - - - Word16 *speech_enc; - Word16 *speech_enc_pe; - Word16 *new_speech_enc; - Word16 *new_speech_enc_pe; - Word16 *wspeech_enc; - Word16 *synth; - /* Core Signal Analysis Outputs */ - - Word8 enableTcxLpc; /* global toggle for the TCX LPC quantizer */ - Word16 envWeighted; /* are is{p,f}_old_q[] weighted or not? */ - - Word8 acelpEnabled; /* Flag indicating if ACELP can be used */ - Word8 tcx10Enabled; /* Flag indicating if TCX 10 can be used */ - Word8 tcx20Enabled; /* Flag indicating if TCX 20 can be used */ - - - Word16 mem_wsp_enc; /* wsp vector memory */ - - Word16 nb_bits_header_ace; /* number of bits for the header */ - Word16 nb_bits_header_tcx; /* number of bits for the header */ - - /*Added by fcs : restrict the possible in EVS: 0 base 10 = d.c.b.a base 2*/ - /* a = 0/1 : ACELP on/off*/ - /* b = 0/1 : TCX20 on/off*/ - /* c = 0/1 : TCX40 on/off*/ - /* d = 0/1 : TCX80 on/off*/ - Word16 restrictedMode; - - /* Framing */ - Word16 nb_subfr; - - Word16 preemph_fac; /*Preemphasis factor*/ - - Word16 gamma; - Word16 inv_gamma; - - TransientDetection transientDetection; - Word16 transient_info[3]; - - Word16 acelpFramesCount; /* Acelp frame counter. Counts upto 50 only !!! */ - - Word16 prevTempFlatness_fx; /* exponent is AVG_FLAT_E */ - - Word32 prevEnergyHF_fx; - Word32 currEnergyHF_fx; - Word16 currEnergyHF_e_fx; /* exponent of currEnergyHF and prevEnergyHF */ - Word32 energyCoreLookahead_Fx; - Word16 sf_energyCoreLookahead_Fx; - - /* lsf quantizer*/ - Word16 parcorr[2]; - Word16 parcorr_mid[2]; - - Word16 lpcQuantization; - Word16 numlpc; - Word16 encoderLookahead_enc; - Word16 encoderPastSamples_enc; - Word16 encoderLookahead_FB; - - /* pitch_ol for adaptive lag window */ - Word16 old_pitch_la; /* past open loop pitch lag from look-ahead */ - Word16 old_voicing_la; /* past open loop pitch gain from look-ahead */ - - Word32 band_energies[2 * NB_BANDS]; /* energy in critical bands without minimum noise floor MODE2_E_MIN */ - Word16 band_energies_exp; /* exponent for energy in critical bands without minimum noise floor MODE2_E_MIN */ - - Word8 tcxonly; - - Word16 Q_max_enc[2]; - - Word16 finalVAD; - Word8 flag_noisy_speech_snr; /*encoder detector for noisy speech*/ - Word16 Pos_relE_cnt; /* Number of frames between positive relE */ - - Word16 fscale; - Word32 sr_core; - Word32 last_sr_core; - Word8 acelp_autocorr; /* Optimize acelp in 0 covariance or 1 correlation domain */ - - Word16 pit_min; - Word16 pit_fr1; - Word16 pit_fr1b; - Word16 pit_fr2; - Word16 pit_max; - Word16 pit_res_max; /* goes from 1 upto 6 (see core_enc_init.c: init_acelp()) */ - - /* for FAC */ - Word16 L_frame_past; - - /*Adaptive BPF*/ - Word16 bpf_gain_param; - Word16 bpf_T[NB_SUBFR16k]; - Word16 bpf_gainT[NB_SUBFR16k]; - - struct MEM_BPF - { - Word16 noise_buf[2 * L_FILT16k]; - Word16 error_buf[L_FILT16k]; - Word32 lp_error; - Word32 lp_error_ener; - Word16 noise_shift_old; - } mem_bpf; - - - - Word8 glr; - Word16 glr_idx[2]; - Word32 gain_code[NB_SUBFR16k]; - Word32 mean_gc[2]; - Word16 prev_lsf4_mean; - Word16 last_stab_fac; - Word8 glr_reset; - - /*for rate switching*/ - Word16 rate_switching_reset; /*Rate switching flag requiring a reset of memories at least partially */ - Word16 rate_switching_reset_16kHz; - - Word16 enablePlcWaveadjust; - Word16 Tonal_SideInfo; - - IGF_ENC_INSTANCE_HANDLE hIGFEnc; /* IGF encoder handle */ - Word16 igf; - - Word16 seed_acelp; - - PLC_ENC_EVS_HANDLE hPlcExt; - - Word16 tec_tfa; - TEC_ENC_HANDLE hTECEnc; /* TEC encoder handle */ - Word16 tec_flag; - Word16 tfa_flag; - Word32 tfa_enr[N_TEC_TFA_SUBFR]; - - Word16 nTimeSlots; /* for CLDFB */ - - T_CldfbVadState_fx vad_st; - - - Word16 pitch_fx[3]; - Word16 voicing_fx[3]; - Word16 sp_aud_decision0; /* 1st stage speech/music classification */ - Word16 sp_aud_decision1; /* 1st stage speech/music classification */ - Word16 sp_aud_decision2; /* 2nd stage speech/music classification */ - Word16 coder_type; /* coder type */ - Word16 vad_flag; - Word16 sharpFlag; /* formant sharpening flag */ - Word16 localVAD; - - Word16 tdm_pc; - Word16 prev_fmerit; - Word16 fmerit_dt; - - -} Encoder_State_fx, * ENC_CORE_HANDLE_FX; +//typedef struct Encoder_State_fx +//{ +// +// /*----------------------------------------------------------------------------------* +// * Common parameters +// *----------------------------------------------------------------------------------*/ +// /*----------------------------------------------------------------------------------* +// * Stereo/IVAS parameters +// *----------------------------------------------------------------------------------*/ +// Word16 flag_ACELP16k; /* flag indicating use of ACELP core at 16kHz internal sampling rate */ +// +// Word16 tdm_LRTD_flag; /* LRTD stereo mode flag */ +// Word16 cna_dirac_flag; /* CNA in DirAC flag */ +// Word16 cng_sba_flag; /* CNG in SBA flag */ +// Word16 idchan; /* channel ID (audio channel number) */ +// Word16 element_mode; /* element mode */ +// Word16 last_element_mode; /* element mode */ +// Word16 low_rate_mode; /* low-rate mode flag */ +// MCT_CHAN_MODE mct_chan_mode; +// Word16 GSC_IVAS_mode; +// Word16 is_ism_format; /* Indication whether the codec operates in ISM format */ +// Word16 dtx_sce_sba; /* enable use of FD CNG with transform domain cores in SCE SBA */ +// +// +// //#ifdef IVAS_CODE +// +//#ifdef DEBUGGING +// Word16 id_element; /* element ID */ +//#endif +// Word32 element_brate; /* element bitrate */ +// Word16 extl_orig; /* extension layer */ +// Word32 extl_brate_orig; /* extension layer bitrate */ +// /*----------------------- End of IVAS specific--------------------------------------*/ +// +// +// Word16 codec_mode; /* MODE1 or MODE2 */ +// Word16 last_codec_mode; /* Previous Codec Mode*/ +// Word16 last_codec_mode_cng; /* Codec Mode of the last inactive frame*/ +// Word16 mdct_sw_enable; /* MDCT switching enable flag */ +// Word16 mdct_sw; /* MDCT switching indicator */ +// Word16 last_enerBuffer_exp; +// Word16 next_bit_pos_fx; /* position of the next bit to be written in the bitstream */ +// Word16 bitstreamformat; /* Bitstream format flag (G.192/MIME) */ +// +// BSTR_ENC_HANDLE hBstr; /* encoder bitstream handle */ +// +// +// LPD_state_HANDLE hLPDmem; /* ACELP LPDmem memories */ +// +// +// Word32 input_Fs_fx; /* input signal sampling frequency in Hz */ +// Word32 total_brate_fx; /* total bitrate in kbps of the codec */ +// Word32 last_total_brate_fx; /* total bitrate in kbps of the codec */ +// Word32 last_total_brate_cng_fx; /* total bitrate in kbps of the last inactive frame */ +// Word16 core_fx; /* core (ACELP_CORE, TCX_20_CORE, TCX_10_CORE, HQ_CORE, AMR_WB_CORE) */ +// Word32 core_brate_fx; /* core bitrate */ +// Word32 last_core_brate_fx; /* previous frame core bitrate */ +// Word16 input_frame_fx; /* Frame lenght (function of input_Fs) */ +// Word16 extl_fx; /* extension layer */ +// Word16 last_extl_fx; /* previous extension layer */ +// Word32 extl_brate_fx; /* extension layer bitrate */ +// Word16 input_bwidth_fx; /* input signal bandwidth */ +// Word16 last_input_bwidth_fx; /* input signal bandwidth in the previous frame */ +// Word16 bwidth_fx; /* encoded bandwidth NB, WB, SWB or FB */ +// Word16 max_bwidth_fx; /* maximum encoded bandwidth */ +// Word16 last_bwidth_fx; /* input signal bandwidth in the previous frame */ +// Word16 last_bwidth_cng_fx; /* input signal bandwidth in the previous inactive frame */ +// Word16 L_frame_fx; /* ACELP core internal frame length */ +// Word16 Opt_AMR_WB_fx; /* flag indicating AMR-WB IO mode */ +// Word16 Opt_DTX_ON_fx; /* flag indicating DTX operation */ +// Word16 cng_type_fx; /* flag indicating LP or CLDFB based SID/CNG */ +// Word16 active_fr_cnt_fx; /* counter of active frames */ +// Word16 Opt_SC_VBR_fx; /* flag indicating SC-VBR mode */ +// Word16 last_Opt_SC_VBR_fx; /* flag indicating SC-VBR mode in the last frame */ +// /*----------------------------------------------------------------------------------* +// * ACELP core parameters +// *----------------------------------------------------------------------------------*/ +// +// Word16 clas_fx; /* current frame clas */ +// Word16 last_clas_fx; /* previous frame signal classification */ +// Word32 Bin_E_fx[L_FFT]; /* Q_new + Q_SCALE -2 per bin energy of two frames */ +// +// /*----------------------------------------------------------------------------------* +// * General signal buffers +// *----------------------------------------------------------------------------------*/ +// Word16* input_buff; +// /*Word16* input; +// Word16* old_input_signal;*/ +// +// SIGNAL_BUFFERS_ENC_HANDLE hSignalBuf; +// +// Word32* Bin_E_old_fx; /* per bin energy of old 2nd frames */ +// Word16* mem_decim_fx; /* decimation filter memory */ +// Word16* mem_decim16k_fx; /* ACELP@16kHz - decimation filter memory @16kHz */ +// Word16* old_inp_12k8_fx; /* memory of input signal at 12.8kHz */ +// Word16* old_inp_16k_fx; /* ACELP@16kHz - memory of input signal @16 kHz */ +// +// Word16* buf_speech_enc_pe; +// Word16* buf_synth; /*can be reduced to PIT_MAX_MAX+L_FRAME_MAX if no rate switching*/ +// Word16* buf_speech_enc; +// Word16* buf_wspeech_enc; +// +// +// Word16 lsp_old1_fx[M]; /* old unquantized LSP vector at the end of the frame */ +// Word16 lsf_old1_fx[M]; /* old LSF vector at the end of the frame */ +// Word16 lsp_old_fx[M]; /* old LSP vector at the end of the frame */ +// Word16 lsf_old_fx[M]; /* old LSF vector at the end of the frame */ +// Word16 lsp_old16k_fx[M]; /* old LSP vector at the end of the frame @16kHz */ +// Word16 lspold_enc_fx[M]; /* old LSP vector at the end of the frame @16kHz */ +// Word16 pstreaklen_fx; /* LSF quantizer */ +// Word16 streaklimit_fx; /* LSF quantizer */ +// Word32 offset_scale1_fx[MAX_NO_MODES + 1][MAX_NO_SCALES + 1]; /* offsets for LSF LVQ structure 1st 8-dim subvector*/ +// Word32 offset_scale2_fx[MAX_NO_MODES + 1][MAX_NO_SCALES + 1]; /* offsets for LSF LVQ structure 2nd 8-dim subvector*/ +// Word32 offset_scale1_p_fx[MAX_NO_MODES_p + 1][MAX_NO_SCALES + 1]; /* offsets for LSF LVQ structure, pred. case, 1st 8-dim subvector*/ +// Word32 offset_scale2_p_fx[MAX_NO_MODES_p + 1][MAX_NO_SCALES + 1]; /* offsets for LSF LVQ structure, pred. case, 2nd 8-dim subvector*/ +// Word16 no_scales_fx[MAX_NO_MODES][2]; /* LSF LVQ structure Q0*/ +// Word16 no_scales_p_fx[MAX_NO_MODES_p][2]; /* LSF LVQ structure Q0*/ +// Word16 stab_fac_fx; /* LSF stability factor */ +// Word16 mem_deemph_fx; /* deemphasis filter memory */ +// Word16 mem_preemph_fx; /* preemphasis filter memory */ +// Word32 mem_hp20_in_fx[5]; /* HP filter memory for AMR-WB IO */ +// Word16 old_wsp_fx[L_WSP_MEM]; /* old weighted signal vector */ +// /*Word16 old_exc_fx[L_EXC_MEM];*/ /* old excitation vector */ +// Word16 old_wsp2_fx[(L_WSP_MEM - L_INTERPOL) / OPL_DECIM]; /* old decimated weighted signal vector qwsp */ +// +// /*----------------------------------------------------------------------------------* +// * Noise estimation +// *----------------------------------------------------------------------------------*/ +// +// NOISE_EST_HANDLE hNoiseEst; +// +// Word16 mem_wsp_fx; /* weighted signal vector memory */ +// Word16 mem_decim2_fx[3]; /* weighted signal decimation filter memory qwsp */ +// Word16 clip_var_fx[6]; +// Word16 mem_AR_fx[M]; /* AR memory of LSF quantizer (past quantized LSFs without mean) */ +// Word16 mem_MA_fx[M]; /* MA memory of LSF quantizer (past quantized residual) (used also in AMR-WB IO mode) */ +// Word16 mCb1_fx; /* LSF quantizer - counter of stationary frames after a transition frame */ +// Word16 coder_type_raw_fx; +// Word16 last_coder_type_raw_fx; /* raw last_coder_type (coming from the sigal classification) */ +// Word16 last_coder_type_fx; /*Q0 previous coding type */ +// Word16 ini_frame_fx; /* initialization frames counter */ +// Word16 old_thres_fx; /* normalized correlation weighting in open-loop pitch Q15 */ +// Word16 old_corr_fx; /* normalized correlation in previous frame (mean value) Q15 */ +// Word16 old_pitch; /* previous pitch for open-loop pitch search Q0 */ +// Word16 delta_pit_fx; /* open-loop pitch extrapolation correction Q0 */ +// Word32 ee_old_fx; +// Word16 min_band_fx; /* Q0 minimum critical band of useful bandwidth */ +// Word16 max_band_fx; /* Q0 maximum critical band of useful bandwidth */ +// Word16 tc_cnt_fx; /* TC frame counter */ +// Word16 audio_frame_cnt_fx; /* Counter of relative presence of audio frames */ +// Word32 old_dE1_fx; /* Maximum energy increase in previous frame */ +// Word16 old_ind_deltaMax_fx; /* Index of the sub-subframe of maximum energy in previous frame */ +// Word32 old_enr_ssf_fx[2 * NB_SSF]; /* Maxima of energies per sub-subframes of previous frame */ +// Word16 spike_hyst_fx; /* Hysteresis to prevent UC after sharp energy spike */ +// Word16 music_hysteresis_fx; /* Counter of frames after AUDIO coding mode to prevent UC */ +// Word16 last_harm_flag_acelp_fx; /* harmonicity flag for ACELP @32kbps rate */ +// Word16 old_Aq_12_8_fx[M + 1]; /* Q12 old Aq[] for core switching */ +// Word16 old_Es_pred_fx; /* Q8 old Es_pred for core switching */ +// +// GSC_ENC_HANDLE hGSCEnc; +// +// +// Word16 GSC_noisy_speech_fx; /* AC mode (GSC) - flag to indicate GSC on SWB noisy speech */ +// +// SP_MUS_CLAS_HANDLE hSpMusClas; +// +// Word16 lgBin_E_fx[L_FFT / 2]; /* Q8 per bin energy of two frames */ +// +// /* speech/music classifier improvement parameters */ +// Word16 last_vad_spa_fx; +// +// +// Word16 Last_pulse_pos_fx; /* FEC - last position of the first glotal pulse in the frame */ +// Word16 lsfoldbfi0_fx[M]; /* FEC - LSF vector of the previous frame */ +// Word16 lsfoldbfi1_fx[M]; /* FEC - LSF vector of the past previous frame */ +// Word16 lsf_adaptive_mean_fx[M]; /* FEC - adaptive mean LSF vector for FEC */ +// Word16 next_force_safety_net_fx; /* FEC - flag to force safety net in next frame */ +// +// +// /*----------------------------------------------------------------------------------* +// * VAD/DTX/CNG +// *----------------------------------------------------------------------------------*/ +// +// VAD_HANDLE hVAD; +// +// VAD_CLDFB_HANDLE_FX hVAD_CLDFB; +// Word16 lp_speech_fx; +// Word16 Opt_HE_SAD_ON_fx; +// Word16 nb_active_frames_HE_SAD_fx; +// +// +// +// +// Word16 voicing_old_fx; +// +// +// Word32 bckr_tilt_lt; +// +// +// TD_CNG_ENC_HANDLE hTdCngEnc; +// +// DTX_ENC_HANDLE hDtxEnc; +// Word16 var_SID_rate_flag_fx; /* CNG and DTX - flag for variable SID rate */ +// Word16 interval_SID_fx; /* CNG and DTX - interval of SID update, default 8 */ +// +// Word16 lp_noise_fx; /* CNG and DTX - LP filtered total noise estimation */ +// +// Word16 uv_count_fx; /*Q0*/ /* Stationary noise UV modification - unvoiced counter */ +// Word16 act_count_fx; /*Q0*/ /* Stationary noise UV modification - activation counter */ +// Word32 ge_sm_fx; /* Stationary noise UV modification - smoothed excitation gain */ +// Word16 lspold_s_fx[M]; /*Q15*/ /* Stationary noise UV modification - old LSP vector */ +// Word16 noimix_seed_fx; /*Q0*/ /* Stationary noise UV modification - mixture seed */ +// Word16 min_alpha_fx; /*Q15*/ /* Stationary noise UV modification - minimum alpha */ +// Word16 exc_pe_fx; /* Stationary noise UV modification - memory of the preemphasis filter */ +// +// Word16 last_L_frame_fx; /* ACELP@16kHz - last L_frame value */ +// Word16 mem_preemph16k_fx; /* ACELP@16kHz - preemphasis filter memory @16kHz */ +// Word16 mem_deemp_preQ_fx; /* ACELP@16kHz - prequantizer deemhasis memory */ +// Word16 mem_preemp_preQ_fx; /* ACELP@16kHz - prequantizer preemhasis memory */ +// Word16 last_nq_preQ_fx; /* ACELP@16kHz - AVQ subquantizer number of the last sub-band of the last subframe */ +// Word16 use_acelp_preq; /* ACELP@16kHz - flag of prequantizer usage */ +// +// Word16 bpf_off_fx; +// Word16 old_pitch_buf_fx[2 * NB_SUBFR16k]; /*Q6 Bass post-filter - buffer of old subframe pitch values */ +// +// +// /* stable short pitch detection */ +// Word16 voicing0_sm_fx; +// Word16 voicing_sm_fx; +// Word16 LF_EnergyRatio_sm_fx; +// Word16 predecision_flag_fx; +// Word32 diff_sm_fx; +// Word32 energy_sm_fx; +// +// Word16 last_ener_fx; /* AC mode (GSC) - previous energy */ +// +// /*----------------------------------------------------------------------------------* +// * AMR-WB IO handle +// *----------------------------------------------------------------------------------*/ +// +// AMRWB_IO_ENC_HANDLE hAmrwb_IO; /* AMR-WB IO encoder handle */ +// +// /*----------------------------------------------------------------------------------* +// * CLDFB analysis +// *----------------------------------------------------------------------------------*/ +// HANDLE_CLDFB_FILTER_BANK cldfbAna_Fx; +// +// HANDLE_CLDFB_FILTER_BANK cldfbSyn_Fx; +// +// /*----------------------------------------------------------------------------------* +// * FD CNG handle +// *----------------------------------------------------------------------------------*/ +// HANDLE_FD_CNG_ENC_FX hFdCngEnc_fx; +// Word16 fd_cng_reset_flag; +// Word16 last_totalNoise_fx; +// Word16 totalNoise_increase_hist_fx[TOTALNOISE_HIST_SIZE]; +// Word16 totalNoise_increase_len_fx; +// /*----------------------------------------------------------------------------------* +// * SC-VBR parameters +// *----------------------------------------------------------------------------------*/ +// +// /*----------------------------------------------------------------------------------* +// * SC-VBR parameters +// *----------------------------------------------------------------------------------*/ +// +// SC_VBR_ENC_HANDLE hSC_VBR; +// +// /*----------------------------------------------------------------------------------* +// * HQ core parameters +// *----------------------------------------------------------------------------------*/ +// Word16 * input; +// Word16 * old_input_signal_fx; +// Word16 Q_old_wtda; +// Word16 old_hpfilt_in_fx; +// Word16 old_hpfilt_out_fx; +// Word32 EnergyLT_fx; +// Word32 Energy_Old_fx; +// Word16 TransientHangOver_fx; +// Word16 last_core_fx; +// +// HQ_ENC_HANDLE hHQ_core; /* HQ core encoder handle */ +// +// Word16 Nb_ACELP_frames_fx; +// +// PVQ_ENC_HANDLE hPVQ; +// +// /*----------------------------------------------------------------------------------* +// * TD BWE parameters +// *----------------------------------------------------------------------------------*/ +// +// TD_BWE_ENC_HANDLE hBWE_TD; +// +// /*----------------------------------------------------------------------------------* +// * FD BWE parameters +// *----------------------------------------------------------------------------------*/ +// +// FD_BWE_ENC_HANDLE hBWE_FD; +// +// /*----------------------------------------------------------------------------------* +// * WB, SWB and FB bandwidth detector +// *----------------------------------------------------------------------------------*/ +// +// Word16 lt_mean_NB_fx; +// Word16 lt_mean_WB_fx; +// Word16 lt_mean_SWB_fx; +// Word16 count_WB_fx; +// Word16 count_SWB_fx; +// Word16 count_FB_fx; +// +// RF_ENC_HANDLE hRF; /* RF encoder handle */ +// +// Word16 rf_mode; +// Word16 rf_target_bits_write; +// Word16 rf_mode_last; +// Word16 last_rf_mode_cng; +// Word16 Opt_RF_ON; +// Word16 rf_fec_offset; +// Word16 rf_fec_indicator; +// +// /*----------------------------------------------------------------------------------* +// * Fixed point only variables +// *----------------------------------------------------------------------------------*/ +// +// Word16 prev_Q_bwe_exc; +// Word16 prev_Q_bwe_syn; +// Word16 Q_stat_noise_ge; +// Word16 Q_stat_noise; +// Word16 Q_syn2; +// Word16 Q_syn; +// Word16 Q_max[L_Q_MEM]; +// Word16 Q_max_16k[L_Q_MEM]; +// Word16 Q_old; +// Word16 prev_Q_old; +// Word16 old_wsp_max; /* Last weigthed speech maximal value */ +// Word16 old_wsp_shift; /* Last wsp scaling */ +// Word16 prev_Q_new; +// Word16 prev_Q_shb; +// +// /*----------------------------------------------------------------------------------* +// * +// *----------------------------------------------------------------------------------*/ +// +// Word16 EnergyLT_fx_exp; +// Word16 prev_lsp_wb_fx[LPC_SHB_ORDER_WB]; +// Word16 prev_lpc_wb_fx[LPC_SHB_ORDER_WB]; +// Word16 prev_lsp_wb_temp_fx[LPC_SHB_ORDER_WB]; +// +// Word16 frame_size_index; /* 0-FRAME_SIZE_NB-1: index determining the frame size */ +// Word16 bits_frame_nominal; /* avg bits per frame on active frame */ +// Word16 bits_frame; /* total bits per frame */ +// Word16 bits_frame_core; /* bits per frame for the core */ +// Word8 narrowBand; +// +// /*ACELP config*/ +// ACELP_config acelp_cfg; /* configuration set for each frame */ +// +// ACELP_config acelp_cfg_rf; /* configuration for RF frame */ +// +// Word16 mode_index; /* Mode Index for LPD core */ +// +// /*TCX config*/ +// TCX_CONFIG_HANDLE hTcxCfg; +// /*----------------------------------------------------------------------------------* +// * TCX core encoder handle +// *----------------------------------------------------------------------------------*/ +// +// TCX_ENC_HANDLE hTcxEnc; +// +// /* cod_main.c */ +// Word16 mem_preemph_enc; /* speech preemph filter memory (at encoder-sampling-rate) */ +// +// +// Word16 *speech_enc; +// Word16 *speech_enc_pe; +// Word16 *new_speech_enc; +// Word16 *new_speech_enc_pe; +// Word16 *wspeech_enc; +// Word16 *synth; +// /* Core Signal Analysis Outputs */ +// +// Word8 enableTcxLpc; /* global toggle for the TCX LPC quantizer */ +// Word16 envWeighted; /* are is{p,f}_old_q[] weighted or not? */ +// +// Word8 acelpEnabled; /* Flag indicating if ACELP can be used */ +// Word8 tcx10Enabled; /* Flag indicating if TCX 10 can be used */ +// Word8 tcx20Enabled; /* Flag indicating if TCX 20 can be used */ +// +// +// Word16 mem_wsp_enc; /* wsp vector memory */ +// +// Word16 nb_bits_header_ace; /* number of bits for the header */ +// Word16 nb_bits_header_tcx; /* number of bits for the header */ +// +// /*Added by fcs : restrict the possible in EVS: 0 base 10 = d.c.b.a base 2*/ +// /* a = 0/1 : ACELP on/off*/ +// /* b = 0/1 : TCX20 on/off*/ +// /* c = 0/1 : TCX40 on/off*/ +// /* d = 0/1 : TCX80 on/off*/ +// Word16 restrictedMode; +// +// /* Framing */ +// Word16 nb_subfr; +// +// Word16 preemph_fac; /*Preemphasis factor*/ +// +// Word16 gamma; +// Word16 inv_gamma; +// +// TransientDetection transientDetection; +// Word16 transient_info[3]; +// +// Word16 acelpFramesCount; /* Acelp frame counter. Counts upto 50 only !!! */ +// +// Word16 prevTempFlatness_fx; /* exponent is AVG_FLAT_E */ +// +// Word32 prevEnergyHF_fx; +// Word32 currEnergyHF_fx; +// Word16 currEnergyHF_e_fx; /* exponent of currEnergyHF and prevEnergyHF */ +// Word32 energyCoreLookahead_Fx; +// Word16 sf_energyCoreLookahead_Fx; +// +// /* lsf quantizer*/ +// Word16 parcorr[2]; +// Word16 parcorr_mid[2]; +// +// Word16 lpcQuantization; +// Word16 numlpc; +// Word16 encoderLookahead_enc; +// Word16 encoderPastSamples_enc; +// Word16 encoderLookahead_FB; +// +// /* pitch_ol for adaptive lag window */ +// Word16 old_pitch_la; /* past open loop pitch lag from look-ahead */ +// Word16 old_voicing_la; /* past open loop pitch gain from look-ahead */ +// +// Word32 band_energies[2 * NB_BANDS]; /* energy in critical bands without minimum noise floor MODE2_E_MIN */ +// Word16 band_energies_exp; /* exponent for energy in critical bands without minimum noise floor MODE2_E_MIN */ +// +// Word8 tcxonly; +// +// Word16 Q_max_enc[2]; +// +// Word16 finalVAD; +// Word8 flag_noisy_speech_snr; /*encoder detector for noisy speech*/ +// Word16 Pos_relE_cnt; /* Number of frames between positive relE */ +// +// Word16 fscale; +// Word32 sr_core; +// Word32 last_sr_core; +// Word8 acelp_autocorr; /* Optimize acelp in 0 covariance or 1 correlation domain */ +// +// Word16 pit_min; +// Word16 pit_fr1; +// Word16 pit_fr1b; +// Word16 pit_fr2; +// Word16 pit_max; +// Word16 pit_res_max; /* goes from 1 upto 6 (see core_enc_init.c: init_acelp()) */ +// +// /* for FAC */ +// Word16 L_frame_past; +// +// /*Adaptive BPF*/ +// Word16 bpf_gain_param; +// Word16 bpf_T[NB_SUBFR16k]; +// Word16 bpf_gainT[NB_SUBFR16k]; +// +// struct MEM_BPF +// { +// Word16 noise_buf[2 * L_FILT16k]; +// Word16 error_buf[L_FILT16k]; +// Word32 lp_error; +// Word32 lp_error_ener; +// Word16 noise_shift_old; +// } mem_bpf; +// +// +// +// Word8 glr; +// Word16 glr_idx[2]; +// Word32 gain_code[NB_SUBFR16k]; +// Word32 mean_gc[2]; +// Word16 prev_lsf4_mean; +// Word16 last_stab_fac; +// Word8 glr_reset; +// +// /*for rate switching*/ +// Word16 rate_switching_reset; /*Rate switching flag requiring a reset of memories at least partially */ +// Word16 rate_switching_reset_16kHz; +// +// Word16 enablePlcWaveadjust; +// Word16 Tonal_SideInfo; +// +// IGF_ENC_INSTANCE_HANDLE hIGFEnc; /* IGF encoder handle */ +// Word16 igf; +// +// Word16 seed_acelp; +// +// PLC_ENC_EVS_HANDLE hPlcExt; +// +// Word16 tec_tfa; +// TEC_ENC_HANDLE hTECEnc; /* TEC encoder handle */ +// Word16 tec_flag; +// Word16 tfa_flag; +// Word32 tfa_enr[N_TEC_TFA_SUBFR]; +// +// Word16 nTimeSlots; /* for CLDFB */ +// +// T_CldfbVadState_fx vad_st; +// +// +// Word16 pitch_fx[3]; +// Word16 voicing_fx[3]; +// Word16 sp_aud_decision0; /* 1st stage speech/music classification */ +// Word16 sp_aud_decision1; /* 1st stage speech/music classification */ +// Word16 sp_aud_decision2; /* 2nd stage speech/music classification */ +// Word16 coder_type; /* coder type */ +// Word16 vad_flag; +// Word16 sharpFlag; /* formant sharpening flag */ +// Word16 localVAD; +// +// Word16 tdm_pc; +// Word16 prev_fmerit; +// Word16 fmerit_dt; +// +// +//} Encoder_State, * ENC_CORE_HANDLE_FX; typedef struct GainItemStr { diff --git a/lib_enc/stat_noise_uv_enc_fx.c b/lib_enc/stat_noise_uv_enc_fx.c index a7ab7164a..8bb3c09bc 100644 --- a/lib_enc/stat_noise_uv_enc_fx.c +++ b/lib_enc/stat_noise_uv_enc_fx.c @@ -19,7 +19,7 @@ /* when the noise is stationary */ /*----------------------------------------------------------------------*/ /* INPUT ARGUMENTS : */ -/* _ (Encoder_State_fx) st_fx : Encoder state Structure */ +/* _ (Encoder_State) st_fx : Encoder state Structure */ /* _ (Word16*) epsP : LP prediction errors */ /* _ (Word16*) isp_new : immittance spectral pairs at 4th sfr Q15 */ /* _ (Word16*) isp_mid : immittance spectral pairs at 2nd sfr Q15 */ @@ -38,7 +38,7 @@ /* _ None */ /*=======================================================================*/ void stat_noise_uv_enc_fx( - Encoder_State_fx *st_fx, /* i/o: state structure */ + Encoder_State *st_fx, /* i/o: state structure */ const Word32 *LepsP, /* i : LP prediction errors */ const Word16 *isp_new, /* i : immittance spectral pairs at 4th sfr */ const Word16 *isp_mid, /* i : immittance spectral pairs at 2nd sfr */ @@ -55,7 +55,7 @@ void stat_noise_uv_enc_fx( #endif test(); test(); - IF ( ( EQ_16(st_fx->coder_type,UNVOICED) && uc_two_stage_flag == 0) || (EQ_16(st_fx->coder_type,INACTIVE) && LE_32(st_fx->core_brate_fx,ACELP_9k60))) + IF ( ( EQ_16(st_fx->coder_type,UNVOICED) && uc_two_stage_flag == 0) || (EQ_16(st_fx->coder_type,INACTIVE) && LE_32(st_fx->core_brate,ACELP_9k60))) { /*-----------------------------------------------------------------* @@ -83,13 +83,13 @@ void stat_noise_uv_enc_fx( num = sub(num,1024);/*num - 1*/ test(); - IF ( NE_16(st_fx->bwidth_fx,NB)) + IF ( NE_16(st_fx->bwidth,NB)) { /* WB case */ /* noisiness = (Word16)(((epsP[2] / epsP[16]) - 1)*2 * 32);*/ noisiness = shr(num,4);/*Q10 x64 -> Q0 */ } - ELSE IF ( EQ_16(st_fx->coder_type,INACTIVE)&&EQ_16(st_fx->bwidth_fx,NB)) + ELSE IF ( EQ_16(st_fx->coder_type,INACTIVE)&&EQ_16(st_fx->bwidth,NB)) { /* NB GSC case */ /* noisiness = (Word16)(((epsP[2] / epsP[16]) - 1)*.25f * 32);*/ @@ -112,9 +112,9 @@ void stat_noise_uv_enc_fx( *-----------------------------------------------------------------*/ stat_noise_uv_mod_fx( st_fx->coder_type, noisiness, st_fx->lsp_old_fx, isp_new, isp_mid, Aq - ,exc2, Q_new, 0, &st_fx->ge_sm_fx, &st_fx->uv_count_fx, &st_fx->act_count_fx, - st_fx->lspold_s_fx, &st_fx->noimix_seed_fx, &st_fx->min_alpha_fx, &st_fx->exc_pe_fx, - st_fx->core_brate_fx, st_fx->bwidth_fx, &st_fx->Q_stat_noise, &st_fx->Q_stat_noise_ge ); + ,exc2, Q_new, 0, &st_fx->ge_sm_fx, &st_fx->uv_count, &st_fx->act_count, + st_fx->lspold_s_fx, &st_fx->noimix_seed, &st_fx->min_alpha_fx, &st_fx->exc_pe_fx, + st_fx->core_brate, st_fx->bwidth, &st_fx->Q_stat_noise, &st_fx->Q_stat_noise_ge ); return; diff --git a/lib_enc/swb_bwe_enc_fx.c b/lib_enc/swb_bwe_enc_fx.c index d244708cc..a79c6a582 100644 --- a/lib_enc/swb_bwe_enc_fx.c +++ b/lib_enc/swb_bwe_enc_fx.c @@ -19,7 +19,7 @@ *---------------------------------------------------------------------*/ static Word16 SWB_BWE_encoding_fx( - Encoder_State_fx *st_fx, /* i/o: encoder state structure */ + Encoder_State *st_fx, /* i/o: encoder state structure */ Word16 *insig_fx, /* i/o: delayed original input signal at 32kHz (might be rescaled)*/ const Word16 *insig_lp_fx, /* i : delayed original lowband input signal at 32kHz */ const Word16 *insig_hp_fx, /* i : delayed original highband input signal at 32kHz */ @@ -112,7 +112,7 @@ static void delay_input_signal_fx( * WB BWE encoder *-------------------------------------------------------------------*/ void wb_bwe_enc_fx( - Encoder_State_fx *st_fx, /* i/o: encoder state structure */ + Encoder_State *st_fx, /* i/o: encoder state structure */ const Word16 *new_wb_speech_fx, /* i : original input signal at 16kHz */ Word16 coder_type /* i : coding type */ ) @@ -129,7 +129,7 @@ void wb_bwe_enc_fx( FD_BWE_ENC_HANDLE hBWE_FD = st_fx->hBWE_FD; Word16 WB_fenv_fx[SWB_FENV]; - IF( EQ_32(st_fx->total_brate_fx, ACELP_13k20)) + IF( EQ_32(st_fx->total_brate, ACELP_13k20)) { /*---------------------------------------------------------------------* * Delay the original input signal to be synchronized with ACELP core synthesis @@ -189,7 +189,7 @@ void wb_bwe_enc_fx( * SWB BWE encoder (only for 32kHz signals) *-------------------------------------------------------------------*/ void swb_bwe_enc_fx( - Encoder_State_fx *st_fx, /* i/o: encoder state structure */ + Encoder_State *st_fx, /* i/o: encoder state structure */ Word16 *old_input_12k8_fx, /* i : input signal @12.8kHz for SWB BWE */ Word16 *old_input_16k_fx, /* i : input signal @16kHz for SWB BWE */ const Word16 *old_syn_12k8_16k_fx, /* i : ACELP core synthesis at 12.8kHz or 16kHz */ @@ -237,7 +237,7 @@ void swb_bwe_enc_fx( /*---------------------------------------------------------------------* * Delay the original input signal to be synchronized with ACELP core synthesis *---------------------------------------------------------------------*/ - IF( EQ_16(st_fx->extl_fx, FB_BWE)) + IF( EQ_16(st_fx->extl, FB_BWE)) { inner_frame = L_FRAME48k; inner_Fs = 48000; @@ -250,7 +250,7 @@ void swb_bwe_enc_fx( set16_fx( old_input_fx, 0, add(NS2SA(inner_Fs, DELAY_FD_BWE_ENC_12k8_NS + DELAY_FIR_RESAMPL_NS), inner_frame) ); - IF( EQ_16(st_fx->L_frame_fx, L_FRAME)) + IF( EQ_16(st_fx->L_frame, L_FRAME)) { Sample_Delay_SWB_BWE = NS2SA(inner_Fs, DELAY_FD_BWE_ENC_12k8_NS + DELAY_FIR_RESAMPL_NS); Sample_Delay_HP = NS2SA(16000, ACELP_LOOK_NS + DELAY_FD_BWE_ENC_12k8_NS + DELAY_FIR_RESAMPL_NS - DELAY_CLDFB_NS); @@ -280,9 +280,9 @@ void swb_bwe_enc_fx( /* tilt returned in Q24 goto to Q11 */ #ifdef BASOP_NOGLOB - tilt_nb_fx = round_fx_o(L_shl_o(calc_tilt_bwe_fx(old_input_lp_fx, Q_slb_speech, st_fx->L_frame_fx), 3, &Overflow), &Overflow); + tilt_nb_fx = round_fx_o(L_shl_o(calc_tilt_bwe_fx(old_input_lp_fx, Q_slb_speech, st_fx->L_frame), 3, &Overflow), &Overflow); #else - tilt_nb_fx = round_fx(L_shl(calc_tilt_bwe_fx(old_input_lp_fx, Q_slb_speech, st_fx->L_frame_fx), 3)); + tilt_nb_fx = round_fx(L_shl(calc_tilt_bwe_fx(old_input_lp_fx, Q_slb_speech, st_fx->L_frame), 3)); #endif /*---------------------------------------------------------------------* * SWB BWE encoding @@ -316,7 +316,7 @@ void swb_bwe_enc_fx( move16(); Q_synth_hf = 0; move16(); - IF (EQ_16(st_fx->L_frame_fx, L_FRAME16k)) + IF (EQ_16(st_fx->L_frame, L_FRAME16k)) { scl = 300; move16(); @@ -343,7 +343,7 @@ void swb_bwe_enc_fx( Copy_Scale_sig(&yorig_fx[scl], &yorig_fx[scl], sub(inner_frame, scl), exp); Q_synth_hf = add(exp, Q_synth); - IF(EQ_16(st_fx->last_extl_fx, SWB_BWE)||EQ_16(st_fx->last_extl_fx,FB_BWE)) + IF(EQ_16(st_fx->last_extl, SWB_BWE)||EQ_16(st_fx->last_extl,FB_BWE)) { exp = norm_l(st_fx->EnergyLT_fx); IF(add(st_fx->EnergyLT_fx_exp, exp) > shl(sub(Q_synth_hf, 4), 1)) @@ -367,7 +367,7 @@ void swb_bwe_enc_fx( } Copy_Scale_sig(new_input_hp_fx, new_input_hp_fx, L_FRAME16k, sub(Q_shb, Q_shb_speech)); /* SWB BWE encoding */ - IF (EQ_16(st_fx->L_frame_fx, L_FRAME16k)) + IF (EQ_16(st_fx->L_frame, L_FRAME16k)) { SWB_BWE_encoding_fx( st_fx, old_input_fx, old_input_lp_fx, new_input_hp_fx, old_syn_12k8_16k_fx, yorig_fx, SWB_fenv_fx, tilt_nb_fx, 80, coder_type, Q_slb_speech, Q_shb, Q_synth_hf, Q_synth ); @@ -380,7 +380,7 @@ void swb_bwe_enc_fx( } /* FB BWE encoding */ - IF ( EQ_16(st_fx->extl_fx, FB_BWE)) + IF ( EQ_16(st_fx->extl, FB_BWE)) { energy_fbe_fb_fx = L_deposit_l(0); FOR( i=FB_BAND_BEGIN; iextl_fx, FB_BWE)) + IF( EQ_16(st_fx->extl, FB_BWE)) { push_indice_fx(st_fx->hBstr, IND_FB_SLOPE, idxGain, NUM_BITS_FB_FRAMEGAIN ); } @@ -590,7 +590,7 @@ static Word16 FD_BWE_class_fx( /* o : FD BWE class */ const Word16 tilt_nb, /* i : BWE tilt */ Word16 Q_syn, Word16 Q_shb, - Encoder_State_fx *st_fx /* i/o: Encoder structure */ + Encoder_State *st_fx /* i/o: Encoder structure */ ) { Word16 i, j, k, noise, sharpMod = 0; @@ -629,7 +629,7 @@ static Word16 FD_BWE_class_fx( /* o : FD BWE class */ L_mean_d = 0L; /* to avoid compilation warnings */ test(); - IF ( EQ_16(st_fx->extl_fx, SWB_BWE)||EQ_16(st_fx->extl_fx,FB_BWE)) + IF ( EQ_16(st_fx->extl, SWB_BWE)||EQ_16(st_fx->extl,FB_BWE)) { input_hi = &fSpectrum[256]; move16(); @@ -639,7 +639,7 @@ static Word16 FD_BWE_class_fx( /* o : FD BWE class */ test(); test(); test(); - IF ( ( EQ_16(st_fx->last_extl_fx, SWB_BWE)&&EQ_16(st_fx->extl_fx,SWB_BWE))||(EQ_16(st_fx->last_extl_fx,FB_BWE)&&EQ_16(st_fx->extl_fx,FB_BWE))) + IF ( ( EQ_16(st_fx->last_extl, SWB_BWE)&&EQ_16(st_fx->extl,SWB_BWE))||(EQ_16(st_fx->last_extl,FB_BWE)&&EQ_16(st_fx->extl,FB_BWE))) { IF(hBWE_FD->prev_global_gain_fx == 0) { @@ -709,7 +709,7 @@ static Word16 FD_BWE_class_fx( /* o : FD BWE class */ } } } - ELSE IF (EQ_16(st_fx->extl_fx, WB_BWE)) + ELSE IF (EQ_16(st_fx->extl, WB_BWE)) { input_hi = &fSpectrum[224]; move16(); @@ -724,7 +724,7 @@ static Word16 FD_BWE_class_fx( /* o : FD BWE class */ { numharmonic = shr(numharmonic, 1); } - IF (NE_16(st_fx->last_extl_fx, WB_BWE)) + IF (NE_16(st_fx->last_extl, WB_BWE)) { IF (EQ_16(hBWE_FD->prev_mode, HARMONIC)) { @@ -807,7 +807,7 @@ static Word16 FD_BWE_class_fx( /* o : FD BWE class */ } } test(); - IF ( EQ_16(st_fx->extl_fx, SWB_BWE)||EQ_16(st_fx->extl_fx,FB_BWE)) + IF ( EQ_16(st_fx->extl, SWB_BWE)||EQ_16(st_fx->extl,FB_BWE)) { test(); test(); @@ -832,7 +832,7 @@ static Word16 FD_BWE_class_fx( /* o : FD BWE class */ L_mean_d = L_add(L_mean_d, L_abs(L_tmp)); /*Q_syn+8 */ } } - ELSE IF (EQ_16(st_fx->extl_fx, WB_BWE)) + ELSE IF (EQ_16(st_fx->extl, WB_BWE)) { test(); IF (GE_16(k,numharmonic)&>_16(sharpPeak,shl(sharplimit,10))) @@ -870,7 +870,7 @@ static Word16 FD_BWE_class_fx( /* o : FD BWE class */ mode = HARMONIC; move16(); } - ELSE IF ( EQ_16(st_fx->extl_fx, SWB_BWE)||EQ_16(st_fx->extl_fx,FB_BWE)) + ELSE IF ( EQ_16(st_fx->extl, SWB_BWE)||EQ_16(st_fx->extl,FB_BWE)) { L_tmp = Mult_32_16(L_mean_d, 6827); /*Q_syn+8 ; 1/4.8 in Q15 */ @@ -1729,7 +1729,7 @@ static void calculate_Tonality_fx( *-------------------------------------------------------------------*/ static void energy_control_fx( - Encoder_State_fx *st_fx, /* i/o: Encoder structure */ + Encoder_State *st_fx, /* i/o: Encoder structure */ const Word16 core, /* i : core */ const Word16 mode, /* i : SHB BWE class */ const Word16 coder_type, /* i : coder type */ @@ -1749,7 +1749,7 @@ static void energy_control_fx( gamma_fx = 11469; move16();/*.35 in Q15 */ test(); - IF ( NE_16(coder_type,AUDIO)&<_32(st_fx->total_brate_fx,ACELP_8k85)) + IF ( NE_16(coder_type,AUDIO)&<_32(st_fx->total_brate,ACELP_8k85)) { core_type = 0; move16(); @@ -1759,9 +1759,9 @@ static void energy_control_fx( core_type = 1; move16(); } - get_normalize_spec_fx(core, st_fx->extl_fx, mode, core_type, org_fx, SWB_signal_fx, &(hBWE_FD->prev_L_swb_norm1), offset, Q_new_lf); + get_normalize_spec_fx(core, st_fx->extl, mode, core_type, org_fx, SWB_signal_fx, &(hBWE_FD->prev_L_swb_norm1), offset, Q_new_lf); - IF ( EQ_16(st_fx->extl_fx,WB_BWE)) + IF ( EQ_16(st_fx->extl,WB_BWE)) { max_band = 4; move16(); @@ -1780,7 +1780,7 @@ static void energy_control_fx( { gamma_fx = 18022; move16();/*.55 in Q15 */ - get_normalize_spec_fx(core, st_fx->extl_fx, mode, -1, org_fx, SWB_signal_fx, &(hBWE_FD->prev_L_swb_norm1), offset, Q_new_lf); + get_normalize_spec_fx(core, st_fx->extl, mode, -1, org_fx, SWB_signal_fx, &(hBWE_FD->prev_L_swb_norm1), offset, Q_new_lf); band_step = 1; move16(); @@ -1829,7 +1829,7 @@ Word16 WB_BWE_encoding_fx( /* o : classification of wb signal */ const Word16 coder_type, /* i : coder type */ const Word16 *yos_fx, /* i : MDCT coefficients of weighted original */ Word16 *WB_fenv_fx, /* i/o: energy of WB envelope */ - Encoder_State_fx *st_fx, /* i/o: Encoder structure */ + Encoder_State *st_fx, /* i/o: Encoder structure */ Word16 Q_synth, Word16 Q_synth_lf ) @@ -1896,7 +1896,7 @@ Word16 WB_BWE_encoding_fx( /* o : classification of wb signal */ * SWB BWE encoder *-------------------------------------------------------------------*/ static Word16 SWB_BWE_encoding_fx( - Encoder_State_fx *st_fx, /* i/o: encoder state structure */ + Encoder_State *st_fx, /* i/o: encoder state structure */ Word16 *insig_fx, /* i : delayed original input signal at 32kHz */ const Word16 *insig_lp_fx, /* i : delayed original lowband input signal at 32kHz */ const Word16 *insig_hp_fx, /* i : delayed original highband input signal at 32kHz */ @@ -1940,7 +1940,7 @@ static Word16 SWB_BWE_encoding_fx( FD_BWE_ENC_HANDLE hBWE_FD = st_fx->hBWE_FD; BSTR_ENC_HANDLE hBstr = st_fx->hBstr; - IF( EQ_16(st_fx->L_frame_fx, L_FRAME )) + IF( EQ_16(st_fx->L_frame, L_FRAME )) { L = L_SUBFR; move16(); @@ -1985,11 +1985,11 @@ static Word16 SWB_BWE_encoding_fx( #endif test(); test(); - IF( EQ_16(IsTransient,1)&&(GT_16(tilt_fx,16384)||GT_16(st_fx->clas_fx,1))) + IF( EQ_16(IsTransient,1)&&(GT_16(tilt_fx,16384)||GT_16(st_fx->clas,1))) { IsTransient = 0; move16(); - st_fx->TransientHangOver_fx = 0; + st_fx->TransientHangOver = 0; move16(); } @@ -2207,7 +2207,7 @@ static Word16 SWB_BWE_encoding_fx( test(); test(); - IF(IsTransient_LF == 0 && EQ_16(coder_type,INACTIVE)&&EQ_16(st_fx->TransientHangOver_fx,1)) + IF(IsTransient_LF == 0 && EQ_16(coder_type,INACTIVE)&&EQ_16(st_fx->TransientHangOver,1)) { FOR(n_band = 0; n_band < SWB_TENV; n_band++) { @@ -2567,7 +2567,7 @@ static void calculate_tonality_fx_32( * *-------------------------------------------------------------------*/ static void energy_control_fx_32( - Encoder_State_fx *st_fx, /* i/o: encoder structure */ + Encoder_State *st_fx, /* i/o: encoder structure */ const Word16 core, /* i : core : Q0 */ const Word16 mode, /* i : SHB BWE class : Q0 */ const Word16 coder_type, /* i : SHB BWE class : Q0 */ @@ -2591,7 +2591,7 @@ static void energy_control_fx_32( gamma_fx = 11468; move16(); test(); - IF ( NE_16(coder_type , AUDIO)&&LE_32(st_fx->total_brate_fx,ACELP_8k00)) + IF ( NE_16(coder_type , AUDIO)&&LE_32(st_fx->total_brate,ACELP_8k00)) { core_type = 0; move16(); @@ -2602,9 +2602,9 @@ static void energy_control_fx_32( move16(); } - get_normalize_spec_fx_32(core, st_fx->extl_fx, mode, core_type, org_fx, SWB_signal_fx, &(hBWE_FD->prev_L_swb_norm1), offset ); + get_normalize_spec_fx_32(core, st_fx->extl, mode, core_type, org_fx, SWB_signal_fx, &(hBWE_FD->prev_L_swb_norm1), offset ); - IF ( EQ_16(st_fx->extl_fx , WB_BWE)) + IF ( EQ_16(st_fx->extl , WB_BWE)) { max_band = 4; move16(); @@ -2747,7 +2747,7 @@ void hq_generic_encoding_fx( const Word32 *coefs_fx, /* i : MDCT coefficients of weighted original : Q12 */ Word16 *hq_generic_fenv_fx, /* i/o: energy of SWB envelope : Q3 */ const Word16 hq_generic_offset, /* i : frequency offset for extracting energy : Q0 */ - Encoder_State_fx *st_fx, /* i/o: encoder state structure */ + Encoder_State *st_fx, /* i/o: encoder state structure */ Word16 *hq_generic_exc_clas /* o : bwe excitation class : Q0 */ ) { @@ -2831,7 +2831,7 @@ void hq_generic_encoding_fx( } } - IF ( EQ_16(st_fx->bwidth_fx , FB)) + IF ( EQ_16(st_fx->bwidth , FB)) { FOR ( n_band = 0; n_band < DIM_FB; n_band++ ) { @@ -2880,7 +2880,7 @@ void hq_generic_encoding_fx( hq_generic_fenv_fx[n_band] = sub(hq_generic_fenv_fx[n_band], Mean_env_fx[n_band]); } - IF ( st_fx->bwidth_fx == FB ) + IF ( st_fx->bwidth == FB ) { FOR ( n_band = 0; n_band < DIM_FB; n_band++ ) { @@ -2899,7 +2899,7 @@ void hq_generic_encoding_fx( msvq_interpol_2_fx(hq_generic_fenv_fx, w_env_fx, indice, nenv); } - IF ( EQ_16(st_fx->bwidth_fx , FB)) + IF ( EQ_16(st_fx->bwidth , FB)) { indice[5] = vqSimple_w_fx(hq_generic_fenv_fx+nenv, hq_generic_fenv_fx+nenv, EnvCdbkFB_fx, NULL, DIM_FB, N_CB_FB, 0); } @@ -2918,7 +2918,7 @@ void hq_generic_encoding_fx( push_indice_fx( hBstr, IND_SWB_FENV_HQ, indice[4], 5 ); } - IF ( EQ_16(st_fx->bwidth_fx , FB)) + IF ( EQ_16(st_fx->bwidth , FB)) { push_indice_fx( hBstr, IND_FB_FENV_HQ, indice[5], 5 ); } @@ -2935,7 +2935,7 @@ void hq_generic_encoding_fx( } - IF ( EQ_16(st_fx->bwidth_fx , FB)) + IF ( EQ_16(st_fx->bwidth , FB)) { FOR ( n_band = 0; n_band < DIM_FB; n_band++ ) { diff --git a/lib_enc/swb_bwe_enc_hr_fx.c b/lib_enc/swb_bwe_enc_hr_fx.c index 0e3bc89a5..21a407c1f 100644 --- a/lib_enc/swb_bwe_enc_hr_fx.c +++ b/lib_enc/swb_bwe_enc_hr_fx.c @@ -89,7 +89,7 @@ static Word16 en_band_quant_fx(/* o : quantization index */ * HR SWB BWE encoder *-------------------------------------------------------------------*/ void swb_bwe_enc_hr_fx( - Encoder_State_fx *st_fx, /* i/o: encoder state structure */ + Encoder_State *st_fx, /* i/o: encoder state structure */ Word16 *new_input_fx, /* i : input signal */ Word16 new_input_fx_exp, /* i : Exponent of input signal */ const Word16 input_frame, /* i : frame length */ @@ -150,7 +150,7 @@ void swb_bwe_enc_hr_fx( /* reset memories in case that last frame was a different technology */ test(); - IF( EQ_16(st_fx->last_core_fx, HQ_CORE)||NE_16(st_fx->last_extl_fx,st_fx->extl_fx)) + IF( EQ_16(st_fx->last_core, HQ_CORE)||NE_16(st_fx->last_extl,st_fx->extl)) { set16_fx(hBWE_FD->L_old_wtda_swb_fx, 0, L_FRAME48k ); st_fx->Q_old_wtda = 0; @@ -159,8 +159,8 @@ void swb_bwe_enc_hr_fx( /* calculate SWB BWE bit-budget (extension layer bit-rate + AVQ unused bits from the core layer) */ /* nBits = st->extl_brate/50 + unbits */ - assert(SWB_BWE_16k == st_fx->extl_brate_fx); - nBits = add(SWB_BWE_16k/50,unbits); /* st->extl_brate_fx is always 16kbps */ + assert(SWB_BWE_16k == st_fx->extl_brate); + nBits = add(SWB_BWE_16k/50,unbits); /* st->extl_brate is always 16kbps */ nBits_total = nBits; move16(); @@ -232,7 +232,7 @@ void swb_bwe_enc_hr_fx( nBits = add(nBits, s_and(nBits_total, NUM_TIME_SW_BLKS_MASK)); /* set width of noncoded (blind estimated) spectrum */ - IF( EQ_16(st_fx->extl_fx, SWB_BWE_HIGHRATE)) + IF( EQ_16(st_fx->extl, SWB_BWE_HIGHRATE)) { width_noncoded = L_FRAME32k/NUM_TIME_SWITCHING_BLOCKS - NUM_TRANS_END_FREQ_COEF; move16(); @@ -285,7 +285,7 @@ void swb_bwe_enc_hr_fx( j = sub(t_audio_fx_exp, scl); /* compute energy of noncoded (14.4-20kHz) spectrum */ - IF( EQ_16(st_fx->extl_fx, FB_BWE_HIGHRATE)) + IF( EQ_16(st_fx->extl, FB_BWE_HIGHRATE)) { L_tmp = Calc_Energy_Autoscaled(t_audio_fx + add(temp, NUM_TRANS_END_FREQ_COEF), j, width_noncoded, &temp2); L_en_noncoded_fx = Sqrt_Ratio32(L_tmp, temp2, L_deposit_l(width_noncoded), 0, &en_noncoded_fx_exp); @@ -400,7 +400,7 @@ void swb_bwe_enc_hr_fx( * estimate energy of noncoded spectrum (14.4-20kHz) *---------------------------------------------------------------------*/ - IF( NE_16(st_fx->extl_fx, SWB_BWE_HIGHRATE)) + IF( NE_16(st_fx->extl, SWB_BWE_HIGHRATE)) { /* st->extl == FB_BWE_HIGHRATE */ /* 'en_noncoded /= (gain * en_band[N_BANDS_TRANS_BWE_HR-1])' */ @@ -462,7 +462,7 @@ void swb_bwe_enc_hr_fx( Nsv = (NUM_TRANS_END_FREQ_COEF - NUM_TRANS_START_FREQ_COEF) / WIDTH_BAND; move16(); AVQ_cod_fx(t_audio_fx + add(temp, NUM_TRANS_START_FREQ_COEF), x_norm_fx, nBits, Nsv, t_audio_fx_exp); - AVQ_encmux_fx(hBstr, st_fx->extl_fx, x_norm_fx, &nBits, Nsv, nq, 0, sub(Nsv, 1)); + AVQ_encmux_fx(hBstr, st_fx->extl, x_norm_fx, &nBits, Nsv, nq, 0, sub(Nsv, 1)); } } @@ -476,7 +476,7 @@ void swb_bwe_enc_hr_fx( *---------------------------------------------------------------------*/ /* set width of noncoded (blind estimated) spectrum */ - IF( EQ_16(st_fx->extl_fx, SWB_BWE_HIGHRATE)) + IF( EQ_16(st_fx->extl, SWB_BWE_HIGHRATE)) { width_noncoded = L_FRAME32k - NUM_NONTRANS_END_FREQ_COEF; move16(); @@ -488,7 +488,7 @@ void swb_bwe_enc_hr_fx( } /* compute energy of noncoded (14.4-20kHz) spectrum */ - IF( EQ_16(st_fx->extl_fx, FB_BWE_HIGHRATE)) + IF( EQ_16(st_fx->extl, FB_BWE_HIGHRATE)) { L_tmp = Calc_Energy_Autoscaled(t_audio_fx + NUM_NONTRANS_END_FREQ_COEF, t_audio_fx_exp, width_noncoded, &temp2); L_en_noncoded_fx = Sqrt_Ratio32(L_tmp, temp2, L_deposit_l(width_noncoded), 0, &en_noncoded_fx_exp); @@ -635,7 +635,7 @@ void swb_bwe_enc_hr_fx( /*---------------------------------------------------------------------* * estimate energy of noncoded spectrum (14.4-20kHz) *---------------------------------------------------------------------*/ - IF( NE_16(st_fx->extl_fx, SWB_BWE_HIGHRATE)) + IF( NE_16(st_fx->extl, SWB_BWE_HIGHRATE)) { /* st->extl == FB_BWE_HIGHRATE */ /* 'en_noncoded /= (gain * min_env)' */ @@ -697,7 +697,7 @@ void swb_bwe_enc_hr_fx( Nsv = shr(i, WIDTH_BAND_SHIFT); AVQ_cod_fx(t_audio_tmp_fx/*same exponent as t_audio_fx*/, x_norm_fx, nBits, Nsv, t_audio_fx_exp); - AVQ_encmux_fx(hBstr, st_fx->extl_fx, x_norm_fx, &nBits, Nsv, nq, 0, sub(Nsv, 1)); + AVQ_encmux_fx(hBstr, st_fx->extl, x_norm_fx, &nBits, Nsv, nq, 0, sub(Nsv, 1)); /*---------------------------------------------------------------------* * second stage coding @@ -787,7 +787,7 @@ void swb_bwe_enc_hr_fx( set16_fx( nq2, 0, Nsv ); AVQ_cod_fx( t_audio_fx, x_norm1_fx, nBits, Nsv2, t_audio_fx_exp ); - AVQ_encmux_fx(hBstr, st_fx->extl_fx, x_norm1_fx, &nBits, Nsv2, nq2, 0, sub(Nsv2, 1)); + AVQ_encmux_fx(hBstr, st_fx->extl, x_norm1_fx, &nBits, Nsv2, nq2, 0, sub(Nsv2, 1)); } } /* 'ELSE' of ' IF( is_transient )' */ diff --git a/lib_enc/swb_bwe_enc_lr_fx.c b/lib_enc/swb_bwe_enc_lr_fx.c index 562844093..5ef07cc1a 100644 --- a/lib_enc/swb_bwe_enc_lr_fx.c +++ b/lib_enc/swb_bwe_enc_lr_fx.c @@ -847,7 +847,7 @@ static void gethar_noisegn_fx( * find lowband indices denoting the selected lowband subband. *--------------------------------------------------------------------------*/ static void EncodeSWBSubbands_fx( - Encoder_State_fx *st_fx, /* i/o: encoder state structure */ + Encoder_State *st_fx, /* i/o: encoder state structure */ Word32 *L_spectra, /* i/o: MDCT domain spectrum */ Word16 QsL, /* i : Q value for L_spectra */ const Word16 fLenLow_fx, /* i : lowband length */ @@ -1046,7 +1046,7 @@ static void EncodeSWBSubbands_fx( * Main encoding routine of SWB BWE for the LR MDCT core *--------------------------------------------------------------------------*/ void swb_bwe_enc_lr_fx( - Encoder_State_fx *st_fx, /* i/o: encoder state structure */ + Encoder_State *st_fx, /* i/o: encoder state structure */ const Word32 L_m_core[], /* i : lowband synthesis */ Word16 QsL, /* i : Q value */ const Word32 L_m_orig[], /* i/o: scaled orig signal (MDCT) */ diff --git a/lib_enc/swb_pre_proc_fx.c b/lib_enc/swb_pre_proc_fx.c index 76658d41b..682394a62 100644 --- a/lib_enc/swb_pre_proc_fx.c +++ b/lib_enc/swb_pre_proc_fx.c @@ -23,7 +23,7 @@ /* is above 16kHz */ /*------------------------------------------------------------------------*/ /* INPUT ARGUMENTS : */ -/* Encoder_State_fx *st_fx : Encoder State Structure */ +/* Encoder_State *st_fx : Encoder State Structure */ /* _ (Word16*) input : original input signal */ /*------------------------------------------------------------------------*/ /* INPUT/OUTPUT ARGUMENTS : */ @@ -40,7 +40,7 @@ /*========================================================================*/ void wb_pre_proc_fx( - Encoder_State_fx *st_fx, /* i/o: encoder state structure */ + Encoder_State *st_fx, /* i/o: encoder state structure */ const Word16 *new_inp_resamp16k, /* i : original input signal in Q-1 */ Word16 *hb_speech /* o : HB target signal (6-8kHz) at 16kHz in Q-1 */ ) @@ -65,12 +65,12 @@ void wb_pre_proc_fx( test(); test(); test(); - IF ( (EQ_32(st_fx->last_total_brate_fx, ACELP_6k60))|| - (EQ_32(st_fx->last_total_brate_fx, ACELP_8k85)) || - (EQ_32(st_fx->last_total_brate_fx, ACELP_12k65)) || - (EQ_32(st_fx->last_total_brate_fx, ACELP_14k25)) || - (EQ_32(st_fx->last_total_brate_fx, ACELP_15k85)) || - (GE_32(st_fx->last_total_brate_fx, ACELP_18k25) && LE_32(st_fx->last_total_brate_fx, ACELP_23k85)) ) + IF ( (EQ_32(st_fx->last_total_brate, ACELP_6k60))|| + (EQ_32(st_fx->last_total_brate, ACELP_8k85)) || + (EQ_32(st_fx->last_total_brate, ACELP_12k65)) || + (EQ_32(st_fx->last_total_brate, ACELP_14k25)) || + (EQ_32(st_fx->last_total_brate, ACELP_15k85)) || + (GE_32(st_fx->last_total_brate, ACELP_18k25) && LE_32(st_fx->last_total_brate, ACELP_23k85)) ) { fSwitchFromIO = 1; move16(); @@ -105,7 +105,7 @@ void wb_pre_proc_fx( test(); test(); - IF ( EQ_16(st_fx->extl_fx, WB_BWE)||EQ_16(st_fx->extl_fx,WB_TBE)||st_fx->igf!=0) + IF ( EQ_16(st_fx->extl, WB_BWE)||EQ_16(st_fx->extl,WB_TBE)||st_fx->igf!=0) { ramp_flag = 0; @@ -113,7 +113,7 @@ void wb_pre_proc_fx( test(); test(); test(); - IF( (NE_16(st_fx->last_extl_fx, WB_TBE)&&NE_16(st_fx->last_extl_fx,WB_BWE)&&st_fx->igf==0)|| + IF( (NE_16(st_fx->last_extl, WB_TBE)&&NE_16(st_fx->last_extl,WB_BWE)&&st_fx->igf==0)|| (st_fx->igf != 0 && fSwitchFromIO != 0) ) { ramp_flag = 1; @@ -130,7 +130,7 @@ void wb_pre_proc_fx( Scale_sig(hBWE_TD->decim_state1_fx, (2*ALLPASSSECTIONS_STEEP+1), -Q_wb_sp); Scale_sig(hBWE_TD->decim_state2_fx, (2*ALLPASSSECTIONS_STEEP+1), -Q_wb_sp); - IF( NE_16(st_fx->extl_fx, WB_TBE)) + IF( NE_16(st_fx->extl, WB_TBE)) { /* Update the previous wideband speech buffer in case of a WB_BWE frame */ Sample_Delay_WB_BWE = (L_LOOK_12k8 + L_SUBFR) * 5/16; @@ -152,7 +152,7 @@ void wb_pre_proc_fx( test(); test(); test(); - IF ( (NE_16(st_fx->extl_fx, WB_BWE)||(EQ_16(st_fx->extl_fx,WB_BWE)&&LE_32(st_fx->total_brate_fx,ACELP_8k00)))&&!hSC_VBR->ppp_mode) + IF ( (NE_16(st_fx->extl, WB_BWE)||(EQ_16(st_fx->extl,WB_BWE)&&LE_32(st_fx->total_brate,ACELP_8k00)))&&!hSC_VBR->ppp_mode) { Sample_Delay_WB_BWE = NS2SA_fx2( 16000, DELAY_FD_BWE_ENC_12k8_NS ); @@ -173,7 +173,7 @@ void wb_pre_proc_fx( /* Common SWB TBE and SWB BWE pre-processing */ /*------------------------------------------------------------------------*/ /* INPUT ARGUMENTS : */ -/* Encoder_State_fx *st_fx : Encoder State Structure Q0 */ +/* Encoder_State *st_fx : Encoder State Structure Q0 */ /* _ (Word16*) input_fx : original input signal Q0 */ /*------------------------------------------------------------------------*/ /* INPUT/OUTPUT ARGUMENTS : */ @@ -192,7 +192,7 @@ void wb_pre_proc_fx( /*========================================================================*/ void swb_pre_proc_fx( - Encoder_State_fx *st_fx, /* i/o: encoder state structure */ + Encoder_State *st_fx, /* i/o: encoder state structure */ const Word16 *input_fx, /* i : original input signal */ Word16 *new_swb_speech_fx, /* o : original input signal at 32kHz */ Word16 *shb_speech_fx, /* o : SHB target signal (6-14kHz) at 16kHz */ @@ -235,26 +235,26 @@ void swb_pre_proc_fx( set16_fx( old_input_fx, 0, NS2SA_fx2(48000, DELAY_FD_BWE_ENC_12k8_NS + DELAY_FIR_RESAMPL_NS) + L_FRAME48k ); - IF( EQ_32(st_fx->input_Fs_fx, 32000)) + IF( EQ_32(st_fx->input_Fs, 32000)) { Copy(input_fx, new_swb_speech_fx, L_FRAME32k); /*Q0 */ test(); test(); - IF( NE_16(st_fx->last_extl_fx, SWB_BWE)&&NE_16(st_fx->last_extl_fx,FB_BWE)&&NE_16(st_fx->extl_fx,SWB_BWE_HIGHRATE)) + IF( NE_16(st_fx->last_extl, SWB_BWE)&&NE_16(st_fx->last_extl,FB_BWE)&&NE_16(st_fx->extl,SWB_BWE_HIGHRATE)) { Sample_Delay_SWB_BWE = NS2SA_fx2( 32000, DELAY_FD_BWE_ENC_12k8_NS + DELAY_FIR_RESAMPL_NS ); Copy(hBWE_FD->old_fdbwe_speech_fx, &old_input_fx[Sample_Delay_SWB_BWE], L_FRAME32k ); set16_fx( old_input_fx, 0, Sample_Delay_SWB_BWE ); Copy(hBWE_FD->old_fdbwe_speech_fx + L_FRAME32k - Sample_Delay_SWB_BWE, hBWE_FD->old_input_fx, Sample_Delay_SWB_BWE ); - IF( sub(st_fx->extl_fx, WB_BWE) != 0 ) + IF( sub(st_fx->extl, WB_BWE) != 0 ) { Copy( old_input_fx, hBWE_FD->L_old_wtda_swb_fx, L_FRAME32k ); } } test(); - IF( NE_16(st_fx->extl_fx, SWB_BWE)&&NE_16(st_fx->extl_fx,FB_BWE)) + IF( NE_16(st_fx->extl, SWB_BWE)&&NE_16(st_fx->extl,FB_BWE)) { Copy( input_fx, hBWE_FD->old_fdbwe_speech_fx, L_FRAME32k ); } @@ -266,7 +266,7 @@ void swb_pre_proc_fx( { test(); test(); - IF( NE_16(st_fx->extl_fx,SWB_BWE)&&NE_16(st_fx->extl_fx,FB_BWE)&&EQ_16(st_fx->core_fx,ACELP_CORE)) + IF( NE_16(st_fx->extl,SWB_BWE)&&NE_16(st_fx->extl,FB_BWE)&&EQ_16(st_fx->core,ACELP_CORE)) { /* move the resampling out of the TDBWE path as new_swb_speech is not needed for TDBWE. */ Copy( input_fx, hBWE_FD->old_fdbwe_speech_fx, L_FRAME48k ); @@ -274,10 +274,10 @@ void swb_pre_proc_fx( ELSE { test(); - IF( NE_16(st_fx->last_extl_fx,SWB_BWE)&&NE_16(st_fx->last_extl_fx,FB_BWE)) + IF( NE_16(st_fx->last_extl,SWB_BWE)&&NE_16(st_fx->last_extl,FB_BWE)) { /* resample 48 kHz to 32kHz */ - IF( EQ_16(st_fx->last_bwidth_fx,FB)) + IF( EQ_16(st_fx->last_bwidth,FB)) { inner_frame = L_FRAME48k; inner_Fs = 48000; @@ -300,7 +300,7 @@ void swb_pre_proc_fx( move16(); } /* resample 48 kHz to 32kHz */ - IF( EQ_16(st_fx->bwidth_fx,FB)) + IF( EQ_16(st_fx->bwidth,FB)) { Copy( input_fx, new_swb_speech_fx, L_FRAME48k ); } @@ -314,7 +314,7 @@ void swb_pre_proc_fx( ELSE { /* resample 48 kHz to 32kHz */ - IF( EQ_16(st_fx->bwidth_fx,FB)) + IF( EQ_16(st_fx->bwidth,FB)) { Copy( input_fx, new_swb_speech_fx, L_FRAME48k ); } @@ -331,10 +331,10 @@ void swb_pre_proc_fx( test(); test(); test(); - IF( ( EQ_16(st_fx->core_fx, ACELP_CORE)&&NE_16(st_fx->extl_fx,SWB_BWE_HIGHRATE)&&NE_16(st_fx->extl_fx,FB_BWE_HIGHRATE)) - || ( ( EQ_32(st_fx->total_brate_fx, 9600) || st_fx->rf_mode != 0 ) && EQ_16(st_fx->bwidth_fx, SWB) ) ) + IF( ( EQ_16(st_fx->core, ACELP_CORE)&&NE_16(st_fx->extl,SWB_BWE_HIGHRATE)&&NE_16(st_fx->extl,FB_BWE_HIGHRATE)) + || ( ( EQ_32(st_fx->total_brate, 9600) || st_fx->rf_mode != 0 ) && EQ_16(st_fx->bwidth, SWB) ) ) { - IF( EQ_16(st_fx->L_frame_fx, L_FRAME)) + IF( EQ_16(st_fx->L_frame, L_FRAME)) { startB= 34; endB= 14; @@ -401,13 +401,13 @@ void swb_pre_proc_fx( CldfbHB_ener = L_mult(sub(Cldfbtemp1, 1741/*3.401 Q9*/), 3495); /* 3495 = Q19 log10(2)*0.1/log10(32768), Q = 19+9+1 = 29 */ hBWE_TD->cldfbHBLT = mac_r(CldfbHB_ener, 29491/*0.9 Q15*/, hBWE_TD->cldfbHBLT); /* cldfbHBLT is in Q13 */ } - cldfbSynthesisFiltering( st_fx->cldfbSyn_Fx, realBufferFlipped, imagBufferFlipped, + cldfbSynthesisFiltering( st_fx->cldfbSynTd, realBufferFlipped, imagBufferFlipped, cldfbScale, shb_speech_fx, 0, CLDFB_NO_COL_MAX, cldfbWorkBuffer ); *Q_shb_spch = 0; /*shb_speech_fx : Q0*/ test(); test(); - IF( NE_16(st_fx->extl_fx, WB_TBE)&&NE_16(st_fx->extl_fx,SWB_TBE)&&NE_16(st_fx->extl_fx,FB_TBE)) + IF( NE_16(st_fx->extl, WB_TBE)&&NE_16(st_fx->extl,SWB_TBE)&&NE_16(st_fx->extl,FB_TBE)) { /* Update the previous superwideband speech buffer in case of a SWB_BWE frame - this code is in swb_tbe_enc */ delay = L_LOOK_16k + L_SUBFR16k; @@ -416,7 +416,7 @@ void swb_pre_proc_fx( } ELSE { - IF( EQ_16(st_fx->bwidth_fx, FB)||EQ_16(st_fx->core_fx,ACELP_CORE)) + IF( EQ_16(st_fx->bwidth, FB)||EQ_16(st_fx->core,ACELP_CORE)) { set16_fx(hBWE_TD->old_speech_shb_fx, 0, L_LOOK_16k + L_SUBFR16k ); set16_fx( shb_speech_fx, 0, L_FRAME16k ); /* shb_speech for FB/SWB BWE_HIGHRATE is not used at 64kbps */ @@ -436,11 +436,11 @@ void swb_pre_proc_fx( } /* Reset CLDFB synthesis buffer */ - set16_fx( st_fx->cldfbSyn_Fx->FilterStates, 0, st_fx->cldfbSyn_Fx->p_filter_length + st_fx->cldfbSyn_Fx->no_channels*st_fx->cldfbSyn_Fx->no_col ); + set16_fx( st_fx->cldfbSynTd->FilterStates, 0, st_fx->cldfbSynTd->p_filter_length + st_fx->cldfbSynTd->no_channels*st_fx->cldfbSynTd->no_col ); } - IF( st_fx->last_extl_fx == -1 ) + IF( st_fx->last_extl == -1 ) { - delay = NS2SA(st_fx->input_Fs_fx, DELAY_FIR_RESAMPL_NS); + delay = NS2SA(st_fx->input_Fs, DELAY_FIR_RESAMPL_NS); FOR( i = 0; i < delay; i++ ) { shb_speech_fx[i] = mult_r( mult_r(i, 983/*0.03f Q15*/), shb_speech_fx[2*delay-1-i] ); diff --git a/lib_enc/swb_tbe_enc_fx.c b/lib_enc/swb_tbe_enc_fx.c index e18647af7..ee212a57b 100644 --- a/lib_enc/swb_tbe_enc_fx.c +++ b/lib_enc/swb_tbe_enc_fx.c @@ -30,10 +30,10 @@ static void singlevectortest_gain_fx( const Word32* inp, const Word16 dimen, static void determine_gain_weights_fx( const Word32* gain, Word16* weights, const Word16 dims ); -static void QuantizeSHBsubgains_fx( Encoder_State_fx* st_fx, Word16* subgains, const Word16 extl ); +static void QuantizeSHBsubgains_fx( Encoder_State* st_fx, Word16* subgains, const Word16 extl ); -static void QuantizeSHBframegain_fx( Encoder_State_fx* st_fx, Word32* GainFrame, const Word16 extl, Word32 extl_brate +static void QuantizeSHBframegain_fx( Encoder_State* st_fx, Word32* GainFrame, const Word16 extl, Word32 extl_brate ,Word16 *rf_gainFrame_ind); static Word16 closest_centroid_fx( const Word16* data, const Word16* weights, @@ -55,10 +55,10 @@ static void EstimateSHBGainShape_fx( const Word16 length, static Word32 pow_off_pk_fx( Word16 a[], Word16 len, Word16 step ); -static void find_max_mem_enc( Encoder_State_fx *st_fx, Word16 *n_mem, Word16 *n_mem2 ); -static void rescale_genSHB_mem_enc( Encoder_State_fx* st_fx, Word16 sf ); -static void find_max_mem_wb_enc( Encoder_State_fx* st_fx, Word16* n_mem ); -static void rescale_genWB_mem_enc( Encoder_State_fx* st_fx, Word16 sf ); +static void find_max_mem_enc( Encoder_State *st_fx, Word16 *n_mem, Word16 *n_mem2 ); +static void rescale_genSHB_mem_enc( Encoder_State* st_fx, Word16 sf ); +static void find_max_mem_wb_enc( Encoder_State* st_fx, Word16* n_mem ); +static void rescale_genWB_mem_enc( Encoder_State* st_fx, Word16 sf ); static void Quant_lower_LSF_fx( const Word16 lsf[], Word16 lsf_q[], @@ -68,11 +68,11 @@ static Word16 Quant_mirror_point_fx( const Word16 lsf[], const Word16 lsf_q[], Word16* m ); static Word16 Find_LSF_grid_fx( const Word16 lsf[], Word16 lsf_q[], const Word16 m ); -static void Quant_BWE_LSF_fx( Encoder_State_fx* st_fx, const Word16 lsp_shb[], Word16 Q_lsfs[]); -static void Quant_shb_ener_sf_fx(Encoder_State_fx *st_fx, Word32 *shb_ener_sf_fx_32, Word16 Q_shb); -static void Quant_shb_res_gshape_fx(Encoder_State_fx *st_fx, Word16 *shb_res_gshape_fx); +static void Quant_BWE_LSF_fx( Encoder_State* st_fx, const Word16 lsp_shb[], Word16 Q_lsfs[]); +static void Quant_shb_ener_sf_fx(Encoder_State *st_fx, Word32 *shb_ener_sf_fx_32, Word16 Q_shb); +static void Quant_shb_res_gshape_fx(Encoder_State *st_fx, Word16 *shb_res_gshape_fx); -static void gainFrSmooth_En_fx(Encoder_State_fx *st_fx, +static void gainFrSmooth_En_fx(Encoder_State *st_fx, Word16 *shb_frame_fx, const Word16 *lpc_shb_fx, const Word16 *lsp_shb_fx, @@ -88,7 +88,7 @@ static void gainFrSmooth_En_fx(Encoder_State_fx *st_fx, * Find norm and max in TBE memories and past buffers *-------------------------------------------------------------------*/ void find_max_mem_enc( - Encoder_State_fx *st_fx, + Encoder_State *st_fx, Word16 *n_mem, Word16 *n_mem2 ) @@ -140,7 +140,7 @@ void find_max_mem_enc( /* for total_brate > 16.4kbps, use n_mem2; else account for the max2 for n_mem calculation */ *n_mem2 = norm_s(max2); if(max2 == 0) *n_mem2 = 15; - if(LT_32(st_fx->total_brate_fx, ACELP_24k40)) + if(LT_32(st_fx->total_brate, ACELP_24k40)) { max = s_max(max, max2); } @@ -152,7 +152,7 @@ void find_max_mem_enc( tempQ15 = abs_s( hBWE_TD->tbe_premph_fx ); max = s_max(max, tempQ15); - IF( EQ_16(st_fx->extl_fx, FB_TBE)) + IF( EQ_16(st_fx->extl, FB_TBE)) { FOR ( i = 0; i < LPC_SHB_ORDER; i++ ) { @@ -189,7 +189,7 @@ void find_max_mem_enc( * * Rescale genSHB memories *-------------------------------------------------------------------*/ -void rescale_genSHB_mem_enc( Encoder_State_fx* st_fx, Word16 sf ) +void rescale_genSHB_mem_enc( Encoder_State* st_fx, Word16 sf ) { Word16 i; TD_BWE_ENC_HANDLE hBWE_TD = st_fx->hBWE_TD; @@ -207,7 +207,7 @@ void rescale_genSHB_mem_enc( Encoder_State_fx* st_fx, Word16 sf ) } /* -- Apply memory scaling for 13.2 and 16.4k bps using sf ----*/ - IF(LT_32(st_fx->total_brate_fx, ACELP_24k40)) + IF(LT_32(st_fx->total_brate, ACELP_24k40)) { FOR ( i = 0; i < LPC_SHB_ORDER; i++ ) { @@ -232,7 +232,7 @@ void rescale_genSHB_mem_enc( Encoder_State_fx* st_fx, Word16 sf ) } -void find_max_mem_wb_enc( Encoder_State_fx* st_fx, Word16* n_mem ) +void find_max_mem_wb_enc( Encoder_State* st_fx, Word16* n_mem ) { Word16 i; Word16 n_mem_32; @@ -306,7 +306,7 @@ void find_max_mem_wb_enc( Encoder_State_fx* st_fx, Word16* n_mem ) *n_mem = s_max( *n_mem, 0 ); } -void rescale_genWB_mem_enc( Encoder_State_fx* st_fx, Word16 sf ) +void rescale_genWB_mem_enc( Encoder_State* st_fx, Word16 sf ) { Word16 i; TD_BWE_ENC_HANDLE hBWE_TD = st_fx->hBWE_TD; @@ -361,7 +361,7 @@ void rescale_genWB_mem_enc( Encoder_State_fx* st_fx, Word16 sf ) * Initialize SWB buffers *-------------------------------------------------------------------*/ void InitSWBencBuffer_fx( - Encoder_State_fx* st_fx /* i/o: SHB encoder structure */ + Encoder_State* st_fx /* i/o: SHB encoder structure */ ) { Word16 i; @@ -463,7 +463,7 @@ void InitSWBencBuffer_fx( * *-------------------------------------------------------------------*/ void ResetSHBbuffer_Enc_fx( - Encoder_State_fx* st_fx /* i/o: SHB encoder structure */ + Encoder_State* st_fx /* i/o: SHB encoder structure */ ) { TD_BWE_ENC_HANDLE hBWE_TD = st_fx->hBWE_TD; @@ -476,7 +476,7 @@ void ResetSHBbuffer_Enc_fx( set16_fx( hBWE_TD->state_syn_shbexc_fx, 0, L_SHB_LAHEAD ); set16_fx( hBWE_TD->state_lpc_syn_fx, 0, LPC_SHB_ORDER ); - //IF( EQ_16(st_fx->extl_fx, FB_TBE)) _DIFF_FLOAT_FIX_ + //IF( EQ_16(st_fx->extl, FB_TBE)) _DIFF_FLOAT_FIX_ { set16_fx( hBWE_TD->fb_state_lpc_syn_fx, 0, LPC_SHB_ORDER ); hBWE_TD->fb_tbe_demph_fx = 0; @@ -516,7 +516,7 @@ void ResetSHBbuffer_Enc_fx( /* Word16 *synth o : WB SHB final synthesis */ /*--------------------------------------------------------------------------*/ /* INPUT/OUTPUT ARGUMENTS : */ -/* Encoder_State_fx *st_fx i/o: encoder state structure */ +/* Encoder_State *st_fx i/o: encoder state structure */ /*--------------------------------------------------------------------------*/ /* RETURN ARGUMENTS : */ /* _ None */ @@ -531,7 +531,7 @@ void ResetSHBbuffer_Enc_fx( #define WBTBE_LPCWIN_LENGTH (L_LOOK_12k8 + L_SUBFR + L_FRAME) * 5/16 - 1 void wb_tbe_enc_fx( - Encoder_State_fx *st_fx, /* i/o: encoder state structure */ + Encoder_State *st_fx, /* i/o: encoder state structure */ const Word16 coder_type, /* i : coding type */ const Word16 *hb_speech, /* i : HB target signal (6-8kHz) at 16kHz at Q-1 */ const Word32 *bwe_exc_extended, /* i : bandwidth extended exciatation */ @@ -599,8 +599,8 @@ void wb_tbe_enc_fx( test(); test(); test(); - IF ( ( NE_16 (st_fx->last_extl_fx, WB_TBE) && NE_16( st_fx->last_extl_fx, WB_BWE)) - && ( EQ_16( st_fx->clas_fx, UNVOICED_CLAS) || ( LT_16( voicing_fx[0], 16384 ) && LT_16( voicing_fx[1], 16384 ) && LT_16( voicing_fx[2], 16384 ) ) ) + IF ( ( NE_16 (st_fx->last_extl, WB_TBE) && NE_16( st_fx->last_extl, WB_BWE)) + && ( EQ_16( st_fx->clas, UNVOICED_CLAS) || ( LT_16( voicing_fx[0], 16384 ) && LT_16( voicing_fx[1], 16384 ) && LT_16( voicing_fx[2], 16384 ) ) ) && st_fx->igf == 0 ) { /* In case of unvoiced signals after switching cores, back-propagate the target signal */ @@ -669,7 +669,7 @@ void wb_tbe_enc_fx( move16(); test(); - IF ( EQ_16(st_fx->rf_mode, 1)||EQ_32(st_fx->extl_brate_fx,WB_TBE_0k35)) + IF ( EQ_16(st_fx->rf_mode, 1)||EQ_32(st_fx->extl_brate,WB_TBE_0k35)) { E_LPC_lev_dur(R_h, R_l, lpc_wb, LepsP, LPC_SHB_ORDER_LBR_WB, NULL); Copy_Scale_sig( lpc_wb, lpc_wb, LPC_SHB_ORDER_LBR_WB+1, sub(norm_s(lpc_wb[0]),2) ); @@ -792,7 +792,7 @@ void wb_tbe_enc_fx( uv_flag = 0; move16(); test(); - if( EQ_32(st_fx->extl_brate_fx, WB_TBE_1k05)&&EQ_16(st_fx->coder_type_raw_fx,UNVOICED)) + if( EQ_32(st_fx->extl_brate, WB_TBE_1k05)&&EQ_16(st_fx->coder_type_raw,UNVOICED)) { uv_flag = 1; move16(); @@ -806,7 +806,7 @@ void wb_tbe_enc_fx( /*vf_modified[i] = 0.8f * voice_factors[i] + 0.2f * voice_factors[i-1];*/ vf_modified_fx[i] = add( mult_r( 26214, voice_factors[i] ), mult_r( 6553, voice_factors[i - 1] ) ); } - IF( NE_16(st_fx->L_frame_fx, L_FRAME)) + IF( NE_16(st_fx->L_frame, L_FRAME)) { vf_modified_fx[4] = add( mult_r( 26214, voice_factors[4] ), mult_r( 6553, voice_factors[3] ) ); } @@ -982,7 +982,7 @@ void wb_tbe_enc_fx( p2m_in = pow_off_pk_fx( GainShape, shr(NUM_SHB_SUBFR,2), 1 ); move16(); - IF( EQ_32(st_fx->extl_brate_fx,WB_TBE_0k35)) + IF( EQ_32(st_fx->extl_brate,WB_TBE_0k35)) { FOR( i = 0; i < 8; i++ ) { @@ -996,7 +996,7 @@ void wb_tbe_enc_fx( push_indice_fx( st_fx->hBstr, IND_UV_FLAG, uv_flag, 1 ); /* Quantization of the subframe gain parameter */ - QuantizeSHBsubgains_fx( st_fx, GainShape, st_fx->extl_fx ); + QuantizeSHBsubgains_fx( st_fx, GainShape, st_fx->extl ); } /* Compute the power of gains away from the peak gain after quantization */ @@ -1083,7 +1083,7 @@ void wb_tbe_enc_fx( } /* Quantization of the frame gain parameter */ - QuantizeSHBframegain_fx( st_fx, &GainFrame, st_fx->extl_fx, st_fx->extl_brate_fx, &hRF->RF_bwe_gainFr_ind); + QuantizeSHBframegain_fx( st_fx, &GainFrame, st_fx->extl, st_fx->extl_brate, &hRF->RF_bwe_gainFr_ind); /* Adjust the subframe and frame gain of the synthesized SHB signal */ /* Scale the shaped excitation*/ @@ -1133,7 +1133,7 @@ void fb_tbe_reset_enc_fx( /* _(Word16*)fb_slope_fx : slope +ve (high freq > low freq), -ve or neutral Q12 */ /*--------------------------------------------------------------------------------------*/ /* INPUT/OUTPUT ARGUMENTS : */ -/* _ Encoder_State_fx *st_fx: : Encoder state structure */ +/* _ Encoder_State *st_fx: : Encoder state structure */ /*--------------------------------------------------------------------------------------*/ /* RETURN ARGUMENTS : */ /* _ None */ @@ -1142,7 +1142,7 @@ void fb_tbe_reset_enc_fx( /*======================================================================================*/ void swb_tbe_enc_fx( - Encoder_State_fx *st_fx, /* i/o: encoder state structure */ + Encoder_State *st_fx, /* i/o: encoder state structure */ const Word16 coder_type_fx, /* i : coding type */ Word16 *shb_speech_fx, /* i : SHB target signal (6-14kHz) at 16kHz Q_shb*/ Word32 *bwe_exc_extended, /* i : bandwidth extended exciatation 2*Q_new*/ @@ -1251,7 +1251,7 @@ void swb_tbe_enc_fx( /* Spectral smoothing of autocorrelation coefficients */ test(); - IF( (st_fx->rf_mode != 0) || EQ_32( st_fx->total_brate_fx, ACELP_9k60 )) + IF( (st_fx->rf_mode != 0) || EQ_32( st_fx->total_brate, ACELP_9k60 )) { FOR( i = 1; i <= LPC_SHB_ORDER; i++ ) { @@ -1288,7 +1288,7 @@ void swb_tbe_enc_fx( /* Expand bandwidth of the LP coeffs */ test(); - IF( (st_fx->rf_mode != 0) || EQ_32( st_fx->total_brate_fx, ACELP_9k60 )) + IF( (st_fx->rf_mode != 0) || EQ_32( st_fx->total_brate, ACELP_9k60 )) { FOR( i = 1; i <= LPC_SHB_ORDER; i++ ) { @@ -1312,7 +1312,7 @@ void swb_tbe_enc_fx( Copy( lsf_shb_fx, lsf_shb_orig_fx, LPC_SHB_ORDER ); test(); - IF( (EQ_16(st_fx->rf_mode,1))||EQ_32(st_fx->total_brate_fx,ACELP_9k60)) + IF( (EQ_16(st_fx->rf_mode,1))||EQ_32(st_fx->total_brate,ACELP_9k60)) { lsp_weights_fx( lsf_shb_fx, weights_lsp, LPC_SHB_ORDER, &Q_out ); @@ -1366,7 +1366,7 @@ void swb_tbe_enc_fx( vf_modified_fx[i] = mac_r(L_tmp, voice_factors_fx[i-1], 6554); move16(); } - IF( NE_16(st_fx->L_frame_fx, L_FRAME)) + IF( NE_16(st_fx->L_frame, L_FRAME)) { L_tmp = L_mult(voice_factors_fx[4], 26214); vf_modified_fx[4] = mac_r(L_tmp, voice_factors_fx[3], 6554); @@ -1378,7 +1378,7 @@ void swb_tbe_enc_fx( E_LPC_lsf_lsp_conversion(lsf_shb_fx, lsp_shb_2_fx, LPC_SHB_ORDER); test(); - IF( EQ_16(st_fx->last_extl_fx, SWB_TBE)||EQ_16(st_fx->last_extl_fx,FB_TBE)) + IF( EQ_16(st_fx->last_extl, SWB_TBE)||EQ_16(st_fx->last_extl,FB_TBE)) { /* SHB LSP values from prev. frame for interpolation */ Copy(hBWE_TD->swb_lsp_prev_interp_fx, lsp_shb_1_fx, LPC_SHB_ORDER); @@ -1406,7 +1406,7 @@ void swb_tbe_enc_fx( tmp2 = shr(mult(31715,tmp),2); /* Q11 */ tilt_para = add(sub(tmp1,tmp2),1335);/*Q10*/ - IF(NE_16(st_fx->last_extl_fx,SWB_TBE)) + IF(NE_16(st_fx->last_extl,SWB_TBE)) { FOR( i=1; itotal_brate_fx,ACELP_16k40)) + IF( LE_32(st_fx->total_brate,ACELP_16k40)) { test(); test(); @@ -1463,7 +1463,7 @@ void swb_tbe_enc_fx( shb_ener_sf_Q31 = 0; move16(); test(); - IF ( EQ_32(st_fx->total_brate_fx, ACELP_24k40 )||EQ_32(st_fx->total_brate_fx,ACELP_32k)) + IF ( EQ_32(st_fx->total_brate, ACELP_24k40 )||EQ_32(st_fx->total_brate,ACELP_32k)) { /* ---------- SHB LSP interpolation ---------- */ ptr_lsp_interp_coef_fx = interpol_frac_shb; /* Q15 */ @@ -1610,13 +1610,13 @@ void swb_tbe_enc_fx( GenShapedSHBExcitation_fx( shaped_shb_excitation_fx + L_SHB_LAHEAD, lpc_shb_fx, White_exc16k_fx, hBWE_TD->mem_csfilt_fx, hBWE_TD->mem_genSHBexc_filt_down_shb_fx, hBWE_TD->state_lpc_syn_fx, - coder_type_fx, bwe_exc_extended_16, hBWE_TD->bwe_seed, vf_modified_fx, st_fx->extl_fx, + coder_type_fx, bwe_exc_extended_16, hBWE_TD->bwe_seed, vf_modified_fx, st_fx->extl, &(hBWE_TD->tbe_demph_fx ), &(hBWE_TD->tbe_premph_fx ), lpc_shb_sf_fx, shb_ener_sf_Q31, shb_res_gshape_fx, shb_res_fx, &vf_ind_fx, formant_fac_fx, hBWE_TD->fb_state_lpc_syn_fx, - &(hBWE_TD->fb_tbe_demph_fx), &Q_bwe_exc,&Q_bwe_exc_fb, Q_shb, n_mem2, st_fx->prev_Q_bwe_syn, st_fx->total_brate_fx, 0 ); + &(hBWE_TD->fb_tbe_demph_fx), &Q_bwe_exc,&Q_bwe_exc_fb, Q_shb, n_mem2, st_fx->prev_Q_bwe_syn, st_fx->total_brate, 0 ); *Q_white_exc = Q_bwe_exc_fb; - IF( EQ_16(st_fx->extl_fx, FB_TBE)) + IF( EQ_16(st_fx->extl, FB_TBE)) { hBWE_TD->prev_Q_bwe_exc_fb = Q_bwe_exc_fb; } @@ -1629,7 +1629,7 @@ void swb_tbe_enc_fx( } test(); - IF( EQ_32(st_fx->total_brate_fx, ACELP_24k40)||EQ_32(st_fx->total_brate_fx,ACELP_32k)) + IF( EQ_32(st_fx->total_brate, ACELP_24k40)||EQ_32(st_fx->total_brate,ACELP_32k)) { IF( EQ_16( st_fx->codec_mode, MODE2 )) { @@ -1834,7 +1834,7 @@ void swb_tbe_enc_fx( /* Quantization of the gain shape parameter */ - QuantizeSHBsubgains_fx( st_fx, GainShape_fx, st_fx->extl_fx ); + QuantizeSHBsubgains_fx( st_fx, GainShape_fx, st_fx->extl ); /* o: GainShape_fx in Q15 */ /* Compute the power of gains away from the peak gain after quantization */ p2m_out_fx = pow_off_pk_fx( GainShape_fx, NUM_SHB_SUBFR, 4 ); @@ -1887,7 +1887,7 @@ void swb_tbe_enc_fx( /* Gain attenuation when the SWB LSF quantization error is larger than a threshold */ tmp = mult_r(25600/*400 Q6*/, sd_uq_q_fx); /* Q6 * Q15 => Q6 */ - IF(EQ_16(st_fx->L_frame_fx, L_FRAME)) + IF(EQ_16(st_fx->L_frame, L_FRAME)) { tmp1 = mult_r(6554/*0.2f Q15*/, tmp); /* Q15, Q6 => Q6 */ L_tmp = L_msu(8192l/*1.0f Q13*/, tmp1, tmp); /* Q13 */ @@ -1945,18 +1945,18 @@ void swb_tbe_enc_fx( GainFrame_fx = Mult_32_16(GainFrame_fx, tmp); /* Q18 + Q15 + 1 - 16 : Q18 */ test(); - IF(EQ_16(st_fx->L_frame_fx, L_FRAME16k)||EQ_16(st_fx->rf_mode,1)) + IF(EQ_16(st_fx->L_frame, L_FRAME16k)||EQ_16(st_fx->rf_mode,1)) { /* Compensate for energy increase mismatch due to memory-less synthesis*/ GainFrame_fx = Mult_32_16(GainFrame_fx, 27853/*0.85f Q15*/ ); /* Q18 */ } /* Quantization of the frame gain parameter */ - QuantizeSHBframegain_fx( st_fx, &GainFrame_fx, st_fx->extl_fx, 0, &hRF->RF_bwe_gainFr_ind ); + QuantizeSHBframegain_fx( st_fx, &GainFrame_fx, st_fx->extl, 0, &hRF->RF_bwe_gainFr_ind ); /* Adjust the subframe and frame gain of the synthesized SHB signal */ /* Scale the shaped excitation */ - IF( EQ_32(st_fx->extl_fx,FB_TBE)) + IF( EQ_32(st_fx->extl,FB_TBE)) { tmp = norm_l( GainFrame_fx ); if(GainFrame_fx == 0) @@ -2697,7 +2697,7 @@ static Word16 closest_centroid_lc_fx( /*------------------------------------------------------------*/ static void QuantizeSHBsubgains_fx( - Encoder_State_fx *st_fx, /* i/o: encoder state structure */ + Encoder_State *st_fx, /* i/o: encoder state structure */ Word16 subgains[], /* i/o: super highband temporal gains Q15*/ const Word16 extl /* i : extension layer */ ) @@ -2817,7 +2817,7 @@ static void QuantizeSHBsubgains_fx( *-------------------------------------------------------------------*/ static void Quant_shb_ener_sf_fx( - Encoder_State_fx *st_fx, /* i/o: encoder state structure */ + Encoder_State *st_fx, /* i/o: encoder state structure */ Word32 *shb_ener_sf_Q31, /* i/o: super highband subframe energies */ Word16 Q_ener ) @@ -2870,7 +2870,7 @@ static void Quant_shb_ener_sf_fx( *-------------------------------------------------------------------*/ static void Quant_shb_res_gshape_fx( - Encoder_State_fx *st_fx, /* i/o: encoder state structure */ + Encoder_State *st_fx, /* i/o: encoder state structure */ Word16 shb_res_gshape_fx[] /* i/o: super highband gain shapes Q14 */ ) { @@ -2913,7 +2913,7 @@ static void Quant_shb_res_gshape_fx( /* */ /*==========================================================================*/ static void QuantizeSHBframegain_fx( - Encoder_State_fx* st_fx, /* i/o: encoder state structure */ + Encoder_State* st_fx, /* i/o: encoder state structure */ Word32* GainFrame, /* i/o: Gain Q18 */ const Word16 extl, /* i : extension layer */ Word32 extl_brate /* i : extension layer bitrate */ @@ -3448,7 +3448,7 @@ static Word16 Find_LSF_grid_fx( * * Gain frame smoothing and attenuation control *-------------------------------------------------------------------*/ -static void gainFrSmooth_En_fx(Encoder_State_fx *st_fx, +static void gainFrSmooth_En_fx(Encoder_State *st_fx, Word16 *shb_frame_fx, const Word16 *lpc_shb_fx, const Word16 *lsp_shb_fx, @@ -3512,8 +3512,8 @@ static void gainFrSmooth_En_fx(Encoder_State_fx *st_fx, test(); test(); - IF( NE_16( st_fx->last_extl_fx, SWB_TBE ) - && NE_16(st_fx->last_extl_fx, FB_TBE) + IF( NE_16( st_fx->last_extl, SWB_TBE ) + && NE_16(st_fx->last_extl, FB_TBE) && LT_16( lsp_spacing, 262 ) ) { hBWE_TD->lsp_shb_spacing_fx[0] = lsp_spacing; @@ -3549,7 +3549,7 @@ static void gainFrSmooth_En_fx(Encoder_State_fx *st_fx, *frGainAttenuate = 1; move16(); - IF( NE_32(st_fx->total_brate_fx , ACELP_24k40)) + IF( NE_32(st_fx->total_brate , ACELP_24k40)) { Copy( shb_frame_fx, temp_shb_frame, L_FRAME16k + L_SHB_LAHEAD ); fir_fx( temp_shb_frame, lpc_shb_fx, shb_frame_fx, hBWE_TD->shb_inv_filt_mem_fx, L_FRAME16k + L_SHB_LAHEAD, LPC_SHB_ORDER, 1,3); @@ -3577,7 +3577,7 @@ static void gainFrSmooth_En_fx(Encoder_State_fx *st_fx, static void Quant_BWE_LSF_fx( - Encoder_State_fx* st_fx, /* i/o: encoder state structure */ + Encoder_State* st_fx, /* i/o: encoder state structure */ const Word16 lsf_shb[], /* i : unquanitzed LSFs */ Word16 Q_lsfs[] /* o : quanitzed LSFs */ ) @@ -3646,7 +3646,7 @@ static void Quant_BWE_LSF_fx( *-------------------------------------------------------------------*/ void fb_tbe_enc_fx( - Encoder_State_fx *st, /* i/o: encoder state structure */ + Encoder_State *st, /* i/o: encoder state structure */ const Word16 new_input[], /* i : input speech at 48 kHz sample rate */ const Word16 fb_exc[], /* i : FB excitation from the SWB part */ Word16 Q_fb_exc @@ -3682,7 +3682,7 @@ void fb_tbe_enc_fx( elliptic_bpf_48k_generic_fx( input_fhb, &exp_temp , tmp_vec, hBWE_TD->elliptic_bpf_2_48k_mem_fx, hBWE_TD->elliptic_bpf_2_48k_mem_fx_Q,full_band_bpf_2_fx ); Sample_Delay_HP = NS2SA(48000, ACELP_LOOK_NS + DELAY_FD_BWE_ENC_12k8_NS + DELAY_FIR_RESAMPL_NS) - L_FRAME48k/2 ; - IF( NE_16(st->last_extl_fx,FB_TBE)) + IF( NE_16(st->last_extl,FB_TBE)) { set16_fx( hBWE_TD->old_input_fhb_fx, 0, Sample_Delay_HP ); hBWE_TD->old_input_fhb_fx_Q = 0; @@ -3769,7 +3769,7 @@ void fb_tbe_enc_fx( return; } void tbe_write_bitstream_fx( - Encoder_State_fx *st_fx /* i/o: encoder state structure */ + Encoder_State *st_fx /* i/o: encoder state structure */ ) { Word16 i; @@ -3782,7 +3782,7 @@ void tbe_write_bitstream_fx( test(); test(); test(); - IF ( ( st_fx->rf_mode || EQ_32( st_fx->total_brate_fx, ACELP_9k60 ))&&(EQ_16(st_fx->bwidth_fx,WB))) + IF ( ( st_fx->rf_mode || EQ_32( st_fx->total_brate, ACELP_9k60 ))&&(EQ_16(st_fx->bwidth,WB))) { /* WB LSF */ push_next_indice_fx(hBstr, hBWE_TD->lsf_WB, NUM_BITS_LBR_WB_LSF ); @@ -3790,13 +3790,13 @@ void tbe_write_bitstream_fx( /* WB frame */ push_next_indice_fx(hBstr, hBWE_TD->gFrame_WB, NUM_BITS_SHB_FrameGain_LBR_WB ); } - ELSE IF ( ( GE_32( st_fx->total_brate_fx, ACELP_9k60 ))&&(LE_32(st_fx->total_brate_fx,ACELP_32k))&& - ( ( EQ_16( st_fx->bwidth_fx, SWB ) ) || ( EQ_16( st_fx->bwidth_fx, FB ) ) ) ) + ELSE IF ( ( GE_32( st_fx->total_brate, ACELP_9k60 ))&&(LE_32(st_fx->total_brate,ACELP_32k))&& + ( ( EQ_16( st_fx->bwidth, SWB ) ) || ( EQ_16( st_fx->bwidth, FB ) ) ) ) { /* LSF coefficients */ test(); - IF( (EQ_16(st_fx->rf_mode,1))||EQ_32(st_fx->total_brate_fx,ACELP_9k60)) + IF( (EQ_16(st_fx->rf_mode,1))||EQ_32(st_fx->total_brate,ACELP_9k60)) { push_next_indice_fx(hBstr, hBWE_TD->lsf_idx[0], 8 ); } @@ -3820,7 +3820,7 @@ void tbe_write_bitstream_fx( /* frame gain */ push_next_indice_fx(hBstr, hBWE_TD->idxFrameGain, NUM_BITS_SHB_FRAMEGAIN ); - IF ( GE_32( st_fx->total_brate_fx, ACELP_24k40 )) + IF ( GE_32( st_fx->total_brate, ACELP_24k40 )) { /* sub frame energy*/ push_next_indice_fx(hBstr, hBWE_TD->idx_shb_fr_gain, NUM_BITS_SHB_ENER_SF ); @@ -3842,7 +3842,7 @@ void tbe_write_bitstream_fx( } } - IF ( EQ_16( st_fx->bwidth_fx, FB )) + IF ( EQ_16( st_fx->bwidth, FB )) { push_next_indice_fx(hBstr, hBWE_TD->idxGain, 4 ); } @@ -3850,13 +3850,13 @@ void tbe_write_bitstream_fx( void TBEreset_enc_fx( - Encoder_State_fx *st_fx, /* i/o: encoder state structure */ + Encoder_State *st_fx, /* i/o: encoder state structure */ Word16 bandwidth /* i : bandwidth mode */ ) { TD_BWE_ENC_HANDLE hBWE_TD = st_fx->hBWE_TD; - IF( NE_16(st_fx->last_core_fx,ACELP_CORE)) + IF( NE_16(st_fx->last_core,ACELP_CORE)) { set16_fx( hBWE_TD->old_bwe_exc_fx, 0, PIT16k_MAX * 2 ); hBWE_TD->bwe_non_lin_prev_scale_fx = L_deposit_l(0); diff --git a/lib_enc/tcx_utils_enc_fx.c b/lib_enc/tcx_utils_enc_fx.c index bd6e31cf0..4bc1335ac 100644 --- a/lib_enc/tcx_utils_enc_fx.c +++ b/lib_enc/tcx_utils_enc_fx.c @@ -200,7 +200,7 @@ void detectLowpassFac(const Word32 *powerSpec, Word16 powerSpec_e, Word16 L_fram * Detect low pass if present. * *-----------------------------------------------------------*/ void AnalyzePowerSpectrum_fx( - Encoder_State_fx *st, /* i/o: encoder states */ + Encoder_State *st, /* i/o: encoder states */ Word16 L_frame, /* input: frame length */ Word16 L_frameTCX, /* input: full band frame length */ Word16 left_overlap, /* input: left overlap length */ @@ -276,8 +276,8 @@ void AnalyzePowerSpectrum_fx( tmp8 = 0; move16(); test(); - if ( L_msu0(L_mult0(st->L_frame_fx, extract_l(st->last_sr_core)), st->L_frame_past, extract_l(st->sr_core)) != 0 - || NE_16(st->last_core_fx, TCX_20_CORE ) ) + if ( L_msu0(L_mult0(st->L_frame, extract_l(st->last_sr_core)), st->L_frame_past, extract_l(st->sr_core)) != 0 + || NE_16(st->last_core, TCX_20_CORE ) ) { tmp8 = 1; move16(); @@ -285,19 +285,19 @@ void AnalyzePowerSpectrum_fx( ComputeSpectrumNoiseMeasure_fx(powerSpec, L_frameTCX, - divide3216(L_mult(hTcxEnc->nmStartLine, L_frame), st->L_frame_fx), + divide3216(L_mult(hTcxEnc->nmStartLine, L_frame), st->L_frame), tmp8, hTcxEnc->memQuantZeros_fx, lowpassLine); - IF( LE_32(st->total_brate_fx, ACELP_24k40)) + IF( LE_32(st->total_brate, ACELP_24k40)) { lowpassLine = shl(mult(st->hTcxCfg->bandwidth, L_frame), 1); test(); detectLowpassFac(powerSpec, *powerSpec_e, L_frame, - sub(st->last_core_fx, ACELP_CORE) == 0, + sub(st->last_core, ACELP_CORE) == 0, &hTcxEnc->measuredBwRatio, lowpassLine); } @@ -1410,7 +1410,7 @@ void tcx_encoder_memory_update_fx( const Word16 *A, /* i: Quantized LPC coefficients */ Word16 preemph, /* i: preemphasis factor */ LPD_state *LPDmem, /* i/o: coder memory state */ - Encoder_State_fx *st, + Encoder_State *st, Word16 *synthout, Word16 Q_new, Word16 shift @@ -1827,7 +1827,7 @@ Word16 tcx_res_Q_spec_fx( } void ProcessIGF_fx( IGF_ENC_INSTANCE_HANDLE const hInstance, /**< in: instance handle of IGF Encoder */ - Encoder_State_fx *st, /**< in: Encoder state */ + Encoder_State *st, /**< in: Encoder state */ Word32 pMDCTSpectrum[], /**< in: MDCT spectrum */ Word16 *pMDCTSpectrum_e, Word32 pPowerSpectrum[], /**< in: MDCT^2 + MDST^2 spectrum, or estimate */ @@ -1883,7 +1883,7 @@ void ProcessIGF_fx( *pPowerSpectrum_e, isTCX20, /**< in: flag indicating if the input is TCX20 or TCX10/2xTCX5 */ isTNSActive, /**< in: flag indicating if the TNS is active */ - (st->last_core_fx == ACELP_CORE) + (st->last_core == ACELP_CORE) ); { const Word32 tns_predictionGain = st->hIGFEnc->tns_predictionGain; diff --git a/lib_enc/tns_base_enc_fx.c b/lib_enc/tns_base_enc_fx.c index cddd8ff75..320b0e656 100644 --- a/lib_enc/tns_base_enc_fx.c +++ b/lib_enc/tns_base_enc_fx.c @@ -327,7 +327,7 @@ Word16 EncodeTnsData_fx(STnsConfig const * pTnsConfig, STnsData const * pTnsData return TNS_NO_ERROR; } -Word16 WriteTnsData_fx(STnsConfig const * pTnsConfig, Word16 const * stream, Word16 * pnSize, Encoder_State_fx *st, Word16 * pnBits) +Word16 WriteTnsData_fx(STnsConfig const * pTnsConfig, Word16 const * stream, Word16 * pnSize, Encoder_State *st, Word16 * pnBits) { IF ( GT_16(pTnsConfig->nMaxFilters,1)) diff --git a/lib_enc/transient_detection_fx.c b/lib_enc/transient_detection_fx.c index b3a11d116..68a05f32b 100644 --- a/lib_enc/transient_detection_fx.c +++ b/lib_enc/transient_detection_fx.c @@ -312,7 +312,7 @@ void RunTransientDetection_fx(Word16 const * input, Word16 nSamplesAvailable, Tr #endif } -void SetTCXModeInfo_fx(Encoder_State_fx *st, +void SetTCXModeInfo_fx(Encoder_State *st, TransientDetection const * pTransientDetection, Word16 * tcxModeOverlap) { @@ -334,7 +334,7 @@ void SetTCXModeInfo_fx(Encoder_State_fx *st, test(); IF ( ((pTransientDetection->transientDetector.bIsAttackPresent != 0) || (GT_32(Mpy_32_16_1(st->currEnergyHF_fx, 840/*1.0f/39.0f Q15*/), st->prevEnergyHF_fx) )) - && ((NE_16(st->last_core_fx, ACELP_CORE) ) && (NE_16(st->last_core_fx, AMR_WB_CORE) )) ) + && ((NE_16(st->last_core, ACELP_CORE) ) && (NE_16(st->last_core, AMR_WB_CORE) )) ) { move16(); hTcxEnc->tcxMode = TCX_10; @@ -365,7 +365,7 @@ void SetTCXModeInfo_fx(Encoder_State_fx *st, } test(); test(); - IF (st->last_core_fx == ACELP_CORE || st->last_core_fx == AMR_WB_CORE) + IF (st->last_core == ACELP_CORE || st->last_core == AMR_WB_CORE) { move16(); st->hTcxCfg->tcx_last_overlap_mode = TRANSITION_OVERLAP; diff --git a/lib_enc/transition_enc_fx.c b/lib_enc/transition_enc_fx.c index baf2a2db7..d4013c0ac 100644 --- a/lib_enc/transition_enc_fx.c +++ b/lib_enc/transition_enc_fx.c @@ -18,7 +18,7 @@ static void gain_trans_enc_fx(Word32 gain_trans32, Word16 exc[], Word16 *quant_index, Word16 *quant_sign, Word16 Q_new); -static void tc_enc_fx(Encoder_State_fx *st_fx, const Word16 i_subfr, Word16 *tc_subfr, Word16 *position, +static void tc_enc_fx(Encoder_State *st_fx, const Word16 i_subfr, Word16 *tc_subfr, Word16 *position, const Word16 *h1_fx, const Word16 *xn_fx, Word16 *exc_fx, Word16 *yy1_fx, Word16 *T0_min, Word16 *T0_max, Word16 *T0, Word16 *T0_frac, Word16 *gain_pit_fx, Word16 g_corr_fx[], Word16 *bwe_exc_fx, Word16 Q_new); @@ -61,7 +61,7 @@ static void tc_enc_fx(Encoder_State_fx *st_fx, const Word16 i_subfr, Word16 *tc_ /*--------------------------------------------------------------------------*/ void transition_enc_fx( - Encoder_State_fx *st_fx,/* i/o: encoder state structure */ + Encoder_State *st_fx,/* i/o: encoder state structure */ const Word16 i_subfr, /* i : subframe index */ Word16 *tc_subfr, /* i/o: TC subframe index */ Word16 *Jopt_flag, /* i : joint optimization flag */ @@ -106,7 +106,7 @@ void transition_enc_fx( * convert pitch values to 16kHz domain *----------------------------------------------------------------*/ - IF(EQ_16(st_fx->L_frame_fx, L_FRAME) /*|| (tdm_Pri_pitch_buf != NULL && tdm_Pri_pitch_buf[0] < 0)*/) + IF(EQ_16(st_fx->L_frame, L_FRAME) /*|| (tdm_Pri_pitch_buf != NULL && tdm_Pri_pitch_buf[0] < 0)*/) { Copy(st_fx->pitch_fx, T_op, 2); } @@ -137,20 +137,20 @@ void transition_enc_fx( IF( limit_flag == 0 ) { test(); - IF( EQ_16(st_fx->L_frame_fx,L_FRAME) && LT_16(T_op[1],PIT_MIN) ) + IF( EQ_16(st_fx->L_frame,L_FRAME) && LT_16(T_op[1],PIT_MIN) ) { mult_Top = 2; move16(); } test(); - if( EQ_16(st_fx->L_frame_fx,L_FRAME16k) && LT_16(T_op[1],PIT16k_MIN)) + if( EQ_16(st_fx->L_frame,L_FRAME16k) && LT_16(T_op[1],PIT16k_MIN)) { mult_Top = 2; move16(); } } - limit_T0_fx( st_fx->L_frame_fx, 8, 0, limit_flag, mult_Top*T_op[1], 0, T0_min, T0_max ); + limit_T0_fx( st_fx->L_frame, 8, 0, limit_flag, mult_Top*T_op[1], 0, T0_min, T0_max ); } /*-----------------------------------------------------------------* @@ -172,7 +172,7 @@ void transition_enc_fx( set16_fx(&exc_fx[i_subfr], 0, L_SUBFR); /* set excitation for current subrame to 0 */ - IF( EQ_16(st_fx->L_frame_fx,L_FRAME)) + IF( EQ_16(st_fx->L_frame,L_FRAME)) { set16_fx(&bwe_exc_fx[i_subfr*HIBND_ACB_L_FAC], 0, (Word16)(L_SUBFR*HIBND_ACB_L_FAC)); /* set past excitation buffer to 0 */ } @@ -198,7 +198,7 @@ void transition_enc_fx( *-----------------------------------------------------------------*/ ELSE IF ( EQ_16(*tc_subfr,i_subfr)) { - IF( EQ_16(st_fx->L_frame_fx,L_FRAME)) + IF( EQ_16(st_fx->L_frame,L_FRAME)) { set16_fx( bwe_exc_fx-PIT_MAX*HIBND_ACB_L_FAC, 0, PIT_MAX*HIBND_ACB_L_FAC); /* set past excitation buffer to 0 */ } @@ -213,12 +213,12 @@ void transition_enc_fx( IF (EQ_16(*tc_subfr, TC_0_0) ) { /* this is called only to compute unused bits */ - config_acelp1(ENC, st_fx->total_brate_fx, st_fx->core_brate_fx, st_fx->core_fx, st_fx->extl_fx, st_fx->extl_brate_fx, + config_acelp1(ENC, st_fx->total_brate, st_fx->core_brate, st_fx->core, st_fx->extl, st_fx->extl_brate, L_FRAME, -1, &(st_fx->acelp_cfg), hBstr->nb_bits_tot_fx, TRANSITION, TC_0_0, 3, NULL, unbits_ACELP, st_fx->element_mode, &i /*dummy*/, 0 /*tdm_lp_reuse_flag*/, 0 /*tdm_low_rate_mode*/, st_fx->idchan, st_fx->active_fr_cnt_fx, 0 /*tdm_Pitch_reuse_flag*/, st_fx->tdm_LRTD_flag, 0 /*GSC_IVAS_mode*/ ); } - *clip_gain = gp_clip_fx(st_fx->element_mode, st_fx->core_brate_fx, st_fx->voicing_fx, i_subfr, TRANSITION, xn_fx, gp_cl_fx, sub(shift_wsp,1) ); + *clip_gain = gp_clip_fx(st_fx->element_mode, st_fx->core_brate, st_fx->voicing_fx, i_subfr, TRANSITION, xn_fx, gp_cl_fx, sub(shift_wsp,1) ); updt_tar_fx( xn_fx, xn2_fx, y1_fx, *gain_pit_fx, L_SUBFR ); **pt_pitch_fx = shl(add(shl(*T0,2),*T0_frac),4); @@ -236,7 +236,7 @@ void transition_enc_fx( *--------------------------------------------------------------*/ ELSE IF ( LT_16(*tc_subfr,i_subfr)) { - IF( EQ_16(st_fx->L_frame_fx,L_FRAME)) + IF( EQ_16(st_fx->L_frame,L_FRAME)) { *Jopt_flag = 1; move16(); @@ -287,7 +287,7 @@ void transition_enc_fx( *T0 = pitch_fr4_fx( &exc_fx[i_subfr], xn_fx, h1_fx, *T0_min, *T0_max, T0_frac, pit_flag, limit_flag, pit_start, pit_limit, L_FRAME, L_SUBFR ); - offset = tbe_celp_exc_offset(*T0, *T0_frac, st_fx->L_frame_fx); + offset = tbe_celp_exc_offset(*T0, *T0_frac, st_fx->L_frame); FOR (i=0; itotal_brate_fx, st_fx->core_brate_fx, st_fx->core_fx, st_fx->extl_fx, st_fx->extl_brate_fx, - st_fx->L_frame_fx, -1, &(st_fx->acelp_cfg), hBstr->nb_bits_tot_fx, TRANSITION, *tc_subfr, 2, NULL, + config_acelp1(ENC, st_fx->total_brate, st_fx->core_brate, st_fx->core, st_fx->extl, st_fx->extl_brate, + st_fx->L_frame, -1, &(st_fx->acelp_cfg), hBstr->nb_bits_tot_fx, TRANSITION, *tc_subfr, 2, NULL, unbits_ACELP, st_fx->element_mode, &i /*dummy*/, 0 /*tdm_lp_reuse_flag*/, 0 /*tdm_low_rate_mode*/, st_fx->idchan, st_fx->active_fr_cnt_fx, 0 /*tdm_Pitch_reuse_flag*/, st_fx->tdm_LRTD_flag, 0 /*GSC_IVAS_mode*/); } /*-----------------------------------------------------------------* @@ -394,7 +394,7 @@ void transition_enc_fx( pred_lt4(&exc_fx[i_subfr], &exc_fx[i_subfr], *T0, *T0_frac, L_SUBFR+1, pitch_inter4_2, L_INTERPOL2, PIT_UP_SAMP); - offset = tbe_celp_exc_offset(*T0, *T0_frac, st_fx->L_frame_fx); + offset = tbe_celp_exc_offset(*T0, *T0_frac, st_fx->L_frame); FOR (i=0; iL_frame_fx); + offset = tbe_celp_exc_offset(*T0, *T0_frac, st_fx->L_frame); FOR (i=0; iL_frame_fx); + offset = tbe_celp_exc_offset(*T0, *T0_frac, st_fx->L_frame); FOR (i=0; iL_frame_fx); + offset = tbe_celp_exc_offset(*T0, *T0_frac, st_fx->L_frame); FOR (i=0; iL_frame_fx); + offset = tbe_celp_exc_offset(*T0, *T0_frac, st_fx->L_frame); FOR (i=0; ielement_mode, st_fx->core_brate_fx, st_fx->voicing_fx, i_subfr, TRANSITION, xn_fx, gp_cl_fx, (Q_new+shift-1) ); + *clip_gain = gp_clip_fx(st_fx->element_mode, st_fx->core_brate, st_fx->voicing_fx, i_subfr, TRANSITION, xn_fx, gp_cl_fx, (Q_new+shift-1) ); lp_select = lp_filt_exc_enc_fx( MODE1, TRANSITION, i_subfr, exc_fx, h1_fx, - xn_fx, y1_fx, xn2_fx, L_SUBFR, st_fx->L_frame_fx, g_corr_fx, *clip_gain, gain_pit_fx, &lp_flag ); + xn_fx, y1_fx, xn2_fx, L_SUBFR, st_fx->L_frame, g_corr_fx, *clip_gain, gain_pit_fx, &lp_flag ); IF( EQ_16(lp_flag,NORMAL_OPERATION)) { @@ -729,7 +729,7 @@ void transition_enc_fx( IF( EQ_16(nBits,10)) { - *T0 = pitch_fr4_fx( &exc_fx[i_subfr], xn_fx, h1_fx, *T0_min, *T0_max, T0_frac, 0, limit_flag, PIT16k_FR2_EXTEND_10b, PIT16k_MAX, st_fx->L_frame_fx, L_SUBFR ); + *T0 = pitch_fr4_fx( &exc_fx[i_subfr], xn_fx, h1_fx, *T0_min, *T0_max, T0_frac, 0, limit_flag, PIT16k_FR2_EXTEND_10b, PIT16k_MAX, st_fx->L_frame, L_SUBFR ); pit16k_Q_enc_fx( hBstr, nBits, limit_flag, *T0, *T0_frac, T0_min, T0_max ); } ELSE IF( EQ_16(nBits,8)) /* tc_subfr==0 && i_subfr==L_SUBFR */ @@ -739,7 +739,7 @@ void transition_enc_fx( * PIT16k_MIN to PIT16k_FR2_TC0_2SUBFR-1 resolution 1/4 (frac = 0,1,2 or 3) * PIT16k_FR2_TC0_2SUBFR to 2*L_SUBFR resolution 1/2 (frac = 0 or 2) *-----------------------------------------------------------------------------*/ - *T0 = pitch_fr4_fx( &exc_fx[i_subfr], xn_fx, h1_fx, *T0_min, *T0_max, T0_frac, 0, limit_flag, PIT16k_FR2_TC0_2SUBFR, 2*L_SUBFR, st_fx->L_frame_fx, L_SUBFR ); + *T0 = pitch_fr4_fx( &exc_fx[i_subfr], xn_fx, h1_fx, *T0_min, *T0_max, T0_frac, 0, limit_flag, PIT16k_FR2_TC0_2SUBFR, 2*L_SUBFR, st_fx->L_frame, L_SUBFR ); IF( GT_16(*T0_max,2*L_SUBFR)) { @@ -764,7 +764,7 @@ void transition_enc_fx( ELSE IF( EQ_16(nBits,6)) { /* delta search */ - *T0 = pitch_fr4_fx( &exc_fx[i_subfr], xn_fx, h1_fx, *T0_min, *T0_max, T0_frac, L_SUBFR, limit_flag, PIT16k_FR2_EXTEND_9b, PIT16k_FR1_EXTEND_9b, st_fx->L_frame_fx, L_SUBFR ); + *T0 = pitch_fr4_fx( &exc_fx[i_subfr], xn_fx, h1_fx, *T0_min, *T0_max, T0_frac, L_SUBFR, limit_flag, PIT16k_FR2_EXTEND_9b, PIT16k_FR1_EXTEND_9b, st_fx->L_frame, L_SUBFR ); index = delta_pit_enc_fx( 4, *T0, *T0_frac, *T0_min ); push_indice_fx( hBstr, IND_PITCH, index, nBits ); @@ -820,10 +820,10 @@ void transition_enc_fx( bwe_exc_fx[i + i_subfr * 2] = bwe_exc_fx[i + i_subfr * 2 - offset + 4]; } - *clip_gain = gp_clip_fx(st_fx->element_mode, st_fx->core_brate_fx, st_fx->voicing_fx, i_subfr, TRANSITION, xn_fx, gp_cl_fx,Q_new ); + *clip_gain = gp_clip_fx(st_fx->element_mode, st_fx->core_brate, st_fx->voicing_fx, i_subfr, TRANSITION, xn_fx, gp_cl_fx,Q_new ); lp_select = lp_filt_exc_enc_fx( MODE1, TRANSITION, i_subfr, exc_fx, h1_fx, - xn_fx, y1_fx, xn2_fx, L_SUBFR, st_fx->L_frame_fx, g_corr_fx, *clip_gain, gain_pit_fx, &lp_flag ); + xn_fx, y1_fx, xn2_fx, L_SUBFR, st_fx->L_frame, g_corr_fx, *clip_gain, gain_pit_fx, &lp_flag ); IF( EQ_16(lp_flag,NORMAL_OPERATION)) { @@ -881,7 +881,7 @@ void transition_enc_fx( *-------------------------------------------------------------------------------------------*/ static void tc_enc_fx( - Encoder_State_fx *st_fx,/* i/o: encoder state structure */ + Encoder_State *st_fx,/* i/o: encoder state structure */ const Word16 i_subfr, /* i : subrame index */ Word16 *tc_subfr, /* i/o: TC subframe index */ Word16 *position, /* i/o: index of the residual signal maximum */ @@ -925,7 +925,7 @@ static void tc_enc_fx( *T0_frac = 0; move16(); - IF( EQ_16(st_fx->L_frame_fx,L_FRAME)) + IF( EQ_16(st_fx->L_frame,L_FRAME)) { test(); IF( (LE_16(*T0_min,L_SUBFR))||(EQ_16(*tc_subfr,3*L_SUBFR))) @@ -955,7 +955,7 @@ static void tc_enc_fx( move16(); } } - ELSE /* st_fx->L_frame_fx == L_FRAME16k */ + ELSE /* st_fx->L_frame == L_FRAME16k */ { IF( EQ_16(nBits,10)) { @@ -980,7 +980,7 @@ static void tc_enc_fx( test(); test(); test(); - if( i_subfr == 0 && EQ_16(st_fx->L_frame_fx,L_FRAME)&&(LT_16(*T0,L_SUBFR)||EQ_16(*tc_subfr,3*L_SUBFR))) + if( i_subfr == 0 && EQ_16(st_fx->L_frame,L_FRAME)&&(LT_16(*T0,L_SUBFR)||EQ_16(*tc_subfr,3*L_SUBFR))) { *tc_subfr = TC_0_0; move16(); @@ -1008,7 +1008,7 @@ static void tc_enc_fx( pred_lt4_tc_fx( exc_fx, *T0, *T0_frac, inter4_2_fx, imp_pos, i_subfr ); IF (st_fx->hBWE_TD != NULL) { - IF(EQ_16(st_fx->L_frame_fx, L_FRAME)) + IF(EQ_16(st_fx->L_frame, L_FRAME)) { interp_code_5over2_fx(&exc_fx[i_subfr], &bwe_exc_fx[i_subfr * HIBND_ACB_L_FAC], L_SUBFR); } @@ -1033,7 +1033,7 @@ static void tc_enc_fx( /*--------------------------------------------------------------* * Encode parameters and write indices *--------------------------------------------------------------*/ - IF( EQ_16(st_fx->L_frame_fx,L_FRAME)) + IF( EQ_16(st_fx->L_frame,L_FRAME)) { test(); test(); @@ -1075,7 +1075,7 @@ static void tc_enc_fx( } } } - ELSE /* st_fx->L_frame_fx == L_FRAME16k */ + ELSE /* st_fx->L_frame == L_FRAME16k */ { IF( EQ_16(nBits,10)) { diff --git a/lib_enc/updt_enc_fx.c b/lib_enc/updt_enc_fx.c index 5c93894a9..cebb93d9c 100644 --- a/lib_enc/updt_enc_fx.c +++ b/lib_enc/updt_enc_fx.c @@ -19,7 +19,7 @@ *-------------------------------------------------------------------*/ void updt_enc_fx( - Encoder_State_fx *st, /* i/o: state structure */ + Encoder_State *st, /* i/o: state structure */ const Word16 *old_exc, /* i : buffer of excitation */ const Word16 *pitch_buf, /* i : floating pitch for each subframe */ const Word16 Es_pred, /* i : predicited scaled innovation energy */ @@ -36,9 +36,9 @@ void updt_enc_fx( TD_BWE_ENC_HANDLE hBWE_TD = st->hBWE_TD; /* update old excitation buffer */ - Copy( &old_exc[st->L_frame_fx], hLPDmem->old_exc, L_EXC_MEM ); + Copy( &old_exc[st->L_frame], hLPDmem->old_exc, L_EXC_MEM ); test(); - IF( !st->Opt_AMR_WB_fx && st->hBWE_TD != NULL) + IF( !st->Opt_AMR_WB && st->hBWE_TD != NULL) { Copy( &old_bwe_exc[L_FRAME32k], hBWE_TD->old_bwe_exc_fx, PIT16k_MAX * 2 ); } @@ -48,32 +48,32 @@ void updt_enc_fx( Copy( lsf_new, st->lsf_old_fx, M ); /* update last coder type */ - st->last_coder_type_fx = st->coder_type; + st->last_coder_type = st->coder_type; move16(); test(); test(); test(); - if( EQ_16(st->coder_type,INACTIVE) || (EQ_16(st->bpf_off_fx,1) && NE_16(st->coder_type,AUDIO) && NE_16(st->coder_type,TRANSITION))) + if( EQ_16(st->coder_type,INACTIVE) || (EQ_16(st->bpf_off,1) && NE_16(st->coder_type,AUDIO) && NE_16(st->coder_type,TRANSITION))) { - st->last_coder_type_fx = UNVOICED; + st->last_coder_type = UNVOICED; move16(); } - /* this ensures that st->last_coder_type_fx is never set to INACTIVE in case of AVQ inactive because the FEC does not distinguish between GSC inactive and AVQ inactive */ + /* this ensures that st->last_coder_type is never set to INACTIVE in case of AVQ inactive because the FEC does not distinguish between GSC inactive and AVQ inactive */ test(); - if ( EQ_16(st->coder_type,INACTIVE) && GT_32(st->total_brate_fx,ACELP_24k40)) + if ( EQ_16(st->coder_type,INACTIVE) && GT_32(st->total_brate,ACELP_24k40)) { - st->last_coder_type_fx = GENERIC; + st->last_coder_type = GENERIC; move16(); } test(); test(); test(); - IF( st->Opt_AMR_WB_fx && EQ_16(st->coder_type,INACTIVE) && st->core_brate_fx!=SID_1k75 && st->core_brate_fx!=FRAME_NO_DATA) + IF( st->Opt_AMR_WB && EQ_16(st->coder_type,INACTIVE) && st->core_brate!=SID_1k75 && st->core_brate!=FRAME_NO_DATA) { /* overwrite previous coding type to help FEC */ - st->last_coder_type_fx = UNVOICED; + st->last_coder_type = UNVOICED; move16(); } @@ -92,16 +92,16 @@ void updt_enc_fx( } /* convert old LSP vector from 12kHz domain to 16kHz domain (needed in case of ACELP@12k8 <-> ACELP@16kHz switching) */ - IF( EQ_16(st->L_frame_fx,L_FRAME)) + IF( EQ_16(st->L_frame,L_FRAME)) { Copy( st->lsp_old_fx, st->lsp_old16k_fx, M ); - st->rate_switching_reset_16kHz=lsp_convert_poly_fx( st->lsp_old16k_fx, L_FRAME16k, st->Opt_AMR_WB_fx ); + st->rate_switching_reset_16kHz=lsp_convert_poly_fx( st->lsp_old16k_fx, L_FRAME16k, st->Opt_AMR_WB ); } /* update buffer of old subframe pitch values */ - IF( NE_16(st->last_L_frame_fx,st->L_frame_fx)) + IF( NE_16(st->last_L_frame,st->L_frame)) { - IF( EQ_16(st->L_frame_fx,L_FRAME)) + IF( EQ_16(st->L_frame,L_FRAME)) { FOR( i=0; iL_frame_fx,6); + tmp = shr(st->L_frame,6); Copy( &st->old_pitch_buf_fx[tmp], st->old_pitch_buf_fx, tmp); Copy( pitch_buf, &st->old_pitch_buf_fx[tmp], tmp); /* SC-VBR */ - st->last_Opt_SC_VBR_fx = st->Opt_SC_VBR_fx; + st->last_Opt_SC_VBR = st->Opt_SC_VBR; move16(); IF(st->hSC_VBR != NULL) { @@ -137,7 +137,7 @@ void updt_enc_fx( move16(); } /* core switching updates */ - Copy( &Aq[(st->L_frame_fx/L_SUBFR-1)*(M+1)], st->old_Aq_12_8_fx, M+1 ); + Copy( &Aq[(st->L_frame/L_SUBFR-1)*(M+1)], st->old_Aq_12_8_fx, M+1 ); st->old_Es_pred_fx = Es_pred; return; @@ -150,7 +150,7 @@ void updt_enc_fx( *-------------------------------------------------------------------*/ void updt_IO_switch_enc_fx( - Encoder_State_fx *st, /* i/o: state structure */ + Encoder_State *st, /* i/o: state structure */ const Word16 input_frame /* i : input frame length */ ) { @@ -163,13 +163,13 @@ void updt_IO_switch_enc_fx( TD_BWE_ENC_HANDLE hBWE_TD = st->hBWE_TD; FD_BWE_ENC_HANDLE hBWE_FD = st->hBWE_FD; - IF( EQ_16(st->last_core_fx,AMR_WB_CORE)) /* switching to EVS primary mode */ + IF( EQ_16(st->last_core,AMR_WB_CORE)) /* switching to EVS primary mode */ { /* reset onset detection counter */ - st->tc_cnt_fx = -1; + st->tc_cnt = -1; /* force safety-net LSFQ in the first frames after the switching */ - st->Nb_ACELP_frames_fx = 0; + st->Nb_ACELP_frames = 0; move16(); /* AMR-WB IO mode uses ISF(ISP), but EVS primary mode LSF(LSP) */ @@ -277,7 +277,7 @@ void updt_IO_switch_enc_fx( /* gain quantization memory */ set16_fx(hAmrwb_IO->past_qua_en_fx, (-14*1024), GAIN_PRED_ORDER ); /* reset VBR signalling */ - IF (st->Opt_SC_VBR_fx) + IF (st->Opt_SC_VBR) { hSC_VBR->ppp_mode = 0; move16(); @@ -320,7 +320,7 @@ void updt_IO_switch_enc_fx( *-------------------------------------------------------------------*/ #if 1 void updt_enc_common_fx( - Encoder_State_fx* st, /* i/o: encoder state structure */ + Encoder_State* st, /* i/o: encoder state structure */ const Word16 Etot, /* i : total energy */ const Word16 Q_new /* i : CUrrent frame scaling */ ) @@ -333,36 +333,36 @@ void updt_enc_common_fx( move32(); st->last_codec_mode = st->codec_mode; move16(); - st->last_L_frame_fx = st->L_frame_fx; // + st->last_L_frame = st->L_frame; // move16(); - st->last_core_fx = st->core_fx; + st->last_core = st->core; move16(); - st->last_core_brate_fx = st->core_brate_fx; + st->last_core_brate = st->core_brate; move32(); #ifdef IVAS_CODE st->last_bits_frame_nominal_fx = st->bits_frame_nominal; #endif - st->last_total_brate_fx = st->total_brate_fx; + st->last_total_brate = st->total_brate; move32(); - st->last_extl_fx = st->extl_fx; // + st->last_extl = st->extl; // move16(); - st->last_input_bwidth_fx = st->input_bwidth_fx; //## + st->last_input_bwidth = st->input_bwidth; //## move16(); - st->last_bwidth_fx = st->bwidth_fx; //## + st->last_bwidth = st->bwidth; //## move16(); st->hNoiseEst->Etot_last_fx = Etot; move16(); - st->last_coder_type_raw_fx = st->coder_type_raw_fx; + st->last_coder_type_raw = st->coder_type_raw; move16(); st->prev_Q_new = Q_new; move16(); test(); - if (GT_32(st->core_brate_fx, SID_2k40) && st->hDtxEnc != NULL) + if (GT_32(st->core_brate, SID_2k40) && st->hDtxEnc != NULL) { - st->hDtxEnc->last_active_brate = st->total_brate_fx; + st->hDtxEnc->last_active_brate = st->total_brate; move32(); } @@ -370,7 +370,7 @@ void updt_enc_common_fx( { st->hBWE_TD->prev_coder_type = st->coder_type; move16(); - if (EQ_16(st->core_fx, HQ_CORE)) + if (EQ_16(st->core, HQ_CORE)) { /* in the HQ core, coder_type is not used so it could have been set to anything */ st->hBWE_TD->prev_coder_type = GENERIC; @@ -380,9 +380,9 @@ void updt_enc_common_fx( } test(); - IF(st->Opt_DTX_ON_fx && st->hTdCngEnc != NULL) + IF(st->Opt_DTX_ON && st->hTdCngEnc != NULL) { - IF(GT_32(st->core_brate_fx, SID_2k40) ) + IF(GT_32(st->core_brate, SID_2k40) ) { IF(EQ_16(st->hDtxEnc->first_CNG, 1)) { @@ -419,7 +419,7 @@ void updt_enc_common_fx( } test(); test(); test(); - if( (EQ_32(st->core_brate_fx, SID_2k40) || EQ_32(st->core_brate_fx, FRAME_NO_DATA)) && st->hDtxEnc->first_CNG == 0 && EQ_16(st->cng_type_fx, LP_CNG)) + if( (EQ_32(st->core_brate, SID_2k40) || EQ_32(st->core_brate, FRAME_NO_DATA)) && st->hDtxEnc->first_CNG == 0 && EQ_16(st->cng_type, LP_CNG)) { st->hDtxEnc->first_CNG = 1; move16(); @@ -431,14 +431,14 @@ void updt_enc_common_fx( * Limit the max number of init. frames *-----------------------------------------------------------------*/ - if (LT_16(st->ini_frame_fx, MAX_FRAME_COUNTER)) + if (LT_16(st->ini_frame, MAX_FRAME_COUNTER)) { - st->ini_frame_fx = add(st->ini_frame_fx, 1); + st->ini_frame = add(st->ini_frame, 1); } /* synchronisation of CNG seeds */ test();test();test(); - IF (st->hTdCngEnc != NULL && NE_32(st->core_brate_fx, FRAME_NO_DATA) && NE_32(st->core_brate_fx, SID_2k40) && NE_16(st->core_fx, AMR_WB_CORE)) + IF (st->hTdCngEnc != NULL && NE_32(st->core_brate, FRAME_NO_DATA) && NE_32(st->core_brate, SID_2k40) && NE_16(st->core, AMR_WB_CORE)) { Random(&(st->hTdCngEnc->cng_seed)); Random(&(st->hTdCngEnc->cng_ener_seed)); @@ -453,32 +453,32 @@ void updt_enc_common_fx( st->codec_mode = MODE2; move16(); - st->sr_core = getCoreSamplerateMode2(EVS_MONO, st->total_brate_fx, st->bwidth_fx, st->flag_ACELP16k, st->rf_mode, 0); + st->sr_core = getCoreSamplerateMode2(EVS_MONO, st->total_brate, st->bwidth, st->flag_ACELP16k, st->rf_mode, 0); - //st->L_frame_fx = extract_l(Mult_32_16(st->sr_core, 0x0290)); /*(int16_t)(st->sr_core / FRAMES_PER_SEC);*/ + //st->L_frame = extract_l(Mult_32_16(st->sr_core, 0x0290)); /*(int16_t)(st->sr_core / FRAMES_PER_SEC);*/ IF (EQ_32(st->sr_core, INT_FS_12k8)) { st->preemph_fac = PREEMPH_FAC; st->gamma = GAMMA1; - st->L_frame_fx = L_FRAME; + st->L_frame = L_FRAME; move16(); move16(); move16(); } ELSE { st->preemph_fac = PREEMPH_FAC_16k; st->gamma = GAMMA16k; - st->L_frame_fx = L_FRAME16k; + st->L_frame = L_FRAME16k; move16();move16();move16(); } - st->igf = getIgfPresent_fx(EVS_MONO, st->total_brate_fx, st->bwidth_fx, st->rf_mode); + st->igf = getIgfPresent_fx(EVS_MONO, st->total_brate, st->bwidth, st->rf_mode); } /* update FER clas */ - if (NE_16(st->core_fx, AMR_WB_CORE)) + if (NE_16(st->core, AMR_WB_CORE)) { - st->last_clas_fx = st->clas_fx; + st->last_clas = st->clas; move16(); } @@ -508,7 +508,7 @@ void updt_enc_common_fx( IF (st->Opt_RF_ON) { - st->L_frame_fx = L_FRAME; + st->L_frame = L_FRAME; st->rf_mode = 1; move16();move16(); } diff --git a/lib_enc/vad_fx.c b/lib_enc/vad_fx.c index 5e1b13569..1021f79c9 100644 --- a/lib_enc/vad_fx.c +++ b/lib_enc/vad_fx.c @@ -173,7 +173,7 @@ static void sign_thr_snr_acc_fx( *-----------------------------------------------------------------*/ Word16 dtx_hangover_addition_fx( - Encoder_State_fx *st_fx, /* i/o: encoder state structure */ + Encoder_State *st_fx, /* i/o: encoder state structure */ const Word16 vad_flag, /* i Q0 */ const Word16 lp_snr, /* i Q8 */ const Word16 cldfb_subtraction, /* i Q0 number of DTX-HO frames CLDFB wants to reduce */ @@ -208,7 +208,7 @@ Word16 dtx_hangover_addition_fx( test(); test(); if ( ( ( LT_16(lp_snr,(16*256))) - && ( NE_16(st_fx->input_bwidth_fx, NB) )) + && ( NE_16(st_fx->input_bwidth, NB) )) || ( GT_16(hVAD->prim_act_he_fx, 31130) ) ) /*.95*Q15*/ { hangover_short_dtx = 3; @@ -237,7 +237,7 @@ Word16 dtx_hangover_addition_fx( tmp = 3; move16(); /* default for EVS*/ - if (EQ_16(st_fx->core_fx,AMR_WB_CORE)) + if (EQ_16(st_fx->core,AMR_WB_CORE)) { tmp = 2; move16(); /* default for AMRWBIO*/ @@ -246,8 +246,8 @@ Word16 dtx_hangover_addition_fx( /* need to be a bit stricter with the DTXHO in very clean WB, SWB cond for EVS12k8VAD section */ test(); test(); - if ( ( NE_16(st_fx->input_bwidth_fx, NB)) /* WB or SWB or FB */ - && ( NE_16(st_fx->core_fx, AMR_WB_CORE) ) + if ( ( NE_16(st_fx->input_bwidth, NB)) /* WB or SWB or FB */ + && ( NE_16(st_fx->core, AMR_WB_CORE) ) && ( GT_16(lp_snr, 25*256) ) ) { @@ -276,7 +276,7 @@ Word16 dtx_hangover_addition_fx( /* hangover adjustment from combined FFT+CLDFBVAD */ - IF (NE_16(st_fx->core_fx,AMR_WB_CORE)) + IF (NE_16(st_fx->core,AMR_WB_CORE)) { hangover_short_dtx = sub(hangover_short_dtx, cldfb_subtraction); hangover_short_dtx = s_max(hangover_short_dtx, 0); @@ -388,7 +388,7 @@ Word16 dtx_hangover_addition_fx( *-----------------------------------------------------------------*/ /* new simplified and harmonized code */ Word16 wb_vad_fx( - Encoder_State_fx *st_fx, /* i/o: encoder state structure */ + Encoder_State *st_fx, /* i/o: encoder state structure */ const Word32 fr_bands[], /* i : per band input energy (contains 2 vectors) Q_new+QSCALE*/ Word16 *noisy_speech_HO, /* o : SC-VBR noisy speech HO flag */ Word16 *clean_speech_HO, /* o : SC-VBR clean speech HO flag */ @@ -477,7 +477,7 @@ Word16 wb_vad_fx( move16(); } - vad_bwidth_fx = st_fx->input_bwidth_fx; + vad_bwidth_fx = st_fx->input_bwidth; move16(); L_snr_outlier = L_deposit_l(0); @@ -494,28 +494,28 @@ Word16 wb_vad_fx( IF( EQ_16(vad_bwidth_fx, NB)) { - st_fx->min_band_fx = 1; + st_fx->min_band = 1; move16(); - st_fx->max_band_fx = 16; + st_fx->max_band = 16; move16(); } ELSE { - st_fx->min_band_fx = 0; + st_fx->min_band = 0; move16(); - st_fx->max_band_fx = 19; + st_fx->max_band = 19; move16(); } /*_DIFF_FLOAT_FIX_ -> see around Ln1570, inversion in if conditions compared to float*/ //PMT("Error in EVS fixed point ?") /*FIXED EVS */ - /* ELSE IF(((LE_16(st_fx->last_coder_type_fx, UNVOICED)) && (LT_32(L_snr_outlier, MAX_SNR_OUTLIER_2_FX)) && (st_fx->Opt_SC_VBR_fx != 0)) || - ((LE_16(last_7k2_coder_type, UNVOICED)) && (LT_32(L_snr_outlier, MAX_SNR_OUTLIER_2_FX)) && (st_fx->Opt_SC_VBR_fx == 0)))*/ + /* ELSE IF(((LE_16(st_fx->last_coder_type, UNVOICED)) && (LT_32(L_snr_outlier, MAX_SNR_OUTLIER_2_FX)) && (st_fx->Opt_SC_VBR != 0)) || + ((LE_16(last_7k2_coder_type, UNVOICED)) && (LT_32(L_snr_outlier, MAX_SNR_OUTLIER_2_FX)) && (st_fx->Opt_SC_VBR == 0)))*/ /*FLOAT both IVAS and EVS */ /*if ((snr_outlier_index <= 4 && (st->last_coder_type > UNVOICED) && !st->Opt_SC_VBR) || (snr_outlier_index <= 4 && (last_7k2_coder_type > UNVOICED) && st->Opt_SC_VBR))*/ - IF ( 1)//st_fx->Opt_SC_VBR_fx) + IF ( 1)//st_fx->Opt_SC_VBR) { last_7k2_coder_type = st_fx->hSC_VBR->last_7k2_coder_type; move16(); @@ -528,7 +528,7 @@ Word16 wb_vad_fx( /*---------------------------------------------------------------------* * set SNR thresholds depending on the input bandwitdh *---------------------------------------------------------------------*/ - IF( EQ_16(st_fx->max_band_fx,19)) /* WB input */ /* or SWB input */ + IF( EQ_16(st_fx->max_band,19)) /* WB input */ /* or SWB input */ { nk = 3277; move16(); /*0.1 Q15 */ @@ -587,7 +587,7 @@ Word16 wb_vad_fx( hangover_short = 0; move16(); - /* IF( st_fx->Opt_SC_VBR_fx != 0 ) */ + /* IF( st_fx->Opt_SC_VBR != 0 ) */ *noisy_speech_HO = 0; move16(); *clean_speech_HO = 0; @@ -698,7 +698,7 @@ Word16 wb_vad_fx( move16(); - FOR( i=st_fx->min_band_fx; i<=st_fx->max_band_fx; i++ ) + FOR( i=st_fx->min_band; i<=st_fx->max_band; i++ ) { ftmp = L_add(*pt1++, 0); ftmp1 = L_add(*pt2++, 0); @@ -963,7 +963,7 @@ Word16 wb_vad_fx( test(); test(); test(); /* one additional test for ELSE IF */ - IF ( (EQ_16(st_fx->max_band_fx, 19)) + IF ( (EQ_16(st_fx->max_band, 19)) && ( GT_32(L_snr18, 5*(1<<4)) ) && ( GT_32(L_snr19, 5*(1<<4)) ) ) { @@ -996,7 +996,7 @@ Word16 wb_vad_fx( test(); test(); test(); - IF( ( EQ_16(st_fx->max_band_fx, 19)) + IF( ( EQ_16(st_fx->max_band, 19)) && LT_32(L_snr_outlier , MAX_SNR_OUTLIER_3_FX) && GT_16(snr_outlier_index, 3) && LT_16(snr_outlier_index, MAX_SNR_OUTLIER_IND_FX) ) @@ -1110,7 +1110,7 @@ Word16 wb_vad_fx( test(); test(); test(); - if (EQ_16(st_fx->max_band_fx, 16) + if (EQ_16(st_fx->max_band, 16) && GT_16(lp_snr, 40 * 256) && GT_16(thr1, 6600) && LT_16(lp_speech_fx, 11520)) @@ -1155,10 +1155,10 @@ Word16 wb_vad_fx( test(); test(); test(); /*_DIFF_FLOAT_FIX_ -> the conditions around Opt_SC_VBR_fx are invertered compared to float - ### st_fx->Opt_SC_VBR_fx!=0 vs !st_fx->Opt_SC_VBR #####*/ + ### st_fx->Opt_SC_VBR!=0 vs !st_fx->Opt_SC_VBR #####*/ test(); - IF( LE_16(snr_outlier_index, 4) && ( ( GT_16(st_fx->last_coder_type_fx,UNVOICED) && (st_fx->Opt_SC_VBR_fx!=0)) || - ( GT_16(last_7k2_coder_type, UNVOICED) && ( st_fx->Opt_SC_VBR_fx == 0 ) ) ) ) + IF( LE_16(snr_outlier_index, 4) && ( ( GT_16(st_fx->last_coder_type,UNVOICED) && (st_fx->Opt_SC_VBR!=0)) || + ( GT_16(last_7k2_coder_type, UNVOICED) && ( st_fx->Opt_SC_VBR == 0 ) ) ) ) { @@ -1167,8 +1167,8 @@ Word16 wb_vad_fx( snr_sum_ol = vad_snr_log_fx(hVAD->L_snr_sum_vad_fx, LG10); /* snr in Q8 */ } - ELSE IF ( ((LE_16(st_fx->last_coder_type_fx, UNVOICED)) && (LT_32(L_snr_outlier,MAX_SNR_OUTLIER_2_FX)) && ( st_fx->Opt_SC_VBR_fx != 0)) || - ((LE_16(last_7k2_coder_type, UNVOICED) ) && (LT_32(L_snr_outlier,MAX_SNR_OUTLIER_2_FX)) && ( st_fx->Opt_SC_VBR_fx == 0 ) ) ) + ELSE IF ( ((LE_16(st_fx->last_coder_type, UNVOICED)) && (LT_32(L_snr_outlier,MAX_SNR_OUTLIER_2_FX)) && ( st_fx->Opt_SC_VBR != 0)) || + ((LE_16(last_7k2_coder_type, UNVOICED) ) && (LT_32(L_snr_outlier,MAX_SNR_OUTLIER_2_FX)) && ( st_fx->Opt_SC_VBR == 0 ) ) ) { /* thr1_ol = thr1 + (float)(1.0f - 0.04f * snr_outlier); */ @@ -1414,14 +1414,14 @@ Word16 wb_vad_fx( { test(); test(); - if (EQ_16(st_fx->element_mode, EVS_MONO) && (LT_16(lp_snr,th_clean)) && (st_fx->Opt_SC_VBR_fx != 0 ) && (GE_16(hVAD->hangover_cnt, 2)) ) + if (EQ_16(st_fx->element_mode, EVS_MONO) && (LT_16(lp_snr,th_clean)) && (st_fx->Opt_SC_VBR != 0 ) && (GE_16(hVAD->hangover_cnt, 2)) ) { *noisy_speech_HO = 1; move16(); } test(); test(); - if (EQ_16(st_fx->element_mode, EVS_MONO) && (GE_16(lp_snr,th_clean)) && (st_fx->Opt_SC_VBR_fx != 0 ) && (GE_16(hVAD->hangover_cnt, 2) ) ) + if (EQ_16(st_fx->element_mode, EVS_MONO) && (GE_16(lp_snr,th_clean)) && (st_fx->Opt_SC_VBR != 0 ) && (GE_16(hVAD->hangover_cnt, 2) ) ) { *clean_speech_HO = 1; move16(); @@ -1509,7 +1509,7 @@ Word16 wb_vad_fx( /* -dtx condition dependency in noisy speech */ tmp = 333; move16(); /* 1.3f; */ - if ( st_fx->Opt_DTX_ON_fx == 0 ) + if ( st_fx->Opt_DTX_ON == 0 ) { tmp = 282; move16(); /* 1.10f; */ diff --git a/lib_enc/vad_param_updt_fx.c b/lib_enc/vad_param_updt_fx.c index c1313b3d7..61b4c2230 100644 --- a/lib_enc/vad_param_updt_fx.c +++ b/lib_enc/vad_param_updt_fx.c @@ -18,7 +18,7 @@ *--------------------------------------------------------------------*/ void vad_param_updt_fx( - Encoder_State_fx *st_fx, /* i/o: state structure */ + Encoder_State *st_fx, /* i/o: state structure */ const Word16 old_pitch1, /* i : OL pitch value from last frame */ const Word16 corr_shift, /* i : correlation shift Q15*/ const Word16 corr_shiftR, /* i : correlation shift */ @@ -44,7 +44,7 @@ void vad_param_updt_fx( move16(); move16(); hVAD = st_fx->hVAD; - ini_frame = st_fx->ini_frame_fx; + ini_frame = st_fx->ini_frame; move16();move16(); IF (hFrontVad != NULL) @@ -60,7 +60,7 @@ void vad_param_updt_fx( hVAD = hFrontVad[1]->hVAD; move16(); } - IF(!st_fx->Opt_AMR_WB_fx) + IF(!st_fx->Opt_AMR_WB) { /* fix explanation , after function dtx_fx, the "vad_flag" parameter can not be used for SID scheduling purposes any longer @@ -70,14 +70,14 @@ void vad_param_updt_fx( tmp_active_flag = 0; move16(); test(); - if ((NE_32(st_fx->core_brate_fx, (Word32)SID_2k40)) && (st_fx->core_brate_fx != 0)) /* Note, core_brate_fx can be -1 */ + if ((NE_32(st_fx->core_brate, (Word32)SID_2k40)) && (st_fx->core_brate != 0)) /* Note, core_brate_fx can be -1 */ { tmp_active_flag = 1; move16(); /* reqires active coding according to dtx_fx logic */ } test(); test(); - IF((st_fx->Opt_DTX_ON_fx != 0) && (tmp_active_flag == 0) && (GT_16(ini_frame, 3))) + IF((st_fx->Opt_DTX_ON != 0) && (tmp_active_flag == 0) && (GT_16(ini_frame, 3))) { @@ -145,12 +145,12 @@ void vad_param_updt_fx( /* Declare SID frame due to spectral tilt changes */ hDtxEnc->cnt_SID = 1; move16(); - st_fx->core_brate_fx = SID_2k40; + st_fx->core_brate = SID_2k40; move16(); hVAD->trigger_SID = 0; move16(); } - ELSE IF(EQ_32(st_fx->core_brate_fx, SID_2k40)) + ELSE IF(EQ_32(st_fx->core_brate, SID_2k40)) { /* SID fame has already been declared before */ hVAD->trigger_SID = 0; diff --git a/lib_enc/vbr_average_rate_fx.c b/lib_enc/vbr_average_rate_fx.c index d893c4b8e..9d0c6bce8 100644 --- a/lib_enc/vbr_average_rate_fx.c +++ b/lib_enc/vbr_average_rate_fx.c @@ -243,7 +243,7 @@ void update_average_rate_fx( hSC_VBR->numactive = add(hSC_VBR->numactive,1); /* sum the total number of bits (in kbytes) * 10 here */ - /*st->sum_of_rates += (hSC_VBR->core_brate_fx / 1000.0f) * 10; */ + /*st->sum_of_rates += (hSC_VBR->core_brate / 1000.0f) * 10; */ L_tmp = L_shl(Mult_32_16(core_brate_fx ,20972),7); #ifdef BASOP_NOGLOB hSC_VBR->sum_of_rates_fx = L_add_o(hSC_VBR->sum_of_rates_fx ,L_tmp, &Overflow); diff --git a/lib_enc/voiced_enc_fx.c b/lib_enc/voiced_enc_fx.c index f7c2fbfb4..3281637ee 100644 --- a/lib_enc/voiced_enc_fx.c +++ b/lib_enc/voiced_enc_fx.c @@ -40,13 +40,13 @@ static Word32 DTFS_getEngy_band_fx(DTFS_STRUCTURE X_fx,const Word16 lband,const /* OUTPUT ARGUMENTS : */ /* _ (Word16*) pitch_fx: floating pitch values for each subframe(Q6) */ /* _ (Word16*) out_fx: Quantized residual signal (Q0) */ -/* _ Encoder_State_fx *st_fx: */ +/* _ Encoder_State *st_fx: */ /* _ lastLgainE_fx - Q11 */ /* _ lastHgainE_fx - Q11 */ /* _ lasterbE_fx - Q13 */ /*---------------------------------------------------------------------------------------*/ /* INPUT/OUTPUT ARGUMENTS : */ -/* _ Encoder_State_fx *st_fx: */ +/* _ Encoder_State *st_fx: */ /* _ hSC_VBR->dtfs_enc_xxxx */ /* _ a nd b in hSC_VBR->dtfs_enc_Q */ /* rest all in Q0 */ diff --git a/lib_util/audio_file_reader.c b/lib_util/audio_file_reader.c index 44d1c2ddb..6911794ab 100644 --- a/lib_util/audio_file_reader.c +++ b/lib_util/audio_file_reader.c @@ -75,8 +75,7 @@ static int8_t AudioFileReader_open_wav( /*! r: AudioFileReader handle */ ivas_error AudioFileReader_open( AudioFileReader **audioReader, /* o : AudioFileReader handle */ - const char *fileName, /* i : path to wav/raw pcm file */ - short *isInputRawFile + const char *fileName /* i : path to wav/raw pcm file */ ) { AudioFileReader *self; @@ -105,12 +104,10 @@ ivas_error AudioFileReader_open( if ( fileNameLen > wavSuffixLen && strncmp( fileName + fileNameLen - wavSuffixLen, wavSuffix, wavSuffixLen ) == 0 ) { retCode = AudioFileReader_open_wav( self, fileName ); - *isInputRawFile = 0; } else { retCode = AudioFileReader_open_raw( self, fileName ); - *isInputRawFile = 1; } if ( retCode != 0 ) diff --git a/lib_util/audio_file_reader.h b/lib_util/audio_file_reader.h index 9275fb945..185d8c077 100644 --- a/lib_util/audio_file_reader.h +++ b/lib_util/audio_file_reader.h @@ -42,8 +42,7 @@ typedef struct AudioFileReader AudioFileReader; ivas_error AudioFileReader_open( AudioFileReader **audioReader, /* o : AudioFileReader handle */ - const char *fileName, /* i : path to wav/raw pcm file */ - short *isInputRawFile + const char *fileName /* i : path to wav/raw pcm file */ ); ivas_error AudioFileReader_read( -- GitLab