paraslash Paraslash Audio Streaming
About   News   Download   Documentation   Development

Macros | Functions
fec.h File Reference

Macros

#define FEC_HEADER_SIZE   32
 
#define FEC_MAGIC   0xFECC0DEC
 

Functions

int fec_new (int k, int n, struct fec_parms **parms)
 
void fec_free (struct fec_parms *p)
 
void fec_encode (struct fec_parms *parms, const unsigned char *const *src, unsigned char *dst, int idx, int sz)
 
int fec_decode (struct fec_parms *parms, unsigned char **data, int *idx, int sz)
 

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.