/*==================================================================================== EVS Codec 3GPP TS26.443 Jun 30, 2015. Version CR 26.443-0006 ====================================================================================*/ #include #include "cnst.h" #include "options.h" #include "prot.h" /*-------------------------------------------------------------------* * four1() * * From "numerical recipes in C". * Replace data by its DFT, if isign is input as 1; or replace data * by nn times its inverse-DFT, if isign is input as -1. * data is a complex array of length nn, input as a real * array data[1...2nn]. nn must be an integer power of 2 *-------------------------------------------------------------------*/ static void four1( float *data, /* i/o: data array .......... */ short nn, /* i : length of data array */ short isign /* i : sign +1 or -1 */ ) { short n,mmax,m,j,istep,i; float wtemp,wr,wpr,wpi,wi,theta; float tempr,tempi; n=nn << 1; j=1; /* this is the bit-reversal section of the routine */ for (i=1; i i) { /* exchange the two complex numbers */ SWAP(data[j],data[i]); SWAP(data[j+1],data[i+1]); } m=n >> 1; while (m >= 2 && j > m) { j -= m; m >>= 1; } j += m; } mmax=2; /* here begins the Danielson-Lanczos section of the routine */ /* Outer loop executed log2(nn) times */ while (n > mmax) { istep=2*mmax; /* initialization for the trigonometric recurrence */ theta=(float) (6.28318530717959/(isign*mmax)); wtemp=(float) (sin(0.5f*theta)); wpr = -2.0f*wtemp*wtemp; wpi=(float) sin(theta); wr=1.0f; wi=0.0f; /* here are the two nested loops */ for (m=1; m