Class ReedSolomonDecoder
java.lang.Object
com.google.zxing.common.reedsolomon.ReedSolomonDecoder
Implements Reed-Solomon decoding, as the name implies.
The algorithm will not be explained here, but the following references were helpful in creating this implementation:
- Bruce Maggs. "Decoding Reed-Solomon Codes" (see discussion of Forney's Formula)
- J.I. Hall. "Chapter 5. Generalized Reed-Solomon Codes" (see discussion of Euclidean algorithm)
Much credit is due to William Rucklidge since portions of this code are an indirect port of his C++ Reed-Solomon implementation.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddecode(int[] received, int twoS) Decodes given set of received codewords, which include both data and error-correction codewords.intdecodeWithECCount(int[] received, int twoS) Decodes given set of received codewords, which include both data and error-correction codewords.private int[]findErrorLocations(GenericGFPoly errorLocator) private int[]findErrorMagnitudes(GenericGFPoly errorEvaluator, int[] errorLocations) private GenericGFPoly[]runEuclideanAlgorithm(GenericGFPoly a, GenericGFPoly b, int R)
-
Field Details
-
field
-
-
Constructor Details
-
ReedSolomonDecoder
-
-
Method Details
-
decode
Decodes given set of received codewords, which include both data and error-correction codewords. Really, this means it uses Reed-Solomon to detect and correct errors, in-place, in the input.
- Parameters:
received- data and error-correction codewordstwoS- number of error-correction codewords available- Throws:
ReedSolomonException- if decoding fails for any reason
-
decodeWithECCount
Decodes given set of received codewords, which include both data and error-correction codewords. Really, this means it uses Reed-Solomon to detect and correct errors, in-place, in the input.
- Parameters:
received- data and error-correction codewordstwoS- number of error-correction codewords available- Returns:
- the number of errors corrected
- Throws:
ReedSolomonException- if decoding fails for any reason
-
runEuclideanAlgorithm
private GenericGFPoly[] runEuclideanAlgorithm(GenericGFPoly a, GenericGFPoly b, int R) throws ReedSolomonException - Throws:
ReedSolomonException
-
findErrorLocations
- Throws:
ReedSolomonException
-
findErrorMagnitudes
-