Advertisement
Guest User

CCSDS Reed-Solomon encoder attempt

a guest
Oct 1st, 2014
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.75 KB | None | 0 0
  1. final int SYNC_BYTES_LENGTH = 4;
  2. final int FRAME_LENGTH = 2040;
  3. final int FIELD_SIZE = 256;
  4.  
  5. byte[] frame = new byte[FRAME_LENGTH];
  6.  
  7. InputStream is = currentThread().getContextClassLoader()
  8.                 .getResourceAsStream("S3SAMPLE.BIN");
  9. is.skip(SYNC_BYTES_LENGTH);
  10.  
  11. // read a single frame
  12. new DataInputStream(is).readFully(frame);
  13. is.close();
  14.  
  15. expected = toInterleavedUnsignedIntArrayBlocks(frame, 0).get(0);
  16. unencoded = toInterleavedPaddedUnsignedIntArrayBlocks(frame, 0).get(0);
  17.  
  18. GenericGF field = new GenericGF(0x187, FIELD_SIZE, 0);
  19. int[] conventional = toConventional(unencoded);
  20. new ReedSolomonEncoder(field).encode(conventional, BLOCK_PARITY_LENGTH);
  21. int[] berlekamp = toBerlekamp(unencoded);
  22.  
  23. assertArrayEquals(expected, berlekamp);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement