mirror of
https://github.com/zxing/zxing.git
synced 2025-01-13 04:07:27 -08:00
c++ port of r2592
git-svn-id: https://zxing.googlecode.com/svn/trunk@2626 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
parent
8e609df96e
commit
d2d6378205
|
@ -39,25 +39,26 @@ const int Code128Reader::MAX_AVG_VARIANCE = int(PATTERN_MATCH_RESULT_SCALE_FACTO
|
|||
const int Code128Reader::MAX_INDIVIDUAL_VARIANCE = int(PATTERN_MATCH_RESULT_SCALE_FACTOR * 700/1000);
|
||||
|
||||
namespace {
|
||||
const int CODE_SHIFT = 98;
|
||||
|
||||
const int CODE_CODE_C = 99;
|
||||
const int CODE_CODE_B = 100;
|
||||
const int CODE_CODE_A = 101;
|
||||
const int CODE_SHIFT = 98;
|
||||
|
||||
const int CODE_FNC_1 = 102;
|
||||
const int CODE_FNC_2 = 97;
|
||||
const int CODE_FNC_3 = 96;
|
||||
const int CODE_FNC_4_A = 101;
|
||||
const int CODE_FNC_4_B = 100;
|
||||
const int CODE_CODE_C = 99;
|
||||
const int CODE_CODE_B = 100;
|
||||
const int CODE_CODE_A = 101;
|
||||
|
||||
const int CODE_START_A = 103;
|
||||
const int CODE_START_B = 104;
|
||||
const int CODE_START_C = 105;
|
||||
const int CODE_STOP = 106;
|
||||
const int CODE_FNC_1 = 102;
|
||||
const int CODE_FNC_2 = 97;
|
||||
const int CODE_FNC_3 = 96;
|
||||
const int CODE_FNC_4_A = 101;
|
||||
const int CODE_FNC_4_B = 100;
|
||||
|
||||
const int CODE_PATTERNS_LENGTH = 107;
|
||||
const int CODE_PATTERNS[CODE_PATTERNS_LENGTH][6] = {
|
||||
const int CODE_START_A = 103;
|
||||
const int CODE_START_B = 104;
|
||||
const int CODE_START_C = 105;
|
||||
const int CODE_STOP = 106;
|
||||
|
||||
const int CODE_PATTERNS_LENGTH = 107;
|
||||
const int CODE_PATTERNS[CODE_PATTERNS_LENGTH][6] = {
|
||||
{2, 1, 2, 2, 2, 2}, /* 0 */
|
||||
{2, 2, 2, 1, 2, 2},
|
||||
{2, 2, 2, 2, 2, 1},
|
||||
|
@ -165,7 +166,8 @@ namespace {
|
|||
{2, 1, 1, 2, 1, 4},
|
||||
{2, 1, 1, 2, 3, 2}, /* 105 */
|
||||
{2, 3, 3, 1, 1, 1}
|
||||
};
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Code128Reader::Code128Reader(){}
|
||||
|
@ -326,6 +328,15 @@ Ref<Result> Code128Reader::decodeRow(int rowNumber, Ref<BitArray> row) {
|
|||
}
|
||||
switch (code) {
|
||||
case CODE_FNC_1:
|
||||
if (result.length() == 0){
|
||||
// GS1 specification 5.4.3.7. and 5.4.6.4. If the first char after the start code
|
||||
// is FNC1 then this is GS1-128. We add the symbology identifier.
|
||||
result.append("]C1");
|
||||
} else {
|
||||
// GS1 specification 5.4.7.5. Every subsequent FNC1 is returned as ASCII 29 (GS)
|
||||
result.append(1, (char) 29);
|
||||
}
|
||||
break;
|
||||
case CODE_FNC_2:
|
||||
case CODE_FNC_3:
|
||||
case CODE_FNC_4_A:
|
||||
|
|
Loading…
Reference in a new issue