From ea24b53a3f9f9791def48ea609cdb6df071b1b84 Mon Sep 17 00:00:00 2001 From: vaclav Date: Fri, 6 Feb 2026 19:09:38 +0100 Subject: [PATCH] HARM_LEV_DURBIN --- lib_com/ACcontextMapping_fx.c | 4 +- lib_com/fd_cng_com_fx.c | 2 +- lib_com/lpc_tools_fx.c | 68 ++++++++++++++++++++++------- lib_com/lsp_conv_poly_fx.c | 6 +-- lib_com/modif_fs_fx.c | 4 +- lib_com/options.h | 1 + lib_com/prot_fx.h | 37 +++------------- lib_com/swb_tbe_com_fx.c | 10 ++--- lib_com/tcx_ltp_fx.c | 4 +- lib_com/tools_fx.c | 2 +- lib_dec/ACcontextMapping_dec_fx.c | 8 ++-- lib_dec/dec_LPD_fx.c | 2 +- lib_dec/er_dec_tcx_fx.c | 2 +- lib_dec/ivas_tcx_core_dec_fx.c | 2 +- lib_enc/ACcontextMapping_enc_fx.c | 16 +++---- lib_enc/analy_lp_fx.c | 4 +- lib_enc/core_enc_ol_fx.c | 2 +- lib_enc/ext_sig_ana_fx.c | 4 +- lib_enc/ivas_masa_enc_fx.c | 2 +- lib_enc/ivas_stereo_dft_td_itd_fx.c | 2 +- lib_enc/swb_tbe_enc_fx.c | 20 ++++----- 21 files changed, 106 insertions(+), 96 deletions(-) diff --git a/lib_com/ACcontextMapping_fx.c b/lib_com/ACcontextMapping_fx.c index 733824243..19cbea1a4 100644 --- a/lib_com/ACcontextMapping_fx.c +++ b/lib_com/ACcontextMapping_fx.c @@ -57,7 +57,7 @@ Word16 get_next_coeff_unmapped( return *idx; } -Word16 update_mixed_context( +Word16 update_mixed_context_fx( Word16 ctx, /* Q0 */ Word16 a /* Q0 */ ) @@ -78,7 +78,7 @@ Word16 update_mixed_context( return add( shl( s_and( ctx, 0xf ), 4 ), add( t, 13 ) ); } -Word32 update_mixed_context_ivas_fx( +Word32 update_mixed_context_fx_32( Word32 ctx, /* Q0 */ Word16 a /* Q0 */ ) diff --git a/lib_com/fd_cng_com_fx.c b/lib_com/fd_cng_com_fx.c index ac6d781a4..f7b58ae62 100644 --- a/lib_com/fd_cng_com_fx.c +++ b/lib_com/fd_cng_com_fx.c @@ -2995,7 +2995,7 @@ void lpc_from_spectrum( /* LPC */ - E_LPC_lev_dur( r_h, r_l, A, NULL, lpcorder, NULL ); + E_LPC_lev_dur_fx( r_h, r_l, A, NULL, lpcorder, NULL ); } /* diff --git a/lib_com/lpc_tools_fx.c b/lib_com/lpc_tools_fx.c index 5b3b8a1c0..dafb07d1d 100644 --- a/lib_com/lpc_tools_fx.c +++ b/lib_com/lpc_tools_fx.c @@ -446,12 +446,18 @@ static Word32 Div_32_opt( Word32 L_num /*Q31*/, Word16 denom_hi /*Qx -16*/, Word * Returns: * void */ -Word16 E_LPC_lev_dur( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*QR -1*/, Word16 A[] /*Qx*/, Word32 epsP[] /*QR*/, const Word16 order, Word16 *mem /*Qx*/ ) -{ - return ( E_LPC_lev_dur_stab( Rh, Rl, A, epsP, order, mem, 32750 ) ); /* 0.99945 in Q15 */ -} -Word16 E_LPC_lev_dur_stab( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*QR -1*/, Word16 A[] /*Qx*/, Word32 epsP[] /*QR*/, const Word16 order, Word16 *mem /*Qx*/, Word16 k_max /*Q15*/ ) +static Word16 E_LPC_lev_dur_stab( +#ifdef HARM_LEV_DURBIN + const Word16 element_mode, +#endif + const Word16 Rh[] /*QR -16*/, + const Word16 Rl[] /*QR -1*/, + Word16 A[] /*Qx*/, + Word32 epsP[] /*QR*/, + const Word16 order, + Word16 *mem /*Qx*/, + Word16 k_max /*Q15*/ ) { Word16 i, j, k; Word16 hi, lo; @@ -608,7 +614,19 @@ Word16 E_LPC_lev_dur_stab( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*QR t0 = L_Comp( Ah[i], Al[i] ); t1 = L_max( t1, L_abs( t0 ) ); } + +#ifdef HARM_LEV_DURBIN + IF( element_mode == EVS_MONO ) + { + k = s_min( norm_l( t1 ), 3 ); + } + ELSE + { + k = s_min( sub( norm_l( t1 ), 1 ), 3 ); + } +#else k = s_min( norm_l( t1 ), 3 ); +#endif A[0] = shl( 2048, k ); move16(); FOR( i = 1; i <= order; i++ ) @@ -632,16 +650,20 @@ Word16 E_LPC_lev_dur_stab( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*QR } } - return ( flag ); } -Word16 E_LPC_lev_dur_ivas_fx( const Word16 Rh[], const Word16 Rl[], Word16 A[], Word32 epsP[], const Word16 order, Word16 *mem ) +Word16 E_LPC_lev_dur_fx( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*QR -1*/, Word16 A[] /*Qx*/, Word32 epsP[] /*QR*/, const Word16 order, Word16 *mem /*Qx*/ ) { - return ( E_LPC_lev_dur_stab_ivas_fx( Rh, Rl, A, epsP, order, mem, 32750 ) ); /* 0.99945 in Q15 */ +#ifdef HARM_LEV_DURBIN + return ( E_LPC_lev_dur_stab( EVS_MONO, Rh, Rl, A, epsP, order, mem, 32750 ) ); /* 0.99945 in Q15 */ +#else + return ( E_LPC_lev_dur_stab( Rh, Rl, A, epsP, order, mem, 32750 ) ); /* 0.99945 in Q15 */ +#endif } -Word16 E_LPC_lev_dur_stab_ivas_fx( const Word16 Rh[], const Word16 Rl[], Word16 A[], Word32 epsP[], const Word16 order, Word16 *mem, Word16 k_max ) +#ifndef HARM_LEV_DURBIN +static Word16 E_LPC_lev_dur_stab_ivas_fx( const Word16 Rh[], const Word16 Rl[], Word16 A[], Word32 epsP[], const Word16 order, Word16 *mem, Word16 k_max ) { Word16 i, j, k; Word16 hi, lo; @@ -822,16 +844,27 @@ Word16 E_LPC_lev_dur_stab_ivas_fx( const Word16 Rh[], const Word16 Rl[], Word16 } } - return ( flag ); } - -Word16 E_LPC_lev_dur_fx( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*QR -1*/, Word32 A[] /*QA*/, Word32 epsP[] /*QR*/, const Word16 order, Word32 *mem /*QA*/ ) +#endif +Word16 E_LPC_lev_dur_ivas_fx( const Word16 Rh[], const Word16 Rl[], Word16 A[], Word32 epsP[], const Word16 order, Word16 *mem ) { - return ( E_LPC_lev_dur_stab_fx( Rh, Rl, A, epsP, order, mem, 32750 ) ); /* 0.99945 in Q15 */ +#ifdef HARM_LEV_DURBIN + return ( E_LPC_lev_dur_stab( IVAS_SCE /* just to differentiate from EVS_MONO */, Rh, Rl, A, epsP, order, mem, 32750 ) ); /* 0.99945 in Q15 */ +#else + return ( E_LPC_lev_dur_stab_ivas_fx( Rh, Rl, A, epsP, order, mem, 32750 ) ); /* 0.99945 in Q15 */ +#endif } -Word16 E_LPC_lev_dur_stab_fx( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*QR -1*/, Word32 A[] /*QA*/, Word32 epsP[] /*QR*/, const Word16 order, Word32 *mem /*QA*/, Word16 k_max /*Q15*/ ) + +static Word16 E_LPC_lev_dur_stab_fx_32( + const Word16 Rh[] /*QR -16*/, + const Word16 Rl[] /*QR -1*/, + Word32 A[] /*QA*/, + Word32 epsP[] /*QR*/, + const Word16 order, + Word32 *mem /*QA*/, + Word16 k_max /*Q15*/ ) { Word16 i, j, k; Word16 hi, lo; @@ -965,7 +998,6 @@ Word16 E_LPC_lev_dur_stab_fx( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /* lo = L_Extract_lc( t0, &hi ); /* DPF format */ t0 = Mpy_32( alp_h, alp_l, hi, lo ); /* Alpha in Q31 */ - /* store denormalized alpha in epsP */ t1 = L_shr( t0, alp_exp ); if ( epsP != NULL ) @@ -1012,10 +1044,14 @@ Word16 E_LPC_lev_dur_stab_fx( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /* } } - return ( flag ); } +Word16 E_LPC_lev_dur_fx_32( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*QR -1*/, Word32 A[] /*QA*/, Word32 epsP[] /*QR*/, const Word16 order, Word32 *mem /*QA*/ ) +{ + return ( E_LPC_lev_dur_stab_fx_32( Rh, Rl, A, epsP, order, mem, 32750 ) ); /* 0.99945 in Q15 */ +} + /* * E_LPC_a_add_tilt diff --git a/lib_com/lsp_conv_poly_fx.c b/lib_com/lsp_conv_poly_fx.c index 473d1d652..834f7b0aa 100644 --- a/lib_com/lsp_conv_poly_fx.c +++ b/lib_com/lsp_conv_poly_fx.c @@ -105,6 +105,7 @@ Word16 lsp_convert_poly_fx( powerspect_fx( grid50_fx, N50, R, S, G, DOWNCONV ); spectautocorr_fx( grid40_fx, N40, G, rh, rl ); } + /*---------------------------------------------------------------------* * Conversion from 12.8 kHz up to 16.0 kHz. * Compute the power spectrum of the LP filter, extrapolate the @@ -125,14 +126,13 @@ Word16 lsp_convert_poly_fx( spectautocorr_fx( grid50_fx, N50, G, rh, rl ); } - /*---------------------------------------------------------------------* * Compute the linear prediction coefficients from the autocorrelation * and convert to line spectrum pairs. *---------------------------------------------------------------------*/ - flag = E_LPC_lev_dur( rh, rl, A, epsP, M, oldA ); - E_LPC_a_lsp_conversion( A, w, stable_LSP_fx, M ); + flag = E_LPC_lev_dur_fx( rh, rl, A, epsP, M, oldA ); + E_LPC_a_lsp_conversion( A, w, stable_LSP_fx, M ); return ( flag ); } diff --git a/lib_com/modif_fs_fx.c b/lib_com/modif_fs_fx.c index 97f4ef413..7ea04feb5 100644 --- a/lib_com/modif_fs_fx.c +++ b/lib_com/modif_fs_fx.c @@ -194,7 +194,7 @@ Word16 modify_Fs_ivas_fx( /* o : length of output Q /* Levinson-Durbin */ set16_fx( mem_lev_fx, 0, 18 ); - E_LPC_lev_dur( r_fx_h, r_fx_l, A_fx, LepsP, M, NULL ); + E_LPC_lev_dur_fx( r_fx_h, r_fx_l, A_fx, LepsP, M, NULL ); Copy_Scale_sig( A_fx, A_fx, M + 1, sub( norm_s( A_fx[0] ), 2 ) ); @@ -472,7 +472,7 @@ Word16 modify_Fs_fx( /* o : length of output Q0 */ /* Levinson-Durbin */ set16_fx( mem_lev_fx, 0, 18 ); - E_LPC_lev_dur( r_fx_h, r_fx_l, A_fx, LepsP, M, NULL ); + E_LPC_lev_dur_fx( r_fx_h, r_fx_l, A_fx, LepsP, M, NULL ); Copy_Scale_sig( A_fx, A_fx, M + 1, sub( norm_s( A_fx[0] ), 2 ) ); diff --git a/lib_com/options.h b/lib_com/options.h index 61a3c10cc..7528646c7 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -94,6 +94,7 @@ #define FIX_2404_HARM_SIGNAL_CLAS /* VA: basop-2404, harmonize signal_clas and signa_ivas_clas */ #define HARMONIZE_ACELP_ENC /* VA: basop issue 2400: Remove duplicated main ACELP encoder function */ #define FIX_2392_MSAN_DESTROY_DEC /* VA: basop issue 2392: fix MSAN in ivas_destroy_dec_fx() */ +#define HARM_LEV_DURBIN /* VA: basop issue 2423: harmonize levinson-Durbin algorithm */ /* #################### End BE switches ################################## */ diff --git a/lib_com/prot_fx.h b/lib_com/prot_fx.h index 4dc1a1b1e..cfa672178 100644 --- a/lib_com/prot_fx.h +++ b/lib_com/prot_fx.h @@ -1152,7 +1152,7 @@ void autocorr_fx_32( const Word16 sym_flag /* i : symmetric window flag */ ); -Word16 E_LPC_lev_dur( +Word16 E_LPC_lev_dur_fx( const Word16 Rh[], const Word16 Rl[], Word16 A[], @@ -1160,15 +1160,6 @@ Word16 E_LPC_lev_dur( const Word16 order, Word16 *parcorr ); -Word16 E_LPC_lev_dur_stab( - const Word16 Rh[], - const Word16 Rl[], - Word16 A[], - Word32 epsP[], - const Word16 order, - Word16 *parcorr, - Word16 k_max ); - Word16 E_LPC_lev_dur_ivas_fx( const Word16 Rh[], const Word16 Rl[], @@ -1177,16 +1168,7 @@ Word16 E_LPC_lev_dur_ivas_fx( const Word16 order, Word16 *parcorr ); -Word16 E_LPC_lev_dur_stab_ivas_fx( - const Word16 Rh[], - const Word16 Rl[], - Word16 A[], - Word32 epsP[], - const Word16 order, - Word16 *parcorr, - Word16 k_max ); - -Word16 E_LPC_lev_dur_fx( +Word16 E_LPC_lev_dur_fx_32( const Word16 Rh[], const Word16 Rl[], Word32 A[], @@ -1194,15 +1176,6 @@ Word16 E_LPC_lev_dur_fx( const Word16 order, Word32 *mem ); -Word16 E_LPC_lev_dur_stab_fx( - const Word16 Rh[], - const Word16 Rl[], - Word32 A[], - Word32 epsP[], - const Word16 order, - Word32 *mem, - Word16 k_max ); - Word16 lev_dur_fx( Word32 *a_fx, /* o : LP coefficients (a[0] = 1.0) Q(q_a)*/ const Word32 *r_fx, /* i : vector of autocorrelations Q(q_r)*/ @@ -8644,12 +8617,12 @@ Word16 get_next_coeff_unmapped( CONTEXT_HM_CONFIG *hm_cfg /* i : HM configuration */ ); -Word16 update_mixed_context( +Word16 update_mixed_context_fx( Word16 ctx, /* Q0 */ Word16 a /* Q0 */ ); -Word32 update_mixed_context_ivas_fx( +Word32 update_mixed_context_fx_32( Word32 ctx, /* Q0 */ Word16 a /* Q0 */ ); @@ -9630,7 +9603,7 @@ void Vr_subt( ); /* o: index of the winning codevector */ -Word16 vquant_ivas_fx( +Word16 vquant_fx_32( Word32 x[], /* i: vector to quantize Q25 */ const Word32 x_mean[], /* i: vector mean to subtract (0 if none) Q25 */ Word32 xq[], /* o: quantized vector Q25 */ diff --git a/lib_com/swb_tbe_com_fx.c b/lib_com/swb_tbe_com_fx.c index 8f5f19d13..d1a16da63 100644 --- a/lib_com/swb_tbe_com_fx.c +++ b/lib_com/swb_tbe_com_fx.c @@ -1441,7 +1441,7 @@ void GenShapedWBExcitation_ivas_fx( L_Extract( L_tmp, &R_h[i], &R_l[i] ); } - E_LPC_lev_dur( R_h, R_l, lpc_whtn, LepsP, LPC_WHTN_ORDER_WB, NULL ); + E_LPC_lev_dur_fx( R_h, R_l, lpc_whtn, LepsP, LPC_WHTN_ORDER_WB, NULL ); Copy_Scale_sig( lpc_whtn, lpc_whtn, LPC_WHTN_ORDER_WB + 1, sub( norm_s( lpc_whtn[0] ), 2 ) ); @@ -1690,7 +1690,7 @@ void GenShapedWBExcitation_fx( L_Extract( L_tmp, &R_h[i], &R_l[i] ); } - E_LPC_lev_dur( R_h, R_l, lpc_whtn, LepsP, LPC_WHTN_ORDER_WB, NULL ); + E_LPC_lev_dur_fx( R_h, R_l, lpc_whtn, LepsP, LPC_WHTN_ORDER_WB, NULL ); Copy_Scale_sig( lpc_whtn, lpc_whtn, LPC_WHTN_ORDER_WB + 1, sub( norm_s( lpc_whtn[0] ), 2 ) ); @@ -2102,7 +2102,7 @@ void GenShapedSHBExcitation_fx( L_tmp = Mpy_32( R_h[i], R_l[i], wac_h[i - 1], wac_l[i - 1] ); L_Extract( L_tmp, &R_h[i], &R_l[i] ); } - E_LPC_lev_dur( R_h, R_l, lpc_whtn, LepsP, LPC_WHTN_ORDER, NULL ); + E_LPC_lev_dur_fx( R_h, R_l, lpc_whtn, LepsP, LPC_WHTN_ORDER, NULL ); Copy_Scale_sig( lpc_whtn, lpc_whtn, LPC_WHTN_ORDER + 1, sub( norm_s( lpc_whtn[0] ), 2 ) ); fir_fx( exc16k, lpc_whtn, exc16kWhtnd, wht_fil_mem, L_FRAME16k, LPC_WHTN_ORDER, 0, 3 ); @@ -2671,7 +2671,7 @@ void GenShapedSHBExcitation_ivas_enc_fx( L_tmp = Mpy_32( R_h[i], R_l[i], wac_h[i - 1], wac_l[i - 1] ); L_Extract( L_tmp, &R_h[i], &R_l[i] ); // Q_R } - E_LPC_lev_dur( R_h, R_l, lpc_whtn, LepsP, LPC_WHTN_ORDER, NULL ); + E_LPC_lev_dur_fx( R_h, R_l, lpc_whtn, LepsP, LPC_WHTN_ORDER, NULL ); Copy_Scale_sig( lpc_whtn, lpc_whtn, LPC_WHTN_ORDER + 1, sub( norm_s( lpc_whtn[0] ), 2 ) ); // Q12 fir_fx( exc16k, lpc_whtn, exc16kWhtnd, wht_fil_mem, L_FRAME16k, LPC_WHTN_ORDER, 0, 3 ); // Q_bwe_exc @@ -3684,7 +3684,7 @@ void GenShapedSHBExcitation_ivas_dec_fx( L_tmp = Mpy_32( R_h[i], R_l[i], wac_h[i - 1], wac_l[i - 1] ); L_Extract( L_tmp, &R_h[i], &R_l[i] ); // Q_R } - E_LPC_lev_dur( R_h, R_l, lpc_whtn, LepsP, LPC_WHTN_ORDER, NULL ); + E_LPC_lev_dur_fx( R_h, R_l, lpc_whtn, LepsP, LPC_WHTN_ORDER, NULL ); Copy_Scale_sig( lpc_whtn, lpc_whtn, LPC_WHTN_ORDER + 1, sub( norm_s( lpc_whtn[0] ), 2 ) ); // Q12 fir_fx( exc16k, lpc_whtn, exc16kWhtnd, wht_fil_mem, L_FRAME16k, LPC_WHTN_ORDER, 0, 3 ); // Q_bwe_exc diff --git a/lib_com/tcx_ltp_fx.c b/lib_com/tcx_ltp_fx.c index 29febbbfc..71fd2b655 100644 --- a/lib_com/tcx_ltp_fx.c +++ b/lib_com/tcx_ltp_fx.c @@ -106,7 +106,7 @@ void tcx_ltp_get_lpc( move16(); } - E_LPC_lev_dur( r_h, r_l, A, NULL, order, NULL ); + E_LPC_lev_dur_fx( r_h, r_l, A, NULL, order, NULL ); } void tcx_ltp_get_lpc_fx( @@ -199,7 +199,7 @@ void tcx_ltp_get_lpc_fx( move16(); } - E_LPC_lev_dur_fx( r_h, r_l, A, NULL, order, NULL ); + E_LPC_lev_dur_fx_32( r_h, r_l, A, NULL, order, NULL ); } static void tcx_ltp_get_zir( diff --git a/lib_com/tools_fx.c b/lib_com/tools_fx.c index cd5ad9667..4e4889745 100644 --- a/lib_com/tools_fx.c +++ b/lib_com/tools_fx.c @@ -2372,7 +2372,7 @@ void Vr_subt( *-------------------------------------------------------------------*/ /* o: index of the winning codevector */ -Word16 vquant_ivas_fx( +Word16 vquant_fx_32( Word32 x[], /* i: vector to quantize Q25 */ const Word32 x_mean[], /* i: vector mean to subtract (0 if none) Q25 */ Word32 xq[], /* o: quantized vector Q25 */ diff --git a/lib_dec/ACcontextMapping_dec_fx.c b/lib_dec/ACcontextMapping_dec_fx.c index 9b6ac8434..2fc562d0b 100644 --- a/lib_dec/ACcontextMapping_dec_fx.c +++ b/lib_dec/ACcontextMapping_dec_fx.c @@ -267,13 +267,13 @@ Word16 ACcontextMapping_decode2_no_mem_s17_LC( { IF( s_and( idx1, 1 ) ) /* update first context */ { - c[p1] = update_mixed_context( c[p1], a ); + c[p1] = update_mixed_context_fx( c[p1], a ); move16(); } IF( s_and( idx2, 1 ) ) /* update second context */ { - c[p2] = update_mixed_context( c[p2], b ); + c[p2] = update_mixed_context_fx( c[p2], b ); move16(); } } @@ -557,14 +557,14 @@ Word16 RCcontextMapping_decode2_no_mem_s17_LCS_fx( IF( s_and( idx1, 1 ) ) { /* update first context */ - c[p1] = update_mixed_context( c[p1], a ); + c[p1] = update_mixed_context_fx( c[p1], a ); move16(); } IF( s_and( idx2, 1 ) ) { /* update second context */ - c[p2] = update_mixed_context( c[p2], b ); + c[p2] = update_mixed_context_fx( c[p2], b ); move16(); } } diff --git a/lib_dec/dec_LPD_fx.c b/lib_dec/dec_LPD_fx.c index 00ff81afe..0bc96a369 100644 --- a/lib_dec/dec_LPD_fx.c +++ b/lib_dec/dec_LPD_fx.c @@ -927,7 +927,7 @@ void decoder_LPD_fx( Qexc = E_UTIL_f_preemph3( buf, st->preemph_fac, L_LP, &tmp, 1 ); autocorr_fx( buf, M, r_h, r_l, &Q_r, L_LP, Assym_window_W16fx, 0, 0 ); lag_wind( r_h, r_l, M, INT_FS_FX, LAGW_WEAK ); - E_LPC_lev_dur( r_h, r_l, A, NULL, M, NULL ); + E_LPC_lev_dur_fx( r_h, r_l, A, NULL, M, NULL ); E_LPC_a_lsp_conversion( A, lsptmp, &xspnew_uw[0], M ); Residu3_fx( A, buf + L_LP - L_FRAME, res, L_FRAME, 1 ); diff --git a/lib_dec/er_dec_tcx_fx.c b/lib_dec/er_dec_tcx_fx.c index e59e3c0e3..9c73fcdf6 100644 --- a/lib_dec/er_dec_tcx_fx.c +++ b/lib_dec/er_dec_tcx_fx.c @@ -208,7 +208,7 @@ void con_tcx_fx( lag_wind( r_h, r_l, M, st->output_Fs, LAGW_STRONG ); /* Levinson Durbin */ - E_LPC_lev_dur( r_h, r_l, A_local, NULL, M, NULL ); + E_LPC_lev_dur_fx( r_h, r_l, A_local, NULL, M, NULL ); /* copy for multiple frame loss */ Copy( A_local, st->old_Aq_12_8_fx, M + 1 ); /*Q12*/ diff --git a/lib_dec/ivas_tcx_core_dec_fx.c b/lib_dec/ivas_tcx_core_dec_fx.c index bea7d8e32..4c780bc1c 100644 --- a/lib_dec/ivas_tcx_core_dec_fx.c +++ b/lib_dec/ivas_tcx_core_dec_fx.c @@ -754,7 +754,7 @@ void stereo_tcx_core_dec_fx( E_UTIL_f_preemph2( 0, buf, st->preemph_fac, L_LP, &tmp ); autocorr_fx( buf, M, r_h, r_l, &q_r, L_LP, Assym_window_W16fx, 0, 0 ); lag_wind( r_h, r_l, M, INT_FS_12k8, LAGW_WEAK ); - E_LPC_lev_dur( r_h, r_l, A, NULL, M, NULL ); + E_LPC_lev_dur_fx( r_h, r_l, A, NULL, M, NULL ); E_LPC_a_lsp_conversion( A, lsptmp, &lspnew_uw_fx[0], M ); Residu3_fx( A, buf + L_LP - L_FRAME, res, L_FRAME, 0 ); diff --git a/lib_enc/ACcontextMapping_enc_fx.c b/lib_enc/ACcontextMapping_enc_fx.c index b637047a2..f9e2d919c 100644 --- a/lib_enc/ACcontextMapping_enc_fx.c +++ b/lib_enc/ACcontextMapping_enc_fx.c @@ -307,13 +307,13 @@ void ACcontextMapping_encode2_no_mem_s17_LC_fx( { IF( s_and( idx1, 1 ) ) /* update first context */ { - c[p1] = update_mixed_context( c[p1], abs_s( x[a1_i] ) ); /* Q0 */ + c[p1] = update_mixed_context_fx( c[p1], abs_s( x[a1_i] ) ); /* Q0 */ move16(); } IF( s_and( idx2, 1 ) ) /* update second context */ { - c[p2] = update_mixed_context( c[p2], abs_s( x[b1_i] ) ); /* Q0 */ + c[p2] = update_mixed_context_fx( c[p2], abs_s( x[b1_i] ) ); /* Q0 */ move16(); } } @@ -679,13 +679,13 @@ Word16 ACcontextMapping_encode2_estimate_no_mem_s17_LC_fx( { IF( s_and( idx1, 1 ) ) /* update first context */ { - c[p1] = update_mixed_context( c[p1], abs_s( x[a1_i] ) ); /* Q0 */ + c[p1] = update_mixed_context_fx( c[p1], abs_s( x[a1_i] ) ); /* Q0 */ move16(); } IF( s_and( idx2, 1 ) ) /* update second context */ { - c[p2] = update_mixed_context( c[p2], abs_s( x[b1_i] ) ); /* Q0 */ + c[p2] = update_mixed_context_fx( c[p2], abs_s( x[b1_i] ) ); /* Q0 */ move16(); } } @@ -955,14 +955,14 @@ void RCcontextMapping_encode2_no_mem_s17_LCS_fx( IF( s_and( idx1, 1 ) ) { /* update first context */ - c[p1] = update_mixed_context_ivas_fx( c[p1], abs_s( x[a1_i] ) ); /* Q0 */ + c[p1] = update_mixed_context_fx_32( c[p1], abs_s( x[a1_i] ) ); /* Q0 */ move32(); } IF( s_and( idx2, 1 ) ) { /* update second context */ - c[p2] = update_mixed_context_ivas_fx( c[p2], abs_s( x[b1_i] ) ); /* Q0 */ + c[p2] = update_mixed_context_fx_32( c[p2], abs_s( x[b1_i] ) ); /* Q0 */ move32(); } } @@ -1407,14 +1407,14 @@ Word16 RCcontextMapping_encode2_estimate_no_mem_s17_LCS_fx( IF( s_and( idx1, 1 ) ) { /* update first context */ - c[p1] = update_mixed_context_ivas_fx( c[p1], abs_s( x[a1_i] ) ); /* Q0 */ + c[p1] = update_mixed_context_fx_32( c[p1], abs_s( x[a1_i] ) ); /* Q0 */ move32(); } IF( s_and( idx2, 1 ) ) { /* update second context */ - c[p2] = update_mixed_context_ivas_fx( c[p2], abs_s( x[b1_i] ) ); /* Q0 */ + c[p2] = update_mixed_context_fx_32( c[p2], abs_s( x[b1_i] ) ); /* Q0 */ move32(); } } diff --git a/lib_enc/analy_lp_fx.c b/lib_enc/analy_lp_fx.c index 162b87ea4..743f95af5 100644 --- a/lib_enc/analy_lp_fx.c +++ b/lib_enc/analy_lp_fx.c @@ -98,7 +98,7 @@ void analy_lp_fx( adapt_lag_wind( r_h, r_l, M, Top[i_subfr], Tnc[i_subfr], Core_sr ); /* Levinson-Durbin */ - E_LPC_lev_dur( r_h, r_l, A, LepsP, M, NULL ); + E_LPC_lev_dur_fx( r_h, r_l, A, LepsP, M, NULL ); FOR( i = 0; i <= M; i++ ) { L_Extract( LepsP[i], &epsP_h[i], &epsP_l[i] ); @@ -174,7 +174,7 @@ void analy_lp_AMR_WB_fx( /* Levinson-Durbin */ /*lev_dur( A, r, M, epsP );*/ - E_LPC_lev_dur( r_h, r_l, A, LepsP, M, NULL ); + E_LPC_lev_dur_fx( r_h, r_l, A, LepsP, M, NULL ); FOR( i = 0; i <= M; i++ ) { L_Extract( LepsP[i], &epsP_h[i], &epsP_l[i] ); diff --git a/lib_enc/core_enc_ol_fx.c b/lib_enc/core_enc_ol_fx.c index 2cbbd5c9a..a347b086a 100644 --- a/lib_enc/core_enc_ol_fx.c +++ b/lib_enc/core_enc_ol_fx.c @@ -457,7 +457,7 @@ void core_encode_openloop_fx( E_UTIL_f_preemph2( Q_new - 1, buf, st->preemph_fac, L_LP, &tmp ); autocorr_fx( buf, M, r_h, r_l, &Q_r, L_LP, Assym_window_W16fx, 0, 0 ); lag_wind( r_h, r_l, M, INT_FS_FX, LAGW_WEAK ); - E_LPC_lev_dur( r_h, r_l, A, NULL, M, NULL ); + E_LPC_lev_dur_fx( r_h, r_l, A, NULL, M, NULL ); E_LPC_a_lsp_conversion( A, lsptmp, lsp_new, M ); Residu3_fx( A, buf + L_LP - L_FRAME, res, L_FRAME, 1 ); diff --git a/lib_enc/ext_sig_ana_fx.c b/lib_enc/ext_sig_ana_fx.c index 331817147..0484361c8 100644 --- a/lib_enc/ext_sig_ana_fx.c +++ b/lib_enc/ext_sig_ana_fx.c @@ -444,7 +444,7 @@ void core_signal_analysis_high_bitrate_fx( adapt_lag_wind( r_h[frameno], r_l[frameno], M, alw_pitch_lag_12k8[frameno], alw_voicing[frameno], st->sr_core ); - E_LPC_lev_dur( r_h[frameno], r_l[frameno], A, epsP, M, NULL ); + E_LPC_lev_dur_fx( r_h[frameno], r_l[frameno], A, epsP, M, NULL ); E_LPC_a_lsp_conversion( A, lsp[nSubframes - 1 - frameno], st->lspold_enc_fx, M ); } @@ -1242,7 +1242,7 @@ void core_signal_analysis_high_bitrate_ivas_fx( adapt_lag_wind( r_h[frameno], r_l[frameno], M, alw_pitch_lag_12k8[frameno], alw_voicing[frameno], st->sr_core ); - E_LPC_lev_dur( r_h[frameno], r_l[frameno], A, NULL, M, NULL ); + E_LPC_lev_dur_fx( r_h[frameno], r_l[frameno], A, NULL, M, NULL ); E_LPC_a_lsp_conversion( A, lsp[nSubframes - 1 - frameno], st->lspold_enc_fx, M ); } diff --git a/lib_enc/ivas_masa_enc_fx.c b/lib_enc/ivas_masa_enc_fx.c index 6bfea1f19..3b30558be 100644 --- a/lib_enc/ivas_masa_enc_fx.c +++ b/lib_enc/ivas_masa_enc_fx.c @@ -2900,7 +2900,7 @@ static Word16 encode_lfe_to_total_energy_ratio_fx( IF( VQLevels > 0 ) { - lfeToTotalEnergyRatioIndices[2] = vquant_ivas_fx( log2LFEratio, 0, xqv, McMASA_LFEGain_vectors_fx, 4, VQLevels ); + lfeToTotalEnergyRatioIndices[2] = vquant_fx_32( log2LFEratio, 0, xqv, McMASA_LFEGain_vectors_fx, 4, VQLevels ); move16(); } } diff --git a/lib_enc/ivas_stereo_dft_td_itd_fx.c b/lib_enc/ivas_stereo_dft_td_itd_fx.c index ac42b9679..452043160 100644 --- a/lib_enc/ivas_stereo_dft_td_itd_fx.c +++ b/lib_enc/ivas_stereo_dft_td_itd_fx.c @@ -303,7 +303,7 @@ static void stereo_td_channel_extrapolate_fx( } r_l[0] = s_max( r_l[0], 1 ); move16(); - flag = E_LPC_lev_dur( r_h, r_l, A, NULL, STEREO_DFT_CHANNEL_EXTR_LPC_ORDER, NULL ); + flag = E_LPC_lev_dur_fx( r_h, r_l, A, NULL, STEREO_DFT_CHANNEL_EXTR_LPC_ORDER, NULL ); Copy_Scale_sig( A, A, STEREO_DFT_CHANNEL_EXTR_LPC_ORDER + 1, sub( norm_s( A[0] ), 2 ) ); IF( EQ_16( flag, 1 ) ) { diff --git a/lib_enc/swb_tbe_enc_fx.c b/lib_enc/swb_tbe_enc_fx.c index d6fe95325..b63b82936 100644 --- a/lib_enc/swb_tbe_enc_fx.c +++ b/lib_enc/swb_tbe_enc_fx.c @@ -789,7 +789,7 @@ void wb_tbe_enc_fx( move16(); } - E_LPC_lev_dur( R_h, R_l, lpc_wb_temp_fx, LepsP, LPC_SHB_ORDER_WB, NULL ); + E_LPC_lev_dur_fx( R_h, R_l, lpc_wb_temp_fx, LepsP, LPC_SHB_ORDER_WB, NULL ); Copy_Scale_sig( lpc_wb_temp_fx, lpc_wb_temp_fx, LPC_SHB_ORDER_WB + 1, sub( norm_s( lpc_wb_temp_fx[0] ), 2 ) ); @@ -837,7 +837,7 @@ void wb_tbe_enc_fx( test(); IF( EQ_16( st_fx->rf_mode, 1 ) || EQ_32( st_fx->extl_brate, WB_TBE_0k35 ) ) { - E_LPC_lev_dur( R_h, R_l, lpc_wb, LepsP, LPC_SHB_ORDER_LBR_WB, NULL ); + E_LPC_lev_dur_fx( R_h, R_l, lpc_wb, LepsP, LPC_SHB_ORDER_LBR_WB, NULL ); Copy_Scale_sig( lpc_wb, lpc_wb, LPC_SHB_ORDER_LBR_WB + 1, sub( norm_s( lpc_wb[0] ), 2 ) ); /* Expand bandwidth of the LP coeffs */ @@ -896,7 +896,7 @@ void wb_tbe_enc_fx( } ELSE /* 13.2kbps */ { - E_LPC_lev_dur( R_h, R_l, lpc_wb, LepsP, LPC_SHB_ORDER_WB, NULL ); + E_LPC_lev_dur_fx( R_h, R_l, lpc_wb, LepsP, LPC_SHB_ORDER_WB, NULL ); Copy_Scale_sig( lpc_wb, lpc_wb, LPC_SHB_ORDER_WB + 1, sub( norm_s( lpc_wb[0] ), 2 ) ); /* Expand bandwidth of the LP coeffs */ @@ -1408,7 +1408,7 @@ void wb_tbe_enc_ivas_fx( move16(); } - E_LPC_lev_dur( R_h, R_l, lpc_wb_temp_fx, LepsP, LPC_SHB_ORDER_WB, NULL ); // Since 0th index will be 1 in floating point buffer, in fixed point one has to take norm of 0th index to identify the Q-factor + E_LPC_lev_dur_fx( R_h, R_l, lpc_wb_temp_fx, LepsP, LPC_SHB_ORDER_WB, NULL ); // Since 0th index will be 1 in floating point buffer, in fixed point one has to take norm of 0th index to identify the Q-factor Copy_Scale_sig( lpc_wb_temp_fx, lpc_wb_temp_fx, LPC_SHB_ORDER_WB + 1, sub( norm_s( lpc_wb_temp_fx[0] ), 2 ) ); // Q12 @@ -1462,7 +1462,7 @@ void wb_tbe_enc_ivas_fx( test(); IF( EQ_16( st_fx->rf_mode, 1 ) || EQ_32( st_fx->extl_brate, WB_TBE_0k35 ) ) { - E_LPC_lev_dur( R_h, R_l, lpc_wb, LepsP, LPC_SHB_ORDER_LBR_WB, NULL ); + E_LPC_lev_dur_fx( R_h, R_l, lpc_wb, LepsP, LPC_SHB_ORDER_LBR_WB, NULL ); Copy_Scale_sig( lpc_wb, lpc_wb, LPC_SHB_ORDER_LBR_WB + 1, sub( norm_s( lpc_wb[0] ), 2 ) ); /* Expand bandwidth of the LP coeffs */ @@ -1521,7 +1521,7 @@ void wb_tbe_enc_ivas_fx( } ELSE /* 13.2kbps */ { - E_LPC_lev_dur( R_h, R_l, lpc_wb, LepsP, LPC_SHB_ORDER_WB, NULL ); + E_LPC_lev_dur_fx( R_h, R_l, lpc_wb, LepsP, LPC_SHB_ORDER_WB, NULL ); Copy_Scale_sig( lpc_wb, lpc_wb, LPC_SHB_ORDER_WB + 1, sub( norm_s( lpc_wb[0] ), 2 ) ); /* Expand bandwidth of the LP coeffs */ @@ -2270,7 +2270,7 @@ void swb_tbe_enc_fx( R_l[0] = s_max( R_l[0], 1 ); move16(); - E_LPC_lev_dur( R_h, R_l, lpc_shb_fx, LepsP, LPC_SHB_ORDER, NULL ); /* LPC in Q14 */ + E_LPC_lev_dur_fx( R_h, R_l, lpc_shb_fx, LepsP, LPC_SHB_ORDER, NULL ); /* LPC in Q14 */ { Word16 enerG, lpc_shb1[M + 1]; @@ -2285,7 +2285,7 @@ void swb_tbe_enc_fx( IF( GT_16( enerG, 256 /*32 Q3*/ ) ) { set16_fx( lpc_shb_fx, 0, LPC_SHB_ORDER + 1 ); - E_LPC_lev_dur( R_h, R_l, lpc_shb_fx, LepsP, 2, NULL ); /* LPC in Q14 */ + E_LPC_lev_dur_fx( R_h, R_l, lpc_shb_fx, LepsP, 2, NULL ); /* LPC in Q14 */ } } @@ -3282,7 +3282,7 @@ void swb_tbe_enc_ivas_fx( R_l[0] = s_max( R_l[0], 1 ); move16(); - E_LPC_lev_dur( R_h, R_l, lpc_shb_fx, LepsP, LPC_SHB_ORDER, NULL ); /* LPC in Q14 */ + E_LPC_lev_dur_fx( R_h, R_l, lpc_shb_fx, LepsP, LPC_SHB_ORDER, NULL ); /* LPC in Q14 */ { Word16 enerG, lpc_shb1[M + 1]; @@ -3311,7 +3311,7 @@ void swb_tbe_enc_ivas_fx( IF( GT_16( enerG, 256 /* 32.0 in Q3 */ ) || flag_sat ) { set16_fx( lpc_shb_fx, 0, LPC_SHB_ORDER + 1 ); - E_LPC_lev_dur( R_h, R_l, lpc_shb_fx, LepsP, 2, NULL ); /* LPC in Q14 */ + E_LPC_lev_dur_fx( R_h, R_l, lpc_shb_fx, LepsP, 2, NULL ); /* LPC in Q14 */ } } -- GitLab