/*==================================================================================== EVS Codec 3GPP TS26.443 Nov 13, 2018. Version 12.11.0 / 13.7.0 / 14.3.0 / 15.1.0 ====================================================================================*/ #include "options.h" #include "prot.h" #include "rom_com.h" /*-----------------------------------------------------------------* * Local constants *-----------------------------------------------------------------*/ #define N_MAX_FFT 1024 #define INV_SQR2 0.70710676908493f /*---------------------------------------------------------------------* * ifft_rel() * * Calculate the inverse FFT of a real signal * * Based on the FORTRAN code from the article "Real-valued Fast Fourier Transform Algorithms" * by Sorensen, ... in IEEE Trans. on ASSP, Vol. ASSP-35, No. June 6th 1987. * * Input: the io[] signal containing the spectrum in the following order : * * Re[0], Re[1], .. Re[n/2], Im[n/2-1], .. Im[1] *---------------------------------------------------------------------*/ void ifft_rel( float io[], /* i/o: input/output vector */ const short n, /* i : vector length */ const short m /* i : log2 of vector length */ ) { short i, j, k; short step; short n2, n4, n8, i0; short is, id; float *x,*xi0, *xi1, *xi2, *xi3, *xi4, *xup1, *xdn6, *xup3, *xdn8; float xt; float r1; float t1, t2, t3, t4, t5; float cc1, cc3, ss1, ss3; const float *s, *s3, *c, *c3; const short *idx; float temp[512]; float n_inv; n_inv = 1.0f/n; /*-----------------------------------------------------------------* * IFFT *-----------------------------------------------------------------*/ x = &io[-1]; n2 = 2*n; for (k=1; k> 1; n4 = n2 >> 2; n8 = n4 >> 1; while (is < n-1) { xi1 = x + is + 1; xi2 = xi1 + n4; xi3 = xi2 + n4; xi4 = xi3 + n4; for (i=is; i>1)]; } } else if (n == 256) { for (i=0; i> 1; while (k < j) { j = j - k; k = k >> 1; } j = j + k; } } /*-----------------------------------------------------------------* * Normalization *-----------------------------------------------------------------*/ for (i=1; i<=n; i++) { x[i] = xi0[i] * n_inv; } return; }