From b8b2edb3a9e23c4f824ad4da3dc13fa98e07e944 Mon Sep 17 00:00:00 2001
From: Raymond Knopp <raymond.knopp@eurecom.fr>
Date: Sat, 3 Sep 2016 12:52:28 -0700
Subject: [PATCH] updates in ulsim for new multipath_channel declaration. Small
 optimization in dlsch_modulation.c

---
 openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c | 29 ++++++++++++++++-
 openair1/SIMULATION/LTE_PHY/ulsim.c           | 31 +------------------
 2 files changed, 29 insertions(+), 31 deletions(-)

diff --git a/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c b/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c
index 034dc0ada8..48b3f53be4 100644
--- a/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c
+++ b/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c
@@ -328,7 +328,7 @@ int allocate_REs_in_RB_no_pilots_64QAM_siso(LTE_DL_FRAME_PARMS *frame_parms,
 
     for (x0p=&x0[*jj],tti_offset=symbol_offset+re_offset,re=0; 
 	 re<12; 
-	 re++,x0p+=6,tti_offset++) {
+	 re+=4,x0p+=24,tti_offset+=4) {
       
       qam64_table_offset_re=FOUR[x0p[0]];
       qam64_table_offset_im=FOUR[x0p[1]];
@@ -338,6 +338,33 @@ int allocate_REs_in_RB_no_pilots_64QAM_siso(LTE_DL_FRAME_PARMS *frame_parms,
       qam64_table_offset_im+=x0p[5];
       ((int16_t *)&txdataF[0][tti_offset])[0]=qam_table_s0[qam64_table_offset_re];
       ((int16_t *)&txdataF[0][tti_offset])[1]=qam_table_s0[qam64_table_offset_im];
+
+      qam64_table_offset_re=FOUR[x0p[6]];
+      qam64_table_offset_im=FOUR[x0p[7]];
+      qam64_table_offset_re+=TWO[x0p[8]];
+      qam64_table_offset_im+=TWO[x0p[9]];
+      qam64_table_offset_re+=x0p[10];
+      qam64_table_offset_im+=x0p[11];
+      ((int16_t *)&txdataF[0][tti_offset])[2]=qam_table_s0[qam64_table_offset_re];
+      ((int16_t *)&txdataF[0][tti_offset])[3]=qam_table_s0[qam64_table_offset_im];
+
+      qam64_table_offset_re=FOUR[x0p[12]];
+      qam64_table_offset_im=FOUR[x0p[13]];
+      qam64_table_offset_re+=TWO[x0p[14]];
+      qam64_table_offset_im+=TWO[x0p[15]];
+      qam64_table_offset_re+=x0p[16];
+      qam64_table_offset_im+=x0p[17];
+      ((int16_t *)&txdataF[0][tti_offset])[4]=qam_table_s0[qam64_table_offset_re];
+      ((int16_t *)&txdataF[0][tti_offset])[5]=qam_table_s0[qam64_table_offset_im];
+
+      qam64_table_offset_re=FOUR[x0p[18]];
+      qam64_table_offset_im=FOUR[x0p[19]];
+      qam64_table_offset_re+=TWO[x0p[20]];
+      qam64_table_offset_im+=TWO[x0p[21]];
+      qam64_table_offset_re+=x0p[22];
+      qam64_table_offset_im+=x0p[23];
+      ((int16_t *)&txdataF[0][tti_offset])[6]=qam_table_s0[qam64_table_offset_re];
+      ((int16_t *)&txdataF[0][tti_offset])[7]=qam_table_s0[qam64_table_offset_im];
     }
   }
   else {
diff --git a/openair1/SIMULATION/LTE_PHY/ulsim.c b/openair1/SIMULATION/LTE_PHY/ulsim.c
index 48b3f8cec1..2c2b03ce78 100644
--- a/openair1/SIMULATION/LTE_PHY/ulsim.c
+++ b/openair1/SIMULATION/LTE_PHY/ulsim.c
@@ -188,7 +188,7 @@ int main(int argc, char **argv)
   int **txdata;
 
   LTE_DL_FRAME_PARMS *frame_parms;
-  double **s_re,**s_im,**r_re,**r_im;
+  double s_re[2][30720],s_im[2][30720],r_re[2][30720],r_im[2][30720];
   double forgetting_factor=0.0; //in [0,1] 0 means a new channel every time, 1 means keep the same channel
   double iqim=0.0;
   uint8_t extended_prefix_flag=0;
@@ -583,12 +583,6 @@ int main(int argc, char **argv)
   txdata = UE->common_vars.txdata;
 
 
-  s_re = malloc(2*sizeof(double*));
-  s_im = malloc(2*sizeof(double*));
-  r_re = malloc(2*sizeof(double*));
-  r_im = malloc(2*sizeof(double*));
-  //  r_re0 = malloc(2*sizeof(double*));
-  //  r_im0 = malloc(2*sizeof(double*));
 
   nsymb = (eNB->frame_parms.Ncp == NORMAL) ? 14 : 12;
 
@@ -630,13 +624,6 @@ int main(int argc, char **argv)
     fprintf(csv_fdUL,"data_all%d=[",mcs);
   }
 
-  for (i=0; i<2; i++) {
-    s_re[i] = malloc(FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
-    s_im[i] = malloc(FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
-    r_re[i] = malloc(FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
-    r_im[i] = malloc(FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
-  }
-
 
   if (xforms==1) {
     fl_initialize (&argc, argv, NULL, 0, 0);
@@ -1716,22 +1703,6 @@ int main(int argc, char **argv)
   if (test_perf !=0)
     fclose (time_meas_fd);
 
-  printf("Freeing channel I/O\n");
-
-  for (i=0; i<2; i++) {
-    free(s_re[i]);
-    free(s_im[i]);
-    free(r_re[i]);
-    free(r_im[i]);
-  }
-
-  free(s_re);
-  free(s_im);
-  free(r_re);
-  free(r_im);
-
-  //  lte_sync_time_free();
-
   return(0);
 
 }
-- 
GitLab