mirror of
https://github.com/zxing/zxing.git
synced 2025-02-02 05:41:08 -08:00
Issue 1762 PDF417 speed up and back-port to Java
git-svn-id: https://zxing.googlecode.com/svn/trunk@2870 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
parent
a1cd1991b8
commit
5fd33bb9d2
|
@ -98,9 +98,13 @@ final class PDF417CodewordDecoder {
|
|||
int bestMatch = -1;
|
||||
for (int j = 0; j < RATIOS_TABLE.length; j++) {
|
||||
float error = 0.0f;
|
||||
float[] ratioTableRow = RATIOS_TABLE[j];
|
||||
for (int k = 0; k < PDF417Common.BARS_IN_MODULE; k++) {
|
||||
float diff = RATIOS_TABLE[j][k] - bitCountRatios[k];
|
||||
float diff = ratioTableRow[k] - bitCountRatios[k];
|
||||
error += diff * diff;
|
||||
if (error >= bestMatchError) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (error < bestMatchError) {
|
||||
bestMatchError = error;
|
||||
|
|
|
@ -408,7 +408,11 @@ void LinesSampler::linesMatrixToCodewords(vector<vector<int> >& clusterNumbers,
|
|||
for (int j = 0; j < POSSIBLE_SYMBOLS; j++) {
|
||||
float error = 0.0f;
|
||||
for (int k = 0; k < BARS_IN_SYMBOL; k++) {
|
||||
error += pow(RATIOS_TABLE[j * BARS_IN_SYMBOL + k] - cwRatios[i][k], 2);
|
||||
float diff = RATIOS_TABLE[j * BARS_IN_SYMBOL + k] - cwRatios[i][k];
|
||||
error += diff * diff;
|
||||
if (error >= bestMatchError) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (error < bestMatchError) {
|
||||
bestMatchError = error;
|
||||
|
|
Loading…
Reference in a new issue