From 7e17518030a45788a1bbc8dbb84843e3fdd89dcf Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Tue, 21 Nov 2023 19:01:47 +0530 Subject: [PATCH] EVS code windowing, lsp poly changes [x] EVS fixed point files/code pulled in as-is. [x] Changes related to windowing (overlap add, time domain aliasing), lsp convert poly functionality [x] Changes made in IVAS floating code to maintain floating code and avoid conflicts with newly introduced fixed point code. [x] Floating code output is bit exact with base version IVAS code. --- Workspace_msvc/lib_com.vcxproj | 3 + Workspace_msvc/lib_com.vcxproj.filters | 7 +- lib_com/lsp_conv_poly_fx.c | 906 ++++++++++++++++++++++++ lib_com/options.h | 2 +- lib_com/prot.h | 10 +- lib_com/prot_fx2.h | 31 + lib_com/rom_com.c | 477 ++++++++++++- lib_com/rom_com.h | 41 +- lib_com/tcx_mdct_window.c | 8 +- lib_com/window_ola.c | 4 +- lib_com/window_ola_fx.c | 941 +++++++++++++++++++++++++ lib_com/wtda.c | 36 +- lib_com/wtda_fx.c | 523 ++++++++++++++ 13 files changed, 2948 insertions(+), 41 deletions(-) create mode 100644 lib_com/lsp_conv_poly_fx.c create mode 100644 lib_com/window_ola_fx.c create mode 100644 lib_com/wtda_fx.c diff --git a/Workspace_msvc/lib_com.vcxproj b/Workspace_msvc/lib_com.vcxproj index 1dbc36e30..64dd04a58 100644 --- a/Workspace_msvc/lib_com.vcxproj +++ b/Workspace_msvc/lib_com.vcxproj @@ -246,6 +246,7 @@ + @@ -308,8 +309,10 @@ + + diff --git a/Workspace_msvc/lib_com.vcxproj.filters b/Workspace_msvc/lib_com.vcxproj.filters index 965c77561..495917759 100644 --- a/Workspace_msvc/lib_com.vcxproj.filters +++ b/Workspace_msvc/lib_com.vcxproj.filters @@ -518,6 +518,8 @@ common_all_c + + common_all_c @@ -576,6 +578,9 @@ common_all_c + + common_all_c + @@ -663,4 +668,4 @@ {b95b7bed-a666-4a00-9332-2b528638503e} - + \ No newline at end of file diff --git a/lib_com/lsp_conv_poly_fx.c b/lib_com/lsp_conv_poly_fx.c new file mode 100644 index 000000000..81a8ad1e0 --- /dev/null +++ b/lib_com/lsp_conv_poly_fx.c @@ -0,0 +1,906 @@ +/*==================================================================================== + EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0 + ====================================================================================*/ + + +#include +#include "options.h" +#include "cnst.h" +#include "rom_com.h" +#include "prot.h" +#include "wmc_auto.h" + +#ifdef IVAS_FLOAT_FIXED +#include "prot_fx2.h" +#endif + +/*-------------------------------------------------------------------* + * Local constants + *-------------------------------------------------------------------*/ + +/* The conversion modes. */ +#define DOWNCONV 0 +#define UPCONV 1 +/* The cap of the inverse power spectrum. */ +#define MAXPOWERSPECT 1e-5f +#define N50 GRID50_POINTS +#define N40 GRID40_POINTS + +/*-------------------------------------------------------------------* + * Local function prototypes + *-------------------------------------------------------------------*/ +static void powerspect_fx( const Word16 x[], Word16 N, Word32 R[], Word32 S[], Word32 G[], Word16 mode ); +static void spectautocorr_fx( const Word16 x[], const Word16 N, const Word32 G[], Word16 rh[], Word16 rl[] ); +static Word32 b_inv_sq( const Word32 in32, const Word16 exp_in ); +static Word32 inv_pow( const Word32 re, const Word32 se, const Word16 x ); +static void zeros2poly_fx( Word16 x[], Word32 R[], Word32 S[] ); +static void polydecomp_fx( Word16 A[], Word32 P[], Word32 Q[] ); +static void cheb2poly_fx( Word32 L_P[] ); + +/*---------------------------------------------------------------------* + * lsp_convert_poly() + * + * Converts the LP filter estimated at 16.0 kHz sampling rate down + * 12.8 kHz frequency scale or alternatively from 12.8 kHz up to + * 16.0 kHz. The former is called down conversation and latter up + * conversion. The resulting LP filter is characterized with its + * line spectrum pairs. The original Lp filter can be either in + * its immittance, used for the AMR-WB IO mode, or line spectrum + * pair representation. + * + * The conversion is based the autocorrelation computed from the + * power spectrum of the LP filter that is truncated or extrapolated + * to the desired frequency scale. + *---------------------------------------------------------------------*/ + +Word16 lsp_convert_poly_fx( + Word16 w[], /* i/o: LSP or ISP parameters */ + const Word16 L_frame, /* i : flag for up or down conversion */ + const Word16 Opt_AMRWB /* i : flag for the AMR-WB IO mode */ +) +{ + Word16 flag; + + Word32 G[GRID50_POINTS]; + Word16 i; + Word16 A[M + 1]; + Word32 R[NC + 1], S[NC + 1]; + Word32 epsP[M + 1]; + Word16 rh[M + 1], rl[M + 1]; + Word16 oldA[M + 3]; + + /*---------------------------------------------------------------------* + * Because AMR-WB IO mode uses immittance spectrum frequency representation + * instead of line spectrum frequency representation, the input + * parameters do not give the zeros of the polynomials R(x) and S(x). + * Hence R(x) and S(x) are formed via the polynomial A(z) of the linear + * prediction filter. + *---------------------------------------------------------------------*/ + + IF( Opt_AMRWB ) + { + E_LPC_f_isp_a_conversion( w, oldA, M ); + + polydecomp_fx( oldA, R, S ); + } + + /*---------------------------------------------------------------------* + * Form the polynomials R(x) and S(x) from their zeros that are the + * line spectrum pairs of A(z). The polynomial coefficients can be + * scaled for convenience, because scaling will not affect the + * resulting LP coefficients. Scaling by 128 gives the correct offset + * to the power spectrum for n = 16. + *---------------------------------------------------------------------*/ + + ELSE + { + E_LPC_f_lsp_a_conversion( w, oldA, M ); + + zeros2poly_fx( w, R, S ); + } + + /*---------------------------------------------------------------------* + * Conversion from 16.0 kHz down to 12.8 kHz. The power spectrum + * needs to be computed only up to 6.4 kHz, because the upper band + * is omitted. + *---------------------------------------------------------------------*/ + + IF( EQ_16( L_frame, L_FRAME ) ) + { + powerspect_fx( grid50_fx, N50, R, S, G, DOWNCONV ); + spectautocorr_fx( grid40_fx, N40, G, rh, rl ); + } + /*---------------------------------------------------------------------* + * Conversion from 12.8 kHz up to 16.0 kHz. + * Compute the power spectrum of the LP filter, extrapolate the + * power spectrum from 6.4 kHz to 8.0 kHz, and compute auto- + * correlation on this power spectrum. + *---------------------------------------------------------------------*/ + + ELSE + { + powerspect_fx( grid40_fx, N40, R, S, G, UPCONV ); + + FOR( i = N40; i < N50; i++ ) + { + G[i] = G[N40 - 1]; + move32(); + } + + spectautocorr_fx( grid50_fx, N50, G, rh, rl ); + } + + + /*---------------------------------------------------------------------* + * Compute the linear prediction coefficients from the autocorrelation + * and convert to line spectrum pairs. + *---------------------------------------------------------------------*/ + flag = E_LPC_lev_dur( rh, rl, A, epsP, M, oldA ); + E_LPC_a_lsp_conversion( A, w, stable_LSP_fx, M ); + + + return ( flag ); +} + +/*---------------------------------------------------------------------* + * powerspect() + * + * Computes the power spectrum G(w) = 1/|A(w)|^2 at N points on + * the real axis x = cos w by utilizing the line spectrum frequency + * decomposition + * + * A(z) = (P(z) + Q(z))/2, + * + * where assuming A(z) of an even degree n, + * + * P(z) = [A(z) + z^(n+1) A(1/z)]/(1/z + 1), + * Q(z) = [A(z) - z^(n+1) A(1/z)]/(1/z - 1). + * + * The zeros of these polynomials give the line spectrum frequencies + * of A(z). It can be shown that for an even n, + * + * |A(x)|^2 = 2 (1 + x) R(x)^2 + 2 (1 - x) S(x)^2, + * + * where x = cos w, and R(x) and S(x) are the direct polynomials + * resulting from the Chebyshev series representation of P(z) + * and Q(z). + * + * This routine assumes the grid X = 1, x[0], x[1], .., x[m-1], + * -, ..., -x[1], -x[0], -1 such that x[i] = cos((i+1)*pi/N) for + * evaluating the power spectrum. Only m = (N-1)/2 - 1 grid points + * need to be stored, because cos(0) and cos(pi/2) are trivial, + * and the points above pi/2 are obtained readily using the symmetry + * of cosine. + * + * The power spectrum can be scaled as a*G[], where a is chosen + * for convenience. This is because the scaling has no impact on + * the LP coefficients to be determined based on the power spectrum. + *---------------------------------------------------------------------*/ + +void powerspect_fx( + const Word16 x[], /* i: Q15 Grid points x[0:m-1] */ + Word16 N, /* i: Number of grid points */ + Word32 R[], /* i: Q20 Coefficients of R(x) in R[0:NC] */ + Word32 S[], /* i: Q20 Coefficients of S(x) in S[0:NC] */ + Word32 G[], /* o: Q15 Power spectrum G[0:N] */ + Word16 mode /* i: Flag for up or down conversion */ +) +{ + Word32 s0, se, so, r0, re, ro; + Word16 i, j; + Word16 iuni, imid; + Word32 L_tmp; + Word16 x2; + Word32 mh; + UWord16 ml; + + /*---------------------------------------------------------------------* + * Down conversion yields iuni unique grid points that do not have + * symmetric counterparts above x = cos(pi/2) = 0. + * Set the mid point of the frequency grid. + *---------------------------------------------------------------------*/ + + IF( mode == DOWNCONV ) + { + iuni = ( GRID50_POINTS - 1 ) / 5 - 1; + move16(); + imid = ( GRID50_POINTS - 1 ) / 2; + move16(); + } + + /*---------------------------------------------------------------------* + * Power spectrum x = cos(pi) = -1 that is not needed in down + * conversion. Set the mid point of the frequency grid. + *---------------------------------------------------------------------*/ + + ELSE + { + iuni = 0; + move16(); + imid = ( GRID40_POINTS - 1 ) / 2; + move16(); + + G[N - 1] = S[0]; + move32(); + + FOR( j = 1; j <= NC; j++ ) + { + G[N - 1] = L_sub( S[j], G[N - 1] ); + move32(); + } + G[N - 1] = b_inv_sq( G[N - 1], 19 ); + move32(); + } + + /*---------------------------------------------------------------------* + * Power spectrum x = cos(0) = 1. + *---------------------------------------------------------------------*/ + + G[0] = R[0]; + move32(); + FOR( j = 1; j <= NC; j++ ) + { + G[0] = L_add( R[j], G[0] ); + move32(); + } + + G[0] = b_inv_sq( L_max( G[0], 1 ), 19 ); + move32(); + + /*---------------------------------------------------------------------* + * Power spectrum at x = cos(pi/2) = 0. + *---------------------------------------------------------------------*/ + G[imid] = inv_pow( R[NC], S[NC], 0 ); + move32(); + + /*---------------------------------------------------------------------* + * Power spectrum at unique points that do not have symmetric + * counterparts at x > cos(pi/2) = 0. + *---------------------------------------------------------------------*/ + + FOR( i = 1; i <= iuni; i++ ) + { + Mpy_32_16_ss( R[0], x[i - 1], &mh, &ml ); + r0 = L_add( R[1], mh ); + Mpy_32_16_ss( S[0], x[i - 1], &mh, &ml ); + s0 = L_add( S[1], mh ); + + + FOR( j = 2; j <= NC; j++ ) + { + Mpy_32_16_ss( r0, x[i - 1], &mh, &ml ); + r0 = L_add( R[j], mh ); + + Mpy_32_16_ss( s0, x[i - 1], &mh, &ml ); + s0 = L_add( S[j], mh ); + } + + G[i] = inv_pow( r0, s0, x[i - 1] ); + move32(); + } + + /*---------------------------------------------------------------------* + * Power spectrum at points other than x = -1, 0, and 1 and unique + * points is computed using the anti-symmetry of the grid relative + * to the midpoint x = 0 in order to reduce looping. + *---------------------------------------------------------------------*/ + + FOR( ; i < imid; i++ ) + { + x2 = mult_r( x[i - 1], x[i - 1] ); + + Mpy_32_16_ss( R[0], x2, &mh, &ml ); + re = L_add( R[2], mh ); + Mpy_32_16_ss( R[1], x2, &mh, &ml ); + ro = L_add( R[3], mh ); + + Mpy_32_16_ss( S[0], x2, &mh, &ml ); + se = L_add( S[2], mh ); + Mpy_32_16_ss( S[1], x2, &mh, &ml ); + so = L_add( S[3], mh ); + + FOR( j = 4; j < NC; j += 2 ) + { + Mpy_32_16_ss( re, x2, &mh, &ml ); + re = L_add( R[j], mh ); + Mpy_32_16_ss( ro, x2, &mh, &ml ); + ro = L_add( R[j + 1], mh ); + Mpy_32_16_ss( se, x2, &mh, &ml ); + se = L_add( S[j], mh ); + Mpy_32_16_ss( so, x2, &mh, &ml ); + so = L_add( S[j + 1], mh ); + } + + Mpy_32_16_ss( re, x2, &mh, &ml ); + L_tmp = L_add( R[j], mh ); + Mpy_32_16_ss( ro, x[i - 1], &mh, &ml ); + re = L_add( L_tmp, mh ); + ro = L_sub( L_tmp, mh ); + + Mpy_32_16_ss( se, x2, &mh, &ml ); + L_tmp = L_add( S[j], mh ); + Mpy_32_16_ss( so, x[i - 1], &mh, &ml ); + se = L_add( L_tmp, mh ); + so = L_sub( L_tmp, mh ); + + G[i] = inv_pow( re, se, x[i - 1] ); + move32(); + G[N - i - 1] = inv_pow( so, ro, x[i - 1] ); + move32(); + } + + return; +} + +static Word32 b_inv_sq( + const Word32 in32, /* i : Input not normalized to inverse */ + const Word16 exp_in /* i : input current exponent */ +) +{ + Word16 m_den, exp_den; + Word16 div_out; + Word32 Ltmp; +#ifdef BASOP_NOGLOB_DECLARE_LOCAL + Flag Overflow = 0; +#endif + + exp_den = norm_l( in32 ); + m_den = extract_h( L_shl( in32, exp_den ) ); + exp_den = add( sub( 30, exp_den ), sub( 16, exp_in ) ); + + m_den = mult_r( m_den, m_den ); +#ifdef BASOP_NOGLOB + exp_den = shl_o( exp_den, 1, &Overflow ); +#else /* BASOP_NOGLOB */ + exp_den = shl( exp_den, 1 ); +#endif /* BASOP_NOGLOB */ + + div_out = div_s( 8192, m_den ); +#ifdef BASOP_NOGLOB + Ltmp = L_shl_o( div_out, add( sub( 30 - 13, exp_den ), 15 ), &Overflow ); /*Q15*/ +#else /* BASOP_NOGLOB */ + Ltmp = L_shl( div_out, add( sub( 30 - 13, exp_den ), 15 ) ); /*Q15*/ +#endif /* BASOP_NOGLOB */ + + return Ltmp; +} + +static Word32 inv_pow( + const Word32 re, + const Word32 se, + const Word16 x ) +{ + Word16 exp1, exp2; + Word16 tmp; + Word32 L_tmp; + Word32 mh; + UWord16 ml; + Word32 r0, s0; +#ifdef BASOP_NOGLOB_DECLARE_LOCAL + Flag Overflow = 0; +#endif + + IF( re == 0 ) + { + exp1 = 30; + move16(); + r0 = L_deposit_l( 0 ); + } + ELSE + { + exp1 = norm_l( re ); + tmp = extract_h( L_shl( re, exp1 ) ); +#ifdef BASOP_NOGLOB + L_tmp = L_shr( L_mult_o( tmp, tmp, &Overflow ), 1 ); +#else /* BASOP_NOGLOB */ + L_tmp = L_shr( L_mult( tmp, tmp ), 1 ); +#endif /* BASOP_NOGLOB */ + Mpy_32_16_ss( L_tmp, x, &mh, &ml ); + r0 = L_add( L_tmp, mh ); + } + + IF( se == 0 ) + { + exp2 = 30; + move16(); + s0 = L_deposit_l( 0 ); + } + ELSE + { + exp2 = norm_l( se ); + tmp = extract_h( L_shl( se, exp2 ) ); +#ifdef BASOP_NOGLOB + L_tmp = L_shr( L_mult_o( tmp, tmp, &Overflow ), 1 ); +#else /* BASOP_NOGLOB */ + L_tmp = L_shr( L_mult( tmp, tmp ), 1 ); +#endif /* BASOP_NOGLOB */ + Mpy_32_16_ss( L_tmp, x, &mh, &ml ); + s0 = L_sub( L_tmp, mh ); + } + + IF( exp1 > exp2 ) + { + exp1 = shl( sub( exp1, exp2 ), 1 ); + r0 = L_shr( r0, exp1 ); + + exp2 = add( add( exp2, exp2 ), 8 ); + } + ELSE + { + exp2 = shl( sub( exp2, exp1 ), 1 ); + s0 = L_shr( s0, exp2 ); + + exp2 = add( add( exp1, exp1 ), 8 ); + } + + r0 = L_add( r0, s0 ); + exp1 = norm_l( r0 ); + L_tmp = L_shl( r0, exp1 ); + tmp = extract_h( L_tmp ); + IF( tmp == 0 ) + { + return MAX_32; + } + tmp = div_s( (Word16) ( ( 1 << 14 ) - 1 ), tmp ); + exp1 = add( exp1, exp2 ); +#ifdef BASOP_NOGLOB + L_tmp = L_shr_o( tmp, sub( 31, exp1 ), &Overflow ); /* result in Q15 */ +#else /* BASOP_NOGLOB */ + L_tmp = L_shr( tmp, sub( 31, exp1 ) ); /* result in Q15 */ +#endif /* BASOP_NOGLOB */ + + return ( L_tmp ); +} + + +/*---------------------------------------------------------------------* + * spectautocorr() + * + * Computes the autocorrelation r[j] for j = 0, 1, ..., M from + * the power spectrum P(w) by using rectangle rule to approximate + * the integral + * + * 1 pi + * r[j] = --- I P(w) cos(j*w) dw. + * 2*pi -pi + * + * It is sufficient to evaluate the integrand only from w = 0 to + * w = pi due to the symmetry P(-w) = P(w). We can further + * employ the relation + * + * cos(j*(pi - w)) = (-1)^j cos(j*w) + * + * to use symmetries relative to w = pi/2. + * + * When applying the rectangle rule, it is useful to separate w = 0, + * w = pi/2, and w = pi. By using a frequency grid of N points, we + * can express the rectangle rule as + * + * r[j] = G[0] + 2*a*G[(N-1)/2] + b*G[N-1] + * + * M + * + 2 sum (G[i] - G[N-i-1]) cos(j*x[i]) + * i=1 + * + * where G[i] is the power spectrum at the grid point cos(i*pi/N) + * and M = (N-1)/2 - 1 is the number of the grid points in the + * interval(0, pi/2). + * + * The coefficients + * + * b = (-1)^j + * a = (1 + (-1)^(j+1))(-1)^floor(j/2) + * + * follow from the properties of cosine. The computation further + * uses the recursion + * + * cos(j*w) = 2*cos(w)*cos((j-1)*w) - cos((j-2)*w) + * + * Note that the autocorrelation can be scaled for convenience, + * because this scaling has no impact on the LP coefficients to be + * calculated from the autocorrelation. The expression of r[j] thus + * omits the division by N. + * + * See the powerspect function on the definition of the grid. + * + * References + * J. Makhoul, "Spectral linear prediction: properties and + * applications," IEEE Trans. on Acoustics, Speech and Signal + * Processing, Vol. 23, No. 3, pp.283-296, June 1975 + *---------------------------------------------------------------------*/ + +static void spectautocorr_fx( + const Word16 x[], /* i: Grid points x[0:m-1] */ + const Word16 N, /* i: Number of grid points */ + const Word32 G[], /* i: Power spectrum G[0:N-1] */ + Word16 rh[], /* o: Autocorrelation r[0:M] */ + Word16 rl[] /* o: Autocorrelation r[0:M] */ +) +{ + Word16 c[M + 1]; /* c[j] = cos(j*w) */ + Word32 gp, gn; + Word16 i, j; + Word16 imid; + Word32 mh; + UWord16 ml; + Word32 r[M + 1]; + Word16 exp0; +#ifdef BASOP_NOGLOB_DECLARE_LOCAL + Flag Overflow = 0; +#endif + + /*---------------------------------------------------------------------* + * The mid point of the cosine table x of m entries assuming an odd m. + * Only the entries x[0] = cos(pi/m), x[1] = cos(2*pi/m), ..., + * x[imid-1] = cos((imid-1)*pi/m) need to be stored due to trivial + * cos(0), cos(pi/2), cos(pi), and symmetry relative to pi/2. + * Here m = 51. + *---------------------------------------------------------------------*/ + + imid = ( N - 1 ) / 2; + move16(); + + /*---------------------------------------------------------------------* + * Autocorrelation r[j] at zero lag j = 0 for the upper half of the + * unit circle, but excluding the points x = cos(0) and x = cos(pi). + *---------------------------------------------------------------------*/ + + r[0] = G[1]; + move32(); + FOR( i = 2; i < N - 1; i++ ) + { +#ifdef BASOP_NOGLOB + r[0] = L_add_o( r[0], G[i], &Overflow ); +#else /* BASOP_NOGLOB */ + r[0] = L_add( r[0], G[i] ); +#endif /* BASOP_NOGLOB */ + move32(); + } + + /*---------------------------------------------------------------------* + * Initialize the autocorrelation r[j] at lags greater than zero + * by adding the midpoint x = cos(pi/2) = 0. + *---------------------------------------------------------------------*/ + + r[1] = L_deposit_l( 0 ); + r[2] = -G[imid]; + move32(); + + FOR( i = 3; i < M; i += 2 ) + { + r[i] = L_deposit_l( 0 ); + r[i + 1] = -r[i - 1]; + move32(); + } + + /*---------------------------------------------------------------------* + * Autocorrelation r[j] at lags j = 1, 2, ..., M. The computation + * employes the relation cos(j*(pi - w)) = (-1)^j cos(j*w) and + * cos(j*w) = 2*cos(w)*cos((j-1)*w) - cos((j-2)*w) for obtaining + * the cosine c[j] = cos(j*w). + *---------------------------------------------------------------------*/ + + c[0] = (Word16) 32767; + move16(); /* 1.0 in Q15 */ + FOR( i = 1; i < imid; i++ ) + { +#ifdef BASOP_NOGLOB + gp = L_add_o( G[i], G[N - i - 1], &Overflow ); +#else /* BASOP_NOGLOB */ + gp = L_add( G[i], G[N - i - 1] ); +#endif /* BASOP_NOGLOB */ + gn = L_sub( G[i], G[N - i - 1] ); + + /*r[1] = L_mac(r[1], x[i-1], gn);*/ + Mpy_32_16_ss( gn, x[i - 1], &mh, &ml ); +#ifdef BASOP_NOGLOB + r[1] = L_add_o( r[1], mh, &Overflow ); +#else + r[1] = L_add( r[1], mh ); +#endif + move32(); + c[1] = x[i - 1]; + move16(); + + FOR( j = 2; j < M; j += 2 ) + { + c[j] = mult_r( c[j - 1], x[i - 1] ); + move16(); +#ifdef BASOP_NOGLOB + c[j] = add_o( c[j], sub_o( c[j], c[j - 2], &Overflow ), &Overflow ); +#else /* BASOP_NOGLOB */ + c[j] = add( c[j], sub( c[j], c[j - 2] ) ); +#endif /* BASOP_NOGLOB */ + move16(); + + /*r[j] = L_mac(r[j], c[j], gp);*/ + Mpy_32_16_ss( gp, c[j], &mh, &ml ); +#ifdef BASOP_NOGLOB + r[j] = L_add_o( r[j], mh, &Overflow ); +#else /* BASOP_NOGLOB */ + r[j] = L_add( r[j], mh ); +#endif /* BASOP_NOGLOB */ + move32(); + + c[j + 1] = mult_r( c[j], x[i - 1] ); + move16(); +#ifdef BASOP_NOGLOB + c[j + 1] = add_o( c[j + 1], sub_o( c[j + 1], c[j - 1], &Overflow ), &Overflow ); +#else /* BASOP_NOGLOB */ + c[j + 1] = add( c[j + 1], sub( c[j + 1], c[j - 1] ) ); +#endif /* BASOP_NOGLOB */ + move16(); + + /*r[j+1] = L_mac(r[j+1], c[j+1], gn);*/ + Mpy_32_16_ss( gn, c[j + 1], &mh, &ml ); +#ifdef BASOP_NOGLOB + r[j + 1] = L_add_o( r[j + 1], mh, &Overflow ); +#else /* BASOP_NOGLOB */ + r[j + 1] = L_add( r[j + 1], mh ); +#endif /* BASOP_NOGLOB */ + move32(); + } + c[j] = mult_r( c[j - 1], x[i - 1] ); + move16(); +#ifdef BASOP_NOGLOB + c[j] = add_o( c[j], sub_o( c[j], c[j - 2], &Overflow ), &Overflow ); +#else /* BASOP_NOGLOB */ + c[j] = add( c[j], sub( c[j], c[j - 2] ) ); +#endif /* BASOP_NOGLOB */ + move16(); + + Mpy_32_16_ss( gp, c[j], &mh, &ml ); +#ifdef BASOP_NOGLOB + r[j] = L_add_o( r[j], mh, &Overflow ); +#else /* BASOP_NOGLOB */ + r[j] = L_add( r[j], mh ); +#endif /* BASOP_NOGLOB */ + move32(); + } + + /*---------------------------------------------------------------------* + * Add the endpoints x = cos(0) = 1 and x = cos(pi) = -1 as + * well as the lower half of the unit circle. + *---------------------------------------------------------------------*/ +#ifdef BASOP_NOGLOB + gp = L_shr( L_add_o( G[0], G[N - 1], &Overflow ), 1 ); +#else /* BASOP_NOGLOB */ + gp = L_shr( L_add( G[0], G[N - 1] ), 1 ); +#endif /* BASOP_NOGLOB */ + gn = L_shr( L_sub( G[0], G[N - 1] ), 1 ); + +#ifdef BASOP_NOGLOB + r[0] = L_add_o( r[0], gp, &Overflow ); +#else /* BASOP_NOGLOB */ + r[0] = L_add( r[0], gp ); +#endif /* BASOP_NOGLOB */ + move32(); + exp0 = norm_l( r[0] ); + L_Extract( L_shl( r[0], exp0 ), &rh[0], &rl[0] ); + + FOR( j = 1; j < M; j += 2 ) + { +#ifdef BASOP_NOGLOB + L_Extract( L_shl( L_add_o( r[j], gn, &Overflow ), exp0 ), &rh[j], &rl[j] ); + L_Extract( L_shl( L_add_o( r[j + 1], gp, &Overflow ), exp0 ), &rh[j + 1], &rl[j + 1] ); +#else /* BASOP_NOGLOB */ + L_Extract( L_shl( L_add( r[j], gn ), exp0 ), &rh[j], &rl[j] ); + L_Extract( L_shl( L_add( r[j + 1], gp ), exp0 ), &rh[j + 1], &rl[j + 1] ); +#endif + } + + return; +} + +/*---------------------------------------------------------------------* + * zeros2poly() + * + * Computes the coefficients of the polynomials + * + * R(x) = prod (x - x[i]), + * i = 0,2,4,... + * + * S(x) = prod (x - x[i]), + * i = 1,3,5,... + * + * when their zeros x[i] are given for i = 0, 1, ..., n-1. The + * routine assumes n = 1 or even n greater than or equal to 4. + * + * The polynomial coefficients are returned in R[0:n/2-1] and + * S[0:n/2-1]. The leading coefficients are in R[0] and S[0]. + *---------------------------------------------------------------------*/ +static void zeros2poly_fx( + Word16 x[], /* i: Q15 Zeros of R(x) and S(x) */ + Word32 R[], /* o: Q22 Coefficients of R(x) */ + Word32 S[] /* o: Q22 Coefficients of S(x) */ +) +{ + Word16 xr, xs; + Word16 i, j; + Word32 mh; + UWord16 ml; + + R[0] = ( 1 << 27 ) - 1; + move32(); + S[0] = ( 1 << 27 ) - 1; + move32(); + R[1] = L_msu( 0, x[0], 1 << 11 ); + move32(); + S[1] = L_msu( 0, x[1], 1 << 11 ); + move32(); + + FOR( i = 2; i <= NC; i++ ) + { + xr = negate( x[2 * i - 2] ); + xs = negate( x[2 * i - 1] ); + + Mpy_32_16_ss( R[i - 1], xr, &R[i], &ml ); + Mpy_32_16_ss( S[i - 1], xs, &S[i], &ml ); + FOR( j = i - 1; j > 0; j-- ) + { + Mpy_32_16_ss( R[j - 1], xr, &mh, &ml ); + R[j] = L_add( R[j], mh ); + Mpy_32_16_ss( S[j - 1], xs, &mh, &ml ); + S[j] = L_add( S[j], mh ); + } + } + + return; +} + +/*---------------------------------------------------------------------* + * polydecomp() + * + * Computes the coefficients of the symmetric and antisymmetric + * polynomials P(z) and Q(z) that define the line spectrum pair + * decomposition of a given polynomial A(z) of order n. For even n, + * + * P(z) = [A(z) + z^(n+1) A(1/z)]/(1/z + 1), + * Q(z) = [A(z) - z^(n+1) A(1/z)]/(1/z - 1), + * + * These polynomials are then expressed in their direct form, + * respectively, R(x) and S(x), on the real axis x = cos w using + * explicit Chebyshev polynomials of the first kind. + * + * The coefficients of the polynomials R(x) and S(x) are returned + * in R[0:n/2] and S[0:n/2] for the given linear prediction + * coefficients A[0:n/2]. Note that R(x) and S(x) are formed in + * place such that P(z) is stored in the same array than R(x), + * and Q(z) is stored in the same array than S(x). + * + * The routines assumes n = 16. + *---------------------------------------------------------------------*/ + +static void polydecomp_fx( + Word16 A[], /* i: Q12 linear prediction coefficients */ + Word32 R[], /* o: Q20 coefficients of R(x) */ + Word32 S[] /* o: Q20 coefficients of S(x) */ +) +{ + Word16 scale; + Word16 i; + Word32 Ltmp1, Ltmp2; + + scale = shl( ( 1 << 5 ), norm_s( A[0] ) ); + + R[0] = ( 1 << 20 ) - 1; + move32(); /* Q20 */ + S[0] = ( 1 << 20 ) - 1; + move32(); + + FOR( i = 0; i < NC; i++ ) + { + Ltmp1 = L_mult( A[i + 1], scale ); + + Ltmp2 = L_msu( Ltmp1, A[M - i], scale ); + Ltmp1 = L_mac( Ltmp1, A[M - i], scale ); + + R[i + 1] = L_sub( Ltmp1, R[i] ); + move32(); + S[i + 1] = L_add( Ltmp2, S[i] ); + move32(); + } + + cheb2poly_fx( R ); + cheb2poly_fx( S ); + + return; +} + +/*---------------------------------------------------------------------* + * cheb2poly_fx() + * + * Computes the coefficients of the explicit Chebyshev polynomial + * P(x) = P[0]*x^n + P[1]*x^(n-1) + ... + P[n] given the coefficients + * of the series + * + * C(x) = C[0]*T_n(x) + C[1]*T_n-1(x) + ... + C[n]*T_0(x) + * + * where T_n(x) is the nth Chebyshev polynomial of the first kind. + * This implementation assumes C[0] = 1. Only value n = 8 is + * supported. + * + * The conversion from C(x) to P(x) is done in place such that the + * coefficients of C(x) are given in P[0:8] and those of P(x) are + * returned in the same array. + *---------------------------------------------------------------------*/ + +static void cheb2poly_fx( + Word32 L_P[] /* i/o Q20: The coefficients of C(x) and P(x) */ +) +{ + Word32 L_C[NC + 1], L_tmp; + Word16 i; + + FOR( i = 1; i <= NC; i++ ) + { + L_C[i] = L_P[i]; + move32(); + } + + L_P[0] = ( 1 << 27 ) - 1; + move32(); + + L_P[1] = L_shl( L_C[1], 6 ); + move32(); /* 64.0*C[1] */ + L_P[8] = L_shl( L_C[1], 3 ); + move32(); /* 8.0*C[1] */ + + L_P[5] = L_sub( L_P[1], L_P[8] ); + move32(); /* 56.0*C[1] */ + + L_P[2] = L_shl( L_C[3], 2 ); + move32(); + L_tmp = L_add( L_C[3], L_P[2] ); /* 5.0*C[3] */ + L_P[7] = L_sub( L_tmp, L_sub( L_P[8], L_C[1] ) ); + move32(); /* -7.0*C[1] */ + + L_P[8] = L_shl( L_C[3], 4 ); + move32(); /* 16.0*C[3] */ + L_P[3] = L_sub( L_P[8], L_shl( L_P[5], 1 ) ); + move32(); /*-112.0*C[1] */ + + L_P[5] = L_sub( L_P[5], L_add( L_P[8], L_P[2] ) ); + move32(); /* -20.0*C[3] */ + + L_P[2] = L_shl( L_C[5], 2 ); + move32(); + L_P[5] = L_add( L_P[5], L_P[2] ); + move32(); /* 4.0*C[5] */ + + L_tmp = L_sub( L_P[7], L_sub( L_P[2], L_C[5] ) ); /* -3.0*C[5] */ + L_P[7] = L_add( L_tmp, L_C[7] ); + move32(); /* C[7] */ + + L_P[6] = L_shl( L_C[2], 4 ); + move32(); + L_tmp = L_sub( ( 160 << 20 ), L_P[6] ); + L_P[4] = L_sub( L_tmp, L_shl( L_C[2], 5 ) ); + move32(); /* -48.0*C[2] */ + + L_tmp = L_add( L_P[6], L_shl( L_C[2], 1 ) ); /* 18.0*C[2] */ + L_P[6] = L_sub( L_tmp, ( 32 << 20 ) ); + move32(); + + L_P[8] = L_shl( L_C[4], 3 ); + move32(); + L_P[4] = L_add( L_P[4], L_P[8] ); + move32(); /* 8.0*C[4] */ + + L_tmp = L_sub( L_P[6], L_P[8] ); /* -8.0*C[4] */ + L_P[6] = L_add( L_tmp, L_shl( L_C[6], 1 ) ); + move32(); /* 2.0*C[6] */ + + L_tmp = L_shl( L_C[2], 5 ); /* 32.0*C[2] */ + L_P[2] = L_sub( L_tmp, ( 256 << 20 ) ); + move32(); + + L_tmp = L_add( ( 1 << 21 ) + 1, L_C[8] ); + L_tmp = L_shr( L_tmp, 1 ); /* 1+0.5*C[8] */ + L_tmp = L_sub( L_tmp, L_C[2] ); + L_tmp = L_add( L_tmp, L_C[4] ); + L_P[8] = L_sub( L_tmp, L_C[6] ); + move32(); + + return; +} diff --git a/lib_com/options.h b/lib_com/options.h index d69536f2d..9006fd91a 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -87,7 +87,7 @@ #define NONBE_FIX_819_DOUBLE_PREC_COMB_FORMATS /* VA: issue 820: Double precision arithmetic in combined formats */ #define NONBE_FIX_849_OMASA_BFI_CRASH /* VA: issue 849: fix OMASA 2TC and FEC crashes */ - +#define IVAS_FLOAT_FIXED /* ##################### End NON-BE switches ########################### */ /* ################## End DEVELOPMENT switches ######################### */ diff --git a/lib_com/prot.h b/lib_com/prot.h index b9d5796a3..62a8a706f 100644 --- a/lib_com/prot.h +++ b/lib_com/prot.h @@ -765,6 +765,14 @@ int16_t lsp_convert_poly( const int16_t Opt_AMRWB /* i : flag for the AMR-WB IO mode */ ); +#ifdef IVAS_FLOAT_FIXED +Word16 lsp_convert_poly_fx( + Word16 w[], /* i/o: LSP or ISP parameters */ + const Word16 L_frame, /* i : flag for up or down conversion */ + const Word16 Opt_AMRWB /* i : flag for the AMR-WB IO mode */ +); +#endif + /*! r: pulse position */ int16_t findpulse( const int16_t L_frame, /* i : length of the frame */ @@ -5160,7 +5168,7 @@ void wtda_ext( const uint16_t kernel_type /* i : transform kernel type (0 - 3) */ ); -void tcx_get_windows_mode1( +void tcx_get_windows_mode1_flt( const int16_t left_mode, /* i : overlap mode of left window half */ const int16_t right_mode, /* i : overlap mode of right window half */ float *left_win, /* o : left overlap window */ diff --git a/lib_com/prot_fx2.h b/lib_com/prot_fx2.h index 04a7ec065..5e9a6c986 100644 --- a/lib_com/prot_fx2.h +++ b/lib_com/prot_fx2.h @@ -1231,6 +1231,36 @@ void pre_echo_att_fx( ); +void window_ola_fx( + Word32 *ImdctOut, + Word16 *auOut, + Word16 *Q_sig, + Word16 *OldauOut, + Word16 *Q_old, + const Word16 L, + const Word16 right_mode, + const Word16 left_mode, + const Word16 old_bfi, + const Word16 oldHqVoicing, + Word16 *oldgapsynth ); + +void tcx_get_windows_mode1( + const Word16 left_mode, /* i: overlap mode of left window half */ + const Word16 right_mode, /* i: overlap mode of right window half */ + Word16 *left_win, /* o: left overlap window */ + Word16 *right_win, /* o: right overlap window */ + Word16 *left_win_int, /* o: left overlap window */ + Word16 *right_win_int, /* o: right overlap window */ + const Word16 L /* i : length */ +); + +void sinq_fx( + const Word16 tmp, /* i : sinus factor cos(tmp*i+phi) Q15*/ + const Word16 phi, /* i : sinus phase cos(tmp*i+phi) Q15*/ + const Word16 N, /* i : size of output */ + Word16 x[] /* o : output vector Q15*/ +); + /*========================================================================================================/ swb_bwe_com_lr_fx.c /========================================================================================================*/ @@ -2576,4 +2606,5 @@ Word32 DTFS_getEngy_band_wb_fx( Word16 lband, Word16 hband ); + #endif \ No newline at end of file diff --git a/lib_com/rom_com.c b/lib_com/rom_com.c index d22a47a3a..316abf397 100644 --- a/lib_com/rom_com.c +++ b/lib_com/rom_com.c @@ -1166,6 +1166,25 @@ const float grid40[(GRID40_POINTS-1)/2 - 1] = 0.3090169944f, 0.2334453639f, 0.1564344650f, 0.0784590957f }; +#ifdef IVAS_FLOAT_FIXED +const Word16 grid50_fx[(GRID50_POINTS - 1) / 2 - 1] = +{ + 32703, 32510, 32188, 31739, 31164, 30467, + 29649, 28715, 27667, 26510, 25248, 23887, + 22431, 20887, 19261, 17558, 15786, 13952, + 12063, 10126, 8149, 6140, 4107, 2058 +}; + +const Word16 grid40_fx[(GRID40_POINTS - 1) / 2 - 1] = +{ + 32667, 32365, 31863, 31164, 30274, 29197, + 27939, 26510, 24917, 23170, 21281, 19261, + 17121, 14876, 12540, 10126, 7650, 5126, + 2571 +}; + +#endif + const float grid100[GRID100_POINTS+1] = { 1.0000000000f, 0.9995065331f, 0.9980267286f, 0.9955619574f, 0.9921147227f, @@ -12541,6 +12560,13 @@ const float stable_LSP[M] = 0.9899f, 0.9667f, 0.8998f, 0.7837f, 0.6581f, 0.5009f, 0.3307f, 0.1643f, -0.0224f, -0.1955f, -0.3658f, -0.5200f, -0.6730f, -0.8040f, -0.9057f,-0.9700f }; +#ifdef IVAS_FLOAT_FIXED +/* This LSP corresponds to GEWB_Ave_fx */ +const Word16 stable_LSP_fx[M] = +{ + 32437, 31676, 29486, 25681, 21564, 16413, 10838, 5385, -735, -6405, -11986, -17040, -22052, -26346, -29678, -31784 +}; +#endif /*----------------------------------------------------------------------------------* * LSF quantization - Mean LSF vectors @@ -19133,7 +19159,7 @@ const float window_8_16_32kHz[370] = 0.12620753f, 0.11471608f, 0.10310041f, 0.09135008f, 0.07945161f, 0.06738693f, 0.05513058f, 0.04264380f, 0.02985996f, 0.01663146f }; -const float window_256kHz[592] = /*ALDO at 25.6 maybe not needed ?*/ +const float window_256kHz_flt[592] = /*ALDO at 25.6 maybe not needed ?*/ { 0.00002505f, 0.00009623f, 0.00021144f, 0.00036963f, 0.00057004f, 0.00081212f, 0.00109541f, 0.00141951f, 0.00178408f, 0.00218883f, 0.00263346f, 0.00311775f, 0.00364144f, 0.00420431f, 0.00480616f, 0.00544680f, @@ -19211,7 +19237,7 @@ const float window_256kHz[592] = /*ALDO at 25.6 maybe not needed ?*/ 0.06526908f, 0.05762520f, 0.04989688f, 0.04207239f, 0.03413516f, 0.02605991f, 0.01780324f, 0.00927214f }; -const float small_overlap_48[R2_48/7]= +const float small_overlap_48_flt[R2_48/7]= { 0.01308960f, 0.03925982f, 0.06540313f, 0.09150162f, 0.11753740f, 0.14349262f, 0.16934950f, 0.19509032f, 0.22069744f, 0.24615329f, 0.27144045f, 0.29654157f, 0.32143947f, 0.34611706f, 0.37055744f, 0.39474386f, @@ -19223,7 +19249,7 @@ const float small_overlap_48[R2_48/7]= 0.99580493f, 0.99785892f, 0.99922904f, 0.99991433f }; -const float small_overlap_25[R2_25/7]= +const float small_overlap_25_flt[R2_25/7]= { 0.02454123f, 0.07356456f, 0.12241068f, 0.17096189f, 0.21910124f, 0.26671276f, 0.31368174f, 0.35989504f, 0.40524131f, 0.44961133f, 0.49289819f, 0.53499762f, 0.57580819f, 0.61523159f, 0.65317284f, 0.68954054f, @@ -19231,7 +19257,7 @@ const float small_overlap_25[R2_25/7]= 0.93299280f, 0.94952818f, 0.96377607f, 0.97570213f, 0.98527764f, 0.99247953f, 0.99729046f, 0.99969882f }; -const float small_overlap_int[R2_16/7]= +const float small_overlap_int_flt[R2_16/7]= { 0.07845910f, 0.15643447f, 0.23344536f, 0.30901699f, 0.38268343f, 0.45399050f, 0.52249856f, 0.58778525f, 0.64944805f, 0.69778617f, @@ -19240,7 +19266,7 @@ const float small_overlap_int[R2_16/7]= }; -const float half_overlap_48[3*R2_48/7]= +const float half_overlap_48_flt[3*R2_48/7]= { 0.00436331f, 0.01308960f, 0.02181489f, 0.03053851f, 0.03925982f, 0.04797813f, 0.05669279f, 0.06540313f, 0.07410849f, 0.08280821f, @@ -19268,7 +19294,7 @@ const float half_overlap_48[3*R2_48/7]= 0.99991433f, 0.99999048f }; -const float half_overlap_25[3*R2_25/7]= +const float half_overlap_25_flt[3*R2_25/7]= { 0.00818114f, 0.02454123f, 0.04089475f, 0.05723732f, 0.07356456f, 0.08987211f, 0.10615561f, 0.12241068f, 0.13863297f, 0.15481816f, 0.17096189f, 0.18705985f, 0.20310773f, 0.21910124f, 0.23503609f, 0.25090801f, @@ -19284,7 +19310,7 @@ const float half_overlap_25[3*R2_25/7]= 0.99247953f, 0.99434953f, 0.99595331f, 0.99729046f, 0.99836060f, 0.99916346f, 0.99969882f, 0.99996653f, }; -const float half_overlap_int[3*R2_16/7]= +const float half_overlap_int_flt[3*R2_16/7]= { 0.02617695f, 0.05233596f, 0.07845910f, 0.10452846f, 0.13052619f, 0.15643447f, 0.18223553f, 0.20791169f, 0.23344536f, 0.25881905f, 0.28401534f, 0.30901699f, 0.33380686f, 0.35836795f, @@ -29060,6 +29086,442 @@ const Word16 inter4_1_fx[32] = 32, -26, -12, 0 }; +const Word16 sin_switch_8[15] = { 3212, 6393, 9512, 12540, 15447, 18205, 20788, 23170, + 25330, 27246, 28899, 30274, 31357, 32138, 32610 +}; + +const Word16 sin_switch_16[30] = { 1660, 3315, 4962, 6596, 8213, 9810, 11380, 12922, + 14431, 15902, 17333, 18719, 20057, 21344, 22576, 23750, + 24863, 25912, 26895, 27808, 28651, 29419, 30112, 30728, + 31265, 31722, 32097, 32390, 32600, 32726 +}; + + +const Word16 sin_switch_32[60] = { 844, 1687, 2529, 3369, 4207, 5043, 5875, 6703, + 7526, 8345, 9158, 9965, 10766, 11559, 12345, 13122, + 13891, 14650, 15400, 16140, 16869, 17586, 18293, 18986, + 19668, 20336, 20991, 21632, 22258, 22870, 23467, 24048, + 24613, 25162, 25694, 26209, 26707, 27187, 27649, 28092, + 28518, 28924, 29311, 29678, 30026, 30354, 30662, 30949, + 31216, 31462, 31688, 31892, 32075, 32237, 32378, 32497, + 32594, 32670, 32725, 32757 +}; + + +const Word16 sin_switch_48[90] = { 566, 1131, 1696, 2261, 2825, 3388, 3950, 4511, + 5070, 5628, 6185, 6739, 7292, 7842, 8390, 8935, + 9478, 10018, 10555, 11089, 11620, 12147, 12670, 13190, + 13706, 14218, 14725, 15228, 15727, 16220, 16709, 17194, + 17672, 18146, 18614, 19077, 19534, 19985, 20431, 20870, + 21303, 21729, 22149, 22563, 22970, 23370, 23763, 24148, + 24527, 24899, 25263, 25619, 25968, 26309, 26642, 26968, + 27285, 27594, 27895, 28188, 28472, 28747, 29015, 29273, + 29523, 29764, 29996, 30219, 30433, 30639, 30835, 31021, + 31199, 31367, 31526, 31676, 31816, 31946, 32068, 32179, + 32281, 32373, 32456, 32529, 32592, 32646, 32690, 32724, + 32748, 32763 +}; + +const Word16 one_on_win_48k_fx[210] = +{ + 16399, 16412, 16425, 16439, 16452, 16465, 16479, 16492, + 16506, 16519, 16533, 16547, 16561, 16575, 16589, 16603, + 16618, 16632, 16647, 16662, 16677, 16692, 16707, 16722, + 16738, 16754, 16770, 16786, 16802, 16818, 16835, 16851, + 16868, 16885, 16902, 16919, 16937, 16955, 16972, 16990, + 17008, 17027, 17045, 17064, 17083, 17102, 17121, 17140, + 17160, 17180, 17200, 17220, 17240, 17261, 17281, 17302, + 17323, 17345, 17366, 17388, 17410, 17432, 17454, 17477, + 17499, 17522, 17545, 17569, 17592, 17616, 17640, 17664, + 17689, 17713, 17738, 17763, 17789, 17814, 17840, 17866, + 17892, 17918, 17945, 17972, 17999, 18027, 18054, 18082, + 18110, 18139, 18167, 18196, 18225, 18255, 18284, 18314, + 18345, 18375, 18406, 18437, 18468, 18499, 18531, 18563, + 18596, 18628, 18661, 18695, 18728, 18762, 18796, 18830, + 18865, 18900, 18935, 18971, 19007, 19043, 19080, 19117, + 19154, 19191, 19229, 19267, 19306, 19345, 19384, 19423, + 19463, 19504, 19544, 19585, 19626, 19668, 19710, 19752, + 19795, 19838, 19882, 19926, 19970, 20015, 20060, 20105, + 20151, 20198, 20244, 20291, 20339, 20387, 20435, 20484, + 20533, 20583, 20633, 20684, 20735, 20787, 20839, 20891, + 20944, 20997, 21051, 21106, 21161, 21216, 21272, 21328, + 21385, 21443, 21501, 21559, 21618, 21678, 21738, 21799, + 21860, 21922, 21984, 22048, 22111, 22175, 22240, 22306, + 22372, 22439, 22506, 22574, 22643, 22712, 22782, 22853, + 22924, 22996, 23069, 23142, 23216, 23291, 23367, 23443, + 23521, 23599, 23677, 23757, 23837, 23918, 24000, 24083, + 24167, 24251 +}; + +const Word16 one_on_win_8k_16k_48k_fx[70] = +{ + 16432, 16472, 16512, 16554, 16596, 16639, 16684, 16730, + 16778, 16826, 16876, 16928, 16981, 17036, 17092, 17150, + 17210, 17271, 17334, 17399, 17465, 17534, 17604, 17676, + 17751, 17827, 17905, 17986, 18068, 18153, 18240, 18329, + 18421, 18515, 18612, 18711, 18813, 18918, 19025, 19135, + 19248, 19364, 19483, 19606, 19731, 19860, 19992, 20128, + 20268, 20411, 20558, 20709, 20865, 21024, 21188, 21357, + 21530, 21708, 21891, 22079, 22273, 22472, 22677, 22888, + 23105, 23329, 23560, 23797, 24041, 24251 +}; + +const Word16 window_8_16_32kHz_fx[370] = +{ + 3, 9, 19, 33, 49, 69, 93, 119, + 149, 182, 219, 258, 301, 347, 396, 448, + 503, 561, 623, 687, 755, 825, 898, 974, + 1054, 1136, 1221, 1309, 1399, 1493, 1589, 1688, + 1790, 1895, 2002, 2112, 2225, 2340, 2458, 2579, + 2702, 2827, 2955, 3086, 3219, 3355, 3493, 3633, + 3775, 3920, 4068, 4217, 4369, 4523, 4679, 4837, + 4998, 5160, 5325, 5491, 5660, 5830, 6003, 6177, + 6353, 6531, 6711, 6892, 7076, 7260, 7447, 7635, + 7825, 8016, 8209, 8403, 8599, 8796, 8995, 9195, + 9396, 9598, 9802, 10007, 10212, 10419, 10628, 10837, + 11047, 11248, 11437, 11623, 11809, 11997, 12185, 12374, + 12564, 12754, 12944, 13135, 13326, 13517, 13709, 13901, + 14093, 14286, 14478, 14671, 14864, 15057, 15250, 15443, + 15636, 15829, 16023, 16216, 16409, 16602, 16794, 16987, + 17179, 17372, 17564, 17755, 17947, 18138, 18329, 18519, + 18710, 18899, 19089, 19278, 19466, 19654, 19841, 20028, + 20214, 20400, 20585, 20770, 20954, 21137, 21319, 21501, + 21682, 21862, 22042, 22220, 22398, 22575, 22751, 22926, + 23101, 23274, 23446, 23618, 23788, 23958, 24126, 24266, + 24321, 24460, 24625, 24789, 24953, 25114, 25275, 25435, + 25593, 25751, 25907, 26061, 26215, 26367, 26518, 26668, + 26817, 26964, 27110, 27254, 27398, 27540, 27680, 27819, + 27957, 28093, 28228, 28362, 28494, 28625, 28754, 28882, + 29008, 29133, 29256, 29378, 29499, 29618, 29736, 29852, + 29966, 30079, 30191, 30301, 30410, 30517, 30623, 30727, + 30830, 30931, 31031, 31129, 31226, 31322, 31416, 31508, + 31599, 31689, 31777, 31864, 31950, 32035, 32118, 32200, + 32280, 32360, 32439, 32517, 32595, 32673, 32673, 32593, + 32513, 32432, 32349, 32265, 32178, 32090, 31999, 31907, + 31812, 31715, 31615, 31514, 31410, 31304, 31196, 31085, + 30972, 30857, 30739, 30619, 30497, 30372, 30245, 30116, + 29984, 29850, 29714, 29575, 29434, 29290, 29144, 28996, + 28845, 28692, 28537, 28379, 28219, 28057, 27892, 27725, + 27555, 27383, 27209, 27033, 26854, 26672, 26489, 26303, + 26115, 25924, 25731, 25536, 25338, 25138, 24936, 24731, + 24525, 24316, 24104, 23890, 23674, 23456, 23236, 23013, + 22788, 22561, 22331, 22138, 22060, 21865, 21629, 21390, + 21150, 20907, 20662, 20414, 20165, 19913, 19659, 19403, + 19145, 18885, 18622, 18357, 18090, 17821, 17550, 17277, + 17001, 16723, 16443, 16161, 15877, 15591, 15303, 15012, + 14719, 14425, 14127, 13828, 13527, 13223, 12918, 12610, + 12300, 11988, 11673, 11356, 11038, 10716, 10393, 10067, + 9739, 9408, 9076, 8740, 8403, 8062, 7720, 7374, + 7026, 6675, 6322, 5965, 5606, 5243, 4878, 4508, + 4136, 3759, 3378, 2993, 2603, 2208, 1807, 1397, + 978, 545 +}; + +const Word16 window_48kHz_fx[1110] = +{ + 0, 1, 2, 3, 5, 8, 10, 13, + 17, 21, 25, 30, 35, 40, 46, 52, + 58, 65, 72, 80, 88, 96, 105, 114, + 124, 133, 144, 154, 165, 176, 188, 200, + 212, 225, 238, 251, 265, 279, 293, 308, + 323, 339, 354, 371, 387, 404, 421, 439, + 457, 475, 493, 512, 532, 551, 571, 591, + 612, 633, 654, 676, 698, 720, 743, 766, + 789, 813, 837, 861, 885, 910, 936, 961, + 987, 1013, 1040, 1067, 1094, 1122, 1149, 1178, + 1206, 1235, 1264, 1293, 1323, 1353, 1384, 1414, + 1445, 1477, 1508, 1540, 1573, 1605, 1638, 1671, + 1705, 1739, 1773, 1807, 1842, 1877, 1912, 1948, + 1984, 2020, 2057, 2093, 2130, 2168, 2206, 2244, + 2282, 2320, 2359, 2399, 2438, 2478, 2518, 2558, + 2599, 2640, 2681, 2722, 2764, 2806, 2848, 2891, + 2934, 2977, 3020, 3064, 3108, 3152, 3196, 3241, + 3286, 3332, 3377, 3423, 3469, 3515, 3562, 3609, + 3656, 3704, 3751, 3799, 3847, 3896, 3945, 3994, + 4043, 4092, 4142, 4192, 4242, 4293, 4343, 4394, + 4445, 4497, 4549, 4600, 4653, 4705, 4758, 4811, + 4864, 4917, 4971, 5024, 5078, 5133, 5187, 5242, + 5297, 5352, 5407, 5463, 5519, 5575, 5631, 5688, + 5744, 5801, 5859, 5916, 5974, 6031, 6089, 6147, + 6206, 6265, 6323, 6382, 6442, 6501, 6561, 6620, + 6680, 6741, 6801, 6862, 6922, 6983, 7045, 7106, + 7168, 7229, 7291, 7353, 7416, 7478, 7541, 7604, + 7667, 7730, 7793, 7857, 7920, 7984, 8048, 8112, + 8177, 8241, 8306, 8371, 8436, 8501, 8566, 8632, + 8697, 8763, 8829, 8895, 8961, 9028, 9094, 9161, + 9228, 9295, 9362, 9429, 9497, 9564, 9632, 9700, + 9768, 9836, 9904, 9972, 10041, 10109, 10178, 10247, + 10316, 10385, 10454, 10523, 10593, 10662, 10732, 10802, + 10871, 10941, 11012, 11082, 11152, 11222, 11283, 11344, + 11406, 11467, 11529, 11591, 11653, 11716, 11778, 11840, + 11903, 11966, 12028, 12091, 12154, 12217, 12280, 12343, + 12406, 12469, 12532, 12595, 12658, 12722, 12785, 12849, + 12912, 12976, 13039, 13103, 13166, 13230, 13294, 13358, + 13421, 13485, 13549, 13613, 13677, 13741, 13805, 13869, + 13933, 13997, 14061, 14125, 14189, 14253, 14318, 14382, + 14446, 14510, 14574, 14639, 14703, 14767, 14832, 14896, + 14960, 15025, 15089, 15153, 15218, 15282, 15346, 15411, + 15475, 15540, 15604, 15668, 15733, 15797, 15862, 15926, + 15990, 16055, 16119, 16183, 16248, 16312, 16376, 16441, + 16505, 16569, 16634, 16698, 16762, 16826, 16891, 16955, + 17019, 17083, 17147, 17211, 17275, 17339, 17404, 17468, + 17532, 17596, 17659, 17723, 17787, 17851, 17915, 17979, + 18042, 18106, 18170, 18233, 18297, 18361, 18424, 18488, + 18551, 18614, 18678, 18741, 18804, 18868, 18931, 18994, + 19057, 19120, 19183, 19246, 19309, 19372, 19434, 19497, + 19560, 19622, 19685, 19748, 19810, 19872, 19935, 19997, + 20059, 20121, 20183, 20245, 20307, 20369, 20431, 20493, + 20554, 20616, 20677, 20739, 20800, 20862, 20923, 20984, + 21045, 21106, 21167, 21228, 21289, 21349, 21410, 21471, + 21531, 21591, 21652, 21712, 21772, 21832, 21892, 21952, + 22012, 22071, 22131, 22190, 22250, 22309, 22368, 22427, + 22486, 22545, 22604, 22663, 22722, 22780, 22839, 22897, + 22955, 23013, 23071, 23129, 23187, 23245, 23303, 23360, + 23418, 23475, 23532, 23589, 23646, 23703, 23760, 23817, + 23873, 23930, 23986, 24042, 24098, 24154, 24210, 24266, + 24321, 24377, 24432, 24488, 24543, 24598, 24653, 24707, + 24762, 24817, 24871, 24925, 24979, 25034, 25087, 25141, + 25195, 25248, 25302, 25355, 25408, 25461, 25514, 25567, + 25620, 25672, 25724, 25777, 25829, 25881, 25932, 25984, + 26036, 26087, 26138, 26189, 26240, 26291, 26342, 26393, + 26443, 26493, 26543, 26593, 26643, 26693, 26743, 26792, + 26841, 26890, 26939, 26988, 27037, 27086, 27134, 27182, + 27230, 27278, 27326, 27374, 27421, 27469, 27516, 27563, + 27610, 27657, 27703, 27750, 27796, 27842, 27888, 27934, + 27980, 28025, 28071, 28116, 28161, 28206, 28250, 28295, + 28340, 28384, 28428, 28472, 28516, 28559, 28603, 28646, + 28689, 28732, 28775, 28818, 28860, 28903, 28945, 28987, + 29029, 29071, 29112, 29154, 29195, 29236, 29277, 29318, + 29358, 29399, 29439, 29479, 29519, 29559, 29598, 29638, + 29677, 29716, 29755, 29794, 29832, 29871, 29909, 29947, + 29985, 30023, 30061, 30098, 30135, 30172, 30209, 30246, + 30283, 30319, 30356, 30392, 30428, 30464, 30499, 30535, + 30570, 30605, 30640, 30675, 30710, 30744, 30779, 30813, + 30847, 30881, 30914, 30948, 30981, 31014, 31047, 31080, + 31113, 31145, 31178, 31210, 31242, 31274, 31306, 31337, + 31369, 31400, 31431, 31462, 31493, 31523, 31554, 31584, + 31614, 31644, 31674, 31704, 31733, 31763, 31792, 31821, + 31850, 31879, 31907, 31936, 31964, 31992, 32020, 32048, + 32076, 32104, 32131, 32159, 32186, 32213, 32240, 32267, + 32294, 32320, 32347, 32373, 32399, 32426, 32452, 32478, + 32504, 32530, 32556, 32582, 32607, 32633, 32659, 32685, + 32712, 32739, 32739, 32712, 32685, 32659, 32633, 32606, + 32580, 32553, 32527, 32500, 32473, 32446, 32418, 32391, + 32363, 32335, 32307, 32279, 32251, 32222, 32193, 32164, + 32134, 32105, 32075, 32045, 32015, 31984, 31953, 31922, + 31891, 31859, 31828, 31796, 31764, 31731, 31698, 31665, + 31632, 31599, 31565, 31531, 31497, 31462, 31428, 31393, + 31357, 31322, 31286, 31250, 31214, 31177, 31141, 31104, + 31066, 31029, 30991, 30953, 30915, 30876, 30837, 30798, + 30759, 30719, 30679, 30639, 30599, 30558, 30517, 30476, + 30435, 30393, 30351, 30309, 30266, 30224, 30181, 30138, + 30094, 30050, 30006, 29962, 29917, 29873, 29827, 29782, + 29737, 29691, 29645, 29598, 29551, 29505, 29457, 29410, + 29362, 29314, 29266, 29218, 29169, 29120, 29070, 29021, + 28971, 28921, 28871, 28820, 28769, 28718, 28667, 28615, + 28563, 28511, 28459, 28406, 28353, 28300, 28246, 28192, + 28138, 28084, 28030, 27975, 27920, 27864, 27809, 27753, + 27697, 27640, 27584, 27527, 27470, 27412, 27355, 27297, + 27238, 27180, 27121, 27062, 27003, 26944, 26884, 26824, + 26763, 26703, 26642, 26581, 26520, 26458, 26396, 26334, + 26272, 26209, 26146, 26083, 26020, 25956, 25892, 25828, + 25763, 25699, 25634, 25568, 25503, 25437, 25371, 25305, + 25239, 25172, 25105, 25037, 24970, 24902, 24834, 24766, + 24697, 24628, 24559, 24490, 24420, 24351, 24281, 24210, + 24140, 24069, 23998, 23926, 23855, 23783, 23711, 23638, + 23566, 23493, 23420, 23346, 23273, 23199, 23125, 23050, + 22976, 22901, 22826, 22750, 22675, 22599, 22523, 22446, + 22370, 22293, 22215, 22138, 22060, 21983, 21904, 21826, + 21747, 21669, 21589, 21510, 21430, 21351, 21271, 21190, + 21110, 21029, 20948, 20866, 20785, 20703, 20621, 20538, + 20456, 20373, 20290, 20207, 20123, 20039, 19955, 19871, + 19787, 19702, 19617, 19532, 19446, 19360, 19274, 19188, + 19102, 19015, 18928, 18841, 18754, 18666, 18578, 18490, + 18402, 18313, 18224, 18135, 18046, 17956, 17866, 17776, + 17686, 17595, 17505, 17414, 17322, 17231, 17139, 17047, + 16955, 16863, 16770, 16677, 16584, 16490, 16397, 16303, + 16209, 16114, 16020, 15925, 15830, 15735, 15639, 15543, + 15447, 15351, 15254, 15158, 15061, 14964, 14866, 14768, + 14671, 14572, 14474, 14375, 14276, 14177, 14078, 13978, + 13878, 13778, 13678, 13578, 13477, 13376, 13274, 13173, + 13071, 12969, 12867, 12764, 12662, 12559, 12455, 12352, + 12248, 12144, 12040, 11936, 11831, 11726, 11621, 11515, + 11410, 11304, 11197, 11091, 10984, 10877, 10770, 10663, + 10555, 10447, 10339, 10230, 10122, 10013, 9904, 9794, + 9684, 9574, 9464, 9353, 9243, 9131, 9020, 8908, + 8797, 8684, 8572, 8459, 8346, 8233, 8119, 8006, + 7892, 7777, 7662, 7547, 7432, 7317, 7201, 7085, + 6968, 6851, 6734, 6617, 6499, 6381, 6263, 6144, + 6025, 5906, 5786, 5666, 5546, 5425, 5304, 5183, + 5061, 4939, 4817, 4694, 4570, 4447, 4323, 4198, + 4074, 3948, 3823, 3696, 3570, 3443, 3315, 3187, + 3058, 2929, 2800, 2669, 2539, 2407, 2275, 2142, + 2009, 1875, 1740, 1604, 1467, 1330, 1191, 1051, + 909, 766, 621, 474, 324, 169 +}; + +const Word16 window_256kHz[592] = /*ALDO at 25.6 maybe not needed ?*/ +{ + 1, 3, 7, 12, 19, 27, 36, 47, + 58, 72, 86, 102, 119, 138, 157, 178, + 201, 224, 249, 275, 302, 331, 361, 391, + 424, 457, 492, 527, 564, 603, 642, 683, + 724, 767, 811, 857, 903, 951, 999, 1049, + 1100, 1152, 1205, 1260, 1315, 1372, 1430, 1488, + 1548, 1609, 1671, 1735, 1799, 1864, 1931, 1998, + 2066, 2136, 2207, 2278, 2351, 2424, 2499, 2575, + 2651, 2729, 2808, 2887, 2968, 3049, 3132, 3215, + 3300, 3385, 3472, 3559, 3647, 3736, 3826, 3917, + 4009, 4101, 4195, 4289, 4385, 4481, 4578, 4676, + 4774, 4874, 4974, 5075, 5177, 5280, 5384, 5488, + 5593, 5699, 5806, 5913, 6021, 6130, 6240, 6350, + 6461, 6573, 6685, 6798, 6912, 7026, 7141, 7257, + 7373, 7491, 7608, 7726, 7845, 7965, 8085, 8206, + 8327, 8449, 8571, 8694, 8817, 8941, 9066, 9191, + 9316, 9442, 9569, 9696, 9823, 9951, 10079, 10208, + 10337, 10467, 10597, 10727, 10858, 10990, 11121, 11253, + 11367, 11482, 11598, 11714, 11831, 11948, 12065, 12182, + 12300, 12418, 12536, 12654, 12772, 12891, 13010, 13129, + 13248, 13367, 13486, 13605, 13725, 13844, 13964, 14084, + 14203, 14323, 14443, 14563, 14683, 14804, 14924, 15044, + 15164, 15284, 15405, 15525, 15645, 15765, 15885, 16006, + 16126, 16246, 16366, 16486, 16606, 16726, 16846, 16966, + 17086, 17206, 17325, 17445, 17564, 17684, 17803, 17922, + 18041, 18160, 18279, 18397, 18516, 18634, 18753, 18871, + 18988, 19106, 19224, 19341, 19458, 19575, 19692, 19809, + 19925, 20041, 20157, 20273, 20388, 20503, 20618, 20733, + 20848, 20962, 21076, 21190, 21303, 21416, 21529, 21642, + 21754, 21866, 21978, 22089, 22200, 22311, 22421, 22531, + 22641, 22751, 22860, 22968, 23077, 23185, 23293, 23400, + 23507, 23613, 23719, 23825, 23931, 24036, 24140, 24244, + 24348, 24452, 24555, 24657, 24759, 24861, 24962, 25063, + 25163, 25263, 25363, 25462, 25561, 25659, 25756, 25854, + 25950, 26047, 26142, 26238, 26333, 26427, 26521, 26614, + 26707, 26799, 26891, 26982, 27073, 27164, 27253, 27343, + 27432, 27520, 27608, 27695, 27781, 27868, 27953, 28038, + 28123, 28207, 28290, 28373, 28456, 28537, 28619, 28699, + 28780, 28859, 28938, 29017, 29095, 29172, 29249, 29325, + 29401, 29476, 29550, 29624, 29698, 29771, 29843, 29915, + 29986, 30056, 30126, 30196, 30264, 30333, 30400, 30467, + 30534, 30600, 30665, 30730, 30794, 30858, 30921, 30984, + 31046, 31107, 31168, 31228, 31288, 31347, 31406, 31464, + 31522, 31579, 31635, 31691, 31746, 31801, 31856, 31909, + 31963, 32016, 32068, 32120, 32171, 32222, 32273, 32323, + 32372, 32422, 32471, 32520, 32568, 32617, 32666, 32715, + 32715, 32666, 32616, 32567, 32517, 32466, 32415, 32364, + 32311, 32258, 32204, 32150, 32094, 32038, 31981, 31923, + 31864, 31805, 31744, 31683, 31621, 31557, 31494, 31429, + 31363, 31296, 31229, 31161, 31091, 31021, 30950, 30878, + 30805, 30731, 30657, 30581, 30505, 30427, 30349, 30270, + 30189, 30108, 30026, 29943, 29860, 29775, 29689, 29603, + 29515, 29427, 29337, 29247, 29156, 29064, 28971, 28877, + 28782, 28687, 28590, 28492, 28394, 28294, 28194, 28093, + 27991, 27888, 27784, 27679, 27573, 27466, 27358, 27250, + 27140, 27030, 26919, 26806, 26693, 26579, 26464, 26349, + 26232, 26114, 25996, 25876, 25756, 25635, 25512, 25389, + 25265, 25140, 25015, 24888, 24761, 24632, 24503, 24373, + 24242, 24110, 23977, 23843, 23708, 23573, 23436, 23299, + 23161, 23022, 22882, 22741, 22599, 22457, 22313, 22169, + 22024, 21878, 21731, 21583, 21435, 21285, 21135, 20984, + 20832, 20679, 20525, 20370, 20215, 20059, 19901, 19743, + 19584, 19425, 19264, 19103, 18940, 18777, 18613, 18448, + 18283, 18116, 17949, 17781, 17612, 17442, 17271, 17100, + 16927, 16754, 16580, 16405, 16230, 16053, 15876, 15698, + 15518, 15339, 15158, 14976, 14794, 14611, 14427, 14242, + 14056, 13869, 13682, 13494, 13305, 13115, 12924, 12732, + 12540, 12346, 12152, 11957, 11761, 11564, 11366, 11168, + 10968, 10768, 10566, 10364, 10161, 9957, 9752, 9547, + 9340, 9132, 8924, 8714, 8503, 8292, 8079, 7866, + 7651, 7436, 7219, 7002, 6783, 6563, 6343, 6121, + 5897, 5673, 5448, 5221, 4993, 4764, 4533, 4301, + 4067, 3832, 3596, 3358, 3118, 2876, 2632, 2387, + 2139, 1888, 1635, 1379, 1119, 854, 583, 304 +}; + +const Word16 small_overlap_48[R2_48 / 7] = +{ + 429, 1286, 2143, 2998, 3851, 4702, 5549, 6393, + 7232, 8066, 8895, 9717, 10533, 11342, 12142, 12935, + 13719, 14493, 15257, 16011, 16754, 17485, 18205, 18912, + 19606, 20286, 20953, 21605, 22243, 22865, 23472, 24062, + 24636, 25193, 25733, 26255, 26760, 27246, 27713, 28161, + 28590, 28999, 29389, 29758, 30107, 30435, 30743, 31029, + 31294, 31538, 31760, 31960, 32138, 32295, 32429, 32541, + 32631, 32698, 32743, 32765 +}; + +const Word16 small_overlap_25[R2_25 / 7] = +{ + 804, 2411, 4011, 5602, 7180, 8740, 10279, 11793, + 13279, 14733, 16151, 17531, 18868, 20160, 21403, 22595, + 23732, 24812, 25833, 26791, 27684, 28511, 29269, 29957, + 30572, 31114, 31581, 31972, 32286, 32522, 32679, 32758 +}; + +const Word16 small_overlap_int[R2_16 / 7] = +{ + 2571, 5126, + 7650, 10126, 12540, 14876, 17121, 19261, 21281, 22865, + 23472, 24917, 26510, 27939, 29197, 30274, 31164, 31863, + 32365, 32667 +}; + + +const Word16 half_overlap_48[3 * R2_48 / 7] = +{ + 143, 429, + 715, 1001, 1286, 1572, 1858, 2143, 2428, 2713, + 2998, 3283, 3567, 3851, 4135, 4419, 4702, 4985, + 5267, 5549, 5831, 6112, 6393, 6673, 6953, 7232, + 7510, 7788, 8066, 8343, 8619, 8895, 9169, 9444, + 9717, 9990, 10262, 10533, 10803, 11073, 11342, 11609, + 11876, 12142, 12408, 12672, 12935, 13197, 13458, 13719, + 13978, 14236, 14493, 14749, 15004, 15257, 15510, 15761, + 16011, 16260, 16508, 16754, 16999, 17243, 17485, 17727, + 17966, 18205, 18442, 18678, 18912, 19145, 19376, 19606, + 19834, 20061, 20286, 20510, 20732, 20953, 21172, 21390, + 21605, 21820, 22032, 22243, 22452, 22659, 22865, 23069, + 23271, 23472, 23670, 23867, 24062, 24255, 24447, 24636, + 24824, 25010, 25193, 25375, 25555, 25733, 25909, 26083, + 26255, 26426, 26594, 26760, 26924, 27086, 27246, 27403, + 27559, 27713, 27864, 28014, 28161, 28306, 28449, 28590, + 28729, 28865, 28999, 29131, 29261, 29389, 29514, 29637, + 29758, 29877, 29993, 30107, 30219, 30328, 30435, 30540, + 30643, 30743, 30840, 30936, 31029, 31120, 31208, 31294, + 31378, 31459, 31538, 31614, 31688, 31760, 31829, 31896, + 31960, 32022, 32081, 32138, 32193, 32245, 32295, 32342, + 32387, 32429, 32469, 32506, 32541, 32573, 32603, 32631, + 32655, 32678, 32698, 32715, 32730, 32743, 32753, 32760, + 32765, 32767 +}; + +const Word16 half_overlap_25[3 * R2_25 / 7] = +{ + 268, 804, 1340, 1876, 2411, 2945, 3479, 4011, + 4543, 5073, 5602, 6130, 6655, 7180, 7702, 8222, + 8740, 9255, 9768, 10279, 10786, 11291, 11793, 12292, + 12787, 13279, 13767, 14252, 14733, 15210, 15683, 16151, + 16616, 17075, 17531, 17981, 18427, 18868, 19304, 19735, + 20160, 20580, 20994, 21403, 21806, 22204, 22595, 22980, + 23359, 23732, 24099, 24459, 24812, 25159, 25499, 25833, + 26159, 26478, 26791, 27096, 27394, 27684, 27967, 28243, + 28511, 28771, 29024, 29269, 29506, 29736, 29957, 30170, + 30375, 30572, 30761, 30942, 31114, 31278, 31434, 31581, + 31720, 31850, 31972, 32085, 32190, 32286, 32373, 32452, + 32522, 32583, 32635, 32679, 32714, 32741, 32758, 32767 +}; + +const Word16 half_overlap_int[3 * R2_16 / 7] = +{ + 858, 1715, 2571, 3425, 4277, 5126, + 5971, 6813, 7650, 8481, 9307, 10126, 10938, 11743, + 12540, 13328, 14107, 14876, 15636, 16384, 17121, 17847, + 18560, 19261, 19948, 20622, 21281, 21926, 22556, 23069, + 23271, 23769, 24351, 24917, 25466, 25997, 26510, 27005, + 27482, 27939, 28378, 28797, 29197, 29576, 29935, 30274, + 30592, 30888, 31164, 31419, 31651, 31863, 32052, 32219, + 32365, 32488, 32588, 32667, 32723, 32757 +}; const Word16 wac_h[LPC_SHB_ORDER] = { 32763, @@ -29180,6 +29642,7 @@ const Word16 cos_diff_table[512] = SHC(0x0072), SHC(0x006E), SHC(0x0069), SHC(0x0064), SHC(0x005F), SHC(0x005B), SHC(0x0056), SHC(0x0050), SHC(0x004C), SHC(0x0048), SHC(0x0042), SHC(0x003D), SHC(0x0039), SHC(0x0034), SHC(0x002E), SHC(0x002A), SHC(0x0025), SHC(0x0020), SHC(0x001B), SHC(0x0017), SHC(0x0011), SHC(0x000C), SHC(0x0008), SHC(0x0001) + }; /* clang-format on */ diff --git a/lib_com/rom_com.h b/lib_com/rom_com.h index ae35d190c..1c84d3870 100644 --- a/lib_com/rom_com.h +++ b/lib_com/rom_com.h @@ -196,6 +196,10 @@ extern const float LP_assym_window_16k[]; /* Assymetric window for LP analysis extern const float hamcos_window[]; /* Hamming-Cosinus window */ extern const float grid50[]; /* Table of grid points for evaluating Chebyshev polynomials */ extern const float grid40[]; /* Table of grid points for evaluating Chebyshev polynomials */ +#ifdef IVAS_FLOAT_FIXED +extern const Word16 grid50_fx[(GRID50_POINTS - 1) / 2 - 1]; +extern const Word16 grid40_fx[(GRID40_POINTS - 1) / 2 - 1]; +#endif extern const float grid100[]; /* Table of 100 grid points for evaluating Chebyshev polynomials */ extern const float wind_sss[LEN_WIN_SSS]; /* window for modify_sf ana */ @@ -433,6 +437,9 @@ extern const float dico5_cng_ev[]; extern const float stable_ISP[]; extern const float stable_LSP[]; +#ifdef IVAS_FLOAT_FIXED +extern const Word16 stable_LSP_fx[]; +#endif extern const float stable_ISF[]; extern const float UVWB_Ave[]; @@ -803,13 +810,13 @@ extern const int16_t ct2[7][13]; *------------------------------------------------------------------------------*/ extern const float window_48kHz[]; -extern const float window_256kHz[]; -extern const float half_overlap_25[]; -extern const float half_overlap_48[]; -extern const float half_overlap_int[]; -extern const float small_overlap_25[]; -extern const float small_overlap_48[]; -extern const float small_overlap_int[]; +extern const float window_256kHz_flt[]; +extern const float half_overlap_25_flt[]; +extern const float half_overlap_48_flt[]; +extern const float half_overlap_int_flt[]; +extern const float small_overlap_25_flt[]; +extern const float small_overlap_48_flt[]; +extern const float small_overlap_int_flt[]; extern const float window_8_16_32kHz[]; extern const float short_window_48kHz[]; @@ -1612,10 +1619,30 @@ extern const Word16 acos_slope[128]; extern const Word16 cos_coef_new[4]; extern const Word16 cos_table[512]; extern const Word16 inter4_1_fx[]; + +extern const Word16 sin_switch_8[15]; +extern const Word16 sin_switch_16[30]; +extern const Word16 sin_switch_32[60]; +extern const Word16 sin_switch_48[90]; + +extern const Word16 one_on_win_48k_fx[210]; /*Q14 */ +extern const Word16 one_on_win_8k_16k_48k_fx[70]; /*Q14 */ + +extern const Word16 window_8_16_32kHz_fx[]; +extern const Word16 window_48kHz_fx[]; +extern const Word16 window_256kHz[]; +extern const Word16 half_overlap_25[]; +extern const Word16 half_overlap_48[]; +extern const Word16 half_overlap_int[]; +extern const Word16 small_overlap_25[]; +extern const Word16 small_overlap_48[]; +extern const Word16 small_overlap_int[]; + extern const Word16 wac_h[]; extern const Word16 wac_l[]; extern const short dsDiracsTab[65]; extern const Word16 pwf_fx[17]; extern const Word32 inverse_table[]; extern const Word16 cos_diff_table[512]; + #endif diff --git a/lib_com/tcx_mdct_window.c b/lib_com/tcx_mdct_window.c index fe6c00041..adf97990b 100644 --- a/lib_com/tcx_mdct_window.c +++ b/lib_com/tcx_mdct_window.c @@ -129,8 +129,8 @@ void mdct_window_aldo( d = 6; break; case 512 / 2: - p1 = window_256kHz; - p2 = window_256kHz + 592 - 1; + p1 = window_256kHz_flt; + p2 = window_256kHz_flt + 592 - 1; d = 2; break; case 640 / 2: @@ -139,8 +139,8 @@ void mdct_window_aldo( d = 3; break; case 1024 / 2: - p1 = window_256kHz; - p2 = window_256kHz + 592 - 1; + p1 = window_256kHz_flt; + p2 = window_256kHz_flt + 592 - 1; d = 1; break; case 1280 / 2: diff --git a/lib_com/window_ola.c b/lib_com/window_ola.c index 8d1b98e38..4eed6bf82 100644 --- a/lib_com/window_ola.c +++ b/lib_com/window_ola.c @@ -82,7 +82,7 @@ void window_ola( decimate = 1; decay = 0; - tcx_get_windows_mode1( left_mode, right_mode, win_left, win_right, win_int_left, win_int_right, L ); + tcx_get_windows_mode1_flt( left_mode, right_mode, win_left, win_right, win_int_left, win_int_right, L ); if ( L == L_FRAME32k || L == L_FRAME16k ) { @@ -281,7 +281,7 @@ void window_ola_ext( decimate = 1; decay = 0; - tcx_get_windows_mode1( left_mode, right_mode, win_left, win_right, win_int_left, win_int_right, L ); + tcx_get_windows_mode1_flt( left_mode, right_mode, win_left, win_right, win_int_left, win_int_right, L ); if ( L == L_FRAME32k || L == L_FRAME16k ) { diff --git a/lib_com/window_ola_fx.c b/lib_com/window_ola_fx.c new file mode 100644 index 000000000..348f1fe76 --- /dev/null +++ b/lib_com/window_ola_fx.c @@ -0,0 +1,941 @@ +/*==================================================================================== + EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0 + ====================================================================================*/ + +#include "options.h" /* Compilation switches */ +#include "prot_fx1.h" /* Function prototypes */ +#include "prot_fx2.h" /* Function prototypes */ +#include "rom_com.h" /* Function prototypes */ +#include "stl.h" + +void sinq_fx( + const Word16 tmp, /* i : sinus factor cos(tmp*i+phi) Q15*/ + const Word16 phi, /* i : sinus phase cos(tmp*i+phi) Q15*/ + const Word16 N, /* i : size of output */ + Word16 x[] /* o : output vector Q15*/ +) +{ + Word16 i; + Word16 tmp1, tmp2; + Word32 L_tmp, A32,tmp_old,tmp_old_old; + + + x[0]= phi; + move16(); /*sin(x) approximated by x; Q15 */ + tmp1 = add(tmp, phi); /*Q15 */ + L_tmp = L_mult(tmp1, tmp1); /*Q31 */ + L_tmp = Mult_32_16(L_tmp, tmp1); /*Q31 */ + L_tmp = Mult_32_16(L_tmp, 5461); /*Q31; division by 6 */ + tmp2 = round_fx(L_tmp); /*Q15 */ + x[1] = sub(tmp1, tmp2); + move16(); /* sin(x) approximated by (x-x^3/3!); Q15 */ + tmp1 = add(shl(tmp,1), phi); /*Q15 */ + L_tmp = L_mult(tmp1, tmp1); /*Q31 */ + L_tmp = Mult_32_16(L_tmp, tmp1); /*Q31 */ + L_tmp = Mult_32_16(L_tmp, 5461); /*Q31; division by 6 */ + tmp2 = round_fx(L_tmp); /*Q15 */ + x[2] = sub(tmp1, tmp2); + move16(); /* sin(x) approximated by (x-x^3/3!); Q15 */ + + + IF ( GT_16(abs_s(tmp),3)) + { + /*A=(x[2]+x[0])/x[1]=2*cos(tmp); here approximated by 2*(1-tmp^2/2!) */ + A32 = L_mult0(tmp,tmp); /*Q30 */ + A32 = L_add(L_sub(1073741824, A32), 1073741824); /*Q30 */ + } + ELSE + { + A32 = L_deposit_l(0); + } + + tmp_old=L_deposit_h(x[2]); /*Q31 */ + tmp_old_old=L_deposit_h(x[1]); /*Q31 */ + + FOR ( i=3; i= MDCT_II ? -1.f : 1.f); + int16_t i, decimate, decay; + int16_t n, n16, windecay48, windecay16; + float win_right[R2_48]; + float win_int_left[R1_16]; + float win_left[R1_48]; + float win_int_right[R2_16]; + float* paout; + + n = (int16_t)((float)L * N_ZERO_MDCT_NS / FRAME_SIZE_NS); + n16 = (int16_t)((float)L_FRAME16k * N_ZERO_MDCT_NS / FRAME_SIZE_NS); + windecay48 = (int16_t)(2 * ((float)L_FRAME48k * N_ZERO_MDCT_NS / FRAME_SIZE_NS)) + R1_48; + windecay16 = (int16_t)(2 * ((float)L_FRAME16k * N_ZERO_MDCT_NS / FRAME_SIZE_NS)) + R1_16; + decimate = 1; + decay = 0; + + tcx_get_windows_mode1_flt(left_mode, right_mode, win_left, win_right, win_int_left, win_int_right, L); + + if (L == L_FRAME32k || L == L_FRAME16k) + { + decimate = 3; + decay = 1; + } + else if (L == L_FRAME8k) + { + decimate = 6; + decay = 2; + } + + else if (L == 512) + { + windecay48 = (int16_t)(2 * ((float)512 * N_ZERO_MDCT_NS / FRAME_SIZE_NS)) + R1_25; + decimate = 1; + decay = 0; + } + else if (L == 256) + { + windecay48 = (int16_t)(2 * ((float)512 * N_ZERO_MDCT_NS / FRAME_SIZE_NS)) + R1_25; + decimate = 2; + decay = 0; + } + + paout = auOut - n; + + if (L == L_FRAME32k) + { + for (i = n; i < L / 2; i += 2) + { + paout[i] = sign_right * ImdstOut[L / 2 + i] * win_right[(2 * L_FRAME16k - (n16 + (i - n) / 2)) * decimate - 1 - decay - windecay48] + OldauOut[i]; + paout[i + 1] = sign_right * ImdstOut[L / 2 + i + 1] * win_int_right[2 * L_FRAME16k - (n16 + (i - n) / 2) - 1 - windecay16] + OldauOut[i + 1]; + } + + for (i = 0; i < L / 2 - n; i += 2) + { + paout[L / 2 + i + 1] = -ImdstOut[L - 1 - (i + 1)] * win_right[(3 * L_FRAME16k / 2 - 1 - i / 2) * decimate + decay - windecay48] + OldauOut[i + L / 2 + 1]; + paout[L / 2 + i] = -ImdstOut[L - 1 - i] * win_int_right[(3 * L_FRAME16k / 2 - 1 - i / 2) - windecay16] + OldauOut[i + L / 2]; + } + + for (i = L / 2 - n; i < L / 2; i += 2) + { + paout[L / 2 + i + 1] = -ImdstOut[L - 1 - (i + 1)] + OldauOut[i + L / 2 + 1]; + paout[L / 2 + i] = -ImdstOut[L - 1 - i] + OldauOut[i + L / 2]; + } + + for (i = 0; i < L / 2; i += 2) + { + OldauOut[L / 2 + i + 1] = sign_left * ImdstOut[i + 1] * win_left[(L_FRAME16k / 2 - i / 2 - 1) * decimate + decay]; + OldauOut[L / 2 + i] = sign_left * ImdstOut[i] * win_int_left[(L_FRAME16k / 2 - i / 2 - 1)]; + } + + + for (i = n; i < L / 2; i += 2) + { + OldauOut[i] = -ImdstOut[L / 2 - 1 - i] * win_left[(L_FRAME16k - i / 2) * decimate - decay - 1]; + OldauOut[i + 1] = -ImdstOut[L / 2 - 1 - (i + 1)] * win_int_left[L_FRAME16k - (i / 2) - 1]; + } + } + else + { + for (i = n; i < L / 2; i++) + { + paout[i] = sign_right * ImdstOut[L / 2 + i] * win_right[(2 * L - i) * decimate - 1 - decay - windecay48] + OldauOut[i]; + } + + for (i = 0; i < L / 2 - n; i++) + { + paout[L / 2 + i] = -ImdstOut[L - 1 - i] * win_right[(3 * L / 2 - 1 - i) * decimate + decay - windecay48] + OldauOut[i + L / 2]; + } + + for (i = L / 2 - n; i < L / 2; i++) + { + paout[L / 2 + i] = -ImdstOut[L - 1 - i] + OldauOut[i + L / 2]; + } + + for (i = 0; i < L / 2; i++) + { + OldauOut[L / 2 + i] = sign_left * ImdstOut[i] * win_left[(L / 2 - i - 1) * decimate + decay]; + } + + + for (i = n; i < L / 2; i++) + { + OldauOut[i] = -ImdstOut[L / 2 - 1 - i] * win_left[(L - i) * decimate - decay - 1]; + } + } + + for (i = 0; i < n; i++) + { + OldauOut[i] = -ImdstOut[L / 2 - 1 - i]; + } + for (i = 0; i < n; i++) + { + paout[L + i] = OldauOut[i]; + } + + return; +} +#endif + + + +/*---------------------------------------------------------------------* +* core_switching_OLA() +* +* modify window after HQ core decoding +* overlapp ACELP and HQ +*---------------------------------------------------------------------*/ +void core_switching_OLA_fx( + Word16 *mem_over_hp, /* i : upsampling filter memory Qsubrf (except at 8kHz) */ + const Word16 last_L_frame, /* i : last L_frame lengthture */ + const Word32 output_Fs, /* i : output sampling rate */ + Word16 *synth, /* i/o: synthesized signal from HQ core Qsynth*/ + Word16 *synth_subfr_out, /* i : synthesized signal from ACELP core Qsubfr*/ + Word16 *synth_subfr_bwe, /* i : synthesized BWE from ACELP core Qbwe (todo) */ + const Word16 output_frame, /* i : output frame length */ + const Word16 bwidth, /* i : output bandwidth */ + Word16* Qsynth, + Word16* Qsubfr +) +{ + Word16 i, Loverlapp, out_filt_length, filt_delay, L; + Word16 tmp_buf_switch[SWITCH_MAX_GAP], tmp_buf_switch2[HQ_DELAY_COMP*HQ_DELTA_MAX+2]; /*Q0 */ + const Word16 *pt_sin=NULL,*pt_cos; + Word16 *pt2,*pt3,*pt; + const Word16 *pt4,*pt5; + Word16 tmp,tmp2,temp_len; + Word16 decimate=0, delta=0; /* initialize just to avoid compiler warnings */ + const Word16 *on_win, *on_win_int; + Word16 a, b, divisor, buf_offset; + Word32 L_tmp; + + /* Scaling (if needed) */ + tmp=s_min(*Qsynth,*Qsubfr); + Scale_sig(synth, output_frame, sub(tmp,*Qsynth)); + *Qsynth=tmp; + move16(); + Scale_sig(synth_subfr_out, SWITCH_MAX_GAP, sub(tmp,*Qsubfr)); + Scale_sig(mem_over_hp,NS2SA(16000, DELAY_CLDFB_NS)+2, sub(tmp, *Qsubfr)); /* reScale mem over HP at Qsynth */ + *Qsubfr=tmp; + move16(); + + /* win = window_48kHz_fx;*/ + /* win_int = window_8_16_32kHz_fx;*/ + on_win = one_on_win_48k_fx; + on_win_int = one_on_win_8k_16k_48k_fx; + + + SWITCH (output_frame) + { + case L_FRAME8k: + decimate = 6; + move16(); + /*decay = 2; move16();*/ + delta = 1; + move16(); + pt_sin=sin_switch_8; + BREAK; + case L_FRAME16k: + decimate = 3; + move16(); + /*decay = 1; move16(); */ + delta = 2; + move16(); + pt_sin=sin_switch_16; + BREAK; + case L_FRAME32k: + decimate = 3; + move16(); + /*decay = 1; move16(); */ + delta = 4; + move16(); + pt_sin=sin_switch_32; + BREAK; + case L_FRAME48k: + decimate = 1; + move16(); + /*decay = 0; move16();*/ + delta = 6; + move16(); + pt_sin=sin_switch_48; + BREAK; + } + + set16_fx(tmp_buf_switch,0,SWITCH_MAX_GAP); + set16_fx(tmp_buf_switch2,0, HQ_DELAY_COMP*HQ_DELTA_MAX+2); + + Loverlapp = i_mult2(delta,SWITCH_OVERLAP_8k); + pt_cos=pt_sin+Loverlapp-1; + + Copy( synth_subfr_out,tmp_buf_switch, i_mult2(SWITCH_GAP_LENGTH_8k,delta)); /* copy 6.25 ms subframe */ + + + /* conversion from 12.8kHz to output_Fs */ + IF( EQ_16(last_L_frame,L_FRAME)) + { + /* resample filter memory */ + IF ( EQ_16(output_frame,L_FRAME8k)) + { + Copy( synth_subfr_out + SWITCH_GAP_LENGTH_8k, tmp_buf_switch+ SWITCH_GAP_LENGTH_8k, NS2SA(output_Fs, DELAY_CLDFB_NS)); /* copy subframe to tmp buffer */ + } + ELSE + { + filt_delay = 0; + move16(); + out_filt_length =0; + move16(); + out_filt_length = modify_Fs_intcub3m_sup_fx( mem_over_hp+2, NS2SA(12800, DELAY_CLDFB_NS), 12800, tmp_buf_switch2, output_Fs , &filt_delay ); + pt=tmp_buf_switch2+sub(out_filt_length,filt_delay); + pt2=pt-1; + FOR( i=0; i Q15 */ + *pt2 = shl( mult_r(*pt2,*pt4),1); + move16();/*/= win[(3*L_FRAME16k/2-1-i/2)*decimate+decay-L_FRAME48k*14/20]; */ + pt+=2; + pt2+=2; + pt5-=3; + pt4--; + + } + } + ELSE + { + + pt=synth+tmp; + pt5=on_win+210-1; + temp_len = i_mult2(shr(R2_16,2),delta); + FOR( i=0 ; i< temp_len; i++ ) + { +#ifdef BASOP_NOGLOB + *pt=shl_sat( mult_r_sat(*pt,*pt5),1); +#else + *pt=shl( mult_r(*pt,*pt5),1); +#endif + move16();/* /= win[(3*output_frame/2-1-i)*decimate+decay-L_FRAME48k*14/20]; */ + pt++; + pt5-=decimate; + move16(); + } + } + + + pt=synth+tmp; + move16();/*Q15 */ + pt2=synth_subfr_bwe+tmp-NS2SA(output_Fs, DELAY_CLDFB_NS); + move16(); /*Q15 */ + pt3=tmp_buf_switch+tmp; + move16(); /*Q15 */ + + FOR( i=0; i +#include "options.h" /* Compilation switches */ +#include "cnst.h" /* Common constants */ +#include "rom_com.h" /* Static table prototypes */ +#include "prot_fx1.h" /* required by wmc_tool */ +#include "prot_fx2.h" /* required by wmc_tool */ +#include "stat_com.h" + /*--------------------------------------------------------------------------* + * mvr2r_inv() + * + * + *--------------------------------------------------------------------------*/ +static void mvs2s_inv( + const Word16 *in, /* i : input vector */ + Word16* out, /* o : output vector */ + const Word16 L, /* i : length */ + const Word16 decimate /* i : decimation flag [-1,1] */ +) +{ + Word16 i; + in= in+ shr(sub(decimate,1),1); + out=out+sub(L,1); + FOR (i=0; i= 2 ? -1.f : 1.f); + const float sign_right = (kernel_type & 1 ? 1.f : -1.f); + int16_t i, decimate, decay; + int16_t n, windecay48, windecay16; + const float* allsig_l, * allsig_r; + float win_right[R2_48]; + float win_int_left[R1_16]; + float win_left[R1_48]; + float win_int_right[R2_16]; + + tcx_get_windows_mode1(left_mode, right_mode, win_left, win_right, win_int_left, win_int_right, L); + + decimate = 1; /* L_FRAME 48k */ + decay = 0; + windecay48 = (int16_t)(2 * ((float)L_FRAME48k * N_ZERO_MDCT_NS / FRAME_SIZE_NS)) + R1_48; + + if (L == L_FRAME32k || L == L_FRAME16k) + { + decimate = 3; + decay = 1; + } + else if (L == L_FRAME8k) + { + decimate = 6; + decay = 2; + } + + n = (int16_t)((float)L * N_ZERO_MDCT_NS / FRAME_SIZE_NS); + + windecay16 = (int16_t)(2 * ((float)L_FRAME16k * N_ZERO_MDCT_NS / FRAME_SIZE_NS)) + R1_16; + + allsig_r = new_audio + n; + allsig_l = new_audio + n - L; + + if (L == L_FRAME32k) + { + for (i = 0; i < L / 2 - n; i += 2) + { + wtda_audio[i] = -allsig_r[L / 2 - i - 1] * win_int_right[3 * L_FRAME16k / 2 - i / 2 - 1 - windecay16] + sign_right * allsig_r[L / 2 + i] * win_int_right[3 * L_FRAME16k / 2 + i / 2 - windecay16]; + wtda_audio[i + 1] = -allsig_r[L / 2 - (i + 1) - 1] * win_right[(3 * L_FRAME16k / 2 - i / 2 - 1) * decimate + decay - windecay48] + sign_right * allsig_r[L / 2 + i + 1] * win_right[(3 * L_FRAME16k / 2 + 1 + i / 2) * decimate - decay - 1 - windecay48]; + } + + for (i = L / 2 - n; i < L / 2; i += 2) + { + wtda_audio[i] = -allsig_r[L / 2 - i - 1]; + wtda_audio[i + 1] = -allsig_r[L / 2 - (i + 1) - 1]; + } + for (i = 0; i < n; i += 2) + { + wtda_audio[i + L / 2] = sign_left * allsig_l[i] * win_left[(i / 2) * decimate + decay] - new_audio[n - i - 1]; + wtda_audio[i + L / 2 + 1] = sign_left * allsig_l[i + 1] * win_int_left[i / 2] - new_audio[n - (i + 1) - 1]; + } + + for (i = n; i < L / 2; i += 2) + { + wtda_audio[i + L / 2] = sign_left * allsig_l[i] * win_left[(i / 2) * decimate + decay] - allsig_l[L - i - 1] * win_left[(L / 2 - i / 2) * decimate - 1 - decay]; + wtda_audio[i + L / 2 + 1] = sign_left * allsig_l[i + 1] * win_int_left[i / 2] - allsig_l[L - (i + 1) - 1] * win_int_left[L / 2 - i / 2 - 1]; + } + } + else + { + for (i = 0; i < L / 2 - n; i++) + { + wtda_audio[i] = -allsig_r[L / 2 - i - 1] * win_right[3 * L / 2 * decimate - (i + 1) * decimate + decay - windecay48] + sign_right * allsig_r[L / 2 + i] * win_right[3 * L / 2 * decimate - 1 + (i + 1) * decimate - decay - windecay48]; + } + + for (i = L / 2 - n; i < L / 2; i++) + { + wtda_audio[i] = -allsig_r[L / 2 - i - 1]; + } + + for (i = 0; i < n; i++) + { + wtda_audio[i + L / 2] = sign_left * allsig_l[i] * win_left[i * decimate + decay] - new_audio[n - i - 1]; + } + + for (i = n; i < L / 2; i++) + { + wtda_audio[i + L / 2] = sign_left * allsig_l[i] * win_left[i * decimate + decay] - allsig_l[L - i - 1] * win_left[L * decimate - i * decimate - 1 - decay]; + } + } + + return; +} + +#endif + -- GitLab