Version.cpp 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560
  1. /*
  2. * Version.cpp
  3. * zxing
  4. *
  5. * Created by Christian Brunschen on 14/05/2008.
  6. * Copyright 2008 ZXing authors All rights reserved.
  7. *
  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
  11. *
  12. * http://www.apache.org/licenses/LICENSE-2.0
  13. *
  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.
  19. */
  20. #include <zxing/qrcode/Version.h>
  21. #include <zxing/qrcode/FormatInformation.h>
  22. #include <zxing/FormatException.h>
  23. #include <limits>
  24. #include <iostream>
  25. #include <cstdarg>
  26. using std::vector;
  27. using std::numeric_limits;
  28. namespace zxing {
  29. namespace qrcode {
  30. ECB::ECB(int count, int dataCodewords) :
  31. count_(count), dataCodewords_(dataCodewords) {
  32. }
  33. int ECB::getCount() {
  34. return count_;
  35. }
  36. int ECB::getDataCodewords() {
  37. return dataCodewords_;
  38. }
  39. ECBlocks::ECBlocks(int ecCodewords, ECB *ecBlocks) :
  40. ecCodewords_(ecCodewords), ecBlocks_(1, ecBlocks) {
  41. }
  42. ECBlocks::ECBlocks(int ecCodewords, ECB *ecBlocks1, ECB *ecBlocks2) :
  43. ecCodewords_(ecCodewords), ecBlocks_(1, ecBlocks1) {
  44. ecBlocks_.push_back(ecBlocks2);
  45. }
  46. int ECBlocks::getECCodewords() {
  47. return ecCodewords_;
  48. }
  49. std::vector<ECB*>& ECBlocks::getECBlocks() {
  50. return ecBlocks_;
  51. }
  52. ECBlocks::~ECBlocks() {
  53. for (size_t i = 0; i < ecBlocks_.size(); i++) {
  54. delete ecBlocks_[i];
  55. }
  56. }
  57. unsigned int Version::VERSION_DECODE_INFO[] = { 0x07C94, 0x085BC, 0x09A99, 0x0A4D3, 0x0BBF6, 0x0C762, 0x0D847, 0x0E60D,
  58. 0x0F928, 0x10B78, 0x1145D, 0x12A17, 0x13532, 0x149A6, 0x15683, 0x168C9, 0x177EC, 0x18EC4, 0x191E1, 0x1AFAB,
  59. 0x1B08E, 0x1CC1A, 0x1D33F, 0x1ED75, 0x1F250, 0x209D5, 0x216F0, 0x228BA, 0x2379F, 0x24B0B, 0x2542E, 0x26A64,
  60. 0x27541, 0x28C69
  61. };
  62. int Version::N_VERSION_DECODE_INFOS = 34;
  63. vector<Ref<Version> > Version::VERSIONS;
  64. static int N_VERSIONS = Version::buildVersions();
  65. int Version::getVersionNumber() {
  66. return versionNumber_;
  67. }
  68. vector<int> &Version::getAlignmentPatternCenters() {
  69. return alignmentPatternCenters_;
  70. }
  71. int Version::getTotalCodewords() {
  72. return totalCodewords_;
  73. }
  74. int Version::getDimensionForVersion() {
  75. return 17 + 4 * versionNumber_;
  76. }
  77. ECBlocks& Version::getECBlocksForLevel(ErrorCorrectionLevel &ecLevel) {
  78. return *ecBlocks_[ecLevel.ordinal()];
  79. }
  80. Version *Version::getProvisionalVersionForDimension(int dimension) {
  81. if (dimension % 4 != 1) {
  82. throw FormatException();
  83. }
  84. try {
  85. return Version::getVersionForNumber((dimension - 17) >> 2);
  86. } catch (IllegalArgumentException const& ignored) {
  87. (void)ignored;
  88. throw FormatException();
  89. }
  90. }
  91. Version *Version::getVersionForNumber(int versionNumber) {
  92. if (versionNumber < 1 || versionNumber > N_VERSIONS) {
  93. throw ReaderException("versionNumber must be between 1 and 40");
  94. }
  95. return VERSIONS[versionNumber - 1];
  96. }
  97. Version::Version(int versionNumber, vector<int> *alignmentPatternCenters, ECBlocks *ecBlocks1, ECBlocks *ecBlocks2,
  98. ECBlocks *ecBlocks3, ECBlocks *ecBlocks4) :
  99. versionNumber_(versionNumber), alignmentPatternCenters_(*alignmentPatternCenters), ecBlocks_(4), totalCodewords_(0) {
  100. ecBlocks_[0] = ecBlocks1;
  101. ecBlocks_[1] = ecBlocks2;
  102. ecBlocks_[2] = ecBlocks3;
  103. ecBlocks_[3] = ecBlocks4;
  104. int total = 0;
  105. int ecCodewords = ecBlocks1->getECCodewords();
  106. vector<ECB*> &ecbArray = ecBlocks1->getECBlocks();
  107. for (size_t i = 0; i < ecbArray.size(); i++) {
  108. ECB *ecBlock = ecbArray[i];
  109. total += ecBlock->getCount() * (ecBlock->getDataCodewords() + ecCodewords);
  110. }
  111. totalCodewords_ = total;
  112. }
  113. Version::~Version() {
  114. delete &alignmentPatternCenters_;
  115. for (size_t i = 0; i < ecBlocks_.size(); i++) {
  116. delete ecBlocks_[i];
  117. }
  118. }
  119. Version *Version::decodeVersionInformation(unsigned int versionBits) {
  120. int bestDifference = numeric_limits<int>::max();
  121. size_t bestVersion = 0;
  122. for (int i = 0; i < N_VERSION_DECODE_INFOS; i++) {
  123. unsigned targetVersion = VERSION_DECODE_INFO[i];
  124. // Do the version info bits match exactly? done.
  125. if (targetVersion == versionBits) {
  126. return getVersionForNumber(i + 7);
  127. }
  128. // Otherwise see if this is the closest to a real version info bit
  129. // string we have seen so far
  130. int bitsDifference = FormatInformation::numBitsDiffering(versionBits, targetVersion);
  131. if (bitsDifference < bestDifference) {
  132. bestVersion = i + 7;
  133. bestDifference = bitsDifference;
  134. }
  135. }
  136. // We can tolerate up to 3 bits of error since no two version info codewords will
  137. // differ in less than 4 bits.
  138. if (bestDifference <= 3) {
  139. return getVersionForNumber(bestVersion);
  140. }
  141. // If we didn't find a close enough match, fail
  142. return 0;
  143. }
  144. Ref<BitMatrix> Version::buildFunctionPattern() {
  145. int dimension = getDimensionForVersion();
  146. Ref<BitMatrix> functionPattern(new BitMatrix(dimension));
  147. // Top left finder pattern + separator + format
  148. functionPattern->setRegion(0, 0, 9, 9);
  149. // Top right finder pattern + separator + format
  150. functionPattern->setRegion(dimension - 8, 0, 8, 9);
  151. // Bottom left finder pattern + separator + format
  152. functionPattern->setRegion(0, dimension - 8, 9, 8);
  153. // Alignment patterns
  154. size_t max = alignmentPatternCenters_.size();
  155. for (size_t x = 0; x < max; x++) {
  156. int i = alignmentPatternCenters_[x] - 2;
  157. for (size_t y = 0; y < max; y++) {
  158. if ((x == 0 && (y == 0 || y == max - 1)) || (x == max - 1 && y == 0)) {
  159. // No alignment patterns near the three finder patterns
  160. continue;
  161. }
  162. functionPattern->setRegion(alignmentPatternCenters_[y] - 2, i, 5, 5);
  163. }
  164. }
  165. // Vertical timing pattern
  166. functionPattern->setRegion(6, 9, 1, dimension - 17);
  167. // Horizontal timing pattern
  168. functionPattern->setRegion(9, 6, dimension - 17, 1);
  169. if (versionNumber_ > 6) {
  170. // Version info, top right
  171. functionPattern->setRegion(dimension - 11, 0, 3, 6);
  172. // Version info, bottom left
  173. functionPattern->setRegion(0, dimension - 11, 6, 3);
  174. }
  175. return functionPattern;
  176. }
  177. static vector<int> *intArray(size_t n...) {
  178. va_list ap;
  179. va_start(ap, n);
  180. vector<int> *result = new vector<int>(n);
  181. for (size_t i = 0; i < n; i++) {
  182. (*result)[i] = va_arg(ap, int);
  183. }
  184. va_end(ap);
  185. return result;
  186. }
  187. int Version::buildVersions() {
  188. VERSIONS.push_back(Ref<Version>(new Version(1, intArray(0),
  189. new ECBlocks(7, new ECB(1, 19)),
  190. new ECBlocks(10, new ECB(1, 16)),
  191. new ECBlocks(13, new ECB(1, 13)),
  192. new ECBlocks(17, new ECB(1, 9)))));
  193. VERSIONS.push_back(Ref<Version>(new Version(2, intArray(2, 6, 18),
  194. new ECBlocks(10, new ECB(1, 34)),
  195. new ECBlocks(16, new ECB(1, 28)),
  196. new ECBlocks(22, new ECB(1, 22)),
  197. new ECBlocks(28, new ECB(1, 16)))));
  198. VERSIONS.push_back(Ref<Version>(new Version(3, intArray(2, 6, 22),
  199. new ECBlocks(15, new ECB(1, 55)),
  200. new ECBlocks(26, new ECB(1, 44)),
  201. new ECBlocks(18, new ECB(2, 17)),
  202. new ECBlocks(22, new ECB(2, 13)))));
  203. VERSIONS.push_back(Ref<Version>(new Version(4, intArray(2, 6, 26),
  204. new ECBlocks(20, new ECB(1, 80)),
  205. new ECBlocks(18, new ECB(2, 32)),
  206. new ECBlocks(26, new ECB(2, 24)),
  207. new ECBlocks(16, new ECB(4, 9)))));
  208. VERSIONS.push_back(Ref<Version>(new Version(5, intArray(2, 6, 30),
  209. new ECBlocks(26, new ECB(1, 108)),
  210. new ECBlocks(24, new ECB(2, 43)),
  211. new ECBlocks(18, new ECB(2, 15),
  212. new ECB(2, 16)),
  213. new ECBlocks(22, new ECB(2, 11),
  214. new ECB(2, 12)))));
  215. VERSIONS.push_back(Ref<Version>(new Version(6, intArray(2, 6, 34),
  216. new ECBlocks(18, new ECB(2, 68)),
  217. new ECBlocks(16, new ECB(4, 27)),
  218. new ECBlocks(24, new ECB(4, 19)),
  219. new ECBlocks(28, new ECB(4, 15)))));
  220. VERSIONS.push_back(Ref<Version>(new Version(7, intArray(3, 6, 22, 38),
  221. new ECBlocks(20, new ECB(2, 78)),
  222. new ECBlocks(18, new ECB(4, 31)),
  223. new ECBlocks(18, new ECB(2, 14),
  224. new ECB(4, 15)),
  225. new ECBlocks(26, new ECB(4, 13),
  226. new ECB(1, 14)))));
  227. VERSIONS.push_back(Ref<Version>(new Version(8, intArray(3, 6, 24, 42),
  228. new ECBlocks(24, new ECB(2, 97)),
  229. new ECBlocks(22, new ECB(2, 38),
  230. new ECB(2, 39)),
  231. new ECBlocks(22, new ECB(4, 18),
  232. new ECB(2, 19)),
  233. new ECBlocks(26, new ECB(4, 14),
  234. new ECB(2, 15)))));
  235. VERSIONS.push_back(Ref<Version>(new Version(9, intArray(3, 6, 26, 46),
  236. new ECBlocks(30, new ECB(2, 116)),
  237. new ECBlocks(22, new ECB(3, 36),
  238. new ECB(2, 37)),
  239. new ECBlocks(20, new ECB(4, 16),
  240. new ECB(4, 17)),
  241. new ECBlocks(24, new ECB(4, 12),
  242. new ECB(4, 13)))));
  243. VERSIONS.push_back(Ref<Version>(new Version(10, intArray(3, 6, 28, 50),
  244. new ECBlocks(18, new ECB(2, 68),
  245. new ECB(2, 69)),
  246. new ECBlocks(26, new ECB(4, 43),
  247. new ECB(1, 44)),
  248. new ECBlocks(24, new ECB(6, 19),
  249. new ECB(2, 20)),
  250. new ECBlocks(28, new ECB(6, 15),
  251. new ECB(2, 16)))));
  252. VERSIONS.push_back(Ref<Version>(new Version(11, intArray(3, 6, 30, 54),
  253. new ECBlocks(20, new ECB(4, 81)),
  254. new ECBlocks(30, new ECB(1, 50),
  255. new ECB(4, 51)),
  256. new ECBlocks(28, new ECB(4, 22),
  257. new ECB(4, 23)),
  258. new ECBlocks(24, new ECB(3, 12),
  259. new ECB(8, 13)))));
  260. VERSIONS.push_back(Ref<Version>(new Version(12, intArray(3, 6, 32, 58),
  261. new ECBlocks(24, new ECB(2, 92),
  262. new ECB(2, 93)),
  263. new ECBlocks(22, new ECB(6, 36),
  264. new ECB(2, 37)),
  265. new ECBlocks(26, new ECB(4, 20),
  266. new ECB(6, 21)),
  267. new ECBlocks(28, new ECB(7, 14),
  268. new ECB(4, 15)))));
  269. VERSIONS.push_back(Ref<Version>(new Version(13, intArray(3, 6, 34, 62),
  270. new ECBlocks(26, new ECB(4, 107)),
  271. new ECBlocks(22, new ECB(8, 37),
  272. new ECB(1, 38)),
  273. new ECBlocks(24, new ECB(8, 20),
  274. new ECB(4, 21)),
  275. new ECBlocks(22, new ECB(12, 11),
  276. new ECB(4, 12)))));
  277. VERSIONS.push_back(Ref<Version>(new Version(14, intArray(4, 6, 26, 46, 66),
  278. new ECBlocks(30, new ECB(3, 115),
  279. new ECB(1, 116)),
  280. new ECBlocks(24, new ECB(4, 40),
  281. new ECB(5, 41)),
  282. new ECBlocks(20, new ECB(11, 16),
  283. new ECB(5, 17)),
  284. new ECBlocks(24, new ECB(11, 12),
  285. new ECB(5, 13)))));
  286. VERSIONS.push_back(Ref<Version>(new Version(15, intArray(4, 6, 26, 48, 70),
  287. new ECBlocks(22, new ECB(5, 87),
  288. new ECB(1, 88)),
  289. new ECBlocks(24, new ECB(5, 41),
  290. new ECB(5, 42)),
  291. new ECBlocks(30, new ECB(5, 24),
  292. new ECB(7, 25)),
  293. new ECBlocks(24, new ECB(11, 12),
  294. new ECB(7, 13)))));
  295. VERSIONS.push_back(Ref<Version>(new Version(16, intArray(4, 6, 26, 50, 74),
  296. new ECBlocks(24, new ECB(5, 98),
  297. new ECB(1, 99)),
  298. new ECBlocks(28, new ECB(7, 45),
  299. new ECB(3, 46)),
  300. new ECBlocks(24, new ECB(15, 19),
  301. new ECB(2, 20)),
  302. new ECBlocks(30, new ECB(3, 15),
  303. new ECB(13, 16)))));
  304. VERSIONS.push_back(Ref<Version>(new Version(17, intArray(4, 6, 30, 54, 78),
  305. new ECBlocks(28, new ECB(1, 107),
  306. new ECB(5, 108)),
  307. new ECBlocks(28, new ECB(10, 46),
  308. new ECB(1, 47)),
  309. new ECBlocks(28, new ECB(1, 22),
  310. new ECB(15, 23)),
  311. new ECBlocks(28, new ECB(2, 14),
  312. new ECB(17, 15)))));
  313. VERSIONS.push_back(Ref<Version>(new Version(18, intArray(4, 6, 30, 56, 82),
  314. new ECBlocks(30, new ECB(5, 120),
  315. new ECB(1, 121)),
  316. new ECBlocks(26, new ECB(9, 43),
  317. new ECB(4, 44)),
  318. new ECBlocks(28, new ECB(17, 22),
  319. new ECB(1, 23)),
  320. new ECBlocks(28, new ECB(2, 14),
  321. new ECB(19, 15)))));
  322. VERSIONS.push_back(Ref<Version>(new Version(19, intArray(4, 6, 30, 58, 86),
  323. new ECBlocks(28, new ECB(3, 113),
  324. new ECB(4, 114)),
  325. new ECBlocks(26, new ECB(3, 44),
  326. new ECB(11, 45)),
  327. new ECBlocks(26, new ECB(17, 21),
  328. new ECB(4, 22)),
  329. new ECBlocks(26, new ECB(9, 13),
  330. new ECB(16, 14)))));
  331. VERSIONS.push_back(Ref<Version>(new Version(20, intArray(4, 6, 34, 62, 90),
  332. new ECBlocks(28, new ECB(3, 107),
  333. new ECB(5, 108)),
  334. new ECBlocks(26, new ECB(3, 41),
  335. new ECB(13, 42)),
  336. new ECBlocks(30, new ECB(15, 24),
  337. new ECB(5, 25)),
  338. new ECBlocks(28, new ECB(15, 15),
  339. new ECB(10, 16)))));
  340. VERSIONS.push_back(Ref<Version>(new Version(21, intArray(5, 6, 28, 50, 72, 94),
  341. new ECBlocks(28, new ECB(4, 116),
  342. new ECB(4, 117)),
  343. new ECBlocks(26, new ECB(17, 42)),
  344. new ECBlocks(28, new ECB(17, 22),
  345. new ECB(6, 23)),
  346. new ECBlocks(30, new ECB(19, 16),
  347. new ECB(6, 17)))));
  348. VERSIONS.push_back(Ref<Version>(new Version(22, intArray(5, 6, 26, 50, 74, 98),
  349. new ECBlocks(28, new ECB(2, 111),
  350. new ECB(7, 112)),
  351. new ECBlocks(28, new ECB(17, 46)),
  352. new ECBlocks(30, new ECB(7, 24),
  353. new ECB(16, 25)),
  354. new ECBlocks(24, new ECB(34, 13)))));
  355. VERSIONS.push_back(Ref<Version>(new Version(23, intArray(5, 6, 30, 54, 78, 102),
  356. new ECBlocks(30, new ECB(4, 121),
  357. new ECB(5, 122)),
  358. new ECBlocks(28, new ECB(4, 47),
  359. new ECB(14, 48)),
  360. new ECBlocks(30, new ECB(11, 24),
  361. new ECB(14, 25)),
  362. new ECBlocks(30, new ECB(16, 15),
  363. new ECB(14, 16)))));
  364. VERSIONS.push_back(Ref<Version>(new Version(24, intArray(5, 6, 28, 54, 80, 106),
  365. new ECBlocks(30, new ECB(6, 117),
  366. new ECB(4, 118)),
  367. new ECBlocks(28, new ECB(6, 45),
  368. new ECB(14, 46)),
  369. new ECBlocks(30, new ECB(11, 24),
  370. new ECB(16, 25)),
  371. new ECBlocks(30, new ECB(30, 16),
  372. new ECB(2, 17)))));
  373. VERSIONS.push_back(Ref<Version>(new Version(25, intArray(5, 6, 32, 58, 84, 110),
  374. new ECBlocks(26, new ECB(8, 106),
  375. new ECB(4, 107)),
  376. new ECBlocks(28, new ECB(8, 47),
  377. new ECB(13, 48)),
  378. new ECBlocks(30, new ECB(7, 24),
  379. new ECB(22, 25)),
  380. new ECBlocks(30, new ECB(22, 15),
  381. new ECB(13, 16)))));
  382. VERSIONS.push_back(Ref<Version>(new Version(26, intArray(5, 6, 30, 58, 86, 114),
  383. new ECBlocks(28, new ECB(10, 114),
  384. new ECB(2, 115)),
  385. new ECBlocks(28, new ECB(19, 46),
  386. new ECB(4, 47)),
  387. new ECBlocks(28, new ECB(28, 22),
  388. new ECB(6, 23)),
  389. new ECBlocks(30, new ECB(33, 16),
  390. new ECB(4, 17)))));
  391. VERSIONS.push_back(Ref<Version>(new Version(27, intArray(5, 6, 34, 62, 90, 118),
  392. new ECBlocks(30, new ECB(8, 122),
  393. new ECB(4, 123)),
  394. new ECBlocks(28, new ECB(22, 45),
  395. new ECB(3, 46)),
  396. new ECBlocks(30, new ECB(8, 23),
  397. new ECB(26, 24)),
  398. new ECBlocks(30, new ECB(12, 15),
  399. new ECB(28, 16)))));
  400. VERSIONS.push_back(Ref<Version>(new Version(28, intArray(6, 6, 26, 50, 74, 98, 122),
  401. new ECBlocks(30, new ECB(3, 117),
  402. new ECB(10, 118)),
  403. new ECBlocks(28, new ECB(3, 45),
  404. new ECB(23, 46)),
  405. new ECBlocks(30, new ECB(4, 24),
  406. new ECB(31, 25)),
  407. new ECBlocks(30, new ECB(11, 15),
  408. new ECB(31, 16)))));
  409. VERSIONS.push_back(Ref<Version>(new Version(29, intArray(6, 6, 30, 54, 78, 102, 126),
  410. new ECBlocks(30, new ECB(7, 116),
  411. new ECB(7, 117)),
  412. new ECBlocks(28, new ECB(21, 45),
  413. new ECB(7, 46)),
  414. new ECBlocks(30, new ECB(1, 23),
  415. new ECB(37, 24)),
  416. new ECBlocks(30, new ECB(19, 15),
  417. new ECB(26, 16)))));
  418. VERSIONS.push_back(Ref<Version>(new Version(30, intArray(6, 6, 26, 52, 78, 104, 130),
  419. new ECBlocks(30, new ECB(5, 115),
  420. new ECB(10, 116)),
  421. new ECBlocks(28, new ECB(19, 47),
  422. new ECB(10, 48)),
  423. new ECBlocks(30, new ECB(15, 24),
  424. new ECB(25, 25)),
  425. new ECBlocks(30, new ECB(23, 15),
  426. new ECB(25, 16)))));
  427. VERSIONS.push_back(Ref<Version>(new Version(31, intArray(6, 6, 30, 56, 82, 108, 134),
  428. new ECBlocks(30, new ECB(13, 115),
  429. new ECB(3, 116)),
  430. new ECBlocks(28, new ECB(2, 46),
  431. new ECB(29, 47)),
  432. new ECBlocks(30, new ECB(42, 24),
  433. new ECB(1, 25)),
  434. new ECBlocks(30, new ECB(23, 15),
  435. new ECB(28, 16)))));
  436. VERSIONS.push_back(Ref<Version>(new Version(32, intArray(6, 6, 34, 60, 86, 112, 138),
  437. new ECBlocks(30, new ECB(17, 115)),
  438. new ECBlocks(28, new ECB(10, 46),
  439. new ECB(23, 47)),
  440. new ECBlocks(30, new ECB(10, 24),
  441. new ECB(35, 25)),
  442. new ECBlocks(30, new ECB(19, 15),
  443. new ECB(35, 16)))));
  444. VERSIONS.push_back(Ref<Version>(new Version(33, intArray(6, 6, 30, 58, 86, 114, 142),
  445. new ECBlocks(30, new ECB(17, 115),
  446. new ECB(1, 116)),
  447. new ECBlocks(28, new ECB(14, 46),
  448. new ECB(21, 47)),
  449. new ECBlocks(30, new ECB(29, 24),
  450. new ECB(19, 25)),
  451. new ECBlocks(30, new ECB(11, 15),
  452. new ECB(46, 16)))));
  453. VERSIONS.push_back(Ref<Version>(new Version(34, intArray(6, 6, 34, 62, 90, 118, 146),
  454. new ECBlocks(30, new ECB(13, 115),
  455. new ECB(6, 116)),
  456. new ECBlocks(28, new ECB(14, 46),
  457. new ECB(23, 47)),
  458. new ECBlocks(30, new ECB(44, 24),
  459. new ECB(7, 25)),
  460. new ECBlocks(30, new ECB(59, 16),
  461. new ECB(1, 17)))));
  462. VERSIONS.push_back(Ref<Version>(new Version(35, intArray(7, 6, 30, 54, 78,
  463. 102, 126, 150),
  464. new ECBlocks(30, new ECB(12, 121),
  465. new ECB(7, 122)),
  466. new ECBlocks(28, new ECB(12, 47),
  467. new ECB(26, 48)),
  468. new ECBlocks(30, new ECB(39, 24),
  469. new ECB(14, 25)),
  470. new ECBlocks(30, new ECB(22, 15),
  471. new ECB(41, 16)))));
  472. VERSIONS.push_back(Ref<Version>(new Version(36, intArray(7, 6, 24, 50, 76,
  473. 102, 128, 154),
  474. new ECBlocks(30, new ECB(6, 121),
  475. new ECB(14, 122)),
  476. new ECBlocks(28, new ECB(6, 47),
  477. new ECB(34, 48)),
  478. new ECBlocks(30, new ECB(46, 24),
  479. new ECB(10, 25)),
  480. new ECBlocks(30, new ECB(2, 15),
  481. new ECB(64, 16)))));
  482. VERSIONS.push_back(Ref<Version>(new Version(37, intArray(7, 6, 28, 54, 80,
  483. 106, 132, 158),
  484. new ECBlocks(30, new ECB(17, 122),
  485. new ECB(4, 123)),
  486. new ECBlocks(28, new ECB(29, 46),
  487. new ECB(14, 47)),
  488. new ECBlocks(30, new ECB(49, 24),
  489. new ECB(10, 25)),
  490. new ECBlocks(30, new ECB(24, 15),
  491. new ECB(46, 16)))));
  492. VERSIONS.push_back(Ref<Version>(new Version(38, intArray(7, 6, 32, 58, 84,
  493. 110, 136, 162),
  494. new ECBlocks(30, new ECB(4, 122),
  495. new ECB(18, 123)),
  496. new ECBlocks(28, new ECB(13, 46),
  497. new ECB(32, 47)),
  498. new ECBlocks(30, new ECB(48, 24),
  499. new ECB(14, 25)),
  500. new ECBlocks(30, new ECB(42, 15),
  501. new ECB(32, 16)))));
  502. VERSIONS.push_back(Ref<Version>(new Version(39, intArray(7, 6, 26, 54, 82,
  503. 110, 138, 166),
  504. new ECBlocks(30, new ECB(20, 117),
  505. new ECB(4, 118)),
  506. new ECBlocks(28, new ECB(40, 47),
  507. new ECB(7, 48)),
  508. new ECBlocks(30, new ECB(43, 24),
  509. new ECB(22, 25)),
  510. new ECBlocks(30, new ECB(10, 15),
  511. new ECB(67, 16)))));
  512. VERSIONS.push_back(Ref<Version>(new Version(40, intArray(7, 6, 30, 58, 86,
  513. 114, 142, 170),
  514. new ECBlocks(30, new ECB(19, 118),
  515. new ECB(6, 119)),
  516. new ECBlocks(28, new ECB(18, 47),
  517. new ECB(31, 48)),
  518. new ECBlocks(30, new ECB(34, 24),
  519. new ECB(34, 25)),
  520. new ECBlocks(30, new ECB(20, 15),
  521. new ECB(61, 16)))));
  522. return VERSIONS.size();
  523. }
  524. }
  525. }