From 5f262bc2fc1a427b20fd4f54df0dbe650da47807 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Tue, 14 Aug 2007 22:54:49 +0800 Subject: Switch multicast distribution system to round-robin mode Send one packet from each eraseblock in turn, rather than all packets for one eraseblock together. This means that bursts of loss are evenly spread between blocks. It also makes the client side a bit more complex if you can't assume that there's anywhere except the flash to store its intermediate data. Signed-off-by: David Woodhouse --- fec.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'fec.c') diff --git a/fec.c b/fec.c index e374dfe..09e8453 100644 --- a/fec.c +++ b/fec.c @@ -742,6 +742,25 @@ fec_encode(struct fec_parms *code, gf *src[], gf *fec, int index, int sz) index, code->n - 1 ); } +void fec_encode_linear(struct fec_parms *code, gf *src, gf *fec, int index, int sz) +{ + int i, k = code->k ; + gf *p ; + + if (GF_BITS > 8) + sz /= 2 ; + + if (index < k) + bcopy(src + (index * sz), fec, sz*sizeof(gf) ) ; + else if (index < code->n) { + p = &(code->enc_matrix[index*k] ); + bzero(fec, sz*sizeof(gf)); + for (i = 0; i < k ; i++) + addmul(fec, src + (i * sz), p[i], sz ) ; + } else + fprintf(stderr, "Invalid index %d (max %d)\n", + index, code->n - 1 ); +} /* * shuffle move src packets in their position */ -- cgit v1.2.3