Exported symbols from fec.c.
More...
|
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...
|
|
Exported symbols from fec.c.
◆ 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.
◆ 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
-
k | Number of input slices. |
n | Number of output slices. |
result | On 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
-
◆ 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
-
parms | The fec parameters returned earlier by fec_new(). |
src | The k data slices to encode. |
dst | Result pointer. |
idx | The index of the slice to compute. |
sz | The 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
-
parms | Pointer to fec params structure. |
data | Pointers to received packets. |
idx | Pointer to packet indices (gets modified). |
sz | Size 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.