0% found this document useful (0 votes)
18 views

Code

The document contains definitions for constants used in fast Fourier transforms (FFTs) including PI and sine and cosine values. It also defines the maximum number of points for an FFT and declares arrays to store FFT data and coefficients.

Uploaded by

Mak Médi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views

Code

The document contains definitions for constants used in fast Fourier transforms (FFTs) including PI and sine and cosine values. It also defines the maximum number of points for an FFT and declares arrays to store FFT data and coefficients.

Uploaded by

Mak Médi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 7

/* FFT CONSTANTS*/

#include <stdio.h>

#define PI 3.14159265359

#define SIN2PI 49 //sin(2*pi/16) * 2^7


#define SIN4PI 90
#define SIN6PI 118
#define COS2PI_P_SIN2PI 167 //(cos(2*pi/16) + sin(2*pi/16)) * 2^7
#define COS2PI_M_SIN2PI 56 //cos(2*pi/16) - sin(2*pi/16)) * 2^7
#define COS6PI_P_SIN6PI 167
#define COS6PI_M_SIN6PI -56
#define OneTwentyEight 128

#define MAX_N_LOG2 12 /* maximally a 4096 point FFT */


#define MAX_N (1<<MAX_N_LOG2) /* #FFT points */

v8int_t test = { 0x57ac,0x745d, 0xdc85,0x6cea, 0xe1d2,0x511e, 0x6c99,0x31c3 };

v8int_t chess_storage(VMa:0) vDataA[1] = {{ 0x57ac,0x745d, 0xdc85,0x6cea,


0xe1d2,0x511e, 0x6c99,0x31c3 }};

/*
v4cmplx_t chess_storage(VMa:0) vDataA[MAX_N / 4] = {
{ {0x57ac,0x745d}, {0xdc85,0x6cea}, {0xe1d2,0x511e}, {0x6c99,0x31c3} },
{ {0xf02d,0x1fa1}, {0xed5f,0x2108}, {0x74bd,0x2e25}, {0xf4de,0x3666} },
{ {0xe927,0x2b80}, {0x6dbb,0x0b0d}, {0xec9c,0xe0ac}, {0xdb50,0xbf37} },
{ {0x612f,0xb52c}, {0xe379,0xc38d}, {0xd11f,0xdcef}, {0x5c36,0xed78} },
{ {0xe50b,0xe6ea}, {0xd378,0xc96e}, {0x6410,0xa3a4}, {0xf26b,0x89fd} },
{ {0xdf29,0x8a90}, {0x7197,0xa4e6}, {0x0131,0xcaad}, {0x6666,0xcccd} },
{ {0x6666,0xcccd}, {0x6666,0xcccd}, {0x6666,0xcccd}, {0x6666,0xcccd} },
{ {0x6666,0xcccd}, {0x6666,0xcccd}, {0x6666,0xcccd}, {0x6666,0xcccd} },
{ {0x6666,0xcccd}, {0x6666,0xcccd}, {0x6666,0xcccd}, {0x6666,0xcccd} },
{ {0x6666,0xcccd}, {0x6666,0xcccd}, {0x6666,0xcccd}, {0x6666,0xcccd} },
{ {0x6666,0xcccd}, {0x6666,0xcccd}, {0x6666,0xcccd}, {0x6666,0xcccd} },
{ {0x6666,0xcccd}, {0x6666,0xcccd}, {0x6666,0xcccd}, {0x6666,0xcccd} },
{ {0x6666,0xcccd}, {0x6666,0xcccd}, {0x6666,0xcccd}, {0x6666,0xcccd} },
{ {0x6666,0xcccd}, {0x6666,0xcccd}, {0x6666,0xcccd}, {0x6666,0xcccd} },
{ {0x6666,0xcccd}, {0x6666,0xcccd}, {0x6666,0xcccd}, {0x6666,0xcccd} },
{ {0x6666,0xcccd}, {0x6666,0xcccd}, {0x6666,0xcccd}, {0x6666,0xcccd} },
{ {0x6666,0xcccd}, {0x6666,0xcccd}, {0x6666,0xcccd}, {0x6666,0xcccd} },
{ {0x6666,0xcccd}, {0x6666,0xcccd}, {0x6666,0xcccd}, {0x6666,0xcccd} },
{ {0x6666,0xcccd}, {0x6666,0xcccd}, {0x6666,0xcccd}, {0x6666,0xcccd} },
{ {0x1019,0x5b41}, {0xbc48,0x6a71}, {0x5884,0x5f8d}, {0x22b5,0x3aa5} },
{ {0xcc82,0x0a64}, {0x6741,0xe3a2}, {0x3243,0xd53b}, {0xd520,0xdf7b} },
{ {0x6a48,0xf462}, {0x331f,0x0084}, {0xcd66,0xf6fa}, {0x5ca6,0xd920} },
{ {0x24a5,0xb55d}, {0xb911,0x9de9}, {0x4621,0x9d69}, {0x11dd,0xb070} },
{ {0xa55d,0xc807}, {0x34d6,0xd37d}, {0x0868,0xcb53}, {0x9e14,0xb650} },
{ {0x3198,0xa57e}, {0x0d44,0xa974}, {0xa3f0,0xc79c}, {0x38d5,0xf630} },
{ {0x18fe,0x2184}, {0xac6a,0x378e}, {0x3e10,0x3294}, {0x1e71,0x1c75} },
{ {0xab18,0x0894}, {0x36e6,0x080c}, {0x165c,0x1f6a}, {0x9c9f,0x442c} },
{ {0x2447,0x6373}, {0x05e6,0x6da2}, {0x89e8,0x5fc6}, {0x11fa,0x44e4} },
{ {0xfa8e,0x2e96}, {0x80d1,0x29a1}, {0x0cdc,0x35c2}, {0xfee7,0x45e2} },
{ {0x8891,0x488c}, {0x1811,0x3362}, {0x11ac,0x0a4a}, {0x9b9f,0xddbd} },
{ {0x2a55,0xc126}, {0x26c8,0xbf23}, {0xac48,0xd2ff}, {0x35b0,0xeb6b} },
{ {0x3162,0xf4e6}, {0xb013,0xe581}, {0x3312,0xc2d8}, {0x2e7b,0x9e8e} },
{ {0xa854,0x8ba3}, {0x27f2,0x9316}, {0x2713,0xaee2}, {0xa0a3,0xce3d} },
{ {0x2146,0xe05f}, {0x281f,0xdef8}, {0xa497,0xd1db}, {0x280e,0xc99a} },
{ {0x3716,0xd480}, {0xb583,0xf4f3}, {0x394c,0x1f54}, {0x4ce5,0x40c9} },
{ {0xc8ef,0x4ad4}, {0x4828,0x3c73}, {0x5b97,0x2311}, {0xd129,0x1288} },
{ {0x488b,0x1916}, {0x59e6,0x3692}, {0xc8a6,0x5c5c}, {0x3935,0x7603} },
{ {0x4af5,0x7570}, {0xb69e,0x5b1a}, {0x24b7,0x3553}, {0x3ba1,0x173f} },
{ {0xa8ef,0x0d1e}, {0x188f,0x1528}, {0x37b1,0x2155}, {0xa881,0x20d9} },
{ {0x19e8,0x0b3f}, {0x4012,0xe624}, {0xb1fa,0xc1f5}, {0x2180,0xafa9} },
{ {0x4a64,0xb5f2}, {0xb8ef,0xccbe}, {0x2233,0xe1e6}, {0x4a28,0xe458} },
{ {0xb2d8,0xcec8}, {0x148e,0xab56}, {0x3bcb,0x8dc8}, {0xa070,0x87d0} },
{ {0xfd91,0x9e89}, {0x281f,0xc781}, {0x8d82,0xef23}, {0xeadb,0x047e} },
{ {0x1d43,0x0326}, {0x8748,0xf532}, {0xe778,0xec41}, {0x22fa,0xf5fb} },
{ {0x917f,0x134c}, {0xf2c2,0x37cc}, {0x3452,0x51af}, {0xa36b,0x552a} },
{ {0x0117,0x4418}, {0x43ef,0x2d07}, {0xaf4e,0x2223}, {0x05ba,0x2da3} },
{ {0x475b,0x4afc}, {0xae04,0x691b}, {0xfd8c,0x7488}, {0x3fc1,0x6326} },
{ {0xa4de,0x3a80}, {0xf170,0x0c9e}, {0x38ab,0xed69}, {0xa0d6,0xe70c} },
{ {0xee77,0xf45d}, {0x3dde,0x04b4}, {0xab2a,0x06a0}, {0xfa5e,0xf2d0} },
{ {0x50f4,0xd078}, {0xc11b,0xb083}, {0x0e45,0xa2b7}, {0x678f,0xabaf} },
{ {0xd5cd,0xc1f2}, {0x1c12,0xd413}, {0x73b8,0xd3ea}, {0xdcc9,0xbff2} },
{ {0x1a05,0xa4bf}, {0x6f58,0x958f}, {0xd433,0xa073}, {0x0aaa,0xc55b} },
{ {0x6115,0xf59c}, {0xc61e,0x1c5e}, {0xfa74,0x2ac5}, {0x5680,0x2085} },
{ {0xbfd7,0x0b9e}, {0xf516,0xff7c}, {0x5882,0x0906}, {0xc698,0x26e0} },
{ {0xfb98,0x4aa3}, {0x63da,0x6217}, {0xd333,0x6297}, {0x03a1,0x4f90} },
{ {0x6c15,0x37f9}, {0xd866,0x2c83}, {0x007d,0x34ad}, {0x6664,0x49b0} },
{ {0xce68,0x5a82}, {0xee44,0x568c}, {0x532b,0x3864}, {0xb9ef,0x09d0} },
{ {0xd590,0xde7c}, {0x3e19,0xc872}, {0xa89c,0xcd6c}, {0xc4a3,0xe38b} },
{ {0x34ac,0xf76c}, {0xa5dc,0xf7f4}, {0xc3bc,0xe096}, {0x3b2c,0xbbd4} },
{ {0xb19b,0x9c8d}, {0xce7a,0x925e}, {0x4961,0xa03a}, {0xc0a7,0xbb1c} },
{ {0xd7db,0xd16a}, {0x51d0,0xd65f}, {0xc66d,0xca3e}, {0xd579,0xba1e} },
{ {0x4d50,0xb774}, {0xbfba,0xcc9e}, {0xc86c,0xf5b6}, {0x4123,0x2243} },
{ {0xb56f,0x3eda}, {0xbc4c,0x40dd}, {0x3a64,0x2d01}, {0xb4d2,0x1495} },
{ {0xbd2b,0x0b1a}, {0x42b1,0x1a7f}, {0xc409,0x3d28}, {0xcd0d,0x6172} }
};
*/

/*
v8int_t chess_storage(VMC) vCoef[] = {
{ 0xff30, 0xde, 0x271, 0x342, 0x2de, 0x133, 0xfead, 0xfc1f },
{ 0xfa91, 0xfaee, 0xfdb6, 0x2cc, 0x96b, 0x104c, 0x15fa, 0x192e },
{ 0x192e, 0x15fa, 0x104c, 0x96b, 0x2cc, 0xfdb6, 0xfaee, 0xfa91 },
{ 0xfc1f, 0xfead, 0x133, 0x2de, 0x342, 0x271, 0xde, 0xff30 }
};

v8int_t chess_storage(VM) vdata[]={


{ 0, 0, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, 0, 0 },
{ 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000 },
{ 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000 },
{ 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000 },
{ 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000 },
{ -10000, -10000, -10000, -10000, -10000, -10000, -10000, -10000 },
{ -10000, -10000, -10000, -10000, -10000, -10000, -10000, -10000 },
{ -10000, -10000, -10000, -10000, -10000, -10000, -10000, -10000 },
{ -10000, -10000, -10000, -10000, -10000, -10000, -10000, -10000 },
{ 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000 },
{ 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000 },
{ 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000 },
{ 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000 },
{ -10000, -10000, -10000, -10000, -10000, -10000, -10000, -10000 },
{ -10000, -10000, -10000, -10000, -10000, -10000, -10000, -10000 },
{ -10000, -10000, -10000, -10000, -10000, -10000, -10000, -10000 },
{ -10000, -10000, -10000, -10000, -10000, -10000, -10000, -10000 },
{ 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000 },
{ 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000 },
{ 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000 },
{ 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000 },
{ -10000, -10000, -10000, -10000, -10000, -10000, -10000, -10000 },
{ -10000, -10000, -10000, -10000, -10000, -10000, -10000, -10000 },
{ -10000, -10000, -10000, -10000, -10000, -10000, -10000, -10000 },
{ -10000, -10000, -10000, -10000, -10000, -10000, -10000, -10000 },
{ 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000 },
{ 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000 },
{ 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000 },
{ 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000 },
{ -10000, -10000, -10000, -10000, -10000, -10000, -10000, -10000 },
{ -10000, -10000, -10000, -10000, -10000, -10000, -10000, -10000 },
{ -10000, -10000, -10000, -10000, -10000, -10000, -10000, -10000 },
{ -10000, -10000, -10000, -10000, -10000, -10000, -10000, -10000 }
};
*/
int findRoot4(int x, int y)
{
if(x < 0)x = -x;
if(y < 0)y = -y;
if (x > y) {
if (x > 2180) return ((15 * (long)x) / 16) + ((15 * (long)y) / 32); //2180 is
about 2^15 / 15
return ((15 * x) / 16) + ((15 * y) / 32);
} else{
if (y > 2180) return (int)(((15 * (long)y) / 16) + ((15 * (long)x) / 32));
return ((15 * y) / 16) + ((15 * x) / 32);
}
}

void fft(int inarr[16],int mags[8] ) {


int atemp, temp, temp0, temp1, temp2, temp3, temp4, temp5, temp6, temp7, temp8;
int temp9,temp10,temp11,temp12,temp13,temp14,temp15;
int outarr[16];

//v8int_t a = test;
v8int_t chess_storage(VMa)* dap = vDataA;
v8int_t va0 = *dap;
v8int_t vb0, vb1, vb2, vb3;
//v4ctransp(va0, va0, va0, va0, vb0, vb1, vb2, vb3);

/*v4cmplx_t chess_storage(VMa:0) vDataA[MAX_N/4] = {


#include XINPUT(SIZE)
};*/
//v4cmplx_t ctest[1] = { {0x57ac,0x745d}, {0xdc85,0x6cea}, {0xe1d2,0x511e},
{0x6c99,0x31c3} };
//v8int_t test = { 0x57ac, 0xdc85, 0xe1d2,0x511e, 0x6c99,0x31c3 };
//v8int_t* a = (v8int_t*) in ;
//v8int_t *b = {1,2,3,4,5,6,7,8};
//v16int_t in[16] = {0x1189, 0xcc82, 0x3198 , 0xfa8e, 0x1189, 0xcc82, 0x3198 ,
0xfa8e};
/*{{0x1189,0x0ba3}, {0xcc82,0x0a64}, {0x3198,0xa57e}, {0xfa8e,0x2e96}},
{{0xa854,0x8ba3}, {0x488b,0x1916}, {0x4a64,0xb5f2}, {0x917f,0x134c}},
{{0xee77,0xf45d}, {0x6115,0xf59c}, {0xce68,0x5a82}, {0xd7db,0xd16a}};*/
//v16int_t input = {1, 2, 3, 4, 5 , 6, 7, 8 ,9 ,10, 11, 12, 13, 14, 15, 16} ;

// v_add_sub( va0, temp1, temp2, temp3, temp4, temp5, temp6, temp7, temp8,
// temp9, temp10, temp11, temp12, temp13, temp14, temp15);

v8int_t chess_storage(VM) * pvin = (v8int_t*) inarr;


v8int_t vdat0 = *pvin;
v8int_t vdat1 = *(pvin + 8);
v8int_t vtemp0 = vconcat_sel(vdat0, vdat1, 1);

//v8int_t vtemp8 = v_add_sub(vdat0, vdat1, 1);


v8int_t vtemp8 = v_add_sub(vdat0, vdat1, 1);

/*
temp0=inarr[0]+inarr[8];
temp1=inarr[1]+inarr[9];
temp2=inarr[2]+inarr[10];
temp3=inarr[3]+inarr[11];
temp4=inarr[4]+inarr[12];
temp5=inarr[5]+inarr[13];
temp6=inarr[6]+inarr[14];
temp7=inarr[7]+inarr[15];*/

/*int temp8=ext_elem(vtemp8,1);
temp9=ext_elem(vtemp8,1);
temp10=ext_elem(vtemp8,2);
temp11=ext_elem(vtemp8,3);
temp12=ext_elem(vtemp8,4);
temp13=ext_elem(vtemp8,5);
temp14=ext_elem(vtemp8,6);
temp15=ext_elem(vtemp8,7);
*/

/*
temp0=inarr[0]+inarr[8];
temp1=inarr[1]+inarr[9];
temp2=inarr[2]+inarr[10];
temp3=inarr[3]+inarr[11];
temp4=inarr[4]+inarr[12];
temp5=inarr[5]+inarr[13];
temp6=inarr[6]+inarr[14];
temp7=inarr[7]+inarr[15];
temp8=inarr[0]-inarr[8];
temp9=inarr[1]-inarr[9];
temp10=inarr[2]-inarr[10];
temp11=inarr[3]-inarr[11];
temp12=inarr[12]-inarr[4];
temp13=inarr[13]-inarr[5];
temp14=inarr[14]-inarr[6];
temp15=inarr[15]-inarr[7];
*/

int puiss = 2 ^ 7; //
temp = ext_elem(vtemp8, 5) + ext_elem(vtemp8, 1); //
temp =(temp13-temp9)*(SIN2PI)/OneTwentyEight; // temp = ext_elem(vtemp8,
5) + ext_elem(vtemp8, 1); //
//temp =(temp13-temp9)*(sin(2*PI/16) * puiss)/OneTwentyEight;

temp9 = ext_elem(vtemp8, 1)*(COS2PI_P_SIN2PI)/OneTwentyEight+temp; //


temp9=temp9*(COS2PI_P_SIN2PI)/OneTwentyEight+temp; // temp9 = ext_elem(vtemp8,
1)*(COS2PI_P_SIN2PI)/OneTwentyEight+temp; //
temp13 = ext_elem(vtemp8, 5)*(COS2PI_M_SIN2PI)/OneTwentyEight+temp; //
temp13=temp13*(COS2PI_M_SIN2PI)/OneTwentyEight+temp; // temp13 =
ext_elem(vtemp8, 5)*(COS2PI_M_SIN2PI)/OneTwentyEight+temp; //
temp10 = ext_elem(vtemp8, 2) * (SIN4PI)/OneTwentyEight;
//temp10 = temp10 * (SIN4PI)/OneTwentyEight; // temp10 =
ext_elem(vtemp8, 2) * (SIN4PI)/OneTwentyEight; //
//temp13=temp13*(COS2PI_M_SIN2PI)/OneTwentyEight+temp;
//temp10 = temp10 * (sin(4*PI/16) * puiss)/OneTwentyEight;

temp14 = ext_elem(vtemp8, 6) * (SIN4PI)/OneTwentyEight; //


temp14 = temp14 * (SIN4PI)/OneTwentyEight; // temp14 =
ext_elem(vtemp8, 6) * (SIN4PI)/OneTwentyEight; //
//temp14 = temp14 * (sin(4*PI/16) * puiss)/OneTwentyEight;

atemp = temp14; //
temp14=temp14-temp10; //
temp10+=atemp; //
temp = (ext_elem(vtemp8, 7) - ext_elem(vtemp8, 3)) * (SIN6PI)/OneTwentyEight; //
temp = (temp15-temp11)*(SIN6PI)/OneTwentyEight; // temp = (ext_elem(vtemp8,
7) - ext_elem(vtemp8, 3)) * (SIN6PI)/OneTwentyEight; //
temp15 = ext_elem(vtemp8, 7) * (COS6PI_P_SIN6PI) / OneTwentyEight + temp; //
temp15=temp15*(COS6PI_P_SIN6PI)/OneTwentyEight+temp; // temp15 =
ext_elem(vtemp8, 7) * (COS6PI_P_SIN6PI) / OneTwentyEight + temp; //
temp11 = ext_elem(vtemp8, 3) * (COS6PI_M_SIN6PI)/OneTwentyEight+temp; //
temp11=temp11*(COS6PI_M_SIN6PI)/OneTwentyEight+temp; // temp11 =
ext_elem(vtemp8, 3) * (COS6PI_M_SIN6PI)/OneTwentyEight+temp; //
atemp = ext_elem(vtemp8, 1); //
atemp = temp8; // atemp = ext_elem(vtemp8,
1); //
temp8+=temp10; //
temp10=atemp-temp10; //
atemp = temp9; //
temp9+=temp11; //
temp11=atemp-temp11;
atemp = ext_elem(vtemp8, 4) ; //
atemp = temp12; // atemp = ext_elem(vtemp8,
4) ; //
temp12+=temp14; //
temp14=atemp-temp14; //
atemp = temp13; //
temp13+=temp15; //
temp15=atemp-temp15; //

outarr[1]=temp8+temp9; //
outarr[3]=temp10-temp15; //
outarr[5]=temp10+temp15; //
outarr[7]=temp8-temp9; //
outarr[9]=temp12+temp13; //
outarr[11]=-temp14-temp11; //
outarr[13]=temp14-temp11; //
outarr[15]=temp13-temp12; //
atemp = ext_elem(vtemp0, 0); //
atemp = temp0; // atemp = ext_elem(vtemp0,
0); //
temp0 = ext_elem(vtemp0, 0) + ext_elem(vtemp0, 4); //
temp0=temp0+temp4; // temp0 = ext_elem(vtemp0,
0) + ext_elem(vtemp0, 4); //
temp4 = atemp - ext_elem(vtemp0, 4); //
temp4=atemp-temp4; // temp4 = atemp -
ext_elem(vtemp0, 4); //
atemp = ext_elem(vtemp0, 1); //
atemp = temp1; // atemp = ext_elem(vtemp0,
1); //
temp1 = ext_elem(vtemp0, 1) + ext_elem(vtemp0, 5); //
temp1=temp1+temp5; // temp1 = ext_elem(vtemp0,
1) + ext_elem(vtemp0, 5); //
temp5 = atemp - ext_elem(vtemp0, 5); //
temp5=atemp-temp5; // temp5 = atemp -
ext_elem(vtemp0, 5); //
atemp = ext_elem(vtemp0, 2); //
atemp = temp2; // atemp = ext_elem(vtemp0,
2); //
temp2 = ext_elem(vtemp0, 3) + ext_elem(vtemp0, 6); //
temp2+=temp6; // temp2 = ext_elem(vtemp0,
3) + ext_elem(vtemp0, 6); //
temp6=atemp-temp6; //
temp6=atemp-temp6; // temp6=atemp-temp6; //
atemp = ext_elem(vtemp0, 3); //
atemp = temp3; // atemp = ext_elem(vtemp0,
3); //
temp3 = ext_elem(vtemp0, 3) + ext_elem(vtemp0, 7) ; //
temp3+=temp7; // temp3 = ext_elem(vtemp0,
3) + ext_elem(vtemp0, 7) ; //
temp7=atemp-temp7;
outarr[0]=temp0+temp2;
outarr[4]=temp0-temp2;
temp1+=temp3;
outarr[12]=(temp3<<1)-temp1;
outarr[0]+=temp1;
outarr[8]=outarr[0]-temp1-temp1;
atemp = temp5 * (SIN4PI)/ OneTwentyEight;
//outarr[8]=outarr[0]-temp1-temp1; atemp = temp5 * (sin(4*PI/16) * puiss)/
OneTwentyEight;

temp7 = temp7 * (SIN4PI)/ OneTwentyEight;


//temp7 = temp7 * (sin(4*PI/16) * puiss)/ OneTwentyEight;

temp5=atemp-temp7;
temp7+=atemp;
outarr[14]=temp6-temp7;
outarr[2]=temp5+temp4; //
outarr[6]=temp4-temp5; //
outarr[10]=-temp7-temp6; // Magnitude calculations
if(outarr[8] > 0) {mags[0] = outarr[8];}
else {mags[0] = -outarr[8];}
mags[1] = findRoot4(outarr[7], outarr[15]);
mags[2] = findRoot4(outarr[6], outarr[14]);
mags[3] = findRoot4(outarr[5], outarr[13]);
mags[4] = findRoot4(outarr[4], outarr[12]);
mags[5] = findRoot4(outarr[3], outarr[11]);
mags[6] = findRoot4(outarr[2], outarr[10]);
mags[7] = findRoot4(outarr[1], outarr[9]); }

int main() {
int mags[8];
int N = 16;
int inarr[16];
for (int i = 0; i < N; i++) {
inarr[i] = i + 1;
}

fft(inarr, mags);
return 0;
}

You might also like