projects
/
paraslash.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
mp3dec: Improve bad main_data_begin pointer error handling.
[paraslash.git]
/
fec.c
diff --git
a/fec.c
b/fec.c
index
e543aed
..
e4cdbaf
100644
(file)
--- a/
fec.c
+++ b/
fec.c
@@
-1,5
+1,6
@@
+/** \file fec.c Forward error correction based on Vandermonde matrices. */
+
/*
/*
- * fec.c -- forward error correction based on Vandermonde matrices
* 980624
* (C) 1997-98 Luigi Rizzo (luigi@iet.unipi.it)
*
* 980624
* (C) 1997-98 Luigi Rizzo (luigi@iet.unipi.it)
*
@@
-32,6
+33,7
@@
* OF SUCH DAMAGE.
*/
* OF SUCH DAMAGE.
*/
+
#include "para.h"
#include "error.h"
#include "portable_io.h"
#include "para.h"
#include "error.h"
#include "portable_io.h"
@@
-214,7
+216,7
@@
static void matmul(unsigned char *a, unsigned char *b, unsigned char *c,
* Compute the inverse of a matrix.
*
* k is the size of the matrix 'src' (Gauss-Jordan, adapted from Numerical
* Compute the inverse of a matrix.
*
* k is the size of the matrix 'src' (Gauss-Jordan, adapted from Numerical
- * Recipes in C). Returns
-1 if 'src' is singular
.
+ * Recipes in C). Returns
negative on errors
.
*/
static int invert_mat(unsigned char *src, int k)
{
*/
static int invert_mat(unsigned char *src, int k)
{
@@
-394,8
+396,13
@@
static void init_fec(void)
fec_initialized = 1;
}
fec_initialized = 1;
}
+/** Internal FEC parameters. */
struct fec_parms {
struct fec_parms {
- int k, n; /* parameters of the code */
+ /** Number of data slices. */
+ int k;
+ /** Number of slices (including redundant slices). */
+ int n;
+ /** The encoding matrix, computed by init_fec(). */
unsigned char *enc_matrix;
};
unsigned char *enc_matrix;
};
@@
-480,7
+487,7
@@
int fec_new(int k, int n, struct fec_parms **result)
* \param sz The size of the input data packets.
*
* Encode the \a k slices of size \a sz given by \a src and store the output
* \param sz The size of the input data packets.
*
* Encode the \a k slices of size \a sz given by \a src and store the output
- * slice number \a idx in \dst.
+ * slice number \a idx in \
a
dst.
*/
void fec_encode(struct fec_parms *parms, const unsigned char * const *src,
unsigned char *dst, int idx, int sz)
*/
void fec_encode(struct fec_parms *parms, const unsigned char * const *src,
unsigned char *dst, int idx, int sz)
@@
-553,7
+560,7
@@
err:
/**
* Decode one slice from the group of received slices.
*
/**
* Decode one slice from the group of received slices.
*
- * \param
code
Pointer to fec params structure.
+ * \param
parms
Pointer to fec params structure.
* \param data Pointers to received packets.
* \param idx Pointer to packet indices (gets modified).
* \param sz Size of each packet.
* \param data Pointers to received packets.
* \param idx Pointer to packet indices (gets modified).
* \param sz Size of each packet.