Commit 49e26c7c authored by Florian Kaltenberger's avatar Florian Kaltenberger

adding llr clipping + other bugfixes

parent c2450fad
......@@ -91,6 +91,7 @@ int test_ldpc(short No_iteration,
//Table of possible lifting sizes
short lift_size[51]= {2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,18,20,22,24,26,28,30,32,36,40,44,48,52,56,60,64,72,80,88,96,104,112,120,128,144,160,176,192,208,224,240,256,288,320,352,384};
int n_segments=8;
int N; //length encoded block
t_nrLDPC_dec_params decParams;
int n_iter;
......@@ -165,7 +166,12 @@ int test_ldpc(short No_iteration,
}
}
printf("ldpc_test: block_length %d, BG %d, Zc %d, Kb %d\n",block_length,BG, Zc, Kb);
if (BG==1)
N=66*Zc;
else if (BG==2)
N=50*Zc;
printf("ldpc_test: block_length %d, BG %d, Zc %d, Kb %d, N %d\n",block_length,BG, Zc, Kb, N);
no_punctured_columns=(int)((nrows-2)*Zc+block_length-block_length*(1/((float)nom_rate/(float)denom_rate)))/Zc;
// printf("puncture:%d\n",no_punctured_columns);
removed_bit=(nrows-no_punctured_columns-2) * Zc+block_length-(int)(block_length/((float)nom_rate/(float)denom_rate));
......@@ -219,8 +225,13 @@ int test_ldpc(short No_iteration,
modulated_input[i]=-1/sqrt(2);
channel_output[i] = modulated_input[i] + gaussdouble(0.0,1.0) * 1/sqrt(2*SNR);
if (channel_output[i]>1.0)
channel_output_fixed[i]=127;
else if (channel_output[i]<-1.0)
channel_output_fixed[i]=-128;
else
channel_output_fixed[i] = (char) ((channel_output[i]*128)<0?(channel_output[i]*128-0.5):(channel_output[i]*128+0.5)); //fixed point 9-7
//printf("llr[%d]=%d\n",i,channel_output_fixed[i]);
//printf("llr[%d]=%d (%f)\n",i,channel_output_fixed[i],channel_output[i]);
}
/*
......@@ -239,7 +250,7 @@ int test_ldpc(short No_iteration,
// decoder supports BG2, Z=128 & 256
//estimated_output=ldpc_decoder(channel_output_fixed, block_length, No_iteration, (double)((float)nom_rate/(float)denom_rate));
nrLDPC_decoder(&decParams, channel_output_fixed, estimated_output, NULL);
n_iter = nrLDPC_decoder(&decParams, channel_output_fixed, estimated_output, NULL);
//for (i=(Kb+nrows) * Zc-5;i<(Kb+nrows) * Zc;i++)
// printf("esimated_output[%d]=%d\n",i,esimated_output[i]);
......
......@@ -50,14 +50,14 @@ int encode_parity_check_part_orig(unsigned char *c,unsigned char *d, short BG,sh
int i1,i2,i3,i4,i5,temp_prime;
unsigned char channel_temp,temp;
//if (BG==1)
if (BG==1)
{
no_shift_values=(short *) no_shift_values_BG1;
pointer_shift_values=(short *) pointer_shift_values_BG1;
nrows=46; //parity check bits
ncols=22; //info bits
}
/*else if (BG==2)
else if (BG==2)
{
no_shift_values=(short *) no_shift_values_BG2;
pointer_shift_values=(short *) pointer_shift_values_BG2;
......@@ -68,7 +68,7 @@ int encode_parity_check_part_orig(unsigned char *c,unsigned char *d, short BG,sh
printf("problem with BG\n");
return(-1);
}
*/
no_punctured_columns=(int)((nrows-2)*Zc+block_length-block_length*3)/Zc;
......
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