diff --git a/lib_com/cng_exc_fx.c b/lib_com/cng_exc_fx.c index 14ddc27d1f309404c5089da6fd422ad579d1b491..42802ee152657a498613e2801bd14d9b6f1226af 100644 --- a/lib_com/cng_exc_fx.c +++ b/lib_com/cng_exc_fx.c @@ -306,11 +306,7 @@ IF( NE_16( Opt_AMR_WB, 1 ) ) IF( EQ_16( L_frame, L_FRAME16k ) ) { -#ifndef FIX_2410_HARM_MODIF_FS - modify_Fs_fx( fft_io, L_FRAME16k, 16000, fft_io, 12800, exc_mem1, 0 ); -#else modify_Fs_fx( fft_io, L_FRAME16k, 16000, fft_io, 12800, exc_mem1, 0, NULL, NULL ); -#endif } /* fft_rel(fft_io, L_FFT, LOG2_L_FFT); */ @@ -423,11 +419,7 @@ IF( NE_16( Opt_AMR_WB, 1 ) ) IF( EQ_16( L_frame, L_FRAME16k ) ) { -#ifndef FIX_2410_HARM_MODIF_FS - modify_Fs_fx( fft_io, L_FFT, 12800, fft_io, 16000, exc_mem, 0 ); -#else modify_Fs_fx( fft_io, L_FFT, 12800, fft_io, 16000, exc_mem, 0, NULL, NULL ); -#endif } /* enr1 = dotp( fft_io, fft_io, L_frame ) / L_frame; */ diff --git a/lib_com/ivas_prot_fx.h b/lib_com/ivas_prot_fx.h index efa8cd68e6a66326fc1f0b7ac8a3a11430605a59..ff41c4ae0ac94cd1f795877c6c8d7e26c46138ae 100644 --- a/lib_com/ivas_prot_fx.h +++ b/lib_com/ivas_prot_fx.h @@ -2956,15 +2956,8 @@ void acelp_fast_fx( BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ const Word16 cdk_index, /* i : codebook index */ const Word16 dn_orig[L_SUBFR], /* i : corr. between target and h[]. Q_dn */ -#ifdef OPT_2416_ACELP_FAST const Word16 Q_dncn, /* i : scaling factor of dn and cn */ -#else - Word16 Q_dn, -#endif const Word16 cn[L_SUBFR], /* i : residual after long term prediction q_cn*/ -#ifndef OPT_2416_ACELP_FAST - const Word16 q_cn, -#endif const Word16 H[L_SUBFR], /* i : impulse response of weighted synthesis filter e(norm_s(H[0])+1) */ Word16 code[L_SUBFR], /* o : algebraic (fixed) codebook excitation */ Word16 y[], /* o : filtered fixed codebook excitation */ diff --git a/lib_com/lpc_tools_fx.c b/lib_com/lpc_tools_fx.c index dafb07d1de8ef4ec2637d1a5aa3348705b69bfcd..a2de22ab87a92ce5184a691f124544200c564a5d 100644 --- a/lib_com/lpc_tools_fx.c +++ b/lib_com/lpc_tools_fx.c @@ -448,9 +448,7 @@ static Word32 Div_32_opt( Word32 L_num /*Q31*/, Word16 denom_hi /*Qx -16*/, Word */ 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*/, @@ -615,7 +613,6 @@ static Word16 E_LPC_lev_dur_stab( t1 = L_max( t1, L_abs( t0 ) ); } -#ifdef HARM_LEV_DURBIN IF( element_mode == EVS_MONO ) { k = s_min( norm_l( t1 ), 3 ); @@ -624,9 +621,6 @@ static Word16 E_LPC_lev_dur_stab( { 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++ ) @@ -655,205 +649,12 @@ static Word16 E_LPC_lev_dur_stab( 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*/ ) { -#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 } -#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; - Word16 Kh, Kl; /* reflection coefficient; hi and lo */ - Word16 alp_h, alp_l, alp_exp; /* Prediction gain; hi lo and exponent */ - Word32 t0, t1, t2; /* temporary variables */ - Word16 flag; - Word16 Ah[TCXLTP_LTP_ORDER + 1], Al[TCXLTP_LTP_ORDER + 1]; /* LPC coef. in double prec. */ - - BASOP_SATURATE_WARNING_OFF_EVS - if ( epsP != NULL ) - { - epsP[0] = L_Comp( Rh[0], Rl[0] ); - move32(); - } - - flag = 0; - move16(); - - /* K = A[1] = -R[1] / R[0] */ - t1 = L_Comp( Rh[1], Rl[1] ); /* R[1] in Q31 */ - t2 = L_abs( t1 ); /* abs R[1] */ - t0 = L_deposit_l( 0 ); - IF( Rh[0] != 0 ) - { - t0 = Div_32_opt( t2, Rh[0], Rl[0] ); /* R[1]/R[0] in Q31 */ - /* Cause a difference in MODE1 due to different implementation of div32*/ - } - if ( t1 > 0 ) - { - t0 = L_negate( t0 ); /* -R[1]/R[0] */ - } - Kl = L_Extract_lc( t0, &Kh ); /* K in DPF */ - t0 = L_shr( t0, 4 ); /* A[1] in Q27 */ - L_Extract( t0, &Ah[1], &Al[1] ); /* A[1] in DPF */ - - /* Alpha = R[0] * (1-K**2) */ - t0 = Sqr_32( Kh, Kl ); /* K*K in Q31 */ - t0 = L_abs( t0 ); /* Some case <0 !! */ - t0 = L_sub( (Word32) 0x7fffffffL, t0 ); /* 1 - K*K in Q31 */ - lo = L_Extract_lc( t0, &hi ); /* DPF format */ - t0 = Mpy_32( Rh[0], Rl[0], hi, lo ); /* Alpha in Q31 */ - if ( epsP != NULL ) - { - epsP[1] = t0; - move32(); - } - - /* Normalize Alpha */ - alp_exp = norm_l( t0 ); - t0 = L_shl( t0, alp_exp ); - alp_l = L_Extract_lc( t0, &alp_h ); - /* DPF format */ - - /*--------------------------------------* - * ITERATIONS I=2 to m - *--------------------------------------*/ - - FOR( i = 2; i <= order; i++ ) - { - /* t0 = SUM(R[j]*A[i-j], j=1, i-1) + R[i] */ - t0 = L_deposit_l( 0 ); - FOR( j = 1; j < i; j++ ) - { - t0 = Mac_32( t0, Rh[j], Rl[j], Ah[i - j], Al[i - j] ); - } - - t0 = L_shl_sat( t0, 4 ); /* result in Q27 -> convert to Q31 */ - /* No overflow possible */ - - /* Compose and add R[i] in Q3 */ - t0 = L_mac_sat( t0, Rl[i], 1 ); - t0 = L_msu_sat( t0, Rh[i], -32768 ); - - /* K = -t0 / Alpha */ - t1 = L_abs( t0 ); - t2 = L_deposit_l( 0 ); - IF( alp_h != 0 ) - { - t2 = Div_32_opt( t1, alp_h, alp_l ); /* abs(t0)/Alpha */ - /* Cause a difference in MODE1 due to different implementation of div32*/ - } - - if ( t0 > 0 ) - { - t2 = L_negate( t2 ); /* K =-t0/Alpha */ - } - t2 = L_shl_sat( t2, alp_exp ); /* denormalize; compare to Alpha */ - test(); - if ( ( mem != NULL ) && ( ( GT_16( abs_s( extract_h( t2 ) ), k_max ) ) ) ) - { - flag = 1; - move16(); /* Test for unstable filter. If unstable keep old A(z) */ - } - test(); - if ( ( mem != NULL ) && ( ( LT_32( L_abs( t2 ), 5 ) ) ) ) - { - flag = 1; - move16(); /*R matrix not reliable (R saturated for many coeff), keep old A(z) */ - } - Kl = L_Extract_lc( t2, &Kh ); /* K in DPF */ - - /*------------------------------------------* - * Compute new LPC coeff. -> An[i] - * An[j]= A[j] + K*A[i-j], j=1 to i-1 - * An[i]= K - *------------------------------------------*/ - - k = mult_r( i, 16384 ); - FOR( j = 1; j < k; j++ ) - { - /* Do two Iterations Together to Allow Direct Update of Ah & Al */ - t0 = Mac_32( L_Comp( Ah[j], Al[j] ), Kh, Kl, Ah[i - j], Al[i - j] ); - t1 = Mac_32( L_Comp( Ah[i - j], Al[i - j] ), Kh, Kl, Ah[j], Al[j] ); - L_Extract( t0, &Ah[j], &Al[j] ); - L_Extract( t1, &Ah[i - j], &Al[i - j] ); - } - IF( s_and( i, 1 ) == 0 ) - { - t0 = Mac_32( L_Comp( Ah[j], Al[j] ), Kh, Kl, Ah[i - j], Al[i - j] ); - L_Extract( t0, &Ah[j], &Al[j] ); - } - t2 = L_shr( t2, 4 ); /* t2 = K in Q31 ->convert to Q27 */ - L_Extract( t2, &Ah[i], &Al[i] ); /* An[i] in Q27 */ - - /* Alpha = Alpha * (1-K**2) */ - t1 = L_mult_sat( Kh, Kh ); /* K*K in Q31 */ - t0 = L_mac( t1, mult( Kh, Kl ), 2 ); - t0 = L_abs( t0 ); /* Some case <0 !! */ - t0 = L_sub( (Word32) 0x7fffffffL, t0 ); /* 1 - K*K in Q31 */ - 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 ) - { - epsP[i] = t1; - move32(); - } - - /* Normalize Alpha */ - j = norm_l( t0 ); - t0 = L_shl( t0, j ); - alp_l = L_Extract_lc( t0, &alp_h ); /* DPF format */ - alp_exp = add( alp_exp, j ); /* Add normalization to alp_exp */ - } - - /* Adaptive scaling */ - t1 = L_deposit_l( 0 ); - FOR( i = 1; i <= order; i++ ) - { - t0 = L_Comp( Ah[i], Al[i] ); - t1 = L_max( t1, L_abs( t0 ) ); - } - k = s_min( sub( norm_l( t1 ), 1 ), 3 ); - A[0] = shl( 2048, k ); - move16(); - FOR( i = 1; i <= order; i++ ) - { - t0 = L_Comp( Ah[i], Al[i] ); - A[i] = round_fx_sat( L_shl_sat( t0, k ) ); - move16(); - } - - BASOP_SATURATE_WARNING_ON_EVS - IF( mem != NULL ) - { - /* Enforce stable LPC filter - parcorr[0] and parcorr[1] are not LPC coeffiecients */ - IF( flag ) - { - Copy( mem, A, add( order, 1 ) ); - } - ELSE /* If stable LPC filter, store into memories */ - { - Copy( A, mem, add( order, 1 ) ); - } - } - - return ( flag ); -} -#endif Word16 E_LPC_lev_dur_ivas_fx( const Word16 Rh[], const Word16 Rl[], Word16 A[], Word32 epsP[], const Word16 order, Word16 *mem ) { -#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 } diff --git a/lib_com/modif_fs_fx.c b/lib_com/modif_fs_fx.c index 21482920e0f971081d2b8d9cf20b2fd3a99125fa..43d5bac4af83ae3b50eb0ffbcbe295848293d823 100644 --- a/lib_com/modif_fs_fx.c +++ b/lib_com/modif_fs_fx.c @@ -42,21 +42,17 @@ /* CALLED FROM : TX/RX */ /*==============================================================================*/ -#ifndef FIX_2410_HARM_MODIF_FS -Word16 modify_Fs_ivas_fx( /* o : length of output Q0 */ -#else /* 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 */ - const Word32 fin, /* i : frequency of input Q0 */ - Word16 sigOut_fx[], /* o : decimated signal Q0 */ - const Word32 fout, /* i : frequency of output Q0 */ - Word16 mem_fx[], /* i/o: filter memory Q0 */ - const Word16 nblp, /* i : flag indicating if NB low-pass is applied */ - Word16 *Q_new_inp, /*scaling added on sigOut_fx */ - Word16 *mem_decim_size /*i: size modified for mem_fx*/ + const Word16 sigIn_fx[], /* i : signal to decimate Q0 */ + Word16 lg, /* i : length of input Q0 */ + const Word32 fin, /* i : frequency of input Q0 */ + Word16 sigOut_fx[], /* o : decimated signal Q0 */ + const Word32 fout, /* i : frequency of output Q0 */ + Word16 mem_fx[], /* i/o: filter memory Q0 */ + const Word16 nblp, /* i : flag indicating if NB low-pass is applied */ + Word16 *Q_new_inp, /*scaling added on sigOut_fx */ + Word16 *mem_decim_size /*i: size modified for mem_fx*/ ) { Word16 i; @@ -84,9 +80,7 @@ Word16 modify_Fs_fx( * Find the resampling configuration *-------------------------------------------------------------------*/ -#ifdef FIX_2410_HARM_MODIF_FS if ( Q_new_inp != NULL ) -#endif { *Q_new_inp = 0; move16(); @@ -96,9 +90,7 @@ Word16 modify_Fs_fx( { /* just copy the signal_fx and quit */ Copy( sigIn_fx, sigOut_fx, lg ); -#ifdef FIX_2410_HARM_MODIF_FS if ( Q_new_inp != NULL ) -#endif { *mem_decim_size = 0; *Q_new_inp = 0; @@ -162,9 +154,7 @@ Word16 modify_Fs_fx( } mem_len = shl( filt_len, 1 ); -#ifdef FIX_2410_HARM_MODIF_FS if ( mem_decim_size != NULL ) -#endif { *mem_decim_size = mem_len; move16(); @@ -247,9 +237,7 @@ Word16 modify_Fs_fx( { filt_len_tmp = shr( add( filt_len, 1 ), 1 ); } -#ifdef FIX_2410_HARM_MODIF_FS if ( Q_new_inp != NULL ) -#endif { *Q_new_inp = negate( norm_s( sub( cfg_ptr_fx->filter_fx[0], 1 ) ) ); } @@ -285,9 +273,7 @@ Word16 modify_Fs_fx( sigOut_fx[i] = round_fx( L_shl( L_mult( sigOut_fx[i], num_den ), 1 ) ); /*Q0*/ move16(); } -#ifdef FIX_2410_HARM_MODIF_FS if ( Q_new_inp != NULL ) -#endif { *Q_new_inp = add( *Q_new_inp, 1 ); move16(); @@ -301,9 +287,7 @@ Word16 modify_Fs_fx( IF( GT_32( fin, 16000 ) && ( EQ_16( lg_out, L_FRAME ) || EQ_16( lg_out, L_FRAME16k ) || EQ_16( lg_out, 512 ) ) ) { num_den = shl_sat( num_den, 1 ); -#ifdef FIX_2410_HARM_MODIF_FS if ( Q_new_inp != NULL ) -#endif { *Q_new_inp = add( *Q_new_inp, 1 ); move16(); @@ -336,9 +320,7 @@ Word16 modify_Fs_fx( sigOut_fx[i] = round_fx( L_mac( L_deposit_h( sigOut_fx[i] ), sigOut_fx[i], num_den ) ); /*Q0*/ move16(); } -#ifdef FIX_2410_HARM_MODIF_FS if ( Q_new_inp != NULL ) -#endif { *Q_new_inp = add( *Q_new_inp, 1 ); move16(); @@ -360,273 +342,6 @@ Word16 modify_Fs_fx( return lg_out; } -#ifndef FIX_2410_HARM_MODIF_FS -Word16 modify_Fs_fx( /* o : length of output Q0 */ - const Word16 sigIn_fx[], /* i : signal to decimate Q0 */ - Word16 lg, /* i : length of input Q0 */ - const Word32 fin, /* i : frequency of input Q0 */ - Word16 sigOut_fx[], /* o : decimated signal Q0 */ - const Word32 fout, /* i : frequency of output Q0 */ - Word16 mem_fx[], /* i/o: filter memory Q0 */ - const Word16 nblp /* i : flag indicating if NB low-pass is applied */ -) -{ - Word16 i; - - Word16 lg_out, fac_num, fac_den, filt_len, frac, temp_n, mem_len; - Word16 num_den; - Word16 datastep, fracstep; - Word16 *sigIn_ptr, *sigPtr; - Word16 signal_tab_fx[3 * L_FILT_MAX + L_FRAME48k], *signal_fx, *signal_ana_fx; /* 3* as 2* for memory and 1* for future prediction */ - Word16 A_fx[M + 1], r_fx_h[M + 1], r_fx_l[M + 1]; - Word16 mem_len_ana; - Word16 plus_sample_in; - Word16 j; - Word16 mu_preemph_fx; - Word16 mem_preemph_fx; - Word16 Q_r; - Word16 mem_lev_fx[18]; - Word32 t0, t1, t2, L_tmp; /* temporary variables */ - Word32 LepsP[M + 1]; - Word16 flag_low_order = 0; - move16(); - Word16 filt_len_tmp; - const Resampling_cfg *cfg_ptr_fx; - - /*-------------------------------------------------------------------* - * Find the resampling configuration - *-------------------------------------------------------------------*/ - - /* check if fin and fout are the same */ - IF( EQ_32( fin, fout ) ) - { - /* just copy the signal_fx and quit */ - Copy( sigIn_fx, sigOut_fx, lg ); - - return lg; - } - ELSE - { - /* find the resampling configuration in the lookup table */ - cfg_ptr_fx = &resampling_cfg_tbl[0]; - WHILE( ( cfg_ptr_fx->fin_fx != 0 ) && !( EQ_32( cfg_ptr_fx->fin_fx, fin ) && EQ_32( cfg_ptr_fx->fout_fx, fout ) ) ) - { - test(); - test(); - cfg_ptr_fx++; - } - - - /* find config with NB 4kHz low-pass */ - test(); - test(); - IF( nblp && ( GT_32( fin, 8000 ) ) && ( EQ_32( fout, 12800 ) ) ) - { - flag_low_order = 1; - move16(); - cfg_ptr_fx++; - WHILE( ( cfg_ptr_fx->fin_fx != 0 ) && !( ( EQ_32( cfg_ptr_fx->fin_fx, fin ) ) && ( EQ_32( cfg_ptr_fx->fout_fx, fout ) ) ) ) - { - test(); - test(); - cfg_ptr_fx++; - } - } - - /*-------------------------------------------------------------------* - * 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; - move16(); - - IF( GE_16( lg, L_FRAME ) ) - { - lg_out = cfg_ptr_fx->lg_out; - move16(); - } - ELSE - { - lg_out = idiv1616( i_mult2( lg, fac_num ), fac_den ); - } - filt_len = cfg_ptr_fx->filt_len_fx; - move16(); - plus_sample_in = 0; - move16(); /*default, regular delay*/ - frac = 0; - move16(); - - test(); - IF( ( EQ_32( fin, 8000 ) ) && ( EQ_32( fout, 12800 ) ) ) - { - plus_sample_in = 7; - move16(); - frac = 4; - move16(); - } - - mem_len = shl( filt_len, 1 ); - signal_fx = signal_tab_fx + 2 * L_FILT_MAX + sub( L_FRAME48k, add( mem_len, lg ) ); - signal_ana_fx = signal_fx; - mem_len_ana = mem_len; - move16(); - } - - - /*-------------------------------------------------------------------* - * Resample - *-------------------------------------------------------------------*/ - /* append filter memory */ - Copy( mem_fx, signal_fx, mem_len ); - - sigPtr = signal_fx + mem_len; - Copy( sigIn_fx, sigPtr, lg ); - - IF( plus_sample_in > 0 ) - { - autocorr_fx( signal_ana_fx + sub( add( mem_len_ana, lg ), LEN_WIN_SSS ), 1, r_fx_h, r_fx_l, &Q_r, LEN_WIN_SSS, wind_sss_fx, 0, 0 ); - - t1 = L_Comp( r_fx_h[1], r_fx_l[1] ); /* R[1] in Q31 */ - t2 = L_abs( t1 ); /* abs R[1] */ - t0 = L_deposit_l( 0 ); - IF( r_fx_h[0] != 0 ) - { - t0 = Div_32( t2, r_fx_h[0], r_fx_l[0] ); /* R[1]/R[0] in Q31 */ - } - if ( t1 < 0 ) - { - t0 = L_negate( t0 ); /* R[1]/R[0] */ - } - - mu_preemph_fx = extract_h( t0 ); /*r_fx[1] / r_fx[0]; */ - mem_preemph_fx = signal_ana_fx[mem_len_ana + lg - LEN_WIN_SSS - 1]; - move16(); - preemph_fx( signal_ana_fx + sub( add( mem_len_ana, lg ), LEN_WIN_SSS ), mu_preemph_fx, LEN_WIN_SSS, &mem_preemph_fx ); - - /* Autocorrelations */ - autocorr_fx( signal_ana_fx + sub( add( mem_len_ana, lg ), LEN_WIN_SSS ), M, r_fx_h, r_fx_l, &Q_r, - LEN_WIN_SSS, wind_sss_fx, 0, 0 ); - - /* Lag windowing */ - lag_wind( r_fx_h, r_fx_l, M, fin, LAGW_STRONG ); - - /* Levinson-Durbin */ - set16_fx( mem_lev_fx, 0, 18 ); - 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 ) ); - - FOR( i = 0; i < plus_sample_in; i++ ) - { - sigPtr = signal_fx + add( add( lg, mem_len ), i ); - move16(); /*+i*/ - L_tmp = syn_kern_16( 0, A_fx, sigPtr ); - L_tmp = L_shl_sat( L_tmp, 3 ); - *sigPtr = round_fx_sat( L_tmp ); /* AZ ringing padding */ - } - mem_preemph_fx = signal_fx[mem_len + lg - LEN_WIN_SSS - 1]; - move16(); - deemph_fx( signal_fx + sub( add( mem_len, lg ), LEN_WIN_SSS ), mu_preemph_fx, add( LEN_WIN_SSS, plus_sample_in ), &mem_preemph_fx ); - } - /* interpolation */ - - datastep = shr( div_s( shl( fac_den, 8 ), shl( fac_num, 11 ) ), 12 ); - /* equivalent to 'datastep = fac_den % fac_num' */ - temp_n = i_mult2( datastep, fac_num ); /*Q0*/ - fracstep = sub( fac_den, temp_n ); - - sigIn_ptr = signal_fx + add( filt_len, plus_sample_in ); - - filt_len_tmp = filt_len; - move16(); - IF( flag_low_order ) - { - filt_len_tmp = shr( add( filt_len, 1 ), 1 ); - } - - FOR( i = 0; i < lg_out; i++ ) - { - sigOut_fx[i] = round_fx_sat( Interpol_lc_fx( sigIn_ptr, cfg_ptr_fx->filter_fx, frac, fac_num, filt_len_tmp ) ); - move16(); - frac = add( frac, fracstep ); - - j = sub( fac_num, frac ); - if ( j < 0 ) - { - frac = sub( frac, fac_num ); - } - sigIn_ptr += add( lshr( j, 15 ), datastep ); - } - /* rescaling */ - test(); - - IF( EQ_32( ( GT_16( fac_num, fac_den ) ), ( ( cfg_ptr_fx->flags_fx & RS_INV_FAC ) != 0 ) ) ) - { - IF( LT_16( fac_num, fac_den ) ) - { - num_den = div_s( fac_num, fac_den ); /*Q15*/ - test(); - IF( GT_32( fin, 16000 ) && EQ_16( lg_out, 512 ) ) - { - - FOR( i = 0; i < lg_out; i++ ) - { - sigOut_fx[i] = round_fx( L_shl( L_mult( sigOut_fx[i], num_den ), 1 ) ); /*Q0*/ - } - } - ELSE - { - test(); - test(); - test(); - if ( GT_32( fin, 16000 ) && ( EQ_16( lg_out, L_FRAME ) || EQ_16( lg_out, L_FRAME16k ) || EQ_16( lg_out, 512 ) ) ) - { - num_den = shl_sat( num_den, 1 ); - } - FOR( i = 0; i < lg_out; i++ ) - { - sigOut_fx[i] = mult_r( sigOut_fx[i], num_den ); /*Q0*/ - move16(); - } - } - } - ELSE - { - IF( EQ_16( fac_num, 8 ) ) - { - num_den = 26214; - FOR( i = 0; i < lg_out; i++ ) - { - sigOut_fx[i] = mult_r( sigOut_fx[i], num_den ); /*Q-1*/ - move16(); - } - } - ELSE - { - num_den = div_s( sub( fac_num, fac_den ), fac_den ); /*Q15*/ - FOR( i = 0; i < lg_out; i++ ) - { - sigOut_fx[i] = round_fx( L_mac( L_deposit_h( sigOut_fx[i] ), sigOut_fx[i], num_den ) ); /*Q0*/ - } - } - } - } - ELSE IF( ( LT_16( fac_num, fac_den ) ) && ( ( cfg_ptr_fx->flags_fx & RS_INV_FAC ) != 0 ) ) - { - FOR( i = 0; i < lg_out; i++ ) - { - sigOut_fx[i] = mult_r( sigOut_fx[i], 16384 ); - move16(); /*Q-1*/ - } - } - /* update the filter memory */ - sigPtr = signal_fx + lg; - Copy( sigPtr, mem_fx, mem_len ); - - return lg_out; -} -#endif /*-------------------------------------------------------------------* diff --git a/lib_com/options.h b/lib_com/options.h index fec0720047015fdd685dce0328ca2775402e06ca..45d5334e0a32cbf6e4f79e526aeadd0bdd7dd9b4 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -83,16 +83,9 @@ #define FIX_1990_SANITIZER_IN_REVERB_LOAD /* Nokia: Fix issue part of issue 1990 by introducing missing free of structure - keep until #2059 is addressed */ #define TMP_1342_WORKAROUND_DEC_FLUSH_BROKEN_IN_SR /* FhG: Temporary workaround for incorrect implementation of decoder flush with split rendering */ #define NONBE_1122_KEEP_EVS_MODE_UNCHANGED /* FhG: Disables fix for issue 1122 in EVS mode to keep BE tests green. This switch should be removed once the 1122 fix is added to EVS via a CR. */ -#define FIX_FLOAT_1522_LTV_MSAN_QMETADATA_ENC_EC3 /* Nokia: float issue 1522: fix uninit MSAN in EC3 of qmetadata encoding */ -#define OPT_2416_ACELP_FAST /* VA: basop issue 2426, optimisation of acelp_fast_fx ( reduc. compl. by 0.35 wmops ) */ -#define FIX_2410_HARM_MODIF_FS /* VA: basop issue 2410: Remove duplicated modif_Fs */ -#define FIX_2425_REMOVE_RC_DUPLICATES /* VA: basop issue 2425: Remove duplicated RC encoder functions */ -#define HARM_LEV_DURBIN /* VA: basop issue 2423: harmonize levinson-Durbin algorithm */ #define HARMONIZE_TBE2 /* VA: basop issue 2399: Remove duplicated code: TBE, step 2 */ #define HARMONIZE_2427_GETPLC /* FhG: basop issue : 2427 Harmonizing getPLCDecision functions:*/ #define HARM_FD_BWE /* VA: harmonize core-coder FD BWE function duplications */ -#define FIX_2411_Harmonize_TNSANALYSIS_DETECTTNSFILT /* FhG: basop issue 2411: harmonize TNSAnalysis*_fx(), DetectTnsFilt*_fx()*/ -#define HARMONIZE_READ_DECODE_TNS /* FhG basop 2389: Harm between two pairs of functions. */ #define FIX_FLOAT_1526_DIRAC_MEM_LEAK /* FhG: float issue 1526: potential memory leak in DirAC handles in case of format switching */ #define FIX_2437_HARMONIZE_ENCODERINDEX /* FhG: basop issue 2437 EncoderIndex_ivas_fx() and EncoderIndex_fx()*/ #define FIX_2385_GETTCXONLY /* FhG: issue 2385 : harmonizing getTcxonly_ivas_fx() and getTcxonly_ivas_fx() functions */ @@ -108,7 +101,6 @@ /* #################### Start NON-BE switches ############################ */ /* any switch which is non-be wrt. TS 26.251 V3.0 */ - #define NONBE_MR2809 /* ##################### End NON-BE switches ########################### */ diff --git a/lib_com/parameter_bitmaping_fx.c b/lib_com/parameter_bitmaping_fx.c index 5a2f8ccfe640147dd4798ff6246940ac0a119ee9..8a9ac872a2fe6e7e1ed073b517c0cad3f42de4de 100644 --- a/lib_com/parameter_bitmaping_fx.c +++ b/lib_com/parameter_bitmaping_fx.c @@ -228,15 +228,10 @@ void SetParameters_fx( IF( s_and( param->pSubParamBitMap != NULL, value > 0 ) ) { pTmp = pParameter; -#ifdef HARMONIZE_READ_DECODE_TNS if ( pSubStruct != NULL ) { pTmp = pSubStruct; } -#else - if ( pSubStruct != NULL ) - pTmp = pSubStruct; -#endif SetParameters( param->pSubParamBitMap, value, pTmp, pStream, pnSize ); } } diff --git a/lib_com/prot_fx.h b/lib_com/prot_fx.h index b9eae67628a39d84f437d304d23b32f07b133e58..a4a32366e6dc07bb41847717659e3d5eb48f0c2b 100644 --- a/lib_com/prot_fx.h +++ b/lib_com/prot_fx.h @@ -2438,34 +2438,18 @@ Word32 Interpol_lc_fx( ); /* o : length of output Q0 */ -#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 */ -#endif - const Word16 sigIn_fx[], /* i : signal to decimate Q0 */ - Word16 lg, /* i : length of input Q0 */ - const Word32 fin, /* i : frequency of input Q0 */ - Word16 sigOut_fx[], /* o : decimated signal Q0 */ - const Word32 fout, /* i : frequency of output Q0 */ - Word16 mem_fx[], /* i/o: filter memory Q0 */ - const Word16 nblp, /* i : flag indicating if NB low-pass is applied */ - Word16 *Q_new_inp, /*scaling added on sigOut_fx */ - Word16 *mem_decim_size /*i: size modified for mem_fx*/ -); - -#ifndef FIX_2410_HARM_MODIF_FS -/* o : length of output Q0 */ -Word16 modify_Fs_fx( - const Word16 sigIn_fx[], /* i : signal to decimate Q0 */ - Word16 lg, /* i : length of i Q0 */ - const Word32 fin, /* i : frequency of i Q0 */ - Word16 sigOut_fx[], /* o : decimated signal Q0 */ - const Word32 fout, /* i : frequency of output Q0 */ - Word16 mem_fx[], /* i/o: filter memory Q0 */ - const Word16 nblp /* i : flag indicating if NB low-pass is applied */ +Word16 modify_Fs_fx( /* o : length of output Q0 */ + const Word16 sigIn_fx[], /* i : signal to decimate Q0 */ + Word16 lg, /* i : length of input Q0 */ + const Word32 fin, /* i : frequency of input Q0 */ + Word16 sigOut_fx[], /* o : decimated signal Q0 */ + const Word32 fout, /* i : frequency of output Q0 */ + Word16 mem_fx[], /* i/o: filter memory Q0 */ + const Word16 nblp, /* i : flag indicating if NB low-pass is applied */ + Word16 *Q_new_inp, /*scaling added on sigOut_fx */ + Word16 *mem_decim_size /*i: size modified for mem_fx*/ ); -#endif + /* 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) */ @@ -8135,7 +8119,6 @@ void tcx_hm_modify_envelope( Word32 env[], /* i/o: envelope Q16 */ Word16 L_frame /* i: number of spectral lines Q0 */ ); -#ifdef HARMONIZE_READ_DECODE_TNS void ReadTnsData_fx( STnsConfig const *pTnsConfig, Decoder_State *st, @@ -8149,34 +8132,6 @@ Word16 DecodeTnsData_fx( Word16 *pnSize, /*Q0*/ STnsData *pTnsData ); -#else -Word16 ReadTnsData( - STnsConfig const *pTnsConfig, - Decoder_State *st, - Word16 *pnBits, - Word16 *stream, - Word16 *pnSize ); - -void ReadTnsData_ivas_fx( - STnsConfig const *pTnsConfig, - Decoder_State *st, - Word16 *pnBits, - Word16 *stream, - Word16 *pnSize ); - -Word16 DecodeTnsData( - STnsConfig const *pTnsConfig, - Word16 const *stream, - Word16 *pnSize, - STnsData *pTnsData ); - -Word16 DecodeTnsData_ivas_fx( - STnsConfig const *pTnsConfig, - Word16 const *stream, - Word16 *pnSize, - STnsData *pTnsData ); - -#endif void GetParameters( ParamsBitMap const *paramsBitMap, const Word16 nParams, @@ -10845,21 +10800,6 @@ void WriteTnsData( Word16 *pnBits /* o : number of written bits */ ); -#ifndef HARMONIZE_READ_DECODE_TNS -void ReadTnsData_ivas( - STnsConfig const *pTnsConfig, - Decoder_State *st, - Word16 *pnBits, - Word16 *stream, - Word16 *pnSize ); - -Word16 DecodeTnsData_ivas( - STnsConfig const *pTnsConfig, - const Word16 *stream, - Word16 *pnSize, - STnsData *pTnsData ); - -#endif // HARMONIZE_READ_DECODE_TNS void analysisCldfbEncoder_ivas_fx( Encoder_State *st, /* i/o: encoder state structure */ Word32 *timeIn, /*q11*/ diff --git a/lib_dec/dec_prm_fx.c b/lib_dec/dec_prm_fx.c index 420c20dbfb65afb13addc582fa0acac280d00d82..5da9b6f1a91cc8f5aa2c84684bf2271f2ff1bb70 100644 --- a/lib_dec/dec_prm_fx.c +++ b/lib_dec/dec_prm_fx.c @@ -394,13 +394,8 @@ void getTCXparam_fx( } ELSE { -#ifdef HARMONIZE_READ_DECODE_TNS ReadTnsData_fx( st->hTcxCfg->pCurrentTnsConfig, st0, &nTnsBits, prm + j, &nTnsParams ); -#else - - ReadTnsData_ivas_fx( st->hTcxCfg->pCurrentTnsConfig, st0, &nTnsBits, prm + j, &nTnsParams ); -#endif // HARMONIZE_READ_DECODE_TNS } hTcxDec->tnsActive[k] = 0; // Q0 move16(); @@ -1357,11 +1352,7 @@ void dec_prm_fx( IF( st->hTcxCfg->fIsTNSAllowed ) { SetTnsConfig( st->hTcxCfg, 1, (Word16) EQ_16( st->last_core_from_bs, ACELP_CORE ) ); -#ifdef HARMONIZE_READ_DECODE_TNS ReadTnsData_fx( st->hTcxCfg->pCurrentTnsConfig, st, &nTnsBits, prm + j, &nTnsParams ); -#else - ReadTnsData( st->hTcxCfg->pCurrentTnsConfig, st, &nTnsBits, prm + j, &nTnsParams ); -#endif // HARMONIZE_READ_DECODE_TNS j = add( j, nTnsParams ); // Q0 } @@ -1685,11 +1676,7 @@ void dec_prm_fx( test(); test(); SetTnsConfig( st->hTcxCfg, 0, ( st->last_core_from_bs == ACELP_CORE ) && ( k == 0 ) ); -#ifdef HARMONIZE_READ_DECODE_TNS ReadTnsData_fx( st->hTcxCfg->pCurrentTnsConfig, st, &nTnsBits, prm + j, &nTnsParams ); -#else - ReadTnsData( st->hTcxCfg->pCurrentTnsConfig, st, &nTnsBits, prm + j, &nTnsParams ); -#endif // DEBUG j = add( j, nTnsParams ); diff --git a/lib_dec/dec_tcx_fx.c b/lib_dec/dec_tcx_fx.c index 0b954c17c41712a68c250b803f9d1ea0431944ea..339826d531f793c24ee077b439cab50928d4ec4a 100644 --- a/lib_dec/dec_tcx_fx.c +++ b/lib_dec/dec_tcx_fx.c @@ -297,17 +297,10 @@ void decoder_tcx_fx( IF( ( bfi == 0 ) && ( hTcxCfg->fIsTNSAllowed != 0 ) ) { cast16(); -#ifdef HARMONIZE_READ_DECODE_TNS fUseTns = (Word8) DecodeTnsData_fx( hTcxCfg->pCurrentTnsConfig, prm_tns, &tnsSize, &tnsData ); -#else - fUseTns = (Word8) DecodeTnsData( hTcxCfg->pCurrentTnsConfig, - prm_tns, - &tnsSize, - &tnsData ); -#endif // HARMONIZE_READ_DECODE_TNS } ELSE { @@ -4206,11 +4199,7 @@ void decoder_tcx_invQ_fx( test(); IF( !bfi && hTcxCfg->fIsTNSAllowed ) { -#ifdef HARMONIZE_READ_DECODE_TNS *fUseTns = DecodeTnsData_fx( hTcxCfg->pCurrentTnsConfig, prm_tns, &tnsSize, tnsData ); -#else - *fUseTns = DecodeTnsData_ivas_fx( hTcxCfg->pCurrentTnsConfig, prm_tns, &tnsSize, tnsData ); -#endif // HARMONIZE_READ_DECODE_TNS move16(); } diff --git a/lib_dec/ivas_lfe_plc_fx.c b/lib_dec/ivas_lfe_plc_fx.c index f99237f46004c3ec097b169c1b868af2dade4c2d..a088b44adb6063c327e6caab8516257d3a47f3c4 100755 --- a/lib_dec/ivas_lfe_plc_fx.c +++ b/lib_dec/ivas_lfe_plc_fx.c @@ -1001,18 +1001,10 @@ void ivas_lfe_tdplc_fx( Copy_Scale_sig_32_16( rec_frame_fx, rec_frame_16_fx, LFE_PLC_RECLEN, -Q5 ); // Q0 Word16 Q_new_inp, mem_decim_size, size_modified; -#ifndef FIX_2410_HARM_MODIF_FS - size_modified = modify_Fs_ivas_fx( prevsynth_16_fx + LFE_PLC_BUFLEN - LFE_PLC_FDEL / LFE_PLC_DSF, LFE_PLC_FDEL / LFE_PLC_DSF, LFE_PLC_FS, rec_frame_us_16_fx, 48000, mem_fx, 0, &Q_new_inp, &mem_decim_size ); -#else size_modified = modify_Fs_fx( prevsynth_16_fx + LFE_PLC_BUFLEN - LFE_PLC_FDEL / LFE_PLC_DSF, LFE_PLC_FDEL / LFE_PLC_DSF, LFE_PLC_FS, rec_frame_us_16_fx, 48000, mem_fx, 0, &Q_new_inp, &mem_decim_size ); -#endif Scale_sig( rec_frame_us_16_fx, size_modified, negate( Q_new_inp ) ); /* scaling back to Q0 */ -#ifndef FIX_2410_HARM_MODIF_FS - size_modified = modify_Fs_ivas_fx( rec_frame_16_fx, LFE_PLC_RECLEN, LFE_PLC_FS, rec_frame_us_16_fx, 48000, mem_fx, 0, &Q_new_inp, &mem_decim_size ); -#else size_modified = modify_Fs_fx( rec_frame_16_fx, LFE_PLC_RECLEN, LFE_PLC_FS, rec_frame_us_16_fx, 48000, mem_fx, 0, &Q_new_inp, &mem_decim_size ); -#endif Scale_sig( rec_frame_us_16_fx, size_modified, negate( Q_new_inp ) ); /* scaling back to Q0 */ /*samples are generated with 48k sampling rate diff --git a/lib_dec/tns_base_dec_fx.c b/lib_dec/tns_base_dec_fx.c index 44d18ccb2a4dda6daaee40b9b6266bf0fd4473e8..aa154531b12ea5097761d14b736cd91f8349a94e 100644 --- a/lib_dec/tns_base_dec_fx.c +++ b/lib_dec/tns_base_dec_fx.c @@ -23,7 +23,6 @@ typedef Word32 ( *TLinearPredictionFilter )( Word16 order, Word16 const parCoeff /********************************/ -#ifdef HARMONIZE_READ_DECODE_TNS /*---------------------------------------------------------------------* * ReadTnsData() * @@ -133,202 +132,3 @@ Word16 DecodeTnsData_fx( } return result; } -#else -/*---------------------------------------------------------------------* - * ReadTnsData() - * - * - *---------------------------------------------------------------------*/ - -Word16 -ReadTnsData( - STnsConfig const *pTnsConfig, - Decoder_State *st, - Word16 *pnBits, /*Q0*/ - Word16 *stream, /*Q0*/ - Word16 *pnSize /*Q0*/ -) -{ - Word16 start_bit_pos; - - - move16(); - start_bit_pos = st->next_bit_pos; - - IF( GT_16( pTnsConfig->nMaxFilters, 1 ) ) - { - { - - IF( LT_16( pTnsConfig->iFilterBorders[0], 512 ) ) - { - ReadFromBitstream_fx( &tnsEnabledSWBTCX10BitMap, 1, st, &stream, pnSize ); - } - ELSE - { - ReadFromBitstream_fx( &tnsEnabledSWBTCX20BitMap, 1, st, &stream, pnSize ); - } - } - } - ELSE - { - ReadFromBitstream_fx( &tnsEnabledWBTCX20BitMap, 1, st, &stream, pnSize ); - } - - move16(); - *pnBits = sub( st->next_bit_pos, start_bit_pos ); - - return TNS_NO_ERROR; -} - -void ReadTnsData_ivas_fx( - STnsConfig const *pTnsConfig, - Decoder_State *st, - Word16 *pnBits, /*Q0*/ - Word16 *stream, /*Q0*/ - Word16 *pnSize /*Q0*/ -) -{ - Word16 start_bit_pos; - - move16(); - start_bit_pos = st->next_bit_pos; - - IF( GT_16( pTnsConfig->nMaxFilters, 1 ) ) - { - IF( pTnsConfig->allowTnsOnWhite ) - { - IF( LT_16( pTnsConfig->iFilterBorders[0], 512 ) ) - { - ReadFromBitstream_fx( &tnsEnabledOnWhiteSWBTCX10BitMap, 1, st, &stream, pnSize ); - } - ELSE - { - ReadFromBitstream_fx( &tnsEnabledOnWhiteSWBTCX20BitMap, 1, st, &stream, pnSize ); - } - } - ELSE - { - - IF( LT_16( pTnsConfig->iFilterBorders[0], 512 ) ) - { - ReadFromBitstream_fx( &tnsEnabledSWBTCX10BitMap, 1, st, &stream, pnSize ); - } - ELSE - { - ReadFromBitstream_fx( &tnsEnabledSWBTCX20BitMap, 1, st, &stream, pnSize ); - } - } - } - ELSE - { - ReadFromBitstream_fx( &tnsEnabledWBTCX20BitMap, 1, st, &stream, pnSize ); - } - - move16(); - *pnBits = sub( st->next_bit_pos, start_bit_pos ); - - return; -} - -/*---------------------------------------------------------------------* - * DecodeTnsData() - * - * - *---------------------------------------------------------------------*/ - -Word16 DecodeTnsData( - STnsConfig const *pTnsConfig, - Word16 const *stream, /*Q0*/ - Word16 *pnSize, /*Q0*/ - STnsData *pTnsData ) -{ - Word16 result; - - - ResetTnsData( pTnsData ); - - IF( GT_16( pTnsConfig->nMaxFilters, 1 ) ) - { - { - IF( LT_16( pTnsConfig->iFilterBorders[0], 512 ) ) - { - SetParameters( &tnsEnabledSWBTCX10BitMap, 1, pTnsData, &stream, pnSize ); - } - ELSE - { - SetParameters( &tnsEnabledSWBTCX20BitMap, 1, pTnsData, &stream, pnSize ); - } - } - } - ELSE - { - SetParameters( &tnsEnabledWBTCX20BitMap, 1, pTnsData, &stream, pnSize ); - } - - move16(); - result = FALSE; - if ( pTnsData->nFilters > 0 ) - { - move16(); - result = TRUE; - } - - - return result; -} - -Word16 DecodeTnsData_ivas_fx( - STnsConfig const *pTnsConfig, - Word16 const *stream, /*Q0*/ - Word16 *pnSize, /*Q0*/ - STnsData *pTnsData ) -{ - Word16 result; - - ResetTnsData( pTnsData ); - - IF( GT_16( pTnsConfig->nMaxFilters, 1 ) ) - { - - IF( pTnsConfig->allowTnsOnWhite ) - { - IF( LT_16( pTnsConfig->iFilterBorders[0], 512 ) ) - { - SetParameters_fx( &tnsEnabledOnWhiteSWBTCX10BitMap, 1, pTnsData, &stream, pnSize ); - } - ELSE - { - SetParameters_fx( &tnsEnabledOnWhiteSWBTCX20BitMap, 1, pTnsData, &stream, pnSize ); - } - } - ELSE - { - IF( LT_16( pTnsConfig->iFilterBorders[0], 512 ) ) - { - SetParameters_fx( &tnsEnabledSWBTCX10BitMap, 1, pTnsData, &stream, pnSize ); - } - ELSE - { - SetParameters_fx( &tnsEnabledSWBTCX20BitMap, 1, pTnsData, &stream, pnSize ); - } - } - } - ELSE - { - SetParameters_fx( &tnsEnabledWBTCX20BitMap, 1, pTnsData, &stream, pnSize ); - } - - move16(); - result = FALSE; - if ( pTnsData->nFilters > 0 ) - { - move16(); - result = TRUE; - } - - - return result; -} - - -#endif // HARMONIZE_READ_DECODE_TNS diff --git a/lib_enc/amr_wb_enc_fx.c b/lib_enc/amr_wb_enc_fx.c index dfc11efcdd3db7f2f959d940b3f7f877e26398d3..5f14a9b661c6657d491ccde80e3e7f31a5eaaf2c 100644 --- a/lib_enc/amr_wb_enc_fx.c +++ b/lib_enc/amr_wb_enc_fx.c @@ -262,11 +262,7 @@ 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 */ @@ -451,11 +447,7 @@ void amr_wb_enc_fx( } ELSE IF( EQ_32( st->input_Fs, 32000 ) || EQ_32( st->input_Fs, 48000 ) ) { -#ifndef FIX_2410_HARM_MODIF_FS - modify_Fs_fx( st->input_fx, input_frame, st->input_Fs, new_inp_16k, 16000, st->mem_decim16k_fx, 0 ); -#else modify_Fs_fx( st->input_fx, input_frame, st->input_Fs, new_inp_16k, 16000, st->mem_decim16k_fx, 0, NULL, NULL ); -#endif } /*----------------------------------------------------------------* diff --git a/lib_enc/cng_enc_fx.c b/lib_enc/cng_enc_fx.c index e0b5041c8889edf3e8f39569af44b230830a4692..e76a227ae6774b7fb23e6a8e5044eebd28c9ae63 100644 --- a/lib_enc/cng_enc_fx.c +++ b/lib_enc/cng_enc_fx.c @@ -877,11 +877,7 @@ void CNG_enc_fx( IF( EQ_16( st_fx->L_frame, L_FRAME16k ) ) { -#ifndef FIX_2410_HARM_MODIF_FS - modify_Fs_fx( fft_io, L_FRAME16k, 16000, fft_io, 12800, hTdCngEnc->exc_mem2_fx, 0 ); -#else modify_Fs_fx( fft_io, L_FRAME16k, 16000, fft_io, 12800, hTdCngEnc->exc_mem2_fx, 0, NULL, NULL ); -#endif } fft_rel_fx( fft_io, L_FFT, LOG2_L_FFT ); diff --git a/lib_enc/cod4t64_fast_fx.c b/lib_enc/cod4t64_fast_fx.c index 66378d261dde31d4ec7cbcdcff1967607bc1d3a2..c6a2811e0675130380e40cbc121cb0d4b1b4c48d 100644 --- a/lib_enc/cod4t64_fast_fx.c +++ b/lib_enc/cod4t64_fast_fx.c @@ -122,19 +122,12 @@ void acelp_fast_fx( BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ const Word16 cdk_index, /* i : codebook index */ const Word16 dn_orig[L_SUBFR], /* i : corr. between target and h[]. Q_dncn */ -#ifdef OPT_2416_ACELP_FAST - const Word16 Q_dncn, /* i : scaling factor of dn and cn */ -#else - Word16 Q_dn, -#endif - const Word16 cn[L_SUBFR], /* i : residual after long term prediction Q_dncn */ -#ifndef OPT_2416_ACELP_FAST - const Word16 q_cn, -#endif - const Word16 H[L_SUBFR], /* i : impulse response of weighted synthesis filter e(norm_s(H[0])+1) */ - Word16 code[L_SUBFR], /* o : algebraic (fixed) codebook excitation Q0 */ - Word16 y[], /* o : filtered fixed codebook excitation e(norm_s(H[0])+1) */ - const Word16 L_subfr /* i : subframe length */ + const Word16 Q_dncn, /* i : scaling factor of dn and cn */ + const Word16 cn[L_SUBFR], /* i : residual after long term prediction Q_dncn */ + const Word16 H[L_SUBFR], /* i : impulse response of weighted synthesis filter e(norm_s(H[0])+1) */ + Word16 code[L_SUBFR], /* o : algebraic (fixed) codebook excitation Q0 */ + Word16 y[], /* o : filtered fixed codebook excitation e(norm_s(H[0])+1) */ + const Word16 L_subfr /* i : subframe length */ ) { Word16 i, j, q, bits, bits_track, nb_pos, nb_pulse, track, nb_iter, nb_tracks; @@ -164,9 +157,6 @@ void acelp_fast_fx( Word16 flag = 0; move16(); Word32 temp1, temp2, temp3, temp4, temp5, temp6; -#ifndef OPT_2416_ACELP_FAST - Word16 q_temp1, q_temp2; -#endif Word16 scale_temp1, scale_temp2; /*-----------------------------------------------------------------* @@ -298,9 +288,6 @@ void acelp_fast_fx( * Find signal bn[] and sign pre-selection vector sign[]. *-----------------------------------------------------------------*/ -#ifndef OPT_2416_ACELP_FAST - exp = sub( Q31, shl( Q_dn, 1 ) ); -#endif s64 = 0; move64(); FOR( i = 0; i < L_subfr; i++ ) @@ -315,11 +302,7 @@ void acelp_fast_fx( { Word16 new_exp1 = W_norm( s64 ); dndn_fx = W_extract_h( W_shl( s64, new_exp1 ) ); // 2 * Q_dyn + exp1 - 31 -#ifndef OPT_2416_ACELP_FAST - dndn_e = sub( 31, sub( add( add( shl( Q_dn, 1 ), 1 ), new_exp1 ), 32 ) ); -#else dndn_e = sub( 31, sub( add( add( shl( Q_dncn, 1 ), 1 ), new_exp1 ), 32 ) ); -#endif } cncn_fx = 214748365 /* 0.1f in Q31 */; @@ -344,11 +327,7 @@ void acelp_fast_fx( { Word16 new_exp1 = W_norm( s64 ); cncn_track[q] = W_extract_h( W_shl( s64, new_exp1 ) ); // 2 * Q_dyn + exp1 - 31 -#ifndef OPT_2416_ACELP_FAST - cncn_track_e[q] = sub( 31, sub( add( add( shl( q_cn, 1 ), 1 ), new_exp1 ), 32 ) ); -#else cncn_track_e[q] = sub( 31, sub( add( add( shl( Q_dncn, 1 ), 1 ), new_exp1 ), 32 ) ); -#endif } cncn_fx = BASOP_Util_Add_Mant32Exp( cncn_fx, cncn_e, cncn_track[q], cncn_track_e[q], &cncn_e ); // Q(cncn_e) } @@ -359,13 +338,8 @@ void acelp_fast_fx( tmp = add( tmp, sub( dndn_e, cncn_e ) ); s_coef_fx = Sqrt16( s_coef_fx, &tmp ); // Q(15 - tmp) -#ifdef OPT_2416_ACELP_FAST scale_temp1 = sub( Q16, tmp ); /* Q_dn = q_cn and it doesn't matter */ -#else - q_temp1 = add( add( sub( Q15, tmp ), q_cn ), Q1 ); - scale_temp1 = sub( q_temp1, Q_dn ); -#endif FOR( i = 0; i < L_subfr; i++ ) { @@ -377,7 +351,6 @@ void acelp_fast_fx( bn_orig_fx[i] = L_add( temp1, temp2 ); // Q_dn move32(); -#ifdef OPT_2416_ACELP_FAST sign_fx[i] = -1; move16(); if ( bn_orig_fx[i] >= 0 ) @@ -385,17 +358,6 @@ void acelp_fast_fx( sign_fx[i] = 1; move16(); } -#else - IF( bn_orig_fx[i] >= 0 ) - { - sign_fx[i] = 1; - } - ELSE - { - sign_fx[i] = -1; - } - move16(); -#endif } /*-----------------------------------------------------------------* @@ -486,7 +448,6 @@ void acelp_fast_fx( test(); test(); /* skip certain tracks if number of pulses is lower than number of tracks */ -#ifdef OPT_2416_ACELP_FAST /* Just need a negative number, it doesn't need to be scaled */ IF( EQ_16( nb_pulse, 2 ) && EQ_16( nb_tracks, NB_TRACK_FCB_4T ) ) { max_track[NB_TRACK_FCB_4T - 3] = L_deposit_l( -1 ); @@ -508,29 +469,6 @@ void acelp_fast_fx( max_track[i] = L_deposit_l( -1 ); move32(); } -#else - IF( EQ_16( nb_pulse, 2 ) && EQ_16( nb_tracks, NB_TRACK_FCB_4T ) ) - { - max_track[NB_TRACK_FCB_4T - 3] = L_shl( -1, Q_dn ); // Q_dn - move32(); - max_track[NB_TRACK_FCB_4T - 1] = L_shl( -1, Q_dn ); // Q_dn - move32(); - } - ELSE IF( EQ_16( nb_pulse, 3 ) && EQ_16( codetrackpos, TRACKPOS_FIXED_FIRST ) ) - { - max_track[NB_TRACK_FCB_4T - 1] = L_shl( -1, Q_dn ); // Q_dn - move32(); - } - - FOR( q = 0; q < nb_tracks; q++ ) - { - i = maximum_32_fx( max_track, nb_tracks, &L_tmp1 ); - track_order[q] = i; - move16(); - max_track[i] = L_shl( -1, Q_dn ); // Q_dn - move32(); - } -#endif track_order[4] = track_order[1]; // Q0 move16(); @@ -669,13 +607,7 @@ void acelp_fast_fx( move64(); FOR( i = track; i < L_subfr; i += nb_tracks ) { -#ifdef OPT_2416_ACELP_FAST temp3 = L_msu0( L_mult0( Gd, dn_orig[i] ), G, *alp_pos0 ); -#else - temp1 = L_mult0( Gd, dn_orig[i] ); - temp2 = L_mult0( G, *alp_pos0 ); - temp3 = L_sub( temp1, temp2 ); -#endif dn[i] = L_shr( temp3, 6 ); move32(); alp_pos0 += nb_tracks; @@ -683,11 +615,7 @@ void acelp_fast_fx( } exp1 = W_norm( s64 ); dndn_fx = W_extract_h( W_shl( s64, exp1 ) ); // 2 * Q_dyn + exp1 - 31 -#ifndef OPT_2416_ACELP_FAST - dndn_e = sub( 31, sub( add( add( shl( Q_dn, 1 ), 1 ), exp1 ), 32 ) ); -#else dndn_e = sub( 31, sub( add( add( shl( Q_dncn, 1 ), 1 ), exp1 ), 32 ) ); -#endif IF( dndn_fx == 0 ) { dndn_fx = 214748365 /* 0.1f in Q31 */; @@ -704,16 +632,9 @@ void acelp_fast_fx( move16(); m[1] = track; // Q0 move16(); -#ifdef OPT_2416_ACELP_FAST scale_temp1 = sub( Q16, exp1 ); scale_temp2 = Q2; move16(); -#else - q_temp1 = add( add( sub( Q15, exp1 ), q_cn ), 1 ); - q_temp2 = add( Q_dn, Q2 ); - scale_temp1 = sub( q_temp1, Q_dn ); - scale_temp2 = sub( q_temp2, Q_dn ); -#endif FOR( i = track; i < L_subfr; i += nb_tracks ) { temp1 = L_mult( s_coef_fx, cn[i] ); // Q(15 - tmp)+q_cn+1 @@ -748,12 +669,8 @@ void acelp_fast_fx( Gn = add( Gn, i_mult( s[1], dn_orig[m[1]] ) ); // Q_dn Gd32 = Gd; move16(); -#ifdef OPT_2416_ACELP_FAST Gd32 = L_add( Gd32, L_mac0( alp[0], i_mult( shl( s[0], 1 ), s[1] ), alp[m[0] - m[1]] ) ); // Q6 -#else - Gd32 = L_add( Gd32, L_add( alp[0], L_mult0( i_mult( shl( s[0], 1 ), s[1] ), alp[m[0] - m[1]] ) ) ); // Q6 -#endif - G = Gn; // Q_dn + G = Gn; // Q_dn move16(); G1 = i_mult( G, s[1] ); // Q_dn G = i_mult( G, s[0] ); // Q_dn @@ -766,15 +683,8 @@ void acelp_fast_fx( FOR( i = track; i < L_subfr; i += nb_tracks ) { temp1 = imult3216( Gd32, dn_orig[i] ); -#ifdef OPT_2416_ACELP_FAST temp4 = L_msu0( temp1, G, *alp_pos0 ); temp4 = L_msu0( temp4, G1, *alp_pos1 ); -#else - temp2 = L_mult0( G, *alp_pos0 ); - temp3 = L_mult0( G1, *alp_pos1 ); - temp4 = L_sub( temp1, temp2 ); - temp4 = L_sub( temp4, temp3 ); -#endif dn[i] = L_shr( temp4, 6 ); move32(); alp_pos0 += nb_tracks; @@ -794,16 +704,10 @@ void acelp_fast_fx( Gn = add( Gn, i_mult( s[2], dn_orig[m[2]] ) ); // Q_dn temp1 = alp[0]; move32(); -#ifdef OPT_2416_ACELP_FAST temp2 = L_mac0( temp1, i_mult( shl( s[0], 1 ), s[2] ), alp[m[0] - m[2]] ); temp3 = L_mac0( temp2, i_mult( shl( s[1], 1 ), s[2] ), alp[m[1] - m[2]] ); Gd32 = L_add( Gd32, temp3 ); // Q6 -#else - temp2 = L_mult0( i_mult( shl( s[0], 1 ), s[2] ), alp[m[0] - m[2]] ); - temp3 = L_mult0( i_mult( shl( s[1], 1 ), s[2] ), alp[m[1] - m[2]] ); - Gd32 = L_add( Gd32, L_add( L_add( temp1, temp2 ), temp3 ) ); // Q6 -#endif - G = Gn; // Q_dn + G = Gn; // Q_dn move16(); G1 = i_mult( G, s[1] ); // Q_dn G2 = i_mult( G, s[2] ); // Q_dn @@ -819,18 +723,9 @@ void acelp_fast_fx( { temp1 = imult3216( Gd32, dn_orig[i] ); -#ifdef OPT_2416_ACELP_FAST temp5 = L_msu0( temp1, G, *alp_pos0 ); temp5 = L_msu0( temp5, G1, *alp_pos1 ); temp5 = L_msu0( temp5, G2, *alp_pos2 ); -#else - temp2 = L_mult0( G, *alp_pos0 ); - temp3 = L_mult0( G1, *alp_pos1 ); - temp4 = L_mult0( G2, *alp_pos2 ); - temp5 = L_sub( temp1, temp2 ); - temp5 = L_sub( temp5, temp3 ); - temp5 = L_sub( temp5, temp4 ); -#endif dn[i] = L_shr( temp5, 6 ); move32(); alp_pos0 += nb_tracks; @@ -856,19 +751,11 @@ void acelp_fast_fx( Gn = add( Gn, i_mult( s[3], dn_orig[m[3]] ) ); // Q_dn temp1 = alp[0]; move32(); -#ifdef OPT_2416_ACELP_FAST temp2 = L_mac0( temp1, i_mult( shl( s[0], 1 ), s[3] ), alp[m[0] - m[3]] ); temp2 = L_mac0( temp2, i_mult( shl( s[1], 1 ), s[3] ), alp[m[1] - m[3]] ); temp2 = L_mac0( temp2, i_mult( shl( s[2], 1 ), s[3] ), alp[m[2] - m[3]] ); Gd32 = L_add( Gd32, temp2 ); // Q6 -#else - temp2 = L_mult0( i_mult( shl( s[0], 1 ), s[3] ), alp[m[0] - m[3]] ); - temp3 = L_mult0( i_mult( shl( s[1], 1 ), s[3] ), alp[m[1] - m[3]] ); - temp4 = L_mult0( i_mult( shl( s[2], 1 ), s[3] ), alp[m[2] - m[3]] ); - - Gd32 = L_add( Gd32, L_add( L_add( L_add( temp1, temp2 ), temp3 ), temp4 ) ); // Q6 -#endif G = Gn; move16(); // Q_dn G1 = i_mult( G, s[1] ); // Q_dn @@ -889,21 +776,10 @@ void acelp_fast_fx( FOR( i = track; i < L_subfr; i += nb_tracks ) { temp1 = imult3216( Gd32, dn_orig[i] ); -#ifdef OPT_2416_ACELP_FAST temp6 = L_msu0( temp1, G, *alp_pos0 ); temp6 = L_msu0( temp6, G1, *alp_pos1 ); temp6 = L_msu0( temp6, G2, *alp_pos2 ); temp6 = L_msu0( temp6, G3, *alp_pos3 ); -#else - temp2 = L_mult0( G, *alp_pos0 ); - temp3 = L_mult0( G1, *alp_pos1 ); - temp4 = L_mult0( G2, *alp_pos2 ); - temp5 = L_mult0( G3, *alp_pos3 ); - temp6 = L_sub( temp1, temp2 ); - temp6 = L_sub( temp6, temp3 ); - temp6 = L_sub( temp6, temp4 ); - temp6 = L_sub( temp6, temp5 ); -#endif dn[i] = L_shr( temp6, 6 ); move32(); alp_pos0 += nb_tracks; @@ -925,21 +801,10 @@ void acelp_fast_fx( FOR( i = 0; i < L_subfr; i++ ) { temp1 = imult3216( Gd32, dn_orig[i] ); -#ifdef OPT_2416_ACELP_FAST temp6 = L_msu0( temp1, G, *alp_pos0 ); temp6 = L_msu0( temp6, G1, *alp_pos1 ); temp6 = L_msu0( temp6, G2, *alp_pos2 ); temp6 = L_msu0( temp6, G3, *alp_pos3 ); -#else - temp2 = L_mult0( G, *alp_pos0 ); - temp3 = L_mult0( G1, *alp_pos1 ); - temp4 = L_mult0( G2, *alp_pos2 ); - temp5 = L_mult0( G3, *alp_pos3 ); - temp6 = L_sub( temp1, temp2 ); - temp6 = L_sub( temp6, temp3 ); - temp6 = L_sub( temp6, temp4 ); - temp6 = L_sub( temp6, temp5 ); -#endif dn[i] = L_shr( temp6, 6 ); move16(); alp_pos0++; @@ -993,22 +858,11 @@ void acelp_fast_fx( FOR( j = 0; j < nb_pulse; j++ ) { -#ifdef OPT_2416_ACELP_FAST p_hn = h_inv - m[j]; if ( s[j] > 0 ) { p_hn = h - m[j]; } -#else - IF( s[j] > 0 ) - { - p_hn = h - m[j]; - } - ELSE - { - p_hn = h_inv - m[j]; - } -#endif FOR( i = 0; i < L_subfr; i++ ) { y_tmp[i] = add_sat( y_tmp[i], *p_hn++ ); // q_H @@ -1021,11 +875,7 @@ void acelp_fast_fx( s64 = W_mult0_32_32( crit_num, crit_num ); // 2*Q_dn exp = W_norm( s64 ); crit_num = W_extract_h( W_shl( s64, exp ) ); // 2*Q_dn + exp - 32 -#ifndef OPT_2416_ACELP_FAST - q_crit_num = add( shl( Q_dn, 1 ), sub( exp, 32 ) ); -#else q_crit_num = add( shl( Q_dncn, 1 ), sub( exp, 32 ) ); -#endif // crit_den = sum2_fx( y_tmp, L_subfr ); // 2*q_H s64 = 0; move64(); @@ -1044,7 +894,6 @@ void acelp_fast_fx( IF( GT_16( exp, exp1 ) ) { -#ifdef OPT_2416_ACELP_FAST flag = 0; move16(); if ( GE_32( L_shr( L_tmp1, sub( exp, exp1 ) ), L_tmp2 ) ) @@ -1052,22 +901,9 @@ void acelp_fast_fx( flag = 1; move16(); } -#else - IF( GE_32( L_shr( L_tmp1, sub( exp, exp1 ) ), L_tmp2 ) ) - { - flag = 1; - move16(); - } - ELSE - { - flag = 0; - move16(); - } -#endif } ELSE { -#ifdef OPT_2416_ACELP_FAST flag = 0; move16(); if ( GE_32( L_tmp1, L_shr( L_tmp2, sub( exp1, exp ) ) ) ) @@ -1075,18 +911,6 @@ void acelp_fast_fx( flag = 1; move16(); } -#else - IF( GE_32( L_tmp1, L_shr( L_tmp2, sub( exp1, exp ) ) ) ) - { - flag = 1; - move16(); - } - ELSE - { - flag = 0; - move16(); - } -#endif } IF( flag ) diff --git a/lib_enc/cod_tcx_fx.c b/lib_enc/cod_tcx_fx.c index db451247697fde2b4fcacff5ceff171b98199d0a..111805d4292c6e2ef023049232a710d75c6cadf2 100644 --- a/lib_enc/cod_tcx_fx.c +++ b/lib_enc/cod_tcx_fx.c @@ -135,96 +135,7 @@ void HBAutocorrelation_fx( } } -#ifndef FIX_2411_Harmonize_TNSANALYSIS_DETECTTNSFILT - -void TNSAnalysis_fx( - TCX_CONFIG_HANDLE hTcxCfg, /* i : configuration of TCX */ - Word16 L_frame, /* input: frame length */ - Word16 L_spec, - Word16 tcxMode, /* input: TCX mode for the frame/subframe - TCX20 | TCX10 | TCX 5 (meaning 2 x TCX 5) */ - Word8 isAfterACELP, /* input: Flag indicating if the last frame was ACELP. For the second TCX subframe it should be 0 */ - Word32 spectrum[], /* input: MDCT spectrum Qx*/ - STnsData *pTnsData, /* output: Tns data */ - Word8 *pfUseTns, /* output: Flag indicating if TNS is used */ - Word16 *predictionGain /*Q7*/ -) -{ - Word32 buff[8]; - Word16 tmp = 0; /* initialization only to avoid compiler warning, not counted */ - Word16 tmp2 = 0; /* initialization only to avoid compiler warning, not counted */ - move16(); - move16(); - - /* Init TNS */ - *pfUseTns = 0; - move16(); - - IF( hTcxCfg->fIsTNSAllowed != 0 ) - { - hTcxCfg->pCurrentTnsConfig = &hTcxCfg->tnsConfig[( tcxMode - TCX_20 ) == 0][isAfterACELP]; - L_spec = hTcxCfg->pCurrentTnsConfig->iFilterBorders[0]; - move16(); - - /*-----------------------------------------------------------* - * Temporal Noise Shaping analysis * - *-----------------------------------------------------------*/ - - IF( EQ_16( tcxMode, TCX_5 ) ) - { - tmp = shr( L_frame, 2 ); - - /* rearrange LF sub-window lines prior to TNS analysis & filtering */ - tmp2 = shr( L_spec, 1 ); - - IF( LT_16( tmp2, tmp ) ) - { - Copy32( spectrum + 8, spectrum + 16, sub( tmp2, 8 ) ); - Copy32( spectrum + tmp, spectrum + 8, 8 ); - Copy32( spectrum + tmp + 8, spectrum + tmp2 + 8, sub( tmp2, 8 ) ); - } - ELSE - { - Copy32( spectrum + tmp, buff, 8 ); - Copy32( spectrum + 8, spectrum + 16, sub( tmp, 8 ) ); - Copy32( buff, spectrum + 8, 8 ); - } - } - - move16(); - *pfUseTns = (Word8) DetectTnsFilt_fx( hTcxCfg->pCurrentTnsConfig, spectrum, pTnsData, predictionGain ); - - /* If TNS should be used then get the residual after applying it inplace in spectrum */ - IF( *pfUseTns != 0 ) - { - ApplyTnsFilter( hTcxCfg->pCurrentTnsConfig, pTnsData, spectrum, 1 ); - } - - IF( EQ_16( tcxMode, TCX_5 ) ) - { - /* undo rearrangement of LF sub-window lines prior to TNS analysis */ - IF( LT_16( tmp2, tmp ) ) - { - Copy32( spectrum + tmp2 + 8, spectrum + tmp + 8, sub( tmp2, 8 ) ); - Copy32( spectrum + 8, spectrum + tmp, 8 ); - Copy32( spectrum + 16, spectrum + 8, sub( tmp2, 8 ) ); - set32_fx( spectrum + tmp2, 0, sub( tmp, tmp2 ) ); - set32_fx( spectrum + tmp + tmp2, 0, sub( tmp, tmp2 ) ); - } - ELSE - { - Copy32( spectrum + 8, buff, 8 ); - Copy32( spectrum + 16, spectrum + 8, sub( tmp, 8 ) ); - Copy32( buff, spectrum + tmp, 8 ); - } - } - } -} -#endif // !FIX_2411_Harmonize_TNSANALYSIS_DETECTTNSFILT -#ifndef FIX_2411_Harmonize_TNSANALYSIS_DETECTTNSFILT -void TNSAnalysis_ivas_fx( -#else void TNSAnalysis_fx( -#endif // FIX_2411_Harmonize_TNSANALYSIS_DETECTTNSFILT TCX_CONFIG_HANDLE hTcxCfg, /* i : configuration of TCX */ Word16 L_frame, /* i : frame length */ Word16 L_spec, /* i : length of the spectrum */ @@ -280,13 +191,8 @@ void TNSAnalysis_fx( } move16(); -#ifdef FIX_2411_Harmonize_TNSANALYSIS_DETECTTNSFILT *pfUseTns = (Word8) DetectTnsFilt_fx( hTcxCfg->pCurrentTnsConfig, spectrum, pTnsData, hTranDet, (Word8) NE_16( transform_type, TCX_20 ), ltp_gain, predictionGain ); -#else - *pfUseTns = (Word8) DetectTnsFilt_ivas_fx( hTcxCfg->pCurrentTnsConfig, spectrum, pTnsData, hTranDet, (Word8) NE_16( transform_type, TCX_20 ), ltp_gain, predictionGain ); - -#endif // FIX_2411_Harmonize_TNSANALYSIS_DETECTTNSFILT /* If TNS should be used then get the residual after applying it inplace in spectrum */ IF( *pfUseTns != 0 ) @@ -3859,11 +3765,7 @@ void coder_tcx_fx( { SetTnsConfig( hTcxCfg, sub( L_frame_glob, st->L_frame ) == 0, st->last_core == 0 ); -#ifndef FIX_2411_Harmonize_TNSANALYSIS_DETECTTNSFILT - TNSAnalysis_fx( hTcxCfg, L_frame, L_spec, TCX_20, st->last_core == 0, spectrum, hTcxEnc->tnsData, hTcxEnc->fUseTns, &st->hIGFEnc->tns_predictionGain ); -#else TNSAnalysis_fx( hTcxCfg, L_frame, L_spec, TCX_20, st->last_core == 0, spectrum, st->hTranDet, -32768, hTcxEnc->tnsData, hTcxEnc->fUseTns, &st->hIGFEnc->tns_predictionGain ); -#endif // !FIX_2411_Harmonize_TNSANALYSIS_DETECTTNSFILT } ELSE { diff --git a/lib_enc/ext_sig_ana_fx.c b/lib_enc/ext_sig_ana_fx.c index 744ed3f924931e0b07e65545a9932e36b2b0f112..18e3e503c04f0557e41127afecef36acab14d946 100644 --- a/lib_enc/ext_sig_ana_fx.c +++ b/lib_enc/ext_sig_ana_fx.c @@ -406,18 +406,10 @@ void core_signal_analysis_high_bitrate_fx( { test(); test(); -#ifndef FIX_2411_Harmonize_TNSANALYSIS_DETECTTNSFILT - - TNSAnalysis_fx( st->hTcxCfg, L_frameTCX, - st->hTcxCfg->tcx_coded_lines, - transform_type[frameno], ( frameno == 0 ) && ( st->last_core == ACELP_CORE ), - spectrum[frameno], &hTcxEnc->tnsData[frameno], &hTcxEnc->fUseTns[frameno], NULL ); -#else TNSAnalysis_fx( st->hTcxCfg, L_frameTCX, st->hTcxCfg->tcx_coded_lines, transform_type[frameno], ( frameno == 0 ) && ( st->last_core == ACELP_CORE ), spectrum[frameno], st->hTranDet, -32768, &hTcxEnc->tnsData[frameno], &hTcxEnc->fUseTns[frameno], NULL ); -#endif // !FIX_2411_Harmonize_TNSANALYSIS_DETECTTNSFILT { EncodeTnsData_fx( st->hTcxCfg->pCurrentTnsConfig, &hTcxEnc->tnsData[frameno], @@ -1207,19 +1199,11 @@ void core_signal_analysis_high_bitrate_ivas_fx( test(); IF( ( frameno == 0 ) && ( st->last_core == ACELP_CORE ) ) { -#ifndef FIX_2411_Harmonize_TNSANALYSIS_DETECTTNSFILT - TNSAnalysis_ivas_fx( st->hTcxCfg, L_frameTCX, st->hTcxCfg->tcx_coded_lines, transform_type[frameno], 1, hTcxEnc->spectrum_fx[frameno], st->hTranDet, -32768, &hTcxEnc->tnsData[frameno], &hTcxEnc->fUseTns[frameno], NULL ); -#else TNSAnalysis_fx( st->hTcxCfg, L_frameTCX, st->hTcxCfg->tcx_coded_lines, transform_type[frameno], 1, hTcxEnc->spectrum_fx[frameno], st->hTranDet, -32768, &hTcxEnc->tnsData[frameno], &hTcxEnc->fUseTns[frameno], NULL ); -#endif // !FIX_2411_Harmonize_TNSANALYSIS_DETECTTNSFILT } ELSE { -#ifndef FIX_2411_Harmonize_TNSANALYSIS_DETECTTNSFILT - TNSAnalysis_ivas_fx( st->hTcxCfg, L_frameTCX, st->hTcxCfg->tcx_coded_lines, transform_type[frameno], 0, hTcxEnc->spectrum_fx[frameno], st->hTranDet, -32768, &hTcxEnc->tnsData[frameno], &hTcxEnc->fUseTns[frameno], NULL ); -#else TNSAnalysis_fx( st->hTcxCfg, L_frameTCX, st->hTcxCfg->tcx_coded_lines, transform_type[frameno], 0, hTcxEnc->spectrum_fx[frameno], st->hTranDet, -32768, &hTcxEnc->tnsData[frameno], &hTcxEnc->fUseTns[frameno], NULL ); -#endif // !FIX_2411_Harmonize_TNSANALYSIS_DETECTTNSFILT } IF( st->hTcxCfg->fIsTNSAllowed ) diff --git a/lib_enc/inov_enc_fx.c b/lib_enc/inov_enc_fx.c index da6719f36f1773951fdfef8e53660885eacdac18..95c7bf160630f3ba7cb69b25bdc76556759c5664 100644 --- a/lib_enc/inov_enc_fx.c +++ b/lib_enc/inov_enc_fx.c @@ -369,11 +369,7 @@ Word16 inov_encode_fx( } ELSE { -#ifdef OPT_2416_ACELP_FAST acelp_fast_fx( hBstr, nBits, dn, Qdn, cn, h2, code, y2, L_subfr ); -#else - acelp_fast_fx( hBstr, nBits, dn, Qdn, cn, Qcn, h2, code, y2, L_subfr ); -#endif } } ELSE IF( ( EQ_16( st_fx->idchan, 1 ) && LE_16( st_fx->acelp_cfg.fixed_cdk_index[idx2], 7 ) ) || ( st_fx->idchan == 0 && LE_16( st_fx->acelp_cfg.fixed_cdk_index[idx2], 3 ) ) ) @@ -384,11 +380,7 @@ Word16 inov_encode_fx( } ELSE { -#ifdef OPT_2416_ACELP_FAST acelp_fast_fx( hBstr, st_fx->acelp_cfg.fixed_cdk_index[idx2], dn, Qdn, cn, h2, code, y2, L_SUBFR ); -#else - acelp_fast_fx( hBstr, st_fx->acelp_cfg.fixed_cdk_index[idx2], dn, Qdn, cn, Qcn, h2, code, y2, L_SUBFR ); -#endif } } ELSE diff --git a/lib_enc/ivas_core_pre_proc_front_fx.c b/lib_enc/ivas_core_pre_proc_front_fx.c index 44f57cf5636030e29e642fa68406b320335e8e38..577b11c1b43451b3d327cf64593dcd96470e3427 100644 --- a/lib_enc/ivas_core_pre_proc_front_fx.c +++ b/lib_enc/ivas_core_pre_proc_front_fx.c @@ -440,22 +440,14 @@ void pre_proc_front_ivas_fx( IF( EQ_16( element_mode, IVAS_SCE ) ) { -#ifndef FIX_2410_HARM_MODIF_FS - new_inp_out_size = modify_Fs_ivas_fx( signal_in_fx, input_frame, input_Fs, new_inp_12k8_fx, INT_FS_12k8, st->mem_decim_fx_q_inp, ( st->max_bwidth == NB ), &Q_new_inp, &mem_decim_size ); /* st->q_inp */ -#else - new_inp_out_size = modify_Fs_fx( signal_in_fx, input_frame, input_Fs, new_inp_12k8_fx, INT_FS_12k8, st->mem_decim_fx_q_inp, ( st->max_bwidth == NB ), &Q_new_inp, &mem_decim_size ); /* st->q_inp */ -#endif - Scale_sig( new_inp_12k8_fx, new_inp_out_size, negate( Q_new_inp ) ); /* scaling back to st->q_inp*/ + new_inp_out_size = modify_Fs_fx( signal_in_fx, input_frame, input_Fs, new_inp_12k8_fx, INT_FS_12k8, st->mem_decim_fx_q_inp, ( st->max_bwidth == NB ), &Q_new_inp, &mem_decim_size ); /* st->q_inp */ + Scale_sig( new_inp_12k8_fx, new_inp_out_size, negate( Q_new_inp ) ); /* scaling back to st->q_inp*/ st->mem_q = st->q_inp; move16(); Copy( st->mem_decim_fx_q_inp, mem_decim_dummy_fx, 2 * L_FILT_MAX ); /* Q(-1) */ set16_fx( temp1F_icatdmResampBuf_fx, 0, L_FILT_MAX ); -#ifndef FIX_2410_HARM_MODIF_FS - new_inp_out_size = modify_Fs_ivas_fx( temp1F_icatdmResampBuf_fx, NS2SA_FX2( input_Fs, DELAY_FIR_RESAMPL_NS ), input_Fs, new_inp_12k8_fx + L_FRAME, INT_FS_12k8, mem_decim_dummy_fx, 0, &Q_new_inp, &mem_decim_size ); /* st->q_inp */ -#else - new_inp_out_size = modify_Fs_fx( temp1F_icatdmResampBuf_fx, NS2SA_FX2( input_Fs, DELAY_FIR_RESAMPL_NS ), input_Fs, new_inp_12k8_fx + L_FRAME, INT_FS_12k8, mem_decim_dummy_fx, 0, &Q_new_inp, &mem_decim_size ); /* st->q_inp */ -#endif - Scale_sig( new_inp_12k8_fx + L_FRAME, new_inp_out_size, negate( Q_new_inp ) ); /* scaling back to st->q_inp*/ + new_inp_out_size = modify_Fs_fx( temp1F_icatdmResampBuf_fx, NS2SA_FX2( input_Fs, DELAY_FIR_RESAMPL_NS ), input_Fs, new_inp_12k8_fx + L_FRAME, INT_FS_12k8, mem_decim_dummy_fx, 0, &Q_new_inp, &mem_decim_size ); /* st->q_inp */ + Scale_sig( new_inp_12k8_fx + L_FRAME, new_inp_out_size, negate( Q_new_inp ) ); /* scaling back to st->q_inp*/ } ELSE IF( EQ_16( element_mode, IVAS_CPE_TD ) || EQ_16( element_mode, IVAS_CPE_MDCT ) ) { @@ -466,19 +458,11 @@ void pre_proc_front_ivas_fx( Word16 length_inp = NS2SA_FX2( input_Fs, L_MEM_RECALC_SCH_NS ); Word16 length_12k8 = NS2SA( INT_FS_12k8, L_MEM_RECALC_SCH_NS ); -#ifndef FIX_2410_HARM_MODIF_FS - new_inp_out_size = modify_Fs_ivas_fx( signal_in_fx - lMemRecalc - length_inp, length_inp, input_Fs, new_inp_12k8_fx - lMemRecalc_12k8 - length_12k8, INT_FS_12k8, st->mem_decim_fx_q_inp, 0, &Q_new_inp, &mem_decim_size ); /* st->q_inp */ -#else - new_inp_out_size = modify_Fs_fx( signal_in_fx - lMemRecalc - length_inp, length_inp, input_Fs, new_inp_12k8_fx - lMemRecalc_12k8 - length_12k8, INT_FS_12k8, st->mem_decim_fx_q_inp, 0, &Q_new_inp, &mem_decim_size ); /* st->q_inp */ -#endif - Scale_sig( new_inp_12k8_fx - lMemRecalc_12k8 - length_12k8, new_inp_out_size, negate( Q_new_inp ) ); /* scaling back to st->q_inp*/ + new_inp_out_size = modify_Fs_fx( signal_in_fx - lMemRecalc - length_inp, length_inp, input_Fs, new_inp_12k8_fx - lMemRecalc_12k8 - length_12k8, INT_FS_12k8, st->mem_decim_fx_q_inp, 0, &Q_new_inp, &mem_decim_size ); /* st->q_inp */ + Scale_sig( new_inp_12k8_fx - lMemRecalc_12k8 - length_12k8, new_inp_out_size, negate( Q_new_inp ) ); /* scaling back to st->q_inp*/ } -#ifndef FIX_2410_HARM_MODIF_FS - new_inp_out_size = modify_Fs_ivas_fx( signal_in_fx - lMemRecalc, input_frame, input_Fs, new_inp_12k8_fx - lMemRecalc_12k8, INT_FS_12k8, st->mem_decim_fx_q_inp, ( st->max_bwidth == NB ), &Q_new_inp, &mem_decim_size ); /* st->q_inp */ -#else - new_inp_out_size = modify_Fs_fx( signal_in_fx - lMemRecalc, input_frame, input_Fs, new_inp_12k8_fx - lMemRecalc_12k8, INT_FS_12k8, st->mem_decim_fx_q_inp, ( st->max_bwidth == NB ), &Q_new_inp, &mem_decim_size ); /* st->q_inp */ -#endif + new_inp_out_size = modify_Fs_fx( signal_in_fx - lMemRecalc, input_frame, input_Fs, new_inp_12k8_fx - lMemRecalc_12k8, INT_FS_12k8, st->mem_decim_fx_q_inp, ( st->max_bwidth == NB ), &Q_new_inp, &mem_decim_size ); /* st->q_inp */ st->mem_q = st->q_inp; move16(); Copy( st->mem_decim_fx_q_inp, mem_decim_dummy_fx, 2 * L_FILT_MAX ); /* st->q_inp */ @@ -486,20 +470,12 @@ void pre_proc_front_ivas_fx( IF( lMemRecalc > 0 ) { -#ifndef FIX_2410_HARM_MODIF_FS - new_inp_out_size = modify_Fs_ivas_fx( signal_in_fx + sub( input_frame, lMemRecalc ), lMemRecalc, input_Fs, new_inp_12k8_fx + sub( L_FRAME, lMemRecalc_12k8 ), INT_FS_12k8, mem_decim_dummy_fx, ( st->max_bwidth == NB ), &Q_new_inp, &mem_decim_size ); /* st->q_inp */ -#else new_inp_out_size = modify_Fs_fx( signal_in_fx + sub( input_frame, lMemRecalc ), lMemRecalc, input_Fs, new_inp_12k8_fx + sub( L_FRAME, lMemRecalc_12k8 ), INT_FS_12k8, mem_decim_dummy_fx, ( st->max_bwidth == NB ), &Q_new_inp, &mem_decim_size ); /* st->q_inp */ -#endif - Scale_sig( new_inp_12k8_fx + L_FRAME - lMemRecalc_12k8, new_inp_out_size, negate( Q_new_inp ) ); /* scaling back to st->q_inp*/ + Scale_sig( new_inp_12k8_fx + L_FRAME - lMemRecalc_12k8, new_inp_out_size, negate( Q_new_inp ) ); /* scaling back to st->q_inp*/ } set16_fx( temp1F_icatdmResampBuf_fx, 0, L_FILT_MAX ); -#ifndef FIX_2410_HARM_MODIF_FS - new_inp_out_size = modify_Fs_ivas_fx( temp1F_icatdmResampBuf_fx, NS2SA_FX2( input_Fs, DELAY_FIR_RESAMPL_NS ), input_Fs, new_inp_12k8_fx + L_FRAME, INT_FS_12k8, mem_decim_dummy_fx, 0, &Q_new_inp, &mem_decim_size ); /* st->q_inp */ -#else - new_inp_out_size = modify_Fs_fx( temp1F_icatdmResampBuf_fx, NS2SA_FX2( input_Fs, DELAY_FIR_RESAMPL_NS ), input_Fs, new_inp_12k8_fx + L_FRAME, INT_FS_12k8, mem_decim_dummy_fx, 0, &Q_new_inp, &mem_decim_size ); /* st->q_inp */ -#endif - Scale_sig( new_inp_12k8_fx + L_FRAME, new_inp_out_size, negate( Q_new_inp ) ); /* scaling back to st->q_inp*/ + new_inp_out_size = modify_Fs_fx( temp1F_icatdmResampBuf_fx, NS2SA_FX2( input_Fs, DELAY_FIR_RESAMPL_NS ), input_Fs, new_inp_12k8_fx + L_FRAME, INT_FS_12k8, mem_decim_dummy_fx, 0, &Q_new_inp, &mem_decim_size ); /* st->q_inp */ + Scale_sig( new_inp_12k8_fx + L_FRAME, new_inp_out_size, negate( Q_new_inp ) ); /* scaling back to st->q_inp*/ } ELSE /* DFT stereo */ { diff --git a/lib_enc/ivas_core_pre_proc_fx.c b/lib_enc/ivas_core_pre_proc_fx.c index 9134f304d468ebe8463f19727c0195d3474d3993..fce2b3e92038ddade3188f3225051906021a097d 100644 --- a/lib_enc/ivas_core_pre_proc_fx.c +++ b/lib_enc/ivas_core_pre_proc_fx.c @@ -789,21 +789,13 @@ void ivas_compute_core_buffers_fx( } ELSE IF( EQ_32( input_Fs, 32000 ) || EQ_32( input_Fs, 48000 ) ) { -#ifndef FIX_2410_HARM_MODIF_FS - size_modified = modify_Fs_ivas_fx( signal_in_fx, input_frame, input_Fs, new_inp_16k_fx, sr_core, st->mem_decim16k_fx, 0, &Q_tmp, &mem_decim16k_size ); /* Q0 */ -#else - size_modified = modify_Fs_fx( signal_in_fx, input_frame, input_Fs, new_inp_16k_fx, sr_core, st->mem_decim16k_fx, 0, &Q_tmp, &mem_decim16k_size ); /* Q0 */ -#endif - Scale_sig( new_inp_16k_fx, size_modified, negate( Q_tmp ) ); /* scaling back to Q_old_inp_16k */ + size_modified = modify_Fs_fx( signal_in_fx, input_frame, input_Fs, new_inp_16k_fx, sr_core, st->mem_decim16k_fx, 0, &Q_tmp, &mem_decim16k_size ); /* Q0 */ + Scale_sig( new_inp_16k_fx, size_modified, negate( Q_tmp ) ); /* scaling back to Q_old_inp_16k */ Copy( st->mem_decim16k_fx, mem_decim16k_dummy_fx, 2 * L_FILT_MAX ); /* Q(-1) */ set16_fx( temp1F_icatdmResampBuf_fx, 0, L_FILT_MAX ); -#ifndef FIX_2410_HARM_MODIF_FS - size_modified = modify_Fs_ivas_fx( temp1F_icatdmResampBuf_fx, NS2SA_FX2( input_Fs, DELAY_FIR_RESAMPL_NS ), input_Fs, new_inp_16k_fx + NS2SA_FX2( sr_core, FRAME_SIZE_NS ), sr_core, mem_decim16k_dummy_fx, 0, &Q_tmp, &mem_decim16k_size ); /* Q0 */ -#else - size_modified = modify_Fs_fx( temp1F_icatdmResampBuf_fx, NS2SA_FX2( input_Fs, DELAY_FIR_RESAMPL_NS ), input_Fs, new_inp_16k_fx + NS2SA_FX2( sr_core, FRAME_SIZE_NS ), sr_core, mem_decim16k_dummy_fx, 0, &Q_tmp, &mem_decim16k_size ); /* Q0 */ -#endif - Scale_sig( new_inp_16k_fx + NS2SA_FX2( sr_core, FRAME_SIZE_NS ), size_modified, negate( Q_tmp ) ); /* scaling back to Q_old_inp_16k */ + size_modified = modify_Fs_fx( temp1F_icatdmResampBuf_fx, NS2SA_FX2( input_Fs, DELAY_FIR_RESAMPL_NS ), input_Fs, new_inp_16k_fx + NS2SA_FX2( sr_core, FRAME_SIZE_NS ), sr_core, mem_decim16k_dummy_fx, 0, &Q_tmp, &mem_decim16k_size ); /* Q0 */ + Scale_sig( new_inp_16k_fx + NS2SA_FX2( sr_core, FRAME_SIZE_NS ), size_modified, negate( Q_tmp ) ); /* scaling back to Q_old_inp_16k */ } } ELSE IF( EQ_16( element_mode, IVAS_CPE_TD ) ) @@ -828,40 +820,24 @@ void ivas_compute_core_buffers_fx( Word16 length_16k = NS2SA_FX2( INT_FS_16k, L_MEM_RECALC_SCH_NS - DELAY_FIR_RESAMPL_NS ); move16(); - Copy( signal_in_fx - lMemRecalc - length_inp - 2 * NS2SA_FX2( input_Fs, DELAY_FIR_RESAMPL_NS ), st->mem_decim16k_fx, 2 * NS2SA_FX2( input_Fs, DELAY_FIR_RESAMPL_NS ) ); /* st->q_inp */ -#ifndef FIX_2410_HARM_MODIF_FS - size_modified = modify_Fs_ivas_fx( signal_in_fx - lMemRecalc - length_inp, length_inp, input_Fs, new_inp_16k_fx - lMemRecalc_16k - length_16k, sr_core, st->mem_decim16k_fx, 0, &Q_tmp, &mem_decim16k_size ); /* Q0 */ -#else - size_modified = modify_Fs_fx( signal_in_fx - lMemRecalc - length_inp, length_inp, input_Fs, new_inp_16k_fx - lMemRecalc_16k - length_16k, sr_core, st->mem_decim16k_fx, 0, &Q_tmp, &mem_decim16k_size ); /* Q0 */ -#endif - Scale_sig( new_inp_16k_fx - lMemRecalc_16k - length_16k, size_modified, negate( Q_tmp ) ); /* scaling back to Q_old_inp_16k */ + Copy( signal_in_fx - lMemRecalc - length_inp - 2 * NS2SA_FX2( input_Fs, DELAY_FIR_RESAMPL_NS ), st->mem_decim16k_fx, 2 * NS2SA_FX2( input_Fs, DELAY_FIR_RESAMPL_NS ) ); /* st->q_inp */ + size_modified = modify_Fs_fx( signal_in_fx - lMemRecalc - length_inp, length_inp, input_Fs, new_inp_16k_fx - lMemRecalc_16k - length_16k, sr_core, st->mem_decim16k_fx, 0, &Q_tmp, &mem_decim16k_size ); /* Q0 */ + Scale_sig( new_inp_16k_fx - lMemRecalc_16k - length_16k, size_modified, negate( Q_tmp ) ); /* scaling back to Q_old_inp_16k */ } -#ifndef FIX_2410_HARM_MODIF_FS - size_modified = modify_Fs_ivas_fx( signal_in_fx - lMemRecalc, input_frame, input_Fs, new_inp_16k_fx - lMemRecalc_16k, sr_core, st->mem_decim16k_fx, 0, &Q_tmp, &mem_decim16k_size ); /* Q0 */ -#else - size_modified = modify_Fs_fx( signal_in_fx - lMemRecalc, input_frame, input_Fs, new_inp_16k_fx - lMemRecalc_16k, sr_core, st->mem_decim16k_fx, 0, &Q_tmp, &mem_decim16k_size ); /* Q0 */ -#endif - Scale_sig( new_inp_16k_fx - lMemRecalc_16k, size_modified, negate( Q_tmp ) ); /* scaling back to Q_old_inp_16k */ + size_modified = modify_Fs_fx( signal_in_fx - lMemRecalc, input_frame, input_Fs, new_inp_16k_fx - lMemRecalc_16k, sr_core, st->mem_decim16k_fx, 0, &Q_tmp, &mem_decim16k_size ); /* Q0 */ + Scale_sig( new_inp_16k_fx - lMemRecalc_16k, size_modified, negate( Q_tmp ) ); /* scaling back to Q_old_inp_16k */ Copy( st->mem_decim16k_fx, mem_decim16k_dummy_fx, 2 * L_FILT_MAX ); IF( lMemRecalc > 0 ) { -#ifndef FIX_2410_HARM_MODIF_FS - size_modified = modify_Fs_ivas_fx( signal_in_fx - lMemRecalc + input_frame, lMemRecalc, input_Fs, new_inp_16k_fx + NS2SA_FX2( sr_core, FRAME_SIZE_NS ) - lMemRecalc_16k, sr_core, mem_decim16k_dummy_fx, 0, &Q_tmp, &mem_decim16k_size ); /* Q0 */ -#else size_modified = modify_Fs_fx( signal_in_fx - lMemRecalc + input_frame, lMemRecalc, input_Fs, new_inp_16k_fx + NS2SA_FX2( sr_core, FRAME_SIZE_NS ) - lMemRecalc_16k, sr_core, mem_decim16k_dummy_fx, 0, &Q_tmp, &mem_decim16k_size ); /* Q0 */ -#endif - Scale_sig( new_inp_16k_fx + NS2SA_FX2( sr_core, FRAME_SIZE_NS ) - lMemRecalc_16k, size_modified, negate( Q_tmp ) ); /* scaling back to Q_old_inp_16k */ + Scale_sig( new_inp_16k_fx + NS2SA_FX2( sr_core, FRAME_SIZE_NS ) - lMemRecalc_16k, size_modified, negate( Q_tmp ) ); /* scaling back to Q_old_inp_16k */ } set16_fx( temp1F_icatdmResampBuf_fx, 0, L_FILT_MAX ); -#ifndef FIX_2410_HARM_MODIF_FS - size_modified = modify_Fs_ivas_fx( temp1F_icatdmResampBuf_fx, NS2SA_FX2( input_Fs, DELAY_FIR_RESAMPL_NS ), input_Fs, new_inp_16k_fx + NS2SA_FX2( sr_core, FRAME_SIZE_NS ), sr_core, mem_decim16k_dummy_fx, 0, &Q_tmp, &mem_decim16k_size ); /* Q0 */ -#else - size_modified = modify_Fs_fx( temp1F_icatdmResampBuf_fx, NS2SA_FX2( input_Fs, DELAY_FIR_RESAMPL_NS ), input_Fs, new_inp_16k_fx + NS2SA_FX2( sr_core, FRAME_SIZE_NS ), sr_core, mem_decim16k_dummy_fx, 0, &Q_tmp, &mem_decim16k_size ); /* Q0 */ -#endif - Scale_sig( new_inp_16k_fx + NS2SA_FX2( sr_core, FRAME_SIZE_NS ), size_modified, negate( Q_tmp ) ); /* scaling back to Q_old_inp_16k */ + size_modified = modify_Fs_fx( temp1F_icatdmResampBuf_fx, NS2SA_FX2( input_Fs, DELAY_FIR_RESAMPL_NS ), input_Fs, new_inp_16k_fx + NS2SA_FX2( sr_core, FRAME_SIZE_NS ), sr_core, mem_decim16k_dummy_fx, 0, &Q_tmp, &mem_decim16k_size ); /* Q0 */ + Scale_sig( new_inp_16k_fx + NS2SA_FX2( sr_core, FRAME_SIZE_NS ), size_modified, negate( Q_tmp ) ); /* scaling back to Q_old_inp_16k */ } } ELSE IF( st->idchan == 0 ) diff --git a/lib_enc/ivas_front_vad_fx.c b/lib_enc/ivas_front_vad_fx.c index 5980d77f04edd60a79c74223a0531c88133cc5a7..28498c891a8830bb6a6f73d3443f9f4758c10401 100644 --- a/lib_enc/ivas_front_vad_fx.c +++ b/lib_enc/ivas_front_vad_fx.c @@ -224,11 +224,7 @@ ivas_error front_vad_fx( Copy( hFrontVad->buffer_12k8_fx + L_FFT, hFrontVad->buffer_12k8_fx, L_FFT / 2 ); /* Resample to 12k8 */ -#ifndef FIX_2410_HARM_MODIF_FS - modify_Fs_ivas_fx( sts[n]->input_fx, input_frame, sts[0]->input_Fs, hFrontVad->buffer_12k8_fx + L_FFT / 2, INT_FS_12k8, hFrontVad->mem_decim_fx, ( sts[0]->max_bwidth == NB ), &Qband, &mem_decim_size ); -#else modify_Fs_fx( sts[n]->input_fx, input_frame, sts[0]->input_Fs, hFrontVad->buffer_12k8_fx + L_FFT / 2, INT_FS_12k8, hFrontVad->mem_decim_fx, ( sts[0]->max_bwidth == NB ), &Qband, &mem_decim_size ); -#endif /* Preemphasis */ hFrontVad->mem_preemph_fx = shl( hFrontVad->mem_preemph_fx, sub( add( Q_inp, Qband ), hFrontVad->q_mem_preemph_fx ) ); /* Q_inp + Qband */ diff --git a/lib_enc/ivas_qmetadata_enc_fx.c b/lib_enc/ivas_qmetadata_enc_fx.c index 48d0aebc23cfb719447be93ab7ef2e7314c58309..2d96066366245984b287673dbaec0fe3a29b5c93 100644 --- a/lib_enc/ivas_qmetadata_enc_fx.c +++ b/lib_enc/ivas_qmetadata_enc_fx.c @@ -2096,12 +2096,10 @@ static Word16 GR_bits_azimuth_context_fx( Word16 no_symb_local[MAX_PARAM_SPATIAL_SUBFRAMES]; Word16 no_data = 0; move16(); -#ifdef FIX_FLOAT_1522_LTV_MSAN_QMETADATA_ENC_EC3 *real_GR_ord = GR_order; /* Init to avoid sanitizer warnings */ move16(); -#endif FOR( i = 0; i < no_data_in; i++ ) { IF( LT_32( data_in[i], MASA_NO_INDEX ) ) diff --git a/lib_enc/ivas_stereo_icbwe_enc_fx.c b/lib_enc/ivas_stereo_icbwe_enc_fx.c index aa80d7330202a1e9806025f12a09c1708c04748e..1127364e3b8185a5ca340d037f51d15aa89a024f 100644 --- a/lib_enc/ivas_stereo_icbwe_enc_fx.c +++ b/lib_enc/ivas_stereo_icbwe_enc_fx.c @@ -1410,11 +1410,7 @@ void stereo_icBWE_preproc_fx( Scale_sig( temp_inp_fx, L_FRAME48k, sub( 0, hStereoICBWE->q_dataChan_fx ) ); /* q_dataChan_fx */ /* IVAS-219: Re-wire the shb nonref estimation through a lite CLDFB */ -#ifndef FIX_2410_HARM_MODIF_FS - modify_Fs_ivas_fx( temp_inp_fx, L_FRAME32k, 32000, tempSHB_fx, 16000, hStereoICBWE->mem_decim_shb_ch0_fx, 0, &Q_new_inp, &mem_decim_size ); -#else modify_Fs_fx( temp_inp_fx, L_FRAME32k, 32000, tempSHB_fx, 16000, hStereoICBWE->mem_decim_shb_ch0_fx, 0, &Q_new_inp, &mem_decim_size ); -#endif Copy_Scale_sig( tempSHB_fx, shb_speech_nonref_fx, L_FRAME16k, sub( q_shb_speech_nonref_fx, Q_new_inp ) ); /* q_shb_speech_nonref_fx */ return; diff --git a/lib_enc/pre_proc_fx.c b/lib_enc/pre_proc_fx.c index f29d734ffd431a5f9a06cd9fe671a236ac332542..671fb4615bb24e71d4c6c7284c7b1e4f5ddabb1d 100644 --- a/lib_enc/pre_proc_fx.c +++ b/lib_enc/pre_proc_fx.c @@ -205,11 +205,7 @@ void pre_proc_fx( * Change the sampling frequency to 12.8 kHz *----------------------------------------------------------------*/ -#ifndef FIX_2410_HARM_MODIF_FS - 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 ) ) ); -#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 ); @@ -1019,11 +1015,7 @@ void pre_proc_fx( } ELSE IF( EQ_32( st->input_Fs, 32000 ) || EQ_32( st->input_Fs, 48000 ) ) { -#ifndef FIX_2410_HARM_MODIF_FS - modify_Fs_fx( signal_in, input_frame, st->input_Fs, new_inp_16k, sr_core_tmp, st->mem_decim16k_fx, 0 ); -#else modify_Fs_fx( signal_in, input_frame, st->input_Fs, new_inp_16k, sr_core_tmp, st->mem_decim16k_fx, 0, NULL, NULL ); -#endif } ELSE /* keep memories up-to-date in case of bitrate switching */ { diff --git a/lib_enc/prot_fx_enc.h b/lib_enc/prot_fx_enc.h index b107e838d87204b77ef576721eccd44b35a48ece..619068099dc15b32252807cd3fefe563ae533b2c 100644 --- a/lib_enc/prot_fx_enc.h +++ b/lib_enc/prot_fx_enc.h @@ -1463,20 +1463,8 @@ void CalculateTnsFilt_fx( const Word16 pSpectrum_e, STnsData *pTnsData /* o : TNS data struct */ ); -#ifndef FIX_2411_Harmonize_TNSANALYSIS_DETECTTNSFILT Word16 DetectTnsFilt_fx( - STnsConfig const *pTnsConfig, - Word32 const pSpectrum[], - STnsData *pTnsData, - Word16 *predictionGain ); -#endif // !FIX_2411_Harmonize_TNSANALYSIS_DETECTTNSFILT -#ifdef FIX_2411_Harmonize_TNSANALYSIS_DETECTTNSFILT - -Word16 DetectTnsFilt_fx( -#else -Word16 DetectTnsFilt_ivas_fx( -#endif // !FIX_2411_Harmonize_TNSANALYSIS_DETECTTNSFILT STnsConfig const *pTnsConfig, /* i : TNS Configuration struct */ Word32 const pSpectrum[], /* i : MDCT spectrum Q=Qx */ STnsData *pTnsData, /* o : TNS data struct */ @@ -2676,25 +2664,8 @@ void IGFEncResetTCX10BitCounter_fx( const IGF_ENC_INSTANCE_HANDLE hInstance /**< in: | instance handle of IGF Encoder */ ); -#ifndef FIX_2411_Harmonize_TNSANALYSIS_DETECTTNSFILT -void TNSAnalysis_fx( - TCX_CONFIG_HANDLE hTcxCfg, /* i : configuration of TCX */ - Word16 L_frame, /* i : frame length */ - Word16 L_spec, - Word16 tcxMode, /* i : TCX mode for the frame/subframe - TCX20 | TCX10 | TCX 5 (meaning 2 x TCX 5) */ - Word8 isAfterACELP, /* i : Flag indicating if the last frame was ACELP. For the second TCX subframe it should be 0 */ - Word32 spectrum[], /* i : MDCT spectrum */ - STnsData *pTnsData, /* o : Tns data */ - Word8 *pfUseTns, /* o : Flag indicating if TNS is used */ - Word16 *predictionGain ); - -#endif // !FIX_2411_Harmonize_TNSANALYSIS_DETECTTNSFILT -#ifndef FIX_2411_Harmonize_TNSANALYSIS_DETECTTNSFILT -void TNSAnalysis_ivas_fx( -#else void TNSAnalysis_fx( -#endif // !FIX_2411_Harmonize_TNSANALYSIS_DETECTTNSFILT TCX_CONFIG_HANDLE hTcxCfg, /* i : configuration of TCX */ Word16 L_frame, /* i : frame length */ Word16 L_spec, /* i : length of the spectrum */ @@ -4127,13 +4098,6 @@ void rc_enc_finish_fx( PVQ_ENC_HANDLE hPVQ /* i/o: PVQ encoder handle */ ); -#ifndef FIX_2425_REMOVE_RC_DUPLICATES -void rc_enc_finish_ivas_fx( - BSTR_ENC_HANDLE hBstr, - PVQ_ENC_HANDLE hPVQ /* i/o: PVQ encoder handle */ - -); -#endif void rc_encode_fx( BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ PVQ_ENC_HANDLE hPVQ, /* i/o: PVQ encoder handle */ @@ -4142,22 +4106,6 @@ void rc_encode_fx( UWord32 tot /* i : Total cumulative frequency Q0*/ ); -#ifndef FIX_2425_REMOVE_RC_DUPLICATES -void rc_encode_ivas_fx( - BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ - PVQ_ENC_HANDLE hPVQ, /* i/o: PVQ encoder handle */ - UWord32 cum_freq, /* i : Cumulative frequency up to symbol Q0*/ - UWord32 sym_freq, /* i : Symbol probability Q0*/ - UWord32 tot /* i : Total cumulative frequency Q0*/ -); - -void rc_enc_uniform_ivas_fx( - BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ - PVQ_ENC_HANDLE hPVQ, /* i/o: PVQ encoder handle */ - UWord32 value, /* i : Value to encode Q0*/ - UWord32 tot /* i : Maximum value Q0*/ -); -#endif void rc_enc_uniform_fx( BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ PVQ_ENC_HANDLE hPVQ, /* i/o: PVQ encoder handle */ @@ -4172,14 +4120,6 @@ void rc_enc_bits_fx( Word16 bits /* i : Number of bits used Q0*/ ); -#ifndef FIX_2425_REMOVE_RC_DUPLICATES -void rc_enc_bits_ivas_fx( - BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ - PVQ_ENC_HANDLE hPVQ, /* i/o: PVQ encoder handle */ - UWord32 value, /* i : Value to encode Q0*/ - Word16 bits /* i : Number of bits used Q0*/ -); -#endif void re8_compute_base_index_fx( const Word16 *x, /* i : Elemen of Q2, Q3 or Q4 */ const Word16 ka, /* i : Identifier of the absolute leader related to x */ diff --git a/lib_enc/pvq_core_enc_fx.c b/lib_enc/pvq_core_enc_fx.c index 67e9adb29d055c27174475b4156390b22d0dd0e8..5ce698f464879f0e0dbd48765f24adae089c2207 100644 --- a/lib_enc/pvq_core_enc_fx.c +++ b/lib_enc/pvq_core_enc_fx.c @@ -351,11 +351,7 @@ void pvq_encode_frame_ivas_fx( } } -#ifdef FIX_2425_REMOVE_RC_DUPLICATES rc_enc_finish_fx( hBstr, hPVQ ); -#else - rc_enc_finish_ivas_fx( hBstr, hPVQ ); -#endif return; } @@ -981,11 +977,7 @@ static void densityIndexSymbolEncode_ivas_fx( } } -#ifdef FIX_2425_REMOVE_RC_DUPLICATES rc_encode_fx( hBstr, hPVQ, cum_freq, sym_freq, tot ); -#else - rc_encode_ivas_fx( hBstr, hPVQ, cum_freq, sym_freq, tot ); -#endif } return; @@ -1154,11 +1146,7 @@ static Word16 calc_pvq_splits_ivas_fx( /* o : Number of tmp = 1; move16(); } -#ifdef FIX_2425_REMOVE_RC_DUPLICATES rc_enc_bits_fx( hBstr, hPVQ, tmp, 1 ); -#else - rc_enc_bits_ivas_fx( hBstr, hPVQ, tmp, 1 ); -#endif Np = add( Np, tmp ); } } diff --git a/lib_enc/pvq_encode_fx.c b/lib_enc/pvq_encode_fx.c index d96f4943970cf185409c09d51772edfa7b8d79dd..8db3fc5b4ea8d25bfd323e0e36e0b6598a922c13 100644 --- a/lib_enc/pvq_encode_fx.c +++ b/lib_enc/pvq_encode_fx.c @@ -365,19 +365,11 @@ void pvq_encode_ivas_fx( entry = mpvq_encode_vec_fx( y, dim, pulses ); /* send the short codeword(s) to the range encoder */ -#ifdef FIX_2425_REMOVE_RC_DUPLICATES rc_enc_bits_fx( hBstr, hPVQ, UL_deposit_l( entry.lead_sign_ind ), 1 ); /* 0 or 1 */ -#else - rc_enc_bits_ivas_fx( hBstr, hPVQ, UL_deposit_l( entry.lead_sign_ind ), 1 ); /* 0 or 1 */ -#endif IF( NE_16( dim, 1 ) ) { -#ifdef FIX_2425_REMOVE_RC_DUPLICATES rc_enc_uniform_fx( hBstr, hPVQ, entry.index, entry.size ); -#else - rc_enc_uniform_ivas_fx( hBstr, hPVQ, entry.index, entry.size ); -#endif } return; diff --git a/lib_enc/range_enc_fx.c b/lib_enc/range_enc_fx.c index 52886cd55f725c5eba50e8dc0b9ddab98d4c5628..b039f49289eeac967bb5301333d72518e647c2a5 100644 --- a/lib_enc/range_enc_fx.c +++ b/lib_enc/range_enc_fx.c @@ -17,10 +17,6 @@ static void rc_enc_shift_fx( BSTR_ENC_HANDLE hBstr, PVQ_ENC_HANDLE hPVQ ); static void rc_enc_write_fx( BSTR_ENC_HANDLE hBstr, Word16 byte, Word16 bits ); -#ifndef FIX_2425_REMOVE_RC_DUPLICATES -static void rc_enc_shift_ivas_fx( BSTR_ENC_HANDLE hBstr, PVQ_ENC_HANDLE hPVQ ); -static void rc_enc_write_ivas_fx( BSTR_ENC_HANDLE hBstr, Word16 byte, Word16 bits ); -#endif /*-------------------------------------------------------------------* * rc_enc_init() @@ -57,46 +53,6 @@ void rc_enc_init_fx( * * Encode symbol with range coder *-------------------------------------------------------------------*/ -#ifndef FIX_2425_REMOVE_RC_DUPLICATES -void rc_encode_ivas_fx( - BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ - PVQ_ENC_HANDLE hPVQ, /* i/o: PVQ encoder handle */ - UWord32 cum_freq, /* i : Cumulative frequency up to symbol Q0*/ - UWord32 sym_freq, /* i : Symbol probability Q0*/ - UWord32 tot /* i : Total cumulative frequency Q0*/ -) -{ - UWord32 r, tmp, inv_tot, lsb; - Word16 exp; - UWord16 carry; - - inv_tot = UL_inverse( tot, &exp ); // Q0 - Mpy_32_32_uu( hPVQ->rc_range, inv_tot, &tmp, &lsb ); /*0+exp-32 */ - r = UL_lshr( tmp, sub( exp, 32 ) ); /* exp-32-exp3+32 = 0 */ - tmp = UL_Mpy_32_32( r, cum_freq ); - - hPVQ->rc_low = UL_addNs( hPVQ->rc_low, tmp, &carry ); // Q0 - move32(); - if ( carry != 0 ) - { - hPVQ->rc_carry = carry; // Q0 - move16(); - } - - hPVQ->rc_range = UL_Mpy_32_32( r, sym_freq ); // Q0 - move32(); - WHILE( LT_64( hPVQ->rc_range, 1 << 24 ) ) - { - hPVQ->rc_range = UL_lshl( hPVQ->rc_range, 8 ); // Q0 - move32(); - hPVQ->rc_num_bits = add( hPVQ->rc_num_bits, 8 ); // Q0 - move16(); - rc_enc_shift_ivas_fx( hBstr, hPVQ ); - } - - return; -} -#endif void rc_encode_fx( BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ @@ -141,91 +97,6 @@ void rc_encode_fx( * Finalize range coder *-------------------------------------------------------------------*/ -#ifndef FIX_2425_REMOVE_RC_DUPLICATES -void rc_enc_finish_ivas_fx( - BSTR_ENC_HANDLE hBstr, - PVQ_ENC_HANDLE hPVQ /* i/o: PVQ encoder handle */ -) -{ - UWord32 val, mask, high; - Word16 bits; - UWord16 over1, over2; - - bits = add( norm_ul( hPVQ->rc_range ), 1 ); - mask = UL_lshr( 0xffffffff, bits ); - - val = UL_addNs( hPVQ->rc_low, mask, &over1 ); // Q0 - high = UL_addNs( hPVQ->rc_low, hPVQ->rc_range, &over2 ); // Q0 - - val = L_and( val, ~mask ); - L_xor( 0, 0 ); /* For bit not */ - - IF( ( L_xor( over1, over2 ) ) == 0 ) - { - L_sub( 0, 0 ); /* For comparision in if */ - IF( UL_addNsD( val, mask ) >= high ) - { - bits = add( bits, 1 ); // Q0 - mask = UL_lshr( mask, 1 ); // Q0 - val = UL_and( UL_addNsD( hPVQ->rc_low, mask ), ~mask ); // Q0 - L_xor( 0, 0 ); /* For bit not */ - } - - if ( LT_64( val, hPVQ->rc_low ) ) - { - hPVQ->rc_carry = 1; - move16(); - } - } - - hPVQ->rc_low = val; - move32(); - - IF( GT_16( bits, sub( hPVQ->rc_tot_bits, hPVQ->rc_num_bits ) ) ) - { - bits = sub( hPVQ->rc_tot_bits, hPVQ->rc_num_bits ); // Q0 - } - - hPVQ->rc_num_bits = add( hPVQ->rc_num_bits, bits ); // Q0 - move16(); - FOR( ; bits > 0; bits -= 8 ) - { - rc_enc_shift_ivas_fx( hBstr, hPVQ ); - } - bits = add( bits, 8 ); - - IF( hPVQ->rc_carry_count > 0 ) - { - rc_enc_write_ivas_fx( hBstr, add( hPVQ->rc_cache, hPVQ->rc_carry ), 8 ); - - FOR( ; hPVQ->rc_carry_count > 1; hPVQ->rc_carry_count-- ) - { - rc_enc_write_ivas_fx( hBstr, add( hPVQ->rc_carry, 0xff ), 8 ); - } - rc_enc_write_ivas_fx( hBstr, s_and( add( hPVQ->rc_carry, 0xff ), sub( lshl( 1, bits ), 1 ) ), bits ); - } - ELSE - { - rc_enc_write_ivas_fx( hBstr, lshr( add( hPVQ->rc_cache, hPVQ->rc_carry ), sub( 8, bits ) ), bits ); - } - - bits = hPVQ->rc_num_bits; // Q0 - move16(); - WHILE( LT_16( bits, sub( hPVQ->rc_tot_bits, 16 ) ) ) - { - rc_enc_write_ivas_fx( hBstr, 0, 16 ); - bits = add( bits, 16 ); - } - - bits = sub( hPVQ->rc_tot_bits, bits ); // Q0 - IF( bits > 0 ) - { - rc_enc_write_ivas_fx( hBstr, 0, bits ); - } - - return; -} -#endif void rc_enc_finish_fx( BSTR_ENC_HANDLE hBstr, @@ -316,42 +187,6 @@ void rc_enc_finish_fx( * * Shift a byte out to bitstream *-------------------------------------------------------------------*/ -#ifndef FIX_2425_REMOVE_RC_DUPLICATES -static void rc_enc_shift_ivas_fx( - BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ - PVQ_ENC_HANDLE hPVQ /* i/o: PVQ encoder handle */ -) -{ - test(); - L_sub( 0, 0 ); /* For comparision in if */ - IF( LT_64( hPVQ->rc_low, 0xff000000UL ) || EQ_16( hPVQ->rc_carry, 1 ) ) - { - IF( hPVQ->rc_cache >= 0 ) - { - rc_enc_write_ivas_fx( hBstr, add( hPVQ->rc_cache, hPVQ->rc_carry ), 8 ); - } - - WHILE( hPVQ->rc_carry_count > 0 ) - { - rc_enc_write_ivas_fx( hBstr, s_and( add( hPVQ->rc_carry, 0xff ), 255 ), 8 ); - hPVQ->rc_carry_count = sub( hPVQ->rc_carry_count, 1 ); // Q0 - move16(); - } - - hPVQ->rc_cache = u_extract_l( UL_lshr( hPVQ->rc_low, 24 ) ); - hPVQ->rc_carry = 0; - move16(); - } - ELSE - { - hPVQ->rc_carry_count = add( hPVQ->rc_carry_count, 1 ); // Q0 - move16(); - } - hPVQ->rc_low = UL_lshl( hPVQ->rc_low, 8 ); - move32(); - return; -} -#endif static void rc_enc_shift_fx( BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ @@ -391,41 +226,6 @@ static void rc_enc_shift_fx( * * *-------------------------------------------------------------------*/ -#ifndef FIX_2425_REMOVE_RC_DUPLICATES -void rc_enc_bits_ivas_fx( - BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ - PVQ_ENC_HANDLE hPVQ, /* i/o: PVQ encoder handle */ - UWord32 value, /* i : Value to encode Q0*/ - Word16 bits /* i : Number of bits used Q0*/ -) -{ - IF( LE_16( add( rc_get_bits2_fx( hPVQ->rc_num_bits, hPVQ->rc_range ), bits ), hPVQ->rc_tot_bits ) ) - { - hPVQ->rc_num_bits = add( hPVQ->rc_num_bits, bits ); // Q0 - move16(); - IF( GT_16( bits, 16 ) ) - { - push_indice( hBstr, sub( IND_RC_END, hPVQ->rc_offset ), u_extract_l( UL_lshr( value, 16 ) ), sub( bits, 16 ) ); - hPVQ->rc_offset = add( hPVQ->rc_offset, 1 ); // Q0 - move16(); - push_indice( hBstr, sub( IND_RC_END, hPVQ->rc_offset ), u_extract_l( UL_and( value, 0x0000ffff ) ), 16 ); - hPVQ->rc_offset = add( hPVQ->rc_offset, 1 ); // Q0 - move16(); - } - ELSE - { - push_indice( hBstr, sub( IND_RC_END, hPVQ->rc_offset ), u_extract_l( value ), bits ); - hPVQ->rc_offset = add( hPVQ->rc_offset, 1 ); // Q0 - move16(); - } - } - ELSE - { - } - - return; -} -#endif void rc_enc_bits_fx( BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ @@ -463,32 +263,6 @@ void rc_enc_bits_fx( * * Encode with uniform distribution *-------------------------------------------------------------------*/ -#ifndef FIX_2425_REMOVE_RC_DUPLICATES -void rc_enc_uniform_ivas_fx( - BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ - PVQ_ENC_HANDLE hPVQ, /* i/o: PVQ encoder handle */ - UWord32 value, /* i : Value to encode Q0*/ - UWord32 tot /* i : Maximum value Q0*/ -) -{ - Word16 n; - - n = sub( 32, norm_ul( UL_subNsD( tot, 1 ) ) ); - - IF( LE_16( n, 8 ) ) - { - rc_encode_ivas_fx( hBstr, hPVQ, value, 1, tot ); - } - ELSE - { - n = sub( n, 8 ); - rc_encode_ivas_fx( hBstr, hPVQ, UL_lshr( value, n ), 1, UL_addNsD( UL_lshr( tot, n ), 1 ) ); - rc_enc_bits_ivas_fx( hBstr, hPVQ, UL_and( value, UL_subNsD( UL_lshl( 1, n ), 1 ) ), n ); - } - - return; -} -#endif void rc_enc_uniform_fx( BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ @@ -520,18 +294,6 @@ void rc_enc_uniform_fx( * * Write a byte to bitstream *-------------------------------------------------------------------*/ -#ifndef FIX_2425_REMOVE_RC_DUPLICATES -static void rc_enc_write_ivas_fx( - BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ - Word16 byte, /* i : Byte to write Q0*/ - Word16 bits /* i : Number of bits Q0*/ -) -{ - push_indice( hBstr, IND_RC_START, byte, bits ); - - return; -} -#endif static void rc_enc_write_fx( BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ diff --git a/lib_enc/tns_base_enc_fx.c b/lib_enc/tns_base_enc_fx.c index 1b9f67de7c15eb41aa9fd6648d443e5a8e2157fd..36880d3d5cd6d9f73b6536ee1949911bb1d385bd 100644 --- a/lib_enc/tns_base_enc_fx.c +++ b/lib_enc/tns_base_enc_fx.c @@ -50,259 +50,6 @@ typedef Word32 ( *TLinearPredictionFilter )( Word16 order, Word16 const parCoeff /********************************/ #define MAX_SUBDIVISIONS 3 -#ifndef FIX_2411_Harmonize_TNSANALYSIS_DETECTTNSFILT - -Word16 DetectTnsFilt_fx( STnsConfig const *pTnsConfig, - Word32 const pSpectrum[], - STnsData *pTnsData, - Word16 *predictionGain ) -{ - Word16 facs[TNS_MAX_NUM_OF_FILTERS][MAX_SUBDIVISIONS]; - Word16 facs_e[TNS_MAX_NUM_OF_FILTERS][MAX_SUBDIVISIONS]; /* exponents of facs[][] */ - Word16 shifts[TNS_MAX_NUM_OF_FILTERS][MAX_SUBDIVISIONS]; - Word16 iFilter = 0; - move16(); - - ResetTnsData( pTnsData ); - - IF( pTnsConfig->maxOrder <= 0 ) - { - return 0; - } - - /* Calculate norms for each spectrum part */ - FOR( iFilter = 0; iFilter < pTnsConfig->nMaxFilters; iFilter++ ) - { - Word16 idx0; - Word16 idx1; - Word16 nSubdivisions; - Word16 iSubdivisions; - - move16(); - move16(); - move16(); - idx0 = pTnsConfig->iFilterBorders[iFilter + 1]; - idx1 = pTnsConfig->iFilterBorders[iFilter]; - nSubdivisions = pTnsConfig->pTnsParameters[iFilter].nSubdivisions; - - assert( pTnsConfig->pTnsParameters[iFilter].nSubdivisions <= MAX_SUBDIVISIONS ); - - FOR( iSubdivisions = 0; iSubdivisions < nSubdivisions; iSubdivisions++ ) - { - Word16 iStartLine; - Word16 iEndLine; - Word16 tmp, headroom, shift; - Word32 L_tmp, tmp32; - - /* iStartLine = idx0 + (idx1-idx0)*iSubdivisions/nSubdivisions; - iEndLine = idx0 + (idx1-idx0)*(iSubdivisions+1)/nSubdivisions; */ - assert( ( nSubdivisions == 1 ) || ( nSubdivisions == 3 ) ); - - tmp = sub( idx1, idx0 ); - iStartLine = imult1616( tmp, iSubdivisions ); - iEndLine = add( iStartLine, tmp ); - - IF( EQ_16( nSubdivisions, 3 ) ) - { - iStartLine = mult( iStartLine, 0x2AAB ); - } - iStartLine = add( iStartLine, idx0 ); - - IF( EQ_16( nSubdivisions, 3 ) ) - { - iEndLine = mult( iEndLine, 0x2AAB ); - } - iEndLine = add( iEndLine, idx0 ); - - /*norms[iFilter][iSubdivisions] = norm2FLOAT(pSpectrum+iStartLine, iEndLine-iStartLine);*/ - headroom = getScaleFactor32( &pSpectrum[iStartLine], sub( iEndLine, iStartLine ) ); - - /* Calculate norm of spectrum band */ - L_tmp = Norm32Norm( pSpectrum + iStartLine, headroom, sub( iEndLine, iStartLine ), &shift ); - - /* Check threshold HLM_MIN_NRG */ - BASOP_SATURATE_WARNING_OFF_EVS; - tmp32 = L_sub( L_shl_sat( L_tmp, s_min( 31, sub( shift, 24 - 31 * 2 ) ) ), 3277l /*HLM_MIN_NRG Q7*/ ); - BASOP_SATURATE_WARNING_ON_EVS; - - /* get pre-shift for autocorrelation */ - tmp = sub( shift, norm_l( L_tmp ) ); /* exponent for normalized L_tmp */ - tmp = shr( sub( 1, tmp ), 1 ); /* pre-shift to apply before autocorrelation */ - shifts[iFilter][iSubdivisions] = s_min( tmp, headroom ); - move16(); - - /* calc normalization factor */ - facs[iFilter][iSubdivisions] = 0; - move16(); - facs_e[iFilter][iSubdivisions] = 0; - move16(); - - if ( tmp32 > 0 ) - { - facs[iFilter][iSubdivisions] = 0x7FFF; - move16(); /* normalization not needed for one subdivision */ - } - - test(); - IF( ( tmp32 > 0 ) && ( GT_16( nSubdivisions, 1 ) ) ) - { - move16(); - facs_e[iFilter][iSubdivisions] = shl( sub( tmp, shifts[iFilter][iSubdivisions] ), 1 ); - - tmp = sub( 1, shl( tmp, 1 ) ); /* exponent of autocorrelation */ - L_tmp = L_shl_sat( L_tmp, sub( shift, tmp ) ); /* shift L_tmp to that exponent */ - - /* calc factor (with 2 bits headroom for sum of 3 subdivisions) */ - move16(); - facs[iFilter][iSubdivisions] = div_s( 0x2000, round_fx_sat( L_tmp ) ); /* L_tmp is >= 0x2000000 */ - } - } - } - /* Calculate normalized autocorrelation for spectrum subdivision and get TNS filter parameters based on it */ - FOR( iFilter = 0; iFilter < pTnsConfig->nMaxFilters; iFilter++ ) - { -#define RXX_E ( 3 ) - Word32 rxx[TNS_MAX_FILTER_ORDER + 1]; - Word16 idx0; - Word16 idx1; - Word16 spectrumLength; - STnsFilter *pFilter; - Word16 nSubdivisions; - Word16 iSubdivisions; - Word16 tmpbuf[325]; - - set32_fx( rxx, 0, TNS_MAX_FILTER_ORDER + 1 ); - - move16(); - move16(); - move16(); - idx0 = pTnsConfig->iFilterBorders[iFilter + 1]; - idx1 = pTnsConfig->iFilterBorders[iFilter]; - spectrumLength = sub( idx1, idx0 ); - pFilter = pTnsData->filter + iFilter; - nSubdivisions = pTnsConfig->pTnsParameters[iFilter].nSubdivisions; - - FOR( iSubdivisions = 0; iSubdivisions < nSubdivisions; iSubdivisions++ ) - { - Word16 iStartLine, n, i; - Word16 iEndLine; - const Word16 *pWindow; - Word16 lag, shift; - Word32 L_tmp; - - IF( facs[iFilter][iSubdivisions] == 0 ) - { - BREAK; - } - - - /* iStartLine = idx0 + (idx1-idx0)*iSubdivisions/nSubdivisions; - iEndLine = idx0 + (idx1-idx0)*(iSubdivisions+1)/nSubdivisions; */ - assert( ( nSubdivisions == 1 ) || ( nSubdivisions == 3 ) ); - - iStartLine = imult1616( spectrumLength, iSubdivisions ); - iEndLine = add( iStartLine, spectrumLength ); - - IF( EQ_16( nSubdivisions, 3 ) ) - { - iStartLine = mult( iStartLine, 0x2AAB ); - } - iStartLine = add( iStartLine, idx0 ); - - IF( EQ_16( nSubdivisions, 3 ) ) - { - iEndLine = mult( iEndLine, 0x2AAB ); - } - iEndLine = add( iEndLine, idx0 ); - - - move16(); - shift = shifts[iFilter][iSubdivisions]; - - move16(); - pWindow = tnsAcfWindow_fx; - - n = sub( iEndLine, iStartLine ); - assert( n < (Word16) ( sizeof( tmpbuf ) / sizeof( Word16 ) ) ); - FOR( i = 0; i < n; i++ ) - { - tmpbuf[i] = round_fx_sat( L_shl( pSpectrum[iStartLine + i], shift ) ); - move16(); - } - - FOR( lag = 0; lag <= pTnsConfig->maxOrder; lag++ ) - { - n = sub( sub( iEndLine, lag ), iStartLine ); - - L_tmp = L_deposit_l( 0 ); - FOR( i = 0; i < n; i++ ) - { - L_tmp = L_mac0_sat( L_tmp, tmpbuf[i], tmpbuf[i + lag] ); - } - - IF( lag != 0 ) - L_tmp = Mpy_32_16_1( L_tmp, *pWindow++ ); - - L_tmp = Mpy_32_16_1( L_tmp, facs[iFilter][iSubdivisions] ); - L_tmp = L_shl( L_tmp, facs_e[iFilter][iSubdivisions] ); - - rxx[lag] = L_add( rxx[lag], L_tmp ); - move32(); - } - } - - IF( EQ_16( iSubdivisions, nSubdivisions ) ) /* meaning there is no subdivision with low energy */ - { - pFilter->spectrumLength = spectrumLength; - move16(); - /* Limit the maximum order to spectrum length/4 */ - GetFilterParameters( rxx, s_min( pTnsConfig->maxOrder, shr( pFilter->spectrumLength, 2 ) ), pFilter ); - } - } - - if ( predictionGain ) - { - assert( pTnsConfig->nMaxFilters == 1 ); - move16(); - *predictionGain = pTnsData->filter->predictionGain; - } - - /* We check the filter's decisions in the opposite direction */ - FOR( iFilter = sub( pTnsConfig->nMaxFilters, 1 ); iFilter >= 0; iFilter-- ) - { - STnsFilter *pFilter; - struct TnsParameters const *pTnsParameters; - - move16(); - move16(); - pFilter = pTnsData->filter + iFilter; - pTnsParameters = pTnsConfig->pTnsParameters + iFilter; - - IF( s_or( (Word16) GT_16( pFilter->predictionGain, pTnsParameters->minPredictionGain ), - sub( pFilter->avgSqrCoef, pTnsParameters->minAvgSqrCoef ) > 0 ) ) - { - move16(); - pTnsData->nFilters = add( pTnsData->nFilters, 1 ); - } - ELSE IF( pTnsData->nFilters > 0 ) /* If a previous filter is turned on */ - { - /* Since TNS filter of order 0 is not allowed we haved to signal in the stream filter of order 1 with the 0th coefficient equal to 0 */ - ClearTnsFilterCoefficients( pFilter ); - move16(); - move16(); - pFilter->order = 1; - pTnsData->nFilters = add( pTnsData->nFilters, 1 ); - } - ELSE - { - ClearTnsFilterCoefficients( pFilter ); - } - } - - - return ( pTnsData->nFilters > 0 ); -} -#endif // FIX_2411_Harmonize_TNSANALYSIS_DETECTTNSFILT void CalculateTnsFilt_fx( STnsConfig const *pTnsConfig, /* i : TNS Configuration struct */ const Word32 pSpectrum[], /* i : MDCT spectrum */ @@ -410,11 +157,7 @@ void CalculateTnsFilt_fx( return; } -#ifdef FIX_2411_Harmonize_TNSANALYSIS_DETECTTNSFILT Word16 DetectTnsFilt_fx( -#else -Word16 DetectTnsFilt_ivas_fx( -#endif // FIX_2411_Harmonize_TNSANALYSIS_DETECTTNSFILT STnsConfig const *pTnsConfig, /* i : TNS Configuration struct */ Word32 const pSpectrum[], /* i : MDCT spectrum Q=Qx */ @@ -637,11 +380,7 @@ Word16 DetectTnsFilt_ivas_fx( } /* We check the filter's decisions in the opposite direction */ -#ifndef FIX_2411_Harmonize_TNSANALYSIS_DETECTTNSFILT - FOR( iFilter = ( pTnsConfig->nMaxFilters - 1 ); iFilter >= 0; iFilter-- ) -#else FOR( iFilter = sub( pTnsConfig->nMaxFilters, 1 ); iFilter >= 0; iFilter-- ) -#endif // FIX_2411_Harmonize_TNSANALYSIS_DETECTTNSFILT { STnsFilter *pFilter; struct TnsParameters const *pTnsParameters; @@ -867,7 +606,7 @@ static void GetFilterParameters_ivas( Word32 rxx[], Word16 maxOrder, STnsFilter #elif TNS_COEF_RES == 4 Word16 const *values = tnsCoeff4; #elif TNS_COEF_RES == 3 - Word16 const *values = tnsCoeff3; + Word16 const *values = tnsCoeff3; #endif Word16 *indexes = pTnsFilter->coefIndex; @@ -929,7 +668,7 @@ static void GetFilterParameters( Word32 rxx[], Word16 maxOrder, STnsFilter *pTns #elif TNS_COEF_RES == 4 Word16 const *values = tnsCoeff4; #elif TNS_COEF_RES == 3 - Word16 const *values = tnsCoeff3; + Word16 const *values = tnsCoeff3; #endif Word16 *indexes = pTnsFilter->coefIndex; @@ -989,7 +728,7 @@ static void Parcor2Index( const Word16 parCoeff[] /*Q15*/, Word16 index[], Word1 #elif TNS_COEF_RES == 4 values = tnsCoeff4; #elif TNS_COEF_RES == 3 - values = tnsCoeff3; + values = tnsCoeff3; #endif FOR( i = 0; i < order; i++ )