paraslash Paraslash Audio Streaming
About   News   Download   Documentation   Development

Functions | Macros
fec.h File Reference

Detailed Description

Forward Error Correction: API.

This implementation of forward error correction employs the Reed Solomon error-correcting code, which is based on Galois field algebra and Vandermonde matrices. The algorithm is implemented in fec.c. The two users are the virtual streaming system (vss.h), which fec-encodes data chunks before sending them over the network, and the fecdec filter (fecdec_filter.c), which decodes fec-encoded chunks and feeds the decoded chunks to the output channel of the buffer tree node for subordinated buffer tree nodes to process.

The API is relatively simple as it contains only the few non-static functions described here. Both the sending and the receiving side first call fec_new() to obtain a reference to an opaque fec handle. The virtual streaming system calls fec_encode() while the fecdec filter calls fec_decode().

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)
 

Macros

#define FEC_HEADER_SIZE
 
#define FEC_MAGIC
 

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 k source slices of size sz and return the slice identified by idx.

◆ 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
Standard.

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.

Macro Definition Documentation

◆ FEC_HEADER_SIZE

#define FEC_HEADER_SIZE

Each FEC slice contains a FEC header of this size.

The value is needed by the virtual streaming system and the fec decoder implemented in fecdec_filter.c.

◆ FEC_MAGIC

#define FEC_MAGIC

The FEC header starts with this magic value.