Commit e005717a authored by Wolfgang A. Mozart's avatar Wolfgang A. Mozart

some error checking

parent e0443bb0
...@@ -319,6 +319,7 @@ int ldpc_encoder(unsigned char *test_input,unsigned char *channel_input,short bl ...@@ -319,6 +319,7 @@ int ldpc_encoder(unsigned char *test_input,unsigned char *channel_input,short bl
} */ } */
//find minimum value in all sets of lifting size //find minimum value in all sets of lifting size
Zc=0;
for (i1=0; i1 < 51; i1++) for (i1=0; i1 < 51; i1++)
{ {
if (lift_size[i1] >= (double) block_length/Kb) if (lift_size[i1] >= (double) block_length/Kb)
...@@ -328,6 +329,11 @@ int ldpc_encoder(unsigned char *test_input,unsigned char *channel_input,short bl ...@@ -328,6 +329,11 @@ int ldpc_encoder(unsigned char *test_input,unsigned char *channel_input,short bl
break; break;
} }
} }
if (Zc==0) {
printf("ldpc_encoder: no lift_size found, problem in block_length %d\n",block_length);
return(-1);
}
// load base graph of generator matrix // load base graph of generator matrix
/* if (BG==1) /* if (BG==1)
...@@ -577,6 +583,14 @@ int ldpc_encoder(unsigned char *test_input,unsigned char *channel_input,short bl ...@@ -577,6 +583,14 @@ int ldpc_encoder(unsigned char *test_input,unsigned char *channel_input,short bl
d[t+45*Zc]=c[518]^c[2452]^c[3854]; d[t+45*Zc]=c[518]^c[2452]^c[3854];
} }
} }
else {
printf("lifting size Zc %d not optimized\n",Zc);
return(-1);
}
}
else {
printf("BG %d not optimized\n",BG);
return(-1);
} }
// information part and puncture columns // information part and puncture columns
...@@ -621,6 +635,7 @@ int ldpc_encoder_orig(unsigned char *test_input,unsigned char *channel_input,sho ...@@ -621,6 +635,7 @@ int ldpc_encoder_orig(unsigned char *test_input,unsigned char *channel_input,sho
}*/ }*/
//find minimum value in all sets of lifting size //find minimum value in all sets of lifting size
Zc=0;
for (i1=0; i1 < 51; i1++) for (i1=0; i1 < 51; i1++)
{ {
if (lift_size[i1] >= (double) block_length/Kb) if (lift_size[i1] >= (double) block_length/Kb)
...@@ -630,6 +645,10 @@ int ldpc_encoder_orig(unsigned char *test_input,unsigned char *channel_input,sho ...@@ -630,6 +645,10 @@ int ldpc_encoder_orig(unsigned char *test_input,unsigned char *channel_input,sho
break; break;
} }
} }
if (Zc==0) {
printf("ldpc_encoder: no lift_size found, problem in block_length %d\n",block_length);
return(-1);
}
// load base graph of generator matrix // load base graph of generator matrix
if (BG==1) if (BG==1)
......
...@@ -1019,7 +1019,9 @@ int dlsch_encoding(PHY_VARS_eNB *eNB, ...@@ -1019,7 +1019,9 @@ int dlsch_encoding(PHY_VARS_eNB *eNB,
unsigned int G; unsigned int G;
unsigned int crc=1; unsigned int crc=1;
#ifdef TD_DECODING
unsigned short iind; unsigned short iind;
#endif
LTE_DL_FRAME_PARMS *frame_parms = &eNB->frame_parms; LTE_DL_FRAME_PARMS *frame_parms = &eNB->frame_parms;
unsigned char harq_pid = dlsch->harq_ids[subframe]; unsigned char harq_pid = dlsch->harq_ids[subframe];
...@@ -1103,6 +1105,7 @@ int dlsch_encoding(PHY_VARS_eNB *eNB, ...@@ -1103,6 +1105,7 @@ int dlsch_encoding(PHY_VARS_eNB *eNB,
Kr_bytes = Kr>>3; Kr_bytes = Kr>>3;
#ifdef TD_DECODING
// get interleaver index for Turbo code (lookup in Table 5.1.3-3 36-212, V8.6 2009-03, p. 13-14) // get interleaver index for Turbo code (lookup in Table 5.1.3-3 36-212, V8.6 2009-03, p. 13-14)
if (Kr_bytes<=64) if (Kr_bytes<=64)
iind = (Kr_bytes-5); iind = (Kr_bytes-5);
...@@ -1114,9 +1117,9 @@ int dlsch_encoding(PHY_VARS_eNB *eNB, ...@@ -1114,9 +1117,9 @@ int dlsch_encoding(PHY_VARS_eNB *eNB,
iind = 123 + ((Kr_bytes-256)>>3); iind = 123 + ((Kr_bytes-256)>>3);
else { else {
printf("dlsch_coding: Illegal codeword size %d!!!\n",Kr_bytes); printf("dlsch_coding: Illegal codeword size %d!!!\n",Kr_bytes);
// return(-1); return(-1);
} }
#endif
#ifdef DEBUG_DLSCH_CODING #ifdef DEBUG_DLSCH_CODING
printf("Generating Code Segment %d (%d bits)\n",r,Kr); printf("Generating Code Segment %d (%d bits)\n",r,Kr);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment