diff --git a/lib_com/ACcontextMapping_fx.c b/lib_com/ACcontextMapping_fx.c index 73382424367a4eff8c4a41ddc1f015166a4803d6..19cbea1a4b8f9b74cbbbd4a9310bc43b86dff046 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 ac6d781a4d7ad3ff08299fa2b1a036ff480086fc..f7b58ae6256c1f34a0a6fde9f0e94886369dd540 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 5b3b8a1c0b990019220f3b27a10a45a8ad7faedc..dafb07d1de8ef4ec2637d1a5aa3348705b69bfcd 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 473d1d652fde2cf4ca8d0b428b26294998c0d189..834f7b0aab8566467ad90cc849fa69bf28bf0846 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 bac77c80d7cdb4e9201aba8135f44a085a7f0bb3..9335d26b6588ee4a64108e18a6c9f01e5ba2d2cc 100644 --- a/lib_com/modif_fs_fx.c +++ b/lib_com/modif_fs_fx.c @@ -45,7 +45,8 @@ #ifndef FIX_2410_HARM_MODIF_FS Word16 modify_Fs_ivas_fx( /* o : length of output Q0 */ #else -Word16 modify_Fs_fx( /* o : length of output Q0 */ +/* o : length of output Q0 */ +Word16 modify_Fs_fx( #endif const Word16 sigIn_fx[], /* i : signal to decimate Q0 */ Word16 lg, /* i : length of input Q0 */ @@ -59,7 +60,6 @@ Word16 modify_Fs_fx( /* o : length of output Q0 */ ) { Word16 i; - Word16 lg_out, fac_num, fac_den, filt_len, frac, temp_n, mem_len; Word16 num_den; Word16 datastep, fracstep; @@ -83,6 +83,7 @@ Word16 modify_Fs_fx( /* o : length of output Q0 */ /*-------------------------------------------------------------------* * Find the resampling configuration *-------------------------------------------------------------------*/ + #ifdef FIX_2410_HARM_MODIF_FS if ( Q_new_inp != NULL ) #endif @@ -137,6 +138,7 @@ Word16 modify_Fs_fx( /* o : length of output Q0 */ /*-------------------------------------------------------------------* * Retrieve and/or calculate the resampling parameters *-------------------------------------------------------------------*/ + fac_num = cfg_ptr_fx->fac_num_fx; move16(); /*Q0*/ fac_den = cfg_ptr_fx->fac_den_fx; @@ -173,10 +175,10 @@ Word16 modify_Fs_fx( /* o : length of output Q0 */ move16(); } - /*-------------------------------------------------------------------* * Resample *-------------------------------------------------------------------*/ + /* append filter memory */ Copy( mem_fx, signal_fx, mem_len ); @@ -213,7 +215,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 ) ); @@ -229,6 +231,7 @@ Word16 modify_Fs_fx( /* o : length of output Q0 */ move16(); deemph_fx( signal_fx + mem_len + lg - LEN_WIN_SSS, mu_preemph_fx, LEN_WIN_SSS + plus_sample_in, &mem_preemph_fx ); } + /* interpolation */ datastep = shr( div_s( shl( fac_den, 7 ), shl( fac_num, 10 ) ), 12 ); @@ -510,7 +513,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 ) ); @@ -624,19 +627,22 @@ Word16 modify_Fs_fx( /* o : length of output Q0 */ return lg_out; } #endif + + /*-------------------------------------------------------------------* * modify_Fs_intcub3m_sup() * * *-------------------------------------------------------------------*/ -Word16 modify_Fs_intcub3m_sup_fx( /* o : length of output */ - const Word16 sigIn[], /* i : signal to decimate with memory of 2 samples (indexes -2 & -1) */ - const Word16 lg, /* i : length of input (suppose that lg is such that lg_out is integer, ex multiple of 5 in case of 16kHz to 12.8 kHz) */ - const Word32 fin, /* i : frequency of input */ - Word16 sigOut[], /* o : decimated signal */ - const Word32 fout, /* i : frequency of output */ - Word16 *delayout /* o : delay of output */ +/* o : length of output */ +Word16 modify_Fs_intcub3m_sup_fx( + const Word16 sigIn[], /* i : signal to decimate with memory of 2 samples (indexes -2 & -1) */ + const Word16 lg, /* i : length of input (suppose that lg is such that lg_out is integer, ex multiple of 5 in case of 16kHz to 12.8 kHz) */ + const Word32 fin, /* i : frequency of input */ + Word16 sigOut[], /* o : decimated signal */ + const Word32 fout, /* i : frequency of output */ + Word16 *delayout /* o : delay of output */ ) { Word16 i, k, i1, i2, k1, k2, k3, kk, cind; diff --git a/lib_com/options.h b/lib_com/options.h index 70addf7142f2867ae5d76fbb88369392e325f6db..2d6a4236946d22c6261a9a7b672c0f25eba38c07 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -95,8 +95,9 @@ #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 FIX_FLOAT_1522_LTV_MSAN_QMETADATA_ENC_EC3 /* Nokia: float issue 1522: fix uninit MSAN in EC3 of qmetadata encoding */ - #define FIX_2410_HARM_MODIF_FS /* VA: basop issue 2410: Remove duplicated modif_Fs */ +#define HARM_LEV_DURBIN /* VA: basop issue 2423: harmonize levinson-Durbin algorithm */ + /* #################### End BE switches ################################## */ /* #################### Start NON-BE switches ############################ */ diff --git a/lib_com/prot_fx.h b/lib_com/prot_fx.h index a25d7db3c96b81b1d590774a7fbba07f5a5180fe..bc60e205de7a879feefc00181d681203060ec637 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)*/ @@ -8649,12 +8622,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 */ ); @@ -9635,7 +9608,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 8f5f19d13763f2c67f45eaaf9cc77ad6a61e3147..d1a16da633b423602bf16492887a8800058c83c3 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 29febbbfc0ba569368b8fa6ace26bdcf9756765a..71fd2b6553235c5b48b628be7571d01d1dd5de65 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 cd5ad9667d9fd56c238f1809e5e46a7978e5d686..4e48897453d0bea78a7e599fa1973d53b47a1899 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 9b6ac8434f6235b4fd38a4c91d051cfdcf0748c9..2fc562d0be3c8238a8050ece13f2b9ef5a4caebb 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 00ff81afedaba35ac89a81a7cc2ebca47e030fe1..0bc96a369d3551a2a9e869b5b34e8a8e4a82bbb6 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 e59e3c0e33dbb9471ee9b116d7017246434c9640..9c73fcdf621c51f911ec6caad69db369dac2e119 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 bea7d8e320a0714356d25070997ee4cec41ce075..4c780bc1c16c5e5619d2a172345d38f8142e6ac1 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 b637047a2fa8f182e55c5cec56b5bdc0dcbba03d..f9e2d919c9bb8b47922c61e8e44df86a632b54e3 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/amr_wb_enc_fx.c b/lib_enc/amr_wb_enc_fx.c index b2b43243412931dcdd6cd62d0e23ef822b7b13bc..dfc11efcdd3db7f2f959d940b3f7f877e26398d3 100644 --- a/lib_enc/amr_wb_enc_fx.c +++ b/lib_enc/amr_wb_enc_fx.c @@ -261,11 +261,13 @@ void amr_wb_enc_fx( /*----------------------------------------------------------------* * Change the sampling frequency to 12.8 kHz *----------------------------------------------------------------*/ + #ifndef FIX_2410_HARM_MODIF_FS modify_Fs_fx( st->input_fx, input_frame, st->input_Fs, new_inp, 12800, st->mem_decim_fx, 0 ); #else modify_Fs_fx( st->input_fx, input_frame, st->input_Fs, new_inp, 12800, st->mem_decim_fx, 0, NULL, NULL ); #endif + /* update signal buffer */ Copy( new_inp, st->buf_speech_enc + L_FRAME, L_FRAME ); /* Q0 */ Scale_sig( st->buf_speech_enc + L_FRAME, L_FRAME, 1 ); /* Q1 */ @@ -430,10 +432,8 @@ void amr_wb_enc_fx( * Update estimated noise energy and voicing cut-off frequency *-----------------------------------------------------------------*/ - noise_est_fx( st, old_pitch1, tmpN, epsP_h, epsP_l, Etot, relE, corr_shift, tmpE, fr_bands, &cor_map_sum, - NULL, &sp_div, &Q_sp_div, &non_staX, &harm_flag, - lf_E, &hNoiseEst->harm_cor_cnt, hNoiseEst->Etot_l_lp_fx, hNoiseEst->Etot_v_h2_fx, &hNoiseEst->bg_cnt, st->lgBin_E_fx, Q_new, Le_min_scaled, &sp_floor, NULL, - st->ini_frame ); + noise_est_fx( st, old_pitch1, tmpN, epsP_h, epsP_l, Etot, relE, corr_shift, tmpE, fr_bands, &cor_map_sum, NULL, &sp_div, &Q_sp_div, &non_staX, &harm_flag, + lf_E, &hNoiseEst->harm_cor_cnt, hNoiseEst->Etot_l_lp_fx, hNoiseEst->Etot_v_h2_fx, &hNoiseEst->bg_cnt, st->lgBin_E_fx, Q_new, Le_min_scaled, &sp_floor, NULL, st->ini_frame ); /*----------------------------------------------------------------* * Change the sampling frequency to 16 kHz, @@ -530,10 +530,9 @@ void amr_wb_enc_fx( if ( hTdCngEnc != NULL ) { hTdCngEnc->burst_ho_cnt = 0; + move16(); } - move16(); - /*------------------------------------------------------------* * Encode excitation *------------------------------------------------------------*/ diff --git a/lib_enc/analy_lp_fx.c b/lib_enc/analy_lp_fx.c index 162b87ea488cc23b5a98d80b8882628fd0cace1a..743f95af5da98e1d59ab9b33fc8b66c8209901e2 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 2cbbd5c9aa8454dd7513aeb90790cb99d7241afd..a347b086a4f24c973265a4fe8e4de98d73eb88e2 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 33181714765ea239bdf078dacdcc47392a934156..0484361c851d4dc80fd229427c92775e52a199cb 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 6bfea1f19540db98ecc8ea5190a0d3f2ba23bd60..3b30558bee542d00124505f039fe451155a767d3 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 ac42b9679ffcd3cd12e216ddaa8561ae13b85b51..452043160530a1b45efaac8fd5c0e88c3481266c 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/pre_proc_fx.c b/lib_enc/pre_proc_fx.c index 485311c1756a2421fbbaa66ea2f2ba2c5a076861..64b8b30896bd0e67dbd92b8ab865e0c8a7d8752a 100644 --- a/lib_enc/pre_proc_fx.c +++ b/lib_enc/pre_proc_fx.c @@ -216,6 +216,7 @@ void pre_proc_fx( #else modify_Fs_fx( signal_in, input_frame, st->input_Fs, new_inp_12k8, INT_FS_12k8, st->mem_decim_fx, ( const Word16 )( EQ_16( st->max_bwidth, NB ) ), NULL, NULL ); #endif + Copy( new_inp_12k8, st->buf_speech_enc + L_FRAME32k, L_FRAME ); Scale_sig( st->buf_speech_enc + L_FRAME32k, L_FRAME, 1 ); diff --git a/lib_enc/swb_tbe_enc_fx.c b/lib_enc/swb_tbe_enc_fx.c index d6fe953257eac236750b68945cad5c705ddada2e..b63b82936c4e1a35763406675b38aa1d9efcb2fe 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 */ } }