From bd5a8535f162fd443a34da350bb14aae5677de42 Mon Sep 17 00:00:00 2001 From: Raymond Knopp <raymond.knopp@eurecom.fr> Date: Fri, 27 Jul 2018 08:46:00 +0200 Subject: [PATCH] testing of UL dfts. commit before merge --- openair1/PHY/TOOLS/lte_dfts.c | 1464 +++++++-------------------------- 1 file changed, 290 insertions(+), 1174 deletions(-) diff --git a/openair1/PHY/TOOLS/lte_dfts.c b/openair1/PHY/TOOLS/lte_dfts.c index 744902c5ed..6ea44ba20f 100644 --- a/openair1/PHY/TOOLS/lte_dfts.c +++ b/openair1/PHY/TOOLS/lte_dfts.c @@ -8424,1120 +8424,177 @@ void dft240(int16_t *x,int16_t *y,unsigned char scale_flag) } -/* Twiddles generated with -twa = floor(32767*exp(-sqrt(-1)*2*pi*(1:95)/288)); -twb = floor(32767*exp(-sqrt(-1)*2*pi*(2:2:190)/288)); -twa2 = zeros(1,191); -twb2 = zeros(1,191); -twa2(1:2:end) = real(twa); -twa2(2:2:end) = imag(twa); -twb2(1:2:end) = real(twb); -twb2(2:2:end) = imag(twb); - - - */ -static int16_t twa288[760]__attribute__((aligned(32))) = {32759,-714,32759,-714,32759,-714,32759,-714, - 32735,-1429,32735,-1429,32735,-1429,32735,-1429, - 32696,-2143,32696,-2143,32696,-2143,32696,-2143, - 32642,-2855,32642,-2855,32642,-2855,32642,-2855, - 32572,-3567,32572,-3567,32572,-3567,32572,-3567, - 32486,-4276,32486,-4276,32486,-4276,32486,-4276, - 32385,-4984,32385,-4984,32385,-4984,32385,-4984, - 32269,-5689,32269,-5689,32269,-5689,32269,-5689, - 32137,-6392,32137,-6392,32137,-6392,32137,-6392, - 31990,-7092,31990,-7092,31990,-7092,31990,-7092, - 31827,-7788,31827,-7788,31827,-7788,31827,-7788, - 31650,-8480,31650,-8480,31650,-8480,31650,-8480, - 31457,-9169,31457,-9169,31457,-9169,31457,-9169, - 31250,-9853,31250,-9853,31250,-9853,31250,-9853, - 31028,-10532,31028,-10532,31028,-10532,31028,-10532, - 30790,-11206,30790,-11206,30790,-11206,30790,-11206, - 30539,-11876,30539,-11876,30539,-11876,30539,-11876, - 30272,-12539,30272,-12539,30272,-12539,30272,-12539, - 29992,-13196,29992,-13196,29992,-13196,29992,-13196, - 29696,-13847,29696,-13847,29696,-13847,29696,-13847, - 29387,-14492,29387,-14492,29387,-14492,29387,-14492, - 29064,-15130,29064,-15130,29064,-15130,29064,-15130, - 28727,-15760,28727,-15760,28727,-15760,28727,-15760, - 28377,-16383,28377,-16383,28377,-16383,28377,-16383, - 28012,-16998,28012,-16998,28012,-16998,28012,-16998, - 27635,-17605,27635,-17605,27635,-17605,27635,-17605, - 27244,-18204,27244,-18204,27244,-18204,27244,-18204, - 26841,-18794,26841,-18794,26841,-18794,26841,-18794, - 26424,-19375,26424,-19375,26424,-19375,26424,-19375, - 25995,-19947,25995,-19947,25995,-19947,25995,-19947, - 25554,-20509,25554,-20509,25554,-20509,25554,-20509, - 25100,-21062,25100,-21062,25100,-21062,25100,-21062, - 24635,-21604,24635,-21604,24635,-21604,24635,-21604, - 24158,-22137,24158,-22137,24158,-22137,24158,-22137, - 23669,-22658,23669,-22658,23669,-22658,23669,-22658, - 23169,-23169,23169,-23169,23169,-23169,23169,-23169, - 22658,-23669,22658,-23669,22658,-23669,22658,-23669, - 22137,-24158,22137,-24158,22137,-24158,22137,-24158, - 21604,-24635,21604,-24635,21604,-24635,21604,-24635, - 21062,-25100,21062,-25100,21062,-25100,21062,-25100, - 20509,-25554,20509,-25554,20509,-25554,20509,-25554, - 19947,-25995,19947,-25995,19947,-25995,19947,-25995, - 19375,-26424,19375,-26424,19375,-26424,19375,-26424, - 18794,-26841,18794,-26841,18794,-26841,18794,-26841, - 18204,-27244,18204,-27244,18204,-27244,18204,-27244, - 17605,-27635,17605,-27635,17605,-27635,17605,-27635, - 16998,-28012,16998,-28012,16998,-28012,16998,-28012, - 16383,-28377,16383,-28377,16383,-28377,16383,-28377, - 15760,-28727,15760,-28727,15760,-28727,15760,-28727, - 15130,-29064,15130,-29064,15130,-29064,15130,-29064, - 14492,-29387,14492,-29387,14492,-29387,14492,-29387, - 13847,-29696,13847,-29696,13847,-29696,13847,-29696, - 13196,-29992,13196,-29992,13196,-29992,13196,-29992, - 12539,-30272,12539,-30272,12539,-30272,12539,-30272, - 11876,-30539,11876,-30539,11876,-30539,11876,-30539, - 11206,-30790,11206,-30790,11206,-30790,11206,-30790, - 10532,-31028,10532,-31028,10532,-31028,10532,-31028, - 9853,-31250,9853,-31250,9853,-31250,9853,-31250, - 9169,-31457,9169,-31457,9169,-31457,9169,-31457, - 8480,-31650,8480,-31650,8480,-31650,8480,-31650, - 7788,-31827,7788,-31827,7788,-31827,7788,-31827, - 7092,-31990,7092,-31990,7092,-31990,7092,-31990, - 6392,-32137,6392,-32137,6392,-32137,6392,-32137, - 5689,-32269,5689,-32269,5689,-32269,5689,-32269, - 4984,-32385,4984,-32385,4984,-32385,4984,-32385, - 4276,-32486,4276,-32486,4276,-32486,4276,-32486, - 3567,-32572,3567,-32572,3567,-32572,3567,-32572, - 2855,-32642,2855,-32642,2855,-32642,2855,-32642, - 2143,-32696,2143,-32696,2143,-32696,2143,-32696, - 1429,-32735,1429,-32735,1429,-32735,1429,-32735, - 714,-32759,714,-32759,714,-32759,714,-32759, - 0,-32767,0,-32767,0,-32767,0,-32767, - -714,-32759,-714,-32759,-714,-32759,-714,-32759, - -1429,-32735,-1429,-32735,-1429,-32735,-1429,-32735, - -2143,-32696,-2143,-32696,-2143,-32696,-2143,-32696, - -2855,-32642,-2855,-32642,-2855,-32642,-2855,-32642, - -3567,-32572,-3567,-32572,-3567,-32572,-3567,-32572, - -4276,-32486,-4276,-32486,-4276,-32486,-4276,-32486, - -4984,-32385,-4984,-32385,-4984,-32385,-4984,-32385, - -5689,-32269,-5689,-32269,-5689,-32269,-5689,-32269, - -6392,-32137,-6392,-32137,-6392,-32137,-6392,-32137, - -7092,-31990,-7092,-31990,-7092,-31990,-7092,-31990, - -7788,-31827,-7788,-31827,-7788,-31827,-7788,-31827, - -8480,-31650,-8480,-31650,-8480,-31650,-8480,-31650, - -9169,-31457,-9169,-31457,-9169,-31457,-9169,-31457, - -9853,-31250,-9853,-31250,-9853,-31250,-9853,-31250, - -10532,-31028,-10532,-31028,-10532,-31028,-10532,-31028, - -11206,-30790,-11206,-30790,-11206,-30790,-11206,-30790, - -11876,-30539,-11876,-30539,-11876,-30539,-11876,-30539, - -12539,-30272,-12539,-30272,-12539,-30272,-12539,-30272, - -13196,-29992,-13196,-29992,-13196,-29992,-13196,-29992, - -13847,-29696,-13847,-29696,-13847,-29696,-13847,-29696, - -14492,-29387,-14492,-29387,-14492,-29387,-14492,-29387, - -15130,-29064,-15130,-29064,-15130,-29064,-15130,-29064, - -15760,-28727,-15760,-28727,-15760,-28727,-15760,-28727 - }; - -static int16_t twb288[760]__attribute__((aligned(32))) = {32735,-1429,32735,-1429,32735,-1429,32735,-1429, - 32642,-2855,32642,-2855,32642,-2855,32642,-2855, - 32486,-4276,32486,-4276,32486,-4276,32486,-4276, - 32269,-5689,32269,-5689,32269,-5689,32269,-5689, - 31990,-7092,31990,-7092,31990,-7092,31990,-7092, - 31650,-8480,31650,-8480,31650,-8480,31650,-8480, - 31250,-9853,31250,-9853,31250,-9853,31250,-9853, - 30790,-11206,30790,-11206,30790,-11206,30790,-11206, - 30272,-12539,30272,-12539,30272,-12539,30272,-12539, - 29696,-13847,29696,-13847,29696,-13847,29696,-13847, - 29064,-15130,29064,-15130,29064,-15130,29064,-15130, - 28377,-16383,28377,-16383,28377,-16383,28377,-16383, - 27635,-17605,27635,-17605,27635,-17605,27635,-17605, - 26841,-18794,26841,-18794,26841,-18794,26841,-18794, - 25995,-19947,25995,-19947,25995,-19947,25995,-19947, - 25100,-21062,25100,-21062,25100,-21062,25100,-21062, - 24158,-22137,24158,-22137,24158,-22137,24158,-22137, - 23169,-23169,23169,-23169,23169,-23169,23169,-23169, - 22137,-24158,22137,-24158,22137,-24158,22137,-24158, - 21062,-25100,21062,-25100,21062,-25100,21062,-25100, - 19947,-25995,19947,-25995,19947,-25995,19947,-25995, - 18794,-26841,18794,-26841,18794,-26841,18794,-26841, - 17605,-27635,17605,-27635,17605,-27635,17605,-27635, - 16383,-28377,16383,-28377,16383,-28377,16383,-28377, - 15130,-29064,15130,-29064,15130,-29064,15130,-29064, - 13847,-29696,13847,-29696,13847,-29696,13847,-29696, - 12539,-30272,12539,-30272,12539,-30272,12539,-30272, - 11206,-30790,11206,-30790,11206,-30790,11206,-30790, - 9853,-31250,9853,-31250,9853,-31250,9853,-31250, - 8480,-31650,8480,-31650,8480,-31650,8480,-31650, - 7092,-31990,7092,-31990,7092,-31990,7092,-31990, - 5689,-32269,5689,-32269,5689,-32269,5689,-32269, - 4276,-32486,4276,-32486,4276,-32486,4276,-32486, - 2855,-32642,2855,-32642,2855,-32642,2855,-32642, - 1429,-32735,1429,-32735,1429,-32735,1429,-32735, - 0,-32767,0,-32767,0,-32767,0,-32767, - -1429,-32735,-1429,-32735,-1429,-32735,-1429,-32735, - -2855,-32642,-2855,-32642,-2855,-32642,-2855,-32642, - -4276,-32486,-4276,-32486,-4276,-32486,-4276,-32486, - -5689,-32269,-5689,-32269,-5689,-32269,-5689,-32269, - -7092,-31990,-7092,-31990,-7092,-31990,-7092,-31990, - -8480,-31650,-8480,-31650,-8480,-31650,-8480,-31650, - -9853,-31250,-9853,-31250,-9853,-31250,-9853,-31250, - -11206,-30790,-11206,-30790,-11206,-30790,-11206,-30790, - -12539,-30272,-12539,-30272,-12539,-30272,-12539,-30272, - -13847,-29696,-13847,-29696,-13847,-29696,-13847,-29696, - -15130,-29064,-15130,-29064,-15130,-29064,-15130,-29064, - -16383,-28377,-16383,-28377,-16383,-28377,-16383,-28377, - -17605,-27635,-17605,-27635,-17605,-27635,-17605,-27635, - -18794,-26841,-18794,-26841,-18794,-26841,-18794,-26841, - -19947,-25995,-19947,-25995,-19947,-25995,-19947,-25995, - -21062,-25100,-21062,-25100,-21062,-25100,-21062,-25100, - -22137,-24158,-22137,-24158,-22137,-24158,-22137,-24158, - -23169,-23169,-23169,-23169,-23169,-23169,-23169,-23169, - -24158,-22137,-24158,-22137,-24158,-22137,-24158,-22137, - -25100,-21062,-25100,-21062,-25100,-21062,-25100,-21062, - -25995,-19947,-25995,-19947,-25995,-19947,-25995,-19947, - -26841,-18794,-26841,-18794,-26841,-18794,-26841,-18794, - -27635,-17605,-27635,-17605,-27635,-17605,-27635,-17605, - -28377,-16383,-28377,-16383,-28377,-16383,-28377,-16383, - -29064,-15130,-29064,-15130,-29064,-15130,-29064,-15130, - -29696,-13847,-29696,-13847,-29696,-13847,-29696,-13847, - -30272,-12539,-30272,-12539,-30272,-12539,-30272,-12539, - -30790,-11206,-30790,-11206,-30790,-11206,-30790,-11206, - -31250,-9853,-31250,-9853,-31250,-9853,-31250,-9853, - -31650,-8480,-31650,-8480,-31650,-8480,-31650,-8480, - -31990,-7092,-31990,-7092,-31990,-7092,-31990,-7092, - -32269,-5689,-32269,-5689,-32269,-5689,-32269,-5689, - -32486,-4276,-32486,-4276,-32486,-4276,-32486,-4276, - -32642,-2855,-32642,-2855,-32642,-2855,-32642,-2855, - -32735,-1429,-32735,-1429,-32735,-1429,-32735,-1429, - -32767,0,-32767,0,-32767,0,-32767,0, - -32735,1429,-32735,1429,-32735,1429,-32735,1429, - -32642,2855,-32642,2855,-32642,2855,-32642,2855, - -32486,4276,-32486,4276,-32486,4276,-32486,4276, - -32269,5689,-32269,5689,-32269,5689,-32269,5689, - -31990,7092,-31990,7092,-31990,7092,-31990,7092, - -31650,8480,-31650,8480,-31650,8480,-31650,8480, - -31250,9853,-31250,9853,-31250,9853,-31250,9853, - -30790,11206,-30790,11206,-30790,11206,-30790,11206, - -30272,12539,-30272,12539,-30272,12539,-30272,12539, - -29696,13847,-29696,13847,-29696,13847,-29696,13847, - -29064,15130,-29064,15130,-29064,15130,-29064,15130, - -28377,16383,-28377,16383,-28377,16383,-28377,16383, - -27635,17605,-27635,17605,-27635,17605,-27635,17605, - -26841,18794,-26841,18794,-26841,18794,-26841,18794, - -25995,19947,-25995,19947,-25995,19947,-25995,19947, - -25100,21062,-25100,21062,-25100,21062,-25100,21062, - -24158,22137,-24158,22137,-24158,22137,-24158,22137, - -23169,23169,-23169,23169,-23169,23169,-23169,23169, - -22137,24158,-22137,24158,-22137,24158,-22137,24158, - -21062,25100,-21062,25100,-21062,25100,-21062,25100, - -19947,25995,-19947,25995,-19947,25995,-19947,25995, - -18794,26841,-18794,26841,-18794,26841,-18794,26841, - -17605,27635,-17605,27635,-17605,27635,-17605,27635 - }; - -void dft288(int16_t *x,int16_t *y,unsigned char scale_flag) -{ - - int i,j; - simd_q15_t *x128=(simd_q15_t *)x; - simd_q15_t *y128=(simd_q15_t *)y; - simd_q15_t *twa128=(simd_q15_t *)&twa288[0]; - simd_q15_t *twb128=(simd_q15_t *)&twb288[0]; - simd_q15_t x2128[288];// = (simd_q15_t *)&x2128array[0]; - simd_q15_t ytmp128[288];//=&ytmp128array3[0]; - - - - for (i=0,j=0; i<96; i++,j+=3) { - x2128[i] = x128[j]; - x2128[i+96] = x128[j+1]; - x2128[i+192] = x128[j+2]; - } - - dft96((int16_t *)x2128,(int16_t *)ytmp128,1); - dft96((int16_t *)(x2128+96),(int16_t *)(ytmp128+96),1); - dft96((int16_t *)(x2128+192),(int16_t *)(ytmp128+192),1); - - bfly3_tw1(ytmp128,ytmp128+96,ytmp128+192,y128,y128+96,y128+192); - - for (i=1,j=0; i<96; i++,j++) { - bfly3(ytmp128+i, - ytmp128+96+i, - ytmp128+192+i, - y128+i, - y128+96+i, - y128+192+i, - twa128+j, - twb128+j); - } - - if (scale_flag==1) { - norm128 = set1_int16(dft_norm_table[14]); - - for (i=0; i<288; i++) { - y128[i] = mulhi_int16(y128[i],norm128); - } - } - - _mm_empty(); - _m_empty(); - -} - -static int16_t twa300[472]__attribute__((aligned(32))) = {32759,-686,32759,-686,32759,-686,32759,-686, - 32738,-1372,32738,-1372,32738,-1372,32738,-1372, - 32702,-2057,32702,-2057,32702,-2057,32702,-2057, - 32652,-2741,32652,-2741,32652,-2741,32652,-2741, - 32587,-3425,32587,-3425,32587,-3425,32587,-3425, - 32508,-4106,32508,-4106,32508,-4106,32508,-4106, - 32415,-4786,32415,-4786,32415,-4786,32415,-4786, - 32308,-5464,32308,-5464,32308,-5464,32308,-5464, - 32186,-6139,32186,-6139,32186,-6139,32186,-6139, - 32050,-6812,32050,-6812,32050,-6812,32050,-6812, - 31901,-7482,31901,-7482,31901,-7482,31901,-7482, - 31737,-8148,31737,-8148,31737,-8148,31737,-8148, - 31559,-8811,31559,-8811,31559,-8811,31559,-8811, - 31368,-9470,31368,-9470,31368,-9470,31368,-9470, - 31163,-10125,31163,-10125,31163,-10125,31163,-10125, - 30944,-10775,30944,-10775,30944,-10775,30944,-10775, - 30711,-11421,30711,-11421,30711,-11421,30711,-11421, - 30465,-12062,30465,-12062,30465,-12062,30465,-12062, - 30206,-12697,30206,-12697,30206,-12697,30206,-12697, - 29934,-13327,29934,-13327,29934,-13327,29934,-13327, - 29648,-13951,29648,-13951,29648,-13951,29648,-13951, - 29349,-14569,29349,-14569,29349,-14569,29349,-14569, - 29038,-15180,29038,-15180,29038,-15180,29038,-15180, - 28713,-15785,28713,-15785,28713,-15785,28713,-15785, - 28377,-16383,28377,-16383,28377,-16383,28377,-16383, - 28027,-16974,28027,-16974,28027,-16974,28027,-16974, - 27666,-17557,27666,-17557,27666,-17557,27666,-17557, - 27292,-18132,27292,-18132,27292,-18132,27292,-18132, - 26906,-18700,26906,-18700,26906,-18700,26906,-18700, - 26509,-19259,26509,-19259,26509,-19259,26509,-19259, - 26099,-19810,26099,-19810,26099,-19810,26099,-19810, - 25679,-20353,25679,-20353,25679,-20353,25679,-20353, - 25247,-20886,25247,-20886,25247,-20886,25247,-20886, - 24804,-21410,24804,-21410,24804,-21410,24804,-21410, - 24350,-21925,24350,-21925,24350,-21925,24350,-21925, - 23886,-22430,23886,-22430,23886,-22430,23886,-22430, - 23411,-22925,23411,-22925,23411,-22925,23411,-22925, - 22925,-23411,22925,-23411,22925,-23411,22925,-23411, - 22430,-23886,22430,-23886,22430,-23886,22430,-23886, - 21925,-24350,21925,-24350,21925,-24350,21925,-24350, - 21410,-24804,21410,-24804,21410,-24804,21410,-24804, - 20886,-25247,20886,-25247,20886,-25247,20886,-25247, - 20353,-25679,20353,-25679,20353,-25679,20353,-25679, - 19810,-26099,19810,-26099,19810,-26099,19810,-26099, - 19259,-26509,19259,-26509,19259,-26509,19259,-26509, - 18700,-26906,18700,-26906,18700,-26906,18700,-26906, - 18132,-27292,18132,-27292,18132,-27292,18132,-27292, - 17557,-27666,17557,-27666,17557,-27666,17557,-27666, - 16974,-28027,16974,-28027,16974,-28027,16974,-28027, - 16383,-28377,16383,-28377,16383,-28377,16383,-28377, - 15785,-28713,15785,-28713,15785,-28713,15785,-28713, - 15180,-29038,15180,-29038,15180,-29038,15180,-29038, - 14569,-29349,14569,-29349,14569,-29349,14569,-29349, - 13951,-29648,13951,-29648,13951,-29648,13951,-29648, - 13327,-29934,13327,-29934,13327,-29934,13327,-29934, - 12697,-30206,12697,-30206,12697,-30206,12697,-30206, - 12062,-30465,12062,-30465,12062,-30465,12062,-30465, - 11421,-30711,11421,-30711,11421,-30711,11421,-30711, - 10775,-30944,10775,-30944,10775,-30944,10775,-30944 - }; - -static int16_t twb300[472]__attribute__((aligned(32))) = {32738,-1372,32738,-1372,32738,-1372,32738,-1372, - 32652,-2741,32652,-2741,32652,-2741,32652,-2741, - 32508,-4106,32508,-4106,32508,-4106,32508,-4106, - 32308,-5464,32308,-5464,32308,-5464,32308,-5464, - 32050,-6812,32050,-6812,32050,-6812,32050,-6812, - 31737,-8148,31737,-8148,31737,-8148,31737,-8148, - 31368,-9470,31368,-9470,31368,-9470,31368,-9470, - 30944,-10775,30944,-10775,30944,-10775,30944,-10775, - 30465,-12062,30465,-12062,30465,-12062,30465,-12062, - 29934,-13327,29934,-13327,29934,-13327,29934,-13327, - 29349,-14569,29349,-14569,29349,-14569,29349,-14569, - 28713,-15785,28713,-15785,28713,-15785,28713,-15785, - 28027,-16974,28027,-16974,28027,-16974,28027,-16974, - 27292,-18132,27292,-18132,27292,-18132,27292,-18132, - 26509,-19259,26509,-19259,26509,-19259,26509,-19259, - 25679,-20353,25679,-20353,25679,-20353,25679,-20353, - 24804,-21410,24804,-21410,24804,-21410,24804,-21410, - 23886,-22430,23886,-22430,23886,-22430,23886,-22430, - 22925,-23411,22925,-23411,22925,-23411,22925,-23411, - 21925,-24350,21925,-24350,21925,-24350,21925,-24350, - 20886,-25247,20886,-25247,20886,-25247,20886,-25247, - 19810,-26099,19810,-26099,19810,-26099,19810,-26099, - 18700,-26906,18700,-26906,18700,-26906,18700,-26906, - 17557,-27666,17557,-27666,17557,-27666,17557,-27666, - 16383,-28377,16383,-28377,16383,-28377,16383,-28377, - 15180,-29038,15180,-29038,15180,-29038,15180,-29038, - 13951,-29648,13951,-29648,13951,-29648,13951,-29648, - 12697,-30206,12697,-30206,12697,-30206,12697,-30206, - 11421,-30711,11421,-30711,11421,-30711,11421,-30711, - 10125,-31163,10125,-31163,10125,-31163,10125,-31163, - 8811,-31559,8811,-31559,8811,-31559,8811,-31559, - 7482,-31901,7482,-31901,7482,-31901,7482,-31901, - 6139,-32186,6139,-32186,6139,-32186,6139,-32186, - 4786,-32415,4786,-32415,4786,-32415,4786,-32415, - 3425,-32587,3425,-32587,3425,-32587,3425,-32587, - 2057,-32702,2057,-32702,2057,-32702,2057,-32702, - 686,-32759,686,-32759,686,-32759,686,-32759, - -686,-32759,-686,-32759,-686,-32759,-686,-32759, - -2057,-32702,-2057,-32702,-2057,-32702,-2057,-32702, - -3425,-32587,-3425,-32587,-3425,-32587,-3425,-32587, - -4786,-32415,-4786,-32415,-4786,-32415,-4786,-32415, - -6139,-32186,-6139,-32186,-6139,-32186,-6139,-32186, - -7482,-31901,-7482,-31901,-7482,-31901,-7482,-31901, - -8811,-31559,-8811,-31559,-8811,-31559,-8811,-31559, - -10125,-31163,-10125,-31163,-10125,-31163,-10125,-31163, - -11421,-30711,-11421,-30711,-11421,-30711,-11421,-30711, - -12697,-30206,-12697,-30206,-12697,-30206,-12697,-30206, - -13951,-29648,-13951,-29648,-13951,-29648,-13951,-29648, - -15180,-29038,-15180,-29038,-15180,-29038,-15180,-29038, - -16383,-28377,-16383,-28377,-16383,-28377,-16383,-28377, - -17557,-27666,-17557,-27666,-17557,-27666,-17557,-27666, - -18700,-26906,-18700,-26906,-18700,-26906,-18700,-26906, - -19810,-26099,-19810,-26099,-19810,-26099,-19810,-26099, - -20886,-25247,-20886,-25247,-20886,-25247,-20886,-25247, - -21925,-24350,-21925,-24350,-21925,-24350,-21925,-24350, - -22925,-23411,-22925,-23411,-22925,-23411,-22925,-23411, - -23886,-22430,-23886,-22430,-23886,-22430,-23886,-22430, - -24804,-21410,-24804,-21410,-24804,-21410,-24804,-21410, - -25679,-20353,-25679,-20353,-25679,-20353,-25679,-20353 - }; - -static int16_t twc300[472]__attribute__((aligned(32))) = {32702,-2057,32702,-2057,32702,-2057,32702,-2057, - 32508,-4106,32508,-4106,32508,-4106,32508,-4106, - 32186,-6139,32186,-6139,32186,-6139,32186,-6139, - 31737,-8148,31737,-8148,31737,-8148,31737,-8148, - 31163,-10125,31163,-10125,31163,-10125,31163,-10125, - 30465,-12062,30465,-12062,30465,-12062,30465,-12062, - 29648,-13951,29648,-13951,29648,-13951,29648,-13951, - 28713,-15785,28713,-15785,28713,-15785,28713,-15785, - 27666,-17557,27666,-17557,27666,-17557,27666,-17557, - 26509,-19259,26509,-19259,26509,-19259,26509,-19259, - 25247,-20886,25247,-20886,25247,-20886,25247,-20886, - 23886,-22430,23886,-22430,23886,-22430,23886,-22430, - 22430,-23886,22430,-23886,22430,-23886,22430,-23886, - 20886,-25247,20886,-25247,20886,-25247,20886,-25247, - 19259,-26509,19259,-26509,19259,-26509,19259,-26509, - 17557,-27666,17557,-27666,17557,-27666,17557,-27666, - 15785,-28713,15785,-28713,15785,-28713,15785,-28713, - 13951,-29648,13951,-29648,13951,-29648,13951,-29648, - 12062,-30465,12062,-30465,12062,-30465,12062,-30465, - 10125,-31163,10125,-31163,10125,-31163,10125,-31163, - 8148,-31737,8148,-31737,8148,-31737,8148,-31737, - 6139,-32186,6139,-32186,6139,-32186,6139,-32186, - 4106,-32508,4106,-32508,4106,-32508,4106,-32508, - 2057,-32702,2057,-32702,2057,-32702,2057,-32702, - 0,-32767,0,-32767,0,-32767,0,-32767, - -2057,-32702,-2057,-32702,-2057,-32702,-2057,-32702, - -4106,-32508,-4106,-32508,-4106,-32508,-4106,-32508, - -6139,-32186,-6139,-32186,-6139,-32186,-6139,-32186, - -8148,-31737,-8148,-31737,-8148,-31737,-8148,-31737, - -10125,-31163,-10125,-31163,-10125,-31163,-10125,-31163, - -12062,-30465,-12062,-30465,-12062,-30465,-12062,-30465, - -13951,-29648,-13951,-29648,-13951,-29648,-13951,-29648, - -15785,-28713,-15785,-28713,-15785,-28713,-15785,-28713, - -17557,-27666,-17557,-27666,-17557,-27666,-17557,-27666, - -19259,-26509,-19259,-26509,-19259,-26509,-19259,-26509, - -20886,-25247,-20886,-25247,-20886,-25247,-20886,-25247, - -22430,-23886,-22430,-23886,-22430,-23886,-22430,-23886, - -23886,-22430,-23886,-22430,-23886,-22430,-23886,-22430, - -25247,-20886,-25247,-20886,-25247,-20886,-25247,-20886, - -26509,-19259,-26509,-19259,-26509,-19259,-26509,-19259, - -27666,-17557,-27666,-17557,-27666,-17557,-27666,-17557, - -28713,-15785,-28713,-15785,-28713,-15785,-28713,-15785, - -29648,-13951,-29648,-13951,-29648,-13951,-29648,-13951, - -30465,-12062,-30465,-12062,-30465,-12062,-30465,-12062, - -31163,-10125,-31163,-10125,-31163,-10125,-31163,-10125, - -31737,-8148,-31737,-8148,-31737,-8148,-31737,-8148, - -32186,-6139,-32186,-6139,-32186,-6139,-32186,-6139, - -32508,-4106,-32508,-4106,-32508,-4106,-32508,-4106, - -32702,-2057,-32702,-2057,-32702,-2057,-32702,-2057, - -32767,0,-32767,0,-32767,0,-32767,0, - -32702,2057,-32702,2057,-32702,2057,-32702,2057, - -32508,4106,-32508,4106,-32508,4106,-32508,4106, - -32186,6139,-32186,6139,-32186,6139,-32186,6139, - -31737,8148,-31737,8148,-31737,8148,-31737,8148, - -31163,10125,-31163,10125,-31163,10125,-31163,10125, - -30465,12062,-30465,12062,-30465,12062,-30465,12062, - -29648,13951,-29648,13951,-29648,13951,-29648,13951, - -28713,15785,-28713,15785,-28713,15785,-28713,15785, - -27666,17557,-27666,17557,-27666,17557,-27666,17557 - }; - -static int16_t twd300[472]__attribute__((aligned(32))) = {32652,-2741,32652,-2741,32652,-2741,32652,-2741, - 32308,-5464,32308,-5464,32308,-5464,32308,-5464, - 31737,-8148,31737,-8148,31737,-8148,31737,-8148, - 30944,-10775,30944,-10775,30944,-10775,30944,-10775, - 29934,-13327,29934,-13327,29934,-13327,29934,-13327, - 28713,-15785,28713,-15785,28713,-15785,28713,-15785, - 27292,-18132,27292,-18132,27292,-18132,27292,-18132, - 25679,-20353,25679,-20353,25679,-20353,25679,-20353, - 23886,-22430,23886,-22430,23886,-22430,23886,-22430, - 21925,-24350,21925,-24350,21925,-24350,21925,-24350, - 19810,-26099,19810,-26099,19810,-26099,19810,-26099, - 17557,-27666,17557,-27666,17557,-27666,17557,-27666, - 15180,-29038,15180,-29038,15180,-29038,15180,-29038, - 12697,-30206,12697,-30206,12697,-30206,12697,-30206, - 10125,-31163,10125,-31163,10125,-31163,10125,-31163, - 7482,-31901,7482,-31901,7482,-31901,7482,-31901, - 4786,-32415,4786,-32415,4786,-32415,4786,-32415, - 2057,-32702,2057,-32702,2057,-32702,2057,-32702, - -686,-32759,-686,-32759,-686,-32759,-686,-32759, - -3425,-32587,-3425,-32587,-3425,-32587,-3425,-32587, - -6139,-32186,-6139,-32186,-6139,-32186,-6139,-32186, - -8811,-31559,-8811,-31559,-8811,-31559,-8811,-31559, - -11421,-30711,-11421,-30711,-11421,-30711,-11421,-30711, - -13951,-29648,-13951,-29648,-13951,-29648,-13951,-29648, - -16383,-28377,-16383,-28377,-16383,-28377,-16383,-28377, - -18700,-26906,-18700,-26906,-18700,-26906,-18700,-26906, - -20886,-25247,-20886,-25247,-20886,-25247,-20886,-25247, - -22925,-23411,-22925,-23411,-22925,-23411,-22925,-23411, - -24804,-21410,-24804,-21410,-24804,-21410,-24804,-21410, - -26509,-19259,-26509,-19259,-26509,-19259,-26509,-19259, - -28027,-16974,-28027,-16974,-28027,-16974,-28027,-16974, - -29349,-14569,-29349,-14569,-29349,-14569,-29349,-14569, - -30465,-12062,-30465,-12062,-30465,-12062,-30465,-12062, - -31368,-9470,-31368,-9470,-31368,-9470,-31368,-9470, - -32050,-6812,-32050,-6812,-32050,-6812,-32050,-6812, - -32508,-4106,-32508,-4106,-32508,-4106,-32508,-4106, - -32738,-1372,-32738,-1372,-32738,-1372,-32738,-1372, - -32738,1372,-32738,1372,-32738,1372,-32738,1372, - -32508,4106,-32508,4106,-32508,4106,-32508,4106, - -32050,6812,-32050,6812,-32050,6812,-32050,6812, - -31368,9470,-31368,9470,-31368,9470,-31368,9470, - -30465,12062,-30465,12062,-30465,12062,-30465,12062, - -29349,14569,-29349,14569,-29349,14569,-29349,14569, - -28027,16974,-28027,16974,-28027,16974,-28027,16974, - -26509,19259,-26509,19259,-26509,19259,-26509,19259, - -24804,21410,-24804,21410,-24804,21410,-24804,21410, - -22925,23411,-22925,23411,-22925,23411,-22925,23411, - -20886,25247,-20886,25247,-20886,25247,-20886,25247, - -18700,26906,-18700,26906,-18700,26906,-18700,26906, - -16383,28377,-16383,28377,-16383,28377,-16383,28377, - -13951,29648,-13951,29648,-13951,29648,-13951,29648, - -11421,30711,-11421,30711,-11421,30711,-11421,30711, - -8811,31559,-8811,31559,-8811,31559,-8811,31559, - -6139,32186,-6139,32186,-6139,32186,-6139,32186, - -3425,32587,-3425,32587,-3425,32587,-3425,32587, - -686,32759,-686,32759,-686,32759,-686,32759, - 2057,32702,2057,32702,2057,32702,2057,32702, - 4786,32415,4786,32415,4786,32415,4786,32415, - 7482,31901,7482,31901,7482,31901,7482,31901 - }; - -void dft300(int16_t *x,int16_t *y,unsigned char scale_flag) -{ - - int i,j; - simd_q15_t *x128=(simd_q15_t *)x; - simd_q15_t *y128=(simd_q15_t *)y; - simd_q15_t *twa128=(simd_q15_t *)&twa300[0]; - simd_q15_t *twb128=(simd_q15_t *)&twb300[0]; - simd_q15_t *twc128=(simd_q15_t *)&twc300[0]; - simd_q15_t *twd128=(simd_q15_t *)&twd300[0]; - simd_q15_t x2128[300];// = (simd_q15_t *)&x2128array[0]; - simd_q15_t ytmp128[300];//=&ytmp128array2[0]; - - - - for (i=0,j=0; i<60; i++,j+=5) { - x2128[i] = x128[j]; - x2128[i+60] = x128[j+1]; - x2128[i+120] = x128[j+2]; - x2128[i+180] = x128[j+3]; - x2128[i+240] = x128[j+4]; - } - - dft60((int16_t *)x2128,(int16_t *)ytmp128,1); - dft60((int16_t *)(x2128+60),(int16_t *)(ytmp128+60),1); - dft60((int16_t *)(x2128+120),(int16_t *)(ytmp128+120),1); - dft60((int16_t *)(x2128+180),(int16_t *)(ytmp128+180),1); - dft60((int16_t *)(x2128+240),(int16_t *)(ytmp128+240),1); - - bfly5_tw1(ytmp128,ytmp128+60,ytmp128+120,ytmp128+180,ytmp128+240,y128,y128+60,y128+120,y128+180,y128+240); - - for (i=1,j=0; i<60; i++,j++) { - bfly5(ytmp128+i, - ytmp128+60+i, - ytmp128+120+i, - ytmp128+180+i, - ytmp128+240+i, - y128+i, - y128+60+i, - y128+120+i, - y128+180+i, - y128+240+i, - twa128+j, - twb128+j, - twc128+j, - twd128+j); - } - - if (scale_flag==1) { - norm128 = set1_int16(dft_norm_table[15]); - - for (i=0; i<300; i++) { - y128[i] = mulhi_int16(y128[i],norm128); - } - } - - _mm_empty(); - _m_empty(); - -} - -/* Twiddles generated with -twa = floor(32767*exp(-sqrt(-1)*2*pi*(1:107)/324)); -twb = floor(32767*exp(-sqrt(-1)*2*pi*2*(1:107)/324)); -twa2 = zeros(1,2*107); -twb2 = zeros(1,2*107); -twa2(1:2:end) = real(twa); -twa2(2:2:end) = imag(twa); -twb2(1:2:end) = real(twb); -twb2(2:2:end) = imag(twb); -fd=fopen("twiddle_tmp.txt","w"); -fprintf(fd,"static int16_t twa324[107*2*4] = {"); -for i=1:2:(2*106) - fprintf(fd,"%d,%d,%d,%d,%d,%d,%d,%d,\n",twa2(i),twa2(i+1),twa2(i),twa2(i+1),twa2(i),twa2(i+1),twa2(i),twa2(i+1)); -end -i=i+2; -fprintf(fd,"%d,%d,%d,%d,%d,%d,%d,%d};\n",twa2(i),twa2(i+1),twa2(i),twa2(i+1),twa2(i),twa2(i+1),twa2(i),twa2(i+1)); -fprintf(fd,"static int16_t twb324[107*2*4] = {"); -for i=1:2:(2*106) - fprintf(fd,"%d,%d,%d,%d,%d,%d,%d,%d,\n",twb2(i),twb2(i+1),twb2(i),twb2(i+1),twb2(i),twb2(i+1),twb2(i),twb2(i+1)); -end -i=i+2; -fprintf(fd,"%d,%d,%d,%d,%d,%d,%d,%d};\n",twb2(i),twb2(i+1),twb2(i),twb2(i+1),twb2(i),twb2(i+1),twb2(i),twb2(i+1)); -fclose(fd); - */ -static int16_t twa324[107*2*4] = {32760,-636,32760,-636,32760,-636,32760,-636, - 32742,-1271,32742,-1271,32742,-1271,32742,-1271, - 32711,-1906,32711,-1906,32711,-1906,32711,-1906, - 32668,-2540,32668,-2540,32668,-2540,32668,-2540, - 32613,-3173,32613,-3173,32613,-3173,32613,-3173, - 32545,-3805,32545,-3805,32545,-3805,32545,-3805, - 32465,-4435,32465,-4435,32465,-4435,32465,-4435, - 32373,-5064,32373,-5064,32373,-5064,32373,-5064, - 32269,-5690,32269,-5690,32269,-5690,32269,-5690, - 32152,-6315,32152,-6315,32152,-6315,32152,-6315, - 32024,-6937,32024,-6937,32024,-6937,32024,-6937, - 31883,-7557,31883,-7557,31883,-7557,31883,-7557, - 31731,-8174,31731,-8174,31731,-8174,31731,-8174, - 31566,-8788,31566,-8788,31566,-8788,31566,-8788, - 31390,-9398,31390,-9398,31390,-9398,31390,-9398, - 31202,-10005,31202,-10005,31202,-10005,31202,-10005, - 31002,-10608,31002,-10608,31002,-10608,31002,-10608, - 30790,-11207,30790,-11207,30790,-11207,30790,-11207, - 30567,-11802,30567,-11802,30567,-11802,30567,-11802, - 30333,-12393,30333,-12393,30333,-12393,30333,-12393, - 30087,-12979,30087,-12979,30087,-12979,30087,-12979, - 29829,-13560,29829,-13560,29829,-13560,29829,-13560, - 29561,-14136,29561,-14136,29561,-14136,29561,-14136, - 29281,-14706,29281,-14706,29281,-14706,29281,-14706, - 28990,-15271,28990,-15271,28990,-15271,28990,-15271, - 28689,-15831,28689,-15831,28689,-15831,28689,-15831, - 28377,-16384,28377,-16384,28377,-16384,28377,-16384, - 28054,-16931,28054,-16931,28054,-16931,28054,-16931, - 27720,-17472,27720,-17472,27720,-17472,27720,-17472, - 27376,-18006,27376,-18006,27376,-18006,27376,-18006, - 27022,-18534,27022,-18534,27022,-18534,27022,-18534, - 26657,-19054,26657,-19054,26657,-19054,26657,-19054, - 26283,-19568,26283,-19568,26283,-19568,26283,-19568, - 25898,-20074,25898,-20074,25898,-20074,25898,-20074, - 25504,-20572,25504,-20572,25504,-20572,25504,-20572, - 25100,-21063,25100,-21063,25100,-21063,25100,-21063, - 24687,-21546,24687,-21546,24687,-21546,24687,-21546, - 24265,-22020,24265,-22020,24265,-22020,24265,-22020, - 23833,-22487,23833,-22487,23833,-22487,23833,-22487, - 23393,-22945,23393,-22945,23393,-22945,23393,-22945, - 22944,-23394,22944,-23394,22944,-23394,22944,-23394, - 22486,-23834,22486,-23834,22486,-23834,22486,-23834, - 22019,-24266,22019,-24266,22019,-24266,22019,-24266, - 21545,-24688,21545,-24688,21545,-24688,21545,-24688, - 21062,-25101,21062,-25101,21062,-25101,21062,-25101, - 20571,-25505,20571,-25505,20571,-25505,20571,-25505, - 20073,-25899,20073,-25899,20073,-25899,20073,-25899, - 19567,-26284,19567,-26284,19567,-26284,19567,-26284, - 19053,-26658,19053,-26658,19053,-26658,19053,-26658, - 18533,-27023,18533,-27023,18533,-27023,18533,-27023, - 18005,-27377,18005,-27377,18005,-27377,18005,-27377, - 17471,-27721,17471,-27721,17471,-27721,17471,-27721, - 16930,-28055,16930,-28055,16930,-28055,16930,-28055, - 16383,-28378,16383,-28378,16383,-28378,16383,-28378, - 15830,-28690,15830,-28690,15830,-28690,15830,-28690, - 15270,-28991,15270,-28991,15270,-28991,15270,-28991, - 14705,-29282,14705,-29282,14705,-29282,14705,-29282, - 14135,-29562,14135,-29562,14135,-29562,14135,-29562, - 13559,-29830,13559,-29830,13559,-29830,13559,-29830, - 12978,-30088,12978,-30088,12978,-30088,12978,-30088, - 12392,-30334,12392,-30334,12392,-30334,12392,-30334, - 11801,-30568,11801,-30568,11801,-30568,11801,-30568, - 11206,-30791,11206,-30791,11206,-30791,11206,-30791, - 10607,-31003,10607,-31003,10607,-31003,10607,-31003, - 10004,-31203,10004,-31203,10004,-31203,10004,-31203, - 9397,-31391,9397,-31391,9397,-31391,9397,-31391, - 8787,-31567,8787,-31567,8787,-31567,8787,-31567, - 8173,-31732,8173,-31732,8173,-31732,8173,-31732, - 7556,-31884,7556,-31884,7556,-31884,7556,-31884, - 6936,-32025,6936,-32025,6936,-32025,6936,-32025, - 6314,-32153,6314,-32153,6314,-32153,6314,-32153, - 5689,-32270,5689,-32270,5689,-32270,5689,-32270, - 5063,-32374,5063,-32374,5063,-32374,5063,-32374, - 4434,-32466,4434,-32466,4434,-32466,4434,-32466, - 3804,-32546,3804,-32546,3804,-32546,3804,-32546, - 3172,-32614,3172,-32614,3172,-32614,3172,-32614, - 2539,-32669,2539,-32669,2539,-32669,2539,-32669, - 1905,-32712,1905,-32712,1905,-32712,1905,-32712, - 1270,-32743,1270,-32743,1270,-32743,1270,-32743, - 635,-32761,635,-32761,635,-32761,635,-32761, - 0,-32767,0,-32767,0,-32767,0,-32767, - -636,-32761,-636,-32761,-636,-32761,-636,-32761, - -1271,-32743,-1271,-32743,-1271,-32743,-1271,-32743, - -1906,-32712,-1906,-32712,-1906,-32712,-1906,-32712, - -2540,-32669,-2540,-32669,-2540,-32669,-2540,-32669, - -3173,-32614,-3173,-32614,-3173,-32614,-3173,-32614, - -3805,-32546,-3805,-32546,-3805,-32546,-3805,-32546, - -4435,-32466,-4435,-32466,-4435,-32466,-4435,-32466, - -5064,-32374,-5064,-32374,-5064,-32374,-5064,-32374, - -5690,-32270,-5690,-32270,-5690,-32270,-5690,-32270, - -6315,-32153,-6315,-32153,-6315,-32153,-6315,-32153, - -6937,-32025,-6937,-32025,-6937,-32025,-6937,-32025, - -7557,-31884,-7557,-31884,-7557,-31884,-7557,-31884, - -8174,-31732,-8174,-31732,-8174,-31732,-8174,-31732, - -8788,-31567,-8788,-31567,-8788,-31567,-8788,-31567, - -9398,-31391,-9398,-31391,-9398,-31391,-9398,-31391, - -10005,-31203,-10005,-31203,-10005,-31203,-10005,-31203, - -10608,-31003,-10608,-31003,-10608,-31003,-10608,-31003, - -11207,-30791,-11207,-30791,-11207,-30791,-11207,-30791, - -11802,-30568,-11802,-30568,-11802,-30568,-11802,-30568, - -12393,-30334,-12393,-30334,-12393,-30334,-12393,-30334, - -12979,-30088,-12979,-30088,-12979,-30088,-12979,-30088, - -13560,-29830,-13560,-29830,-13560,-29830,-13560,-29830, - -14136,-29562,-14136,-29562,-14136,-29562,-14136,-29562, - -14706,-29282,-14706,-29282,-14706,-29282,-14706,-29282, - -15271,-28991,-15271,-28991,-15271,-28991,-15271,-28991, - -15831,-28690,-15831,-28690,-15831,-28690,-15831,-28690 - }; -static int16_t twb324[107*2*4] = {32742,-1271,32742,-1271,32742,-1271,32742,-1271, - 32668,-2540,32668,-2540,32668,-2540,32668,-2540, - 32545,-3805,32545,-3805,32545,-3805,32545,-3805, - 32373,-5064,32373,-5064,32373,-5064,32373,-5064, - 32152,-6315,32152,-6315,32152,-6315,32152,-6315, - 31883,-7557,31883,-7557,31883,-7557,31883,-7557, - 31566,-8788,31566,-8788,31566,-8788,31566,-8788, - 31202,-10005,31202,-10005,31202,-10005,31202,-10005, - 30790,-11207,30790,-11207,30790,-11207,30790,-11207, - 30333,-12393,30333,-12393,30333,-12393,30333,-12393, - 29829,-13560,29829,-13560,29829,-13560,29829,-13560, - 29281,-14706,29281,-14706,29281,-14706,29281,-14706, - 28689,-15831,28689,-15831,28689,-15831,28689,-15831, - 28054,-16931,28054,-16931,28054,-16931,28054,-16931, - 27376,-18006,27376,-18006,27376,-18006,27376,-18006, - 26657,-19054,26657,-19054,26657,-19054,26657,-19054, - 25898,-20074,25898,-20074,25898,-20074,25898,-20074, - 25100,-21063,25100,-21063,25100,-21063,25100,-21063, - 24265,-22020,24265,-22020,24265,-22020,24265,-22020, - 23393,-22945,23393,-22945,23393,-22945,23393,-22945, - 22486,-23834,22486,-23834,22486,-23834,22486,-23834, - 21545,-24688,21545,-24688,21545,-24688,21545,-24688, - 20571,-25505,20571,-25505,20571,-25505,20571,-25505, - 19567,-26284,19567,-26284,19567,-26284,19567,-26284, - 18533,-27023,18533,-27023,18533,-27023,18533,-27023, - 17471,-27721,17471,-27721,17471,-27721,17471,-27721, - 16383,-28378,16383,-28378,16383,-28378,16383,-28378, - 15270,-28991,15270,-28991,15270,-28991,15270,-28991, - 14135,-29562,14135,-29562,14135,-29562,14135,-29562, - 12978,-30088,12978,-30088,12978,-30088,12978,-30088, - 11801,-30568,11801,-30568,11801,-30568,11801,-30568, - 10607,-31003,10607,-31003,10607,-31003,10607,-31003, - 9397,-31391,9397,-31391,9397,-31391,9397,-31391, - 8173,-31732,8173,-31732,8173,-31732,8173,-31732, - 6936,-32025,6936,-32025,6936,-32025,6936,-32025, - 5689,-32270,5689,-32270,5689,-32270,5689,-32270, - 4434,-32466,4434,-32466,4434,-32466,4434,-32466, - 3172,-32614,3172,-32614,3172,-32614,3172,-32614, - 1905,-32712,1905,-32712,1905,-32712,1905,-32712, - 635,-32761,635,-32761,635,-32761,635,-32761, - -636,-32761,-636,-32761,-636,-32761,-636,-32761, - -1906,-32712,-1906,-32712,-1906,-32712,-1906,-32712, - -3173,-32614,-3173,-32614,-3173,-32614,-3173,-32614, - -4435,-32466,-4435,-32466,-4435,-32466,-4435,-32466, - -5690,-32270,-5690,-32270,-5690,-32270,-5690,-32270, - -6937,-32025,-6937,-32025,-6937,-32025,-6937,-32025, - -8174,-31732,-8174,-31732,-8174,-31732,-8174,-31732, - -9398,-31391,-9398,-31391,-9398,-31391,-9398,-31391, - -10608,-31003,-10608,-31003,-10608,-31003,-10608,-31003, - -11802,-30568,-11802,-30568,-11802,-30568,-11802,-30568, - -12979,-30088,-12979,-30088,-12979,-30088,-12979,-30088, - -14136,-29562,-14136,-29562,-14136,-29562,-14136,-29562, - -15271,-28991,-15271,-28991,-15271,-28991,-15271,-28991, - -16384,-28378,-16384,-28378,-16384,-28378,-16384,-28378, - -17472,-27721,-17472,-27721,-17472,-27721,-17472,-27721, - -18534,-27023,-18534,-27023,-18534,-27023,-18534,-27023, - -19568,-26284,-19568,-26284,-19568,-26284,-19568,-26284, - -20572,-25505,-20572,-25505,-20572,-25505,-20572,-25505, - -21546,-24688,-21546,-24688,-21546,-24688,-21546,-24688, - -22487,-23834,-22487,-23834,-22487,-23834,-22487,-23834, - -23394,-22945,-23394,-22945,-23394,-22945,-23394,-22945, - -24266,-22020,-24266,-22020,-24266,-22020,-24266,-22020, - -25101,-21063,-25101,-21063,-25101,-21063,-25101,-21063, - -25899,-20074,-25899,-20074,-25899,-20074,-25899,-20074, - -26658,-19054,-26658,-19054,-26658,-19054,-26658,-19054, - -27377,-18006,-27377,-18006,-27377,-18006,-27377,-18006, - -28055,-16931,-28055,-16931,-28055,-16931,-28055,-16931, - -28690,-15831,-28690,-15831,-28690,-15831,-28690,-15831, - -29282,-14706,-29282,-14706,-29282,-14706,-29282,-14706, - -29830,-13560,-29830,-13560,-29830,-13560,-29830,-13560, - -30334,-12393,-30334,-12393,-30334,-12393,-30334,-12393, - -30791,-11207,-30791,-11207,-30791,-11207,-30791,-11207, - -31203,-10005,-31203,-10005,-31203,-10005,-31203,-10005, - -31567,-8788,-31567,-8788,-31567,-8788,-31567,-8788, - -31884,-7557,-31884,-7557,-31884,-7557,-31884,-7557, - -32153,-6315,-32153,-6315,-32153,-6315,-32153,-6315, - -32374,-5064,-32374,-5064,-32374,-5064,-32374,-5064, - -32546,-3805,-32546,-3805,-32546,-3805,-32546,-3805, - -32669,-2540,-32669,-2540,-32669,-2540,-32669,-2540, - -32743,-1271,-32743,-1271,-32743,-1271,-32743,-1271, - -32767,-1,-32767,-1,-32767,-1,-32767,-1, - -32743,1270,-32743,1270,-32743,1270,-32743,1270, - -32669,2539,-32669,2539,-32669,2539,-32669,2539, - -32546,3804,-32546,3804,-32546,3804,-32546,3804, - -32374,5063,-32374,5063,-32374,5063,-32374,5063, - -32153,6314,-32153,6314,-32153,6314,-32153,6314, - -31884,7556,-31884,7556,-31884,7556,-31884,7556, - -31567,8787,-31567,8787,-31567,8787,-31567,8787, - -31203,10004,-31203,10004,-31203,10004,-31203,10004, - -30791,11206,-30791,11206,-30791,11206,-30791,11206, - -30334,12392,-30334,12392,-30334,12392,-30334,12392, - -29830,13559,-29830,13559,-29830,13559,-29830,13559, - -29282,14705,-29282,14705,-29282,14705,-29282,14705, - -28690,15830,-28690,15830,-28690,15830,-28690,15830, - -28055,16930,-28055,16930,-28055,16930,-28055,16930, - -27377,18005,-27377,18005,-27377,18005,-27377,18005, - -26658,19053,-26658,19053,-26658,19053,-26658,19053, - -25899,20073,-25899,20073,-25899,20073,-25899,20073, - -25101,21062,-25101,21062,-25101,21062,-25101,21062, - -24266,22019,-24266,22019,-24266,22019,-24266,22019, - -23394,22944,-23394,22944,-23394,22944,-23394,22944, - -22487,23833,-22487,23833,-22487,23833,-22487,23833, - -21546,24687,-21546,24687,-21546,24687,-21546,24687, - -20572,25504,-20572,25504,-20572,25504,-20572,25504, - -19568,26283,-19568,26283,-19568,26283,-19568,26283, - -18534,27022,-18534,27022,-18534,27022,-18534,27022, - -17472,27720,-17472,27720,-17472,27720,-17472,27720 - }; - -void dft324(int16_t *x,int16_t *y,unsigned char scale_flag) // 108 x 3 -{ - int i,j; - simd_q15_t *x128=(simd_q15_t *)x; - simd_q15_t *y128=(simd_q15_t *)y; - simd_q15_t *twa128=(simd_q15_t *)&twa324[0]; - simd_q15_t *twb128=(simd_q15_t *)&twb324[0]; - simd_q15_t x2128[324];// = (simd_q15_t *)&x2128array[0]; - simd_q15_t ytmp128[324];//=&ytmp128array3[0]; - - - - for (i=0,j=0; i<108; i++,j+=3) { - x2128[i] = x128[j]; - x2128[i+108] = x128[j+1]; - x2128[i+216] = x128[j+2]; - } - - dft108((int16_t *)x2128,(int16_t *)ytmp128,1); - dft108((int16_t *)(x2128+108),(int16_t *)(ytmp128+108),1); - dft108((int16_t *)(x2128+216),(int16_t *)(ytmp128+216),1); - - bfly3_tw1(ytmp128,ytmp128+108,ytmp128+216,y128,y128+108,y128+216); - - for (i=1,j=0; i<108; i++,j++) { - bfly3(ytmp128+i, - ytmp128+108+i, - ytmp128+216+i, - y128+i, - y128+108+i, - y128+216+i, - twa128+j, - twb128+j); - } - - if (scale_flag==1) { - norm128 = set1_int16(dft_norm_table[14]); - - for (i=0; i<324; i++) { - y128[i] = mulhi_int16(y128[i],norm128); - } - } - - _mm_empty(); - _m_empty(); - -}; - -/* Twiddles generated with -twa = floor(32767*exp(-sqrt(-1)*2*pi*(1:119)/360)); -twb = floor(32767*exp(-sqrt(-1)*2*pi*2*(1:119)/360)); -twa2 = zeros(1,2*119); -twb2 = zeros(1,2*119); -twa2(1:2:end) = real(twa); -twa2(2:2:end) = imag(twa); -twb2(1:2:end) = real(twb); -twb2(2:2:end) = imag(twb); -fd=fopen("twiddle_tmp.txt","w"); -fprintf(fd,"static int16_t twa360[119*2*4] = {"); -for i=1:2:(2*118) - fprintf(fd,"%d,%d,%d,%d,%d,%d,%d,%d,\n",twa2(i),twa2(i+1),twa2(i),twa2(i+1),twa2(i),twa2(i+1),twa2(i),twa2(i+1)); -end -i=i+2; -fprintf(fd,"%d,%d,%d,%d,%d,%d,%d,%d};\n",twa2(i),twa2(i+1),twa2(i),twa2(i+1),twa2(i),twa2(i+1),twa2(i),twa2(i+1)); -fprintf(fd,"static int16_t twb360[119*2*4] = {"); -for i=1:2:(2*118) - fprintf(fd,"%d,%d,%d,%d,%d,%d,%d,%d,\n",twb2(i),twb2(i+1),twb2(i),twb2(i+1),twb2(i),twb2(i+1),twb2(i),twb2(i+1)); -end -i=i+2; -fprintf(fd,"%d,%d,%d,%d,%d,%d,%d,%d};\n",twb2(i),twb2(i+1),twb2(i),twb2(i+1),twb2(i),twb2(i+1),twb2(i),twb2(i+1)); -fclose(fd); - */ -static int16_t twa360[119*2*4] = {32762,-572,32762,-572,32762,-572,32762,-572, - 32747,-1144,32747,-1144,32747,-1144,32747,-1144, - 32722,-1715,32722,-1715,32722,-1715,32722,-1715, - 32687,-2286,32687,-2286,32687,-2286,32687,-2286, - 32642,-2856,32642,-2856,32642,-2856,32642,-2856, - 32587,-3426,32587,-3426,32587,-3426,32587,-3426, - 32522,-3994,32522,-3994,32522,-3994,32522,-3994, - 32448,-4561,32448,-4561,32448,-4561,32448,-4561, - 32363,-5126,32363,-5126,32363,-5126,32363,-5126, - 32269,-5690,32269,-5690,32269,-5690,32269,-5690, - 32164,-6253,32164,-6253,32164,-6253,32164,-6253, - 32050,-6813,32050,-6813,32050,-6813,32050,-6813, - 31927,-7371,31927,-7371,31927,-7371,31927,-7371, - 31793,-7928,31793,-7928,31793,-7928,31793,-7928, - 31650,-8481,31650,-8481,31650,-8481,31650,-8481, - 31497,-9032,31497,-9032,31497,-9032,31497,-9032, - 31335,-9581,31335,-9581,31335,-9581,31335,-9581, - 31163,-10126,31163,-10126,31163,-10126,31163,-10126, - 30981,-10668,30981,-10668,30981,-10668,30981,-10668, - 30790,-11207,30790,-11207,30790,-11207,30790,-11207, - 30590,-11743,30590,-11743,30590,-11743,30590,-11743, - 30381,-12275,30381,-12275,30381,-12275,30381,-12275, - 30162,-12804,30162,-12804,30162,-12804,30162,-12804, - 29934,-13328,29934,-13328,29934,-13328,29934,-13328, - 29696,-13848,29696,-13848,29696,-13848,29696,-13848, - 29450,-14365,29450,-14365,29450,-14365,29450,-14365, - 29195,-14876,29195,-14876,29195,-14876,29195,-14876, - 28931,-15384,28931,-15384,28931,-15384,28931,-15384, - 28658,-15886,28658,-15886,28658,-15886,28658,-15886, - 28377,-16384,28377,-16384,28377,-16384,28377,-16384, - 28086,-16877,28086,-16877,28086,-16877,28086,-16877, - 27787,-17364,27787,-17364,27787,-17364,27787,-17364, - 27480,-17847,27480,-17847,27480,-17847,27480,-17847, - 27165,-18324,27165,-18324,27165,-18324,27165,-18324, - 26841,-18795,26841,-18795,26841,-18795,26841,-18795, - 26509,-19260,26509,-19260,26509,-19260,26509,-19260, - 26168,-19720,26168,-19720,26168,-19720,26168,-19720, - 25820,-20174,25820,-20174,25820,-20174,25820,-20174, - 25464,-20621,25464,-20621,25464,-20621,25464,-20621, - 25100,-21063,25100,-21063,25100,-21063,25100,-21063, - 24729,-21498,24729,-21498,24729,-21498,24729,-21498, - 24350,-21926,24350,-21926,24350,-21926,24350,-21926, - 23964,-22348,23964,-22348,23964,-22348,23964,-22348, - 23570,-22762,23570,-22762,23570,-22762,23570,-22762, - 23169,-23170,23169,-23170,23169,-23170,23169,-23170, - 22761,-23571,22761,-23571,22761,-23571,22761,-23571, - 22347,-23965,22347,-23965,22347,-23965,22347,-23965, - 21925,-24351,21925,-24351,21925,-24351,21925,-24351, - 21497,-24730,21497,-24730,21497,-24730,21497,-24730, - 21062,-25101,21062,-25101,21062,-25101,21062,-25101, - 20620,-25465,20620,-25465,20620,-25465,20620,-25465, - 20173,-25821,20173,-25821,20173,-25821,20173,-25821, - 19719,-26169,19719,-26169,19719,-26169,19719,-26169, - 19259,-26510,19259,-26510,19259,-26510,19259,-26510, - 18794,-26842,18794,-26842,18794,-26842,18794,-26842, - 18323,-27166,18323,-27166,18323,-27166,18323,-27166, - 17846,-27481,17846,-27481,17846,-27481,17846,-27481, - 17363,-27788,17363,-27788,17363,-27788,17363,-27788, - 16876,-28087,16876,-28087,16876,-28087,16876,-28087, - 16383,-28378,16383,-28378,16383,-28378,16383,-28378, - 15885,-28659,15885,-28659,15885,-28659,15885,-28659, - 15383,-28932,15383,-28932,15383,-28932,15383,-28932, - 14875,-29196,14875,-29196,14875,-29196,14875,-29196, - 14364,-29451,14364,-29451,14364,-29451,14364,-29451, - 13847,-29697,13847,-29697,13847,-29697,13847,-29697, - 13327,-29935,13327,-29935,13327,-29935,13327,-29935, - 12803,-30163,12803,-30163,12803,-30163,12803,-30163, - 12274,-30382,12274,-30382,12274,-30382,12274,-30382, - 11742,-30591,11742,-30591,11742,-30591,11742,-30591, - 11206,-30791,11206,-30791,11206,-30791,11206,-30791, - 10667,-30982,10667,-30982,10667,-30982,10667,-30982, - 10125,-31164,10125,-31164,10125,-31164,10125,-31164, - 9580,-31336,9580,-31336,9580,-31336,9580,-31336, - 9031,-31498,9031,-31498,9031,-31498,9031,-31498, - 8480,-31651,8480,-31651,8480,-31651,8480,-31651, - 7927,-31794,7927,-31794,7927,-31794,7927,-31794, - 7370,-31928,7370,-31928,7370,-31928,7370,-31928, - 6812,-32051,6812,-32051,6812,-32051,6812,-32051, - 6252,-32165,6252,-32165,6252,-32165,6252,-32165, - 5689,-32270,5689,-32270,5689,-32270,5689,-32270, - 5125,-32364,5125,-32364,5125,-32364,5125,-32364, - 4560,-32449,4560,-32449,4560,-32449,4560,-32449, - 3993,-32523,3993,-32523,3993,-32523,3993,-32523, - 3425,-32588,3425,-32588,3425,-32588,3425,-32588, - 2855,-32643,2855,-32643,2855,-32643,2855,-32643, - 2285,-32688,2285,-32688,2285,-32688,2285,-32688, - 1714,-32723,1714,-32723,1714,-32723,1714,-32723, - 1143,-32748,1143,-32748,1143,-32748,1143,-32748, - 571,-32763,571,-32763,571,-32763,571,-32763, - 0,-32767,0,-32767,0,-32767,0,-32767, - -572,-32763,-572,-32763,-572,-32763,-572,-32763, - -1144,-32748,-1144,-32748,-1144,-32748,-1144,-32748, - -1715,-32723,-1715,-32723,-1715,-32723,-1715,-32723, - -2286,-32688,-2286,-32688,-2286,-32688,-2286,-32688, - -2856,-32643,-2856,-32643,-2856,-32643,-2856,-32643, - -3426,-32588,-3426,-32588,-3426,-32588,-3426,-32588, - -3994,-32523,-3994,-32523,-3994,-32523,-3994,-32523, - -4561,-32449,-4561,-32449,-4561,-32449,-4561,-32449, - -5126,-32364,-5126,-32364,-5126,-32364,-5126,-32364, - -5690,-32270,-5690,-32270,-5690,-32270,-5690,-32270, - -6253,-32165,-6253,-32165,-6253,-32165,-6253,-32165, - -6813,-32051,-6813,-32051,-6813,-32051,-6813,-32051, - -7371,-31928,-7371,-31928,-7371,-31928,-7371,-31928, - -7928,-31794,-7928,-31794,-7928,-31794,-7928,-31794, - -8481,-31651,-8481,-31651,-8481,-31651,-8481,-31651, - -9032,-31498,-9032,-31498,-9032,-31498,-9032,-31498, - -9581,-31336,-9581,-31336,-9581,-31336,-9581,-31336, - -10126,-31164,-10126,-31164,-10126,-31164,-10126,-31164, - -10668,-30982,-10668,-30982,-10668,-30982,-10668,-30982, - -11207,-30791,-11207,-30791,-11207,-30791,-11207,-30791, - -11743,-30591,-11743,-30591,-11743,-30591,-11743,-30591, - -12275,-30382,-12275,-30382,-12275,-30382,-12275,-30382, - -12804,-30163,-12804,-30163,-12804,-30163,-12804,-30163, - -13328,-29935,-13328,-29935,-13328,-29935,-13328,-29935, - -13848,-29697,-13848,-29697,-13848,-29697,-13848,-29697, - -14365,-29451,-14365,-29451,-14365,-29451,-14365,-29451, - -14876,-29196,-14876,-29196,-14876,-29196,-14876,-29196, - -15384,-28932,-15384,-28932,-15384,-28932,-15384,-28932, - -15886,-28659,-15886,-28659,-15886,-28659,-15886,-28659 - }; -static int16_t twb360[119*2*4] = {32747,-1144,32747,-1144,32747,-1144,32747,-1144, - 32687,-2286,32687,-2286,32687,-2286,32687,-2286, - 32587,-3426,32587,-3426,32587,-3426,32587,-3426, - 32448,-4561,32448,-4561,32448,-4561,32448,-4561, - 32269,-5690,32269,-5690,32269,-5690,32269,-5690, - 32050,-6813,32050,-6813,32050,-6813,32050,-6813, - 31793,-7928,31793,-7928,31793,-7928,31793,-7928, - 31497,-9032,31497,-9032,31497,-9032,31497,-9032, - 31163,-10126,31163,-10126,31163,-10126,31163,-10126, - 30790,-11207,30790,-11207,30790,-11207,30790,-11207, - 30381,-12275,30381,-12275,30381,-12275,30381,-12275, - 29934,-13328,29934,-13328,29934,-13328,29934,-13328, - 29450,-14365,29450,-14365,29450,-14365,29450,-14365, - 28931,-15384,28931,-15384,28931,-15384,28931,-15384, - 28377,-16384,28377,-16384,28377,-16384,28377,-16384, - 27787,-17364,27787,-17364,27787,-17364,27787,-17364, - 27165,-18324,27165,-18324,27165,-18324,27165,-18324, - 26509,-19260,26509,-19260,26509,-19260,26509,-19260, - 25820,-20174,25820,-20174,25820,-20174,25820,-20174, - 25100,-21063,25100,-21063,25100,-21063,25100,-21063, - 24350,-21926,24350,-21926,24350,-21926,24350,-21926, - 23570,-22762,23570,-22762,23570,-22762,23570,-22762, - 22761,-23571,22761,-23571,22761,-23571,22761,-23571, - 21925,-24351,21925,-24351,21925,-24351,21925,-24351, - 21062,-25101,21062,-25101,21062,-25101,21062,-25101, - 20173,-25821,20173,-25821,20173,-25821,20173,-25821, - 19259,-26510,19259,-26510,19259,-26510,19259,-26510, - 18323,-27166,18323,-27166,18323,-27166,18323,-27166, - 17363,-27788,17363,-27788,17363,-27788,17363,-27788, - 16383,-28378,16383,-28378,16383,-28378,16383,-28378, - 15383,-28932,15383,-28932,15383,-28932,15383,-28932, - 14364,-29451,14364,-29451,14364,-29451,14364,-29451, - 13327,-29935,13327,-29935,13327,-29935,13327,-29935, - 12274,-30382,12274,-30382,12274,-30382,12274,-30382, - 11206,-30791,11206,-30791,11206,-30791,11206,-30791, - 10125,-31164,10125,-31164,10125,-31164,10125,-31164, - 9031,-31498,9031,-31498,9031,-31498,9031,-31498, - 7927,-31794,7927,-31794,7927,-31794,7927,-31794, - 6812,-32051,6812,-32051,6812,-32051,6812,-32051, - 5689,-32270,5689,-32270,5689,-32270,5689,-32270, - 4560,-32449,4560,-32449,4560,-32449,4560,-32449, - 3425,-32588,3425,-32588,3425,-32588,3425,-32588, - 2285,-32688,2285,-32688,2285,-32688,2285,-32688, - 1143,-32748,1143,-32748,1143,-32748,1143,-32748, - 0,-32767,0,-32767,0,-32767,0,-32767, - -1144,-32748,-1144,-32748,-1144,-32748,-1144,-32748, - -2286,-32688,-2286,-32688,-2286,-32688,-2286,-32688, - -3426,-32588,-3426,-32588,-3426,-32588,-3426,-32588, - -4561,-32449,-4561,-32449,-4561,-32449,-4561,-32449, - -5690,-32270,-5690,-32270,-5690,-32270,-5690,-32270, - -6813,-32051,-6813,-32051,-6813,-32051,-6813,-32051, - -7928,-31794,-7928,-31794,-7928,-31794,-7928,-31794, - -9032,-31498,-9032,-31498,-9032,-31498,-9032,-31498, - -10126,-31164,-10126,-31164,-10126,-31164,-10126,-31164, - -11207,-30791,-11207,-30791,-11207,-30791,-11207,-30791, - -12275,-30382,-12275,-30382,-12275,-30382,-12275,-30382, - -13328,-29935,-13328,-29935,-13328,-29935,-13328,-29935, - -14365,-29451,-14365,-29451,-14365,-29451,-14365,-29451, - -15384,-28932,-15384,-28932,-15384,-28932,-15384,-28932, - -16384,-28378,-16384,-28378,-16384,-28378,-16384,-28378, - -17364,-27788,-17364,-27788,-17364,-27788,-17364,-27788, - -18324,-27166,-18324,-27166,-18324,-27166,-18324,-27166, - -19260,-26510,-19260,-26510,-19260,-26510,-19260,-26510, - -20174,-25821,-20174,-25821,-20174,-25821,-20174,-25821, - -21063,-25101,-21063,-25101,-21063,-25101,-21063,-25101, - -21926,-24351,-21926,-24351,-21926,-24351,-21926,-24351, - -22762,-23571,-22762,-23571,-22762,-23571,-22762,-23571, - -23571,-22762,-23571,-22762,-23571,-22762,-23571,-22762, - -24351,-21926,-24351,-21926,-24351,-21926,-24351,-21926, - -25101,-21063,-25101,-21063,-25101,-21063,-25101,-21063, - -25821,-20174,-25821,-20174,-25821,-20174,-25821,-20174, - -26510,-19260,-26510,-19260,-26510,-19260,-26510,-19260, - -27166,-18324,-27166,-18324,-27166,-18324,-27166,-18324, - -27788,-17364,-27788,-17364,-27788,-17364,-27788,-17364, - -28378,-16384,-28378,-16384,-28378,-16384,-28378,-16384, - -28932,-15384,-28932,-15384,-28932,-15384,-28932,-15384, - -29451,-14365,-29451,-14365,-29451,-14365,-29451,-14365, - -29935,-13328,-29935,-13328,-29935,-13328,-29935,-13328, - -30382,-12275,-30382,-12275,-30382,-12275,-30382,-12275, - -30791,-11207,-30791,-11207,-30791,-11207,-30791,-11207, - -31164,-10126,-31164,-10126,-31164,-10126,-31164,-10126, - -31498,-9032,-31498,-9032,-31498,-9032,-31498,-9032, - -31794,-7928,-31794,-7928,-31794,-7928,-31794,-7928, - -32051,-6813,-32051,-6813,-32051,-6813,-32051,-6813, - -32270,-5690,-32270,-5690,-32270,-5690,-32270,-5690, - -32449,-4561,-32449,-4561,-32449,-4561,-32449,-4561, - -32588,-3426,-32588,-3426,-32588,-3426,-32588,-3426, - -32688,-2286,-32688,-2286,-32688,-2286,-32688,-2286, - -32748,-1144,-32748,-1144,-32748,-1144,-32748,-1144, - -32767,-1,-32767,-1,-32767,-1,-32767,-1, - -32748,1143,-32748,1143,-32748,1143,-32748,1143, - -32688,2285,-32688,2285,-32688,2285,-32688,2285, - -32588,3425,-32588,3425,-32588,3425,-32588,3425, - -32449,4560,-32449,4560,-32449,4560,-32449,4560, - -32270,5689,-32270,5689,-32270,5689,-32270,5689, - -32051,6812,-32051,6812,-32051,6812,-32051,6812, - -31794,7927,-31794,7927,-31794,7927,-31794,7927, - -31498,9031,-31498,9031,-31498,9031,-31498,9031, - -31164,10125,-31164,10125,-31164,10125,-31164,10125, - -30791,11206,-30791,11206,-30791,11206,-30791,11206, - -30382,12274,-30382,12274,-30382,12274,-30382,12274, - -29935,13327,-29935,13327,-29935,13327,-29935,13327, - -29451,14364,-29451,14364,-29451,14364,-29451,14364, - -28932,15383,-28932,15383,-28932,15383,-28932,15383, - -28378,16383,-28378,16383,-28378,16383,-28378,16383, - -27788,17363,-27788,17363,-27788,17363,-27788,17363, - -27166,18323,-27166,18323,-27166,18323,-27166,18323, - -26510,19259,-26510,19259,-26510,19259,-26510,19259, - -25821,20173,-25821,20173,-25821,20173,-25821,20173, - -25101,21062,-25101,21062,-25101,21062,-25101,21062, - -24351,21925,-24351,21925,-24351,21925,-24351,21925, - -23571,22761,-23571,22761,-23571,22761,-23571,22761, - -22762,23570,-22762,23570,-22762,23570,-22762,23570, - -21926,24350,-21926,24350,-21926,24350,-21926,24350, - -21063,25100,-21063,25100,-21063,25100,-21063,25100, - -20174,25820,-20174,25820,-20174,25820,-20174,25820, - -19260,26509,-19260,26509,-19260,26509,-19260,26509, - -18324,27165,-18324,27165,-18324,27165,-18324,27165, - -17364,27787,-17364,27787,-17364,27787,-17364,27787 - }; +static int16_t twa288[760]__attribute__((aligned(32))); +static int16_t twb288[760]__attribute__((aligned(32))); + +void dft288(int16_t *x,int16_t *y,unsigned char scale_flag) +{ + + int i,j; + simd_q15_t *x128=(simd_q15_t *)x; + simd_q15_t *y128=(simd_q15_t *)y; + simd_q15_t *twa128=(simd_q15_t *)&twa288[0]; + simd_q15_t *twb128=(simd_q15_t *)&twb288[0]; + simd_q15_t x2128[288];// = (simd_q15_t *)&x2128array[0]; + simd_q15_t ytmp128[288];//=&ytmp128array3[0]; + + + + for (i=0,j=0; i<96; i++,j+=3) { + x2128[i] = x128[j]; + x2128[i+96] = x128[j+1]; + x2128[i+192] = x128[j+2]; + } + + dft96((int16_t *)x2128,(int16_t *)ytmp128,1); + dft96((int16_t *)(x2128+96),(int16_t *)(ytmp128+96),1); + dft96((int16_t *)(x2128+192),(int16_t *)(ytmp128+192),1); + + bfly3_tw1(ytmp128,ytmp128+96,ytmp128+192,y128,y128+96,y128+192); + + for (i=1,j=0; i<96; i++,j++) { + bfly3(ytmp128+i, + ytmp128+96+i, + ytmp128+192+i, + y128+i, + y128+96+i, + y128+192+i, + twa128+j, + twb128+j); + } + + if (scale_flag==1) { + norm128 = set1_int16(dft_norm_table[14]); + + for (i=0; i<288; i++) { + y128[i] = mulhi_int16(y128[i],norm128); + } + } + + _mm_empty(); + _m_empty(); + +} + +static int16_t twa300[472]__attribute__((aligned(32))); +static int16_t twb300[472]__attribute__((aligned(32))); +static int16_t twc300[472]__attribute__((aligned(32))); +static int16_t twd300[472]__attribute__((aligned(32))); + +void dft300(int16_t *x,int16_t *y,unsigned char scale_flag) +{ + + int i,j; + simd_q15_t *x128=(simd_q15_t *)x; + simd_q15_t *y128=(simd_q15_t *)y; + simd_q15_t *twa128=(simd_q15_t *)&twa300[0]; + simd_q15_t *twb128=(simd_q15_t *)&twb300[0]; + simd_q15_t *twc128=(simd_q15_t *)&twc300[0]; + simd_q15_t *twd128=(simd_q15_t *)&twd300[0]; + simd_q15_t x2128[300];// = (simd_q15_t *)&x2128array[0]; + simd_q15_t ytmp128[300];//=&ytmp128array2[0]; + + + + for (i=0,j=0; i<60; i++,j+=5) { + x2128[i] = x128[j]; + x2128[i+60] = x128[j+1]; + x2128[i+120] = x128[j+2]; + x2128[i+180] = x128[j+3]; + x2128[i+240] = x128[j+4]; + } + + dft60((int16_t *)x2128,(int16_t *)ytmp128,1); + dft60((int16_t *)(x2128+60),(int16_t *)(ytmp128+60),1); + dft60((int16_t *)(x2128+120),(int16_t *)(ytmp128+120),1); + dft60((int16_t *)(x2128+180),(int16_t *)(ytmp128+180),1); + dft60((int16_t *)(x2128+240),(int16_t *)(ytmp128+240),1); + + bfly5_tw1(ytmp128,ytmp128+60,ytmp128+120,ytmp128+180,ytmp128+240,y128,y128+60,y128+120,y128+180,y128+240); + + for (i=1,j=0; i<60; i++,j++) { + bfly5(ytmp128+i, + ytmp128+60+i, + ytmp128+120+i, + ytmp128+180+i, + ytmp128+240+i, + y128+i, + y128+60+i, + y128+120+i, + y128+180+i, + y128+240+i, + twa128+j, + twb128+j, + twc128+j, + twd128+j); + } + + if (scale_flag==1) { + norm128 = set1_int16(dft_norm_table[15]); + + for (i=0; i<300; i++) { + y128[i] = mulhi_int16(y128[i],norm128); + } + } + + _mm_empty(); + _m_empty(); +} + +static int16_t twa324[107*2*4]; +static int16_t twb324[107*2*4]; + +void dft324(int16_t *x,int16_t *y,unsigned char scale_flag) // 108 x 3 +{ + int i,j; + simd_q15_t *x128=(simd_q15_t *)x; + simd_q15_t *y128=(simd_q15_t *)y; + simd_q15_t *twa128=(simd_q15_t *)&twa324[0]; + simd_q15_t *twb128=(simd_q15_t *)&twb324[0]; + simd_q15_t x2128[324];// = (simd_q15_t *)&x2128array[0]; + simd_q15_t ytmp128[324];//=&ytmp128array3[0]; + + + + for (i=0,j=0; i<108; i++,j+=3) { + x2128[i] = x128[j]; + x2128[i+108] = x128[j+1]; + x2128[i+216] = x128[j+2]; + } + + dft108((int16_t *)x2128,(int16_t *)ytmp128,1); + dft108((int16_t *)(x2128+108),(int16_t *)(ytmp128+108),1); + dft108((int16_t *)(x2128+216),(int16_t *)(ytmp128+216),1); + + bfly3_tw1(ytmp128,ytmp128+108,ytmp128+216,y128,y128+108,y128+216); + + for (i=1,j=0; i<108; i++,j++) { + bfly3(ytmp128+i, + ytmp128+108+i, + ytmp128+216+i, + y128+i, + y128+108+i, + y128+216+i, + twa128+j, + twb128+j); + } + + if (scale_flag==1) { + norm128 = set1_int16(dft_norm_table[14]); + + for (i=0; i<324; i++) { + y128[i] = mulhi_int16(y128[i],norm128); + } + } + + _mm_empty(); + _m_empty(); + +}; + +static int16_t twa360[119*2*4]; +static int16_t twb360[119*2*4]; void dft360(int16_t *x,int16_t *y,unsigned char scale_flag) // 120 x 3 { @@ -9587,41 +8644,6 @@ void dft360(int16_t *x,int16_t *y,unsigned char scale_flag) // 120 x 3 }; -/* Twiddles generated with -twa = floor(32767*exp(-sqrt(-1)*2*pi*(1:95)/384)); -twb = floor(32767*exp(-sqrt(-1)*2*pi*2*(1:95)/384)); -twc = floor(32767*exp(-sqrt(-1)*2*pi*3*(1:95)/384)); -twa2 = zeros(1,2*95); -twb2 = zeros(1,2*95); -twc2 = zeros(1,2*95); -twa2(1:2:end) = real(twa); -twa2(2:2:end) = imag(twa); -twb2(1:2:end) = real(twb); -twb2(2:2:end) = imag(twb); -twc2(1:2:end) = real(twc); -twc2(2:2:end) = imag(twc); -fd=fopen("twiddle_tmp.txt","w"); -fprintf(fd,"static int16_t twa384[95*2*4] = {"); -for i=1:2:(2*94) - fprintf(fd,"%d,%d,%d,%d,%d,%d,%d,%d,\n",twa2(i),twa2(i+1),twa2(i),twa2(i+1),twa2(i),twa2(i+1),twa2(i),twa2(i+1)); -end -i=i+2; -fprintf(fd,"%d,%d,%d,%d,%d,%d,%d,%d};\n",twa2(i),twa2(i+1),twa2(i),twa2(i+1),twa2(i),twa2(i+1),twa2(i),twa2(i+1)); -fprintf(fd,"static int16_t twb384[95*2*4] = {"); -for i=1:2:(2*94) - fprintf(fd,"%d,%d,%d,%d,%d,%d,%d,%d,\n",twb2(i),twb2(i+1),twb2(i),twb2(i+1),twb2(i),twb2(i+1),twb2(i),twb2(i+1)); -end -i=i+2; -fprintf(fd,"%d,%d,%d,%d,%d,%d,%d,%d};\n",twb2(i),twb2(i+1),twb2(i),twb2(i+1),twb2(i),twb2(i+1),twb2(i),twb2(i+1)); -fprintf(fd,"static int16_t twc384[95*2*4] = {"); -for i=1:2:(2*94) - fprintf(fd,"%d,%d,%d,%d,%d,%d,%d,%d,\n",twc2(i),twc2(i+1),twc2(i),twc2(i+1),twc2(i),twc2(i+1),twc2(i),twc2(i+1)); -end -i=i+2; -fprintf(fd,"%d,%d,%d,%d,%d,%d,%d,%d};\n",twc2(i),twc2(i+1),twc2(i),twc2(i+1),twc2(i),twc2(i+1),twc2(i),twc2(i+1)); -fclose(fd); - */ - static int16_t twa384[95*2*4] = {32762,-537,32762,-537,32762,-537,32762,-537, 32749,-1073,32749,-1073,32749,-1073,32749,-1073, 32727,-1608,32727,-1608,32727,-1608,32727,-1608, @@ -18810,13 +17832,13 @@ void init_rad4_rep(int N,int16_t *twa,int16_t *twb,int16_t *twc) { int i,j; - for (i=1;i<(N/4)-1;i++) { - *twa = (int16_t)round(32767.0*cos(2*M_PI*i/N)); - *twa = -(int16_t)round(32767.0*sin(2*M_PI*i/N)); - *twb = (int16_t)round(32767.0*cos(2*M_PI*2*i/N)); - *twb = -(int16_t)round(32767.0*sin(2*M_PI*2*i/N)); - *twc = (int16_t)round(32767.0*cos(2*M_PI*3*i/N)); - *twc = -(int16_t)round(32767.0*sin(2*M_PI*3*i/N)); + for (i=1;i<(N/4);i++) { + twa[0] = (int16_t)round(32767.0*cos(2*M_PI*i/N)); + twa[1] = -(int16_t)round(32767.0*sin(2*M_PI*i/N)); + twb[0] = (int16_t)round(32767.0*cos(2*M_PI*2*i/N)); + twb[1] = -(int16_t)round(32767.0*sin(2*M_PI*2*i/N)); + twc[0] = (int16_t)round(32767.0*cos(2*M_PI*3*i/N)); + twc[1] = -(int16_t)round(32767.0*sin(2*M_PI*3*i/N)); for (j=1;j<4;j++) { ((int32_t*)twa)[j]=((int32_t*)twa)[0]; ((int32_t*)twb)[j]=((int32_t*)twb)[0]; @@ -18843,9 +17865,9 @@ void init_rad2_rep(int N,int16_t *twa) { int i,j; - for (i=1;i<(N/2)-1;i++) { - *twa = (int16_t)round(32767.0*cos(2*M_PI*i/N)); - *twa = -(int16_t)round(32767.0*sin(2*M_PI*i/N)); + for (i=1;i<(N/2);i++) { + twa[0] = (int16_t)round(32767.0*cos(2*M_PI*i/N)); + twa[1] = -(int16_t)round(32767.0*sin(2*M_PI*i/N)); for (j=1;j<4;j++) { ((int32_t*)twa)[j]=((int32_t*)twa)[0]; } @@ -18869,11 +17891,11 @@ void init_rad3_rep(int N,int16_t *twa,int16_t *twb) { int i,j; - for (i=1;i<(N/3)-1;i++) { - *twa = (int16_t)round(32767.0*cos(2*M_PI*i/N)); - *twa = -(int16_t)round(32767.0*sin(2*M_PI*i/N)); - *twb = (int16_t)round(32767.0*cos(2*M_PI*2*i/N)); - *twb = -(int16_t)round(32767.0*sin(2*M_PI*2*i/N)); + for (i=1;i<(N/3);i++) { + twa[0] = (int16_t)round(32767.0*cos(2*M_PI*i/N)); + twa[1] = -(int16_t)round(32767.0*sin(2*M_PI*i/N)); + twb[0] = (int16_t)round(32767.0*cos(2*M_PI*2*i/N)); + twb[1] = -(int16_t)round(32767.0*sin(2*M_PI*2*i/N)); for (j=1;j<4;j++) { ((int32_t*)twa)[j]=((int32_t*)twa)[0]; ((int32_t*)twb)[j]=((int32_t*)twb)[0]; @@ -18887,17 +17909,15 @@ void init_rad5_rep(int N,int16_t *twa,int16_t *twb,int16_t *twc,int16_t *twd) { int i,j; - for (i=1;i<(N/5)-1;i++) { - *twa = (int16_t)round(32767.0*cos(2*M_PI*i/N)); - *twa = -(int16_t)round(32767.0*sin(2*M_PI*i/N)); - *twb = (int16_t)round(32767.0*cos(2*M_PI*2*i/N)); - *twb = -(int16_t)round(32767.0*sin(2*M_PI*2*i/N)); - *twb = (int16_t)round(32767.0*cos(2*M_PI*3*i/N)); - *twb = -(int16_t)round(32767.0*sin(2*M_PI*3*i/N)); - *twc = (int16_t)round(32767.0*cos(2*M_PI*3*i/N)); - *twc = -(int16_t)round(32767.0*sin(2*M_PI*3*i/N)); - *twd = (int16_t)round(32767.0*cos(2*M_PI*4*i/N)); - *twd = -(int16_t)round(32767.0*sin(2*M_PI*4*i/N)); + for (i=1;i<(N/5);i++) { + twa[0] = (int16_t)round(32767.0*cos(2*M_PI*i/N)); + twa[1] = -(int16_t)round(32767.0*sin(2*M_PI*i/N)); + twb[0] = (int16_t)round(32767.0*cos(2*M_PI*2*i/N)); + twb[1] = -(int16_t)round(32767.0*sin(2*M_PI*2*i/N)); + twc[0] = (int16_t)round(32767.0*cos(2*M_PI*3*i/N)); + twc[1] = -(int16_t)round(32767.0*sin(2*M_PI*3*i/N)); + twd[0] = (int16_t)round(32767.0*cos(2*M_PI*4*i/N)); + twd[1] = -(int16_t)round(32767.0*sin(2*M_PI*4*i/N)); for (j=1;j<4;j++) { ((int32_t*)twa)[j]=((int32_t*)twa)[0]; ((int32_t*)twb)[j]=((int32_t*)twb)[0]; @@ -19895,6 +18915,102 @@ int main(int argc, char**argv) LOG_M("y24576.m","y24576",y,24576,1,1); LOG_M("x24576.m","x24576",x,24576,1,1); + // 4x288-point DFT + memset((void*)x,0,288*8*sizeof(int16_t)); + for (i=0;i<288*8;i+=8) { + if ((taus() & 1)==0) + ((int16_t*)x)[i] = 364; + else + ((int16_t*)x)[i] = -364; + if ((taus() & 1)==0) + ((int16_t*)x)[i+1] = 364; + else + ((int16_t*)x)[i+1] = -364; + } + + reset_meas(&ts); + for (i=0; i<10000; i++) { + start_meas(&ts); + dft288((int16_t *)x,(int16_t *)y,1); + stop_meas(&ts); + } + + printf("\n\n4x288-point(%f cycles)\n",(double)ts.diff/(double)ts.trials); + LOG_M("y288.m","y288",y,288*4,1,1); + LOG_M("x288.m","x288",x,288*4,1,1); + + // 4x300-point DFT + memset((void*)x,0,300*8*sizeof(int16_t)); + for (i=0;i<300*8;i+=8) { + if ((taus() & 1)==0) + ((int16_t*)x)[i] = 364; + else + ((int16_t*)x)[i] = -364; + if ((taus() & 1)==0) + ((int16_t*)x)[i+1] = 364; + else + ((int16_t*)x)[i+1] = -364; + } + + reset_meas(&ts); + for (i=0; i<10000; i++) { + start_meas(&ts); + dft300((int16_t *)x,(int16_t *)y,1); + stop_meas(&ts); + } + + printf("\n\n4x300-point(%f cycles)\n",(double)ts.diff/(double)ts.trials); + LOG_M("y300.m","y300",y,300*4,1,1); + LOG_M("x300.m","x300",x,300*4,1,1); + + // 4x324-point DFT + memset((void*)x,0,324*8*sizeof(int16_t)); + for (i=0;i<324*8;i+=8) { + if ((taus() & 1)==0) + ((int16_t*)x)[i] = 364; + else + ((int16_t*)x)[i] = -364; + if ((taus() & 1)==0) + ((int16_t*)x)[i+1] = 364; + else + ((int16_t*)x)[i+1] = -364; + } + + reset_meas(&ts); + for (i=0; i<10000; i++) { + start_meas(&ts); + dft324((int16_t *)x,(int16_t *)y,1); + stop_meas(&ts); + } + + printf("\n\n4x324-point(%f cycles)\n",(double)ts.diff/(double)ts.trials); + LOG_M("y324.m","y324",y,324*4,1,1); + LOG_M("x324.m","x324",x,324*4,1,1); + + // 4x360-point DFT + memset((void*)x,0,360*8*sizeof(int16_t)); + for (i=0;i<360*8;i+=8) { + if ((taus() & 1)==0) + ((int16_t*)x)[i] = 364; + else + ((int16_t*)x)[i] = -364; + if ((taus() & 1)==0) + ((int16_t*)x)[i+1] = 364; + else + ((int16_t*)x)[i+1] = -364; + } + + reset_meas(&ts); + for (i=0; i<10000; i++) { + start_meas(&ts); + dft360((int16_t *)x,(int16_t *)y,1); + stop_meas(&ts); + } + + printf("\n\n4x360-point(%f cycles)\n",(double)ts.diff/(double)ts.trials); + LOG_M("y360.m","y360",y,360*4,1,1); + LOG_M("x360.m","x360",x,360*4,1,1); + return(0); } -- 2.26.2