public class QrCodePolynomialMath
extends java.lang.Object
[1] S. A. Tretter "Introduction to Bose Chaudhuri Hocquenghem codes" Goddard Space Flight Center, September 1967 [2] https://en.wikiversity.org/wiki/Reed–Solomon_codes_for_coders
| Modifier and Type | Field and Description |
|---|---|
static int |
FORMAT_GENERATOR |
static int |
FORMAT_MASK |
static int |
VERSION_GENERATOR |
| Constructor and Description |
|---|
QrCodePolynomialMath() |
| Modifier and Type | Method and Description |
|---|---|
static int |
bitPolyModulus(int data,
int generator,
int totalBits,
int dataBits)
Performs division using xcr operators on the encoded polynomials.
|
static boolean |
checkFormatBits(int bitsNoMask)
Check the format bits.
|
static boolean |
checkVersionBits(int bits)
Encodes the version bits.
|
static int |
correctDCH(int N,
int messageNoMask,
int generator,
int totalBits,
int dataBits)
Applies a brute force algorithm to find the message which has the smallest hamming distance.
|
static int |
correctFormatBits(int bitsNoMask)
Attempts to correct format bit sequence.
|
static int |
correctVersionBits(int bits)
Attempts to correct version bit sequence.
|
static void |
decodeFormatMessage(int message,
QrCode qr)
Assumes that the format message has no errors in it and decodes its data and saves it into the qr code
|
static int |
encodeFormatBits(QrCode.ErrorLevel level,
int mask)
Encodes the format bits.
|
static int |
encodeVersionBits(int version)
Encodes the version bits.
|
public static final int FORMAT_GENERATOR
public static final int FORMAT_MASK
public static final int VERSION_GENERATOR
public static int encodeVersionBits(int version)
version - QR code version. 7 to 40public static boolean checkVersionBits(int bits)
bits - Read in bits. Should encode 18-bitspublic static int correctVersionBits(int bits)
bits - Read in bits after removing the maskpublic static int encodeFormatBits(QrCode.ErrorLevel level, int mask)
level - Error correction levelmask - The type of mask that is applied to the qr codepublic static boolean checkFormatBits(int bitsNoMask)
public static void decodeFormatMessage(int message,
QrCode qr)
message - format data bits after the mask has been remove and shifted over 10 bitsqr - Where the results are written topublic static int correctFormatBits(int bitsNoMask)
bitsNoMask - Read in bits after removing the maskpublic static int correctDCH(int N,
int messageNoMask,
int generator,
int totalBits,
int dataBits)
N - Number of possible messages. 32 or 64messageNoMask - The observed message with mask removedgenerator - Generator polynomialtotalBits - Total number of bits in the message.dataBits - Total number of data bits in the messagepublic static int bitPolyModulus(int data,
int generator,
int totalBits,
int dataBits)
data - Data being checkedgenerator - Generator polynomialtotalBits - Total number of bits in datadataBits - Number of data bits. Rest are error correction bits