Package org.yamcs.rs
Class ReedSolomon
java.lang.Object
org.yamcs.rs.ReedSolomon
Reed-Solomon encoder/decoder.
-
Constructor Summary
ConstructorsConstructorDescriptionReedSolomon
(int nroots, int symsize, int fcr, int prim, int gfpoly, int pad) Constructs a new encoder/decoder. -
Method Summary
-
Constructor Details
-
ReedSolomon
public ReedSolomon(int nroots, int symsize, int fcr, int prim, int gfpoly, int pad) Constructs a new encoder/decoder.- Parameters:
nroots
- the number of roots in the Reed Solomon code generator polynomial. This equals the number of parity symbols per code block.symsize
- the symbol size in bits, up to 8fcr
- in index form, the first consecutive root of the Reed Solomon code generator polynomial.prim
- in index form, the primitive element in the Galois field used to generate the Reed Solomon code generator polynomial.gfpoly
- the extended Galois field generator polynomial coefficients, with the 0th coefficient in the low order bit. The polynomial must be primitive; if not, an IllegalArgumentException will be thrown.pad
- the number of leading symbols in the codeword that are implicitly padded to zero in a shortened code block
-
-
Method Details
-
encode
public void encode(byte[] data, byte[] parity) -
decode
Corrects in place data and returns the number of error corrected.- Parameters:
data
- - data to be correctederas_pos
- - erasures positions (can be null)- Returns:
- Throws:
ReedSolomonException
- - thrown if the data cannot be corrected
-
nroots
public int nroots()
-