Loading lib_enc/ivas_core_enc_fx.c +34 −5 Original line number Diff line number Diff line Loading @@ -98,6 +98,9 @@ ivas_error ivas_core_enc_fx( Word16 Q_shb_spch; Word32 new_swb_speech_buffer_fx[L_FRAME48k + STEREO_DFT_OVL_MAX]; Word16 new_inp_resamp16k_fx[CPE_CHANNELS][L_FRAME16k]; /* new input signal @16kHz, non pre-emphasised, used by the WB TBE/BWE */ #ifdef NONBE_FIX_ISSUE_2206 Word16 q_new_inp_resamp16k_fx[CPE_CHANNELS]; #endif Word16 *hb_speech_fx; Word32 bwe_exc_extended_fx[CPE_CHANNELS][L_FRAME32k + NL_BUFF_OFFSET]; /* 2 * Q_new */ Word16 old_syn_12k8_16k_fx[CPE_CHANNELS][L_FRAME16k]; /* ACELP core synthesis at 12.8kHz or 16kHz to be used by the SWB BWE */ Loading Loading @@ -249,6 +252,13 @@ ivas_error ivas_core_enc_fx( return error; } } #ifdef NONBE_FIX_ISSUE_2206 /* Normalize new_inp_resamp16k_fx to avoid inconvenient rescale of old WTDA buffers later. */ q_new_inp_resamp16k_fx[n] = norm_arr(new_inp_resamp16k_fx[n], L_FRAME16k); scale_sig( new_inp_resamp16k_fx[n], L_FRAME16k, q_new_inp_resamp16k_fx[n] ); q_new_inp_resamp16k_fx[n] = add( q_new_inp_resamp16k_fx[n], sub( Q_new[n], 1 ) ); #endif test(); IF( EQ_16( st->element_mode, IVAS_CPE_MDCT ) || EQ_16( st->element_mode, IVAS_SCE ) ) { Loading Loading @@ -626,7 +636,27 @@ ivas_error ivas_core_enc_fx( { st = sts[n]; #ifndef NONBE_FIX_ISSUE_2206 #ifdef NONBE_FIX_ISSUE_2206 Copy( st->input_fx - input_frame, tmp_old_input_fx, input_frame ); Copy( st->input_fx, tmp_input_fx, input_frame ); q_inp[0] = st->q_old_inp; q_inp[1] = st->q_inp; st->q_inp = s_min( st->Q_old_wtda, st->q_inp ); st->q_old_inp = st->q_inp; IF( st->hBWE_FD != NULL ) { Scale_sig( st->hBWE_FD->L_old_wtda_swb_fx, L_FRAME48k, sub( st->q_inp, st->Q_old_wtda ) ); // s_min( st->Q_old_wtda, st->q_inp ); st->Q_old_wtda = st->q_inp; move16(); //Scale_sig( st->hBWE_FD->old_input_lp_fx, NS2SA( 16000, ACELP_LOOK_NS + DELAY_FD_BWE_ENC_NS ), sub( sub( Q_new[n], 1 ), st->hBWE_FD->prev_Q_input_lp ) ); /* Q_new[n] - 1 */ //st->hBWE_FD->prev_Q_input_lp = sub( Q_new[n], 1 ); //move16(); } Scale_sig( st->input_fx - input_frame, 2 * input_frame, sub( st->q_inp, q_inp[0] ) ); #else IF( st->hBWE_FD != NULL ) { Scale_sig( st->hBWE_FD->L_old_wtda_swb_fx, L_FRAME48k, sub( negate( 1 ), st->Q_old_wtda ) ); // Q(-1) Loading @@ -636,7 +666,6 @@ ivas_error ivas_core_enc_fx( st->hBWE_FD->prev_Q_input_lp = sub( Q_new[n], 1 ); move16(); } #endif Copy( st->input_fx - input_frame, tmp_old_input_fx, input_frame ); Copy( st->input_fx, tmp_input_fx, input_frame ); Loading @@ -648,6 +677,7 @@ ivas_error ivas_core_enc_fx( move16(); st->q_old_inp = -1; move16(); #endif /*---------------------------------------------------------------------* * Postprocessing for ACELP/HQ core switching Loading @@ -668,7 +698,7 @@ ivas_error ivas_core_enc_fx( { /* Common pre-processing for WB TBE and WB BWE */ #ifdef NONBE_FIX_ISSUE_2206 wb_pre_proc_ivas_fx( st, last_element_mode, new_inp_resamp16k_fx[n], hb_speech_fx, sub( *Q_new, 1 ) ); wb_pre_proc_ivas_fx( st, last_element_mode, new_inp_resamp16k_fx[n], hb_speech_fx, q_new_inp_resamp16k_fx[n] ); #else wb_pre_proc_ivas_fx( st, last_element_mode, new_inp_resamp16k_fx[n], hb_speech_fx ); #endif Loading @@ -685,7 +715,7 @@ ivas_error ivas_core_enc_fx( { /* WB BWE encoder */ #ifdef NONBE_FIX_ISSUE_2206 wb_bwe_enc_ivas_fx( st, new_inp_resamp16k_fx[n], sub( *Q_new, 1 ) ); wb_bwe_enc_ivas_fx( st, new_inp_resamp16k_fx[n], q_new_inp_resamp16k_fx[n] ); #else wb_bwe_enc_ivas_fx( st, new_inp_resamp16k_fx[n] ); #endif Loading Loading @@ -783,7 +813,6 @@ ivas_error ivas_core_enc_fx( } Scale_sig( old_syn_12k8_16k_fx[n], L_FRAME16k, sub( Q1, Q_new[n] ) ); // Q0 /*---------------------------------------------------------------------* * SWB DTX/CNG encoding *---------------------------------------------------------------------*/ Loading lib_enc/swb_pre_proc_fx.c +19 −2 Original line number Diff line number Diff line Loading @@ -475,8 +475,13 @@ void wb_pre_proc_ivas_fx( Sample_Delay_WB_BWE = ( L_LOOK_12k8 + L_SUBFR ) * 5 / 16; highband_new_speech = highband_old_speech + Sample_Delay_WB_BWE; #ifdef NONBE_FIX_ISSUE_2206 Copy( hb_speech, highband_new_speech, L_FRAME16k / 4 ); Copy_Scale_sig( highband_old_speech + L_FRAME16k / 4, hBWE_TD->old_speech_wb_fx, Sample_Delay_WB_BWE, sub( -1, Q_wb_sp ) ); #else Copy( hb_speech, highband_new_speech, L_FRAME16k / 4 ); Copy( highband_old_speech + L_FRAME16k / 4, hBWE_TD->old_speech_wb_fx, Sample_Delay_WB_BWE ); #endif } } } Loading @@ -489,7 +494,11 @@ void wb_pre_proc_ivas_fx( if ( hBWE_FD != NULL ) { #ifdef NONBE_FIX_ISSUE_2206 hBWE_FD->mem_old_wtda_swb_fx = shl( new_inp_resamp16k[L_FRAME16k - L_MEM_RECALC_16K - L_FILT16k - 1], sub( -1, Q_wb_sp ) ); #else hBWE_FD->mem_old_wtda_swb_fx = new_inp_resamp16k[L_FRAME16k - L_MEM_RECALC_16K - L_FILT16k - 1]; #endif move16(); } Loading @@ -501,16 +510,24 @@ void wb_pre_proc_ivas_fx( { Sample_Delay_WB_BWE = NS2SA( 16000, DELAY_FD_BWE_ENC_12k8_NS ); #ifdef NONBE_FIX_ISSUE_2206 Copy_Scale_sig( new_inp_resamp16k, &old_input[Sample_Delay_WB_BWE], L_FRAME16k, sub( Q_wb_sp , new_inp_resamp16k_q ) ); Copy_Scale_sig( hBWE_FD->old_input_wb_fx, old_input, Sample_Delay_WB_BWE, sub( -1, Q_wb_sp ) ); Copy_Scale_sig( new_inp_resamp16k + L_FRAME16k - Sample_Delay_WB_BWE, hBWE_FD->old_input_wb_fx, Sample_Delay_WB_BWE, sub( -1, new_inp_resamp16k_q ) ); #else Copy( new_inp_resamp16k, &old_input[Sample_Delay_WB_BWE], L_FRAME16k ); Copy( hBWE_FD->old_input_wb_fx, old_input, Sample_Delay_WB_BWE ); Copy( new_inp_resamp16k + L_FRAME16k - Sample_Delay_WB_BWE, hBWE_FD->old_input_wb_fx, Sample_Delay_WB_BWE ); #endif test(); IF( NE_16( st_fx->extl, SWB_BWE ) && NE_16( st_fx->extl, FB_BWE ) ) { Copy( old_input, hBWE_FD->L_old_wtda_swb_fx, L_FRAME16k ); #ifdef NONBE_FIX_ISSUE_2206 st_fx->Q_old_wtda = sub( Q_wb_sp, 0 ); Copy_Scale_sig( old_input, hBWE_FD->L_old_wtda_swb_fx, L_FRAME16k, sub( st_fx->Q_old_wtda, Q_wb_sp ) ); //Copy( old_input, hBWE_FD->L_old_wtda_swb_fx, L_FRAME16k ); //st_fx->Q_old_wtda = Q_wb_sp; #else Copy( old_input, hBWE_FD->L_old_wtda_swb_fx, L_FRAME16k ); st_fx->Q_old_wtda = -1; #endif move16(); Loading Loading
lib_enc/ivas_core_enc_fx.c +34 −5 Original line number Diff line number Diff line Loading @@ -98,6 +98,9 @@ ivas_error ivas_core_enc_fx( Word16 Q_shb_spch; Word32 new_swb_speech_buffer_fx[L_FRAME48k + STEREO_DFT_OVL_MAX]; Word16 new_inp_resamp16k_fx[CPE_CHANNELS][L_FRAME16k]; /* new input signal @16kHz, non pre-emphasised, used by the WB TBE/BWE */ #ifdef NONBE_FIX_ISSUE_2206 Word16 q_new_inp_resamp16k_fx[CPE_CHANNELS]; #endif Word16 *hb_speech_fx; Word32 bwe_exc_extended_fx[CPE_CHANNELS][L_FRAME32k + NL_BUFF_OFFSET]; /* 2 * Q_new */ Word16 old_syn_12k8_16k_fx[CPE_CHANNELS][L_FRAME16k]; /* ACELP core synthesis at 12.8kHz or 16kHz to be used by the SWB BWE */ Loading Loading @@ -249,6 +252,13 @@ ivas_error ivas_core_enc_fx( return error; } } #ifdef NONBE_FIX_ISSUE_2206 /* Normalize new_inp_resamp16k_fx to avoid inconvenient rescale of old WTDA buffers later. */ q_new_inp_resamp16k_fx[n] = norm_arr(new_inp_resamp16k_fx[n], L_FRAME16k); scale_sig( new_inp_resamp16k_fx[n], L_FRAME16k, q_new_inp_resamp16k_fx[n] ); q_new_inp_resamp16k_fx[n] = add( q_new_inp_resamp16k_fx[n], sub( Q_new[n], 1 ) ); #endif test(); IF( EQ_16( st->element_mode, IVAS_CPE_MDCT ) || EQ_16( st->element_mode, IVAS_SCE ) ) { Loading Loading @@ -626,7 +636,27 @@ ivas_error ivas_core_enc_fx( { st = sts[n]; #ifndef NONBE_FIX_ISSUE_2206 #ifdef NONBE_FIX_ISSUE_2206 Copy( st->input_fx - input_frame, tmp_old_input_fx, input_frame ); Copy( st->input_fx, tmp_input_fx, input_frame ); q_inp[0] = st->q_old_inp; q_inp[1] = st->q_inp; st->q_inp = s_min( st->Q_old_wtda, st->q_inp ); st->q_old_inp = st->q_inp; IF( st->hBWE_FD != NULL ) { Scale_sig( st->hBWE_FD->L_old_wtda_swb_fx, L_FRAME48k, sub( st->q_inp, st->Q_old_wtda ) ); // s_min( st->Q_old_wtda, st->q_inp ); st->Q_old_wtda = st->q_inp; move16(); //Scale_sig( st->hBWE_FD->old_input_lp_fx, NS2SA( 16000, ACELP_LOOK_NS + DELAY_FD_BWE_ENC_NS ), sub( sub( Q_new[n], 1 ), st->hBWE_FD->prev_Q_input_lp ) ); /* Q_new[n] - 1 */ //st->hBWE_FD->prev_Q_input_lp = sub( Q_new[n], 1 ); //move16(); } Scale_sig( st->input_fx - input_frame, 2 * input_frame, sub( st->q_inp, q_inp[0] ) ); #else IF( st->hBWE_FD != NULL ) { Scale_sig( st->hBWE_FD->L_old_wtda_swb_fx, L_FRAME48k, sub( negate( 1 ), st->Q_old_wtda ) ); // Q(-1) Loading @@ -636,7 +666,6 @@ ivas_error ivas_core_enc_fx( st->hBWE_FD->prev_Q_input_lp = sub( Q_new[n], 1 ); move16(); } #endif Copy( st->input_fx - input_frame, tmp_old_input_fx, input_frame ); Copy( st->input_fx, tmp_input_fx, input_frame ); Loading @@ -648,6 +677,7 @@ ivas_error ivas_core_enc_fx( move16(); st->q_old_inp = -1; move16(); #endif /*---------------------------------------------------------------------* * Postprocessing for ACELP/HQ core switching Loading @@ -668,7 +698,7 @@ ivas_error ivas_core_enc_fx( { /* Common pre-processing for WB TBE and WB BWE */ #ifdef NONBE_FIX_ISSUE_2206 wb_pre_proc_ivas_fx( st, last_element_mode, new_inp_resamp16k_fx[n], hb_speech_fx, sub( *Q_new, 1 ) ); wb_pre_proc_ivas_fx( st, last_element_mode, new_inp_resamp16k_fx[n], hb_speech_fx, q_new_inp_resamp16k_fx[n] ); #else wb_pre_proc_ivas_fx( st, last_element_mode, new_inp_resamp16k_fx[n], hb_speech_fx ); #endif Loading @@ -685,7 +715,7 @@ ivas_error ivas_core_enc_fx( { /* WB BWE encoder */ #ifdef NONBE_FIX_ISSUE_2206 wb_bwe_enc_ivas_fx( st, new_inp_resamp16k_fx[n], sub( *Q_new, 1 ) ); wb_bwe_enc_ivas_fx( st, new_inp_resamp16k_fx[n], q_new_inp_resamp16k_fx[n] ); #else wb_bwe_enc_ivas_fx( st, new_inp_resamp16k_fx[n] ); #endif Loading Loading @@ -783,7 +813,6 @@ ivas_error ivas_core_enc_fx( } Scale_sig( old_syn_12k8_16k_fx[n], L_FRAME16k, sub( Q1, Q_new[n] ) ); // Q0 /*---------------------------------------------------------------------* * SWB DTX/CNG encoding *---------------------------------------------------------------------*/ Loading
lib_enc/swb_pre_proc_fx.c +19 −2 Original line number Diff line number Diff line Loading @@ -475,8 +475,13 @@ void wb_pre_proc_ivas_fx( Sample_Delay_WB_BWE = ( L_LOOK_12k8 + L_SUBFR ) * 5 / 16; highband_new_speech = highband_old_speech + Sample_Delay_WB_BWE; #ifdef NONBE_FIX_ISSUE_2206 Copy( hb_speech, highband_new_speech, L_FRAME16k / 4 ); Copy_Scale_sig( highband_old_speech + L_FRAME16k / 4, hBWE_TD->old_speech_wb_fx, Sample_Delay_WB_BWE, sub( -1, Q_wb_sp ) ); #else Copy( hb_speech, highband_new_speech, L_FRAME16k / 4 ); Copy( highband_old_speech + L_FRAME16k / 4, hBWE_TD->old_speech_wb_fx, Sample_Delay_WB_BWE ); #endif } } } Loading @@ -489,7 +494,11 @@ void wb_pre_proc_ivas_fx( if ( hBWE_FD != NULL ) { #ifdef NONBE_FIX_ISSUE_2206 hBWE_FD->mem_old_wtda_swb_fx = shl( new_inp_resamp16k[L_FRAME16k - L_MEM_RECALC_16K - L_FILT16k - 1], sub( -1, Q_wb_sp ) ); #else hBWE_FD->mem_old_wtda_swb_fx = new_inp_resamp16k[L_FRAME16k - L_MEM_RECALC_16K - L_FILT16k - 1]; #endif move16(); } Loading @@ -501,16 +510,24 @@ void wb_pre_proc_ivas_fx( { Sample_Delay_WB_BWE = NS2SA( 16000, DELAY_FD_BWE_ENC_12k8_NS ); #ifdef NONBE_FIX_ISSUE_2206 Copy_Scale_sig( new_inp_resamp16k, &old_input[Sample_Delay_WB_BWE], L_FRAME16k, sub( Q_wb_sp , new_inp_resamp16k_q ) ); Copy_Scale_sig( hBWE_FD->old_input_wb_fx, old_input, Sample_Delay_WB_BWE, sub( -1, Q_wb_sp ) ); Copy_Scale_sig( new_inp_resamp16k + L_FRAME16k - Sample_Delay_WB_BWE, hBWE_FD->old_input_wb_fx, Sample_Delay_WB_BWE, sub( -1, new_inp_resamp16k_q ) ); #else Copy( new_inp_resamp16k, &old_input[Sample_Delay_WB_BWE], L_FRAME16k ); Copy( hBWE_FD->old_input_wb_fx, old_input, Sample_Delay_WB_BWE ); Copy( new_inp_resamp16k + L_FRAME16k - Sample_Delay_WB_BWE, hBWE_FD->old_input_wb_fx, Sample_Delay_WB_BWE ); #endif test(); IF( NE_16( st_fx->extl, SWB_BWE ) && NE_16( st_fx->extl, FB_BWE ) ) { Copy( old_input, hBWE_FD->L_old_wtda_swb_fx, L_FRAME16k ); #ifdef NONBE_FIX_ISSUE_2206 st_fx->Q_old_wtda = sub( Q_wb_sp, 0 ); Copy_Scale_sig( old_input, hBWE_FD->L_old_wtda_swb_fx, L_FRAME16k, sub( st_fx->Q_old_wtda, Q_wb_sp ) ); //Copy( old_input, hBWE_FD->L_old_wtda_swb_fx, L_FRAME16k ); //st_fx->Q_old_wtda = Q_wb_sp; #else Copy( old_input, hBWE_FD->L_old_wtda_swb_fx, L_FRAME16k ); st_fx->Q_old_wtda = -1; #endif move16(); Loading