From 51df66257fd037adb96aa66a51908903a068d355 Mon Sep 17 00:00:00 2001 From: Sagar Parsawar Date: Thu, 3 Mar 2022 17:54:00 +0100 Subject: [PATCH] OAI dft/idft support for 768 and 384 --- openair1/PHY/MODULATION/ofdm_mod.c | 8 ++++ openair1/PHY/MODULATION/slot_fep_nr.c | 3 ++ openair1/PHY/NR_UE_TRANSPORT/pss_nr.c | 12 +++++ openair1/PHY/TOOLS/oai_dfts.c | 64 ++++++++++++++++++++++++++- 4 files changed, 85 insertions(+), 2 deletions(-) diff --git a/openair1/PHY/MODULATION/ofdm_mod.c b/openair1/PHY/MODULATION/ofdm_mod.c index 2f075e8218..482c1d5648 100644 --- a/openair1/PHY/MODULATION/ofdm_mod.c +++ b/openair1/PHY/MODULATION/ofdm_mod.c @@ -149,10 +149,18 @@ void PHY_ofdm_mod(int *input, /// pointer to complex input idftsize = IDFT_256; break; + case 384: + idftsize = IDFT_384; + break; + case 512: idftsize = IDFT_512; break; + case 768: + idftsize = IDFT_768; + break; + case 1024: idftsize = IDFT_1024; break; diff --git a/openair1/PHY/MODULATION/slot_fep_nr.c b/openair1/PHY/MODULATION/slot_fep_nr.c index 0dad107da5..232ddffd26 100644 --- a/openair1/PHY/MODULATION/slot_fep_nr.c +++ b/openair1/PHY/MODULATION/slot_fep_nr.c @@ -43,6 +43,9 @@ dft_size_idx_t get_dft_size_idx(uint16_t ofdm_symbol_size) case 256: return DFT_256; + case 384: + return DFT_384; + case 512: return DFT_512; diff --git a/openair1/PHY/NR_UE_TRANSPORT/pss_nr.c b/openair1/PHY/NR_UE_TRANSPORT/pss_nr.c index 857d9a1d45..9c64aa03fd 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/pss_nr.c +++ b/openair1/PHY/NR_UE_TRANSPORT/pss_nr.c @@ -74,6 +74,10 @@ idft_size_idx_t get_idft(int ofdm_symbol_size) return IDFT_256; break; + case 384: + return IDFT_384; + break; + case 512: return IDFT_512; break; @@ -139,10 +143,18 @@ dft_size_idx_t get_dft(int ofdm_symbol_size) return DFT_256; break; + case 384: + return DFT_384; + break; + case 512: return DFT_512; break; + case 768: + return DFT_768; + break; + case 1024: return DFT_1024; break; diff --git a/openair1/PHY/TOOLS/oai_dfts.c b/openair1/PHY/TOOLS/oai_dfts.c index 2d9bb1adb3..51f747be92 100644 --- a/openair1/PHY/TOOLS/oai_dfts.c +++ b/openair1/PHY/TOOLS/oai_dfts.c @@ -8680,6 +8680,7 @@ void dft384(int16_t *x,int16_t *y,unsigned char scale_flag) // 96 x 4 }; + static int16_t twa432[107*2*4]; static int16_t twb432[107*2*4]; static int16_t twc432[107*2*4]; @@ -9059,7 +9060,7 @@ static int16_t twc768[191*2*4]; void dft768(int16_t *x,int16_t *y,unsigned char scale_flag) { // 192x 4; -#if 1 +#if 0 int i,j; simd_q15_t *x128=(simd_q15_t *)x; simd_q15_t *y128=(simd_q15_t *)y; @@ -9162,6 +9163,63 @@ void dft768(int16_t *x,int16_t *y,unsigned char scale_flag) { // 192x 4; } +static int16_t twa384i[95*2*4]; +static int16_t twb384i[95*2*4]; +// 128 x 3 +void idft384(int16_t *input, int16_t *output, unsigned char scale) +{ + int i,i2,j; + uint32_t tmp[3][128]__attribute__((aligned(32))); + uint32_t tmpo[3][128] __attribute__((aligned(32))); + simd_q15_t *y128p=(simd_q15_t*)output; + simd_q15_t ONE_OVER_SQRT3_Q15_128 = set1_int16(ONE_OVER_SQRT3_Q15); + + for (i=0,j=0; i<128; i++) { + tmp[0][i] = ((uint32_t *)input)[j++]; + tmp[1][i] = ((uint32_t *)input)[j++]; + tmp[2][i] = ((uint32_t *)input)[j++]; + } + + idft128((int16_t*)(tmp[0]),(int16_t*)(tmpo[0]),1); + idft128((int16_t*)(tmp[1]),(int16_t*)(tmpo[1]),1); + idft128((int16_t*)(tmp[2]),(int16_t*)(tmpo[2]),1); + + for (i=0,i2=0; i<256; i+=8,i2+=4) { + ibfly3((simd_q15_t*)(&tmpo[0][i2]),(simd_q15_t*)(&tmpo[1][i2]),(simd_q15_t*)(&tmpo[2][i2]), + (simd_q15_t*)(output+i),(simd_q15_t*)(output+256+i),(simd_q15_t*)(output+512+i), + (simd_q15_t*)(twa384+i),(simd_q15_t*)(twb384+i)); + } + + + if (scale==1) { + for (i=0; i<6; i++) { + y128p[0] = mulhi_int16(y128p[0],ONE_OVER_SQRT3_Q15_128); + y128p[1] = mulhi_int16(y128p[1],ONE_OVER_SQRT3_Q15_128); + y128p[2] = mulhi_int16(y128p[2],ONE_OVER_SQRT3_Q15_128); + y128p[3] = mulhi_int16(y128p[3],ONE_OVER_SQRT3_Q15_128); + y128p[4] = mulhi_int16(y128p[4],ONE_OVER_SQRT3_Q15_128); + y128p[5] = mulhi_int16(y128p[5],ONE_OVER_SQRT3_Q15_128); + y128p[6] = mulhi_int16(y128p[6],ONE_OVER_SQRT3_Q15_128); + y128p[7] = mulhi_int16(y128p[7],ONE_OVER_SQRT3_Q15_128); + y128p[8] = mulhi_int16(y128p[8],ONE_OVER_SQRT3_Q15_128); + y128p[9] = mulhi_int16(y128p[9],ONE_OVER_SQRT3_Q15_128); + y128p[10] = mulhi_int16(y128p[10],ONE_OVER_SQRT3_Q15_128); + y128p[11] = mulhi_int16(y128p[11],ONE_OVER_SQRT3_Q15_128); + y128p[12] = mulhi_int16(y128p[12],ONE_OVER_SQRT3_Q15_128); + y128p[13] = mulhi_int16(y128p[13],ONE_OVER_SQRT3_Q15_128); + y128p[14] = mulhi_int16(y128p[14],ONE_OVER_SQRT3_Q15_128); + y128p[15] = mulhi_int16(y128p[15],ONE_OVER_SQRT3_Q15_128); + y128p+=16; + } + } + + _mm_empty(); + _m_empty(); + +} + + + // 256 x 3 void idft768(int16_t *input, int16_t *output, unsigned char scale) { @@ -10669,6 +10727,7 @@ int dfts_autoinit(void) init_rad3_rep(324,twa324,twb324); init_rad3_rep(360,twa360,twb360); init_rad4_rep(384,twa384,twb384,twc384); + init_rad3_rep(384,twa384i,twb384i); init_rad4_rep(432,twa432,twb432,twc432); init_rad4_rep(480,twa480,twb480,twc480); init_rad3_rep(540,twa540,twb540); @@ -10676,7 +10735,8 @@ int dfts_autoinit(void) init_rad2_rep(600,twa600); init_rad3_rep(648,twa648,twb648); init_rad4_rep(720,twa720,twb720,twc720); - init_rad4_rep(768,twa768,twb768,twc768); + //init_rad4_rep(768,twa768,twb768,twc768); + init_rad3_rep(768,twa768,twb768); init_rad3_rep(864,twa864,twb864); init_rad3_rep(900,twa900,twb900); init_rad4_rep(960,twa960,twb960,twc960);