-
Notifications
You must be signed in to change notification settings - Fork 20
/
data.h
72 lines (59 loc) · 2.34 KB
/
data.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/*\
* Yes, This Is Another Barcode Reader
* Copyright (C) 2013 Quentin SANTOS
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
\*/
#ifndef DATA_H
#define DATA_H
// 7 by 7 matrix representing the
// finder pattern found in each corner
extern const unsigned char pattern_finder[7][7];
// 5 by 5 matrix representing the
// alignment pattern
extern const unsigned char pattern_alignment[5][5];
// 45-byte long character set for
// the alphanumeric encoding mode
extern const char* charset_alpha;
// version to version range translation
extern const unsigned char version_range[41];
// Error Correction Level is handled as L..H = 0..3
// but they are coded as 1, 0, 3, 2
// yes, it is absurd, but see Table 25
extern const unsigned char code_to_ecl[4];
extern const unsigned char ecl_to_code[4];
// number of bits used to encode the segment length
extern const unsigned char lenbits[5][3]; // [encoding][version range]
// format and version information decoding data
extern const unsigned long bch_format_gen;
extern const unsigned long bch_format_mask;
extern const unsigned long bch_version_gen;
extern const unsigned long bch_version_mask;
// position of alignment patterns for each version
// the v-th row contains the list of coordinates
// the positions are all combinations of this coordinates
// except for the three corner (finder pattern overlaps)
extern const unsigned char pattern_alignment_pos[41][8];
struct BlockRun {
unsigned int n_blocks;
unsigned int total_codewords_per_block;
unsigned int data_codewords_per_block;
};
struct TwoBlockRuns {
struct BlockRun first;
struct BlockRun second;
};
// row at index (4 * version + error_correction_level) describes the two runs of blocks
extern const struct TwoBlockRuns block_sizes[164];
#endif