public class Pure16Code extends PureCode
Constructor and Description |
---|
Pure16Code(int k,
int n)
Notes about large N support:
you can just generate the top k*k vandermonde matrix, call it V,
then invert it, then when you have k blocks generate a matrix M
with the k rows you need
|
Modifier and Type | Method and Description |
---|---|
void |
decode(byte[][] pkts,
int[] pktsOff,
int[] index,
int packetLength,
boolean inOrder)
This method takes an array of encoded packets and decodes them.
|
protected char[][] |
decode(char[][] pkts,
int[] pktsOff,
int[] index,
int numChars) |
void |
encode(byte[][] src,
int[] srcOff,
byte[][] repair,
int[] repairOff,
int[] index,
int packetLength)
encode accepts as input pointers to n data packets of size sz,
and produces as output a packet pointed to by fec, computed
with index "index".
|
protected void |
encode(char[][] src,
int[] srcOff,
char[] repair,
int repairOff,
int index,
int numChars)
ASSERT: index >= k && index < n
|
java.lang.String |
toString() |
protected static final FECMath fecMath
public Pure16Code(int k, int n)
public void encode(byte[][] src, int[] srcOff, byte[][] repair, int[] repairOff, int[] index, int packetLength)
encode
in class PureCode
src
- An array of k
byte[]'s that contain the source
packets to be encoded. Often these byte[]'s are actually references
to a single byte[] that contains the entire source block, then you must
simply vary the srcOff's to pass it in in this fashion. src[0] will
point to the 1st packet, src[1] to the second, etc.srcOff
- An array of integers which specifies the offset of each
each packet within its associated byte[].repair
- Much like src, variable points to a number of buffers
to which the encoded repair packets will be written. This array should
be the same length as repairOff and index.repairOff
- This is the repair analog to srcOff.index
- This int[] specifies the indexes of the packets to be
encoded and written to repair
. These indexes must be
between 0..n (should probably be k..n, because encoding < k is a NOP)packetLength
- the packetLength in bytes. All of the buffers
in src and repair are assumed to be this long.protected void encode(char[][] src, int[] srcOff, char[] repair, int repairOff, int index, int numChars)
public void decode(byte[][] pkts, int[] pktsOff, int[] index, int packetLength, boolean inOrder)
FECCode
shuffled
flag is set to true then it is assumed that
the packets are already in the proper order. If not then they will
have the references of the byte[]'s shuffled within the byte[][]. No
data will be copied, only references swapped. This means that if the
byte[][] is wrapping an underlying byte[] then the shuffling proceedure
may bring the byte[][] out of sync with the underlying data structure.
From an SPI perspective this means that the implementation is expected
to follow the exact same behavior as the shuffle() method in this class
which means that you should simply call shuffle() if the flag is false.decode
in class PureCode
pkts
- An array of k
byte[]'s that contain the repair
packets to be decoded. The decoding proceedure will copy the decoded
data into the byte[]'s that are provided and will place them in order
within the byte[][]. If the byte[][] is already properly shuffled
then the byte[]'s will not be moved around in the byte[][].pktsOff
- An array of integers which specifies the offset of each
each packet within its associated byte[].index
- This int[] specifies the indexes of the packets to be
decoded. These indexes must be between 0..npacketLength
- the packetLength in bytes. All of the buffers
in pkts are assumed to be this long.protected char[][] decode(char[][] pkts, int[] pktsOff, int[] index, int numChars)
Copyright © 2023. All rights reserved.