Commit a8bf0b23 authored by Raymond Knopp's avatar Raymond Knopp

andmask for both optimized encoder routines. Minor changes in ldpctest

parent 0b9d0158
...@@ -362,7 +362,7 @@ int test_ldpc(short No_iteration, ...@@ -362,7 +362,7 @@ int test_ldpc(short No_iteration,
printf("\ne %d..%d: ",i,i+15); printf("\ne %d..%d: ",i,i+15);
#endif #endif
if (channel_input[j][i-2*Zc]==0) if (channel_input_optim[j][i-2*Zc]==0)
modulated_input[j][i]=1.0;///sqrt(2); //QPSK modulated_input[j][i]=1.0;///sqrt(2); //QPSK
else else
modulated_input[j][i]=-1.0;///sqrt(2); modulated_input[j][i]=-1.0;///sqrt(2);
...@@ -386,7 +386,7 @@ int test_ldpc(short No_iteration, ...@@ -386,7 +386,7 @@ int test_ldpc(short No_iteration,
else else
channel_output_uncoded[j][i]=0; channel_output_uncoded[j][i]=0;
if (channel_output_uncoded[j][i] != channel_input[j][i-2*Zc]) if (channel_output_uncoded[j][i] != channel_input_optim[j][i-2*Zc])
*errors_bit_uncoded = (*errors_bit_uncoded) + 1; *errors_bit_uncoded = (*errors_bit_uncoded) + 1;
} }
......
...@@ -273,7 +273,7 @@ int ldpc_encoder_optim(unsigned char *test_input,unsigned char *channel_input,sh ...@@ -273,7 +273,7 @@ int ldpc_encoder_optim(unsigned char *test_input,unsigned char *channel_input,sh
if(tinput != NULL) start_meas(tinput); if(tinput != NULL) start_meas(tinput);
for (i=0; i<block_length; i++) { for (i=0; i<block_length; i++) {
c[i] = (test_input[i/8]&(128>>(i&7)))>>(i&7); c[i] = (test_input[i/8]&(128>>(i&7)))>>(7-(i&7));
//printf("c(%d,%d)=%d\n",j,i,temp); //printf("c(%d,%d)=%d\n",j,i,temp);
} }
...@@ -330,7 +330,7 @@ int ldpc_encoder_optim_8seg(unsigned char **test_input,unsigned char **channel_i ...@@ -330,7 +330,7 @@ int ldpc_encoder_optim_8seg(unsigned char **test_input,unsigned char **channel_i
#ifdef __AVX2__ #ifdef __AVX2__
__m256i shufmask = _mm256_set_epi64x(0x0303030303030303, 0x0202020202020202,0x0101010101010101, 0x0000000000000000); __m256i shufmask = _mm256_set_epi64x(0x0303030303030303, 0x0202020202020202,0x0101010101010101, 0x0000000000000000);
__m256i andmask = _mm256_set1_epi64x(0x8040201008040201); // every 8 bits -> 8 bytes, pattern repeats. __m256i andmask = _mm256_set1_epi64x(0x0102040810204080); // every 8 bits -> 8 bytes, pattern repeats.
__m256i zero256 = _mm256_setzero_si256(); __m256i zero256 = _mm256_setzero_si256();
__m256i masks[8]; __m256i masks[8];
register __m256i c256; register __m256i c256;
...@@ -413,7 +413,7 @@ int ldpc_encoder_optim_8seg(unsigned char **test_input,unsigned char **channel_i ...@@ -413,7 +413,7 @@ int ldpc_encoder_optim_8seg(unsigned char **test_input,unsigned char **channel_i
for (i=0; i<block_length; i++) { for (i=0; i<block_length; i++) {
for (j=0; j<n_segments; j++) { for (j=0; j<n_segments; j++) {
temp = (test_input[j][i/8]&(1<<(i&7)))>>(i&7); temp = (test_input[j][i/8]&(128>>(i&7)))>>(7-(i&7));
//printf("c(%d,%d)=%d\n",j,i,temp); //printf("c(%d,%d)=%d\n",j,i,temp);
c[i] |= (temp << j); c[i] |= (temp << j);
} }
...@@ -431,7 +431,7 @@ int ldpc_encoder_optim_8seg(unsigned char **test_input,unsigned char **channel_i ...@@ -431,7 +431,7 @@ int ldpc_encoder_optim_8seg(unsigned char **test_input,unsigned char **channel_i
for (i=(block_length>>5)<<5;i<block_length;i++) { for (i=(block_length>>5)<<5;i<block_length;i++) {
for (j=0; j<n_segments; j++) { for (j=0; j<n_segments; j++) {
temp = (test_input[j][i/8]&(128>>(i&7)))>>(i&7); temp = (test_input[j][i/8]&(128>>(i&7)))>>(7-(i&7));
//printf("c(%d,%d)=%d\n",j,i,temp); //printf("c(%d,%d)=%d\n",j,i,temp);
c[i] |= (temp << j); c[i] |= (temp << j);
} }
...@@ -639,7 +639,7 @@ int ldpc_encoder_optim_8seg_multi(unsigned char **test_input,unsigned char **cha ...@@ -639,7 +639,7 @@ int ldpc_encoder_optim_8seg_multi(unsigned char **test_input,unsigned char **cha
//for (j=0; j<n_segments; j++) { //for (j=0; j<n_segments; j++) {
for (j=macro_segment; j < macro_segment_end; j++) { for (j=macro_segment; j < macro_segment_end; j++) {
temp = (test_input[j][i/8]&(128>>(i&7)))>>(i&7); temp = (test_input[j][i/8]&(128>>(i&7)))>>(7-(i&7));
//printf("c(%d,%d)=%d\n",j,i,temp); //printf("c(%d,%d)=%d\n",j,i,temp);
c[i] |= (temp << (j-macro_segment)); c[i] |= (temp << (j-macro_segment));
} }
......
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