dlsch_demodulation.c 241 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/*
 * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The OpenAirInterface Software Alliance licenses this file to You under
 * the OAI Public License, Version 1.0  (the "License"); you may not use this file
 * except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.openairinterface.org/?page_id=698
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *-------------------------------------------------------------------------------
 * For more information about the OpenAirInterface (OAI) Software Alliance:
 *      contact@openairinterface.org
 */
21
22
23

/*! \file PHY/LTE_TRANSPORT/dlsch_demodulation.c
 * \brief Top-level routines for demodulating the PDSCH physical channel from 36-211, V8.6 2009-03
24
 * \author R. Knopp, F. Kaltenberger,A. Bhamri, S. Aubert, X. Xiang
25
 * \date 2011
26
 * \version 0.1
27
28
29
30
31
 * \company Eurecom
 * \email: knopp@eurecom.fr,florian.kaltenberger@eurecom.fr,ankit.bhamri@eurecom.fr,sebastien.aubert@eurecom.fr
 * \note
 * \warning
 */
32
//#include "PHY/defs.h"
33
34
35
#include "PHY/extern.h"
#include "defs.h"
#include "extern.h"
36
#include "PHY/sse_intrin.h"
Bilel's avatar
Bilel committed
37
#include "T.h"
38
39
40
41

#ifndef USER_MODE
#define NOCYGWIN_STATIC static
#else
42
#define NOCYGWIN_STATIC
43
44
#endif

45
46
47
48
49
50
/* dynamic shift for LLR computation for TM3/4
 * set as command line argument, see lte-softmodem.c
 * default value: 0
 */
int16_t dlsch_demod_shift = 0;

51
52
//#define DEBUG_HARQ

Elena Lukashova's avatar
Elena Lukashova committed
53
54
55
//#undef LOG_D
//#define LOG_D LOG_I

56
//#define DEBUG_PHY 1
57
//#define DEBUG_DLSCH_DEMOD 1
58

59
int avg[4];
60
61
int avg_0[2];
int avg_1[2];
62
63

// [MCS][i_mod (0,1,2) = (2,4,6)]
64
unsigned char offset_mumimo_llr_drange_fix=0;
Elena Lukashova's avatar
Elena Lukashova committed
65
66
67
uint8_t interf_unaw_shift0=0;
uint8_t interf_unaw_shift1=0;
uint8_t interf_unaw_shift=0;
68
//inferference-free case
69
unsigned char interf_unaw_shift_tm4_mcs[29]={5, 3, 4, 3, 3, 2, 1, 1, 2, 0, 1, 1, 1, 1, 0, 0,
70
                                             1, 1, 1, 1, 0, 2, 1, 0, 1, 0, 1, 0, 0} ;
71
unsigned char interf_unaw_shift_tm1_mcs[29]={5, 5, 4, 3, 3, 3, 2, 2, 4, 4, 2, 3, 3, 3, 1, 1,
72
                                             0, 1, 1, 2, 5, 4, 4, 6, 5, 1, 0, 5, 6} ; // mcs 21, 26, 28 seem to be errorneous
73

74
75
76
/*
//original values from sebastion + same hand tuning
unsigned char offset_mumimo_llr_drange[29][3]={{8,8,8},{7,7,7},{7,7,7},{7,7,7},{6,6,6},{6,6,6},{6,6,6},{5,5,5},{4,4,4},{1,2,4}, // QPSK
77
78
{5,5,4},{5,5,5},{5,5,5},{3,3,3},{2,2,2},{2,2,2},{2,2,2}, // 16-QAM
{2,2,1},{3,3,3},{3,3,3},{3,3,1},{2,2,2},{2,2,2},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}}; //64-QAM
79
*/
80
81
82
83
84
85
86
87
 /*
 //first optimization try
 unsigned char offset_mumimo_llr_drange[29][3]={{7, 8, 7},{6, 6, 7},{6, 6, 7},{6, 6, 6},{5, 6, 6},{5, 5, 6},{5, 5, 6},{4, 5, 4},{4, 3, 4},{3, 2, 2},{6, 5, 5},{5, 4, 4},{5, 5, 4},{3, 3, 2},{2, 2, 1},{2, 1, 1},{2, 2, 2},{3, 3, 3},{3, 3, 2},{3, 3, 2},{3, 2, 1},{2, 2, 2},{2, 2, 2},{0, 0, 0},{0, 0, 0},{0, 0, 0},{0, 0, 0},{0, 0, 0}};
 */
 //second optimization try
 /*
   unsigned char offset_mumimo_llr_drange[29][3]={{5, 8, 7},{4, 6, 8},{3, 6, 7},{7, 7, 6},{4, 7, 8},{4, 7, 4},{6, 6, 6},{3, 6, 6},{3, 6, 6},{1, 3, 4},{1, 1, 0},{3, 3, 2},{3, 4, 1},{4, 0, 1},{4, 2, 2},{3, 1, 2},{2, 1, 0},{2, 1, 1},{1, 0, 1},{1, 0, 1},{0, 0, 0},{1, 0, 0},{0, 0, 0},{0, 1, 0},{1, 0, 0},{0, 0, 0},{0, 0, 0},{0, 0, 0},{0, 0, 0}};  w
 */
88
unsigned char offset_mumimo_llr_drange[29][3]= {{0, 6, 5},{0, 4, 5},{0, 4, 5},{0, 5, 4},{0, 5, 6},{0, 5, 3},{0, 4, 4},{0, 4, 4},{0, 3, 3},{0, 1, 2},{1, 1, 0},{1, 3, 2},{3, 4, 1},{2, 0, 0},{2, 2, 2},{1, 1, 1},{2, 1, 0},{2, 1, 1},{1, 0, 1},{1, 0, 1},{0, 0, 0},{1, 0, 0},{0, 0, 0},{0, 1, 0},{1, 0, 0},{0, 0, 0},{0, 0, 0},{0, 0, 0},{0, 0, 0}};
89
90


91
extern void print_shorts(char *s,int16_t *x);
92

93

94
int rx_pdsch(PHY_VARS_UE *ue,
95
96
             PDSCH_t type,
             unsigned char eNB_id,
97
             unsigned char eNB_id_i, //if this == ue->n_connected_eNB, we assume MU interference
Bilel's avatar
Bilel committed
98
             uint32_t frame,
gauthier's avatar
gauthier committed
99
             uint8_t subframe,
100
101
             unsigned char symbol,
             unsigned char first_symbol_flag,
102
             RX_type_t rx_type,
103
             unsigned char i_mod,
104
105
106
             unsigned char harq_pid)
{

107
108
109
  LTE_UE_COMMON *common_vars  = &ue->common_vars;
  LTE_UE_PDSCH **pdsch_vars;
  LTE_DL_FRAME_PARMS *frame_parms    = &ue->frame_parms;
110
  PHY_MEASUREMENTS *measurements = &ue->measurements;
111
  LTE_UE_DLSCH_t   **dlsch;
112

Elena Lukashova's avatar
Elena Lukashova committed
113

114
  unsigned char aatx,aarx;
115

116
  unsigned short nb_rb = 0, round;
117
  int avgs, rb;
118
  LTE_DL_UE_HARQ_t *dlsch0_harq,*dlsch1_harq = 0;
Elena Lukashova's avatar
Elena Lukashova committed
119

120
  uint8_t beamforming_mode;
121
  uint32_t *rballoc;
122

123
124
  int32_t **rxdataF_comp_ptr;
  int32_t **dl_ch_mag_ptr;
125
126
127
128
  int32_t codeword_TB0;
  int32_t codeword_TB1;


129

130
131
  switch (type) {
  case SI_PDSCH:
132
    pdsch_vars = &ue->pdsch_vars_SI[eNB_id];
133
134
    dlsch = &ue->dlsch_SI[eNB_id];
    dlsch0_harq = dlsch[0]->harq_processes[harq_pid];
135
    beamforming_mode  = 0;
136
    break;
137

138
  case RA_PDSCH:
139
    pdsch_vars = &ue->pdsch_vars_ra[eNB_id];
140
141
    dlsch = &ue->dlsch_ra[eNB_id];
    dlsch0_harq = dlsch[0]->harq_processes[harq_pid];
142
    beamforming_mode  = 0;
143
    break;
144

145
  case PDSCH:
146
    pdsch_vars = &ue->pdsch_vars[subframe&0x1][eNB_id];
Bilel's avatar
Bilel committed
147
148
149
150
151
152
    dlsch = ue->dlsch[subframe&0x1][eNB_id];
    LOG_D(PHY,"AbsSubframe %d.%d / Sym %d harq_pid %d,  harq status %d.%d \n",
                   frame,subframe,symbol,harq_pid,
                   dlsch[0]->harq_processes[harq_pid]->status,
                   dlsch[1]->harq_processes[harq_pid]->status);

153
154
155
156
157
158
    if ((dlsch[0]->harq_processes[harq_pid]->status == ACTIVE) &&
        (dlsch[1]->harq_processes[harq_pid]->status == ACTIVE)){
      codeword_TB0 = dlsch[0]->harq_processes[harq_pid]->codeword;
      codeword_TB1 = dlsch[1]->harq_processes[harq_pid]->codeword;
      dlsch0_harq = dlsch[codeword_TB0]->harq_processes[harq_pid];
      dlsch1_harq = dlsch[codeword_TB1]->harq_processes[harq_pid];
159
    }
160
161
162
163
164
165
     else if ((dlsch[0]->harq_processes[harq_pid]->status == ACTIVE) &&
              (dlsch[1]->harq_processes[harq_pid]->status != ACTIVE) ) {
      codeword_TB0 = dlsch[0]->harq_processes[harq_pid]->codeword;
      dlsch0_harq = dlsch[0]->harq_processes[harq_pid];
      dlsch1_harq = NULL;
      codeword_TB1 = -1;
166
    }
167
168
169
     else if ((dlsch[0]->harq_processes[harq_pid]->status != ACTIVE) &&
              (dlsch[1]->harq_processes[harq_pid]->status == ACTIVE) ){
      codeword_TB1 = dlsch[1]->harq_processes[harq_pid]->codeword;
Bilel's avatar
Bilel committed
170
171
      dlsch0_harq  = dlsch[1]->harq_processes[harq_pid];
      dlsch1_harq  = NULL;
172
      codeword_TB0 = -1;
173
    }
174
175
176
177
    else {
      LOG_E(PHY,"[UE][FATAL] Frame %d subframe %d: no active DLSCH\n",ue->proc.proc_rxtx[0].frame_rx,subframe);
      return(-1);
    }
178
    beamforming_mode  = ue->transmission_mode[eNB_id]<7?0:ue->transmission_mode[eNB_id];
179
180
181
    break;

  default:
Cedric Roux's avatar
Cedric Roux committed
182
    LOG_E(PHY,"[UE][FATAL] Frame %d subframe %d: Unknown PDSCH format %d\n",ue->proc.proc_rxtx[0].frame_rx,subframe,type);
183
184
185
    return(-1);
    break;
  }
186
187
188
189
#ifdef DEBUG_HARQ
  printf("[DEMOD] MIMO mode = %d\n", dlsch0_harq->mimo_mode);
  printf("[DEMOD] cw for TB0 = %d, cw for TB1 = %d\n", codeword_TB0, codeword_TB1);
#endif
190

191
192
  DevAssert(dlsch0_harq);
  round = dlsch0_harq->round;
193

194
  if (eNB_id > 2) {
jiangx's avatar
jiangx committed
195
    LOG_W(PHY,"dlsch_demodulation.c: Illegal eNB_id %d\n",eNB_id);
196
197
    return(-1);
  }
198

199
200
  if (!common_vars) {
    LOG_W(PHY,"dlsch_demodulation.c: Null common_vars\n");
201
202
203
    return(-1);
  }

204
  if (!dlsch[0]) {
jiangx's avatar
jiangx committed
205
    LOG_W(PHY,"dlsch_demodulation.c: Null dlsch_ue pointer\n");
206
207
208
    return(-1);
  }

209
210
  if (!pdsch_vars) {
    LOG_W(PHY,"dlsch_demodulation.c: Null pdsch_vars pointer\n");
211
212
    return(-1);
  }
213

214
  if (!frame_parms) {
215
    LOG_W(PHY,"dlsch_demodulation.c: Null frame_parms\n");
216
217
    return(-1);
  }
218

219
220
221
222
223
  if (((frame_parms->Ncp == NORMAL) && (symbol>=7)) ||
      ((frame_parms->Ncp == EXTENDED) && (symbol>=6)))
    rballoc = dlsch0_harq->rb_alloc_odd;
  else
    rballoc = dlsch0_harq->rb_alloc_even;
224

225

Elena Lukashova's avatar
Elena Lukashova committed
226
  if (dlsch0_harq->mimo_mode>DUALSTREAM_PUSCH_PRECODING) {
227
228
229
    LOG_E(PHY,"This transmission mode is not yet supported!\n");
    return(-1);
  }
230
231
232



233
234
235
236
237
238
239
240
  if ((dlsch0_harq->mimo_mode==LARGE_CDD) || ((dlsch0_harq->mimo_mode>=DUALSTREAM_UNIFORM_PRECODING1) && (dlsch0_harq->mimo_mode<=DUALSTREAM_PUSCH_PRECODING)))  {
    DevAssert(dlsch1_harq);
    if (eNB_id!=eNB_id_i) {
      LOG_E(PHY,"TM3/TM4 requires to set eNB_id==eNB_id_i!\n");
      return(-1);
    }
  }

Xiwen JIANG's avatar
Xiwen JIANG committed
241
  if (frame_parms->nb_antenna_ports_eNB>1 && beamforming_mode==0) {
242
#ifdef DEBUG_DLSCH_MOD
243
    LOG_I(PHY,"dlsch: using pmi %x (%p), rb_alloc %x\n",pmi2hex_2Ar1(dlsch0_harq->pmi_alloc),dlsch[0],dlsch0_harq->rb_alloc_even[0]);
244
#endif
245

246
247
    nb_rb = dlsch_extract_rbs_dual(common_vars->common_vars_rx_data_per_thread[subframe&0x1].rxdataF,
                                   common_vars->common_vars_rx_data_per_thread[subframe&0x1].dl_ch_estimates[eNB_id],
248
249
                                   pdsch_vars[eNB_id]->rxdataF_ext,
                                   pdsch_vars[eNB_id]->dl_ch_estimates_ext,
250
                                   dlsch0_harq->pmi_alloc,
251
                                   pdsch_vars[eNB_id]->pmi_ext,
252
                                   rballoc,
253
254
                                   symbol,
                                   subframe,
255
                                   ue->high_speed_flag,
Elena Lukashova's avatar
Elena Lukashova committed
256
                                   frame_parms,
257
                                   dlsch0_harq->mimo_mode);
258
//#ifdef DEBUG_DLSCH_MOD
259
260
    /*   printf("dlsch: using pmi %lx, rb_alloc %x, pmi_ext ",pmi2hex_2Ar1(dlsch0_harq->pmi_alloc),*rballoc);
       for (rb=0;rb<nb_rb;rb++)
261
          printf("%d",pdsch_vars[eNB_id]->pmi_ext[rb]);
262
       printf("\n");*/
263
//#endif
264

Elena Lukashova's avatar
Elena Lukashova committed
265
   if (rx_type >= rx_IC_single_stream) {
266
      if (eNB_id_i<ue->n_connected_eNB) // we are in TM5
267
      nb_rb = dlsch_extract_rbs_dual(common_vars->common_vars_rx_data_per_thread[subframe&0x1].rxdataF,
268
                                       common_vars->common_vars_rx_data_per_thread[subframe&0x1].dl_ch_estimates[eNB_id_i],
269
270
                                       pdsch_vars[eNB_id_i]->rxdataF_ext,
                                       pdsch_vars[eNB_id_i]->dl_ch_estimates_ext,
271
                                       dlsch0_harq->pmi_alloc,
272
                                       pdsch_vars[eNB_id_i]->pmi_ext,
273
                                       rballoc,
274
275
                                       symbol,
                                       subframe,
276
                                       ue->high_speed_flag,
Elena Lukashova's avatar
Elena Lukashova committed
277
                                       frame_parms,
278
                                       dlsch0_harq->mimo_mode);
279
      else
280
281
        nb_rb = dlsch_extract_rbs_dual(common_vars->common_vars_rx_data_per_thread[subframe&0x1].rxdataF,
                                       common_vars->common_vars_rx_data_per_thread[subframe&0x1].dl_ch_estimates[eNB_id],
282
283
                                       pdsch_vars[eNB_id_i]->rxdataF_ext,
                                       pdsch_vars[eNB_id_i]->dl_ch_estimates_ext,
284
                                       dlsch0_harq->pmi_alloc,
285
                                       pdsch_vars[eNB_id_i]->pmi_ext,
286
                                       rballoc,
287
288
                                       symbol,
                                       subframe,
289
                                       ue->high_speed_flag,
Elena Lukashova's avatar
Elena Lukashova committed
290
                                       frame_parms,
291
                                       dlsch0_harq->mimo_mode);
292
    }
293
  } else if (beamforming_mode==0) { //else if nb_antennas_ports_eNB==1 && beamforming_mode == 0
294
295
    nb_rb = dlsch_extract_rbs_single(common_vars->common_vars_rx_data_per_thread[subframe&0x1].rxdataF,
                                     common_vars->common_vars_rx_data_per_thread[subframe&0x1].dl_ch_estimates[eNB_id],
296
297
                                     pdsch_vars[eNB_id]->rxdataF_ext,
                                     pdsch_vars[eNB_id]->dl_ch_estimates_ext,
298
                                     dlsch0_harq->pmi_alloc,
299
                                     pdsch_vars[eNB_id]->pmi_ext,
300
                                     rballoc,
301
302
                                     symbol,
                                     subframe,
303
                                     ue->high_speed_flag,
304
                                     frame_parms);
305

Elena Lukashova's avatar
Elena Lukashova committed
306
   if (rx_type==rx_IC_single_stream) {
307
     if (eNB_id_i<ue->n_connected_eNB)
308
309
        nb_rb = dlsch_extract_rbs_single(common_vars->common_vars_rx_data_per_thread[subframe&0x1].rxdataF,
                                         common_vars->common_vars_rx_data_per_thread[subframe&0x1].dl_ch_estimates[eNB_id_i],
310
                                         pdsch_vars[eNB_id_i]->rxdataF_ext,
311
                                         pdsch_vars[eNB_id_i]->dl_ch_estimates_ext,
312
                                         dlsch0_harq->pmi_alloc,
313
                                         pdsch_vars[eNB_id_i]->pmi_ext,
314
                                         rballoc,
315
316
                                         symbol,
                                         subframe,
317
                                         ue->high_speed_flag,
318
                                         frame_parms);
319
      else
320
321
        nb_rb = dlsch_extract_rbs_single(common_vars->common_vars_rx_data_per_thread[subframe&0x1].rxdataF,
                                         common_vars->common_vars_rx_data_per_thread[subframe&0x1].dl_ch_estimates[eNB_id],
322
                                         pdsch_vars[eNB_id_i]->rxdataF_ext,
323
                                         pdsch_vars[eNB_id_i]->dl_ch_estimates_ext,
324
                                         dlsch0_harq->pmi_alloc,
325
                                         pdsch_vars[eNB_id_i]->pmi_ext,
326
                                         rballoc,
327
328
                                         symbol,
                                         subframe,
329
                                         ue->high_speed_flag,
330
                                         frame_parms);
331
    }
332
  } else if (beamforming_mode==7) { //else if beamforming_mode == 7
333
    nb_rb = dlsch_extract_rbs_TM7(common_vars->common_vars_rx_data_per_thread[subframe&0x1].rxdataF,
334
335
336
                                  pdsch_vars[eNB_id]->dl_bf_ch_estimates,
                                  pdsch_vars[eNB_id]->rxdataF_ext,
                                  pdsch_vars[eNB_id]->dl_bf_ch_estimates_ext,
337
                                  rballoc,
338
339
                                  symbol,
                                  subframe,
340
                                  ue->high_speed_flag,
341
                                  frame_parms);
342

343
  } else if(beamforming_mode>7) {
344
    LOG_W(PHY,"dlsch_demodulation: beamforming mode not supported yet.\n");
345
  }
346

Bilel's avatar
Bilel committed
347
  //printf("nb_rb = %d, eNB_id %d\n",nb_rb,eNB_id);
348
  if (nb_rb==0) {
349
    LOG_D(PHY,"dlsch_demodulation.c: nb_rb=0\n");
350
351
    return(-1);
  }
352

Elena Lukashova's avatar
Elena Lukashova committed
353

354
#ifdef DEBUG_PHY
355
356
  LOG_D(PHY,"[DLSCH] log2_maxh = %d (%d,%d)\n",pdsch_vars[eNB_id]->log2_maxh,avg[0],avgs);
  LOG_D(PHY,"[DLSCH] mimo_mode = %d\n", dlsch0_harq->mimo_mode);
357
358
#endif

359
  aatx = frame_parms->nb_antenna_ports_eNB;
Elena Lukashova's avatar
Elena Lukashova committed
360
361
  aarx = frame_parms->nb_antennas_rx;

362
  dlsch_scale_channel(pdsch_vars[eNB_id]->dl_ch_estimates_ext,
363
364
365
366
                      frame_parms,
                      dlsch,
                      symbol,
                      nb_rb);
367

368
369
370
371
372
373
  if ((dlsch0_harq->mimo_mode<DUALSTREAM_UNIFORM_PRECODING1) &&
      (rx_type==rx_IC_single_stream) &&
      (eNB_id_i==ue->n_connected_eNB) &&
      (dlsch0_harq->dl_power_off==0)
     )  // TM5 two-user
  {
374
    dlsch_scale_channel(pdsch_vars[eNB_id_i]->dl_ch_estimates_ext,
375
                        frame_parms,
376
                        dlsch,
377
378
                        symbol,
                        nb_rb);
379
  }
380

381
  if (first_symbol_flag==1) {
382
383
384
    if (beamforming_mode==0){
      if (dlsch0_harq->mimo_mode<LARGE_CDD) {
        dlsch_channel_level(pdsch_vars[eNB_id]->dl_ch_estimates_ext,
385
386
387
388
                           frame_parms,
                           avg,
                           symbol,
                           nb_rb);
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
        avgs = 0;
        for (aatx=0;aatx<frame_parms->nb_antenna_ports_eNB;aatx++)
          for (aarx=0;aarx<frame_parms->nb_antennas_rx;aarx++)
            avgs = cmax(avgs,avg[(aatx<<1)+aarx]);

        pdsch_vars[eNB_id]->log2_maxh = (log2_approx(avgs)/2)+1;
     }
     else if ((dlsch0_harq->mimo_mode == LARGE_CDD) ||
           ((dlsch0_harq->mimo_mode >=DUALSTREAM_UNIFORM_PRECODING1) &&
            (dlsch0_harq->mimo_mode <=DUALSTREAM_PUSCH_PRECODING)))
     {
      dlsch_channel_level_TM34(pdsch_vars[eNB_id]->dl_ch_estimates_ext,
                                 frame_parms,
                                 pdsch_vars[eNB_id]->pmi_ext,
                                 avg_0,
                                 avg_1,
                                 symbol,
                                 nb_rb,
                                 dlsch0_harq->mimo_mode);

Bilel's avatar
Bilel committed
409
410
      LOG_D(PHY,"Channel Level TM34  avg_0 %d, avg_1 %d, rx_type %d, rx_standard %d, interf_unaw_shift %d \n", avg_0[0],
              avg_1[0], rx_type, rx_standard, interf_unaw_shift);
411
        if (rx_type>rx_standard) {
412
413
          avg_0[0] = (log2_approx(avg_0[0])/2) + dlsch_demod_shift;// + 2 ;//+ 4;
          avg_1[0] = (log2_approx(avg_1[0])/2) + dlsch_demod_shift;// + 2 ;//+ 4;
414
415
          pdsch_vars[eNB_id]->log2_maxh0 = cmax(avg_0[0],0);
          pdsch_vars[eNB_id]->log2_maxh1 = cmax(avg_1[0],0);
Bilel's avatar
Bilel committed
416
417
          //printf("TM4 I-A log2_maxh0 = %d\n", pdsch_vars[eNB_id]->log2_maxh0);
          //printf("TM4 I-A log2_maxh1 = %d\n", pdsch_vars[eNB_id]->log2_maxh1);
418
419
420
421
422
423
         }
          else {
          avg_0[0] = (log2_approx(avg_0[0])/2) - 13 + interf_unaw_shift;
          avg_1[0] = (log2_approx(avg_1[0])/2) - 13 + interf_unaw_shift;
          pdsch_vars[eNB_id]->log2_maxh0 = cmax(avg_0[0],0);
          pdsch_vars[eNB_id]->log2_maxh1 = cmax(avg_1[0],0);
Bilel's avatar
Bilel committed
424
425
          //printf("TM4 I-UA log2_maxh0 = %d\n", pdsch_vars[eNB_id]->log2_maxh0);
          //printf("TM4 I-UA log2_maxh1 = %d\n", pdsch_vars[eNB_id]->log2_maxh1);
426
427
428
429
430
431
432
433
434
435
436
437
        }
      }
      else if (dlsch0_harq->mimo_mode<DUALSTREAM_UNIFORM_PRECODING1) {// single-layer precoding (TM5, TM6)
        if ((rx_type==rx_IC_single_stream) && (eNB_id_i==ue->n_connected_eNB) && (dlsch0_harq->dl_power_off==0)) {
            dlsch_channel_level_TM56(pdsch_vars[eNB_id]->dl_ch_estimates_ext,
                                frame_parms,
                                pdsch_vars[eNB_id]->pmi_ext,
                                avg,
                                symbol,
                                nb_rb);
            avg[0] = log2_approx(avg[0]) - 13 + offset_mumimo_llr_drange[dlsch0_harq->mcs][(i_mod>>1)-1];
            pdsch_vars[eNB_id]->log2_maxh = cmax(avg[0],0);
438

439
440
        }
        else if (dlsch0_harq->dl_power_off==1) { //TM6
441

442
443
444
445
446
          dlsch_channel_level(pdsch_vars[eNB_id]->dl_ch_estimates_ext,
                                   frame_parms,
                                   avg,
                                   symbol,
                                   nb_rb);
447

448
449
450
451
          avgs = 0;
          for (aatx=0;aatx<frame_parms->nb_antenna_ports_eNB;aatx++)
            for (aarx=0;aarx<frame_parms->nb_antennas_rx;aarx++)
              avgs = cmax(avgs,avg[(aatx<<1)+aarx]);
452

453
454
          pdsch_vars[eNB_id]->log2_maxh = (log2_approx(avgs)/2) + 1;
          pdsch_vars[eNB_id]->log2_maxh++;
455

456
        }
457
      }
458

459
460
461
462
463
464
465
    }
    else if (beamforming_mode==7)
       dlsch_channel_level_TM7(pdsch_vars[eNB_id]->dl_bf_ch_estimates_ext,
                              frame_parms,
                              avg,
                              symbol,
                              nb_rb);
466
#ifdef DEBUG_PHY
Bilel's avatar
Bilel committed
467
468
469
470
471
    LOG_I(PHY,"[DLSCH] log2_maxh = %d [log2_maxh0 %d log2_maxh1 %d] (%d,%d)\n",pdsch_vars[eNB_id]->log2_maxh,
                                                 pdsch_vars[eNB_id]->log2_maxh0,
                                                 pdsch_vars[eNB_id]->log2_maxh1,
                                                 avg[0],avgs);
    LOG_I(PHY,"[DLSCH] mimo_mode = %d\n", dlsch0_harq->mimo_mode);
472
473
#endif
  }
474

475
476
477
478
479
480
481
#if T_TRACER
    if (type == PDSCH)
    {
      T(T_UE_PHY_PDSCH_ENERGY, T_INT(eNB_id),  T_INT(0), T_INT(frame%1024), T_INT(subframe),
                               T_INT(avg[0]), T_INT(avg[1]),    T_INT(avg[2]),             T_INT(avg[3]));
    }
#endif
482

483
484
// Now channel compensation
  if (dlsch0_harq->mimo_mode<LARGE_CDD) {
485
486
487
488
489
490
    dlsch_channel_compensation(pdsch_vars[eNB_id]->rxdataF_ext,
                               pdsch_vars[eNB_id]->dl_ch_estimates_ext,
                               pdsch_vars[eNB_id]->dl_ch_mag0,
                               pdsch_vars[eNB_id]->dl_ch_magb0,
                               pdsch_vars[eNB_id]->rxdataF_comp0,
                               (aatx>1) ? pdsch_vars[eNB_id]->rho : NULL,
491
492
493
                               frame_parms,
                               symbol,
                               first_symbol_flag,
Elena Lukashova's avatar
Elena Lukashova committed
494
                               dlsch0_harq->Qm,
495
                               nb_rb,
496
                               pdsch_vars[eNB_id]->log2_maxh,
497
                               measurements); // log2_maxh+I0_shift
498
 /*if (symbol == 5) {
499
     write_output("rxF_comp_d.m","rxF_c_d",&pdsch_vars[eNB_id]->rxdataF_comp0[0][symbol*frame_parms->N_RB_DL*12],frame_parms->N_RB_DL*12,1,1);
500
 } */
501
    if ((rx_type==rx_IC_single_stream) &&
502
        (eNB_id_i<ue->n_connected_eNB)) {
503
         dlsch_channel_compensation(pdsch_vars[eNB_id_i]->rxdataF_ext,
504
505
506
507
508
                                 pdsch_vars[eNB_id_i]->dl_ch_estimates_ext,
                                 pdsch_vars[eNB_id_i]->dl_ch_mag0,
                                 pdsch_vars[eNB_id_i]->dl_ch_magb0,
                                 pdsch_vars[eNB_id_i]->rxdataF_comp0,
                                 (aatx>1) ? pdsch_vars[eNB_id_i]->rho : NULL,
509
510
511
512
513
                                 frame_parms,
                                 symbol,
                                 first_symbol_flag,
                                 i_mod,
                                 nb_rb,
514
                                 pdsch_vars[eNB_id]->log2_maxh,
515
                                 measurements); // log2_maxh+I0_shift
516
517
#ifdef DEBUG_PHY
      if (symbol == 5) {
518
        write_output("rxF_comp_d.m","rxF_c_d",&pdsch_vars[eNB_id]->rxdataF_comp0[0][symbol*frame_parms->N_RB_DL*12],frame_parms->N_RB_DL*12,1,1);
519
        write_output("rxF_comp_i.m","rxF_c_i",&pdsch_vars[eNB_id_i]->rxdataF_comp0[0][symbol*frame_parms->N_RB_DL*12],frame_parms->N_RB_DL*12,1,1);
520
      }
521
#endif
522

523
      dlsch_dual_stream_correlation(frame_parms,
524
525
                                    symbol,
                                    nb_rb,
526
527
                                    pdsch_vars[eNB_id]->dl_ch_estimates_ext,
                                    pdsch_vars[eNB_id_i]->dl_ch_estimates_ext,
528
                                    pdsch_vars[eNB_id]->dl_ch_rho_ext[harq_pid][round],
529
                                    pdsch_vars[eNB_id]->log2_maxh);
530
    }
531
532
  } else if ((dlsch0_harq->mimo_mode == LARGE_CDD) || ((dlsch0_harq->mimo_mode >=DUALSTREAM_UNIFORM_PRECODING1) &&
            (dlsch0_harq->mimo_mode <=DUALSTREAM_PUSCH_PRECODING))){
533
      dlsch_channel_compensation_TM34(frame_parms,
534
                                     pdsch_vars[eNB_id],
535
                                     measurements,
536
537
538
                                     eNB_id,
                                     symbol,
                                     dlsch0_harq->Qm,
Elena Lukashova's avatar
Elena Lukashova committed
539
                                     dlsch1_harq->Qm,
540
541
542
                                     harq_pid,
                                     dlsch0_harq->round,
                                     dlsch0_harq->mimo_mode,
543
                                     nb_rb,
544
                                     pdsch_vars[eNB_id]->log2_maxh0,
545
                                     pdsch_vars[eNB_id]->log2_maxh1);
546
  /*   if (symbol == 5) {
547
548
549
550
     write_output("rxF_comp_d00.m","rxF_c_d00",&pdsch_vars[eNB_id]->rxdataF_comp0[0][symbol*frame_parms->N_RB_DL*12],frame_parms->N_RB_DL*12,1,1);// should be QAM
     write_output("rxF_comp_d01.m","rxF_c_d01",&pdsch_vars[eNB_id]->rxdataF_comp0[1][symbol*frame_parms->N_RB_DL*12],frame_parms->N_RB_DL*12,1,1);//should be almost 0
     write_output("rxF_comp_d10.m","rxF_c_d10",&pdsch_vars[eNB_id]->rxdataF_comp1[harq_pid][round][0][symbol*frame_parms->N_RB_DL*12],frame_parms->N_RB_DL*12,1,1);//should be almost 0
     write_output("rxF_comp_d11.m","rxF_c_d11",&pdsch_vars[eNB_id]->rxdataF_comp1[harq_pid][round][1][symbol*frame_parms->N_RB_DL*12],frame_parms->N_RB_DL*12,1,1);//should be QAM
551
        } */
552
      // compute correlation between signal and interference channels (rho12 and rho21)
553
        dlsch_dual_stream_correlation(frame_parms, // this is doing h11'*h12 and h21'*h22
554
555
                                    symbol,
                                    nb_rb,
556
557
                                    pdsch_vars[eNB_id]->dl_ch_estimates_ext,
                                    &(pdsch_vars[eNB_id]->dl_ch_estimates_ext[2]),
558
559
560
                                    pdsch_vars[eNB_id]->dl_ch_rho2_ext,
                                    pdsch_vars[eNB_id]->log2_maxh0);
        //printf("rho stream1 =%d\n", &pdsch_vars[eNB_id]->dl_ch_rho_ext[harq_pid][round] );
561
      //to be optimized (just take complex conjugate)
562
      dlsch_dual_stream_correlation(frame_parms, // this is doing h12'*h11 and h22'*h21
563
564
                                    symbol,
                                    nb_rb,
565
                                    &(pdsch_vars[eNB_id]->dl_ch_estimates_ext[2]),
566
                                    pdsch_vars[eNB_id]->dl_ch_estimates_ext,
567
568
                                    pdsch_vars[eNB_id]->dl_ch_rho_ext[harq_pid][round],
                                    pdsch_vars[eNB_id]->log2_maxh1);
569
    //  printf("rho stream2 =%d\n",&pdsch_vars[eNB_id]->dl_ch_rho2_ext );
570
      //printf("TM3 log2_maxh : %d\n",pdsch_vars[eNB_id]->log2_maxh);
571
  /*     if (symbol == 5) {
572
573
574
575
     write_output("rho0_0.m","rho0_0",&pdsch_vars[eNB_id]->dl_ch_rho_ext[harq_pid][round][0][symbol*frame_parms->N_RB_DL*12],frame_parms->N_RB_DL*12,1,1);// should be QAM
     write_output("rho2_0.m","rho2_0",&pdsch_vars[eNB_id]->dl_ch_rho2_ext[0][symbol*frame_parms->N_RB_DL*12],frame_parms->N_RB_DL*12,1,1);//should be almost 0
     write_output("rho0_1.m.m","rho0_1",&pdsch_vars[eNB_id]->dl_ch_rho_ext[harq_pid][round][1][symbol*frame_parms->N_RB_DL*12],frame_parms->N_RB_DL*12,1,1);//should be almost 0
     write_output("rho2_1.m","rho2_1",&pdsch_vars[eNB_id]->dl_ch_rho2_ext[1][symbol*frame_parms->N_RB_DL*12],frame_parms->N_RB_DL*12,1,1);//should be QAM
576
        } */
577

578
579
580
    } else if (dlsch0_harq->mimo_mode<DUALSTREAM_UNIFORM_PRECODING1) {// single-layer precoding (TM5, TM6)
        if ((rx_type==rx_IC_single_stream) && (eNB_id_i==ue->n_connected_eNB) && (dlsch0_harq->dl_power_off==0)) {
          dlsch_channel_compensation_TM56(pdsch_vars[eNB_id]->rxdataF_ext,
581
582
583
584
585
                                      pdsch_vars[eNB_id]->dl_ch_estimates_ext,
                                      pdsch_vars[eNB_id]->dl_ch_mag0,
                                      pdsch_vars[eNB_id]->dl_ch_magb0,
                                      pdsch_vars[eNB_id]->rxdataF_comp0,
                                      pdsch_vars[eNB_id]->pmi_ext,
586
                                      frame_parms,
587
                                      measurements,
588
589
                                      eNB_id,
                                      symbol,
590
                                      dlsch0_harq->Qm,
591
                                      nb_rb,
592
                                      pdsch_vars[eNB_id]->log2_maxh,
593
                                      dlsch0_harq->dl_power_off);
594

595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
        for (rb=0; rb<nb_rb; rb++) {
          switch(pdsch_vars[eNB_id]->pmi_ext[rb]) {
          case 0:
            pdsch_vars[eNB_id_i]->pmi_ext[rb]=1;
            break;
         case 1:
            pdsch_vars[eNB_id_i]->pmi_ext[rb]=0;
            break;
         case 2:
            pdsch_vars[eNB_id_i]->pmi_ext[rb]=3;
            break;
          case 3:
            pdsch_vars[eNB_id_i]->pmi_ext[rb]=2;
            break;
          }
Elena Lukashova's avatar
Elena Lukashova committed
610
       //  if (rb==0)
611
        //    printf("pmi %d, pmi_i %d\n",pdsch_vars[eNB_id]->pmi_ext[rb],pdsch_vars[eNB_id_i]->pmi_ext[rb]);
612
      }
613
614
615
616
617
618
      dlsch_channel_compensation_TM56(pdsch_vars[eNB_id_i]->rxdataF_ext,
                                      pdsch_vars[eNB_id_i]->dl_ch_estimates_ext,
                                      pdsch_vars[eNB_id_i]->dl_ch_mag0,
                                      pdsch_vars[eNB_id_i]->dl_ch_magb0,
                                      pdsch_vars[eNB_id_i]->rxdataF_comp0,
                                      pdsch_vars[eNB_id_i]->pmi_ext,
619
                                      frame_parms,
620
                                      measurements,
621
622
623
624
                                      eNB_id_i,
                                      symbol,
                                      i_mod,
                                      nb_rb,
625
                                      pdsch_vars[eNB_id]->log2_maxh,
626
                                      dlsch0_harq->dl_power_off);
627
628
#ifdef DEBUG_PHY
      if (symbol==5) {
629
        write_output("rxF_comp_d.m","rxF_c_d",&pdsch_vars[eNB_id]->rxdataF_comp0[0][symbol*frame_parms->N_RB_DL*12],frame_parms->N_RB_DL*12,1,1);
630
       write_output("rxF_comp_i.m","rxF_c_i",&pdsch_vars[eNB_id_i]->rxdataF_comp0[0][symbol*frame_parms->N_RB_DL*12],frame_parms->N_RB_DL*12,1,1);
631
      }
632
#endif
633
634
635
      dlsch_dual_stream_correlation(frame_parms,
                                    symbol,
                                    nb_rb,
636
637
638
639
                                    pdsch_vars[eNB_id]->dl_ch_estimates_ext,
                                    pdsch_vars[eNB_id_i]->dl_ch_estimates_ext,
                                    pdsch_vars[eNB_id]->dl_ch_rho_ext[harq_pid][round],
                                    pdsch_vars[eNB_id]->log2_maxh);
640
    }  else if (dlsch0_harq->dl_power_off==1)  {
641
642
643
644
645
646
      dlsch_channel_compensation_TM56(pdsch_vars[eNB_id]->rxdataF_ext,
                                      pdsch_vars[eNB_id]->dl_ch_estimates_ext,
                                      pdsch_vars[eNB_id]->dl_ch_mag0,
                                      pdsch_vars[eNB_id]->dl_ch_magb0,
                                      pdsch_vars[eNB_id]->rxdataF_comp0,
                                      pdsch_vars[eNB_id]->pmi_ext,
647
                                      frame_parms,
648
                                      measurements,
649
650
                                      eNB_id,
                                      symbol,
651
                                      dlsch0_harq->Qm,
652
                                      nb_rb,
653
                                      pdsch_vars[eNB_id]->log2_maxh,
654
                                      1);
Elena Lukashova's avatar
Elena Lukashova committed
655

656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
      }


    } else if (dlsch0_harq->mimo_mode==TM7) { //TM7

      dlsch_channel_compensation(pdsch_vars[eNB_id]->rxdataF_ext,
                                 pdsch_vars[eNB_id]->dl_bf_ch_estimates_ext,
                                 pdsch_vars[eNB_id]->dl_ch_mag0,
                                 pdsch_vars[eNB_id]->dl_ch_magb0,
                                 pdsch_vars[eNB_id]->rxdataF_comp0,
                                 (aatx>1) ? pdsch_vars[eNB_id]->rho : NULL,
                                 frame_parms,
                                 symbol,
                                 first_symbol_flag,
                                 get_Qm(dlsch0_harq->mcs),
                                 nb_rb,
                                 //9,
                                 pdsch_vars[eNB_id]->log2_maxh,
                                 measurements); // log2_maxh+I0_shift
675
676
  }

677
678
679
680
// MRC


   if (frame_parms->nb_antennas_rx > 1) {
681
    if ((dlsch0_harq->mimo_mode == LARGE_CDD) ||
682
        ((dlsch0_harq->mimo_mode >=DUALSTREAM_UNIFORM_PRECODING1) &&
683
         (dlsch0_harq->mimo_mode <=DUALSTREAM_PUSCH_PRECODING))){  // TM3 or TM4
Xiwen JIANG's avatar
Xiwen JIANG committed
684
      if (frame_parms->nb_antenna_ports_eNB == 2) {
685
        dlsch_detection_mrc_TM34(frame_parms,
686
                                 pdsch_vars[eNB_id],
687
                                 harq_pid,
688
                                 dlsch0_harq->round,
689
690
691
                                 symbol,
                                 nb_rb,
                                 1);
692
    /*   if (symbol == 5) {
693
694
     write_output("rho0_mrc.m","rho0_0",&pdsch_vars[eNB_id]->dl_ch_rho_ext[harq_pid][round][0][symbol*frame_parms->N_RB_DL*12],frame_parms->N_RB_DL*12,1,1);// should be QAM
     write_output("rho2_mrc.m","rho2_0",&pdsch_vars[eNB_id]->dl_ch_rho2_ext[0][symbol*frame_parms->N_RB_DL*12],frame_parms->N_RB_DL*12,1,1);//should be almost 0
695
        } */
696
      }
697
    } else {
698
      dlsch_detection_mrc(frame_parms,
699
700
701
                          pdsch_vars[eNB_id]->rxdataF_comp0,
                          pdsch_vars[eNB_id_i]->rxdataF_comp0,
                          pdsch_vars[eNB_id]->rho,
702
                          pdsch_vars[eNB_id]->dl_ch_rho_ext[harq_pid][round],
703
704
705
706
                          pdsch_vars[eNB_id]->dl_ch_mag0,
                          pdsch_vars[eNB_id]->dl_ch_magb0,
                          pdsch_vars[eNB_id_i]->dl_ch_mag0,
                          pdsch_vars[eNB_id_i]->dl_ch_magb0,
707
708
                          symbol,
                          nb_rb,
709
                          rx_type==rx_IC_single_stream);
710
711
712
713
714
    }
  }
  //  printf("Combining");
  if ((dlsch0_harq->mimo_mode == SISO) ||
      ((dlsch0_harq->mimo_mode >= UNIFORM_PRECODING11) &&
715
716
       (dlsch0_harq->mimo_mode <= PUSCH_PRECODING0)) ||
       (dlsch0_harq->mimo_mode == TM7)) {
717
718
    /*
      dlsch_siso(frame_parms,
719
720
      pdsch_vars[eNB_id]->rxdataF_comp,
      pdsch_vars[eNB_id_i]->rxdataF_comp,
721
722
723
724
725
      symbol,
      nb_rb);
    */
  } else if (dlsch0_harq->mimo_mode == ALAMOUTI) {
    dlsch_alamouti(frame_parms,
726
727
728
                   pdsch_vars[eNB_id]->rxdataF_comp0,
                   pdsch_vars[eNB_id]->dl_ch_mag0,
                   pdsch_vars[eNB_id]->dl_ch_magb0,
729
730
                   symbol,
                   nb_rb);
731
732
  }

733
  //    printf("LLR");
734
735
  if ((dlsch0_harq->mimo_mode == LARGE_CDD) ||
      ((dlsch0_harq->mimo_mode >=DUALSTREAM_UNIFORM_PRECODING1) &&
736
       (dlsch0_harq->mimo_mode <=DUALSTREAM_PUSCH_PRECODING)))  {
737
    rxdataF_comp_ptr = pdsch_vars[eNB_id]->rxdataF_comp1[harq_pid][round];
738
    dl_ch_mag_ptr = pdsch_vars[eNB_id]->dl_ch_mag1[harq_pid][round];
739
740
  }
  else {
741
742
    rxdataF_comp_ptr = pdsch_vars[eNB_id_i]->rxdataF_comp0;
    dl_ch_mag_ptr = pdsch_vars[eNB_id_i]->dl_ch_mag0;
743
    //i_mod should have been passed as a parameter
744
  }
745

746
  switch (dlsch0_harq->Qm) {
747
  case 2 :
748
    if ((rx_type==rx_standard) || (codeword_TB0 == -1) || (codeword_TB1 == -1)) {
749
        dlsch_qpsk_llr(frame_parms,
750
751
                       pdsch_vars[eNB_id]->rxdataF_comp0,
                       pdsch_vars[eNB_id]->llr[0],
752
753
754
                       symbol,
                       first_symbol_flag,
                       nb_rb,
755
                       adjust_G2(frame_parms,dlsch0_harq->rb_alloc_even,2,subframe,symbol),
756
                       pdsch_vars[eNB_id]->llr128,
757
                       beamforming_mode);
758
    }
Elena Lukashova's avatar
Elena Lukashova committed
759
      else if (rx_type >= rx_IC_single_stream) {
Elena Lukashova's avatar
Elena Lukashova committed
760
        if (dlsch1_harq->Qm == 2) {
761
          dlsch_qpsk_qpsk_llr(frame_parms,
762
                              pdsch_vars[eNB_id]->rxdataF_comp0,
763
                              rxdataF_comp_ptr,
764
765
                              pdsch_vars[eNB_id]->dl_ch_rho2_ext,
                              pdsch_vars[eNB_id]->llr[0],
766
                              symbol,first_symbol_flag,nb_rb,
Elena Lukashova's avatar
Elena Lukashova committed
767
                              adjust_G2(frame_parms,dlsch0_harq->rb_alloc_even,2,subframe,symbol),
768
                              pdsch_vars[eNB_id]->llr128);
769
770
771
          if (rx_type==rx_IC_dual_stream) {
            dlsch_qpsk_qpsk_llr(frame_parms,
                                rxdataF_comp_ptr,
772
773
774
                                pdsch_vars[eNB_id]->rxdataF_comp0,
                                pdsch_vars[eNB_id]->dl_ch_rho_ext[harq_pid][round],
                                pdsch_vars[eNB_id]->llr[1],
775
                                symbol,first_symbol_flag,nb_rb,
776
                                adjust_G2(frame_parms,dlsch1_harq->rb_alloc_even,2,subframe,symbol),
777
                                pdsch_vars[eNB_id]->llr128_2ndstream);
778
779
          }
        }
780
        else if (dlsch1_harq->Qm == 4) {
781
          dlsch_qpsk_16qam_llr(frame_parms,
782
                               pdsch_vars[eNB_id]->rxdataF_comp0,
783
784
                               rxdataF_comp_ptr,//i
                               dl_ch_mag_ptr,//i
785
786
                               pdsch_vars[eNB_id]->dl_ch_rho2_ext,
                               pdsch_vars[eNB_id]->llr[0],
787
                               symbol,first_symbol_flag,nb_rb,
Elena Lukashova's avatar
Elena Lukashova committed
788
                               adjust_G2(frame_parms,dlsch0_harq->rb_alloc_even,2,subframe,symbol),
789
                               pdsch_vars[eNB_id]->llr128);
790
791
792
          if (rx_type==rx_IC_dual_stream) {
            dlsch_16qam_qpsk_llr(frame_parms,
                                 rxdataF_comp_ptr,
793
                                 pdsch_vars[eNB_id]->rxdataF_comp0,//i
794
                                 dl_ch_mag_ptr,
795
796
                                 pdsch_vars[eNB_id]->dl_ch_rho_ext[harq_pid][round],
                                 pdsch_vars[eNB_id]->llr[1],
797
                                 symbol,first_symbol_flag,nb_rb,
Elena Lukashova's avatar
Elena Lukashova committed
798
                                 adjust_G2(frame_parms,dlsch1_harq->rb_alloc_even,4,subframe,symbol),
799
                                 pdsch_vars[eNB_id]->llr128_2ndstream);
800
801
802
803
          }
        }
        else {
          dlsch_qpsk_64qam_llr(frame_parms,
804
                               pdsch_vars[eNB_id]->rxdataF_comp0,
805
806
                               rxdataF_comp_ptr,//i
                               dl_ch_mag_ptr,//i
807
808
                               pdsch_vars[eNB_id]->dl_ch_rho2_ext,
                               pdsch_vars[eNB_id]->llr[0],
809
                               symbol,first_symbol_flag,nb_rb,
Elena Lukashova's avatar
Elena Lukashova committed
810
                               adjust_G2(frame_parms,dlsch0_harq->rb_alloc_even,2,subframe,symbol),
811
                               pdsch_vars[eNB_id]->llr128);
812
813
814
          if (rx_type==rx_IC_dual_stream) {
            dlsch_64qam_qpsk_llr(frame_parms,
                                 rxdataF_comp_ptr,
815
                                 pdsch_vars[eNB_id]->rxdataF_comp0,//i
816
                                 dl_ch_mag_ptr,
817
818
                                 pdsch_vars[eNB_id]->dl_ch_rho_ext[harq_pid][round],
                                 pdsch_vars[eNB_id]->llr[1],
819
                                 symbol,first_symbol_flag,nb_rb,
Elena Lukashova's avatar
Elena Lukashova committed
820
                                 adjust_G2(frame_parms,dlsch1_harq->rb_alloc_even,6,subframe,symbol),
821
                                 pdsch_vars[eNB_id]->llr128_2ndstream);
822
          }
823
        }
824
      }
825
826
    break;
  case 4 :
827
    if ((rx_type==rx_standard ) || (codeword_TB0 == -1) || (codeword_TB1 == -1)) {
Florian Kaltenberger's avatar