jabcode
 All Classes Files Functions Variables Enumerations Macros
ldpc.c File Reference

LDPC encoder and decoder. More...

#include <stdlib.h>
#include <math.h>
#include "jabcode.h"
#include "ldpc.h"
#include <string.h>
#include <stdio.h>
#include "detector.h"
#include "pseudo_random.h"

Functions

jab_int32 * createMatrixA (jab_int32 wc, jab_int32 wr, jab_int32 capacity)
 Create matrix A for message data. More...
 
jab_int32 GaussJordan (jab_int32 *matrixA, jab_int32 wc, jab_int32 wr, jab_int32 capacity, jab_int32 *matrix_rank, jab_boolean encode)
 Gauss Jordan elimination algorithm. More...
 
jab_int32 * createMetadataMatrixA (jab_int32 wc, jab_int32 capacity)
 Create the error correction matrix for the metadata. More...
 
jab_int32 * createGeneratorMatrix (jab_int32 *matrixA, jab_int32 capacity, jab_int32 Pn)
 Create the generator matrix to encode messages. More...
 
jab_dataencodeLDPC (jab_data *data, jab_int32 *coderate_params)
 LDPC encoding. More...
 
jab_int32 decodeMessage (jab_byte *data, jab_int32 *matrix, jab_int32 length, jab_int32 height, jab_int32 max_iter, jab_boolean *is_correct, jab_int32 start_pos)
 Iterative hard decision error correction decoder. More...
 
jab_int32 decodeLDPChd (jab_byte *data, jab_int32 length, jab_int32 wc, jab_int32 wr)
 LDPC decoding to perform hard decision. More...
 
jab_int32 decodeMessageILL (jab_float *enc, jab_int32 *matrix, jab_int32 length, jab_int32 checkbits, jab_int32 height, jab_int32 max_iter, jab_boolean *is_correct, jab_int32 start_pos, jab_byte *dec)
 LDPC Iterative Log Likelihood decoding algorithm for binary codes. More...
 
jab_int32 decodeMessageBP (jab_float *enc, jab_int32 *matrix, jab_int32 length, jab_int32 checkbits, jab_int32 height, jab_int32 max_iter, jab_boolean *is_correct, jab_int32 start_pos, jab_byte *dec)
 LDPC Iterative belief propagation decoding algorithm for binary codes. More...
 
jab_int32 decodeLDPC (jab_float *enc, jab_int32 length, jab_int32 wc, jab_int32 wr, jab_byte *dec)
 LDPC decoding to performe soft decision. More...
 

Detailed Description

LDPC encoder and decoder.

libjabcode - JABCode Encoding/Decoding Library

Copyright 2016 by Fraunhofer SIT. All rights reserved. See LICENSE file for full terms of use and distribution.

Contact: Huajian Liu liu@s.nosp@m.it.f.nosp@m.raunh.nosp@m.ofer.nosp@m..de Waldemar Berchtold walde.nosp@m.mar..nosp@m.berch.nosp@m.told.nosp@m.@sit..nosp@m.frau.nosp@m.nhofe.nosp@m.r.de

Function Documentation

jab_int32* createGeneratorMatrix ( jab_int32 *  matrixA,
jab_int32  capacity,
jab_int32  Pn 
)

Create the generator matrix to encode messages.

Parameters
matrixAthe error correction matrix
capacitythe number of columns of the matrix
Pnthe number of net message bits
Returns
the generator matrix | NULL if failed (out of memory)
jab_int32* createMatrixA ( jab_int32  wc,
jab_int32  wr,
jab_int32  capacity 
)

Create matrix A for message data.

Parameters
wcthe number of '1's in a column
wrthe number of '1's in a row
capacitythe number of columns of the matrix
Returns
the matrix A | NULL if failed (out of memory)
jab_int32* createMetadataMatrixA ( jab_int32  wc,
jab_int32  capacity 
)

Create the error correction matrix for the metadata.

Parameters
wcthe number of '1's in a column
capacitythe number of columns of the matrix
Returns
the error correction matrix | NULL if failed
jab_int32 decodeLDPC ( jab_float *  enc,
jab_int32  length,
jab_int32  wc,
jab_int32  wr,
jab_byte *  dec 
)

LDPC decoding to performe soft decision.

Parameters
encthe probability value for each bit position
lengththe encoded data length
wcthe number of '1's in each column
wrthe number of '1's in each row
decthe decoded data
Returns
the decoded data length | 0: decoding error
jab_int32 decodeLDPChd ( jab_byte *  data,
jab_int32  length,
jab_int32  wc,
jab_int32  wr 
)

LDPC decoding to perform hard decision.

Parameters
datathe encoded data
lengththe encoded data length
wcthe number of '1's in a column
wrthe number of '1's in a row
Returns
the decoded data length | 0: fatal error (out of memory)
jab_int32 decodeMessage ( jab_byte *  data,
jab_int32 *  matrix,
jab_int32  length,
jab_int32  height,
jab_int32  max_iter,
jab_boolean *  is_correct,
jab_int32  start_pos 
)

Iterative hard decision error correction decoder.

Parameters
datathe received data
matrixthe parity check matrix
lengththe encoded data length
heightthe number of check bits
max_iterthe maximal number of iterations
is_correctindicating if decodedMessage function could correct all errors
start_posindicating the position to start reading in data array
Returns
1: error correction succeeded | 0: fatal error (out of memory)
jab_int32 decodeMessageBP ( jab_float *  enc,
jab_int32 *  matrix,
jab_int32  length,
jab_int32  checkbits,
jab_int32  height,
jab_int32  max_iter,
jab_boolean *  is_correct,
jab_int32  start_pos,
jab_byte *  dec 
)

LDPC Iterative belief propagation decoding algorithm for binary codes.

Parameters
encthe received reliability value for each bit
matrixthe decoding matrixreliability value for each bit
lengththe encoded data length
checkbitsthe rank of the matrix
heightthe number of check bits
max_iterthe maximal number of iterations
is_correctindicating if decodedMessage function could correct all errors
start_posindicating the position to start reading in enc array
decis the tentative decision after each decoding iteration
Returns
1: error correction succeded | 0: decoding failed
jab_int32 decodeMessageILL ( jab_float *  enc,
jab_int32 *  matrix,
jab_int32  length,
jab_int32  checkbits,
jab_int32  height,
jab_int32  max_iter,
jab_boolean *  is_correct,
jab_int32  start_pos,
jab_byte *  dec 
)

LDPC Iterative Log Likelihood decoding algorithm for binary codes.

Parameters
encthe received reliability value for each bit
matrixthe error correction decoding matrix
lengththe encoded data length
checkbitsthe rank of the matrix
heightthe number of check bits
max_iterthe maximal number of iterations
is_correctindicating if decodedMessage function could correct all errors
start_posindicating the position to start reading in enc array
decis the tentative decision after each decoding iteration
Returns
1: success | 0: fatal error (out of memory)
jab_data* encodeLDPC ( jab_data data,
jab_int32 *  coderate_params 
)

LDPC encoding.

Parameters
datathe data to be encoded
coderate_paramsthe two code rate parameter wc and wr indicating how many '1' in a column (Wc) and how many '1' in a row of the parity check matrix
Returns
the encoded data | NULL if failed
jab_int32 GaussJordan ( jab_int32 *  matrixA,
jab_int32  wc,
jab_int32  wr,
jab_int32  capacity,
jab_int32 *  matrix_rank,
jab_boolean  encode 
)

Gauss Jordan elimination algorithm.

Parameters
matrixAthe matrix
wcthe number of '1's in a column
wrthe number of '1's in a row
capacitythe number of columns of the matrix
matrix_rankthe rank of the matrix
encodespecifies if function is called by the encoder or decoder
Returns
0: success | 1: fatal error (out of memory)