composite.h 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. /* composite.c - Tables for UCC.EAN Composite Symbols */
  2. /*
  3. libzint - the open source barcode library
  4. Copyright (C) 2008-2024 Robin Stuart <rstuart114@gmail.com>
  5. Redistribution and use in source and binary forms, with or without
  6. modification, are permitted provided that the following conditions
  7. are met:
  8. 1. Redistributions of source code must retain the above copyright
  9. notice, this list of conditions and the following disclaimer.
  10. 2. Redistributions in binary form must reproduce the above copyright
  11. notice, this list of conditions and the following disclaimer in the
  12. documentation and/or other materials provided with the distribution.
  13. 3. Neither the name of the project nor the names of its contributors
  14. may be used to endorse or promote products derived from this software
  15. without specific prior written permission.
  16. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
  17. ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  18. IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  19. ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
  20. FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  21. DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  22. OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  23. HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  24. LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  25. OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  26. SUCH DAMAGE.
  27. */
  28. /* SPDX-License-Identifier: BSD-3-Clause */
  29. #ifndef Z_COMPOSITE_H
  30. #define Z_COMPOSITE_H
  31. /* CC-A component coefficients from ISO/IEC 24728:2006 Annex F */
  32. static const unsigned short cc_aCoeffs[30] = {
  33. /* k = 4 */
  34. 522, 568, 723, 809,
  35. /* k = 5 */
  36. 427, 919, 460, 155, 566,
  37. /* k = 6 */
  38. 861, 285, 19, 803, 17, 766,
  39. /* k = 7 */
  40. 76, 925, 537, 597, 784, 691, 437,
  41. /* k = 8 */
  42. 237, 308, 436, 284, 646, 653, 428, 379
  43. };
  44. /* rows, error codewords, k-offset of valid CC-A sizes from ISO/IEC 24723:2006 Table 9 */
  45. static const char cc_aVariants[51] = {
  46. 5, 6, 7, 8, 9, 10, 12, 4, 5, 6, 7, 8, 3, 4, 5, 6, 7,
  47. 4, 4, 5, 5, 6, 6, 7, 4, 5, 6, 7, 7, 4, 5, 6, 7, 8,
  48. 0, 0, 4, 4, 9, 9, 15, 0, 4, 9, 15, 15, 0, 4, 9, 15, 22
  49. };
  50. /* following is Left RAP, Centre RAP, Right RAP and Start Cluster from ISO/IEC 24723:2006 tables 10 and 11 */
  51. static const char cc_aRAPTable[68] = {
  52. 39, 1, 32, 8, 14, 43, 20, 11, 1, 5, 15, 21, 40, 43, 46, 34, 29,
  53. 0, 0, 0, 0, 0, 0, 0, 43, 33, 37, 47, 1, 20, 23, 26, 14, 9,
  54. 19, 33, 12, 40, 46, 23, 52, 23, 13, 17, 27, 33, 52, 3, 6, 46, 41,
  55. 6, 0, 3, 3, 3, 0, 3, 3, 0, 3, 6, 6, 0, 0, 0, 0, 3
  56. };
  57. /* Row Address Patterns are as defined in pdf417.h */
  58. /* Generated by tools/gen_pwr928_table.php */
  59. static const unsigned short cc_pwr928[69][7] = {
  60. { 0, 0, 0, 0, 0, 0, 1, },
  61. { 0, 0, 0, 0, 0, 0, 2, },
  62. { 0, 0, 0, 0, 0, 0, 4, },
  63. { 0, 0, 0, 0, 0, 0, 8, },
  64. { 0, 0, 0, 0, 0, 0, 16, },
  65. { 0, 0, 0, 0, 0, 0, 32, },
  66. { 0, 0, 0, 0, 0, 0, 64, },
  67. { 0, 0, 0, 0, 0, 0, 128, },
  68. { 0, 0, 0, 0, 0, 0, 256, },
  69. { 0, 0, 0, 0, 0, 0, 512, },
  70. { 0, 0, 0, 0, 0, 1, 96, },
  71. { 0, 0, 0, 0, 0, 2, 192, },
  72. { 0, 0, 0, 0, 0, 4, 384, },
  73. { 0, 0, 0, 0, 0, 8, 768, },
  74. { 0, 0, 0, 0, 0, 17, 608, },
  75. { 0, 0, 0, 0, 0, 35, 288, },
  76. { 0, 0, 0, 0, 0, 70, 576, },
  77. { 0, 0, 0, 0, 0, 141, 224, },
  78. { 0, 0, 0, 0, 0, 282, 448, },
  79. { 0, 0, 0, 0, 0, 564, 896, },
  80. { 0, 0, 0, 0, 1, 201, 864, },
  81. { 0, 0, 0, 0, 2, 403, 800, },
  82. { 0, 0, 0, 0, 4, 807, 672, },
  83. { 0, 0, 0, 0, 9, 687, 416, },
  84. { 0, 0, 0, 0, 19, 446, 832, },
  85. { 0, 0, 0, 0, 38, 893, 736, },
  86. { 0, 0, 0, 0, 77, 859, 544, },
  87. { 0, 0, 0, 0, 155, 791, 160, },
  88. { 0, 0, 0, 0, 311, 654, 320, },
  89. { 0, 0, 0, 0, 623, 380, 640, },
  90. { 0, 0, 0, 1, 318, 761, 352, },
  91. { 0, 0, 0, 2, 637, 594, 704, },
  92. { 0, 0, 0, 5, 347, 261, 480, },
  93. { 0, 0, 0, 10, 694, 523, 32, },
  94. { 0, 0, 0, 21, 461, 118, 64, },
  95. { 0, 0, 0, 42, 922, 236, 128, },
  96. { 0, 0, 0, 85, 916, 472, 256, },
  97. { 0, 0, 0, 171, 905, 16, 512, },
  98. { 0, 0, 0, 343, 882, 33, 96, },
  99. { 0, 0, 0, 687, 836, 66, 192, },
  100. { 0, 0, 1, 447, 744, 132, 384, },
  101. { 0, 0, 2, 895, 560, 264, 768, },
  102. { 0, 0, 5, 863, 192, 529, 608, },
  103. { 0, 0, 11, 798, 385, 131, 288, },
  104. { 0, 0, 23, 668, 770, 262, 576, },
  105. { 0, 0, 47, 409, 612, 525, 224, },
  106. { 0, 0, 94, 819, 297, 122, 448, },
  107. { 0, 0, 189, 710, 594, 244, 896, },
  108. { 0, 0, 379, 493, 260, 489, 864, },
  109. { 0, 0, 759, 58, 521, 51, 800, },
  110. { 0, 1, 590, 117, 114, 103, 672, },
  111. { 0, 3, 252, 234, 228, 207, 416, },
  112. { 0, 6, 504, 468, 456, 414, 832, },
  113. { 0, 13, 81, 8, 912, 829, 736, },
  114. { 0, 26, 162, 17, 897, 731, 544, },
  115. { 0, 52, 324, 35, 867, 535, 160, },
  116. { 0, 104, 648, 71, 807, 142, 320, },
  117. { 0, 209, 368, 143, 686, 284, 640, },
  118. { 0, 418, 736, 287, 444, 569, 352, },
  119. { 0, 837, 544, 574, 889, 210, 704, },
  120. { 1, 747, 161, 221, 850, 421, 480, },
  121. { 3, 566, 322, 443, 772, 843, 32, },
  122. { 7, 204, 644, 887, 617, 758, 64, },
  123. { 14, 409, 361, 847, 307, 588, 128, },
  124. { 28, 818, 723, 766, 615, 248, 256, },
  125. { 57, 709, 519, 605, 302, 496, 512, },
  126. { 115, 491, 111, 282, 605, 65, 96, },
  127. { 231, 54, 222, 565, 282, 130, 192, },
  128. { 462, 108, 445, 202, 564, 260, 384, },
  129. };
  130. /* vim: set ts=4 sw=4 et : */
  131. #endif /* Z_COMPOSITE_H */