From 0194f77f7eb314e6e2d8174ba717add978af8d81 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Mon, 23 Dec 2024 20:04:01 +0530 Subject: [PATCH] Bug fix in acelp and stereo tcx core enc --- lib_enc/enc_pit_exc_fx.c | 10 +++++----- lib_enc/ivas_tcx_core_enc.c | 2 +- lib_enc/tcx_utils_enc_fx.c | 1 + 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/lib_enc/enc_pit_exc_fx.c b/lib_enc/enc_pit_exc_fx.c index 78fe82979..9d75c82fc 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 b944816a9..5b19a7a0a 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 576f98d41..ad19753b5 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 ) ) -- GitLab