Class ECoCheckCodec
The checksum was provided as a way to catch some invalid encoding and employs a simple xor strategy. It was found
that this checksum was needed even when ECC was turned on because for smaller messages it had an unacceptable
false positive rate. The number of bits for the checksum is configurable
.
The Reed Solomon encoding used in ECoCheck is the same as what's used in QR Codes. It can detect and fix
errors inside of 8-bit words. Two words are needed to detect and recover from an error in a single word. This
will increase the packet size as an encoded message has to now be contained inside of "word" sized chunks and
several extra words are required to fix errors. The amount of error correction can be
configured
.
Number of bits used to encode the two ID numbers is dynamically determined based on their maximum value. The minimum number of bits is computed using this formula: bit count = ceil(log(max_number)/log(2))
Packet Format:- N-bits: Marker ID
- M-bits: Cell ID
- K-bits: XOR Checksum
-
Field Summary
Modifier and TypeFieldDescriptionprotected final PackedBits8
protected int
protected int
protected final DogArray_I8
protected int
static final int
static final int
protected final DogArray_I8
protected int
static final int
Number of bits per word -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
configure
(int numUniqueMarkers, int numUniqueCells) Computes how large of a grid will be needed to encode the coordinates + overhead.boolean
decode
(PackedBits8 readBits, CellValue cell) Decodes the read in bit array and converts it into a coordinate.void
encode
(int markerID, int cellID, PackedBits8 encodedPacket) Encodes the coordinate and copies the results into 'encodedPacket'double
Converts the level into a fraction
-
Field Details
-
MAX_ECC_LEVEL
public static final int MAX_ECC_LEVEL- See Also:
-
MAX_CHECKSUM_BITS
public static final int MAX_CHECKSUM_BITS- See Also:
-
WORD_BITS
public static final int WORD_BITSNumber of bits per word- See Also:
-
checksumMask
protected int checksumMask -
dataWords
protected int dataWords -
eccWords
protected int eccWords -
paddingBits
protected int paddingBits -
message
-
ecc
-
bits
-
-
Constructor Details
-
ECoCheckCodec
public ECoCheckCodec()
-
-
Method Details
-
configure
public void configure(int numUniqueMarkers, int numUniqueCells) Computes how large of a grid will be needed to encode the coordinates + overhead. Pre-allocates any memory that will be needed- Parameters:
numUniqueMarkers
- Maximum number of unique markers requirednumUniqueCells
- Maximum number of unique cell IDs in a marker required
-
encode
Encodes the coordinate and copies the results into 'encodedPacket'- Parameters:
markerID
- (Input) The marker's unique IDcellID
- (input) The cell's unique ID inside the markerencodedPacket
- (Output) The encoded packet
-
decode
Decodes the read in bit array and converts it into a coordinate. If true is returned then it believes it is a valid packet and has corrected minor errors. This won't catch every single failure but should catch most of them.- Parameters:
readBits
- (Input) Read in bits from an imagecell
- (Output) Found marker and cell ID- Returns:
- True is returned if it believes all errors have been fixed and the data is not corrupted.
-
errorCorrectionFraction
public double errorCorrectionFraction()Converts the level into a fraction
-