Loading lib_com/cnst.h +9 −0 Original line number Diff line number Diff line Loading @@ -209,6 +209,15 @@ enum{ #define L_FRAME8k 160 /* Frame size in samples at 8kHz */ #define L_FRAME4k 80 /* Frame size in samples at 4kHz */ #define ONE_BY_L_FRAME48k_Q31 2236962 #define ONE_BY_L_FRAME32k_Q31 3355443 #define ONE_BY_L_FRAME25_6k_Q31 4194304 #define ONE_BY_L_FRAME16k_Q31 6710886 #define ONE_BY_L_FRAME_Q31 8388608 #define ONE_BY_240_Q31 8947849 #define ONE_BY_L_FRAME8k_Q31 13421772 #define ONE_BY_L_FRAME4k_Q31 26843546 #define L_SPEC48k 800 /* HQ spectrum length at 48kHz */ #define L_SPEC32k 640 /* HQ spectrum length at 32kHz */ #define L_SPEC16k 320 /* HQ spectrum length at 16kHz */ Loading lib_com/ivas_prot_fx.h +17 −3 Original line number Diff line number Diff line Loading @@ -2700,7 +2700,6 @@ void rc_uni_enc_encode_bits( const Word16 bits /* i : Number of bits */ ); #ifdef IVAS_FLOAT_FIXED void stereo_dft_enc_process_fx( CPE_ENC_HANDLE hCPE, /* i/o: CPE encoder structure */ const Word16 vad_flag_dtx[], /* i : VAD dtx flags */ Loading @@ -2708,6 +2707,23 @@ void stereo_dft_enc_process_fx( const Word16 input_frame /* i : input frame length */ ); void stereo_dft_cng_side_gain_fx( STEREO_DFT_ENC_DATA_HANDLE hStereoDft, /* i/o: DFT stereo handle */ STEREO_CNG_ENC_HANDLE hStereoCng, /* i/o: Stereo CNG data structure */ const Word32 core_brate, /* i : core bitrate */ const Word32 last_core_brate, /* i : last core bitrate */ const Word16 bwidth /* i : audio band-width */ ); void stereo_cng_upd_counters_fx( STEREO_CNG_ENC_HANDLE hStereoCng, /* i/o: Stereo CNG data structure */ const Word32 element_mode, /* i : element mode */ const Word16 nbands, /* i : Number of bands in active */ const Word32 sidSideGain[], /* i : SID side gains */ const Word16 burst_ho_count, /* i : Hang-over count */ Word16 *coh_fade_counter /* i : Coherence fade counter */ ); void spectral_balancer_fx16( Word16 *signal, /* i/o : signal Qx */ Word16 *mem, /* i/o : mem Qx */ Loading Loading @@ -2763,8 +2779,6 @@ void acelp_fast_fx( const Word16 L_subfr /* i : subframe length */ ); #endif void ivas_mdct_quant_coder_fx( CPE_ENC_HANDLE hCPE, /* i/o: Encoder CPE handle */ Word16 tnsBits[CPE_CHANNELS][NB_DIV], /* i : bits needed for TNS parameters */ Loading lib_com/prot.h +3 −3 Original line number Diff line number Diff line Loading @@ -2381,7 +2381,7 @@ ivas_error acelp_core_enc( ivas_error acelp_core_enc( Encoder_State *st, /* i/o: encoder state structure */ /*const*/ float inp[], /* i : input signal of the current frame */ const float ener, /* i : residual energy from Levinson-Durbin */ // const float ener, /* i : residual energy from Levinson-Durbin */ float A[NB_SUBFR16k * ( M + 1 )], /* i : A(z) unquantized for the 4 subframes */ float Aw[NB_SUBFR16k * ( M + 1 )], /* i : weighted A(z) unquant. for subframes */ const float epsP[M + 1], /* i : LP prediction errors */ Loading lib_enc/acelp_core_enc.c +99 −7 Original line number Diff line number Diff line Loading @@ -64,7 +64,7 @@ ivas_error acelp_core_enc( Encoder_State *st, /* i/o: encoder state structure */ /*const*/ float inp[], /* i : input signal of the current frame */ const float ener, /* i : residual energy from Levinson-Durbin*/ // const float ener, /* i : residual energy from Levinson-Durbin*/ float A[NB_SUBFR16k * ( M + 1 )], /* i : A(z) unquantized for the 4 subframes*/ float Aw[NB_SUBFR16k * ( M + 1 )], /* i : weighted A(z) unquant. for subframes*/ const float epsP[M + 1], /* i : LP prediction errors */ Loading Loading @@ -142,6 +142,7 @@ ivas_error acelp_core_enc( Word16 exc2_fx[L_FRAME16k]; /* enhanced excitation */ Word16 Es_pred_fx; /* predicited scaled innovation energy */ Word16 tmp_noise_fx; /* NB post-filter long-term noise energy*/ // Word16 tc_subfr_fx; /* TC sub-frame indication */ Word16 old_bwe_exc_fx[( PIT16k_MAX + ( L_FRAME16k + 1 ) + L_SUBFR16k ) * 2]; /* excitation buffer */ Word16 Q_old_bwe_exc; Loading Loading @@ -170,11 +171,12 @@ ivas_error acelp_core_enc( Word32 gc_threshold_bck_fx; Word16 clip_var_bck_fx[6]; // Word16 next_force_sf_bck_fx; // Word32 q_env_fx[NUM_ENV_CNG]; Word32 q_env_fx[NUM_ENV_CNG]; // Word16 coder_type; Word16 exc3_fx[L_FRAME16k]; Word16 syn1_fx[L_FRAME16k]; Word16 *tdm_Pri_pitch_buf_fx; Word16 att_fx; Word16 lsp_new_fx[M]; /* i : LSPs at the end of the frame */ Loading Loading @@ -488,7 +490,7 @@ ivas_error acelp_core_enc( if ( st->cng_type == LP_CNG ) { /* Run CNG post parameter update */ #if 1 #ifdef IVAS_FLOAT_FIXED #ifdef IVAS_FLOAT_FIXED_CONVERSIONS FOR( Word16 ii = 0; ii < HO_HIST_SIZE; ii++ ) { Loading @@ -499,17 +501,106 @@ ivas_error acelp_core_enc( #endif cng_params_postupd_ivas_fx( st->hTdCngEnc->ho_circ_ptr, &st->hTdCngEnc->cng_buf_cnt, st->hTdCngEnc->cng_exc2_buf, st->hTdCngEnc->cng_Qexc_buf, st->hTdCngEnc->cng_brate_buf, st->hTdCngEnc->ho_env_circ_fx, st->element_mode, st->hFdCngEnc->hFdCngCom->CngBandwidth ); #ifdef IVAS_FLOAT_FIXED_CONVERSIONS Word16 q_inp; floatToFixed_arr( Aq, Aq_fx, NB_SUBFR16k * ( M + 1 ), Q12 ); q_inp = Q_factor_arr( inp, st->L_frame ); floatToFixed_arr( inp, inp_fx, q_inp, st->L_frame ); st->hTdCngEnc->CNG_att_fx = float_to_fix16( st->hTdCngEnc->CNG_att, Q7 ); floatToFixed_arr( lsp_mid, lsp_mid_fx, Q15, M ); floatToFixed_arr( lsp_new, lsp_new_fx, Q15, M ); floatToFixed_arr( st->lsp_old, st->lsp_old_fx, Q15, M ); floatToFixed_arr( st->hTdCngEnc->ho_lsp_hist, st->hTdCngEnc->ho_lsp_hist_fx, Q15, HO_HIST_SIZE * M ); floatToFixed_arr( st->hTdCngEnc->ho_lsp_circ, st->hTdCngEnc->ho_lsp_circ_fx, Q15, HO_HIST_SIZE * M ); floatToFixed_arr( st->hTdCngEnc->ho_lsp_circ2, st->hTdCngEnc->ho_lsp_circ2_fx, Q15, HO_HIST_SIZE * M ); floatToFixed_arrL( st->hTdCngEnc->ho_ener_hist, st->hTdCngEnc->ho_ener_hist_fx, Q6, HO_HIST_SIZE ); floatToFixed_arrL( st->hTdCngEnc->ho_ener_circ, st->hTdCngEnc->ho_ener_circ_fx, Q6, HO_HIST_SIZE ); floatToFixed_arr( st->hTdCngEnc->cng_ener_hist, st->hTdCngEnc->cng_ener_hist_fx, Q8, DTX_HIST_SIZE ); floatToFixed_arr( st->hDtxEnc->lspCNG, st->hDtxEnc->lspCNG_fx, Q15, M ); floatToFixed_arrL( st->hTdCngEnc->cng_res_env, st->hTdCngEnc->cng_res_env_fx, Q6, NUM_ENV_CNG * HO_HIST_SIZE ); floatToFixed_arr( st->hTdCngEnc->cng_lsp_hist, st->hTdCngEnc->cng_lsp_hist_fx, Q15, DTX_HIST_SIZE * M ); floatToFixed_arrL( st->hTdCngEnc->lp_env, st->hTdCngEnc->lp_env_fx, Q6, NUM_ENV_CNG ); floatToFixed_arrL( st->hTdCngEnc->ho_env_hist, st->hTdCngEnc->ho_env_hist_fx, Q6, HO_HIST_SIZE * NUM_ENV_CNG ); floatToFixed_arr( st->hTdCngEnc->exc_mem2, st->hTdCngEnc->exc_mem2_fx, q_inp, 30 ); st->hTdCngEnc->lp_ener_fx = float_to_fix( st->hTdCngEnc->lp_ener, Q6 ); st->hTdCngEnc->Enew_fx = float_to_fix( st->hTdCngEnc->Enew, Q6 ); st->hTdCngEnc->lp_sp_enr_fx = float_to_fix16( st->hTdCngEnc->lp_sp_enr, Q8 ); for ( i = 0; i < M; i++ ) { lsf_new_fx[i] = (Word16) ( lsf_new[i] * 2.56f ); st->lsf_old_fx[i] = (Word16) ( st->lsf_old[i] * 2.56f ); } #endif /* encode CNG parameters */ CNG_enc_ivas_fx( st, Aq_fx, inp_fx, /*ener_fx,*/ lsp_mid_fx, lsp_new_fx, lsf_new_fx, &allow_cn_step, q_inp, q_env_fx, &sid_bw ); #ifdef IVAS_FLOAT_FIXED_CONVERSIONS fixedToFloat_arr( Aq_fx, Aq, Q12, NB_SUBFR16k * ( M + 1 ) ); fixedToFloat_arr( lsp_new_fx, lsp_new, Q15, M ); fixedToFloat_arrL32( q_env_fx, q_env, Q6, NUM_ENV_CNG ); fixedToFloat_arr( st->lsp_old_fx, st->lsp_old, Q15, M ); fixedToFloat_arr( st->hDtxEnc->lspCNG_fx, st->hDtxEnc->lspCNG, Q15, M ); fixedToFloat_arr( st->hTdCngEnc->ho_lsp_circ_fx, st->hTdCngEnc->ho_lsp_circ, Q15, HO_HIST_SIZE * M ); fixedToFloat_arr( st->hTdCngEnc->ho_lsp_circ2_fx, st->hTdCngEnc->ho_lsp_circ2, Q15, HO_HIST_SIZE * M ); fixedToFloat_arr( st->hTdCngEnc->ho_lsp_hist_fx, st->hTdCngEnc->ho_lsp_hist, Q15, HO_HIST_SIZE * M ); fixedToFloat_arrL( st->hTdCngEnc->ho_env_circ_fx, st->hTdCngEnc->ho_env_circ, Q6, 160 ); fixedToFloat_arrL( st->hTdCngEnc->cng_res_env_fx, st->hTdCngEnc->cng_res_env, Q6, NUM_ENV_CNG * HO_HIST_SIZE ); fixedToFloat_arr( st->hTdCngEnc->cng_ener_hist_fx, st->hTdCngEnc->cng_ener_hist, Q8, DTX_HIST_SIZE ); fixedToFloat_arrL( st->hTdCngEnc->ho_ener_hist_fx, st->hTdCngEnc->ho_ener_hist, Q6, HO_HIST_SIZE ); fixedToFloat_arrL( st->hTdCngEnc->ho_ener_circ_fx, st->hTdCngEnc->ho_ener_circ, Q6, HO_HIST_SIZE ); fixedToFloat_arr( st->hTdCngEnc->cng_lsp_hist_fx, st->hTdCngEnc->cng_lsp_hist, Q15, DTX_HIST_SIZE * M ); fixedToFloat_arrL( st->hTdCngEnc->lp_env_fx, st->hTdCngEnc->lp_env, Q6, NUM_ENV_CNG ); fixedToFloat_arrL( st->hTdCngEnc->ho_env_hist_fx, st->hTdCngEnc->ho_env_hist, Q6, HO_HIST_SIZE * NUM_ENV_CNG ); fixedToFloat_arr( st->hTdCngEnc->exc_mem2_fx, st->hTdCngEnc->exc_mem2, q_inp, 30 ); st->hTdCngEnc->lp_sp_enr = fix16_to_float( st->hTdCngEnc->lp_sp_enr_fx, Q8 ); st->hTdCngEnc->lp_ener = fix_to_float( st->hTdCngEnc->lp_ener_fx, Q6 ); st->hTdCngEnc->Enew = fix_to_float( st->hTdCngEnc->Enew_fx, Q6 ); st->hTdCngEnc->CNG_att = fix16_to_float( st->hTdCngEnc->CNG_att_fx, Q7 ); for ( i = 0; i < M; i++ ) { lsf_new[i] = ( (float) lsf_new_fx[i] / 2.56f ); st->lsf_old[i] = ( (float) st->lsf_old_fx[i] / 2.56f ); } #endif #else cng_params_postupd( st->hTdCngEnc->ho_circ_ptr, &st->hTdCngEnc->cng_buf_cnt, st->hTdCngEnc->cng_exc2_buf_flt, st->hTdCngEnc->cng_brate_buf, st->hTdCngEnc->ho_env_circ, st->element_mode, st->hFdCngEnc->hFdCngCom->CngBandwidth ); #endif /* encode CNG parameters */ CNG_enc( st, Aq, inp, ener, lsp_mid, lsp_new, lsf_new, &allow_cn_step, q_env, &sid_bw ); #endif #ifdef IVAS_FLOAT_FIXED_CONVERSIONS st->hTdCngEnc->Enew_fx = float_to_fix( st->hTdCngEnc->Enew, Q6 ); st->hTdCngEnc->lp_ener_fx = float_to_fix( st->hTdCngEnc->lp_ener, Q6 ); floatToFixed_arr32( q_env, q_env_fx, Q6, NUM_ENV_CNG ); floatToFixed_arr32( st->hTdCngEnc->lp_env, st->hTdCngEnc->lp_env_fx, Q6, NUM_ENV_CNG ); floatToFixed_arr32( st->hTdCngEnc->old_env, st->hTdCngEnc->old_env_fx, Q6, NUM_ENV_CNG ); //Word16 Q_exc_l = Q_factor_arr( st->hTdCngEnc->exc_mem, 24 ); //Word16 Q_exc1_l = Q_factor_arr( st->hTdCngEnc->exc_mem1, 30 ); //Q_exc_l = min( Q_exc_l, Q_exc1_l ); floatToFixed_arr( st->hTdCngEnc->exc_mem, st->hTdCngEnc->exc_mem_fx, Q_new, 24 ); floatToFixed_arr( st->hTdCngEnc->exc_mem1, st->hTdCngEnc->exc_mem1_fx, Q_new, 30 ); #endif /* comfort noise generation */ CNG_exc( st->core_brate, st->L_frame, &st->hTdCngEnc->Enew, &st->hTdCngEnc->cng_seed, exc, exc2, &st->hTdCngEnc->lp_ener, st->last_core_brate, &st->hDtxEnc->first_CNG, &st->hTdCngEnc->cng_ener_seed, bwe_exc, allow_cn_step, &st->hTdCngEnc->last_allow_cn_step, st->hTdCngEnc->num_ho, q_env, st->hTdCngEnc->lp_env, st->hTdCngEnc->old_env, st->hTdCngEnc->exc_mem, st->hTdCngEnc->exc_mem1, &sid_bw, &st->hTdCngEnc->cng_ener_seed1, exc3, st->Opt_AMR_WB, EVS_MONO ); // CNG_exc( st->core_brate, st->L_frame, &st->hTdCngEnc->Enew_fx, &st->hTdCngEnc->cng_seed, exc, exc2, &st->hTdCngEnc->lp_ener, st->last_core_brate, &st->hDtxEnc->first_CNG, //&st->hTdCngEnc->cng_ener_seed, bwe_exc, allow_cn_step, &st->hTdCngEnc->last_allow_cn_step, st->hTdCngEnc->num_ho, q_env, st->hTdCngEnc->lp_env, st->hTdCngEnc->old_env, // st->hTdCngEnc->exc_mem, st->hTdCngEnc->exc_mem1, &sid_bw, &st->hTdCngEnc->cng_ener_seed1, exc3, st->Opt_AMR_WB, EVS_MONO ); CNG_exc_fx( st->core_brate, st->L_frame, &st->hTdCngEnc->Enew_fx, &st->hTdCngEnc->cng_seed, exc_fx, exc2_fx, &st->hTdCngEnc->lp_ener_fx, st->last_core_brate, &st->hDtxEnc->first_CNG, &st->hTdCngEnc->cng_ener_seed, bwe_exc_fx, allow_cn_step, &st->hTdCngEnc->last_allow_cn_step, sub( st->prev_Q_new, 1 ), Q_new, st->hTdCngEnc->num_ho, q_env_fx, st->hTdCngEnc->lp_env_fx, st->hTdCngEnc->old_env_fx, st->hTdCngEnc->exc_mem_fx, st->hTdCngEnc->exc_mem1_fx, &sid_bw, &st->hTdCngEnc->cng_ener_seed1, exc3_fx, st->Opt_AMR_WB, EVS_MONO ); #ifdef IVAS_FLOAT_FIXED_CONVERSIONS st->hTdCngEnc->Enew = fixedToFloat( st->hTdCngEnc->Enew_fx, Q6 ); st->hTdCngEnc->lp_ener = fixedToFloat( st->hTdCngEnc->lp_ener_fx, Q6 ); fixedToFloat_arrL( q_env_fx, q_env, Q6, NUM_ENV_CNG ); fixedToFloat_arrL( st->hTdCngEnc->lp_env_fx, st->hTdCngEnc->lp_env, Q6, NUM_ENV_CNG ); fixedToFloat_arrL( st->hTdCngEnc->old_env_fx, st->hTdCngEnc->old_env, Q6, NUM_ENV_CNG ); fixedToFloat_arr( exc_fx, exc, Q_new, st->L_frame ); fixedToFloat_arr( exc2_fx, exc2, Q_new, st->L_frame ); fixedToFloat_arr( exc3_fx, exc3, Q_new, st->L_frame ); fixedToFloat_arr( bwe_exc_fx, bwe_exc, Q_new, st->L_frame ); fixedToFloat_arr( st->hTdCngEnc->exc_mem_fx, st->hTdCngEnc->exc_mem, Q_new, 24 ); fixedToFloat_arr( st->hTdCngEnc->exc_mem1_fx, st->hTdCngEnc->exc_mem1, Q_new, 30 ); #endif } else { Loading Loading @@ -1006,6 +1097,7 @@ ivas_error acelp_core_enc( #ifdef IVAS_FLOAT_FIXED_CONVERSIONS // conv params from float to fix Q_exc2 = Q_factor_arr( exc2, L_FRAME ); floatToFixed_arr( exc2, exc2_fx, Q_exc2, L_FRAME16k ); floatToFixed_arr( Aq, Aq_fx, 12, NB_SUBFR16k * ( M + 1 ) ); floatToFixed_arr( st->lspold_s, st->lspold_s_fx, 15, 16 ); Loading lib_enc/cng_enc_fx.c +1412 −192 File changed.Preview size limit exceeded, changes collapsed. Show changes Loading
lib_com/cnst.h +9 −0 Original line number Diff line number Diff line Loading @@ -209,6 +209,15 @@ enum{ #define L_FRAME8k 160 /* Frame size in samples at 8kHz */ #define L_FRAME4k 80 /* Frame size in samples at 4kHz */ #define ONE_BY_L_FRAME48k_Q31 2236962 #define ONE_BY_L_FRAME32k_Q31 3355443 #define ONE_BY_L_FRAME25_6k_Q31 4194304 #define ONE_BY_L_FRAME16k_Q31 6710886 #define ONE_BY_L_FRAME_Q31 8388608 #define ONE_BY_240_Q31 8947849 #define ONE_BY_L_FRAME8k_Q31 13421772 #define ONE_BY_L_FRAME4k_Q31 26843546 #define L_SPEC48k 800 /* HQ spectrum length at 48kHz */ #define L_SPEC32k 640 /* HQ spectrum length at 32kHz */ #define L_SPEC16k 320 /* HQ spectrum length at 16kHz */ Loading
lib_com/ivas_prot_fx.h +17 −3 Original line number Diff line number Diff line Loading @@ -2700,7 +2700,6 @@ void rc_uni_enc_encode_bits( const Word16 bits /* i : Number of bits */ ); #ifdef IVAS_FLOAT_FIXED void stereo_dft_enc_process_fx( CPE_ENC_HANDLE hCPE, /* i/o: CPE encoder structure */ const Word16 vad_flag_dtx[], /* i : VAD dtx flags */ Loading @@ -2708,6 +2707,23 @@ void stereo_dft_enc_process_fx( const Word16 input_frame /* i : input frame length */ ); void stereo_dft_cng_side_gain_fx( STEREO_DFT_ENC_DATA_HANDLE hStereoDft, /* i/o: DFT stereo handle */ STEREO_CNG_ENC_HANDLE hStereoCng, /* i/o: Stereo CNG data structure */ const Word32 core_brate, /* i : core bitrate */ const Word32 last_core_brate, /* i : last core bitrate */ const Word16 bwidth /* i : audio band-width */ ); void stereo_cng_upd_counters_fx( STEREO_CNG_ENC_HANDLE hStereoCng, /* i/o: Stereo CNG data structure */ const Word32 element_mode, /* i : element mode */ const Word16 nbands, /* i : Number of bands in active */ const Word32 sidSideGain[], /* i : SID side gains */ const Word16 burst_ho_count, /* i : Hang-over count */ Word16 *coh_fade_counter /* i : Coherence fade counter */ ); void spectral_balancer_fx16( Word16 *signal, /* i/o : signal Qx */ Word16 *mem, /* i/o : mem Qx */ Loading Loading @@ -2763,8 +2779,6 @@ void acelp_fast_fx( const Word16 L_subfr /* i : subframe length */ ); #endif void ivas_mdct_quant_coder_fx( CPE_ENC_HANDLE hCPE, /* i/o: Encoder CPE handle */ Word16 tnsBits[CPE_CHANNELS][NB_DIV], /* i : bits needed for TNS parameters */ Loading
lib_com/prot.h +3 −3 Original line number Diff line number Diff line Loading @@ -2381,7 +2381,7 @@ ivas_error acelp_core_enc( ivas_error acelp_core_enc( Encoder_State *st, /* i/o: encoder state structure */ /*const*/ float inp[], /* i : input signal of the current frame */ const float ener, /* i : residual energy from Levinson-Durbin */ // const float ener, /* i : residual energy from Levinson-Durbin */ float A[NB_SUBFR16k * ( M + 1 )], /* i : A(z) unquantized for the 4 subframes */ float Aw[NB_SUBFR16k * ( M + 1 )], /* i : weighted A(z) unquant. for subframes */ const float epsP[M + 1], /* i : LP prediction errors */ Loading
lib_enc/acelp_core_enc.c +99 −7 Original line number Diff line number Diff line Loading @@ -64,7 +64,7 @@ ivas_error acelp_core_enc( Encoder_State *st, /* i/o: encoder state structure */ /*const*/ float inp[], /* i : input signal of the current frame */ const float ener, /* i : residual energy from Levinson-Durbin*/ // const float ener, /* i : residual energy from Levinson-Durbin*/ float A[NB_SUBFR16k * ( M + 1 )], /* i : A(z) unquantized for the 4 subframes*/ float Aw[NB_SUBFR16k * ( M + 1 )], /* i : weighted A(z) unquant. for subframes*/ const float epsP[M + 1], /* i : LP prediction errors */ Loading Loading @@ -142,6 +142,7 @@ ivas_error acelp_core_enc( Word16 exc2_fx[L_FRAME16k]; /* enhanced excitation */ Word16 Es_pred_fx; /* predicited scaled innovation energy */ Word16 tmp_noise_fx; /* NB post-filter long-term noise energy*/ // Word16 tc_subfr_fx; /* TC sub-frame indication */ Word16 old_bwe_exc_fx[( PIT16k_MAX + ( L_FRAME16k + 1 ) + L_SUBFR16k ) * 2]; /* excitation buffer */ Word16 Q_old_bwe_exc; Loading Loading @@ -170,11 +171,12 @@ ivas_error acelp_core_enc( Word32 gc_threshold_bck_fx; Word16 clip_var_bck_fx[6]; // Word16 next_force_sf_bck_fx; // Word32 q_env_fx[NUM_ENV_CNG]; Word32 q_env_fx[NUM_ENV_CNG]; // Word16 coder_type; Word16 exc3_fx[L_FRAME16k]; Word16 syn1_fx[L_FRAME16k]; Word16 *tdm_Pri_pitch_buf_fx; Word16 att_fx; Word16 lsp_new_fx[M]; /* i : LSPs at the end of the frame */ Loading Loading @@ -488,7 +490,7 @@ ivas_error acelp_core_enc( if ( st->cng_type == LP_CNG ) { /* Run CNG post parameter update */ #if 1 #ifdef IVAS_FLOAT_FIXED #ifdef IVAS_FLOAT_FIXED_CONVERSIONS FOR( Word16 ii = 0; ii < HO_HIST_SIZE; ii++ ) { Loading @@ -499,17 +501,106 @@ ivas_error acelp_core_enc( #endif cng_params_postupd_ivas_fx( st->hTdCngEnc->ho_circ_ptr, &st->hTdCngEnc->cng_buf_cnt, st->hTdCngEnc->cng_exc2_buf, st->hTdCngEnc->cng_Qexc_buf, st->hTdCngEnc->cng_brate_buf, st->hTdCngEnc->ho_env_circ_fx, st->element_mode, st->hFdCngEnc->hFdCngCom->CngBandwidth ); #ifdef IVAS_FLOAT_FIXED_CONVERSIONS Word16 q_inp; floatToFixed_arr( Aq, Aq_fx, NB_SUBFR16k * ( M + 1 ), Q12 ); q_inp = Q_factor_arr( inp, st->L_frame ); floatToFixed_arr( inp, inp_fx, q_inp, st->L_frame ); st->hTdCngEnc->CNG_att_fx = float_to_fix16( st->hTdCngEnc->CNG_att, Q7 ); floatToFixed_arr( lsp_mid, lsp_mid_fx, Q15, M ); floatToFixed_arr( lsp_new, lsp_new_fx, Q15, M ); floatToFixed_arr( st->lsp_old, st->lsp_old_fx, Q15, M ); floatToFixed_arr( st->hTdCngEnc->ho_lsp_hist, st->hTdCngEnc->ho_lsp_hist_fx, Q15, HO_HIST_SIZE * M ); floatToFixed_arr( st->hTdCngEnc->ho_lsp_circ, st->hTdCngEnc->ho_lsp_circ_fx, Q15, HO_HIST_SIZE * M ); floatToFixed_arr( st->hTdCngEnc->ho_lsp_circ2, st->hTdCngEnc->ho_lsp_circ2_fx, Q15, HO_HIST_SIZE * M ); floatToFixed_arrL( st->hTdCngEnc->ho_ener_hist, st->hTdCngEnc->ho_ener_hist_fx, Q6, HO_HIST_SIZE ); floatToFixed_arrL( st->hTdCngEnc->ho_ener_circ, st->hTdCngEnc->ho_ener_circ_fx, Q6, HO_HIST_SIZE ); floatToFixed_arr( st->hTdCngEnc->cng_ener_hist, st->hTdCngEnc->cng_ener_hist_fx, Q8, DTX_HIST_SIZE ); floatToFixed_arr( st->hDtxEnc->lspCNG, st->hDtxEnc->lspCNG_fx, Q15, M ); floatToFixed_arrL( st->hTdCngEnc->cng_res_env, st->hTdCngEnc->cng_res_env_fx, Q6, NUM_ENV_CNG * HO_HIST_SIZE ); floatToFixed_arr( st->hTdCngEnc->cng_lsp_hist, st->hTdCngEnc->cng_lsp_hist_fx, Q15, DTX_HIST_SIZE * M ); floatToFixed_arrL( st->hTdCngEnc->lp_env, st->hTdCngEnc->lp_env_fx, Q6, NUM_ENV_CNG ); floatToFixed_arrL( st->hTdCngEnc->ho_env_hist, st->hTdCngEnc->ho_env_hist_fx, Q6, HO_HIST_SIZE * NUM_ENV_CNG ); floatToFixed_arr( st->hTdCngEnc->exc_mem2, st->hTdCngEnc->exc_mem2_fx, q_inp, 30 ); st->hTdCngEnc->lp_ener_fx = float_to_fix( st->hTdCngEnc->lp_ener, Q6 ); st->hTdCngEnc->Enew_fx = float_to_fix( st->hTdCngEnc->Enew, Q6 ); st->hTdCngEnc->lp_sp_enr_fx = float_to_fix16( st->hTdCngEnc->lp_sp_enr, Q8 ); for ( i = 0; i < M; i++ ) { lsf_new_fx[i] = (Word16) ( lsf_new[i] * 2.56f ); st->lsf_old_fx[i] = (Word16) ( st->lsf_old[i] * 2.56f ); } #endif /* encode CNG parameters */ CNG_enc_ivas_fx( st, Aq_fx, inp_fx, /*ener_fx,*/ lsp_mid_fx, lsp_new_fx, lsf_new_fx, &allow_cn_step, q_inp, q_env_fx, &sid_bw ); #ifdef IVAS_FLOAT_FIXED_CONVERSIONS fixedToFloat_arr( Aq_fx, Aq, Q12, NB_SUBFR16k * ( M + 1 ) ); fixedToFloat_arr( lsp_new_fx, lsp_new, Q15, M ); fixedToFloat_arrL32( q_env_fx, q_env, Q6, NUM_ENV_CNG ); fixedToFloat_arr( st->lsp_old_fx, st->lsp_old, Q15, M ); fixedToFloat_arr( st->hDtxEnc->lspCNG_fx, st->hDtxEnc->lspCNG, Q15, M ); fixedToFloat_arr( st->hTdCngEnc->ho_lsp_circ_fx, st->hTdCngEnc->ho_lsp_circ, Q15, HO_HIST_SIZE * M ); fixedToFloat_arr( st->hTdCngEnc->ho_lsp_circ2_fx, st->hTdCngEnc->ho_lsp_circ2, Q15, HO_HIST_SIZE * M ); fixedToFloat_arr( st->hTdCngEnc->ho_lsp_hist_fx, st->hTdCngEnc->ho_lsp_hist, Q15, HO_HIST_SIZE * M ); fixedToFloat_arrL( st->hTdCngEnc->ho_env_circ_fx, st->hTdCngEnc->ho_env_circ, Q6, 160 ); fixedToFloat_arrL( st->hTdCngEnc->cng_res_env_fx, st->hTdCngEnc->cng_res_env, Q6, NUM_ENV_CNG * HO_HIST_SIZE ); fixedToFloat_arr( st->hTdCngEnc->cng_ener_hist_fx, st->hTdCngEnc->cng_ener_hist, Q8, DTX_HIST_SIZE ); fixedToFloat_arrL( st->hTdCngEnc->ho_ener_hist_fx, st->hTdCngEnc->ho_ener_hist, Q6, HO_HIST_SIZE ); fixedToFloat_arrL( st->hTdCngEnc->ho_ener_circ_fx, st->hTdCngEnc->ho_ener_circ, Q6, HO_HIST_SIZE ); fixedToFloat_arr( st->hTdCngEnc->cng_lsp_hist_fx, st->hTdCngEnc->cng_lsp_hist, Q15, DTX_HIST_SIZE * M ); fixedToFloat_arrL( st->hTdCngEnc->lp_env_fx, st->hTdCngEnc->lp_env, Q6, NUM_ENV_CNG ); fixedToFloat_arrL( st->hTdCngEnc->ho_env_hist_fx, st->hTdCngEnc->ho_env_hist, Q6, HO_HIST_SIZE * NUM_ENV_CNG ); fixedToFloat_arr( st->hTdCngEnc->exc_mem2_fx, st->hTdCngEnc->exc_mem2, q_inp, 30 ); st->hTdCngEnc->lp_sp_enr = fix16_to_float( st->hTdCngEnc->lp_sp_enr_fx, Q8 ); st->hTdCngEnc->lp_ener = fix_to_float( st->hTdCngEnc->lp_ener_fx, Q6 ); st->hTdCngEnc->Enew = fix_to_float( st->hTdCngEnc->Enew_fx, Q6 ); st->hTdCngEnc->CNG_att = fix16_to_float( st->hTdCngEnc->CNG_att_fx, Q7 ); for ( i = 0; i < M; i++ ) { lsf_new[i] = ( (float) lsf_new_fx[i] / 2.56f ); st->lsf_old[i] = ( (float) st->lsf_old_fx[i] / 2.56f ); } #endif #else cng_params_postupd( st->hTdCngEnc->ho_circ_ptr, &st->hTdCngEnc->cng_buf_cnt, st->hTdCngEnc->cng_exc2_buf_flt, st->hTdCngEnc->cng_brate_buf, st->hTdCngEnc->ho_env_circ, st->element_mode, st->hFdCngEnc->hFdCngCom->CngBandwidth ); #endif /* encode CNG parameters */ CNG_enc( st, Aq, inp, ener, lsp_mid, lsp_new, lsf_new, &allow_cn_step, q_env, &sid_bw ); #endif #ifdef IVAS_FLOAT_FIXED_CONVERSIONS st->hTdCngEnc->Enew_fx = float_to_fix( st->hTdCngEnc->Enew, Q6 ); st->hTdCngEnc->lp_ener_fx = float_to_fix( st->hTdCngEnc->lp_ener, Q6 ); floatToFixed_arr32( q_env, q_env_fx, Q6, NUM_ENV_CNG ); floatToFixed_arr32( st->hTdCngEnc->lp_env, st->hTdCngEnc->lp_env_fx, Q6, NUM_ENV_CNG ); floatToFixed_arr32( st->hTdCngEnc->old_env, st->hTdCngEnc->old_env_fx, Q6, NUM_ENV_CNG ); //Word16 Q_exc_l = Q_factor_arr( st->hTdCngEnc->exc_mem, 24 ); //Word16 Q_exc1_l = Q_factor_arr( st->hTdCngEnc->exc_mem1, 30 ); //Q_exc_l = min( Q_exc_l, Q_exc1_l ); floatToFixed_arr( st->hTdCngEnc->exc_mem, st->hTdCngEnc->exc_mem_fx, Q_new, 24 ); floatToFixed_arr( st->hTdCngEnc->exc_mem1, st->hTdCngEnc->exc_mem1_fx, Q_new, 30 ); #endif /* comfort noise generation */ CNG_exc( st->core_brate, st->L_frame, &st->hTdCngEnc->Enew, &st->hTdCngEnc->cng_seed, exc, exc2, &st->hTdCngEnc->lp_ener, st->last_core_brate, &st->hDtxEnc->first_CNG, &st->hTdCngEnc->cng_ener_seed, bwe_exc, allow_cn_step, &st->hTdCngEnc->last_allow_cn_step, st->hTdCngEnc->num_ho, q_env, st->hTdCngEnc->lp_env, st->hTdCngEnc->old_env, st->hTdCngEnc->exc_mem, st->hTdCngEnc->exc_mem1, &sid_bw, &st->hTdCngEnc->cng_ener_seed1, exc3, st->Opt_AMR_WB, EVS_MONO ); // CNG_exc( st->core_brate, st->L_frame, &st->hTdCngEnc->Enew_fx, &st->hTdCngEnc->cng_seed, exc, exc2, &st->hTdCngEnc->lp_ener, st->last_core_brate, &st->hDtxEnc->first_CNG, //&st->hTdCngEnc->cng_ener_seed, bwe_exc, allow_cn_step, &st->hTdCngEnc->last_allow_cn_step, st->hTdCngEnc->num_ho, q_env, st->hTdCngEnc->lp_env, st->hTdCngEnc->old_env, // st->hTdCngEnc->exc_mem, st->hTdCngEnc->exc_mem1, &sid_bw, &st->hTdCngEnc->cng_ener_seed1, exc3, st->Opt_AMR_WB, EVS_MONO ); CNG_exc_fx( st->core_brate, st->L_frame, &st->hTdCngEnc->Enew_fx, &st->hTdCngEnc->cng_seed, exc_fx, exc2_fx, &st->hTdCngEnc->lp_ener_fx, st->last_core_brate, &st->hDtxEnc->first_CNG, &st->hTdCngEnc->cng_ener_seed, bwe_exc_fx, allow_cn_step, &st->hTdCngEnc->last_allow_cn_step, sub( st->prev_Q_new, 1 ), Q_new, st->hTdCngEnc->num_ho, q_env_fx, st->hTdCngEnc->lp_env_fx, st->hTdCngEnc->old_env_fx, st->hTdCngEnc->exc_mem_fx, st->hTdCngEnc->exc_mem1_fx, &sid_bw, &st->hTdCngEnc->cng_ener_seed1, exc3_fx, st->Opt_AMR_WB, EVS_MONO ); #ifdef IVAS_FLOAT_FIXED_CONVERSIONS st->hTdCngEnc->Enew = fixedToFloat( st->hTdCngEnc->Enew_fx, Q6 ); st->hTdCngEnc->lp_ener = fixedToFloat( st->hTdCngEnc->lp_ener_fx, Q6 ); fixedToFloat_arrL( q_env_fx, q_env, Q6, NUM_ENV_CNG ); fixedToFloat_arrL( st->hTdCngEnc->lp_env_fx, st->hTdCngEnc->lp_env, Q6, NUM_ENV_CNG ); fixedToFloat_arrL( st->hTdCngEnc->old_env_fx, st->hTdCngEnc->old_env, Q6, NUM_ENV_CNG ); fixedToFloat_arr( exc_fx, exc, Q_new, st->L_frame ); fixedToFloat_arr( exc2_fx, exc2, Q_new, st->L_frame ); fixedToFloat_arr( exc3_fx, exc3, Q_new, st->L_frame ); fixedToFloat_arr( bwe_exc_fx, bwe_exc, Q_new, st->L_frame ); fixedToFloat_arr( st->hTdCngEnc->exc_mem_fx, st->hTdCngEnc->exc_mem, Q_new, 24 ); fixedToFloat_arr( st->hTdCngEnc->exc_mem1_fx, st->hTdCngEnc->exc_mem1, Q_new, 30 ); #endif } else { Loading Loading @@ -1006,6 +1097,7 @@ ivas_error acelp_core_enc( #ifdef IVAS_FLOAT_FIXED_CONVERSIONS // conv params from float to fix Q_exc2 = Q_factor_arr( exc2, L_FRAME ); floatToFixed_arr( exc2, exc2_fx, Q_exc2, L_FRAME16k ); floatToFixed_arr( Aq, Aq_fx, 12, NB_SUBFR16k * ( M + 1 ) ); floatToFixed_arr( st->lspold_s, st->lspold_s_fx, 15, 16 ); Loading
lib_enc/cng_enc_fx.c +1412 −192 File changed.Preview size limit exceeded, changes collapsed. Show changes