File Coverage

blib/lib/Barcode/DataMatrix/Constants.pm
Criterion Covered Total %
statement 6 6 100.0
branch n/a
condition n/a
subroutine 2 2 100.0
pod n/a
total 8 8 100.0


line stmt bran cond sub pod time code
1             package Barcode::DataMatrix::Constants;
2              
3             =head1 Barcode::DataMatrix::Constants
4              
5             Constants associated with the Reed-Solomon error correction encoding used
6             for data matrices. See
7             L for
8             more information.
9              
10             =cut
11              
12 2     2   9 use strict;
  2         3  
  2         50  
13 2     2   18 use warnings;
  2         4  
  2         2374  
14              
15             =head2 GFI
16              
17             Exponent values used in the multiplication step of the Reed-Solomon encoding
18             algorithm.
19              
20             =cut
21              
22             our @GFI = ( 1, 2, 4, 8, 16, 32, 64, 128, 45, 90, 180, 69, 138, 57, 114, 228, 229, 231, 227, 235, 251, 219, 155, 27, 54, 108, 216, 157, 23, 46, 92, 184, 93, 186, 89, 178, 73, 146, 9, 18, 36, 72, 144, 13, 26, 52, 104, 208, 141, 55, 110, 220, 149, 7, 14, 28, 56, 112, 224, 237, 247, 195, 171, 123, 246, 193, 175, 115, 230, 225, 239, 243, 203, 187, 91, 182, 65, 130, 41, 82, 164, 101, 202, 185, 95, 190, 81, 162, 105, 210, 137, 63, 126, 252, 213, 135, 35, 70, 140, 53, 106, 212, 133, 39, 78, 156, 21, 42, 84, 168, 125, 250, 217, 159, 19, 38, 76, 152, 29, 58, 116, 232, 253, 215, 131, 43, 86, 172, 117, 234, 249, 223, 147, 11, 22, 44, 88, 176, 77, 154, 25, 50, 100, 200, 189, 87, 174, 113, 226, 233, 255, 211, 139, 59, 118, 236, 245, 199, 163, 107, 214, 129, 47, 94, 188, 85, 170, 121, 242, 201, 191, 83, 166, 97, 194, 169, 127, 254, 209, 143, 51, 102, 204, 181, 71, 142, 49, 98, 196, 165, 103, 206, 177, 79, 158, 17, 34, 68, 136, 61, 122, 244, 197, 167, 99, 198, 161, 111, 222, 145, 15, 30, 60, 120, 240, 205, 183, 67, 134, 33, 66, 132, 37, 74, 148, 5, 10, 20, 40, 80, 160, 109, 218, 153, 31, 62, 124, 248, 221, 151, 3, 6, 12, 24, 48, 96, 192, 173, 119, 238, 241, 207, 179, 75, 150 );
23              
24             =head2 GFL
25              
26             Log values used in the multiplication step of the Reed-Solomon encoding
27             algorithm.
28              
29             =cut
30              
31             our @GFL = ( 0, 0, 1, 240, 2, 225, 241, 53, 3, 38, 226, 133, 242, 43, 54, 210, 4, 195, 39, 114, 227, 106, 134, 28, 243, 140, 44, 23, 55, 118, 211, 234, 5, 219, 196, 96, 40, 222, 115, 103, 228, 78, 107, 125, 135, 8, 29, 162, 244, 186, 141, 180, 45, 99, 24, 49, 56, 13, 119, 153, 212, 199, 235, 91, 6, 76, 220, 217, 197, 11, 97, 184, 41, 36, 223, 253, 116, 138, 104, 193, 229, 86, 79, 171, 108, 165, 126, 145, 136, 34, 9, 74, 30, 32, 163, 84, 245, 173, 187, 204, 142, 81, 181, 190, 46, 88, 100, 159, 25, 231, 50, 207, 57, 147, 14, 67, 120, 128, 154, 248, 213, 167, 200, 63, 236, 110, 92, 176, 7, 161, 77, 124, 221, 102, 218, 95, 198, 90, 12, 152, 98, 48, 185, 179, 42, 209, 37, 132, 224, 52, 254, 239, 117, 233, 139, 22, 105, 27, 194, 113, 230, 206, 87, 158, 80, 189, 172, 203, 109, 175, 166, 62, 127, 247, 146, 66, 137, 192, 35, 252, 10, 183, 75, 216, 31, 83, 33, 73, 164, 144, 85, 170, 246, 65, 174, 61, 188, 202, 205, 157, 143, 169, 82, 72, 182, 215, 191, 251, 47, 178, 89, 151, 101, 94, 160, 123, 26, 112, 232, 21, 51, 238, 208, 131, 58, 69, 148, 18, 15, 16, 68, 17, 121, 149, 129, 19, 155, 59, 249, 70, 214, 250, 168, 71, 201, 156, 64, 60, 237, 130, 111, 20, 93, 122, 177, 150 );
32              
33             =head2 POLY
34              
35             Coefficients of the Reed-Solomon coeeficients. The keys of the C hash
36             correspond to the order of the respective polynomial.
37              
38             =cut
39              
40             our %POLY = (
41             5 => [62, 111, 15, 48, 228],
42             7 => [254, 92, 240, 134, 144, 68, 23],
43             10 => [61, 110, 255, 116, 248, 223, 166, 185, 24, 28],
44             11 => [120, 97, 60, 245, 39, 168, 194, 12, 205, 138, 175],
45             12 => [242, 100, 178, 97, 213, 142, 42, 61, 91, 158, 153, 41],
46             14 => [185, 83, 186, 18, 45, 138, 119, 157, 9, 95, 252, 192, 97, 156],
47             18 => [188, 90, 48, 225, 254, 94, 129, 109, 213, 241, 61, 66, 75, 188, 39, 100, 195, 83],
48             20 => [172, 186, 174, 27, 82, 108, 79, 253, 145, 153, 160, 188, 2, 168, 71, 233, 9, 244, 195, 15],
49             24 => [193, 50, 96, 184, 181, 12, 124, 254, 172, 5, 21, 155, 223, 251, 197, 155, 21, 176, 39, 109, 205, 88, 190, 52],
50             28 => [255, 93, 168, 233, 151, 120, 136, 141, 213, 110, 138, 17, 121, 249, 34, 75, 53, 170, 151, 37, 174, 103, 96, 71, 97, 43, 231, 211],
51             36 => [112, 81, 98, 225, 25, 59, 184, 175, 44, 115, 119, 95, 137, 101, 33, 68, 4, 2, 18, 229, 182, 80, 251, 220, 179, 84, 120, 102, 181, 162, 250, 130, 218, 242, 127, 245],
52             42 => [5, 9, 5, 226, 177, 150, 50, 69, 202, 248, 101, 54, 57, 253, 1, 21, 121, 57, 111, 214, 105, 167, 9, 100, 95, 175, 8, 242, 133, 245, 2, 122, 105, 247, 153, 22, 38, 19, 31, 137, 193, 77],
53             48 => [19, 225, 253, 92, 213, 69, 175, 160, 147, 187, 87, 176, 44, 82, 240, 186, 138, 66, 100, 120, 88, 131, 205, 170, 90, 37, 23, 118, 147, 16, 106, 191, 87, 237, 188, 205, 231, 238, 133, 238, 22, 117, 32, 96, 223, 172, 132, 245],
54             56 => [46, 143, 53, 233, 107, 203, 43, 155, 28, 247, 67, 127, 245, 137, 13, 164, 207, 62, 117, 201, 150, 22, 238, 144, 232, 29, 203, 117, 234, 218, 146, 228, 54, 132, 200, 38, 223, 36, 159, 150, 235, 215, 192, 230, 170, 175, 29, 100, 208, 220, 17, 12, 238, 223, 9, 175],
55             62 => [204, 11, 47, 86, 124, 224, 166, 94, 7, 232, 107, 4, 170, 176, 31, 163, 17, 188, 130, 40, 10, 87, 63, 51, 218, 27, 6, 147, 44, 161, 71, 114, 64, 175, 221, 185, 106, 250, 190, 197, 63, 245, 230, 134, 112, 185, 37, 196, 108, 143, 189, 201, 188, 202, 118, 39, 210, 144, 50, 169, 93, 242],
56             68 => [186, 82, 103, 96, 63, 132, 153, 108, 54, 64, 189, 211, 232, 49, 25, 172, 52, 59, 241, 181, 239, 223, 136, 231, 210, 96, 232, 220, 25, 179, 167, 202, 185, 153, 139, 66, 236, 227, 160, 15, 213, 93, 122, 68, 177, 158, 197, 234, 180, 248, 136, 213, 127, 73, 36, 154, 244, 147, 33, 89, 56, 159, 149, 251, 89, 173, 228, 220],
57             );
58              
59             our @FORMATS = (
60             [10, 10, 8, 8, 1, 8, 8, 3, 5, 3, 5, 1],
61             [12, 12, 10, 10, 1, 10, 10, 5, 7, 5, 7, 1],
62             [14, 14, 12, 12, 1, 12, 12, 8, 10, 8, 10, 1],
63             [16, 16, 14, 14, 1, 14, 14, 12, 12, 12, 12, 1],
64             [18, 18, 16, 16, 1, 16, 16, 18, 14, 18, 14, 1],
65             [20, 20, 18, 18, 1, 18, 18, 22, 18, 22, 18, 1],
66             [22, 22, 20, 20, 1, 20, 20, 30, 20, 30, 20, 1],
67             [24, 24, 22, 22, 1, 22, 22, 36, 24, 36, 24, 1],
68             [26, 26, 24, 24, 1, 24, 24, 44, 28, 44, 28, 1],
69             [32, 32, 14, 14, 4, 28, 28, 62, 36, 62, 36, 1],
70             [36, 36, 16, 16, 4, 32, 32, 86, 42, 86, 42, 1],
71             [40, 40, 18, 18, 4, 36, 36, 114, 48, 114, 48, 1],
72             [44, 44, 20, 20, 4, 40, 40, 144, 56, 144, 56, 1],
73             [48, 48, 22, 22, 4, 44, 44, 174, 68, 174, 68, 1],
74             [52, 52, 24, 24, 4, 48, 48, 204, 84, 102, 42, 2],
75             [64, 64, 14, 14, 16, 56, 56, 280, 112, 140, 56, 2],
76             [72, 72, 16, 16, 16, 64, 64, 368, 144, 92, 36, 4],
77             [80, 80, 18, 18, 16, 72, 72, 456, 192, 114, 48, 4],
78             [88, 88, 20, 20, 16, 80, 80, 576, 224, 144, 56, 4],
79             [96, 96, 22, 22, 16, 88, 88, 696, 272, 174, 68, 4],
80             [104, 104, 24, 24, 16, 96, 96, 816, 336, 136, 56, 6],
81             [120, 120, 18, 18, 36, 108, 108, 1050, 496, 175, 68, 6],
82             [132, 132, 20, 20, 36, 120, 120, 1304, 496, 163, 62, 8],
83             [144, 144, 22, 22, 36, 132, 132, 1558, 620, 156, 62, 10],
84             [8, 18, 6, 16, 1, 6, 16, 5, 7, 5, 7, 1],
85             [8, 32, 6, 14, 2, 6, 28, 10, 11, 10, 11, 1],
86             [12, 26, 10, 24, 1, 10, 24, 16, 14, 16, 14, 1],
87             [12, 36, 10, 16, 2, 10, 32, 22, 18, 22, 18, 1],
88             [16, 36, 14, 16, 2, 14, 32, 32, 24, 32, 24, 1],
89             [16, 48, 14, 22, 2, 14, 44, 49, 28, 49, 28, 1],
90             );
91              
92             our @C1 = (
93             [0, 0],
94             [0, 1],
95             [0, 2],
96             [0, 3],
97             [0, 4],
98             [0, 5],
99             [0, 6],
100             [0, 7],
101             [0, 8],
102             [0, 9],
103             [0, 10],
104             [0, 11],
105             [0, 12],
106             [0, 13],
107             [0, 14],
108             [0, 15],
109             [0, 16],
110             [0, 17],
111             [0, 18],
112             [0, 19],
113             [0, 20],
114             [0, 21],
115             [0, 22],
116             [0, 23],
117             [0, 24],
118             [0, 25],
119             [0, 26],
120             [0, 27],
121             [0, 28],
122             [0, 29],
123             [0, 30],
124             [0, 31],
125             [3],
126             [1, 0],
127             [1, 1],
128             [1, 2],
129             [1, 3],
130             [1, 4],
131             [1, 5],
132             [1, 6],
133             [1, 7],
134             [1, 8],
135             [1, 9],
136             [1, 10],
137             [1, 11],
138             [1, 12],
139             [1, 13],
140             [1, 14],
141             [4],
142             [5],
143             [6],
144             [7],
145             [8],
146             [9],
147             [10],
148             [11],
149             [12],
150             [13],
151             [1, 15],
152             [1, 16],
153             [1, 17],
154             [1, 18],
155             [1, 19],
156             [1, 20],
157             [1, 21],
158             [14],
159             [15],
160             [16],
161             [17],
162             [18],
163             [19],
164             [20],
165             [21],
166             [22],
167             [23],
168             [24],
169             [25],
170             [26],
171             [27],
172             [28],
173             [29],
174             [30],
175             [31],
176             [32],
177             [33],
178             [34],
179             [35],
180             [36],
181             [37],
182             [38],
183             [39],
184             [1, 22],
185             [1, 23],
186             [1, 24],
187             [1, 25],
188             [1, 26],
189             [2, 0],
190             [2, 1],
191             [2, 2],
192             [2, 3],
193             [2, 4],
194             [2, 5],
195             [2, 6],
196             [2, 7],
197             [2, 8],
198             [2, 9],
199             [2, 10],
200             [2, 11],
201             [2, 12],
202             [2, 13],
203             [2, 14],
204             [2, 15],
205             [2, 16],
206             [2, 17],
207             [2, 18],
208             [2, 19],
209             [2, 20],
210             [2, 21],
211             [2, 22],
212             [2, 23],
213             [2, 24],
214             [2, 25],
215             [2, 26],
216             [2, 27],
217             [2, 28],
218             [2, 29],
219             [2, 30],
220             [2, 31],
221             [1, 30, 0, 0],
222             [1, 30, 0, 1],
223             [1, 30, 0, 2],
224             [1, 30, 0, 3],
225             [1, 30, 0, 4],
226             [1, 30, 0, 5],
227             [1, 30, 0, 6],
228             [1, 30, 0, 7],
229             [1, 30, 0, 8],
230             [1, 30, 0, 9],
231             [1, 30, 0, 10],
232             [1, 30, 0, 11],
233             [1, 30, 0, 12],
234             [1, 30, 0, 13],
235             [1, 30, 0, 14],
236             [1, 30, 0, 15],
237             [1, 30, 0, 16],
238             [1, 30, 0, 17],
239             [1, 30, 0, 18],
240             [1, 30, 0, 19],
241             [1, 30, 0, 20],
242             [1, 30, 0, 21],
243             [1, 30, 0, 22],
244             [1, 30, 0, 23],
245             [1, 30, 0, 24],
246             [1, 30, 0, 25],
247             [1, 30, 0, 26],
248             [1, 30, 0, 27],
249             [1, 30, 0, 28],
250             [1, 30, 0, 29],
251             [1, 30, 0, 30],
252             [1, 30, 0, 31],
253             [1, 30, 3],
254             [1, 30, 1, 0],
255             [1, 30, 1, 1],
256             [1, 30, 1, 2],
257             [1, 30, 1, 3],
258             [1, 30, 1, 4],
259             [1, 30, 1, 5],
260             [1, 30, 1, 6],
261             [1, 30, 1, 7],
262             [1, 30, 1, 8],
263             [1, 30, 1, 9],
264             [1, 30, 1, 10],
265             [1, 30, 1, 11],
266             [1, 30, 1, 12],
267             [1, 30, 1, 13],
268             [1, 30, 1, 14],
269             [1, 30, 4],
270             [1, 30, 5],
271             [1, 30, 6],
272             [1, 30, 7],
273             [1, 30, 8],
274             [1, 30, 9],
275             [1, 30, 10],
276             [1, 30, 11],
277             [1, 30, 12],
278             [1, 30, 13],
279             [1, 30, 1, 15],
280             [1, 30, 1, 16],
281             [1, 30, 1, 17],
282             [1, 30, 1, 18],
283             [1, 30, 1, 19],
284             [1, 30, 1, 20],
285             [1, 30, 1, 21],
286             [1, 30, 14],
287             [1, 30, 15],
288             [1, 30, 16],
289             [1, 30, 17],
290             [1, 30, 18],
291             [1, 30, 19],
292             [1, 30, 20],
293             [1, 30, 21],
294             [1, 30, 22],
295             [1, 30, 23],
296             [1, 30, 24],
297             [1, 30, 25],
298             [1, 30, 26],
299             [1, 30, 27],
300             [1, 30, 28],
301             [1, 30, 29],
302             [1, 30, 30],
303             [1, 30, 31],
304             [1, 30, 32],
305             [1, 30, 33],
306             [1, 30, 34],
307             [1, 30, 35],
308             [1, 30, 36],
309             [1, 30, 37],
310             [1, 30, 38],
311             [1, 30, 39],
312             [1, 30, 1, 22],
313             [1, 30, 1, 23],
314             [1, 30, 1, 24],
315             [1, 30, 1, 25],
316             [1, 30, 1, 26],
317             [1, 30, 2, 0],
318             [1, 30, 2, 1],
319             [1, 30, 2, 2],
320             [1, 30, 2, 3],
321             [1, 30, 2, 4],
322             [1, 30, 2, 5],
323             [1, 30, 2, 6],
324             [1, 30, 2, 7],
325             [1, 30, 2, 8],
326             [1, 30, 2, 9],
327             [1, 30, 2, 10],
328             [1, 30, 2, 11],
329             [1, 30, 2, 12],
330             [1, 30, 2, 13],
331             [1, 30, 2, 14],
332             [1, 30, 2, 15],
333             [1, 30, 2, 16],
334             [1, 30, 2, 17],
335             [1, 30, 2, 18],
336             [1, 30, 2, 19],
337             [1, 30, 2, 20],
338             [1, 30, 2, 21],
339             [1, 30, 2, 22],
340             [1, 30, 2, 23],
341             [1, 30, 2, 24],
342             [1, 30, 2, 25],
343             [1, 30, 2, 26],
344             [1, 30, 2, 27],
345             [1, 30, 2, 28],
346             [1, 30, 2, 29],
347             [1, 30, 2, 30],
348             [1, 30, 2, 31],
349             );
350              
351             1;