Tuesday, June 4, 2013

Some DVB-T2 LDPC Generator Matrices

Here is a short tutorial on LDPC parity check matrices as used in DVB.  I do not profess to know everything, I am giving you what I know.

If you look in the DVB-T2 specification, ETSI EN 302 775, you will find some information about this in Annex A and Annex B, which just says "Addresses of parity bit accumulators for Nldpc = 64800 and 16200.  I don't know exactly what is meant here by addresses and accumulators, but have read of "repeat accumulate code", which look as if they are the specific kind of LDPC codes used in DVB.

In DVB-T2, two sizes of FEC blocks are used: 64800 bits, a.k.a. "normal" FEC blocks, and 16200 bits, a.k.a. "short" FEC blocks.

The size of a parity check matrix is expressed as mxn, where m is the number of rows, and n is the code length size.   Note that m is the number of rows and n the number of columns.

Now if you have the DVB-T2 Common Simulation Platform code, you can easily generate any of the parity check matrices in Matlab or GNU Octave.  Unzip the file somewhere, start Matlab or Octave and cd to DVB-T2-CSP-03-02-02/model/std/std_dvbt2std.  (You may need to use \ instead of /)

Type 'dir' and you should see the file t2_std_dvbt2_bl_ldpc.m.  Now use the function in this file generate a matrix:

H = t2_std_dvbt2_bl_ldpc(1/2, 64800, '1.2.1');

It is somewhat important to add the semicolon, otherwise H will be typed out, taking some time.

Note that the matrix generated is a sparse matrix.  Type

 nnz(H) / ( size(H,1) * size(H,2) ) * 100
and get:

ans =  0.010802

Only 0.01 % of the matrix entries are 1's, the rest are all zeros!   Only the 1's are saved in memory Matlab or Octave, otherwise it might not have been possible.

To view the matrix you have generated, type

spy(H)

and see:



Note that Octave is not very good with the aspect ratio.  Notice the right hand part of the octave where there is just a diagonal running from top left to bottom right.  This part has the same width and height.   I as able to resize it vertically to make it look square.

Before I explain more, let us generate the following one:

H = t2_std_dvbt2_bl_ldpc(2/3, 64800, '1.2.1');

Note, 2/3 is the Code Rate, meaning two thirds of the block length are useful bits, the rest are redundant forward error correction (FEC) bits. Type

spy(H)


What do you notice?  The  part looking almost solid is 3/4 of the whole width.  Whenever seeing a DVB LDPC matrix, you can almost tell from it what the Code Rate is.

In this case, the width of the solid part is 48600, thus the width of the right hand side is 64800 - 48600 = 16200, which is also the height of the matrix.

This means, that 48600 bits of real information is encoded, 16200 parity check bits are added to for a "Code Word" of 64800 bits, which is also called an FEC block.

Try one more example:

H = t2_std_dvbt2_bl_ldpc(5/6, 64800, '1.2.1');

Again:

5/6 is the Code Rate
64800 is the Block Length
1.2.1 is the DVB T2 version.  If you read the code of the function, you will see the version number only counts in about one special case.

Type

spy(H)

 
 
You can of course, type
 
size(H)
 
and get
 
10800 64800
 
Let us have a closer look at the right hand bottom corner, by typing:
 
full(H(10790:10800, 64790:64800))
 
and we get
 
          1        0        0        0        0        0        0        0        0        0        0
          1        1        0        0        0        0        0        0        0        0        0
          0        1        1        0        0        0        0        0        0        0        0
          0        0        1        1        0        0        0        0        0        0        0
          0        0        0        1        1        0        0        0        0        0        0
          0        0        0        0        1        1        0        0        0        0        0
          0        0        0        0        0        1        1        0        0        0        0
          0        0        0        0        0        0        1        1        0        0        0
          0        0        0        0        0        0        0        1        1        0        0
          0        0        0        0        0        0        0        0        1        1        0
          0        0        0        0        0        0        0        0        0        1        1
 
Notice there is not just a single diagonal as it appears in the spy graph.  In this right hand square, there are no 1's above the diagonal, but some 1's below it.  It is known as a "lower triangle" matrix. In Matlab/Octave, you can use the 'tril' function to test is a matrix is lower triangle.
I hope this helps!

 



 




 




No comments:

Post a Comment