5 * Created by Lukasz Warchol on 10-01-15.
6 * Copyright 2010 ZXing authors All rights reserved.
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
21 #include <zxing/oned/OneDReader.h>
22 #include <zxing/common/BitArray.h>
23 #include <zxing/Result.h>
27 class Code128Reader : public OneDReader {
30 static const unsigned int MAX_AVG_VARIANCE = (unsigned int) (PATTERN_MATCH_RESULT_SCALE_FACTOR * 0.25f);
31 static const int MAX_INDIVIDUAL_VARIANCE = (int) (PATTERN_MATCH_RESULT_SCALE_FACTOR * 0.7f);
33 static const int CODE_SHIFT = 98;
35 static const int CODE_CODE_C = 99;
36 static const int CODE_CODE_B = 100;
37 static const int CODE_CODE_A = 101;
39 static const int CODE_FNC_1 = 102;
40 static const int CODE_FNC_2 = 97;
41 static const int CODE_FNC_3 = 96;
42 static const int CODE_FNC_4_A = 101;
43 static const int CODE_FNC_4_B = 100;
45 static const int CODE_START_A = 103;
46 static const int CODE_START_B = 104;
47 static const int CODE_START_C = 105;
48 static const int CODE_STOP = 106;
50 static int* findStartPattern(Ref<BitArray> row);
51 static int decodeCode(Ref<BitArray> row, int counters[], int countersCount, int rowOffset);
53 void append(char* s, char c);
55 Ref<Result> decodeRow(int rowNumber, Ref<BitArray> row);