Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-RAN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
canghaiwuhen
OpenXG-RAN
Commits
4c86d4fb
Commit
4c86d4fb
authored
Jan 23, 2018
by
Florian Kaltenberger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adding latest version of ldpc_encoder from branch feature_ldpc_coding
parent
188a6013
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
5925 additions
and
601 deletions
+5925
-601
cmake_targets/CMakeLists.txt
cmake_targets/CMakeLists.txt
+1
-0
openair1/PHY/CODING/TESTBENCH/ldpctest.c
openair1/PHY/CODING/TESTBENCH/ldpctest.c
+61
-48
openair1/PHY/CODING/defs.h
openair1/PHY/CODING/defs.h
+1
-0
openair1/PHY/CODING/ldpc_encoder.c
openair1/PHY/CODING/ldpc_encoder.c
+5414
-553
openair1/PHY/CODING/ldpc_generate_coefficient.c
openair1/PHY/CODING/ldpc_generate_coefficient.c
+448
-0
No files found.
cmake_targets/CMakeLists.txt
View file @
4c86d4fb
...
...
@@ -1089,6 +1089,7 @@ set(PHY_SRC
${
OPENAIR1_DIR
}
/PHY/CODING/nr_segmentation.c
${
OPENAIR1_DIR
}
/PHY/CODING/ldpc_decoder.c
${
OPENAIR1_DIR
}
/PHY/CODING/ldpc_encoder.c
${
OPENAIR1_DIR
}
/PHY/CODING/ldpc_generate_coefficient.c
${
OPENAIR1_DIR
}
/PHY/CODING/ccoding_byte.c
${
OPENAIR1_DIR
}
/PHY/CODING/ccoding_byte_lte.c
${
OPENAIR1_DIR
}
/PHY/CODING/3gpplte_sse.c
...
...
openair1/PHY/CODING/TESTBENCH/ldpctest.c
View file @
4c86d4fb
...
...
@@ -26,6 +26,8 @@
#include "SIMULATION/TOOLS/defs.h"
// 4-bit quantizer
char
quantize4bit
(
double
D
,
double
x
)
{
...
...
@@ -81,7 +83,7 @@ int test_ldpc(short No_iteration,
double
*
modulated_input
;
short
*
channel_output_fixed
;
unsigned
int
i
,
trial
=
0
;
short
BG
,
Zc
,
Kb
,
nrows
,
ncols
,
channel_temp
;
short
BG
,
Zc
,
Kb
,
nrows
,
ncols
;
int
no_punctured_columns
,
removed_bit
;
int
i1
;
//Table of possible lifting sizes
...
...
@@ -89,14 +91,13 @@ int test_ldpc(short No_iteration,
*
errors
=
0
;
*
crc_misses
=
0
;
// generate input block
test_input
=
(
unsigned
char
*
)
malloc
(
sizeof
(
unsigned
char
)
*
block_length
/
8
);
test_input
=
(
unsigned
char
*
)
malloc
(
sizeof
(
unsigned
char
)
*
block_length
/
8
);
channel_input
=
(
unsigned
char
*
)
malloc
(
sizeof
(
unsigned
char
)
*
68
*
384
);
modulated_input
=
(
double
*
)
malloc
(
sizeof
(
double
)
*
68
*
384
);
channel_output
=
(
double
*
)
malloc
(
sizeof
(
double
)
*
68
*
384
);
reset_meas
(
&
time
);
while
(
trial
++
<
ntrials
)
{
for
(
i
=
0
;
i
<
block_length
/
8
;
i
++
)
{
//test_input[i]=(unsigned char) rand();
...
...
@@ -104,32 +105,31 @@ int test_ldpc(short No_iteration,
}
//determine number of bits in codeword
//if (block_length>3840)
//{
BG
=
1
;
Kb
=
22
;
nrows
=
46
;
//parity check bits
ncols
=
22
;
//info bits
// }
/*
else if (block_length<=3840)
{
BG=2;
nrows=42; //parity check bits
ncols=10; // info bits
if (block_length>640)
Kb = 10;
else if (block_length>560)
Kb = 9;
else if (block_length>192)
Kb = 8;
else
Kb = 6;
}
*/
if
(
block_length
>
3840
)
{
BG
=
1
;
Kb
=
22
;
nrows
=
46
;
//parity check bits
ncols
=
22
;
//info bits
}
else
if
(
block_length
<=
3840
)
{
BG
=
2
;
nrows
=
42
;
//parity check bits
ncols
=
10
;
// info bits
if
(
block_length
>
640
)
Kb
=
10
;
else
if
(
block_length
>
560
)
Kb
=
9
;
else
if
(
block_length
>
192
)
Kb
=
8
;
else
Kb
=
6
;
}
//find minimum value in all sets of lifting size
Zc
=
0
;
for
(
i1
=
0
;
i1
<
51
;
i1
++
)
{
if
(
lift_size
[
i1
]
>=
(
double
)
block_length
/
Kb
)
...
...
@@ -140,21 +140,30 @@ int test_ldpc(short No_iteration,
}
}
printf
(
"BG %d, Zc %d, Kb %d
\n
"
,
BG
,
Zc
,
Kb
);
no_punctured_columns
=
(
int
)((
nrows
-
2
)
*
Zc
+
block_length
-
block_length
/
rate
)
/
Zc
;
//printf("%d\n",no_punctured_columns);
start_meas
(
&
time
);
//// encoder
ldpc_encoder
(
test_input
,
channel_input
,
block_length
,
rate
);
stop_meas
(
&
time
);
print_meas_now
(
&
time
,
""
,
stdout
);
for
(
i
=
0
;
i
<
10
;
i
++
)
printf
(
"channel_input[%d]=%d
\n
"
,
i
,
channel_input
[
i
]);
for
(
trial
=
0
;
trial
<
ntrials
;
trial
++
)
{
//// encoder
if
(
ntrials
==
1
)
ldpc_encoder_orig
(
test_input
,
channel_input
,
block_length
,
rate
,
1
);
else
{
start_meas
(
&
time
);
if
(
BG
==
1
)
ldpc_encoder
(
test_input
,
channel_input
,
block_length
,
rate
);
else
ldpc_encoder_orig
(
test_input
,
channel_input
,
block_length
,
rate
,
0
);
stop_meas
(
&
time
);
}
//print_meas_now(&time, "", stdout);
ldpc_encoder_orig
(
test_input
,
channel_input
,
block_length
,
rate
);
for
(
i
=
0
;
i
<
10
;
i
++
)
printf
(
"channel_input[%d]=%d
\n
"
,
i
,
channel_input
[
i
]);
// for (i=0;i<8448;i++)
//printf("channel_input[%d]=%d\n",i,channel_input[i]);
//printf("%d ",channel_input[i]);
if
((
BG
==
2
)
&&
(
Zc
==
128
||
Zc
==
256
))
{
...
...
@@ -210,24 +219,27 @@ int test_ldpc(short No_iteration,
free
(
channel_output_fixed
);
}
else
printf
(
"decoder is not supported
\n
"
);
if
(
trial
==
0
)
printf
(
"decoder is not supported
\n
"
);
}
print_meas
(
&
time
,
"ldpc encoder"
,
NULL
,
NULL
);
print_meas
(
&
time
,
"ldpc_encoder"
,
NULL
,
NULL
);
return
*
errors
;
}
int
main
(
int
argc
,
char
*
argv
[])
{
unsigned
int
errors
,
crc_misses
;
short
block_length
=
22
*
128
;
// decoder supports length: 1201 -> 1280, 2401 -> 2560
short
block_length
=
22
*
384
;
// decoder supports length: 1201 -> 1280, 2401 -> 2560
short
No_iteration
=
25
;
double
rate
=
0
.
333
;
double
SNR
,
SNR_lin
;
unsigned
char
qbits
=
4
;
unsigned
int
decoded_errors
[
100
];
// initiate the size of matrix equivalent to size of SNR
int
c
,
i
=
0
;
int
ntrials
=
100
;
int
n
_
trials
=
100
;
randominit
(
0
);
while
((
c
=
getopt
(
argc
,
argv
,
"q:r:l:n:"
))
!=
-
1
)
...
...
@@ -245,9 +257,9 @@ int main(int argc, char *argv[])
block_length
=
atoi
(
optarg
);
break
;
case
'n'
:
n
trials
=
atoi
(
optarg
);
break
;
case
'n'
:
n_
trials
=
atoi
(
optarg
);
break
;
default:
abort
();
...
...
@@ -266,10 +278,10 @@ int main(int argc, char *argv[])
SNR_lin
,
// noise standard deviation
qbits
,
block_length
,
// block length bytes
ntrials
,
n
_
trials
,
&
errors
,
&
crc_misses
);
printf
(
"SNR %f, BLER %f (%d/%d)
\n
"
,
SNR
,(
float
)
decoded_errors
[
i
]
/
(
float
)
n
trials
,
decoded_errors
[
i
],
n
trials
);
printf
(
"SNR %f, BLER %f (%d/%d)
\n
"
,
SNR
,(
float
)
decoded_errors
[
i
]
/
(
float
)
n
_trials
,
decoded_errors
[
i
],
n_
trials
);
i
=
i
+
1
;
}
...
...
@@ -277,3 +289,4 @@ int main(int argc, char *argv[])
}
openair1/PHY/CODING/defs.h
View file @
4c86d4fb
...
...
@@ -573,5 +573,6 @@ void phy_viterbi_dot11(int8_t *,uint8_t *,uint16_t);
short
*
ldpc_decoder
(
short
*
msgChannel
,
short
block_length
,
short
No_iteration
,
double
rate
);
int
ldpc_encoder
(
unsigned
char
*
test_input
,
unsigned
char
*
channel_input
,
short
block_length
,
double
rate
);
int
ldpc_encoder_orig
(
unsigned
char
*
test_input
,
unsigned
char
*
channel_input
,
short
block_length
,
double
rate
,
unsigned
char
gen_code
);
#endif
openair1/PHY/CODING/ldpc_encoder.c
View file @
4c86d4fb
This diff is collapsed.
Click to expand it.
openair1/PHY/CODING/ldpc_generate_coefficient.c
0 → 100644
View file @
4c86d4fb
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment