paraslash Paraslash Audio Streaming
About   News   Download   Documentation   Development

Macros | Functions
fec.h File Reference

Exported symbols from fec.c. More...

Macros

#define FEC_HEADER_SIZE   32
 Each FEC slice contains a FEC header of this size. More...
 
#define FEC_MAGIC   0xFECC0DEC
 The FEC header starts with this magic value. More...
 

Functions

int fec_new (int k, int n, struct fec_parms **parms)
 Create a new encoder and return an opaque descriptor to it. More...
 
void fec_free (struct fec_parms *p)
 Deallocate a fec params structure. More...
 
void fec_encode (struct fec_parms *parms, const unsigned char *const *src, unsigned char *dst, int idx, int sz)
 Compute one encoded slice of the given input. More...
 
int fec_decode (struct fec_parms *parms, unsigned char **data, int *idx, int sz)
 Decode one slice from the group of received slices. More...
 

Detailed Description

Exported symbols from fec.c.

Macro Definition Documentation

◆ FEC_HEADER_SIZE

#define FEC_HEADER_SIZE   32

Each FEC slice contains a FEC header of this size.

◆ FEC_MAGIC

#define FEC_MAGIC   0xFECC0DEC

The FEC header starts with this magic value.

Function Documentation

◆ fec_new()

int fec_new ( int  k,
int  n,
struct fec_parms **  result 
)

Create a new encoder and return an opaque descriptor to it.

Parameters
kNumber of input slices.
nNumber of output slices.
resultOn success the Fec descriptor is returned here.
Returns
Standard.

This creates the k*n encoding matrix. It is computed starting with a Vandermonde matrix, and then transformed into a systematic matrix.

◆ fec_free()

void fec_free ( struct fec_parms *  p)

Deallocate a fec params structure.

Parameters
pThe structure to free.

◆ fec_encode()

void fec_encode ( struct fec_parms *  parms,
const unsigned char *const *  src,
unsigned char *  dst,
int  idx,
int  sz 
)

Compute one encoded slice of the given input.

Parameters
parmsThe fec parameters returned earlier by fec_new().
srcThe k data slices to encode.
dstResult pointer.
idxThe index of the slice to compute.
szThe size of the input data packets.

Encode the k slices of size sz given by src and store the output slice number idx in dst.

◆ fec_decode()

int fec_decode ( struct fec_parms *  parms,
unsigned char **  data,
int *  idx,
int  sz 
)

Decode one slice from the group of received slices.

Parameters
parmsPointer to fec params structure.
dataPointers to received packets.
idxPointer to packet indices (gets modified).
szSize of each packet.
Returns
Zero on success, -1 on errors.

The data vector of received slices and the indices of slices are used to produce the correct output slice. The data slices are modified in-place.