GSoC ’13LDPC Codes and More FEC in GNU Radio
Manu T SMentor : Dr.-Ing. Jens Elsner
IIT Bombay
October 1, 2013
Manu T S (IITB) GSoC ’ 13 October 1, 2013 1 / 21
An Evaluation
The Original Proposal
Generic Encoder/Decoder for LDPC codes
Algorithms for generating LDPC codes
Improve RS codes, add BCH etc
The Outcomes
Generic Encoder/Decoder for LDPC codes
2 Algorithms for generating LDPC codes
An attempt to incorporate LDPC into FECAPI
Manu T S (IITB) GSoC ’ 13 October 1, 2013 2 / 21
What is an LDPC Code
A linear error correcting code
All codewords should satisfyHx = 0 (1)
Any vector that satisfy above equation is a codeword
A block codeIf H is M x N and has rank R then the code has dimension
K = N − R
Block length of the code is N.
Sparse H
Here we are dealing with binary LDPC codes, so H has few 1s rest all zeros
Manu T S (IITB) GSoC ’ 13 October 1, 2013 3 / 21
Tanner Graph
H =
1 1 0 1 1 0 01 0 1 1 0 1 00 1 1 1 0 0 1
(2)
x7
x6
x5
x4
x3
x2
x1
f3
f2
f1
(a)
Manu T S (IITB) GSoC ’ 13 October 1, 2013 4 / 21
How we split up the work
Tracie / ManuConstruction of LDPC codes.
Regular LDPC matrix
LDPC codes based on Reed-Solomon codes
Progressive Edge Growth Algorithm
Encoding Techniques.
Transform parity check matrix into approximate upper triangular matrix
Obtain G = [I P] followed by matrix multiplication
Decoding Techniques.
Bit-Flip Decoding
Message Passing decoder for BSC
Message Passing decoder for AWGN Channel
Manu T S (IITB) GSoC ’ 13 October 1, 2013 5 / 21
The Algorithms - Encoding
If the parity check matrix is given as [I P], where I is N − K x N − K identitymatrix, P is some N − K x K matrix, a codeword x =
[xT
p xTd
]T can beformed by assigning
xp = P · xd
We obtain G = [I P] from H by
Column permutation
Row additions
Row permutations
Suppose f represents the permutation in obtaining G from H, and G · x = 0,then H · f (x) = 0
Manu T S (IITB) GSoC ’ 13 October 1, 2013 6 / 21
The Algorithms - Encoding
x0 x1 x2 x3 x4 x5 x6
xp xd
x
2 0 3 1 5 4 6f
x1 x3 x0 x2 x5 x4 x6f (x)
Manu T S (IITB) GSoC ’ 13 October 1, 2013 7 / 21
The Algorithms - Encoding
std::vector <char > cldpc:: encode(std::vector <char > dataword) {
if (dataword.size() == K) {
GF2Vec x(N);
GF2Vec data(K);
data.set_vec(dataword );
for ( int i = rank_H; i < N; i++ ) {
x[i] = dataword[i - rank_H ];
}
for ( int i = 0; i < rank_H; i++ ) {
x[i] = G[i]. sub_vector(N-K, N)*data;
}
GF2Vec y(N);
for ( int i = 0; i < N; i++ ) {
y[permute[i]] = x[i];
}
return y.get_vec ();
}
}
Manu T S (IITB) GSoC ’ 13 October 1, 2013 8 / 21
The Algorithms - Message Passing
7654321
3
2
11
�
check-to-variable
7654321
3
2
13
(0 0)(? ?)(0 0)(1 1)(? ?)(? ?)(0 0)
2
�
variable-to-check
(0 0)(? ?)(0 0)(1 1)(? ?)(1 ?)(0 0)
4
Manu T S (IITB) GSoC ’ 13 October 1, 2013 9 / 21
The Algorithms - Message Passing
7654321
3
2
15
7654321
3
2
17
(0 0)(? ?)(0 0)(1 1)(0 ?)(1 ?)(0 0)
6(0 0)(1 ?)(0 0)(1 1)(0 ?)(1 ?)(0 0)
8
Manu T S (IITB) GSoC ’ 13 October 1, 2013 10 / 21
The Algorithms - Message Passing
std::vector <char > awgn_bp :: decode(std::vector <float > rx_word ,
int *niteration) {
*niteration = 0;
compute_init_estimate(rx_word );
if (is_codeword ()) {
return estimate;
}
else {
rx_lr_calc(rx_word );
spa_initialize ();
while (* niteration < max_iterations) {
*niteration += 1;
update_chks ();
update_vars ();
decision ();
if (is_codeword ()) {
break;
}
}
return estimate;
}
}
Manu T S (IITB) GSoC ’ 13 October 1, 2013 11 / 21
The Algorithms - Generation of LDPC codes
Regular and Irregular Progressive Edge Growth Tanner Graphs
Suboptimal solution for a hard Combinatorial problem
Initialized from N, M, and symbol node degree sequence
The insertion of new edge has minimum effect on the girth of the graph
Both regular and irregular LDPC codes can be constructed
LDPC Codes based on RS Codes with 2 information symbols
Constructs a regular LDPC codes.
Makes sure that there are no length 4 cycles
Manu T S (IITB) GSoC ’ 13 October 1, 2013 12 / 21
Introducing gr-ldpc OOT Module
The classes and blocks
Class for GF(2) Vector arithmetic.
Class for GF(2) Matrix arithmetic.
Class for accessing LDPC codes in “alist-file” format.
Class for holding an LDPC code.
Class for message passing mechanisms for BSC and AWGN channels.
LDPC Encoder block.
LDPC Decoder blocks, for both float inputs and byte inputs.
Two algorithms for construction of LDPC codes
Codes available in github
Manu T S (IITB) GSoC ’ 13 October 1, 2013 13 / 21
Bit Error Rate Performance
(3, 6) Regular Code of block length N = 96, dimension K = 50,Number of parity checks M = 48, 107 Bytes Transferred
No Code With LDPCsigma Errors BER Errors BER0.3 4338 0.0004338 0 00.4 61814 0.0061814 0 00.5 227228 0.0227228 31 3.1e-060.6 477744 0.0477744 65855 0.00658550.7 765326 0.0765326 572393 0.05723930.8 1055848 0.1055848 968856 0.09688560.9 1332039 0.1332039 1291208 0.12912081.0 1585653 0.1585653 1565803 0.1565803
Manu T S (IITB) GSoC ’ 13 October 1, 2013 15 / 21
Block Error Rate Performance
LDPC generated using PEG Algorithm,Block length N = 1008, Dimension K = 504Number of Parity Checks M = 504
No Code With LDPCsigma Errors BER Errors BER
0.3 3898 0.196461 0 00.4 18938 0.954488 0 00.5 19840 0.999994 0 00.6 19841 1.0 17 0.00085680.7 19841 1.0 19841 1.0
Manu T S (IITB) GSoC ’ 13 October 1, 2013 16 / 21
BER Plot
0 2 4 6 8 10 12Eb/N0
0.00
0.02
0.04
0.06
0.08
0.10
0.12
0.14
0.16BE
RBER Comparison
No CodeWith LDPC
Manu T S (IITB) GSoC ’ 13 October 1, 2013 17 / 21
Current Issues & Future Work
Current Issues
Have not finished porting them to fecapi
Initialization process is very slow.
LDPC codes saved as alist-file is only accepted.
Future Work
Finish porting the codes to fecapi
Optimization of message passing algorithms, initialization steps
Benchmarking the algorithms
VOLK for encoding, GF(2) matrix multiplication,
Bring more of FEC into fecapi framework
Manu T S (IITB) GSoC ’ 13 October 1, 2013 18 / 21
Lessons Learned and Experiences
How to use gr modtool.
fecapi framework.
Importance of testing the code.
Keep the mentor posted about what you do.
Improved my coding skills.
Manu T S (IITB) GSoC ’ 13 October 1, 2013 19 / 21
Acknowledgements
I take this opportunity to thank
Jens
Nick, Tracie
Prof. Sibi Raj B Pillai, IIT Bombay
Prof. Radford Neal, University of Toronto
Prof. Eric G. Larsson, Linkoping University
Sreeraj
GNU Radio Developers and Users
Ettus Research
GNU Radio Mailing List, USRP Users Mailing List
Google SoC Team
Manu T S (IITB) GSoC ’ 13 October 1, 2013 20 / 21
References
T. Richardson and R. Urbanke, “Modern Coding Theory”, Cambridge 2003.
I. Djurdjevic, Jun Xu, K. Abdel-Ghaffar and Shu Lin, “A class of low-density parity-check codes constructed based on Reed-Solomon
codes with two information symbols”, IEEE Communication Letters, July 2003.
T. Richardson, M Amin Shokrollahi and R. Urbanke,“Design of Capacity Approaching Irregular Low-Density Parity-Check Codes”,
Transactions On Information Theory, February 2001.
Xiao-Yu Hu, Evangelos Eleftheriou and Dieter M. Arnold, ”Regular and Irregular Progressive Edge-Growth Tanner Graphs”,Transactions on Information Theory, January 2005.
Jun Xu, Lei Chen, I. Djurdjevic, Shu Lin and K. Abdel-Ghaffar, “Construction of Regular and Irregular LDPC codes: GeometryDecomposition and Masking”, Transactions on Information Theory, January 2007.
David J. C. MacKay, “Good Error-Correcting Codes Based on Very Sparse Matrices”, Transactions on Information Theory, March1999.
Richard E. Blahut, “Algebraic Codes for Data Transmission”, Cambridge University Press 2003.
F.J. MacWilliams and N.J.A. Sloane. “Theory of Error-Correcting Codes”, North-Holland Publishing Company 1977.
Manu T S (IITB) GSoC ’ 13 October 1, 2013 21 / 21