OLD | NEW |
| (Empty) |
1 // Copyright 2014 PDFium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | |
6 // Original code is licensed as follows: | |
7 /* | |
8 * Copyright 2007 ZXing authors | |
9 * | |
10 * Licensed under the Apache License, Version 2.0 (the "License"); | |
11 * you may not use this file except in compliance with the License. | |
12 * You may obtain a copy of the License at | |
13 * | |
14 * http://www.apache.org/licenses/LICENSE-2.0 | |
15 * | |
16 * Unless required by applicable law or agreed to in writing, software | |
17 * distributed under the License is distributed on an "AS IS" BASIS, | |
18 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
19 * See the License for the specific language governing permissions and | |
20 * limitations under the License. | |
21 */ | |
22 | |
23 #include "xfa/src/fxbarcode/common/BC_CommonBitMatrix.h" | |
24 #include "xfa/src/fxbarcode/qrcode/BC_QRCoderBitVector.h" | |
25 #include "xfa/src/fxbarcode/qrcode/BC_QRCoderECB.h" | |
26 #include "xfa/src/fxbarcode/qrcode/BC_QRCoderECBlocks.h" | |
27 #include "xfa/src/fxbarcode/qrcode/BC_QRCoderErrorCorrectionLevel.h" | |
28 #include "xfa/src/fxbarcode/qrcode/BC_QRCoderFormatInformation.h" | |
29 #include "xfa/src/fxbarcode/qrcode/BC_QRCoderVersion.h" | |
30 #include "xfa/src/fxbarcode/utils.h" | |
31 | |
32 const int32_t CBC_QRCoderVersion::VERSION_DECODE_INFO[] = { | |
33 0x07C94, 0x085BC, 0x09A99, 0x0A4D3, 0x0BBF6, 0x0C762, 0x0D847, | |
34 0x0E60D, 0x0F928, 0x10B78, 0x1145D, 0x12A17, 0x13532, 0x149A6, | |
35 0x15683, 0x168C9, 0x177EC, 0x18EC4, 0x191E1, 0x1AFAB, 0x1B08E, | |
36 0x1CC1A, 0x1D33F, 0x1ED75, 0x1F250, 0x209D5, 0x216F0, 0x228BA, | |
37 0x2379F, 0x24B0B, 0x2542E, 0x26A64, 0x27541, 0x28C69}; | |
38 CFX_PtrArray* CBC_QRCoderVersion::VERSION = NULL; | |
39 | |
40 void CBC_QRCoderVersion::Initialize() { | |
41 VERSION = new CFX_PtrArray(); | |
42 } | |
43 void CBC_QRCoderVersion::Finalize() { | |
44 for (int32_t i = 0; i < VERSION->GetSize(); i++) { | |
45 CBC_QRCoderVersion* v = (CBC_QRCoderVersion*)(VERSION->GetAt(i)); | |
46 delete v; | |
47 } | |
48 delete VERSION; | |
49 } | |
50 CBC_QRCoderVersion::CBC_QRCoderVersion(int32_t versionNumber, | |
51 CBC_QRCoderECBlocks* ecBlocks1, | |
52 CBC_QRCoderECBlocks* ecBlocks2, | |
53 CBC_QRCoderECBlocks* ecBlocks3, | |
54 CBC_QRCoderECBlocks* ecBlocks4) { | |
55 m_versionNumber = versionNumber; | |
56 m_ecBlocks.Add(ecBlocks1); | |
57 m_ecBlocks.Add(ecBlocks2); | |
58 m_ecBlocks.Add(ecBlocks3); | |
59 m_ecBlocks.Add(ecBlocks4); | |
60 int32_t total = 0; | |
61 int32_t ecCodeWords = ecBlocks1->GetECCodeWordsPerBlock(); | |
62 CFX_PtrArray* ecbArray = ecBlocks1->GetECBlocks(); | |
63 for (int32_t i = 0; i < ecbArray->GetSize(); i++) { | |
64 CBC_QRCoderECB* ecBlock = (CBC_QRCoderECB*)((*ecbArray)[i]); | |
65 total += ecBlock->GetCount() * (ecBlock->GetDataCodeWords() + ecCodeWords); | |
66 } | |
67 m_totalCodeWords = total; | |
68 switch (versionNumber) { | |
69 case 1: | |
70 break; | |
71 case 2: | |
72 m_alignmentPatternCenters.Add(6); | |
73 m_alignmentPatternCenters.Add(18); | |
74 break; | |
75 case 3: | |
76 m_alignmentPatternCenters.Add(6); | |
77 m_alignmentPatternCenters.Add(22); | |
78 break; | |
79 case 4: | |
80 m_alignmentPatternCenters.Add(6); | |
81 m_alignmentPatternCenters.Add(26); | |
82 break; | |
83 case 5: | |
84 m_alignmentPatternCenters.Add(6); | |
85 m_alignmentPatternCenters.Add(30); | |
86 break; | |
87 case 6: | |
88 m_alignmentPatternCenters.Add(6); | |
89 m_alignmentPatternCenters.Add(34); | |
90 break; | |
91 case 7: | |
92 m_alignmentPatternCenters.Add(6); | |
93 m_alignmentPatternCenters.Add(22); | |
94 m_alignmentPatternCenters.Add(38); | |
95 break; | |
96 case 8: | |
97 m_alignmentPatternCenters.Add(6); | |
98 m_alignmentPatternCenters.Add(24); | |
99 m_alignmentPatternCenters.Add(42); | |
100 break; | |
101 case 9: | |
102 m_alignmentPatternCenters.Add(6); | |
103 m_alignmentPatternCenters.Add(26); | |
104 m_alignmentPatternCenters.Add(46); | |
105 break; | |
106 case 10: | |
107 m_alignmentPatternCenters.Add(6); | |
108 m_alignmentPatternCenters.Add(28); | |
109 m_alignmentPatternCenters.Add(50); | |
110 break; | |
111 case 11: | |
112 m_alignmentPatternCenters.Add(6); | |
113 m_alignmentPatternCenters.Add(30); | |
114 m_alignmentPatternCenters.Add(54); | |
115 break; | |
116 case 12: | |
117 m_alignmentPatternCenters.Add(6); | |
118 m_alignmentPatternCenters.Add(32); | |
119 m_alignmentPatternCenters.Add(58); | |
120 break; | |
121 case 13: | |
122 m_alignmentPatternCenters.Add(6); | |
123 m_alignmentPatternCenters.Add(34); | |
124 m_alignmentPatternCenters.Add(62); | |
125 break; | |
126 case 14: | |
127 m_alignmentPatternCenters.Add(6); | |
128 m_alignmentPatternCenters.Add(26); | |
129 m_alignmentPatternCenters.Add(46); | |
130 m_alignmentPatternCenters.Add(66); | |
131 break; | |
132 case 15: | |
133 m_alignmentPatternCenters.Add(6); | |
134 m_alignmentPatternCenters.Add(26); | |
135 m_alignmentPatternCenters.Add(48); | |
136 m_alignmentPatternCenters.Add(70); | |
137 break; | |
138 case 16: | |
139 m_alignmentPatternCenters.Add(6); | |
140 m_alignmentPatternCenters.Add(26); | |
141 m_alignmentPatternCenters.Add(50); | |
142 m_alignmentPatternCenters.Add(74); | |
143 break; | |
144 case 17: | |
145 m_alignmentPatternCenters.Add(6); | |
146 m_alignmentPatternCenters.Add(30); | |
147 m_alignmentPatternCenters.Add(54); | |
148 m_alignmentPatternCenters.Add(78); | |
149 break; | |
150 case 18: | |
151 m_alignmentPatternCenters.Add(6); | |
152 m_alignmentPatternCenters.Add(30); | |
153 m_alignmentPatternCenters.Add(56); | |
154 m_alignmentPatternCenters.Add(82); | |
155 break; | |
156 case 19: | |
157 m_alignmentPatternCenters.Add(6); | |
158 m_alignmentPatternCenters.Add(30); | |
159 m_alignmentPatternCenters.Add(58); | |
160 m_alignmentPatternCenters.Add(86); | |
161 break; | |
162 case 20: | |
163 m_alignmentPatternCenters.Add(6); | |
164 m_alignmentPatternCenters.Add(34); | |
165 m_alignmentPatternCenters.Add(62); | |
166 m_alignmentPatternCenters.Add(90); | |
167 break; | |
168 case 21: | |
169 m_alignmentPatternCenters.Add(6); | |
170 m_alignmentPatternCenters.Add(28); | |
171 m_alignmentPatternCenters.Add(50); | |
172 m_alignmentPatternCenters.Add(72); | |
173 m_alignmentPatternCenters.Add(94); | |
174 break; | |
175 case 22: | |
176 m_alignmentPatternCenters.Add(6); | |
177 m_alignmentPatternCenters.Add(26); | |
178 m_alignmentPatternCenters.Add(50); | |
179 m_alignmentPatternCenters.Add(74); | |
180 m_alignmentPatternCenters.Add(98); | |
181 break; | |
182 case 23: | |
183 m_alignmentPatternCenters.Add(6); | |
184 m_alignmentPatternCenters.Add(30); | |
185 m_alignmentPatternCenters.Add(54); | |
186 m_alignmentPatternCenters.Add(74); | |
187 m_alignmentPatternCenters.Add(102); | |
188 break; | |
189 case 24: | |
190 m_alignmentPatternCenters.Add(6); | |
191 m_alignmentPatternCenters.Add(28); | |
192 m_alignmentPatternCenters.Add(54); | |
193 m_alignmentPatternCenters.Add(80); | |
194 m_alignmentPatternCenters.Add(106); | |
195 break; | |
196 case 25: | |
197 m_alignmentPatternCenters.Add(6); | |
198 m_alignmentPatternCenters.Add(32); | |
199 m_alignmentPatternCenters.Add(58); | |
200 m_alignmentPatternCenters.Add(84); | |
201 m_alignmentPatternCenters.Add(110); | |
202 break; | |
203 case 26: | |
204 m_alignmentPatternCenters.Add(6); | |
205 m_alignmentPatternCenters.Add(30); | |
206 m_alignmentPatternCenters.Add(58); | |
207 m_alignmentPatternCenters.Add(86); | |
208 m_alignmentPatternCenters.Add(114); | |
209 break; | |
210 case 27: | |
211 m_alignmentPatternCenters.Add(6); | |
212 m_alignmentPatternCenters.Add(34); | |
213 m_alignmentPatternCenters.Add(62); | |
214 m_alignmentPatternCenters.Add(90); | |
215 m_alignmentPatternCenters.Add(118); | |
216 break; | |
217 case 28: | |
218 m_alignmentPatternCenters.Add(6); | |
219 m_alignmentPatternCenters.Add(26); | |
220 m_alignmentPatternCenters.Add(50); | |
221 m_alignmentPatternCenters.Add(74); | |
222 m_alignmentPatternCenters.Add(98); | |
223 m_alignmentPatternCenters.Add(122); | |
224 break; | |
225 case 29: | |
226 m_alignmentPatternCenters.Add(6); | |
227 m_alignmentPatternCenters.Add(30); | |
228 m_alignmentPatternCenters.Add(54); | |
229 m_alignmentPatternCenters.Add(78); | |
230 m_alignmentPatternCenters.Add(102); | |
231 m_alignmentPatternCenters.Add(126); | |
232 break; | |
233 case 30: | |
234 m_alignmentPatternCenters.Add(6); | |
235 m_alignmentPatternCenters.Add(26); | |
236 m_alignmentPatternCenters.Add(52); | |
237 m_alignmentPatternCenters.Add(78); | |
238 m_alignmentPatternCenters.Add(104); | |
239 m_alignmentPatternCenters.Add(130); | |
240 break; | |
241 case 31: | |
242 m_alignmentPatternCenters.Add(6); | |
243 m_alignmentPatternCenters.Add(30); | |
244 m_alignmentPatternCenters.Add(56); | |
245 m_alignmentPatternCenters.Add(82); | |
246 m_alignmentPatternCenters.Add(108); | |
247 m_alignmentPatternCenters.Add(134); | |
248 break; | |
249 case 32: | |
250 m_alignmentPatternCenters.Add(6); | |
251 m_alignmentPatternCenters.Add(34); | |
252 m_alignmentPatternCenters.Add(60); | |
253 m_alignmentPatternCenters.Add(86); | |
254 m_alignmentPatternCenters.Add(112); | |
255 m_alignmentPatternCenters.Add(138); | |
256 break; | |
257 case 33: | |
258 m_alignmentPatternCenters.Add(6); | |
259 m_alignmentPatternCenters.Add(30); | |
260 m_alignmentPatternCenters.Add(58); | |
261 m_alignmentPatternCenters.Add(86); | |
262 m_alignmentPatternCenters.Add(114); | |
263 m_alignmentPatternCenters.Add(142); | |
264 break; | |
265 case 34: | |
266 m_alignmentPatternCenters.Add(6); | |
267 m_alignmentPatternCenters.Add(34); | |
268 m_alignmentPatternCenters.Add(62); | |
269 m_alignmentPatternCenters.Add(90); | |
270 m_alignmentPatternCenters.Add(118); | |
271 m_alignmentPatternCenters.Add(146); | |
272 break; | |
273 case 35: | |
274 m_alignmentPatternCenters.Add(6); | |
275 m_alignmentPatternCenters.Add(30); | |
276 m_alignmentPatternCenters.Add(54); | |
277 m_alignmentPatternCenters.Add(78); | |
278 m_alignmentPatternCenters.Add(102); | |
279 m_alignmentPatternCenters.Add(126); | |
280 m_alignmentPatternCenters.Add(150); | |
281 break; | |
282 case 36: | |
283 m_alignmentPatternCenters.Add(6); | |
284 m_alignmentPatternCenters.Add(24); | |
285 m_alignmentPatternCenters.Add(50); | |
286 m_alignmentPatternCenters.Add(76); | |
287 m_alignmentPatternCenters.Add(102); | |
288 m_alignmentPatternCenters.Add(128); | |
289 m_alignmentPatternCenters.Add(154); | |
290 break; | |
291 case 37: | |
292 m_alignmentPatternCenters.Add(6); | |
293 m_alignmentPatternCenters.Add(28); | |
294 m_alignmentPatternCenters.Add(54); | |
295 m_alignmentPatternCenters.Add(80); | |
296 m_alignmentPatternCenters.Add(106); | |
297 m_alignmentPatternCenters.Add(132); | |
298 m_alignmentPatternCenters.Add(158); | |
299 break; | |
300 case 38: | |
301 m_alignmentPatternCenters.Add(6); | |
302 m_alignmentPatternCenters.Add(32); | |
303 m_alignmentPatternCenters.Add(58); | |
304 m_alignmentPatternCenters.Add(84); | |
305 m_alignmentPatternCenters.Add(110); | |
306 m_alignmentPatternCenters.Add(136); | |
307 m_alignmentPatternCenters.Add(162); | |
308 break; | |
309 case 39: | |
310 m_alignmentPatternCenters.Add(6); | |
311 m_alignmentPatternCenters.Add(26); | |
312 m_alignmentPatternCenters.Add(54); | |
313 m_alignmentPatternCenters.Add(82); | |
314 m_alignmentPatternCenters.Add(110); | |
315 m_alignmentPatternCenters.Add(138); | |
316 m_alignmentPatternCenters.Add(166); | |
317 break; | |
318 case 40: | |
319 m_alignmentPatternCenters.Add(6); | |
320 m_alignmentPatternCenters.Add(30); | |
321 m_alignmentPatternCenters.Add(58); | |
322 m_alignmentPatternCenters.Add(86); | |
323 m_alignmentPatternCenters.Add(114); | |
324 m_alignmentPatternCenters.Add(142); | |
325 m_alignmentPatternCenters.Add(170); | |
326 break; | |
327 } | |
328 } | |
329 CBC_QRCoderVersion::~CBC_QRCoderVersion() { | |
330 if (m_ecBlocks.GetSize() != 0) { | |
331 int32_t itBeg = 0; | |
332 int32_t itEnd = m_ecBlocks.GetSize(); | |
333 while (itBeg != itEnd) { | |
334 delete ((CBC_QRCoderECBlocks*)(m_ecBlocks[itBeg])); | |
335 itBeg++; | |
336 } | |
337 } | |
338 } | |
339 int32_t CBC_QRCoderVersion::GetVersionNumber() { | |
340 return m_versionNumber; | |
341 } | |
342 CFX_Int32Array* CBC_QRCoderVersion::GetAlignmentPatternCenters() { | |
343 return &m_alignmentPatternCenters; | |
344 } | |
345 int32_t CBC_QRCoderVersion::GetTotalCodeWords() { | |
346 return m_totalCodeWords; | |
347 } | |
348 int32_t CBC_QRCoderVersion::GetDimensionForVersion() { | |
349 return 17 + 4 * m_versionNumber; | |
350 } | |
351 CBC_QRCoderECBlocks* CBC_QRCoderVersion::GetECBlocksForLevel( | |
352 CBC_QRCoderErrorCorrectionLevel* ecLevel) { | |
353 return (CBC_QRCoderECBlocks*)m_ecBlocks[ecLevel->Ordinal()]; | |
354 } | |
355 CBC_QRCoderVersion* CBC_QRCoderVersion::GetProvisionalVersionForDimension( | |
356 int32_t dimension, | |
357 int32_t& e) { | |
358 if ((dimension % 4) != 1) { | |
359 e = BCExceptionRead; | |
360 BC_EXCEPTION_CHECK_ReturnValue(e, NULL); | |
361 } | |
362 CBC_QRCoderVersion* qcv = GetVersionForNumber((dimension - 17) >> 2, e); | |
363 BC_EXCEPTION_CHECK_ReturnValue(e, NULL); | |
364 return qcv; | |
365 } | |
366 CBC_QRCoderVersion* CBC_QRCoderVersion::DecodeVersionInformation( | |
367 int32_t versionBits, | |
368 int32_t& e) { | |
369 int32_t bestDifference = FXSYS_IntMax; | |
370 int32_t bestVersion = 0; | |
371 for (int32_t i = 0; i < 34; i++) { | |
372 int32_t targetVersion = VERSION_DECODE_INFO[i]; | |
373 if (targetVersion == versionBits) { | |
374 CBC_QRCoderVersion* qcv = GetVersionForNumber(i + 7, e); | |
375 BC_EXCEPTION_CHECK_ReturnValue(e, NULL); | |
376 return qcv; | |
377 } | |
378 int32_t bitsDifference = CBC_QRCoderFormatInformation::NumBitsDiffering( | |
379 versionBits, targetVersion); | |
380 if (bitsDifference < bestDifference) { | |
381 bestVersion = i + 7; | |
382 bestDifference = bitsDifference; | |
383 } | |
384 } | |
385 if (bestDifference <= 3) { | |
386 CBC_QRCoderVersion* qcv = GetVersionForNumber(bestVersion, e); | |
387 BC_EXCEPTION_CHECK_ReturnValue(e, NULL); | |
388 return qcv; | |
389 } | |
390 return NULL; | |
391 } | |
392 CBC_CommonBitMatrix* CBC_QRCoderVersion::BuildFunctionPattern(int32_t& e) { | |
393 int32_t dimension = GetDimensionForVersion(); | |
394 CBC_CommonBitMatrix* bitMatrix = new CBC_CommonBitMatrix(); | |
395 bitMatrix->Init(dimension); | |
396 bitMatrix->SetRegion(0, 0, 9, 9, e); | |
397 BC_EXCEPTION_CHECK_ReturnValue(e, NULL); | |
398 bitMatrix->SetRegion(dimension - 8, 0, 8, 9, e); | |
399 BC_EXCEPTION_CHECK_ReturnValue(e, NULL); | |
400 bitMatrix->SetRegion(0, dimension - 8, 9, 8, e); | |
401 BC_EXCEPTION_CHECK_ReturnValue(e, NULL); | |
402 int32_t max = m_alignmentPatternCenters.GetSize(); | |
403 for (int32_t x = 0; x < max; x++) { | |
404 int32_t i = m_alignmentPatternCenters[x] - 2; | |
405 for (int32_t y = 0; y < max; y++) { | |
406 if ((x == 0 && (y == 0 || y == max - 1)) || (x == max - 1 && y == 0)) { | |
407 continue; | |
408 } | |
409 bitMatrix->SetRegion(m_alignmentPatternCenters[y] - 2, i, 5, 5, e); | |
410 BC_EXCEPTION_CHECK_ReturnValue(e, NULL); | |
411 } | |
412 } | |
413 bitMatrix->SetRegion(6, 9, 1, dimension - 17, e); | |
414 BC_EXCEPTION_CHECK_ReturnValue(e, NULL); | |
415 bitMatrix->SetRegion(9, 6, dimension - 17, 1, e); | |
416 BC_EXCEPTION_CHECK_ReturnValue(e, NULL); | |
417 if (m_versionNumber > 6) { | |
418 bitMatrix->SetRegion(dimension - 11, 0, 3, 6, e); | |
419 BC_EXCEPTION_CHECK_ReturnValue(e, NULL); | |
420 bitMatrix->SetRegion(0, dimension - 11, 6, 3, e); | |
421 BC_EXCEPTION_CHECK_ReturnValue(e, NULL); | |
422 } | |
423 return bitMatrix; | |
424 } | |
425 CBC_QRCoderVersion* CBC_QRCoderVersion::GetVersionForNumber( | |
426 int32_t versionNumber, | |
427 int32_t& e) { | |
428 if (VERSION->GetSize() == 0) { | |
429 VERSION->Add(new CBC_QRCoderVersion( | |
430 1, new CBC_QRCoderECBlocks(7, new CBC_QRCoderECB(1, 19)), | |
431 new CBC_QRCoderECBlocks(10, new CBC_QRCoderECB(1, 16)), | |
432 new CBC_QRCoderECBlocks(13, new CBC_QRCoderECB(1, 13)), | |
433 new CBC_QRCoderECBlocks(17, new CBC_QRCoderECB(1, 9)))); | |
434 VERSION->Add(new CBC_QRCoderVersion( | |
435 2, new CBC_QRCoderECBlocks(10, new CBC_QRCoderECB(1, 34)), | |
436 new CBC_QRCoderECBlocks(16, new CBC_QRCoderECB(1, 28)), | |
437 new CBC_QRCoderECBlocks(22, new CBC_QRCoderECB(1, 22)), | |
438 new CBC_QRCoderECBlocks(28, new CBC_QRCoderECB(1, 16)))); | |
439 VERSION->Add(new CBC_QRCoderVersion( | |
440 3, new CBC_QRCoderECBlocks(15, new CBC_QRCoderECB(1, 55)), | |
441 new CBC_QRCoderECBlocks(26, new CBC_QRCoderECB(1, 44)), | |
442 new CBC_QRCoderECBlocks(18, new CBC_QRCoderECB(2, 17)), | |
443 new CBC_QRCoderECBlocks(22, new CBC_QRCoderECB(2, 13)))); | |
444 VERSION->Add(new CBC_QRCoderVersion( | |
445 4, new CBC_QRCoderECBlocks(20, new CBC_QRCoderECB(1, 80)), | |
446 new CBC_QRCoderECBlocks(18, new CBC_QRCoderECB(2, 32)), | |
447 new CBC_QRCoderECBlocks(26, new CBC_QRCoderECB(2, 24)), | |
448 new CBC_QRCoderECBlocks(16, new CBC_QRCoderECB(4, 9)))); | |
449 VERSION->Add(new CBC_QRCoderVersion( | |
450 5, new CBC_QRCoderECBlocks(26, new CBC_QRCoderECB(1, 108)), | |
451 new CBC_QRCoderECBlocks(24, new CBC_QRCoderECB(2, 43)), | |
452 new CBC_QRCoderECBlocks(18, new CBC_QRCoderECB(2, 15), | |
453 new CBC_QRCoderECB(2, 16)), | |
454 new CBC_QRCoderECBlocks(22, new CBC_QRCoderECB(2, 11), | |
455 new CBC_QRCoderECB(2, 12)))); | |
456 VERSION->Add(new CBC_QRCoderVersion( | |
457 6, new CBC_QRCoderECBlocks(18, new CBC_QRCoderECB(2, 68)), | |
458 new CBC_QRCoderECBlocks(16, new CBC_QRCoderECB(4, 27)), | |
459 new CBC_QRCoderECBlocks(24, new CBC_QRCoderECB(4, 19)), | |
460 new CBC_QRCoderECBlocks(28, new CBC_QRCoderECB(4, 15)))); | |
461 VERSION->Add(new CBC_QRCoderVersion( | |
462 7, new CBC_QRCoderECBlocks(20, new CBC_QRCoderECB(2, 78)), | |
463 new CBC_QRCoderECBlocks(18, new CBC_QRCoderECB(4, 31)), | |
464 new CBC_QRCoderECBlocks(18, new CBC_QRCoderECB(2, 14), | |
465 new CBC_QRCoderECB(4, 15)), | |
466 new CBC_QRCoderECBlocks(26, new CBC_QRCoderECB(4, 13), | |
467 new CBC_QRCoderECB(1, 14)))); | |
468 VERSION->Add(new CBC_QRCoderVersion( | |
469 8, new CBC_QRCoderECBlocks(24, new CBC_QRCoderECB(2, 97)), | |
470 new CBC_QRCoderECBlocks(22, new CBC_QRCoderECB(2, 38), | |
471 new CBC_QRCoderECB(2, 39)), | |
472 new CBC_QRCoderECBlocks(22, new CBC_QRCoderECB(4, 18), | |
473 new CBC_QRCoderECB(2, 19)), | |
474 new CBC_QRCoderECBlocks(26, new CBC_QRCoderECB(4, 14), | |
475 new CBC_QRCoderECB(2, 15)))); | |
476 VERSION->Add(new CBC_QRCoderVersion( | |
477 9, new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(2, 116)), | |
478 new CBC_QRCoderECBlocks(22, new CBC_QRCoderECB(3, 36), | |
479 new CBC_QRCoderECB(2, 37)), | |
480 new CBC_QRCoderECBlocks(20, new CBC_QRCoderECB(4, 16), | |
481 new CBC_QRCoderECB(4, 17)), | |
482 new CBC_QRCoderECBlocks(24, new CBC_QRCoderECB(4, 12), | |
483 new CBC_QRCoderECB(4, 13)))); | |
484 VERSION->Add(new CBC_QRCoderVersion( | |
485 10, new CBC_QRCoderECBlocks(18, new CBC_QRCoderECB(2, 68), | |
486 new CBC_QRCoderECB(2, 69)), | |
487 new CBC_QRCoderECBlocks(26, new CBC_QRCoderECB(4, 43), | |
488 new CBC_QRCoderECB(1, 44)), | |
489 new CBC_QRCoderECBlocks(24, new CBC_QRCoderECB(6, 19), | |
490 new CBC_QRCoderECB(2, 20)), | |
491 new CBC_QRCoderECBlocks(28, new CBC_QRCoderECB(6, 15), | |
492 new CBC_QRCoderECB(2, 16)))); | |
493 VERSION->Add(new CBC_QRCoderVersion( | |
494 11, new CBC_QRCoderECBlocks(20, new CBC_QRCoderECB(4, 81)), | |
495 new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(1, 50), | |
496 new CBC_QRCoderECB(4, 51)), | |
497 new CBC_QRCoderECBlocks(28, new CBC_QRCoderECB(4, 22), | |
498 new CBC_QRCoderECB(4, 23)), | |
499 new CBC_QRCoderECBlocks(24, new CBC_QRCoderECB(3, 12), | |
500 new CBC_QRCoderECB(8, 13)))); | |
501 VERSION->Add(new CBC_QRCoderVersion( | |
502 12, new CBC_QRCoderECBlocks(24, new CBC_QRCoderECB(2, 92), | |
503 new CBC_QRCoderECB(2, 93)), | |
504 new CBC_QRCoderECBlocks(22, new CBC_QRCoderECB(6, 36), | |
505 new CBC_QRCoderECB(2, 37)), | |
506 new CBC_QRCoderECBlocks(26, new CBC_QRCoderECB(4, 20), | |
507 new CBC_QRCoderECB(6, 21)), | |
508 new CBC_QRCoderECBlocks(28, new CBC_QRCoderECB(7, 14), | |
509 new CBC_QRCoderECB(4, 15)))); | |
510 VERSION->Add(new CBC_QRCoderVersion( | |
511 13, new CBC_QRCoderECBlocks(26, new CBC_QRCoderECB(4, 107)), | |
512 new CBC_QRCoderECBlocks(22, new CBC_QRCoderECB(8, 37), | |
513 new CBC_QRCoderECB(1, 38)), | |
514 new CBC_QRCoderECBlocks(24, new CBC_QRCoderECB(8, 20), | |
515 new CBC_QRCoderECB(4, 21)), | |
516 new CBC_QRCoderECBlocks(22, new CBC_QRCoderECB(12, 11), | |
517 new CBC_QRCoderECB(4, 12)))); | |
518 VERSION->Add(new CBC_QRCoderVersion( | |
519 14, new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(3, 115), | |
520 new CBC_QRCoderECB(1, 116)), | |
521 new CBC_QRCoderECBlocks(24, new CBC_QRCoderECB(4, 40), | |
522 new CBC_QRCoderECB(5, 41)), | |
523 new CBC_QRCoderECBlocks(20, new CBC_QRCoderECB(11, 16), | |
524 new CBC_QRCoderECB(5, 17)), | |
525 new CBC_QRCoderECBlocks(24, new CBC_QRCoderECB(11, 12), | |
526 new CBC_QRCoderECB(5, 13)))); | |
527 VERSION->Add(new CBC_QRCoderVersion( | |
528 15, new CBC_QRCoderECBlocks(22, new CBC_QRCoderECB(5, 87), | |
529 new CBC_QRCoderECB(1, 88)), | |
530 new CBC_QRCoderECBlocks(24, new CBC_QRCoderECB(5, 41), | |
531 new CBC_QRCoderECB(5, 42)), | |
532 new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(5, 24), | |
533 new CBC_QRCoderECB(7, 25)), | |
534 new CBC_QRCoderECBlocks(24, new CBC_QRCoderECB(11, 12), | |
535 new CBC_QRCoderECB(7, 13)))); | |
536 VERSION->Add(new CBC_QRCoderVersion( | |
537 16, new CBC_QRCoderECBlocks(24, new CBC_QRCoderECB(5, 98), | |
538 new CBC_QRCoderECB(1, 99)), | |
539 new CBC_QRCoderECBlocks(28, new CBC_QRCoderECB(7, 45), | |
540 new CBC_QRCoderECB(3, 46)), | |
541 new CBC_QRCoderECBlocks(24, new CBC_QRCoderECB(15, 19), | |
542 new CBC_QRCoderECB(2, 20)), | |
543 new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(3, 15), | |
544 new CBC_QRCoderECB(13, 16)))); | |
545 VERSION->Add(new CBC_QRCoderVersion( | |
546 17, new CBC_QRCoderECBlocks(28, new CBC_QRCoderECB(1, 107), | |
547 new CBC_QRCoderECB(5, 108)), | |
548 new CBC_QRCoderECBlocks(28, new CBC_QRCoderECB(10, 46), | |
549 new CBC_QRCoderECB(1, 47)), | |
550 new CBC_QRCoderECBlocks(28, new CBC_QRCoderECB(1, 22), | |
551 new CBC_QRCoderECB(15, 23)), | |
552 new CBC_QRCoderECBlocks(28, new CBC_QRCoderECB(2, 14), | |
553 new CBC_QRCoderECB(17, 15)))); | |
554 VERSION->Add(new CBC_QRCoderVersion( | |
555 18, new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(5, 120), | |
556 new CBC_QRCoderECB(1, 121)), | |
557 new CBC_QRCoderECBlocks(26, new CBC_QRCoderECB(9, 43), | |
558 new CBC_QRCoderECB(4, 44)), | |
559 new CBC_QRCoderECBlocks(28, new CBC_QRCoderECB(17, 22), | |
560 new CBC_QRCoderECB(1, 23)), | |
561 new CBC_QRCoderECBlocks(28, new CBC_QRCoderECB(2, 14), | |
562 new CBC_QRCoderECB(19, 15)))); | |
563 VERSION->Add(new CBC_QRCoderVersion( | |
564 19, new CBC_QRCoderECBlocks(28, new CBC_QRCoderECB(3, 113), | |
565 new CBC_QRCoderECB(4, 114)), | |
566 new CBC_QRCoderECBlocks(26, new CBC_QRCoderECB(3, 44), | |
567 new CBC_QRCoderECB(11, 45)), | |
568 new CBC_QRCoderECBlocks(26, new CBC_QRCoderECB(17, 21), | |
569 new CBC_QRCoderECB(4, 22)), | |
570 new CBC_QRCoderECBlocks(26, new CBC_QRCoderECB(9, 13), | |
571 new CBC_QRCoderECB(16, 14)))); | |
572 VERSION->Add(new CBC_QRCoderVersion( | |
573 20, new CBC_QRCoderECBlocks(28, new CBC_QRCoderECB(3, 107), | |
574 new CBC_QRCoderECB(5, 108)), | |
575 new CBC_QRCoderECBlocks(26, new CBC_QRCoderECB(3, 41), | |
576 new CBC_QRCoderECB(13, 42)), | |
577 new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(15, 24), | |
578 new CBC_QRCoderECB(5, 25)), | |
579 new CBC_QRCoderECBlocks(28, new CBC_QRCoderECB(15, 15), | |
580 new CBC_QRCoderECB(10, 16)))); | |
581 VERSION->Add(new CBC_QRCoderVersion( | |
582 21, new CBC_QRCoderECBlocks(28, new CBC_QRCoderECB(4, 116), | |
583 new CBC_QRCoderECB(4, 117)), | |
584 new CBC_QRCoderECBlocks(26, new CBC_QRCoderECB(17, 42)), | |
585 new CBC_QRCoderECBlocks(28, new CBC_QRCoderECB(17, 22), | |
586 new CBC_QRCoderECB(6, 23)), | |
587 new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(19, 16), | |
588 new CBC_QRCoderECB(6, 17)))); | |
589 VERSION->Add(new CBC_QRCoderVersion( | |
590 22, new CBC_QRCoderECBlocks(28, new CBC_QRCoderECB(2, 111), | |
591 new CBC_QRCoderECB(7, 112)), | |
592 new CBC_QRCoderECBlocks(28, new CBC_QRCoderECB(17, 46)), | |
593 new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(7, 24), | |
594 new CBC_QRCoderECB(16, 25)), | |
595 new CBC_QRCoderECBlocks(24, new CBC_QRCoderECB(34, 13)))); | |
596 VERSION->Add(new CBC_QRCoderVersion( | |
597 23, new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(4, 121), | |
598 new CBC_QRCoderECB(5, 122)), | |
599 new CBC_QRCoderECBlocks(28, new CBC_QRCoderECB(4, 47), | |
600 new CBC_QRCoderECB(14, 48)), | |
601 new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(11, 24), | |
602 new CBC_QRCoderECB(14, 25)), | |
603 new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(16, 15), | |
604 new CBC_QRCoderECB(14, 16)))); | |
605 VERSION->Add(new CBC_QRCoderVersion( | |
606 24, new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(6, 117), | |
607 new CBC_QRCoderECB(4, 118)), | |
608 new CBC_QRCoderECBlocks(28, new CBC_QRCoderECB(6, 45), | |
609 new CBC_QRCoderECB(14, 46)), | |
610 new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(11, 24), | |
611 new CBC_QRCoderECB(16, 25)), | |
612 new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(30, 16), | |
613 new CBC_QRCoderECB(2, 17)))); | |
614 VERSION->Add(new CBC_QRCoderVersion( | |
615 25, new CBC_QRCoderECBlocks(26, new CBC_QRCoderECB(8, 106), | |
616 new CBC_QRCoderECB(4, 107)), | |
617 new CBC_QRCoderECBlocks(28, new CBC_QRCoderECB(8, 47), | |
618 new CBC_QRCoderECB(13, 48)), | |
619 new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(7, 24), | |
620 new CBC_QRCoderECB(22, 25)), | |
621 new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(22, 15), | |
622 new CBC_QRCoderECB(13, 16)))); | |
623 VERSION->Add(new CBC_QRCoderVersion( | |
624 26, new CBC_QRCoderECBlocks(28, new CBC_QRCoderECB(10, 114), | |
625 new CBC_QRCoderECB(2, 115)), | |
626 new CBC_QRCoderECBlocks(28, new CBC_QRCoderECB(19, 46), | |
627 new CBC_QRCoderECB(4, 47)), | |
628 new CBC_QRCoderECBlocks(28, new CBC_QRCoderECB(28, 22), | |
629 new CBC_QRCoderECB(6, 23)), | |
630 new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(33, 16), | |
631 new CBC_QRCoderECB(4, 17)))); | |
632 VERSION->Add(new CBC_QRCoderVersion( | |
633 27, new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(8, 122), | |
634 new CBC_QRCoderECB(4, 123)), | |
635 new CBC_QRCoderECBlocks(28, new CBC_QRCoderECB(22, 45), | |
636 new CBC_QRCoderECB(3, 46)), | |
637 new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(8, 23), | |
638 new CBC_QRCoderECB(26, 24)), | |
639 new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(12, 15), | |
640 new CBC_QRCoderECB(28, 16)))); | |
641 VERSION->Add(new CBC_QRCoderVersion( | |
642 28, new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(3, 117), | |
643 new CBC_QRCoderECB(10, 118)), | |
644 new CBC_QRCoderECBlocks(28, new CBC_QRCoderECB(3, 45), | |
645 new CBC_QRCoderECB(23, 46)), | |
646 new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(4, 24), | |
647 new CBC_QRCoderECB(31, 25)), | |
648 new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(11, 15), | |
649 new CBC_QRCoderECB(31, 16)))); | |
650 VERSION->Add(new CBC_QRCoderVersion( | |
651 29, new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(7, 116), | |
652 new CBC_QRCoderECB(7, 117)), | |
653 new CBC_QRCoderECBlocks(28, new CBC_QRCoderECB(21, 45), | |
654 new CBC_QRCoderECB(7, 46)), | |
655 new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(1, 23), | |
656 new CBC_QRCoderECB(37, 24)), | |
657 new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(19, 15), | |
658 new CBC_QRCoderECB(26, 16)))); | |
659 VERSION->Add(new CBC_QRCoderVersion( | |
660 30, new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(5, 115), | |
661 new CBC_QRCoderECB(10, 116)), | |
662 new CBC_QRCoderECBlocks(28, new CBC_QRCoderECB(19, 47), | |
663 new CBC_QRCoderECB(10, 48)), | |
664 new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(15, 24), | |
665 new CBC_QRCoderECB(25, 25)), | |
666 new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(23, 15), | |
667 new CBC_QRCoderECB(25, 16)))); | |
668 VERSION->Add(new CBC_QRCoderVersion( | |
669 31, new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(13, 115), | |
670 new CBC_QRCoderECB(3, 116)), | |
671 new CBC_QRCoderECBlocks(28, new CBC_QRCoderECB(2, 46), | |
672 new CBC_QRCoderECB(29, 47)), | |
673 new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(42, 24), | |
674 new CBC_QRCoderECB(1, 25)), | |
675 new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(23, 15), | |
676 new CBC_QRCoderECB(28, 16)))); | |
677 VERSION->Add(new CBC_QRCoderVersion( | |
678 32, new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(17, 115)), | |
679 new CBC_QRCoderECBlocks(28, new CBC_QRCoderECB(10, 46), | |
680 new CBC_QRCoderECB(23, 47)), | |
681 new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(10, 24), | |
682 new CBC_QRCoderECB(35, 25)), | |
683 new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(19, 15), | |
684 new CBC_QRCoderECB(35, 16)))); | |
685 VERSION->Add(new CBC_QRCoderVersion( | |
686 33, new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(17, 115), | |
687 new CBC_QRCoderECB(1, 116)), | |
688 new CBC_QRCoderECBlocks(28, new CBC_QRCoderECB(14, 46), | |
689 new CBC_QRCoderECB(21, 47)), | |
690 new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(29, 24), | |
691 new CBC_QRCoderECB(19, 25)), | |
692 new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(11, 15), | |
693 new CBC_QRCoderECB(46, 16)))); | |
694 VERSION->Add(new CBC_QRCoderVersion( | |
695 34, new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(13, 115), | |
696 new CBC_QRCoderECB(6, 116)), | |
697 new CBC_QRCoderECBlocks(28, new CBC_QRCoderECB(14, 46), | |
698 new CBC_QRCoderECB(23, 47)), | |
699 new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(44, 24), | |
700 new CBC_QRCoderECB(7, 25)), | |
701 new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(59, 16), | |
702 new CBC_QRCoderECB(1, 17)))); | |
703 VERSION->Add(new CBC_QRCoderVersion( | |
704 35, new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(12, 121), | |
705 new CBC_QRCoderECB(7, 122)), | |
706 new CBC_QRCoderECBlocks(28, new CBC_QRCoderECB(12, 47), | |
707 new CBC_QRCoderECB(26, 48)), | |
708 new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(39, 24), | |
709 new CBC_QRCoderECB(14, 25)), | |
710 new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(22, 15), | |
711 new CBC_QRCoderECB(41, 16)))); | |
712 VERSION->Add(new CBC_QRCoderVersion( | |
713 36, new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(6, 121), | |
714 new CBC_QRCoderECB(14, 122)), | |
715 new CBC_QRCoderECBlocks(28, new CBC_QRCoderECB(6, 47), | |
716 new CBC_QRCoderECB(34, 48)), | |
717 new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(46, 24), | |
718 new CBC_QRCoderECB(10, 25)), | |
719 new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(2, 15), | |
720 new CBC_QRCoderECB(64, 16)))); | |
721 VERSION->Add(new CBC_QRCoderVersion( | |
722 37, new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(17, 122), | |
723 new CBC_QRCoderECB(4, 123)), | |
724 new CBC_QRCoderECBlocks(28, new CBC_QRCoderECB(29, 46), | |
725 new CBC_QRCoderECB(14, 47)), | |
726 new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(49, 24), | |
727 new CBC_QRCoderECB(10, 25)), | |
728 new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(24, 15), | |
729 new CBC_QRCoderECB(46, 16)))); | |
730 VERSION->Add(new CBC_QRCoderVersion( | |
731 38, new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(4, 122), | |
732 new CBC_QRCoderECB(18, 123)), | |
733 new CBC_QRCoderECBlocks(28, new CBC_QRCoderECB(13, 46), | |
734 new CBC_QRCoderECB(32, 47)), | |
735 new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(48, 24), | |
736 new CBC_QRCoderECB(14, 25)), | |
737 new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(42, 15), | |
738 new CBC_QRCoderECB(32, 16)))); | |
739 VERSION->Add(new CBC_QRCoderVersion( | |
740 39, new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(20, 117), | |
741 new CBC_QRCoderECB(4, 118)), | |
742 new CBC_QRCoderECBlocks(28, new CBC_QRCoderECB(40, 47), | |
743 new CBC_QRCoderECB(7, 48)), | |
744 new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(43, 24), | |
745 new CBC_QRCoderECB(22, 25)), | |
746 new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(10, 15), | |
747 new CBC_QRCoderECB(67, 16)))); | |
748 VERSION->Add(new CBC_QRCoderVersion( | |
749 40, new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(19, 118), | |
750 new CBC_QRCoderECB(6, 119)), | |
751 new CBC_QRCoderECBlocks(28, new CBC_QRCoderECB(18, 47), | |
752 new CBC_QRCoderECB(31, 48)), | |
753 new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(34, 24), | |
754 new CBC_QRCoderECB(34, 25)), | |
755 new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(20, 15), | |
756 new CBC_QRCoderECB(61, 16)))); | |
757 } | |
758 if (versionNumber < 1 || versionNumber > 40) { | |
759 e = BCExceptionIllegalArgument; | |
760 BC_EXCEPTION_CHECK_ReturnValue(e, NULL); | |
761 } | |
762 return (CBC_QRCoderVersion*)(*VERSION)[versionNumber - 1]; | |
763 } | |
764 void CBC_QRCoderVersion::Destroy() { | |
765 int32_t i; | |
766 for (i = 0; i < VERSION->GetSize(); i++) { | |
767 delete ((CBC_QRCoderVersion*)(*VERSION)[i]); | |
768 } | |
769 } | |
OLD | NEW |