Loading lib_com/prot_fx.h +19 −13 Original line number Diff line number Diff line Loading @@ -10824,7 +10824,11 @@ ivas_error init_encoder_fx( const Word32 element_brate /* i : element bitrate */ ); #ifdef HARMONIZE_ACELP_ENC ivas_error acelp_core_enc_fx( #else ivas_error acelp_core_enc_ivas_fx( #endif Encoder_State *st, /* i/o: encoder state structure */ const Word16 inp[], /* i : input signal of the current frame Q_new*/ Word16 A[NB_SUBFR16k * ( M + 1 )], /* i : A(z) unquantized for the 4 subframes Q12*/ Loading @@ -10837,7 +10841,9 @@ ivas_error acelp_core_enc_ivas_fx( Word32 bwe_exc_extended_fx[], /* i/o: bandwidth extended excitation st->prev_Q_bwe_exc*/ Word16 *voice_factors_fx, /* o : voicing factors Q15*/ Word16 old_syn_12k8_16k[], /* o : intermediate ACELP synthesis at 12.8kHz or 16kHz to be used by SWB BWE q_old_syn_12k8_16*/ #ifndef HARMONIZE_ACELP_ENC Word16 *q_old_syn_12k8_16, /* o : Q factor of old_syn_12k8_16k[] */ #endif Word16 pitch_buf[NB_SUBFR16k], /* o : floating pitch for each subframe Q6*/ Word16 *unbits, /* o : number of unused bits Q0*/ STEREO_TD_ENC_DATA_HANDLE hStereoTD, /* i/o: TD stereo encoder handle */ Loading lib_enc/acelp_core_enc_fx.c +77 −47 Original line number Diff line number Diff line Loading @@ -11,7 +11,6 @@ #include "rom_com.h" #include "rom_enc.h" /* Encoder static table prototypes */ #include "prot_fx_enc.h" /* Function prototypes */ #include "ivas_cnst.h" #include "ivas_prot_fx.h" /*-------------------------------------------------------------------* Loading @@ -19,7 +18,9 @@ * * ACELP core encoder *--------------------------------------------------------------------*/ ivas_error acelp_core_enc_fx( #ifndef HARMONIZE_ACELP_ENC Encoder_State *st_fx, /* i/o: encoder state structure */ const Word16 inp_fx[], /* i : input signal of the current frame Q_new*/ const Word32 ener_fx, /* i : residual energy from Levinson-Durbin Q6*/ Loading Loading @@ -675,6 +676,7 @@ ivas_error acelp_core_enc_fx( *--------------------------------------------------------------------*/ ivas_error acelp_core_enc_ivas_fx( #endif Encoder_State *st, /* i/o: encoder state structure */ const Word16 inp[], /* i : input signal of the current frame Q_new*/ Word16 A[NB_SUBFR16k * ( M + 1 )], /* i : A(z) unquantized for the 4 subframes Q12*/ Loading @@ -687,7 +689,9 @@ ivas_error acelp_core_enc_ivas_fx( Word32 bwe_exc_extended_fx[], /* i/o: bandwidth extended excitation st->prev_Q_bwe_exc*/ Word16 *voice_factors_fx, /* o : voicing factors Q15*/ Word16 old_syn_12k8_16k[], /* o : intermediate ACELP synthesis at 12.8kHz or 16kHz to be used by SWB BWE q_old_syn_12k8_16*/ #ifndef HARMONIZE_ACELP_ENC Word16 *q_old_syn_12k8_16, /* o : Q factor of old_syn_12k8_16k[] */ #endif Word16 pitch_buf[NB_SUBFR16k], /* o : floating pitch for each subframe Q6*/ Word16 *unbits, /* o : number of unused bits Q0*/ STEREO_TD_ENC_DATA_HANDLE hStereoTD, /* i/o: TD stereo encoder handle */ Loading Loading @@ -758,7 +762,11 @@ ivas_error acelp_core_enc_ivas_fx( Word16 tmpF_fx; ivas_error error; hLPDmem = st->hLPDmem; #ifdef HARMONIZE_ACELP_ENC set16_fx( old_exc_fx, 0, L_EXC ); IF( st->element_mode > EVS_MONO ) #endif { Loading @@ -767,22 +775,22 @@ ivas_error acelp_core_enc_ivas_fx( { Scale_sig( st->hBWE_TD->old_bwe_exc_fx, PIT16k_MAX * 2, sub( Q_new, st->prev_Q_new ) ); // Q_new } IF( st->hLPDmem ) IF( hLPDmem ) { Scale_sig( st->hLPDmem->old_exc, L_EXC_MEM, sub( Q_new, st->hLPDmem->q_lpd_old_exc ) ); // Q_new st->hLPDmem->q_lpd_old_exc = Q_new; Scale_sig( hLPDmem->old_exc, L_EXC_MEM, sub( Q_new, hLPDmem->q_lpd_old_exc ) ); // Q_new hLPDmem->q_lpd_old_exc = Q_new; move16(); Scale_sig( st->hLPDmem->syn, M + 1, sub( Q_new, st->hLPDmem->q_lpd_syn ) ); // Q_new st->hLPDmem->q_lpd_syn = Q_new; Scale_sig( hLPDmem->syn, M + 1, sub( Q_new, hLPDmem->q_lpd_syn ) ); // Q_new hLPDmem->q_lpd_syn = Q_new; move16(); Scale_sig( st->hLPDmem->mem_syn, M, sub( sub( Q_new, 1 ), st->hLPDmem->q_mem_syn ) ); // Q_new -1 Scale_sig( st->hLPDmem->mem_syn1_fx, M, sub( sub( Q_new, 1 ), st->hLPDmem->q_mem_syn ) ); // Q_new -1 Scale_sig( st->hLPDmem->mem_syn2, M, sub( sub( Q_new, 1 ), st->hLPDmem->q_mem_syn ) ); // Q_new -1 Scale_sig( st->hLPDmem->mem_syn3, M, sub( sub( Q_new, 1 ), st->hLPDmem->q_mem_syn ) ); // Q_new -1 Scale_sig( st->hLPDmem->mem_syn_r, L_SYN_MEM, sub( sub( Q_new, 1 ), st->hLPDmem->q_mem_syn ) ); // Q_new -1 st->hLPDmem->mem_w0 = shl_sat( st->hLPDmem->mem_w0, sub( sub( Q_new, 1 ), st->hLPDmem->q_mem_syn ) ); // Q_new -1 Scale_sig( hLPDmem->mem_syn, M, sub( sub( Q_new, 1 ), hLPDmem->q_mem_syn ) ); // Q_new -1 Scale_sig( hLPDmem->mem_syn1_fx, M, sub( sub( Q_new, 1 ), hLPDmem->q_mem_syn ) ); // Q_new -1 Scale_sig( hLPDmem->mem_syn2, M, sub( sub( Q_new, 1 ), hLPDmem->q_mem_syn ) ); // Q_new -1 Scale_sig( hLPDmem->mem_syn3, M, sub( sub( Q_new, 1 ), hLPDmem->q_mem_syn ) ); // Q_new -1 Scale_sig( hLPDmem->mem_syn_r, L_SYN_MEM, sub( sub( Q_new, 1 ), hLPDmem->q_mem_syn ) ); // Q_new -1 hLPDmem->mem_w0 = shl_sat( hLPDmem->mem_w0, sub( sub( Q_new, 1 ), hLPDmem->q_mem_syn ) ); // Q_new -1 move16(); st->hLPDmem->q_mem_syn = sub( Q_new, 1 ); hLPDmem->q_mem_syn = sub( Q_new, 1 ); move16(); } Loading @@ -809,8 +817,6 @@ ivas_error acelp_core_enc_ivas_fx( * Initialization *------------------------------------------------------------------*/ hLPDmem = st->hLPDmem; Es_pred_fx = 0; move16(); Loading Loading @@ -877,7 +883,7 @@ ivas_error acelp_core_enc_ivas_fx( #ifdef HARMONIZE_ACELP_ENC /* SC-VBR temporary variables */ mCb1_fx = 0; //-> to be removed mCb1_fx = 0; move16(); pstreaklen_fx = 0; move16(); Loading @@ -890,7 +896,8 @@ ivas_error acelp_core_enc_ivas_fx( /* channel-aware mode */ reset_rf_indices_fx( st ); /* VBR modes */ /* SC-VBR modes */ IF( st->Opt_SC_VBR ) { ppp_mode = st->hSC_VBR->ppp_mode; Loading Loading @@ -1146,14 +1153,14 @@ ivas_error acelp_core_enc_ivas_fx( ELSE #endif { Scale_sig( st->hLPDmem->mem_syn, M, sub( st->Q_syn, st->hLPDmem->q_mem_syn ) ); // st->Q_syn Scale_sig( st->hLPDmem->mem_syn1_fx, M, sub( st->Q_syn, st->hLPDmem->q_mem_syn ) ); // st->Q_syn Scale_sig( st->hLPDmem->mem_syn2, M, sub( st->Q_syn, st->hLPDmem->q_mem_syn ) ); // st->Q_syn Scale_sig( st->hLPDmem->mem_syn3, M, sub( st->Q_syn, st->hLPDmem->q_mem_syn ) ); // st->Q_syn Scale_sig( st->hLPDmem->mem_syn_r, L_SYN_MEM, sub( st->Q_syn, st->hLPDmem->q_mem_syn ) ); // st->Q_syn st->hLPDmem->mem_w0 = shl_sat( st->hLPDmem->mem_w0, sub( st->Q_syn, st->hLPDmem->q_mem_syn ) ); // st->Q_syn Scale_sig( hLPDmem->mem_syn, M, sub( st->Q_syn, hLPDmem->q_mem_syn ) ); // st->Q_syn Scale_sig( hLPDmem->mem_syn1_fx, M, sub( st->Q_syn, hLPDmem->q_mem_syn ) ); // st->Q_syn Scale_sig( hLPDmem->mem_syn2, M, sub( st->Q_syn, hLPDmem->q_mem_syn ) ); // st->Q_syn Scale_sig( hLPDmem->mem_syn3, M, sub( st->Q_syn, hLPDmem->q_mem_syn ) ); // st->Q_syn Scale_sig( hLPDmem->mem_syn_r, L_SYN_MEM, sub( st->Q_syn, hLPDmem->q_mem_syn ) ); // st->Q_syn hLPDmem->mem_w0 = shl_sat( hLPDmem->mem_w0, sub( st->Q_syn, hLPDmem->q_mem_syn ) ); // st->Q_syn move16(); st->hLPDmem->q_mem_syn = st->Q_syn; hLPDmem->q_mem_syn = st->Q_syn; move16(); /* synthesis at 12.8kHz sampling rate */ Loading Loading @@ -1187,21 +1194,38 @@ ivas_error acelp_core_enc_ivas_fx( move16(); Scale_sig( st->hBWE_FD->old_syn_12k8_16k_fx, NS2SA( 16000, DELAY_FD_BWE_ENC_NS ), sub( st->Q_syn, st->hBWE_FD->q_mem_deemph_old_syn ) ); /* st->Q_syn */ save_old_syn_fx( st->L_frame, syn1_fx, old_syn_12k8_16k, st->hBWE_FD->old_syn_12k8_16k_fx, st->preemph_fac, &st->hBWE_FD->mem_deemph_old_syn_fx ); #ifdef HARMONIZE_ACELP_ENC Scale_sig( old_syn_12k8_16k, st->L_frame, sub( sub( Q_new, 1 ), st->Q_syn ) ); // Q_syn #else *q_old_syn_12k8_16 = st->Q_syn; move16(); #endif st->hBWE_FD->q_mem_deemph_old_syn = st->Q_syn; move16(); } } Scale_sig( st->hLPDmem->syn, M + 1, sub( st->Q_syn, st->hLPDmem->q_lpd_syn ) ); /* st->Q_syn */ st->hLPDmem->q_lpd_syn = st->Q_syn; #ifdef HARMONIZE_ACELP_ENC IF( st->element_mode == EVS_MONO ) { /* Update MODE2 core switching memory */ tmpF_fx = hLPDmem->syn[M]; move16(); E_UTIL_deemph2( sub( Q_new, 1 ), syn1_fx, st->preemph_fac, st->L_frame, &tmpF_fx ); Copy( syn1_fx + st->L_frame - M - 1, hLPDmem->syn, M + 1 ); /* st_fx->Q_syn */ } ELSE #endif { Scale_sig( hLPDmem->syn, M + 1, sub( st->Q_syn, hLPDmem->q_lpd_syn ) ); /* st->Q_syn */ hLPDmem->q_lpd_syn = st->Q_syn; move16(); /*Update MODE2 core switching memory*/ deemph_fx( syn1_fx, st->preemph_fac, st->L_frame, &( hLPDmem->syn[M] ) ); Copy( syn1_fx + add( st->L_frame, -M - 1 ), hLPDmem->syn, M + 1 ); /* st->Q_syn */ } } /*----------------------------------------------------------------* * Encoding of all other frames Loading Loading @@ -1326,7 +1350,7 @@ ivas_error acelp_core_enc_ivas_fx( move16(); preemph_fx( hLPDmem->old_exc, st->preemph_fac, st->L_frame, &tmpF_fx ); Copy( hLPDmem->old_exc + sub( st->L_frame, M ), hLPDmem->mem_syn, M ); /* Q_new */ Scale_sig( st->hLPDmem->mem_syn, M, sub( st->hLPDmem->q_mem_syn, Q_new ) ); Scale_sig( hLPDmem->mem_syn, M, sub( hLPDmem->q_mem_syn, Q_new ) ); Residu3_fx( Aq, hLPDmem->old_exc, old_exc_fx, st->L_frame, 0 ); } Loading Loading @@ -1481,10 +1505,12 @@ ivas_error acelp_core_enc_ivas_fx( Copy( syn_fx + sub( st->L_frame, L_SYN_MEM ), hLPDmem->mem_syn_r, L_SYN_MEM ); // hLPDmem->q_mem_syn #ifdef HARMONIZE_ACELP_ENC IF( st->element_mode > EVS_MONO ) #endif { Scale_sig( syn_fx, L_FRAME16k, sub( st->Q_syn, Q_new - 1 ) ); // Q_syn Scale_sig( syn_fx, st->L_frame, sub( st->Q_syn, Q_new - 1 ) ); // Q_syn } #else Scale_sig( syn_fx, L_FRAME16k, sub( st->Q_syn, Q_new - 1 ) ); // Q_syn #endif /* save and delay synthesis to be used by SWB BWE */ IF( st->hBWE_FD != NULL ) Loading @@ -1494,8 +1520,12 @@ ivas_error acelp_core_enc_ivas_fx( Scale_sig( st->hBWE_FD->old_syn_12k8_16k_fx, NS2SA( 16000, DELAY_FD_BWE_ENC_NS ), sub( s_min( st->Q_syn, st->hBWE_FD->q_mem_deemph_old_syn ), st->hBWE_FD->q_mem_deemph_old_syn ) ); // s_min( st->Q_syn, st->hBWE_FD->q_mem_deemph_old_syn ) save_old_syn_fx( st->L_frame, syn_fx, old_syn_12k8_16k, st->hBWE_FD->old_syn_12k8_16k_fx, st->preemph_fac, &st->hBWE_FD->mem_deemph_old_syn_fx ); #ifdef HARMONIZE_ACELP_ENC Scale_sig( old_syn_12k8_16k, st->L_frame, sub( sub( Q_new, 1 ), st->Q_syn ) ); // Q_syn #else *q_old_syn_12k8_16 = s_min( st->Q_syn, st->hBWE_FD->q_mem_deemph_old_syn ); move16(); #endif st->hBWE_FD->q_mem_deemph_old_syn = s_min( st->Q_syn, st->hBWE_FD->q_mem_deemph_old_syn ); move16(); Scale_sig( syn_fx, st->L_frame, sub( st->Q_syn, s_min( st->Q_syn, st->hBWE_FD->q_mem_deemph_old_syn ) ) ); // st->Q_syn Loading Loading @@ -1679,7 +1709,7 @@ ivas_error acelp_core_enc_ivas_fx( move16(); } #ifdef HARMONIZE_ACELP_ENC st->hLPDmem->q_lpd_old_exc = Q_new; hLPDmem->q_lpd_old_exc = Q_new; move16(); #endif } Loading lib_enc/evs_enc_fx.c +1 −2 Original line number Diff line number Diff line Loading @@ -272,8 +272,7 @@ ivas_error evs_enc_fx( IF( EQ_16( st->core, ACELP_CORE ) ) { #ifdef HARMONIZE_ACELP_ENC Word16 Q_old_syn_12k8_16k; IF( NE_32( ( error = acelp_core_enc_ivas_fx( st, inp, A, Aw, epsP, lsp_new, lsp_mid, vad_hover_flag, attack_flag, bwe_exc_extended, voice_factors, old_syn_12k8_16k, &Q_old_syn_12k8_16k, pitch_buf, &unbits, NULL, NULL, Q_new, shift ) ), IVAS_ERR_OK ) ) IF( NE_32( ( error = acelp_core_enc_fx( st, inp, A, Aw, epsP, lsp_new, lsp_mid, vad_hover_flag, attack_flag, bwe_exc_extended, voice_factors, old_syn_12k8_16k, pitch_buf, &unbits, NULL, NULL, Q_new, shift ) ), IVAS_ERR_OK ) ) { return error; } Loading lib_enc/ivas_core_enc_fx.c +5 −3 Original line number Diff line number Diff line Loading @@ -316,17 +316,19 @@ ivas_error ivas_core_enc_fx( IF( st->core == ACELP_CORE ) { /* ACELP core encoder */ Word16 Q_old_syn_12k8_16k = 0; move16(); #ifdef HARMONIZE_ACELP_ENC IF( NE_32( ( error = acelp_core_enc_ivas_fx( st, inp_fx[n], A_fx[n], Aw_fx[n], epsP_fx[n], lsp_new_fx[n], lsp_mid_fx[n], vad_hover_flag[0], attack_flag[n], bwe_exc_extended_fx[n], voice_factors_fx[n], old_syn_12k8_16k_fx[n], &Q_old_syn_12k8_16k, pitch_buf_fx[n], &unbits[n], hStereoTD, tdm_lsfQ_PCh_fx, Q_new[n], 0 ) ), IVAS_ERR_OK ) ) IF( NE_32( ( error = acelp_core_enc_fx( st, inp_fx[n], A_fx[n], Aw_fx[n], epsP_fx[n], lsp_new_fx[n], lsp_mid_fx[n], vad_hover_flag[0], attack_flag[n], bwe_exc_extended_fx[n], voice_factors_fx[n], old_syn_12k8_16k_fx[n], pitch_buf_fx[n], &unbits[n], hStereoTD, tdm_lsfQ_PCh_fx, Q_new[n], 0 ) ), IVAS_ERR_OK ) ) #else Word16 Q_old_syn_12k8_16k = 0; move16(); IF( NE_32( ( error = acelp_core_enc_ivas_fx( st, inp_fx[n], /*ener[n],*/ A_fx[n], Aw_fx[n], epsP_fx[n], lsp_new_fx[n], lsp_mid_fx[n], vad_hover_flag[0], attack_flag[n], bwe_exc_extended_fx[n], voice_factors_fx[n], old_syn_12k8_16k_fx[n], &Q_old_syn_12k8_16k, pitch_buf_fx[n], &unbits[n], hStereoTD, tdm_lsfQ_PCh_fx, Q_new[n] ) ), IVAS_ERR_OK ) ) #endif { return error; } #ifndef HARMONIZE_ACELP_ENC Scale_sig( old_syn_12k8_16k_fx[n], st->L_frame, sub( sub( Q_new[n], 1 ), Q_old_syn_12k8_16k ) ); // Q_old_syn_12k8_16k -> Q_new[n] - 1 #endif } test(); Loading lib_enc/prot_fx_enc.h +2 −1 Original line number Diff line number Diff line Loading @@ -41,6 +41,7 @@ #include "ivas_stat_enc.h" #ifndef HARMONIZE_ACELP_ENC ivas_error acelp_core_enc_fx( Encoder_State *st_fx, /* i/o: encoder state structure */ const Word16 inp_fx[], /* i : input signal of the current frame Q_new*/ Loading @@ -61,7 +62,7 @@ ivas_error acelp_core_enc_fx( STEREO_TD_ENC_DATA_HANDLE hStereoTD, /* i/o: TD stereo encoder handle */ const Word16 Q_new, const Word16 shift ); #endif void analy_lp_fx( const Word16 speech[], /* i :(Q_new) pointer to the speech frame */ const Word16 L_frame, /* i :(q0) length of the frame */ Loading Loading
lib_com/prot_fx.h +19 −13 Original line number Diff line number Diff line Loading @@ -10824,7 +10824,11 @@ ivas_error init_encoder_fx( const Word32 element_brate /* i : element bitrate */ ); #ifdef HARMONIZE_ACELP_ENC ivas_error acelp_core_enc_fx( #else ivas_error acelp_core_enc_ivas_fx( #endif Encoder_State *st, /* i/o: encoder state structure */ const Word16 inp[], /* i : input signal of the current frame Q_new*/ Word16 A[NB_SUBFR16k * ( M + 1 )], /* i : A(z) unquantized for the 4 subframes Q12*/ Loading @@ -10837,7 +10841,9 @@ ivas_error acelp_core_enc_ivas_fx( Word32 bwe_exc_extended_fx[], /* i/o: bandwidth extended excitation st->prev_Q_bwe_exc*/ Word16 *voice_factors_fx, /* o : voicing factors Q15*/ Word16 old_syn_12k8_16k[], /* o : intermediate ACELP synthesis at 12.8kHz or 16kHz to be used by SWB BWE q_old_syn_12k8_16*/ #ifndef HARMONIZE_ACELP_ENC Word16 *q_old_syn_12k8_16, /* o : Q factor of old_syn_12k8_16k[] */ #endif Word16 pitch_buf[NB_SUBFR16k], /* o : floating pitch for each subframe Q6*/ Word16 *unbits, /* o : number of unused bits Q0*/ STEREO_TD_ENC_DATA_HANDLE hStereoTD, /* i/o: TD stereo encoder handle */ Loading
lib_enc/acelp_core_enc_fx.c +77 −47 Original line number Diff line number Diff line Loading @@ -11,7 +11,6 @@ #include "rom_com.h" #include "rom_enc.h" /* Encoder static table prototypes */ #include "prot_fx_enc.h" /* Function prototypes */ #include "ivas_cnst.h" #include "ivas_prot_fx.h" /*-------------------------------------------------------------------* Loading @@ -19,7 +18,9 @@ * * ACELP core encoder *--------------------------------------------------------------------*/ ivas_error acelp_core_enc_fx( #ifndef HARMONIZE_ACELP_ENC Encoder_State *st_fx, /* i/o: encoder state structure */ const Word16 inp_fx[], /* i : input signal of the current frame Q_new*/ const Word32 ener_fx, /* i : residual energy from Levinson-Durbin Q6*/ Loading Loading @@ -675,6 +676,7 @@ ivas_error acelp_core_enc_fx( *--------------------------------------------------------------------*/ ivas_error acelp_core_enc_ivas_fx( #endif Encoder_State *st, /* i/o: encoder state structure */ const Word16 inp[], /* i : input signal of the current frame Q_new*/ Word16 A[NB_SUBFR16k * ( M + 1 )], /* i : A(z) unquantized for the 4 subframes Q12*/ Loading @@ -687,7 +689,9 @@ ivas_error acelp_core_enc_ivas_fx( Word32 bwe_exc_extended_fx[], /* i/o: bandwidth extended excitation st->prev_Q_bwe_exc*/ Word16 *voice_factors_fx, /* o : voicing factors Q15*/ Word16 old_syn_12k8_16k[], /* o : intermediate ACELP synthesis at 12.8kHz or 16kHz to be used by SWB BWE q_old_syn_12k8_16*/ #ifndef HARMONIZE_ACELP_ENC Word16 *q_old_syn_12k8_16, /* o : Q factor of old_syn_12k8_16k[] */ #endif Word16 pitch_buf[NB_SUBFR16k], /* o : floating pitch for each subframe Q6*/ Word16 *unbits, /* o : number of unused bits Q0*/ STEREO_TD_ENC_DATA_HANDLE hStereoTD, /* i/o: TD stereo encoder handle */ Loading Loading @@ -758,7 +762,11 @@ ivas_error acelp_core_enc_ivas_fx( Word16 tmpF_fx; ivas_error error; hLPDmem = st->hLPDmem; #ifdef HARMONIZE_ACELP_ENC set16_fx( old_exc_fx, 0, L_EXC ); IF( st->element_mode > EVS_MONO ) #endif { Loading @@ -767,22 +775,22 @@ ivas_error acelp_core_enc_ivas_fx( { Scale_sig( st->hBWE_TD->old_bwe_exc_fx, PIT16k_MAX * 2, sub( Q_new, st->prev_Q_new ) ); // Q_new } IF( st->hLPDmem ) IF( hLPDmem ) { Scale_sig( st->hLPDmem->old_exc, L_EXC_MEM, sub( Q_new, st->hLPDmem->q_lpd_old_exc ) ); // Q_new st->hLPDmem->q_lpd_old_exc = Q_new; Scale_sig( hLPDmem->old_exc, L_EXC_MEM, sub( Q_new, hLPDmem->q_lpd_old_exc ) ); // Q_new hLPDmem->q_lpd_old_exc = Q_new; move16(); Scale_sig( st->hLPDmem->syn, M + 1, sub( Q_new, st->hLPDmem->q_lpd_syn ) ); // Q_new st->hLPDmem->q_lpd_syn = Q_new; Scale_sig( hLPDmem->syn, M + 1, sub( Q_new, hLPDmem->q_lpd_syn ) ); // Q_new hLPDmem->q_lpd_syn = Q_new; move16(); Scale_sig( st->hLPDmem->mem_syn, M, sub( sub( Q_new, 1 ), st->hLPDmem->q_mem_syn ) ); // Q_new -1 Scale_sig( st->hLPDmem->mem_syn1_fx, M, sub( sub( Q_new, 1 ), st->hLPDmem->q_mem_syn ) ); // Q_new -1 Scale_sig( st->hLPDmem->mem_syn2, M, sub( sub( Q_new, 1 ), st->hLPDmem->q_mem_syn ) ); // Q_new -1 Scale_sig( st->hLPDmem->mem_syn3, M, sub( sub( Q_new, 1 ), st->hLPDmem->q_mem_syn ) ); // Q_new -1 Scale_sig( st->hLPDmem->mem_syn_r, L_SYN_MEM, sub( sub( Q_new, 1 ), st->hLPDmem->q_mem_syn ) ); // Q_new -1 st->hLPDmem->mem_w0 = shl_sat( st->hLPDmem->mem_w0, sub( sub( Q_new, 1 ), st->hLPDmem->q_mem_syn ) ); // Q_new -1 Scale_sig( hLPDmem->mem_syn, M, sub( sub( Q_new, 1 ), hLPDmem->q_mem_syn ) ); // Q_new -1 Scale_sig( hLPDmem->mem_syn1_fx, M, sub( sub( Q_new, 1 ), hLPDmem->q_mem_syn ) ); // Q_new -1 Scale_sig( hLPDmem->mem_syn2, M, sub( sub( Q_new, 1 ), hLPDmem->q_mem_syn ) ); // Q_new -1 Scale_sig( hLPDmem->mem_syn3, M, sub( sub( Q_new, 1 ), hLPDmem->q_mem_syn ) ); // Q_new -1 Scale_sig( hLPDmem->mem_syn_r, L_SYN_MEM, sub( sub( Q_new, 1 ), hLPDmem->q_mem_syn ) ); // Q_new -1 hLPDmem->mem_w0 = shl_sat( hLPDmem->mem_w0, sub( sub( Q_new, 1 ), hLPDmem->q_mem_syn ) ); // Q_new -1 move16(); st->hLPDmem->q_mem_syn = sub( Q_new, 1 ); hLPDmem->q_mem_syn = sub( Q_new, 1 ); move16(); } Loading @@ -809,8 +817,6 @@ ivas_error acelp_core_enc_ivas_fx( * Initialization *------------------------------------------------------------------*/ hLPDmem = st->hLPDmem; Es_pred_fx = 0; move16(); Loading Loading @@ -877,7 +883,7 @@ ivas_error acelp_core_enc_ivas_fx( #ifdef HARMONIZE_ACELP_ENC /* SC-VBR temporary variables */ mCb1_fx = 0; //-> to be removed mCb1_fx = 0; move16(); pstreaklen_fx = 0; move16(); Loading @@ -890,7 +896,8 @@ ivas_error acelp_core_enc_ivas_fx( /* channel-aware mode */ reset_rf_indices_fx( st ); /* VBR modes */ /* SC-VBR modes */ IF( st->Opt_SC_VBR ) { ppp_mode = st->hSC_VBR->ppp_mode; Loading Loading @@ -1146,14 +1153,14 @@ ivas_error acelp_core_enc_ivas_fx( ELSE #endif { Scale_sig( st->hLPDmem->mem_syn, M, sub( st->Q_syn, st->hLPDmem->q_mem_syn ) ); // st->Q_syn Scale_sig( st->hLPDmem->mem_syn1_fx, M, sub( st->Q_syn, st->hLPDmem->q_mem_syn ) ); // st->Q_syn Scale_sig( st->hLPDmem->mem_syn2, M, sub( st->Q_syn, st->hLPDmem->q_mem_syn ) ); // st->Q_syn Scale_sig( st->hLPDmem->mem_syn3, M, sub( st->Q_syn, st->hLPDmem->q_mem_syn ) ); // st->Q_syn Scale_sig( st->hLPDmem->mem_syn_r, L_SYN_MEM, sub( st->Q_syn, st->hLPDmem->q_mem_syn ) ); // st->Q_syn st->hLPDmem->mem_w0 = shl_sat( st->hLPDmem->mem_w0, sub( st->Q_syn, st->hLPDmem->q_mem_syn ) ); // st->Q_syn Scale_sig( hLPDmem->mem_syn, M, sub( st->Q_syn, hLPDmem->q_mem_syn ) ); // st->Q_syn Scale_sig( hLPDmem->mem_syn1_fx, M, sub( st->Q_syn, hLPDmem->q_mem_syn ) ); // st->Q_syn Scale_sig( hLPDmem->mem_syn2, M, sub( st->Q_syn, hLPDmem->q_mem_syn ) ); // st->Q_syn Scale_sig( hLPDmem->mem_syn3, M, sub( st->Q_syn, hLPDmem->q_mem_syn ) ); // st->Q_syn Scale_sig( hLPDmem->mem_syn_r, L_SYN_MEM, sub( st->Q_syn, hLPDmem->q_mem_syn ) ); // st->Q_syn hLPDmem->mem_w0 = shl_sat( hLPDmem->mem_w0, sub( st->Q_syn, hLPDmem->q_mem_syn ) ); // st->Q_syn move16(); st->hLPDmem->q_mem_syn = st->Q_syn; hLPDmem->q_mem_syn = st->Q_syn; move16(); /* synthesis at 12.8kHz sampling rate */ Loading Loading @@ -1187,21 +1194,38 @@ ivas_error acelp_core_enc_ivas_fx( move16(); Scale_sig( st->hBWE_FD->old_syn_12k8_16k_fx, NS2SA( 16000, DELAY_FD_BWE_ENC_NS ), sub( st->Q_syn, st->hBWE_FD->q_mem_deemph_old_syn ) ); /* st->Q_syn */ save_old_syn_fx( st->L_frame, syn1_fx, old_syn_12k8_16k, st->hBWE_FD->old_syn_12k8_16k_fx, st->preemph_fac, &st->hBWE_FD->mem_deemph_old_syn_fx ); #ifdef HARMONIZE_ACELP_ENC Scale_sig( old_syn_12k8_16k, st->L_frame, sub( sub( Q_new, 1 ), st->Q_syn ) ); // Q_syn #else *q_old_syn_12k8_16 = st->Q_syn; move16(); #endif st->hBWE_FD->q_mem_deemph_old_syn = st->Q_syn; move16(); } } Scale_sig( st->hLPDmem->syn, M + 1, sub( st->Q_syn, st->hLPDmem->q_lpd_syn ) ); /* st->Q_syn */ st->hLPDmem->q_lpd_syn = st->Q_syn; #ifdef HARMONIZE_ACELP_ENC IF( st->element_mode == EVS_MONO ) { /* Update MODE2 core switching memory */ tmpF_fx = hLPDmem->syn[M]; move16(); E_UTIL_deemph2( sub( Q_new, 1 ), syn1_fx, st->preemph_fac, st->L_frame, &tmpF_fx ); Copy( syn1_fx + st->L_frame - M - 1, hLPDmem->syn, M + 1 ); /* st_fx->Q_syn */ } ELSE #endif { Scale_sig( hLPDmem->syn, M + 1, sub( st->Q_syn, hLPDmem->q_lpd_syn ) ); /* st->Q_syn */ hLPDmem->q_lpd_syn = st->Q_syn; move16(); /*Update MODE2 core switching memory*/ deemph_fx( syn1_fx, st->preemph_fac, st->L_frame, &( hLPDmem->syn[M] ) ); Copy( syn1_fx + add( st->L_frame, -M - 1 ), hLPDmem->syn, M + 1 ); /* st->Q_syn */ } } /*----------------------------------------------------------------* * Encoding of all other frames Loading Loading @@ -1326,7 +1350,7 @@ ivas_error acelp_core_enc_ivas_fx( move16(); preemph_fx( hLPDmem->old_exc, st->preemph_fac, st->L_frame, &tmpF_fx ); Copy( hLPDmem->old_exc + sub( st->L_frame, M ), hLPDmem->mem_syn, M ); /* Q_new */ Scale_sig( st->hLPDmem->mem_syn, M, sub( st->hLPDmem->q_mem_syn, Q_new ) ); Scale_sig( hLPDmem->mem_syn, M, sub( hLPDmem->q_mem_syn, Q_new ) ); Residu3_fx( Aq, hLPDmem->old_exc, old_exc_fx, st->L_frame, 0 ); } Loading Loading @@ -1481,10 +1505,12 @@ ivas_error acelp_core_enc_ivas_fx( Copy( syn_fx + sub( st->L_frame, L_SYN_MEM ), hLPDmem->mem_syn_r, L_SYN_MEM ); // hLPDmem->q_mem_syn #ifdef HARMONIZE_ACELP_ENC IF( st->element_mode > EVS_MONO ) #endif { Scale_sig( syn_fx, L_FRAME16k, sub( st->Q_syn, Q_new - 1 ) ); // Q_syn Scale_sig( syn_fx, st->L_frame, sub( st->Q_syn, Q_new - 1 ) ); // Q_syn } #else Scale_sig( syn_fx, L_FRAME16k, sub( st->Q_syn, Q_new - 1 ) ); // Q_syn #endif /* save and delay synthesis to be used by SWB BWE */ IF( st->hBWE_FD != NULL ) Loading @@ -1494,8 +1520,12 @@ ivas_error acelp_core_enc_ivas_fx( Scale_sig( st->hBWE_FD->old_syn_12k8_16k_fx, NS2SA( 16000, DELAY_FD_BWE_ENC_NS ), sub( s_min( st->Q_syn, st->hBWE_FD->q_mem_deemph_old_syn ), st->hBWE_FD->q_mem_deemph_old_syn ) ); // s_min( st->Q_syn, st->hBWE_FD->q_mem_deemph_old_syn ) save_old_syn_fx( st->L_frame, syn_fx, old_syn_12k8_16k, st->hBWE_FD->old_syn_12k8_16k_fx, st->preemph_fac, &st->hBWE_FD->mem_deemph_old_syn_fx ); #ifdef HARMONIZE_ACELP_ENC Scale_sig( old_syn_12k8_16k, st->L_frame, sub( sub( Q_new, 1 ), st->Q_syn ) ); // Q_syn #else *q_old_syn_12k8_16 = s_min( st->Q_syn, st->hBWE_FD->q_mem_deemph_old_syn ); move16(); #endif st->hBWE_FD->q_mem_deemph_old_syn = s_min( st->Q_syn, st->hBWE_FD->q_mem_deemph_old_syn ); move16(); Scale_sig( syn_fx, st->L_frame, sub( st->Q_syn, s_min( st->Q_syn, st->hBWE_FD->q_mem_deemph_old_syn ) ) ); // st->Q_syn Loading Loading @@ -1679,7 +1709,7 @@ ivas_error acelp_core_enc_ivas_fx( move16(); } #ifdef HARMONIZE_ACELP_ENC st->hLPDmem->q_lpd_old_exc = Q_new; hLPDmem->q_lpd_old_exc = Q_new; move16(); #endif } Loading
lib_enc/evs_enc_fx.c +1 −2 Original line number Diff line number Diff line Loading @@ -272,8 +272,7 @@ ivas_error evs_enc_fx( IF( EQ_16( st->core, ACELP_CORE ) ) { #ifdef HARMONIZE_ACELP_ENC Word16 Q_old_syn_12k8_16k; IF( NE_32( ( error = acelp_core_enc_ivas_fx( st, inp, A, Aw, epsP, lsp_new, lsp_mid, vad_hover_flag, attack_flag, bwe_exc_extended, voice_factors, old_syn_12k8_16k, &Q_old_syn_12k8_16k, pitch_buf, &unbits, NULL, NULL, Q_new, shift ) ), IVAS_ERR_OK ) ) IF( NE_32( ( error = acelp_core_enc_fx( st, inp, A, Aw, epsP, lsp_new, lsp_mid, vad_hover_flag, attack_flag, bwe_exc_extended, voice_factors, old_syn_12k8_16k, pitch_buf, &unbits, NULL, NULL, Q_new, shift ) ), IVAS_ERR_OK ) ) { return error; } Loading
lib_enc/ivas_core_enc_fx.c +5 −3 Original line number Diff line number Diff line Loading @@ -316,17 +316,19 @@ ivas_error ivas_core_enc_fx( IF( st->core == ACELP_CORE ) { /* ACELP core encoder */ Word16 Q_old_syn_12k8_16k = 0; move16(); #ifdef HARMONIZE_ACELP_ENC IF( NE_32( ( error = acelp_core_enc_ivas_fx( st, inp_fx[n], A_fx[n], Aw_fx[n], epsP_fx[n], lsp_new_fx[n], lsp_mid_fx[n], vad_hover_flag[0], attack_flag[n], bwe_exc_extended_fx[n], voice_factors_fx[n], old_syn_12k8_16k_fx[n], &Q_old_syn_12k8_16k, pitch_buf_fx[n], &unbits[n], hStereoTD, tdm_lsfQ_PCh_fx, Q_new[n], 0 ) ), IVAS_ERR_OK ) ) IF( NE_32( ( error = acelp_core_enc_fx( st, inp_fx[n], A_fx[n], Aw_fx[n], epsP_fx[n], lsp_new_fx[n], lsp_mid_fx[n], vad_hover_flag[0], attack_flag[n], bwe_exc_extended_fx[n], voice_factors_fx[n], old_syn_12k8_16k_fx[n], pitch_buf_fx[n], &unbits[n], hStereoTD, tdm_lsfQ_PCh_fx, Q_new[n], 0 ) ), IVAS_ERR_OK ) ) #else Word16 Q_old_syn_12k8_16k = 0; move16(); IF( NE_32( ( error = acelp_core_enc_ivas_fx( st, inp_fx[n], /*ener[n],*/ A_fx[n], Aw_fx[n], epsP_fx[n], lsp_new_fx[n], lsp_mid_fx[n], vad_hover_flag[0], attack_flag[n], bwe_exc_extended_fx[n], voice_factors_fx[n], old_syn_12k8_16k_fx[n], &Q_old_syn_12k8_16k, pitch_buf_fx[n], &unbits[n], hStereoTD, tdm_lsfQ_PCh_fx, Q_new[n] ) ), IVAS_ERR_OK ) ) #endif { return error; } #ifndef HARMONIZE_ACELP_ENC Scale_sig( old_syn_12k8_16k_fx[n], st->L_frame, sub( sub( Q_new[n], 1 ), Q_old_syn_12k8_16k ) ); // Q_old_syn_12k8_16k -> Q_new[n] - 1 #endif } test(); Loading
lib_enc/prot_fx_enc.h +2 −1 Original line number Diff line number Diff line Loading @@ -41,6 +41,7 @@ #include "ivas_stat_enc.h" #ifndef HARMONIZE_ACELP_ENC ivas_error acelp_core_enc_fx( Encoder_State *st_fx, /* i/o: encoder state structure */ const Word16 inp_fx[], /* i : input signal of the current frame Q_new*/ Loading @@ -61,7 +62,7 @@ ivas_error acelp_core_enc_fx( STEREO_TD_ENC_DATA_HANDLE hStereoTD, /* i/o: TD stereo encoder handle */ const Word16 Q_new, const Word16 shift ); #endif void analy_lp_fx( const Word16 speech[], /* i :(Q_new) pointer to the speech frame */ const Word16 L_frame, /* i :(q0) length of the frame */ Loading