summaryrefslogtreecommitdiff
path: root/fec.c
diff options
context:
space:
mode:
authorDavid Woodhouse <dwmw2@infradead.org>2007-08-14 22:54:49 +0800
committerDavid Woodhouse <dwmw2@infradead.org>2007-08-14 22:54:49 +0800
commit5f262bc2fc1a427b20fd4f54df0dbe650da47807 (patch)
tree48ebd3fa20534eeb70e0163eba1b029e09492c00 /fec.c
parent596450e1d50cce8701dccd65eaa3d646f525b375 (diff)
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 <dwmw2@infradead.org>
Diffstat (limited to 'fec.c')
-rw-r--r--fec.c19
1 files changed, 19 insertions, 0 deletions
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
*/