Greetings,
I am trying to make use of the fec_encode() and fec_decode() functions provided in fec.c. However despite many source code comments, nothing explains the basic inputs and outputs of these functions or their meaning. The fec_test.c example that exercises these functions is also well obfuscated and lacks explanation.
The fec_encode() paramters seem a little more straightforward and I can guess at the parameters:
void fec_encode(
unsigned int blockSize,
unsigned char **data_blocks,
unsigned int nrDataBlocks,
unsigned char **fec_blocks,
unsigned int nrFecBlocks)
My guess:
blockSize, data_blocks – input, an array of pointers to data blocks of size blockSize. This is the data set that we want to add redundancy to.
nrDataBlocks – input, number of input data blocks we are passing in (i.e. array size of data_blocks)
fec_blocks – Pass in an array of blockSize block pointers. This is where fec_encode() will write redundancy blocks to
nrFecBlocks – This is the number of redundancy blocks we wish to add (i.e. array size of data blocks).
But now here’s where things get completely lost. On the decoding side you expect a collection of at least nrDataBlocks blocks (minimum required for FEC) out of the nrDataBlocks + nrFecBlocks blocks sent. It’s just not at all clear what all the parameters in fec_decode() mean. Please help!
void fec_decode(unsigned int blockSize,
unsigned char **data_blocks,
unsigned int nr_data_blocks,
unsigned char **fec_blocks,
unsigned int *fec_block_nos,
unsigned int *erased_blocks,
unsigned short nr_fec_blocks)