Fix Issue 1133, PDF417 issues with alpha mode after other modes

git-svn-id: https://zxing.googlecode.com/svn/trunk@2181 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
srowen 2012-02-12 19:08:56 +00:00
parent d6dc4bb237
commit e1c71e464b
4 changed files with 28 additions and 2 deletions

View file

@ -232,6 +232,10 @@ final class DecodedBitStreamParser {
subMode = Mode.PUNCT_SHIFT;
} else if (subModeCh == MODE_SHIFT_TO_BYTE_COMPACTION_MODE) {
result.append((char) byteCompactionData[i]);
// the pdf417 specs say we have to return to the last latched
// sub-mode. But I checked different encoder implementations and
// all of them return to alpha sub-mode after Shift-to-Byte
subMode = Mode.ALPHA;
}
}
break;
@ -255,6 +259,10 @@ final class DecodedBitStreamParser {
subMode = Mode.PUNCT_SHIFT;
} else if (subModeCh == MODE_SHIFT_TO_BYTE_COMPACTION_MODE) {
result.append((char) byteCompactionData[i]);
// the pdf417 specs say we have to return to the last latched
// sub-mode. But I checked different encoder implementations and
// all of them return to alpha sub-mode after Shift-to-Byte
subMode = Mode.ALPHA;
}
}
break;
@ -278,6 +286,10 @@ final class DecodedBitStreamParser {
subMode = Mode.PUNCT_SHIFT;
} else if (subModeCh == MODE_SHIFT_TO_BYTE_COMPACTION_MODE) {
result.append((char) byteCompactionData[i]);
// the pdf417 specs say we have to return to the last latched
// sub-mode. But I checked different encoder implementations and
// all of them return to alpha sub-mode after Shift-to-Byte
subMode = Mode.ALPHA;
}
}
break;
@ -291,6 +303,10 @@ final class DecodedBitStreamParser {
subMode = Mode.ALPHA;
} else if (subModeCh == MODE_SHIFT_TO_BYTE_COMPACTION_MODE) {
result.append((char) byteCompactionData[i]);
// the pdf417 specs say we have to return to the last latched
// sub-mode. But I checked different encoder implementations and
// all of them return to alpha sub-mode after Shift-to-Byte
subMode = Mode.ALPHA;
}
}
break;
@ -317,6 +333,14 @@ final class DecodedBitStreamParser {
} else {
if (subModeCh == PAL) {
subMode = Mode.ALPHA;
} else if (subModeCh == MODE_SHIFT_TO_BYTE_COMPACTION_MODE) {
// PS before Shift-to-Byte is used as a padding character,
// see 5.4.2.4 of the specification
result.append((char) byteCompactionData[i]);
// the pdf417 specs say we have to return to the last latched
// sub-mode. But I checked different encoder implementations and
// all of them return to alpha sub-mode after Shift-to-Byte
subMode = Mode.ALPHA;
}
}
break;
@ -423,6 +447,7 @@ final class DecodedBitStreamParser {
value >>= 8;
}
result.append(decodedData);
count = 0;
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

View file

@ -0,0 +1 @@
nä jag menar det där som sitter fast i din dörrkarm

View file

@ -29,8 +29,8 @@ public final class PDF417BlackBox1TestCase extends AbstractBlackBoxTestCase {
public PDF417BlackBox1TestCase() {
super("test/data/blackbox/pdf417", new MultiFormatReader(), BarcodeFormat.PDF_417);
addTest(3, 3, 0.0f);
addTest(3, 3, 180.0f);
addTest(4, 4, 0.0f);
addTest(4, 4, 180.0f);
}
}