Package boofcv.alg.fiducial.qrcode
Class GaliosFieldOps
java.lang.Object
boofcv.alg.fiducial.qrcode.GaliosFieldOps
Basic path operators on polynomial Galious Field (GF) with GF(2) coefficients. Polynomials are stored
inside of integers with the least significant bits first. This class is primarily used to
populate precomputed tables.
Code and code comments based on the tutorial at [1].
[1] Reed-Solomon Codes for Coders Viewed on September 28, 2017
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic intadd(int a, int b) static intdivide(int dividend, int divisor) Divides dividend by the divisor and returns the integer results, e.g.static intlength(int value) The bit in which the most significant non-zero bit is storedstatic intmodulus(int dividend, int divisor) Performs the polynomial GF modulus operation.static intmultiply(int a, int b) Multiply the two polynomials together.static intmultiply(int x, int y, int primitive, int domain) Implementation of multiplication with a primitive polynomial.static intsubtract(int a, int b)
-
Constructor Details
-
GaliosFieldOps
public GaliosFieldOps()
-
-
Method Details
-
add
public static int add(int a, int b) -
subtract
public static int subtract(int a, int b) -
multiply
public static int multiply(int a, int b) Multiply the two polynomials together. The technique used here isn't the fastest but is easy to understand.
NOTE: No modulus operation is performed so the result might not be a member of the same field.
- Parameters:
a- polynomialb- polynomial- Returns:
- result polynomial
-
multiply
public static int multiply(int x, int y, int primitive, int domain) Implementation of multiplication with a primitive polynomial. The result will be a member of the same field as the inputs, provided primitive is an appropriate irreducible polynomial for that field. Uses 'Russian Peasant Multiplication' that should be a faster algorithm.- Parameters:
x- polynomialy- polynomialprimitive- Primitive polynomial which is irreducible.domain- Value of a the largest possible value plus 1. E.g. GF(2**8) would be 256- Returns:
- result polynomial
-
modulus
public static int modulus(int dividend, int divisor) Performs the polynomial GF modulus operation.
result = dividend mod divisor. -
divide
public static int divide(int dividend, int divisor) Divides dividend by the divisor and returns the integer results, e.g. no remainder.
result = dividend / divisor- Parameters:
dividend- number on topdivisor- number on bottom- Returns:
- number of times divisor goes into dividend.
-
length
public static int length(int value) The bit in which the most significant non-zero bit is stored
-