image_pack 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (319) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +18 -0
  3. data/LICENSE.txt +21 -0
  4. data/README.md +140 -0
  5. data/THIRD_PARTY_NOTICES.md +8 -0
  6. data/ext/image_pack/extconf.rb +515 -0
  7. data/ext/image_pack/image_pack.c +1618 -0
  8. data/ext/image_pack/vendor/.vendored +1 -0
  9. data/ext/image_pack/vendor/mozjpeg/BUILDING.txt +902 -0
  10. data/ext/image_pack/vendor/mozjpeg/CMakeLists.txt +1593 -0
  11. data/ext/image_pack/vendor/mozjpeg/LICENSE.md +132 -0
  12. data/ext/image_pack/vendor/mozjpeg/README-mozilla.txt +194 -0
  13. data/ext/image_pack/vendor/mozjpeg/README-turbo.txt +346 -0
  14. data/ext/image_pack/vendor/mozjpeg/README.ijg +258 -0
  15. data/ext/image_pack/vendor/mozjpeg/README.md +29 -0
  16. data/ext/image_pack/vendor/mozjpeg/cderror.h +128 -0
  17. data/ext/image_pack/vendor/mozjpeg/cdjpeg.c +156 -0
  18. data/ext/image_pack/vendor/mozjpeg/cdjpeg.h +171 -0
  19. data/ext/image_pack/vendor/mozjpeg/cjpeg.c +961 -0
  20. data/ext/image_pack/vendor/mozjpeg/cmyk.h +60 -0
  21. data/ext/image_pack/vendor/mozjpeg/coderules.txt +78 -0
  22. data/ext/image_pack/vendor/mozjpeg/croptest.in +95 -0
  23. data/ext/image_pack/vendor/mozjpeg/djpeg.c +855 -0
  24. data/ext/image_pack/vendor/mozjpeg/example.txt +464 -0
  25. data/ext/image_pack/vendor/mozjpeg/jaricom.c +157 -0
  26. data/ext/image_pack/vendor/mozjpeg/jcapimin.c +307 -0
  27. data/ext/image_pack/vendor/mozjpeg/jcapistd.c +168 -0
  28. data/ext/image_pack/vendor/mozjpeg/jcarith.c +972 -0
  29. data/ext/image_pack/vendor/mozjpeg/jccoefct.c +609 -0
  30. data/ext/image_pack/vendor/mozjpeg/jccolext.c +144 -0
  31. data/ext/image_pack/vendor/mozjpeg/jccolor.c +721 -0
  32. data/ext/image_pack/vendor/mozjpeg/jcdctmgr.c +1776 -0
  33. data/ext/image_pack/vendor/mozjpeg/jcext.c +219 -0
  34. data/ext/image_pack/vendor/mozjpeg/jchuff.c +1146 -0
  35. data/ext/image_pack/vendor/mozjpeg/jchuff.h +57 -0
  36. data/ext/image_pack/vendor/mozjpeg/jcicc.c +105 -0
  37. data/ext/image_pack/vendor/mozjpeg/jcinit.c +82 -0
  38. data/ext/image_pack/vendor/mozjpeg/jcmainct.c +162 -0
  39. data/ext/image_pack/vendor/mozjpeg/jcmarker.c +844 -0
  40. data/ext/image_pack/vendor/mozjpeg/jcmaster.c +958 -0
  41. data/ext/image_pack/vendor/mozjpeg/jcmaster.h +56 -0
  42. data/ext/image_pack/vendor/mozjpeg/jcomapi.c +109 -0
  43. data/ext/image_pack/vendor/mozjpeg/jconfig.h.in +37 -0
  44. data/ext/image_pack/vendor/mozjpeg/jconfig.txt +93 -0
  45. data/ext/image_pack/vendor/mozjpeg/jconfigint.h.in +44 -0
  46. data/ext/image_pack/vendor/mozjpeg/jcparam.c +991 -0
  47. data/ext/image_pack/vendor/mozjpeg/jcphuff.c +1123 -0
  48. data/ext/image_pack/vendor/mozjpeg/jcprepct.c +351 -0
  49. data/ext/image_pack/vendor/mozjpeg/jcsample.c +522 -0
  50. data/ext/image_pack/vendor/mozjpeg/jcstest.c +126 -0
  51. data/ext/image_pack/vendor/mozjpeg/jctrans.c +408 -0
  52. data/ext/image_pack/vendor/mozjpeg/jdapimin.c +407 -0
  53. data/ext/image_pack/vendor/mozjpeg/jdapistd.c +691 -0
  54. data/ext/image_pack/vendor/mozjpeg/jdarith.c +782 -0
  55. data/ext/image_pack/vendor/mozjpeg/jdatadst-tj.c +198 -0
  56. data/ext/image_pack/vendor/mozjpeg/jdatadst.c +299 -0
  57. data/ext/image_pack/vendor/mozjpeg/jdatasrc-tj.c +194 -0
  58. data/ext/image_pack/vendor/mozjpeg/jdatasrc.c +295 -0
  59. data/ext/image_pack/vendor/mozjpeg/jdcoefct.c +881 -0
  60. data/ext/image_pack/vendor/mozjpeg/jdcoefct.h +83 -0
  61. data/ext/image_pack/vendor/mozjpeg/jdcol565.c +384 -0
  62. data/ext/image_pack/vendor/mozjpeg/jdcolext.c +141 -0
  63. data/ext/image_pack/vendor/mozjpeg/jdcolor.c +881 -0
  64. data/ext/image_pack/vendor/mozjpeg/jdct.h +208 -0
  65. data/ext/image_pack/vendor/mozjpeg/jddctmgr.c +367 -0
  66. data/ext/image_pack/vendor/mozjpeg/jdhuff.c +834 -0
  67. data/ext/image_pack/vendor/mozjpeg/jdhuff.h +247 -0
  68. data/ext/image_pack/vendor/mozjpeg/jdicc.c +167 -0
  69. data/ext/image_pack/vendor/mozjpeg/jdinput.c +408 -0
  70. data/ext/image_pack/vendor/mozjpeg/jdmainct.c +460 -0
  71. data/ext/image_pack/vendor/mozjpeg/jdmainct.h +71 -0
  72. data/ext/image_pack/vendor/mozjpeg/jdmarker.c +1374 -0
  73. data/ext/image_pack/vendor/mozjpeg/jdmaster.c +727 -0
  74. data/ext/image_pack/vendor/mozjpeg/jdmaster.h +33 -0
  75. data/ext/image_pack/vendor/mozjpeg/jdmerge.c +587 -0
  76. data/ext/image_pack/vendor/mozjpeg/jdmerge.h +47 -0
  77. data/ext/image_pack/vendor/mozjpeg/jdmrg565.c +354 -0
  78. data/ext/image_pack/vendor/mozjpeg/jdmrgext.c +184 -0
  79. data/ext/image_pack/vendor/mozjpeg/jdphuff.c +679 -0
  80. data/ext/image_pack/vendor/mozjpeg/jdpostct.c +294 -0
  81. data/ext/image_pack/vendor/mozjpeg/jdsample.c +524 -0
  82. data/ext/image_pack/vendor/mozjpeg/jdsample.h +50 -0
  83. data/ext/image_pack/vendor/mozjpeg/jdtrans.c +156 -0
  84. data/ext/image_pack/vendor/mozjpeg/jerror.c +251 -0
  85. data/ext/image_pack/vendor/mozjpeg/jerror.h +335 -0
  86. data/ext/image_pack/vendor/mozjpeg/jfdctflt.c +169 -0
  87. data/ext/image_pack/vendor/mozjpeg/jfdctfst.c +227 -0
  88. data/ext/image_pack/vendor/mozjpeg/jfdctint.c +288 -0
  89. data/ext/image_pack/vendor/mozjpeg/jidctflt.c +240 -0
  90. data/ext/image_pack/vendor/mozjpeg/jidctfst.c +371 -0
  91. data/ext/image_pack/vendor/mozjpeg/jidctint.c +2627 -0
  92. data/ext/image_pack/vendor/mozjpeg/jidctred.c +409 -0
  93. data/ext/image_pack/vendor/mozjpeg/jinclude.h +147 -0
  94. data/ext/image_pack/vendor/mozjpeg/jmemmgr.c +1180 -0
  95. data/ext/image_pack/vendor/mozjpeg/jmemnobs.c +110 -0
  96. data/ext/image_pack/vendor/mozjpeg/jmemsys.h +178 -0
  97. data/ext/image_pack/vendor/mozjpeg/jmorecfg.h +382 -0
  98. data/ext/image_pack/vendor/mozjpeg/jpeg_nbits_table.h +4098 -0
  99. data/ext/image_pack/vendor/mozjpeg/jpegcomp.h +32 -0
  100. data/ext/image_pack/vendor/mozjpeg/jpegint.h +453 -0
  101. data/ext/image_pack/vendor/mozjpeg/jpeglib.h +1211 -0
  102. data/ext/image_pack/vendor/mozjpeg/jpegtran.c +827 -0
  103. data/ext/image_pack/vendor/mozjpeg/jpegyuv.c +172 -0
  104. data/ext/image_pack/vendor/mozjpeg/jquant1.c +856 -0
  105. data/ext/image_pack/vendor/mozjpeg/jquant2.c +1286 -0
  106. data/ext/image_pack/vendor/mozjpeg/jsimd.h +123 -0
  107. data/ext/image_pack/vendor/mozjpeg/jsimd_none.c +431 -0
  108. data/ext/image_pack/vendor/mozjpeg/jsimddct.h +70 -0
  109. data/ext/image_pack/vendor/mozjpeg/jstdhuff.c +144 -0
  110. data/ext/image_pack/vendor/mozjpeg/jutils.c +133 -0
  111. data/ext/image_pack/vendor/mozjpeg/jversion.h.in +56 -0
  112. data/ext/image_pack/vendor/mozjpeg/libjpeg.map.in +11 -0
  113. data/ext/image_pack/vendor/mozjpeg/libjpeg.txt +3150 -0
  114. data/ext/image_pack/vendor/mozjpeg/rdbmp.c +690 -0
  115. data/ext/image_pack/vendor/mozjpeg/rdcolmap.c +253 -0
  116. data/ext/image_pack/vendor/mozjpeg/rdgif.c +720 -0
  117. data/ext/image_pack/vendor/mozjpeg/rdjpeg.c +160 -0
  118. data/ext/image_pack/vendor/mozjpeg/rdjpgcom.c +494 -0
  119. data/ext/image_pack/vendor/mozjpeg/rdpng.c +194 -0
  120. data/ext/image_pack/vendor/mozjpeg/rdppm.c +781 -0
  121. data/ext/image_pack/vendor/mozjpeg/rdswitch.c +642 -0
  122. data/ext/image_pack/vendor/mozjpeg/rdtarga.c +508 -0
  123. data/ext/image_pack/vendor/mozjpeg/simd/arm/aarch32/jccolext-neon.c +148 -0
  124. data/ext/image_pack/vendor/mozjpeg/simd/arm/aarch32/jchuff-neon.c +334 -0
  125. data/ext/image_pack/vendor/mozjpeg/simd/arm/aarch32/jsimd.c +976 -0
  126. data/ext/image_pack/vendor/mozjpeg/simd/arm/aarch32/jsimd_neon.S +1200 -0
  127. data/ext/image_pack/vendor/mozjpeg/simd/arm/aarch64/jccolext-neon.c +316 -0
  128. data/ext/image_pack/vendor/mozjpeg/simd/arm/aarch64/jchuff-neon.c +411 -0
  129. data/ext/image_pack/vendor/mozjpeg/simd/arm/aarch64/jsimd.c +1053 -0
  130. data/ext/image_pack/vendor/mozjpeg/simd/arm/aarch64/jsimd_neon.S +2254 -0
  131. data/ext/image_pack/vendor/mozjpeg/simd/arm/align.h +28 -0
  132. data/ext/image_pack/vendor/mozjpeg/simd/arm/jccolor-neon.c +160 -0
  133. data/ext/image_pack/vendor/mozjpeg/simd/arm/jcgray-neon.c +120 -0
  134. data/ext/image_pack/vendor/mozjpeg/simd/arm/jcgryext-neon.c +106 -0
  135. data/ext/image_pack/vendor/mozjpeg/simd/arm/jchuff.h +131 -0
  136. data/ext/image_pack/vendor/mozjpeg/simd/arm/jcphuff-neon.c +623 -0
  137. data/ext/image_pack/vendor/mozjpeg/simd/arm/jcsample-neon.c +192 -0
  138. data/ext/image_pack/vendor/mozjpeg/simd/arm/jdcolext-neon.c +374 -0
  139. data/ext/image_pack/vendor/mozjpeg/simd/arm/jdcolor-neon.c +141 -0
  140. data/ext/image_pack/vendor/mozjpeg/simd/arm/jdmerge-neon.c +144 -0
  141. data/ext/image_pack/vendor/mozjpeg/simd/arm/jdmrgext-neon.c +723 -0
  142. data/ext/image_pack/vendor/mozjpeg/simd/arm/jdsample-neon.c +569 -0
  143. data/ext/image_pack/vendor/mozjpeg/simd/arm/jfdctfst-neon.c +214 -0
  144. data/ext/image_pack/vendor/mozjpeg/simd/arm/jfdctint-neon.c +376 -0
  145. data/ext/image_pack/vendor/mozjpeg/simd/arm/jidctfst-neon.c +472 -0
  146. data/ext/image_pack/vendor/mozjpeg/simd/arm/jidctint-neon.c +801 -0
  147. data/ext/image_pack/vendor/mozjpeg/simd/arm/jidctred-neon.c +486 -0
  148. data/ext/image_pack/vendor/mozjpeg/simd/arm/jquanti-neon.c +193 -0
  149. data/ext/image_pack/vendor/mozjpeg/simd/arm/neon-compat.h +26 -0
  150. data/ext/image_pack/vendor/mozjpeg/simd/arm/neon-compat.h.in +37 -0
  151. data/ext/image_pack/vendor/mozjpeg/simd/i386/jccolext-avx2.asm +578 -0
  152. data/ext/image_pack/vendor/mozjpeg/simd/i386/jccolext-mmx.asm +476 -0
  153. data/ext/image_pack/vendor/mozjpeg/simd/i386/jccolext-sse2.asm +503 -0
  154. data/ext/image_pack/vendor/mozjpeg/simd/i386/jccolor-avx2.asm +121 -0
  155. data/ext/image_pack/vendor/mozjpeg/simd/i386/jccolor-mmx.asm +121 -0
  156. data/ext/image_pack/vendor/mozjpeg/simd/i386/jccolor-sse2.asm +120 -0
  157. data/ext/image_pack/vendor/mozjpeg/simd/i386/jcgray-avx2.asm +113 -0
  158. data/ext/image_pack/vendor/mozjpeg/simd/i386/jcgray-mmx.asm +113 -0
  159. data/ext/image_pack/vendor/mozjpeg/simd/i386/jcgray-sse2.asm +112 -0
  160. data/ext/image_pack/vendor/mozjpeg/simd/i386/jcgryext-avx2.asm +457 -0
  161. data/ext/image_pack/vendor/mozjpeg/simd/i386/jcgryext-mmx.asm +355 -0
  162. data/ext/image_pack/vendor/mozjpeg/simd/i386/jcgryext-sse2.asm +382 -0
  163. data/ext/image_pack/vendor/mozjpeg/simd/i386/jchuff-sse2.asm +761 -0
  164. data/ext/image_pack/vendor/mozjpeg/simd/i386/jcphuff-sse2.asm +662 -0
  165. data/ext/image_pack/vendor/mozjpeg/simd/i386/jcsample-avx2.asm +388 -0
  166. data/ext/image_pack/vendor/mozjpeg/simd/i386/jcsample-mmx.asm +324 -0
  167. data/ext/image_pack/vendor/mozjpeg/simd/i386/jcsample-sse2.asm +351 -0
  168. data/ext/image_pack/vendor/mozjpeg/simd/i386/jdcolext-avx2.asm +515 -0
  169. data/ext/image_pack/vendor/mozjpeg/simd/i386/jdcolext-mmx.asm +404 -0
  170. data/ext/image_pack/vendor/mozjpeg/simd/i386/jdcolext-sse2.asm +458 -0
  171. data/ext/image_pack/vendor/mozjpeg/simd/i386/jdcolor-avx2.asm +118 -0
  172. data/ext/image_pack/vendor/mozjpeg/simd/i386/jdcolor-mmx.asm +117 -0
  173. data/ext/image_pack/vendor/mozjpeg/simd/i386/jdcolor-sse2.asm +117 -0
  174. data/ext/image_pack/vendor/mozjpeg/simd/i386/jdmerge-avx2.asm +136 -0
  175. data/ext/image_pack/vendor/mozjpeg/simd/i386/jdmerge-mmx.asm +123 -0
  176. data/ext/image_pack/vendor/mozjpeg/simd/i386/jdmerge-sse2.asm +135 -0
  177. data/ext/image_pack/vendor/mozjpeg/simd/i386/jdmrgext-avx2.asm +575 -0
  178. data/ext/image_pack/vendor/mozjpeg/simd/i386/jdmrgext-mmx.asm +460 -0
  179. data/ext/image_pack/vendor/mozjpeg/simd/i386/jdmrgext-sse2.asm +517 -0
  180. data/ext/image_pack/vendor/mozjpeg/simd/i386/jdsample-avx2.asm +760 -0
  181. data/ext/image_pack/vendor/mozjpeg/simd/i386/jdsample-mmx.asm +731 -0
  182. data/ext/image_pack/vendor/mozjpeg/simd/i386/jdsample-sse2.asm +724 -0
  183. data/ext/image_pack/vendor/mozjpeg/simd/i386/jfdctflt-3dn.asm +318 -0
  184. data/ext/image_pack/vendor/mozjpeg/simd/i386/jfdctflt-sse.asm +369 -0
  185. data/ext/image_pack/vendor/mozjpeg/simd/i386/jfdctfst-mmx.asm +395 -0
  186. data/ext/image_pack/vendor/mozjpeg/simd/i386/jfdctfst-sse2.asm +403 -0
  187. data/ext/image_pack/vendor/mozjpeg/simd/i386/jfdctint-avx2.asm +331 -0
  188. data/ext/image_pack/vendor/mozjpeg/simd/i386/jfdctint-mmx.asm +620 -0
  189. data/ext/image_pack/vendor/mozjpeg/simd/i386/jfdctint-sse2.asm +633 -0
  190. data/ext/image_pack/vendor/mozjpeg/simd/i386/jidctflt-3dn.asm +451 -0
  191. data/ext/image_pack/vendor/mozjpeg/simd/i386/jidctflt-sse.asm +571 -0
  192. data/ext/image_pack/vendor/mozjpeg/simd/i386/jidctflt-sse2.asm +497 -0
  193. data/ext/image_pack/vendor/mozjpeg/simd/i386/jidctfst-mmx.asm +499 -0
  194. data/ext/image_pack/vendor/mozjpeg/simd/i386/jidctfst-sse2.asm +501 -0
  195. data/ext/image_pack/vendor/mozjpeg/simd/i386/jidctint-avx2.asm +453 -0
  196. data/ext/image_pack/vendor/mozjpeg/simd/i386/jidctint-mmx.asm +851 -0
  197. data/ext/image_pack/vendor/mozjpeg/simd/i386/jidctint-sse2.asm +858 -0
  198. data/ext/image_pack/vendor/mozjpeg/simd/i386/jidctred-mmx.asm +704 -0
  199. data/ext/image_pack/vendor/mozjpeg/simd/i386/jidctred-sse2.asm +592 -0
  200. data/ext/image_pack/vendor/mozjpeg/simd/i386/jquant-3dn.asm +230 -0
  201. data/ext/image_pack/vendor/mozjpeg/simd/i386/jquant-mmx.asm +276 -0
  202. data/ext/image_pack/vendor/mozjpeg/simd/i386/jquant-sse.asm +208 -0
  203. data/ext/image_pack/vendor/mozjpeg/simd/i386/jquantf-sse2.asm +168 -0
  204. data/ext/image_pack/vendor/mozjpeg/simd/i386/jquanti-avx2.asm +188 -0
  205. data/ext/image_pack/vendor/mozjpeg/simd/i386/jquanti-sse2.asm +201 -0
  206. data/ext/image_pack/vendor/mozjpeg/simd/i386/jsimd.c +1312 -0
  207. data/ext/image_pack/vendor/mozjpeg/simd/i386/jsimdcpu.asm +135 -0
  208. data/ext/image_pack/vendor/mozjpeg/simd/jsimd.h +1258 -0
  209. data/ext/image_pack/vendor/mozjpeg/simd/mips/jsimd.c +1143 -0
  210. data/ext/image_pack/vendor/mozjpeg/simd/mips/jsimd_dspr2.S +4543 -0
  211. data/ext/image_pack/vendor/mozjpeg/simd/mips/jsimd_dspr2_asm.h +292 -0
  212. data/ext/image_pack/vendor/mozjpeg/simd/mips64/jccolext-mmi.c +455 -0
  213. data/ext/image_pack/vendor/mozjpeg/simd/mips64/jccolor-mmi.c +148 -0
  214. data/ext/image_pack/vendor/mozjpeg/simd/mips64/jcgray-mmi.c +132 -0
  215. data/ext/image_pack/vendor/mozjpeg/simd/mips64/jcgryext-mmi.c +374 -0
  216. data/ext/image_pack/vendor/mozjpeg/simd/mips64/jcsample-mmi.c +98 -0
  217. data/ext/image_pack/vendor/mozjpeg/simd/mips64/jcsample.h +28 -0
  218. data/ext/image_pack/vendor/mozjpeg/simd/mips64/jdcolext-mmi.c +415 -0
  219. data/ext/image_pack/vendor/mozjpeg/simd/mips64/jdcolor-mmi.c +139 -0
  220. data/ext/image_pack/vendor/mozjpeg/simd/mips64/jdmerge-mmi.c +149 -0
  221. data/ext/image_pack/vendor/mozjpeg/simd/mips64/jdmrgext-mmi.c +615 -0
  222. data/ext/image_pack/vendor/mozjpeg/simd/mips64/jdsample-mmi.c +304 -0
  223. data/ext/image_pack/vendor/mozjpeg/simd/mips64/jfdctfst-mmi.c +255 -0
  224. data/ext/image_pack/vendor/mozjpeg/simd/mips64/jfdctint-mmi.c +398 -0
  225. data/ext/image_pack/vendor/mozjpeg/simd/mips64/jidctfst-mmi.c +395 -0
  226. data/ext/image_pack/vendor/mozjpeg/simd/mips64/jidctint-mmi.c +571 -0
  227. data/ext/image_pack/vendor/mozjpeg/simd/mips64/jquanti-mmi.c +124 -0
  228. data/ext/image_pack/vendor/mozjpeg/simd/mips64/jsimd.c +866 -0
  229. data/ext/image_pack/vendor/mozjpeg/simd/mips64/jsimd_mmi.h +69 -0
  230. data/ext/image_pack/vendor/mozjpeg/simd/mips64/loongson-mmintrin.h +1334 -0
  231. data/ext/image_pack/vendor/mozjpeg/simd/nasm/jcolsamp.inc +135 -0
  232. data/ext/image_pack/vendor/mozjpeg/simd/nasm/jdct.inc +31 -0
  233. data/ext/image_pack/vendor/mozjpeg/simd/nasm/jsimdcfg.inc +93 -0
  234. data/ext/image_pack/vendor/mozjpeg/simd/nasm/jsimdcfg.inc.h +133 -0
  235. data/ext/image_pack/vendor/mozjpeg/simd/nasm/jsimdext.inc +520 -0
  236. data/ext/image_pack/vendor/mozjpeg/simd/powerpc/jccolext-altivec.c +269 -0
  237. data/ext/image_pack/vendor/mozjpeg/simd/powerpc/jccolor-altivec.c +116 -0
  238. data/ext/image_pack/vendor/mozjpeg/simd/powerpc/jcgray-altivec.c +111 -0
  239. data/ext/image_pack/vendor/mozjpeg/simd/powerpc/jcgryext-altivec.c +228 -0
  240. data/ext/image_pack/vendor/mozjpeg/simd/powerpc/jcsample-altivec.c +159 -0
  241. data/ext/image_pack/vendor/mozjpeg/simd/powerpc/jcsample.h +28 -0
  242. data/ext/image_pack/vendor/mozjpeg/simd/powerpc/jdcolext-altivec.c +276 -0
  243. data/ext/image_pack/vendor/mozjpeg/simd/powerpc/jdcolor-altivec.c +106 -0
  244. data/ext/image_pack/vendor/mozjpeg/simd/powerpc/jdmerge-altivec.c +130 -0
  245. data/ext/image_pack/vendor/mozjpeg/simd/powerpc/jdmrgext-altivec.c +329 -0
  246. data/ext/image_pack/vendor/mozjpeg/simd/powerpc/jdsample-altivec.c +400 -0
  247. data/ext/image_pack/vendor/mozjpeg/simd/powerpc/jfdctfst-altivec.c +154 -0
  248. data/ext/image_pack/vendor/mozjpeg/simd/powerpc/jfdctint-altivec.c +258 -0
  249. data/ext/image_pack/vendor/mozjpeg/simd/powerpc/jidctfst-altivec.c +255 -0
  250. data/ext/image_pack/vendor/mozjpeg/simd/powerpc/jidctint-altivec.c +357 -0
  251. data/ext/image_pack/vendor/mozjpeg/simd/powerpc/jquanti-altivec.c +250 -0
  252. data/ext/image_pack/vendor/mozjpeg/simd/powerpc/jsimd.c +884 -0
  253. data/ext/image_pack/vendor/mozjpeg/simd/powerpc/jsimd_altivec.h +98 -0
  254. data/ext/image_pack/vendor/mozjpeg/simd/x86_64/jccolext-avx2.asm +559 -0
  255. data/ext/image_pack/vendor/mozjpeg/simd/x86_64/jccolext-sse2.asm +484 -0
  256. data/ext/image_pack/vendor/mozjpeg/simd/x86_64/jccolor-avx2.asm +121 -0
  257. data/ext/image_pack/vendor/mozjpeg/simd/x86_64/jccolor-sse2.asm +120 -0
  258. data/ext/image_pack/vendor/mozjpeg/simd/x86_64/jcgray-avx2.asm +113 -0
  259. data/ext/image_pack/vendor/mozjpeg/simd/x86_64/jcgray-sse2.asm +112 -0
  260. data/ext/image_pack/vendor/mozjpeg/simd/x86_64/jcgryext-avx2.asm +438 -0
  261. data/ext/image_pack/vendor/mozjpeg/simd/x86_64/jcgryext-sse2.asm +363 -0
  262. data/ext/image_pack/vendor/mozjpeg/simd/x86_64/jchuff-sse2.asm +583 -0
  263. data/ext/image_pack/vendor/mozjpeg/simd/x86_64/jcphuff-sse2.asm +639 -0
  264. data/ext/image_pack/vendor/mozjpeg/simd/x86_64/jcsample-avx2.asm +367 -0
  265. data/ext/image_pack/vendor/mozjpeg/simd/x86_64/jcsample-sse2.asm +330 -0
  266. data/ext/image_pack/vendor/mozjpeg/simd/x86_64/jdcolext-avx2.asm +496 -0
  267. data/ext/image_pack/vendor/mozjpeg/simd/x86_64/jdcolext-sse2.asm +439 -0
  268. data/ext/image_pack/vendor/mozjpeg/simd/x86_64/jdcolor-avx2.asm +118 -0
  269. data/ext/image_pack/vendor/mozjpeg/simd/x86_64/jdcolor-sse2.asm +117 -0
  270. data/ext/image_pack/vendor/mozjpeg/simd/x86_64/jdmerge-avx2.asm +136 -0
  271. data/ext/image_pack/vendor/mozjpeg/simd/x86_64/jdmerge-sse2.asm +135 -0
  272. data/ext/image_pack/vendor/mozjpeg/simd/x86_64/jdmrgext-avx2.asm +596 -0
  273. data/ext/image_pack/vendor/mozjpeg/simd/x86_64/jdmrgext-sse2.asm +538 -0
  274. data/ext/image_pack/vendor/mozjpeg/simd/x86_64/jdsample-avx2.asm +696 -0
  275. data/ext/image_pack/vendor/mozjpeg/simd/x86_64/jdsample-sse2.asm +665 -0
  276. data/ext/image_pack/vendor/mozjpeg/simd/x86_64/jfdctflt-sse.asm +355 -0
  277. data/ext/image_pack/vendor/mozjpeg/simd/x86_64/jfdctfst-sse2.asm +389 -0
  278. data/ext/image_pack/vendor/mozjpeg/simd/x86_64/jfdctint-avx2.asm +320 -0
  279. data/ext/image_pack/vendor/mozjpeg/simd/x86_64/jfdctint-sse2.asm +619 -0
  280. data/ext/image_pack/vendor/mozjpeg/simd/x86_64/jidctflt-sse2.asm +482 -0
  281. data/ext/image_pack/vendor/mozjpeg/simd/x86_64/jidctfst-sse2.asm +491 -0
  282. data/ext/image_pack/vendor/mozjpeg/simd/x86_64/jidctint-avx2.asm +418 -0
  283. data/ext/image_pack/vendor/mozjpeg/simd/x86_64/jidctint-sse2.asm +847 -0
  284. data/ext/image_pack/vendor/mozjpeg/simd/x86_64/jidctred-sse2.asm +574 -0
  285. data/ext/image_pack/vendor/mozjpeg/simd/x86_64/jquantf-sse2.asm +155 -0
  286. data/ext/image_pack/vendor/mozjpeg/simd/x86_64/jquanti-avx2.asm +163 -0
  287. data/ext/image_pack/vendor/mozjpeg/simd/x86_64/jquanti-sse2.asm +188 -0
  288. data/ext/image_pack/vendor/mozjpeg/simd/x86_64/jsimd.c +1110 -0
  289. data/ext/image_pack/vendor/mozjpeg/simd/x86_64/jsimdcpu.asm +86 -0
  290. data/ext/image_pack/vendor/mozjpeg/strtest.c +170 -0
  291. data/ext/image_pack/vendor/mozjpeg/structure.txt +900 -0
  292. data/ext/image_pack/vendor/mozjpeg/tjbench.c +1044 -0
  293. data/ext/image_pack/vendor/mozjpeg/tjbenchtest.in +256 -0
  294. data/ext/image_pack/vendor/mozjpeg/tjbenchtest.java.in +215 -0
  295. data/ext/image_pack/vendor/mozjpeg/tjexample.c +406 -0
  296. data/ext/image_pack/vendor/mozjpeg/tjexampletest.in +149 -0
  297. data/ext/image_pack/vendor/mozjpeg/tjexampletest.java.in +151 -0
  298. data/ext/image_pack/vendor/mozjpeg/tjunittest.c +961 -0
  299. data/ext/image_pack/vendor/mozjpeg/tjutil.c +70 -0
  300. data/ext/image_pack/vendor/mozjpeg/tjutil.h +53 -0
  301. data/ext/image_pack/vendor/mozjpeg/transupp.c +2373 -0
  302. data/ext/image_pack/vendor/mozjpeg/transupp.h +243 -0
  303. data/ext/image_pack/vendor/mozjpeg/turbojpeg-jni.c +1259 -0
  304. data/ext/image_pack/vendor/mozjpeg/turbojpeg.c +2320 -0
  305. data/ext/image_pack/vendor/mozjpeg/turbojpeg.h +1784 -0
  306. data/ext/image_pack/vendor/mozjpeg/usage.txt +679 -0
  307. data/ext/image_pack/vendor/mozjpeg/wizard.txt +220 -0
  308. data/ext/image_pack/vendor/mozjpeg/wrbmp.c +552 -0
  309. data/ext/image_pack/vendor/mozjpeg/wrgif.c +580 -0
  310. data/ext/image_pack/vendor/mozjpeg/wrjpgcom.c +577 -0
  311. data/ext/image_pack/vendor/mozjpeg/wrppm.c +366 -0
  312. data/ext/image_pack/vendor/mozjpeg/wrtarga.c +258 -0
  313. data/ext/image_pack/vendor/mozjpeg/yuvjpeg.c +268 -0
  314. data/lib/image_pack/backend.rb +8 -0
  315. data/lib/image_pack/configuration.rb +23 -0
  316. data/lib/image_pack/errors.rb +13 -0
  317. data/lib/image_pack/version.rb +5 -0
  318. data/lib/image_pack.rb +208 -0
  319. metadata +433 -0
@@ -0,0 +1,247 @@
1
+ /*
2
+ * jdhuff.h
3
+ *
4
+ * This file was part of the Independent JPEG Group's software:
5
+ * Copyright (C) 1991-1997, Thomas G. Lane.
6
+ * libjpeg-turbo Modifications:
7
+ * Copyright (C) 2010-2011, 2015-2016, 2021, D. R. Commander.
8
+ * Copyright (C) 2018, Matthias Räncker.
9
+ * For conditions of distribution and use, see the accompanying README.ijg
10
+ * file.
11
+ *
12
+ * This file contains declarations for Huffman entropy decoding routines
13
+ * that are shared between the sequential decoder (jdhuff.c) and the
14
+ * progressive decoder (jdphuff.c). No other modules need to see these.
15
+ */
16
+
17
+ #include "jconfigint.h"
18
+
19
+
20
+ /* Derived data constructed for each Huffman table */
21
+
22
+ #define HUFF_LOOKAHEAD 8 /* # of bits of lookahead */
23
+
24
+ typedef struct {
25
+ /* Basic tables: (element [0] of each array is unused) */
26
+ JLONG maxcode[18]; /* largest code of length k (-1 if none) */
27
+ /* (maxcode[17] is a sentinel to ensure jpeg_huff_decode terminates) */
28
+ JLONG valoffset[18]; /* huffval[] offset for codes of length k */
29
+ /* valoffset[k] = huffval[] index of 1st symbol of code length k, less
30
+ * the smallest code of length k; so given a code of length k, the
31
+ * corresponding symbol is huffval[code + valoffset[k]]
32
+ */
33
+
34
+ /* Link to public Huffman table (needed only in jpeg_huff_decode) */
35
+ JHUFF_TBL *pub;
36
+
37
+ /* Lookahead table: indexed by the next HUFF_LOOKAHEAD bits of
38
+ * the input data stream. If the next Huffman code is no more
39
+ * than HUFF_LOOKAHEAD bits long, we can obtain its length and
40
+ * the corresponding symbol directly from this tables.
41
+ *
42
+ * The lower 8 bits of each table entry contain the number of
43
+ * bits in the corresponding Huffman code, or HUFF_LOOKAHEAD + 1
44
+ * if too long. The next 8 bits of each entry contain the
45
+ * symbol.
46
+ */
47
+ int lookup[1 << HUFF_LOOKAHEAD];
48
+ } d_derived_tbl;
49
+
50
+ /* Expand a Huffman table definition into the derived format */
51
+ EXTERN(void) jpeg_make_d_derived_tbl(j_decompress_ptr cinfo, boolean isDC,
52
+ int tblno, d_derived_tbl **pdtbl);
53
+
54
+
55
+ /*
56
+ * Fetching the next N bits from the input stream is a time-critical operation
57
+ * for the Huffman decoders. We implement it with a combination of inline
58
+ * macros and out-of-line subroutines. Note that N (the number of bits
59
+ * demanded at one time) never exceeds 15 for JPEG use.
60
+ *
61
+ * We read source bytes into get_buffer and dole out bits as needed.
62
+ * If get_buffer already contains enough bits, they are fetched in-line
63
+ * by the macros CHECK_BIT_BUFFER and GET_BITS. When there aren't enough
64
+ * bits, jpeg_fill_bit_buffer is called; it will attempt to fill get_buffer
65
+ * as full as possible (not just to the number of bits needed; this
66
+ * prefetching reduces the overhead cost of calling jpeg_fill_bit_buffer).
67
+ * Note that jpeg_fill_bit_buffer may return FALSE to indicate suspension.
68
+ * On TRUE return, jpeg_fill_bit_buffer guarantees that get_buffer contains
69
+ * at least the requested number of bits --- dummy zeroes are inserted if
70
+ * necessary.
71
+ */
72
+
73
+ #if !defined(_WIN32) && !defined(SIZEOF_SIZE_T)
74
+ #error Cannot determine word size
75
+ #endif
76
+
77
+ #if SIZEOF_SIZE_T == 8 || defined(_WIN64)
78
+
79
+ typedef size_t bit_buf_type; /* type of bit-extraction buffer */
80
+ #define BIT_BUF_SIZE 64 /* size of buffer in bits */
81
+
82
+ #elif defined(__x86_64__) && defined(__ILP32__)
83
+
84
+ typedef unsigned long long bit_buf_type; /* type of bit-extraction buffer */
85
+ #define BIT_BUF_SIZE 64 /* size of buffer in bits */
86
+
87
+ #else
88
+
89
+ typedef unsigned long bit_buf_type; /* type of bit-extraction buffer */
90
+ #define BIT_BUF_SIZE 32 /* size of buffer in bits */
91
+
92
+ #endif
93
+
94
+ /* If long is > 32 bits on your machine, and shifting/masking longs is
95
+ * reasonably fast, making bit_buf_type be long and setting BIT_BUF_SIZE
96
+ * appropriately should be a win. Unfortunately we can't define the size
97
+ * with something like #define BIT_BUF_SIZE (sizeof(bit_buf_type)*8)
98
+ * because not all machines measure sizeof in 8-bit bytes.
99
+ */
100
+
101
+ typedef struct { /* Bitreading state saved across MCUs */
102
+ bit_buf_type get_buffer; /* current bit-extraction buffer */
103
+ int bits_left; /* # of unused bits in it */
104
+ } bitread_perm_state;
105
+
106
+ typedef struct { /* Bitreading working state within an MCU */
107
+ /* Current data source location */
108
+ /* We need a copy, rather than munging the original, in case of suspension */
109
+ const JOCTET *next_input_byte; /* => next byte to read from source */
110
+ size_t bytes_in_buffer; /* # of bytes remaining in source buffer */
111
+ /* Bit input buffer --- note these values are kept in register variables,
112
+ * not in this struct, inside the inner loops.
113
+ */
114
+ bit_buf_type get_buffer; /* current bit-extraction buffer */
115
+ int bits_left; /* # of unused bits in it */
116
+ /* Pointer needed by jpeg_fill_bit_buffer. */
117
+ j_decompress_ptr cinfo; /* back link to decompress master record */
118
+ } bitread_working_state;
119
+
120
+ /* Macros to declare and load/save bitread local variables. */
121
+ #define BITREAD_STATE_VARS \
122
+ register bit_buf_type get_buffer; \
123
+ register int bits_left; \
124
+ bitread_working_state br_state
125
+
126
+ #define BITREAD_LOAD_STATE(cinfop, permstate) \
127
+ br_state.cinfo = cinfop; \
128
+ br_state.next_input_byte = cinfop->src->next_input_byte; \
129
+ br_state.bytes_in_buffer = cinfop->src->bytes_in_buffer; \
130
+ get_buffer = permstate.get_buffer; \
131
+ bits_left = permstate.bits_left;
132
+
133
+ #define BITREAD_SAVE_STATE(cinfop, permstate) \
134
+ cinfop->src->next_input_byte = br_state.next_input_byte; \
135
+ cinfop->src->bytes_in_buffer = br_state.bytes_in_buffer; \
136
+ permstate.get_buffer = get_buffer; \
137
+ permstate.bits_left = bits_left
138
+
139
+ /*
140
+ * These macros provide the in-line portion of bit fetching.
141
+ * Use CHECK_BIT_BUFFER to ensure there are N bits in get_buffer
142
+ * before using GET_BITS, PEEK_BITS, or DROP_BITS.
143
+ * The variables get_buffer and bits_left are assumed to be locals,
144
+ * but the state struct might not be (jpeg_huff_decode needs this).
145
+ * CHECK_BIT_BUFFER(state, n, action);
146
+ * Ensure there are N bits in get_buffer; if suspend, take action.
147
+ * val = GET_BITS(n);
148
+ * Fetch next N bits.
149
+ * val = PEEK_BITS(n);
150
+ * Fetch next N bits without removing them from the buffer.
151
+ * DROP_BITS(n);
152
+ * Discard next N bits.
153
+ * The value N should be a simple variable, not an expression, because it
154
+ * is evaluated multiple times.
155
+ */
156
+
157
+ #define CHECK_BIT_BUFFER(state, nbits, action) { \
158
+ if (bits_left < (nbits)) { \
159
+ if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
160
+ { action; } \
161
+ get_buffer = (state).get_buffer; bits_left = (state).bits_left; \
162
+ } \
163
+ }
164
+
165
+ #define GET_BITS(nbits) \
166
+ (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
167
+
168
+ #define PEEK_BITS(nbits) \
169
+ (((int)(get_buffer >> (bits_left - (nbits)))) & ((1 << (nbits)) - 1))
170
+
171
+ #define DROP_BITS(nbits) \
172
+ (bits_left -= (nbits))
173
+
174
+ /* Load up the bit buffer to a depth of at least nbits */
175
+ EXTERN(boolean) jpeg_fill_bit_buffer(bitread_working_state *state,
176
+ register bit_buf_type get_buffer,
177
+ register int bits_left, int nbits);
178
+
179
+
180
+ /*
181
+ * Code for extracting next Huffman-coded symbol from input bit stream.
182
+ * Again, this is time-critical and we make the main paths be macros.
183
+ *
184
+ * We use a lookahead table to process codes of up to HUFF_LOOKAHEAD bits
185
+ * without looping. Usually, more than 95% of the Huffman codes will be 8
186
+ * or fewer bits long. The few overlength codes are handled with a loop,
187
+ * which need not be inline code.
188
+ *
189
+ * Notes about the HUFF_DECODE macro:
190
+ * 1. Near the end of the data segment, we may fail to get enough bits
191
+ * for a lookahead. In that case, we do it the hard way.
192
+ * 2. If the lookahead table contains no entry, the next code must be
193
+ * more than HUFF_LOOKAHEAD bits long.
194
+ * 3. jpeg_huff_decode returns -1 if forced to suspend.
195
+ */
196
+
197
+ #define HUFF_DECODE(result, state, htbl, failaction, slowlabel) { \
198
+ register int nb, look; \
199
+ if (bits_left < HUFF_LOOKAHEAD) { \
200
+ if (!jpeg_fill_bit_buffer(&state, get_buffer, bits_left, 0)) \
201
+ { failaction; } \
202
+ get_buffer = state.get_buffer; bits_left = state.bits_left; \
203
+ if (bits_left < HUFF_LOOKAHEAD) { \
204
+ nb = 1; goto slowlabel; \
205
+ } \
206
+ } \
207
+ look = PEEK_BITS(HUFF_LOOKAHEAD); \
208
+ if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
209
+ DROP_BITS(nb); \
210
+ result = htbl->lookup[look] & ((1 << HUFF_LOOKAHEAD) - 1); \
211
+ } else { \
212
+ slowlabel: \
213
+ if ((result = \
214
+ jpeg_huff_decode(&state, get_buffer, bits_left, htbl, nb)) < 0) \
215
+ { failaction; } \
216
+ get_buffer = state.get_buffer; bits_left = state.bits_left; \
217
+ } \
218
+ }
219
+
220
+ #define HUFF_DECODE_FAST(s, nb, htbl) \
221
+ FILL_BIT_BUFFER_FAST; \
222
+ s = PEEK_BITS(HUFF_LOOKAHEAD); \
223
+ s = htbl->lookup[s]; \
224
+ nb = s >> HUFF_LOOKAHEAD; \
225
+ /* Pre-execute the common case of nb <= HUFF_LOOKAHEAD */ \
226
+ DROP_BITS(nb); \
227
+ s = s & ((1 << HUFF_LOOKAHEAD) - 1); \
228
+ if (nb > HUFF_LOOKAHEAD) { \
229
+ /* Equivalent of jpeg_huff_decode() */ \
230
+ /* Don't use GET_BITS() here because we don't want to modify bits_left */ \
231
+ s = (get_buffer >> bits_left) & ((1 << (nb)) - 1); \
232
+ while (s > htbl->maxcode[nb]) { \
233
+ s <<= 1; \
234
+ s |= GET_BITS(1); \
235
+ nb++; \
236
+ } \
237
+ if (nb > 16) \
238
+ s = 0; \
239
+ else \
240
+ s = htbl->pub->huffval[(int)(s + htbl->valoffset[nb]) & 0xFF]; \
241
+ }
242
+
243
+ /* Out-of-line case for Huffman code fetching */
244
+ EXTERN(int) jpeg_huff_decode(bitread_working_state *state,
245
+ register bit_buf_type get_buffer,
246
+ register int bits_left, d_derived_tbl *htbl,
247
+ int min_bits);
@@ -0,0 +1,167 @@
1
+ /*
2
+ * jdicc.c
3
+ *
4
+ * Copyright (C) 1997-1998, Thomas G. Lane, Todd Newman.
5
+ * Copyright (C) 2017, D. R. Commander.
6
+ * For conditions of distribution and use, see the accompanying README.ijg
7
+ * file.
8
+ *
9
+ * This file provides code to read International Color Consortium (ICC) device
10
+ * profiles embedded in JFIF JPEG image files. The ICC has defined a standard
11
+ * for including such data in JPEG "APP2" markers. The code given here does
12
+ * not know anything about the internal structure of the ICC profile data; it
13
+ * just knows how to get the profile data from a JPEG file while reading it.
14
+ */
15
+
16
+ #define JPEG_INTERNALS
17
+ #include "jinclude.h"
18
+ #include "jpeglib.h"
19
+ #include "jerror.h"
20
+
21
+
22
+ #define ICC_MARKER (JPEG_APP0 + 2) /* JPEG marker code for ICC */
23
+ #define ICC_OVERHEAD_LEN 14 /* size of non-profile data in APP2 */
24
+
25
+
26
+ /*
27
+ * Handy subroutine to test whether a saved marker is an ICC profile marker.
28
+ */
29
+
30
+ LOCAL(boolean)
31
+ marker_is_icc(jpeg_saved_marker_ptr marker)
32
+ {
33
+ return
34
+ marker->marker == ICC_MARKER &&
35
+ marker->data_length >= ICC_OVERHEAD_LEN &&
36
+ /* verify the identifying string */
37
+ marker->data[0] == 0x49 &&
38
+ marker->data[1] == 0x43 &&
39
+ marker->data[2] == 0x43 &&
40
+ marker->data[3] == 0x5F &&
41
+ marker->data[4] == 0x50 &&
42
+ marker->data[5] == 0x52 &&
43
+ marker->data[6] == 0x4F &&
44
+ marker->data[7] == 0x46 &&
45
+ marker->data[8] == 0x49 &&
46
+ marker->data[9] == 0x4C &&
47
+ marker->data[10] == 0x45 &&
48
+ marker->data[11] == 0x0;
49
+ }
50
+
51
+
52
+ /*
53
+ * See if there was an ICC profile in the JPEG file being read; if so,
54
+ * reassemble and return the profile data.
55
+ *
56
+ * TRUE is returned if an ICC profile was found, FALSE if not. If TRUE is
57
+ * returned, *icc_data_ptr is set to point to the returned data, and
58
+ * *icc_data_len is set to its length.
59
+ *
60
+ * IMPORTANT: the data at *icc_data_ptr is allocated with malloc() and must be
61
+ * freed by the caller with free() when the caller no longer needs it.
62
+ * (Alternatively, we could write this routine to use the IJG library's memory
63
+ * allocator, so that the data would be freed implicitly when
64
+ * jpeg_finish_decompress() is called. But it seems likely that many
65
+ * applications will prefer to have the data stick around after decompression
66
+ * finishes.)
67
+ */
68
+
69
+ GLOBAL(boolean)
70
+ jpeg_read_icc_profile(j_decompress_ptr cinfo, JOCTET **icc_data_ptr,
71
+ unsigned int *icc_data_len)
72
+ {
73
+ jpeg_saved_marker_ptr marker;
74
+ int num_markers = 0;
75
+ int seq_no;
76
+ JOCTET *icc_data;
77
+ unsigned int total_length;
78
+ #define MAX_SEQ_NO 255 /* sufficient since marker numbers are bytes */
79
+ char marker_present[MAX_SEQ_NO + 1]; /* 1 if marker found */
80
+ unsigned int data_length[MAX_SEQ_NO + 1]; /* size of profile data in marker */
81
+ unsigned int data_offset[MAX_SEQ_NO + 1]; /* offset for data in marker */
82
+
83
+ if (icc_data_ptr == NULL || icc_data_len == NULL)
84
+ ERREXIT(cinfo, JERR_BUFFER_SIZE);
85
+ if (cinfo->global_state < DSTATE_READY)
86
+ ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
87
+
88
+ *icc_data_ptr = NULL; /* avoid confusion if FALSE return */
89
+ *icc_data_len = 0;
90
+
91
+ /* This first pass over the saved markers discovers whether there are
92
+ * any ICC markers and verifies the consistency of the marker numbering.
93
+ */
94
+
95
+ for (seq_no = 1; seq_no <= MAX_SEQ_NO; seq_no++)
96
+ marker_present[seq_no] = 0;
97
+
98
+ for (marker = cinfo->marker_list; marker != NULL; marker = marker->next) {
99
+ if (marker_is_icc(marker)) {
100
+ if (num_markers == 0)
101
+ num_markers = marker->data[13];
102
+ else if (num_markers != marker->data[13]) {
103
+ WARNMS(cinfo, JWRN_BOGUS_ICC); /* inconsistent num_markers fields */
104
+ return FALSE;
105
+ }
106
+ seq_no = marker->data[12];
107
+ if (seq_no <= 0 || seq_no > num_markers) {
108
+ WARNMS(cinfo, JWRN_BOGUS_ICC); /* bogus sequence number */
109
+ return FALSE;
110
+ }
111
+ if (marker_present[seq_no]) {
112
+ WARNMS(cinfo, JWRN_BOGUS_ICC); /* duplicate sequence numbers */
113
+ return FALSE;
114
+ }
115
+ marker_present[seq_no] = 1;
116
+ data_length[seq_no] = marker->data_length - ICC_OVERHEAD_LEN;
117
+ }
118
+ }
119
+
120
+ if (num_markers == 0)
121
+ return FALSE;
122
+
123
+ /* Check for missing markers, count total space needed,
124
+ * compute offset of each marker's part of the data.
125
+ */
126
+
127
+ total_length = 0;
128
+ for (seq_no = 1; seq_no <= num_markers; seq_no++) {
129
+ if (marker_present[seq_no] == 0) {
130
+ WARNMS(cinfo, JWRN_BOGUS_ICC); /* missing sequence number */
131
+ return FALSE;
132
+ }
133
+ data_offset[seq_no] = total_length;
134
+ total_length += data_length[seq_no];
135
+ }
136
+
137
+ if (total_length == 0) {
138
+ WARNMS(cinfo, JWRN_BOGUS_ICC); /* found only empty markers? */
139
+ return FALSE;
140
+ }
141
+
142
+ /* Allocate space for assembled data */
143
+ icc_data = (JOCTET *)malloc(total_length * sizeof(JOCTET));
144
+ if (icc_data == NULL)
145
+ ERREXIT1(cinfo, JERR_OUT_OF_MEMORY, 11); /* oops, out of memory */
146
+
147
+ /* and fill it in */
148
+ for (marker = cinfo->marker_list; marker != NULL; marker = marker->next) {
149
+ if (marker_is_icc(marker)) {
150
+ JOCTET FAR *src_ptr;
151
+ JOCTET *dst_ptr;
152
+ unsigned int length;
153
+ seq_no = marker->data[12];
154
+ dst_ptr = icc_data + data_offset[seq_no];
155
+ src_ptr = marker->data + ICC_OVERHEAD_LEN;
156
+ length = data_length[seq_no];
157
+ while (length--) {
158
+ *dst_ptr++ = *src_ptr++;
159
+ }
160
+ }
161
+ }
162
+
163
+ *icc_data_ptr = icc_data;
164
+ *icc_data_len = total_length;
165
+
166
+ return TRUE;
167
+ }