-
Notifications
You must be signed in to change notification settings - Fork 3
/
tables.go
144 lines (134 loc) · 2.16 KB
/
tables.go
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
package microqr
var formatTable = [5][4]int{
{}, // dummy
// M1
{
LevelCheck: 0b000,
LevelL: -1,
LevelM: -1,
LevelQ: -1,
},
// M2
{
LevelCheck: -1,
LevelL: 0b001,
LevelM: 0b010,
LevelQ: -1,
},
// M3
{
LevelCheck: -1,
LevelL: 0b011,
LevelM: 0b100,
LevelQ: -1,
},
// M4
{
LevelCheck: -1,
LevelL: 0b101,
LevelM: 0b110,
LevelQ: 0b111,
},
}
var rawFormatTable = [8]struct {
version Version
level Level
}{
{1, LevelCheck},
{2, LevelL},
{2, LevelM},
{3, LevelL},
{3, LevelM},
{4, LevelL},
{4, LevelM},
{4, LevelQ},
}
type capacity struct {
Total int // number of total code words.
Data int // number of data code words.
DataBits int // number of bit for data.
Correction int // number of correction code words.
MaxError int // maximum number of code word errors.
Reserved int // number of code words reserved for error detection.
}
// X 0510 : 2018
// 表9 マイクロORコード及びORコードの誤り訂正特性
var capacityTable = [5][4]capacity{
{}, // dummy
// version 1
{
LevelCheck: {
Total: 5,
Data: 3,
DataBits: 20,
Correction: 2,
Reserved: 2,
MaxError: 0,
},
},
// version 2
{
LevelL: {
Total: 10,
Data: 5,
DataBits: 40,
Correction: 5,
Reserved: 3,
MaxError: 1,
},
LevelM: {
Total: 10,
Data: 4,
DataBits: 32,
Correction: 6,
Reserved: 2,
MaxError: 2,
},
},
// version 3
{
LevelL: {
Total: 17,
Data: 11,
DataBits: 84,
Correction: 6,
Reserved: 2,
MaxError: 2,
},
LevelM: {
Total: 17,
Data: 9,
DataBits: 68,
Correction: 8,
Reserved: 2,
MaxError: 4,
},
},
// version 4
{
LevelL: {
Total: 24,
Data: 16,
DataBits: 128,
Correction: 8,
Reserved: 2,
MaxError: 3,
},
LevelM: {
Total: 24,
Data: 14,
DataBits: 112,
Correction: 10,
Reserved: 0,
MaxError: 5,
},
LevelQ: {
Total: 24,
Data: 10,
DataBits: 80,
Correction: 14,
Reserved: 0,
MaxError: 7,
},
},
}