diff --git a/lib_enc/enc_pit_exc_fx.c b/lib_enc/enc_pit_exc_fx.c index 78fe8297913666cf619b0faecb15c388a9ec555a..9d75c82fc02612c1fc6cc3bb568490affa0826d4 100644 --- a/lib_enc/enc_pit_exc_fx.c +++ b/lib_enc/enc_pit_exc_fx.c @@ -766,7 +766,7 @@ void enc_pit_exc_ivas_fx( Copy( &res[i_subfr], &exc[i_subfr], L_subfr ); /* condition on target (compared to float) has been put outside the loop */ - find_targets_ivas_fx( speech, hLPDmem->mem_syn, i_subfr, &hLPDmem->mem_w0, p_Aq, + find_targets_ivas_fx( speech, hGSCEnc->mem_syn_tmp_fx, i_subfr, &hGSCEnc->mem_w0_tmp_fx, p_Aq, res, L_subfr, p_Aw, st_fx->preemph_fac, xn, cn, h1 ); Copy_Scale_sig( h1, h2, L_subfr, -2 ); @@ -897,7 +897,7 @@ void enc_pit_exc_ivas_fx( Ltmp = L_mac_o( Ltmp, xn[L_subfr - 1], 16384, &Overflow ); // Q_new-1+15+shift Ltmp = L_msu_o( Ltmp, y1[L_subfr - 1], gain_pit, &Overflow ); // Q_new-1+15+shift Ltmp = L_shl_o( Ltmp, sub( 1, shift ), &Overflow ); // Q_new+15 - hLPDmem->mem_w0 = round_fx_o( Ltmp, &Overflow ); /*Q_new-1 */ + hGSCEnc->mem_w0_tmp_fx = round_fx_o( Ltmp, &Overflow ); /*Q_new-1 */ #else Ltmp = L_mult( gcode16, y2[L_subfr - 1] ); Ltmp = L_shl( Ltmp, add( 5, shift ) ); @@ -905,7 +905,7 @@ void enc_pit_exc_ivas_fx( Ltmp = L_mac( Ltmp, xn[L_subfr - 1], 16384 ); Ltmp = L_msu( Ltmp, y1[L_subfr - 1], gain_pit ); Ltmp = L_shl( Ltmp, sub( 1, shift ) ); - hLPDmem->mem_w0 = round_fx( Ltmp ); /*Q_new-1 */ + hGSCEnc->mem_w0_tmp_fx = round_fx( Ltmp ); /*Q_new-1 */ #endif } ELSE @@ -914,11 +914,11 @@ void enc_pit_exc_ivas_fx( #ifdef BASOP_NOGLOB Ltmp = L_msu_sat( Ltmp, y1[L_subfr - 1], gain_pit ); // Q_new-1+15+shift Ltmp = L_shl_sat( Ltmp, sub( 1, shift ) ); // Q_new+15 - hLPDmem->mem_w0 = round_fx_sat( Ltmp ); /*Q_new-1 */ + hGSCEnc->mem_w0_tmp_fx = round_fx_sat( Ltmp ); /*Q_new-1 */ #else Ltmp = L_msu( Ltmp, y1[L_subfr - 1], gain_pit ); Ltmp = L_shl( Ltmp, sub( 1, shift ) ); - hLPDmem->mem_w0 = round_fx( Ltmp ); /*Q_new-1 */ + hGSCEnc->mem_w0_tmp_fx = round_fx( Ltmp ); /*Q_new-1 */ #endif } diff --git a/lib_enc/ivas_tcx_core_enc.c b/lib_enc/ivas_tcx_core_enc.c index b944816a9d18dc9bd1d78318126c41ab82e54c40..5b19a7a0a61873379c440eaa96fce14dc49afe90 100644 --- a/lib_enc/ivas_tcx_core_enc.c +++ b/lib_enc/ivas_tcx_core_enc.c @@ -712,7 +712,7 @@ void stereo_tcx_core_enc( move16(); Scale_sig( st->hLPDmem->mem_syn1_fx, M, sub( s_min( curr_q_syn, st->hLPDmem->q_mem_syn ), st->hLPDmem->q_mem_syn ) ); Scale_sig( st->hLPDmem->mem_syn3, M, sub( s_min( curr_q_syn, st->hLPDmem->q_mem_syn ), st->hLPDmem->q_mem_syn ) ); - st->hLPDmem->q_mem_syn = sub( Q_new, 1 ); + st->hLPDmem->q_mem_syn = s_min( curr_q_syn, st->hLPDmem->q_mem_syn ); move16(); st->hLPDmem->q_lpd_syn = Q_new; move16(); diff --git a/lib_enc/tcx_utils_enc_fx.c b/lib_enc/tcx_utils_enc_fx.c index 576f98d41fb85d5d9280cec00e10853079c859af..ad19753b5a397f61db9b7e46621daeeed71d4533 100644 --- a/lib_enc/tcx_utils_enc_fx.c +++ b/lib_enc/tcx_utils_enc_fx.c @@ -2581,6 +2581,7 @@ void tcx_encoder_memory_update_ivas_fx( Copy( synth + sub( L_frame_glob, M ), LPDmem->mem_syn, M ); Copy( synth + sub( L_frame_glob, M ), LPDmem->mem_syn2, M ); Copy( synth + sub( L_frame_glob, L_SYN_MEM ), LPDmem->mem_syn_r, L_SYN_MEM ); + LPDmem->q_mem_syn = sub( shl( Q_new, 1 ), 1 ); // resultant q of synth after E_UTIL_f_preemph2 test(); IF( st->tcxonly == 0 || LE_16( L_frame_glob, L_FRAME16k ) )