Package org.yamcs.rs

Class ReedSolomon

java.lang.Object
org.yamcs.rs.ReedSolomon

public class ReedSolomon extends Object
Reed-Solomon encoder/decoder.
  • Constructor Summary

    Constructors
    Constructor
    Description
    ReedSolomon(int nroots, int symsize, int fcr, int prim, int gfpoly, int pad)
    Constructs a new encoder/decoder.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    decode(byte[] data, int[] eras_pos)
    Corrects in place data and returns the number of error corrected.
    void
    encode(byte[] data, byte[] parity)
     
    int
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 8
      fcr - 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

      public int decode(byte[] data, int[] eras_pos) throws ReedSolomonException
      Corrects in place data and returns the number of error corrected.
      Parameters:
      data - - data to be corrected
      eras_pos - - erasures positions (can be null)
      Returns:
      Throws:
      ReedSolomonException - - thrown if the data cannot be corrected
    • nroots

      public int nroots()