mirror of
https://github.com/zxing/zxing.git
synced 2025-03-05 20:48:51 -08:00
Restored a corrected Reed-Solomon optimization and fixed a small issue in black box test cases
git-svn-id: https://zxing.googlecode.com/svn/trunk@316 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
parent
c465263306
commit
4473c00147
|
@ -138,9 +138,9 @@ public final class ReedSolomonDecoder {
|
||||||
private int[] findErrorLocations(GF256Poly errorLocator) throws ReedSolomonException {
|
private int[] findErrorLocations(GF256Poly errorLocator) throws ReedSolomonException {
|
||||||
// This is a direct application of Chien's search
|
// This is a direct application of Chien's search
|
||||||
int numErrors = errorLocator.getDegree();
|
int numErrors = errorLocator.getDegree();
|
||||||
//if (numErrors == 1) { // shortcut
|
if (numErrors == 1) { // shortcut
|
||||||
// return new int[] { errorLocator.getCoefficient(1) };
|
return new int[] { errorLocator.getCoefficient(1) };
|
||||||
//}
|
}
|
||||||
int[] result = new int[numErrors];
|
int[] result = new int[numErrors];
|
||||||
int e = 0;
|
int e = 0;
|
||||||
for (int i = 1; i < 256 && e < numErrors; i++) {
|
for (int i = 1; i < 256 && e < numErrors; i++) {
|
||||||
|
@ -158,9 +158,6 @@ public final class ReedSolomonDecoder {
|
||||||
private int[] findErrorMagnitudes(GF256Poly errorEvaluator, int[] errorLocations) {
|
private int[] findErrorMagnitudes(GF256Poly errorEvaluator, int[] errorLocations) {
|
||||||
// This is directly applying Forney's Formula
|
// This is directly applying Forney's Formula
|
||||||
int s = errorLocations.length;
|
int s = errorLocations.length;
|
||||||
//if (s == 1) { // shortcut
|
|
||||||
// return new int[] { errorEvaluator.getCoefficient(0) };
|
|
||||||
//}
|
|
||||||
int[] result = new int[s];
|
int[] result = new int[s];
|
||||||
for (int i = 0; i < s; i++) {
|
for (int i = 0; i < s; i++) {
|
||||||
int xiInverse = field.inverse(errorLocations[i]);
|
int xiInverse = field.inverse(errorLocations[i]);
|
||||||
|
|
|
@ -108,7 +108,7 @@ public abstract class AbstractBlackBoxTestCase extends TestCase {
|
||||||
if (passed) {
|
if (passed) {
|
||||||
passedCount++;
|
passedCount++;
|
||||||
} else {
|
} else {
|
||||||
System.out.println("Mismatch: expected '" + expectedText + "' but got '" + resultText + '\'');
|
fail("Mismatch: expected '" + expectedText + "' but got '" + resultText + '\'');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try "try harder" mode
|
// Try "try harder" mode
|
||||||
|
|
Loading…
Reference in a new issue