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,258 @@
1
+ libjpeg-turbo note: This file has been modified by The libjpeg-turbo Project
2
+ to include only information relevant to libjpeg-turbo, to wordsmith certain
3
+ sections, and to remove impolitic language that existed in the libjpeg v8
4
+ README. It is included only for reference. Please see README.md for
5
+ information specific to libjpeg-turbo.
6
+
7
+
8
+ The Independent JPEG Group's JPEG software
9
+ ==========================================
10
+
11
+ This distribution contains a release of the Independent JPEG Group's free JPEG
12
+ software. You are welcome to redistribute this software and to use it for any
13
+ purpose, subject to the conditions under LEGAL ISSUES, below.
14
+
15
+ This software is the work of Tom Lane, Guido Vollbeding, Philip Gladstone,
16
+ Bill Allombert, Jim Boucher, Lee Crocker, Bob Friesenhahn, Ben Jackson,
17
+ Julian Minguillon, Luis Ortiz, George Phillips, Davide Rossi, Ge' Weijers,
18
+ and other members of the Independent JPEG Group.
19
+
20
+ IJG is not affiliated with the ISO/IEC JTC1/SC29/WG1 standards committee
21
+ (also known as JPEG, together with ITU-T SG16).
22
+
23
+
24
+ DOCUMENTATION ROADMAP
25
+ =====================
26
+
27
+ This file contains the following sections:
28
+
29
+ OVERVIEW General description of JPEG and the IJG software.
30
+ LEGAL ISSUES Copyright, lack of warranty, terms of distribution.
31
+ REFERENCES Where to learn more about JPEG.
32
+ ARCHIVE LOCATIONS Where to find newer versions of this software.
33
+ FILE FORMAT WARS Software *not* to get.
34
+ TO DO Plans for future IJG releases.
35
+
36
+ Other documentation files in the distribution are:
37
+
38
+ User documentation:
39
+ usage.txt Usage instructions for cjpeg, djpeg, jpegtran,
40
+ rdjpgcom, and wrjpgcom.
41
+ *.1 Unix-style man pages for programs (same info as usage.txt).
42
+ wizard.txt Advanced usage instructions for JPEG wizards only.
43
+ change.log Version-to-version change highlights.
44
+ Programmer and internal documentation:
45
+ libjpeg.txt How to use the JPEG library in your own programs.
46
+ example.txt Sample code for calling the JPEG library.
47
+ structure.txt Overview of the JPEG library's internal structure.
48
+ coderules.txt Coding style rules --- please read if you contribute code.
49
+
50
+ Please read at least usage.txt. Some information can also be found in the JPEG
51
+ FAQ (Frequently Asked Questions) article. See ARCHIVE LOCATIONS below to find
52
+ out where to obtain the FAQ article.
53
+
54
+ If you want to understand how the JPEG code works, we suggest reading one or
55
+ more of the REFERENCES, then looking at the documentation files (in roughly
56
+ the order listed) before diving into the code.
57
+
58
+
59
+ OVERVIEW
60
+ ========
61
+
62
+ This package contains C software to implement JPEG image encoding, decoding,
63
+ and transcoding. JPEG (pronounced "jay-peg") is a standardized compression
64
+ method for full-color and grayscale images. JPEG's strong suit is compressing
65
+ photographic images or other types of images that have smooth color and
66
+ brightness transitions between neighboring pixels. Images with sharp lines or
67
+ other abrupt features may not compress well with JPEG, and a higher JPEG
68
+ quality may have to be used to avoid visible compression artifacts with such
69
+ images.
70
+
71
+ JPEG is lossy, meaning that the output pixels are not necessarily identical to
72
+ the input pixels. However, on photographic content and other "smooth" images,
73
+ very good compression ratios can be obtained with no visible compression
74
+ artifacts, and extremely high compression ratios are possible if you are
75
+ willing to sacrifice image quality (by reducing the "quality" setting in the
76
+ compressor.)
77
+
78
+ This software implements JPEG baseline, extended-sequential, and progressive
79
+ compression processes. Provision is made for supporting all variants of these
80
+ processes, although some uncommon parameter settings aren't implemented yet.
81
+ We have made no provision for supporting the hierarchical or lossless
82
+ processes defined in the standard.
83
+
84
+ We provide a set of library routines for reading and writing JPEG image files,
85
+ plus two sample applications "cjpeg" and "djpeg", which use the library to
86
+ perform conversion between JPEG and some other popular image file formats.
87
+ The library is intended to be reused in other applications.
88
+
89
+ In order to support file conversion and viewing software, we have included
90
+ considerable functionality beyond the bare JPEG coding/decoding capability;
91
+ for example, the color quantization modules are not strictly part of JPEG
92
+ decoding, but they are essential for output to colormapped file formats or
93
+ colormapped displays. These extra functions can be compiled out of the
94
+ library if not required for a particular application.
95
+
96
+ We have also included "jpegtran", a utility for lossless transcoding between
97
+ different JPEG processes, and "rdjpgcom" and "wrjpgcom", two simple
98
+ applications for inserting and extracting textual comments in JFIF files.
99
+
100
+ The emphasis in designing this software has been on achieving portability and
101
+ flexibility, while also making it fast enough to be useful. In particular,
102
+ the software is not intended to be read as a tutorial on JPEG. (See the
103
+ REFERENCES section for introductory material.) Rather, it is intended to
104
+ be reliable, portable, industrial-strength code. We do not claim to have
105
+ achieved that goal in every aspect of the software, but we strive for it.
106
+
107
+ We welcome the use of this software as a component of commercial products.
108
+ No royalty is required, but we do ask for an acknowledgement in product
109
+ documentation, as described under LEGAL ISSUES.
110
+
111
+
112
+ LEGAL ISSUES
113
+ ============
114
+
115
+ In plain English:
116
+
117
+ 1. We don't promise that this software works. (But if you find any bugs,
118
+ please let us know!)
119
+ 2. You can use this software for whatever you want. You don't have to pay us.
120
+ 3. You may not pretend that you wrote this software. If you use it in a
121
+ program, you must acknowledge somewhere in your documentation that
122
+ you've used the IJG code.
123
+
124
+ In legalese:
125
+
126
+ The authors make NO WARRANTY or representation, either express or implied,
127
+ with respect to this software, its quality, accuracy, merchantability, or
128
+ fitness for a particular purpose. This software is provided "AS IS", and you,
129
+ its user, assume the entire risk as to its quality and accuracy.
130
+
131
+ This software is copyright (C) 1991-2020, Thomas G. Lane, Guido Vollbeding.
132
+ All Rights Reserved except as specified below.
133
+
134
+ Permission is hereby granted to use, copy, modify, and distribute this
135
+ software (or portions thereof) for any purpose, without fee, subject to these
136
+ conditions:
137
+ (1) If any part of the source code for this software is distributed, then this
138
+ README file must be included, with this copyright and no-warranty notice
139
+ unaltered; and any additions, deletions, or changes to the original files
140
+ must be clearly indicated in accompanying documentation.
141
+ (2) If only executable code is distributed, then the accompanying
142
+ documentation must state that "this software is based in part on the work of
143
+ the Independent JPEG Group".
144
+ (3) Permission for use of this software is granted only if the user accepts
145
+ full responsibility for any undesirable consequences; the authors accept
146
+ NO LIABILITY for damages of any kind.
147
+
148
+ These conditions apply to any software derived from or based on the IJG code,
149
+ not just to the unmodified library. If you use our work, you ought to
150
+ acknowledge us.
151
+
152
+ Permission is NOT granted for the use of any IJG author's name or company name
153
+ in advertising or publicity relating to this software or products derived from
154
+ it. This software may be referred to only as "the Independent JPEG Group's
155
+ software".
156
+
157
+ We specifically permit and encourage the use of this software as the basis of
158
+ commercial products, provided that all warranty or liability claims are
159
+ assumed by the product vendor.
160
+
161
+
162
+ REFERENCES
163
+ ==========
164
+
165
+ We recommend reading one or more of these references before trying to
166
+ understand the innards of the JPEG software.
167
+
168
+ The best short technical introduction to the JPEG compression algorithm is
169
+ Wallace, Gregory K. "The JPEG Still Picture Compression Standard",
170
+ Communications of the ACM, April 1991 (vol. 34 no. 4), pp. 30-44.
171
+ (Adjacent articles in that issue discuss MPEG motion picture compression,
172
+ applications of JPEG, and related topics.) If you don't have the CACM issue
173
+ handy, a PDF file containing a revised version of Wallace's article is
174
+ available at http://www.ijg.org/files/Wallace.JPEG.pdf. The file (actually
175
+ a preprint for an article that appeared in IEEE Trans. Consumer Electronics)
176
+ omits the sample images that appeared in CACM, but it includes corrections
177
+ and some added material. Note: the Wallace article is copyright ACM and IEEE,
178
+ and it may not be used for commercial purposes.
179
+
180
+ A somewhat less technical, more leisurely introduction to JPEG can be found in
181
+ "The Data Compression Book" by Mark Nelson and Jean-loup Gailly, published by
182
+ M&T Books (New York), 2nd ed. 1996, ISBN 1-55851-434-1. This book provides
183
+ good explanations and example C code for a multitude of compression methods
184
+ including JPEG. It is an excellent source if you are comfortable reading C
185
+ code but don't know much about data compression in general. The book's JPEG
186
+ sample code is far from industrial-strength, but when you are ready to look
187
+ at a full implementation, you've got one here...
188
+
189
+ The best currently available description of JPEG is the textbook "JPEG Still
190
+ Image Data Compression Standard" by William B. Pennebaker and Joan L.
191
+ Mitchell, published by Van Nostrand Reinhold, 1993, ISBN 0-442-01272-1.
192
+ Price US$59.95, 638 pp. The book includes the complete text of the ISO JPEG
193
+ standards (DIS 10918-1 and draft DIS 10918-2).
194
+
195
+ The original JPEG standard is divided into two parts, Part 1 being the actual
196
+ specification, while Part 2 covers compliance testing methods. Part 1 is
197
+ titled "Digital Compression and Coding of Continuous-tone Still Images,
198
+ Part 1: Requirements and guidelines" and has document numbers ISO/IEC IS
199
+ 10918-1, ITU-T T.81. Part 2 is titled "Digital Compression and Coding of
200
+ Continuous-tone Still Images, Part 2: Compliance testing" and has document
201
+ numbers ISO/IEC IS 10918-2, ITU-T T.83.
202
+
203
+ The JPEG standard does not specify all details of an interchangeable file
204
+ format. For the omitted details, we follow the "JFIF" conventions, revision
205
+ 1.02. JFIF version 1 has been adopted as ISO/IEC 10918-5 (05/2013) and
206
+ Recommendation ITU-T T.871 (05/2011): Information technology - Digital
207
+ compression and coding of continuous-tone still images: JPEG File Interchange
208
+ Format (JFIF). It is available as a free download in PDF file format from
209
+ https://www.iso.org/standard/54989.html and http://www.itu.int/rec/T-REC-T.871.
210
+ A PDF file of the older JFIF 1.02 specification is available at
211
+ http://www.w3.org/Graphics/JPEG/jfif3.pdf.
212
+
213
+ The TIFF 6.0 file format specification can be obtained from
214
+ http://mirrors.ctan.org/graphics/tiff/TIFF6.ps.gz. The JPEG incorporation
215
+ scheme found in the TIFF 6.0 spec of 3-June-92 has a number of serious
216
+ problems. IJG does not recommend use of the TIFF 6.0 design (TIFF Compression
217
+ tag 6). Instead, we recommend the JPEG design proposed by TIFF Technical Note
218
+ #2 (Compression tag 7). Copies of this Note can be obtained from
219
+ http://www.ijg.org/files/. It is expected that the next revision
220
+ of the TIFF spec will replace the 6.0 JPEG design with the Note's design.
221
+ Although IJG's own code does not support TIFF/JPEG, the free libtiff library
222
+ uses our library to implement TIFF/JPEG per the Note.
223
+
224
+
225
+ ARCHIVE LOCATIONS
226
+ =================
227
+
228
+ The "official" archive site for this software is www.ijg.org.
229
+ The most recent released version can always be found there in
230
+ directory "files".
231
+
232
+ The JPEG FAQ (Frequently Asked Questions) article is a source of some
233
+ general information about JPEG. It is available at
234
+ http://www.faqs.org/faqs/jpeg-faq.
235
+
236
+
237
+ FILE FORMAT COMPATIBILITY
238
+ =========================
239
+
240
+ This software implements ITU T.81 | ISO/IEC 10918 with some extensions from
241
+ ITU T.871 | ISO/IEC 10918-5 (JPEG File Interchange Format-- see REFERENCES).
242
+ Informally, the term "JPEG image" or "JPEG file" most often refers to JFIF or
243
+ a subset thereof, but there are other formats containing the name "JPEG" that
244
+ are incompatible with the DCT-based JPEG standard or with JFIF (for instance,
245
+ JPEG 2000 and JPEG XR). This software therefore does not support these
246
+ formats. Indeed, one of the original reasons for developing this free software
247
+ was to help force convergence on a common, interoperable format standard for
248
+ JPEG files.
249
+
250
+ JFIF is a minimal or "low end" representation. TIFF/JPEG (TIFF revision 6.0 as
251
+ modified by TIFF Technical Note #2) can be used for "high end" applications
252
+ that need to record a lot of additional data about an image.
253
+
254
+
255
+ TO DO
256
+ =====
257
+
258
+ Please send bug reports, offers of help, etc. to jpeg-info@jpegclub.org.
@@ -0,0 +1,29 @@
1
+ Mozilla JPEG Encoder Project [![Build Status](https://ci.appveyor.com/api/projects/status/github/mozilla/mozjpeg?branch=master&svg=true)](https://ci.appveyor.com/project/kornel/mozjpeg-4ekrx)
2
+ ============================
3
+
4
+ MozJPEG improves JPEG compression efficiency achieving higher visual quality and smaller file sizes at the same time. It is compatible with the JPEG standard, and the vast majority of the world's deployed JPEG decoders.
5
+
6
+ MozJPEG is a patch for [libjpeg-turbo](https://github.com/libjpeg-turbo/libjpeg-turbo). **Please send pull requests to libjpeg-turbo** if the changes aren't specific to newly-added MozJPEG-only compression code. This project aims to keep differences with libjpeg-turbo minimal, so whenever possible, improvements and bug fixes should go there first.
7
+
8
+ MozJPEG is compatible with the libjpeg API and ABI. It is intended to be a drop-in replacement for libjpeg. MozJPEG is a strict superset of libjpeg-turbo's functionality. All MozJPEG's improvements can be disabled at run time, and in that case it behaves exactly like libjpeg-turbo.
9
+
10
+ MozJPEG is meant to be used as a library in graphics programs and image processing tools. We include a demo `cjpeg` command-line tool, but it's not intended for serious use. We encourage authors of graphics programs to use libjpeg's [C API](libjpeg.txt) and link with MozJPEG library instead.
11
+
12
+ ## Features
13
+
14
+ * Progressive encoding with "jpegrescan" optimization. It can be applied to any JPEG file (with `jpegtran`) to losslessly reduce file size.
15
+ * Trellis quantization. When converting other formats to JPEG it maximizes quality/filesize ratio.
16
+ * Comes with new quantization table presets, e.g. tuned for high-resolution displays.
17
+ * Fully compatible with all web browsers.
18
+ * Can be seamlessly integrated into any program that uses the industry-standard libjpeg API. There's no need to write any MozJPEG-specific integration code.
19
+
20
+ ## Releases
21
+
22
+ * [Latest release](https://github.com/mozilla/mozjpeg/releases/latest)
23
+ * [Overview of 3.0 features](https://calendar.perfplanet.com/2014/mozjpeg-3-0/)
24
+ * [Version 2.0 Announcement](https://blog.mozilla.org/research/2014/07/15/mozilla-advances-jpeg-encoding-with-mozjpeg-2-0/)
25
+ * [Version 1.0 Announcement](https://blog.mozilla.org/research/2014/03/05/introducing-the-mozjpeg-project/)
26
+
27
+ ## Compiling
28
+
29
+ See [BUILDING](BUILDING.md). MozJPEG is built exactly the same way as libjpeg-turbo, so if you need additional help please consult [libjpeg-turbo documentation](https://libjpeg-turbo.org/).
@@ -0,0 +1,128 @@
1
+ /*
2
+ * cderror.h
3
+ *
4
+ * This file was part of the Independent JPEG Group's software:
5
+ * Copyright (C) 1994-1997, Thomas G. Lane.
6
+ * Modified 2009-2017 by Guido Vollbeding.
7
+ * libjpeg-turbo Modifications:
8
+ * Copyright (C) 2021, D. R. Commander.
9
+ * For conditions of distribution and use, see the accompanying README.ijg
10
+ * file.
11
+ *
12
+ * This file defines the error and message codes for the cjpeg/djpeg
13
+ * applications. These strings are not needed as part of the JPEG library
14
+ * proper.
15
+ * Edit this file to add new codes, or to translate the message strings to
16
+ * some other language.
17
+ */
18
+
19
+ /*
20
+ * To define the enum list of message codes, include this file without
21
+ * defining macro JMESSAGE. To create a message string table, include it
22
+ * again with a suitable JMESSAGE definition (see jerror.c for an example).
23
+ */
24
+ #ifndef JMESSAGE
25
+ #ifndef CDERROR_H
26
+ #define CDERROR_H
27
+ /* First time through, define the enum list */
28
+ #define JMAKE_ENUM_LIST
29
+ #else
30
+ /* Repeated inclusions of this file are no-ops unless JMESSAGE is defined */
31
+ #define JMESSAGE(code, string)
32
+ #endif /* CDERROR_H */
33
+ #endif /* JMESSAGE */
34
+
35
+ #ifdef JMAKE_ENUM_LIST
36
+
37
+ typedef enum {
38
+
39
+ #define JMESSAGE(code, string) code,
40
+
41
+ #endif /* JMAKE_ENUM_LIST */
42
+
43
+ JMESSAGE(JMSG_FIRSTADDONCODE = 1000, NULL) /* Must be first entry! */
44
+
45
+ #ifdef BMP_SUPPORTED
46
+ JMESSAGE(JERR_BMP_BADCMAP, "Unsupported BMP colormap format")
47
+ JMESSAGE(JERR_BMP_BADDEPTH, "Only 8-, 24-, and 32-bit BMP files are supported")
48
+ JMESSAGE(JERR_BMP_BADHEADER, "Invalid BMP file: bad header length")
49
+ JMESSAGE(JERR_BMP_BADPLANES, "Invalid BMP file: biPlanes not equal to 1")
50
+ JMESSAGE(JERR_BMP_COLORSPACE, "BMP output must be grayscale or RGB")
51
+ JMESSAGE(JERR_BMP_COMPRESSED, "Sorry, compressed BMPs not yet supported")
52
+ JMESSAGE(JERR_BMP_EMPTY, "Empty BMP image")
53
+ JMESSAGE(JERR_BMP_NOT, "Not a BMP file - does not start with BM")
54
+ JMESSAGE(JERR_BMP_OUTOFRANGE, "Numeric value out of range in BMP file")
55
+ JMESSAGE(JTRC_BMP, "%ux%u %d-bit BMP image")
56
+ JMESSAGE(JTRC_BMP_MAPPED, "%ux%u 8-bit colormapped BMP image")
57
+ JMESSAGE(JTRC_BMP_OS2, "%ux%u %d-bit OS2 BMP image")
58
+ JMESSAGE(JTRC_BMP_OS2_MAPPED, "%ux%u 8-bit colormapped OS2 BMP image")
59
+ #endif /* BMP_SUPPORTED */
60
+
61
+ #ifdef GIF_SUPPORTED
62
+ JMESSAGE(JERR_GIF_BUG, "GIF output got confused")
63
+ JMESSAGE(JERR_GIF_CODESIZE, "Bogus GIF codesize %d")
64
+ JMESSAGE(JERR_GIF_COLORSPACE, "GIF output must be grayscale or RGB")
65
+ JMESSAGE(JERR_GIF_EMPTY, "Empty GIF image")
66
+ JMESSAGE(JERR_GIF_IMAGENOTFOUND, "Too few images in GIF file")
67
+ JMESSAGE(JERR_GIF_NOT, "Not a GIF file")
68
+ JMESSAGE(JTRC_GIF, "%ux%ux%d GIF image")
69
+ JMESSAGE(JTRC_GIF_BADVERSION,
70
+ "Warning: unexpected GIF version number '%c%c%c'")
71
+ JMESSAGE(JTRC_GIF_EXTENSION, "Ignoring GIF extension block of type 0x%02x")
72
+ JMESSAGE(JTRC_GIF_NONSQUARE, "Caution: nonsquare pixels in input")
73
+ JMESSAGE(JWRN_GIF_BADDATA, "Corrupt data in GIF file")
74
+ JMESSAGE(JWRN_GIF_CHAR, "Bogus char 0x%02x in GIF file, ignoring")
75
+ JMESSAGE(JWRN_GIF_ENDCODE, "Premature end of GIF image")
76
+ JMESSAGE(JWRN_GIF_NOMOREDATA, "Ran out of GIF bits")
77
+ #endif /* GIF_SUPPORTED */
78
+
79
+ #ifdef PPM_SUPPORTED
80
+ JMESSAGE(JERR_PPM_COLORSPACE, "PPM output must be grayscale or RGB")
81
+ JMESSAGE(JERR_PPM_NONNUMERIC, "Nonnumeric data in PPM file")
82
+ JMESSAGE(JERR_PPM_NOT, "Not a PPM/PGM file")
83
+ JMESSAGE(JERR_PPM_OUTOFRANGE, "Numeric value out of range in PPM file")
84
+ JMESSAGE(JTRC_PGM, "%ux%u PGM image")
85
+ JMESSAGE(JTRC_PGM_TEXT, "%ux%u text PGM image")
86
+ JMESSAGE(JTRC_PPM, "%ux%u PPM image")
87
+ JMESSAGE(JTRC_PPM_TEXT, "%ux%u text PPM image")
88
+ #endif /* PPM_SUPPORTED */
89
+
90
+ #ifdef TARGA_SUPPORTED
91
+ JMESSAGE(JERR_TGA_BADCMAP, "Unsupported Targa colormap format")
92
+ JMESSAGE(JERR_TGA_BADPARMS, "Invalid or unsupported Targa file")
93
+ JMESSAGE(JERR_TGA_COLORSPACE, "Targa output must be grayscale or RGB")
94
+ JMESSAGE(JTRC_TGA, "%ux%u RGB Targa image")
95
+ JMESSAGE(JTRC_TGA_GRAY, "%ux%u grayscale Targa image")
96
+ JMESSAGE(JTRC_TGA_MAPPED, "%ux%u colormapped Targa image")
97
+ #else
98
+ JMESSAGE(JERR_TGA_NOTCOMP, "Targa support was not compiled")
99
+ #endif /* TARGA_SUPPORTED */
100
+
101
+ JMESSAGE(JERR_BAD_CMAP_FILE,
102
+ "Color map file is invalid or of unsupported format")
103
+ JMESSAGE(JERR_TOO_MANY_COLORS,
104
+ "Output file format cannot handle %d colormap entries")
105
+ JMESSAGE(JERR_UNGETC_FAILED, "ungetc failed")
106
+ #ifdef PNG_SUPPORTED
107
+ JMESSAGE(JERR_UNKNOWN_FORMAT,
108
+ "MozJPEG can't read the image (JPEG, PNG and old BMP and Targa are supported)")
109
+ #else
110
+ JMESSAGE(JERR_UNKNOWN_FORMAT, "MozJPEG can't read the image (PNG support is disabled in this build)")
111
+ #endif
112
+ JMESSAGE(JERR_UNSUPPORTED_FORMAT, "Unsupported output file format")
113
+
114
+ #ifdef PNG_SUPPORTED
115
+ JMESSAGE(JERR_PNG_ERROR, "Unable to read PNG file: %s")
116
+ JMESSAGE(JERR_PNG_PROFILETOOLARGE, "Embedded profile was too large for this tool - dropped.")
117
+ #endif
118
+
119
+ #ifdef JMAKE_ENUM_LIST
120
+
121
+ JMSG_LASTADDONCODE
122
+ } ADDON_MESSAGE_CODE;
123
+
124
+ #undef JMAKE_ENUM_LIST
125
+ #endif /* JMAKE_ENUM_LIST */
126
+
127
+ /* Zap JMESSAGE macro so that future re-inclusions do nothing by default */
128
+ #undef JMESSAGE
@@ -0,0 +1,156 @@
1
+ /*
2
+ * cdjpeg.c
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) 2019, 2022, D. R. Commander.
8
+ * For conditions of distribution and use, see the accompanying README.ijg
9
+ * file.
10
+ *
11
+ * This file contains common support routines used by the IJG application
12
+ * programs (cjpeg, djpeg, jpegtran).
13
+ */
14
+
15
+ #include "cdjpeg.h" /* Common decls for cjpeg/djpeg applications */
16
+ #include <ctype.h> /* to declare isupper(), tolower() */
17
+ #ifdef USE_SETMODE
18
+ #include <fcntl.h> /* to declare setmode()'s parameter macros */
19
+ /* If you have setmode() but not <io.h>, just delete this line: */
20
+ #include <io.h> /* to declare setmode() */
21
+ #endif
22
+
23
+
24
+ /*
25
+ * Optional progress monitor: display a percent-done figure on stderr.
26
+ */
27
+
28
+ METHODDEF(void)
29
+ progress_monitor(j_common_ptr cinfo)
30
+ {
31
+ cd_progress_ptr prog = (cd_progress_ptr)cinfo->progress;
32
+
33
+ if (prog->max_scans != 0 && cinfo->is_decompressor) {
34
+ int scan_no = ((j_decompress_ptr)cinfo)->input_scan_number;
35
+
36
+ if (scan_no > (int)prog->max_scans) {
37
+ fprintf(stderr, "Scan number %d exceeds maximum scans (%u)\n", scan_no,
38
+ prog->max_scans);
39
+ exit(EXIT_FAILURE);
40
+ }
41
+ }
42
+
43
+ if (prog->report) {
44
+ int total_passes = prog->pub.total_passes + prog->total_extra_passes;
45
+ int percent_done =
46
+ (int)(prog->pub.pass_counter * 100L / prog->pub.pass_limit);
47
+
48
+ if (percent_done != prog->percent_done) {
49
+ prog->percent_done = percent_done;
50
+ if (total_passes > 1) {
51
+ fprintf(stderr, "\rPass %d/%d: %3d%% ",
52
+ prog->pub.completed_passes + prog->completed_extra_passes + 1,
53
+ total_passes, percent_done);
54
+ } else {
55
+ fprintf(stderr, "\r %3d%% ", percent_done);
56
+ }
57
+ fflush(stderr);
58
+ }
59
+ }
60
+ }
61
+
62
+
63
+ GLOBAL(void)
64
+ start_progress_monitor(j_common_ptr cinfo, cd_progress_ptr progress)
65
+ {
66
+ /* Enable progress display, unless trace output is on */
67
+ if (cinfo->err->trace_level == 0) {
68
+ progress->pub.progress_monitor = progress_monitor;
69
+ progress->completed_extra_passes = 0;
70
+ progress->total_extra_passes = 0;
71
+ progress->max_scans = 0;
72
+ progress->report = FALSE;
73
+ progress->percent_done = -1;
74
+ cinfo->progress = &progress->pub;
75
+ }
76
+ }
77
+
78
+
79
+ GLOBAL(void)
80
+ end_progress_monitor(j_common_ptr cinfo)
81
+ {
82
+ /* Clear away progress display */
83
+ if (cinfo->err->trace_level == 0) {
84
+ fprintf(stderr, "\r \r");
85
+ fflush(stderr);
86
+ }
87
+ }
88
+
89
+
90
+ /*
91
+ * Case-insensitive matching of possibly-abbreviated keyword switches.
92
+ * keyword is the constant keyword (must be lower case already),
93
+ * minchars is length of minimum legal abbreviation.
94
+ */
95
+
96
+ GLOBAL(boolean)
97
+ keymatch(char *arg, const char *keyword, int minchars)
98
+ {
99
+ register int ca, ck;
100
+ register int nmatched = 0;
101
+
102
+ while ((ca = *arg++) != '\0') {
103
+ if ((ck = *keyword++) == '\0')
104
+ return FALSE; /* arg longer than keyword, no good */
105
+ if (isupper(ca)) /* force arg to lcase (assume ck is already) */
106
+ ca = tolower(ca);
107
+ if (ca != ck)
108
+ return FALSE; /* no good */
109
+ nmatched++; /* count matched characters */
110
+ }
111
+ /* reached end of argument; fail if it's too short for unique abbrev */
112
+ if (nmatched < minchars)
113
+ return FALSE;
114
+ return TRUE; /* A-OK */
115
+ }
116
+
117
+
118
+ /*
119
+ * Routines to establish binary I/O mode for stdin and stdout.
120
+ * Non-Unix systems often require some hacking to get out of text mode.
121
+ */
122
+
123
+ GLOBAL(FILE *)
124
+ read_stdin(void)
125
+ {
126
+ FILE *input_file = stdin;
127
+
128
+ #ifdef USE_SETMODE /* need to hack file mode? */
129
+ setmode(fileno(stdin), O_BINARY);
130
+ #endif
131
+ #ifdef USE_FDOPEN /* need to re-open in binary mode? */
132
+ if ((input_file = fdopen(fileno(stdin), READ_BINARY)) == NULL) {
133
+ fprintf(stderr, "Cannot reopen stdin\n");
134
+ exit(EXIT_FAILURE);
135
+ }
136
+ #endif
137
+ return input_file;
138
+ }
139
+
140
+
141
+ GLOBAL(FILE *)
142
+ write_stdout(void)
143
+ {
144
+ FILE *output_file = stdout;
145
+
146
+ #ifdef USE_SETMODE /* need to hack file mode? */
147
+ setmode(fileno(stdout), O_BINARY);
148
+ #endif
149
+ #ifdef USE_FDOPEN /* need to re-open in binary mode? */
150
+ if ((output_file = fdopen(fileno(stdout), WRITE_BINARY)) == NULL) {
151
+ fprintf(stderr, "Cannot reopen stdout\n");
152
+ exit(EXIT_FAILURE);
153
+ }
154
+ #endif
155
+ return output_file;
156
+ }