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,679 @@
1
+ NOTE: This file was modified by The libjpeg-turbo Project to include only
2
+ information relevant to libjpeg-turbo and to wordsmith certain sections.
3
+
4
+ USAGE instructions for the Independent JPEG Group's JPEG software
5
+ =================================================================
6
+
7
+ This file describes usage of the JPEG conversion programs cjpeg and djpeg,
8
+ as well as the utility programs jpegtran, rdjpgcom and wrjpgcom. (See
9
+ the other documentation files if you wish to use the JPEG library within
10
+ your own programs.)
11
+
12
+ If you are on a Unix machine you may prefer to read the Unix-style manual
13
+ pages in files cjpeg.1, djpeg.1, jpegtran.1, rdjpgcom.1, wrjpgcom.1.
14
+
15
+
16
+ INTRODUCTION
17
+
18
+ These programs implement JPEG image encoding, decoding, and transcoding.
19
+ JPEG (pronounced "jay-peg") is a standardized compression method for
20
+ full-color and grayscale images.
21
+
22
+
23
+ GENERAL USAGE
24
+
25
+ We provide two programs, cjpeg to compress an image file into JPEG format,
26
+ and djpeg to decompress a JPEG file back into a conventional image format.
27
+
28
+ On most systems, you say:
29
+ cjpeg [switches] [imagefile] >jpegfile
30
+ or
31
+ djpeg [switches] [jpegfile] >imagefile
32
+ The programs read the specified input file, or standard input if none is
33
+ named. They always write to standard output (with trace/error messages to
34
+ standard error). These conventions are handy for piping images between
35
+ programs.
36
+
37
+ If you defined TWO_FILE_COMMANDLINE when compiling the programs, you can
38
+ instead say:
39
+ cjpeg [switches] imagefile jpegfile
40
+ or
41
+ djpeg [switches] jpegfile imagefile
42
+ i.e., both the input and output files are named on the command line. This
43
+ style is a little more foolproof, and it loses no functionality if you don't
44
+ have pipes.
45
+
46
+ You can also say:
47
+ cjpeg [switches] -outfile jpegfile imagefile
48
+ or
49
+ djpeg [switches] -outfile imagefile jpegfile
50
+ This syntax works on all systems, so it is useful for scripts.
51
+
52
+ The currently supported image file formats are: PPM (PBMPLUS color format),
53
+ PGM (PBMPLUS grayscale format), BMP, GIF, and Targa. cjpeg recognizes the
54
+ input image format automatically, with the exception of some Targa files. You
55
+ have to tell djpeg which format to generate.
56
+
57
+ JPEG files are in the defacto standard JFIF file format. There are other,
58
+ less widely used JPEG-based file formats, but we don't support them.
59
+
60
+ All switch names may be abbreviated; for example, -grayscale may be written
61
+ -gray or -gr. Most of the "basic" switches can be abbreviated to as little as
62
+ one letter. Upper and lower case are equivalent (-BMP is the same as -bmp).
63
+ British spellings are also accepted (e.g., -greyscale), though for brevity
64
+ these are not mentioned below.
65
+
66
+
67
+ CJPEG DETAILS
68
+
69
+ The basic command line switches for cjpeg are:
70
+
71
+ -quality N[,...] Scale quantization tables to adjust image quality.
72
+ Quality is 0 (worst) to 100 (best); default is 75.
73
+ (See below for more info.)
74
+
75
+ -grayscale Create monochrome JPEG file from color input. By
76
+ saying -grayscale, you'll get a smaller JPEG file that
77
+ takes less time to process.
78
+
79
+ -rgb Create RGB JPEG file.
80
+ Using this switch suppresses the conversion from RGB
81
+ colorspace input to the default YCbCr JPEG colorspace.
82
+
83
+ -optimize Perform optimization of entropy encoding parameters.
84
+ Without this, default encoding parameters are used.
85
+ -optimize usually makes the JPEG file a little smaller,
86
+ but cjpeg runs somewhat slower and needs much more
87
+ memory. Image quality and speed of decompression are
88
+ unaffected by -optimize.
89
+
90
+ -progressive Create progressive JPEG file (see below).
91
+
92
+ -targa Input file is Targa format. Targa files that contain
93
+ an "identification" field will not be automatically
94
+ recognized by cjpeg; for such files you must specify
95
+ -targa to make cjpeg treat the input as Targa format.
96
+ For most Targa files, you won't need this switch.
97
+
98
+ The -quality switch lets you trade off compressed file size against quality of
99
+ the reconstructed image: the higher the quality setting, the larger the JPEG
100
+ file, and the closer the output image will be to the original input. Normally
101
+ you want to use the lowest quality setting (smallest file) that decompresses
102
+ into something visually indistinguishable from the original image. For this
103
+ purpose the quality setting should generally be between 50 and 95 (the default
104
+ is 75) for photographic images. If you see defects at -quality 75, then go up
105
+ 5 or 10 counts at a time until you are happy with the output image. (The
106
+ optimal setting will vary from one image to another.)
107
+
108
+ -quality 100 will generate a quantization table of all 1's, minimizing loss
109
+ in the quantization step (but there is still information loss in subsampling,
110
+ as well as roundoff error.) For most images, specifying a quality value above
111
+ about 95 will increase the size of the compressed file dramatically, and while
112
+ the quality gain from these higher quality values is measurable (using metrics
113
+ such as PSNR or SSIM), it is rarely perceivable by human vision.
114
+
115
+ In the other direction, quality values below 50 will produce very small files
116
+ of low image quality. Settings around 5 to 10 might be useful in preparing an
117
+ index of a large image library, for example. Try -quality 2 (or so) for some
118
+ amusing Cubist effects. (Note: quality values below about 25 generate 2-byte
119
+ quantization tables, which are considered optional in the JPEG standard.
120
+ cjpeg emits a warning message when you give such a quality value, because some
121
+ other JPEG programs may be unable to decode the resulting file. Use -baseline
122
+ if you need to ensure compatibility at low quality values.)
123
+
124
+ The -quality option has been extended in this version of cjpeg to support
125
+ separate quality settings for luminance and chrominance (or, in general,
126
+ separate settings for every quantization table slot.) The principle is the
127
+ same as chrominance subsampling: since the human eye is more sensitive to
128
+ spatial changes in brightness than spatial changes in color, the chrominance
129
+ components can be quantized more than the luminance components without
130
+ incurring any visible image quality loss. However, unlike subsampling, this
131
+ feature reduces data in the frequency domain instead of the spatial domain,
132
+ which allows for more fine-grained control. This option is useful in
133
+ quality-sensitive applications, for which the artifacts generated by
134
+ subsampling may be unacceptable.
135
+
136
+ The -quality option accepts a comma-separated list of parameters, which
137
+ respectively refer to the quality levels that should be assigned to the
138
+ quantization table slots. If there are more q-table slots than parameters,
139
+ then the last parameter is replicated. Thus, if only one quality parameter is
140
+ given, this is used for both luminance and chrominance (slots 0 and 1,
141
+ respectively), preserving the legacy behavior of cjpeg v6b and prior. More (or
142
+ customized) quantization tables can be set with the -qtables option and
143
+ assigned to components with the -qslots option (see the "wizard" switches
144
+ below.)
145
+
146
+ JPEG files generated with separate luminance and chrominance quality are fully
147
+ compliant with standard JPEG decoders.
148
+
149
+ CAUTION: For this setting to be useful, be sure to pass an argument of
150
+ -sample 1x1 to cjpeg to disable chrominance subsampling. Otherwise, the
151
+ default subsampling level (2x2, AKA "4:2:0") will be used.
152
+
153
+ The -progressive switch creates a "progressive JPEG" file. In this type of
154
+ JPEG file, the data is stored in multiple scans of increasing quality. If the
155
+ file is being transmitted over a slow communications link, the decoder can use
156
+ the first scan to display a low-quality image very quickly, and can then
157
+ improve the display with each subsequent scan. The final image is exactly
158
+ equivalent to a standard JPEG file of the same quality setting, and the total
159
+ file size is about the same --- often a little smaller.
160
+
161
+ Switches for advanced users:
162
+
163
+ -arithmetic Use arithmetic coding. CAUTION: arithmetic coded JPEG
164
+ is not yet widely implemented, so many decoders will
165
+ be unable to view an arithmetic coded JPEG file at
166
+ all.
167
+
168
+ -dct int Use accurate integer DCT method (default).
169
+ -dct fast Use less accurate integer DCT method [legacy feature].
170
+ When the Independent JPEG Group's software was first
171
+ released in 1991, the compression time for a
172
+ 1-megapixel JPEG image on a mainstream PC was measured
173
+ in minutes. Thus, the fast integer DCT algorithm
174
+ provided noticeable performance benefits. On modern
175
+ CPUs running libjpeg-turbo, however, the compression
176
+ time for a 1-megapixel JPEG image is measured in
177
+ milliseconds, and thus the performance benefits of the
178
+ fast algorithm are much less noticeable. On modern
179
+ x86/x86-64 CPUs that support AVX2 instructions, the
180
+ fast and int methods have similar performance. On
181
+ other types of CPUs, the fast method is generally about
182
+ 5-15% faster than the int method.
183
+
184
+ For quality levels of 90 and below, there should be
185
+ little or no perceptible quality difference between the
186
+ two algorithms. For quality levels above 90, however,
187
+ the difference between the fast and int methods becomes
188
+ more pronounced. With quality=97, for instance, the
189
+ fast method incurs generally about a 1-3 dB loss in
190
+ PSNR relative to the int method, but this can be larger
191
+ for some images. Do not use the fast method with
192
+ quality levels above 97. The algorithm often
193
+ degenerates at quality=98 and above and can actually
194
+ produce a more lossy image than if lower quality levels
195
+ had been used. Also, in libjpeg-turbo, the fast method
196
+ is not fully accelerated for quality levels above 97,
197
+ so it will be slower than the int method.
198
+ -dct float Use floating-point DCT method [legacy feature].
199
+ The float method does not produce significantly more
200
+ accurate results than the int method, and it is much
201
+ slower. The float method may also give different
202
+ results on different machines due to varying roundoff
203
+ behavior, whereas the integer methods should give the
204
+ same results on all machines.
205
+
206
+ -restart N Emit a JPEG restart marker every N MCU rows, or every
207
+ N MCU blocks if "B" is attached to the number.
208
+ -restart 0 (the default) means no restart markers.
209
+
210
+ -smooth N Smooth the input image to eliminate dithering noise.
211
+ N, ranging from 1 to 100, indicates the strength of
212
+ smoothing. 0 (the default) means no smoothing.
213
+
214
+ -maxmemory N Set limit for amount of memory to use in processing
215
+ large images. Value is in thousands of bytes, or
216
+ millions of bytes if "M" is attached to the number.
217
+ For example, -max 4m selects 4000000 bytes. If more
218
+ space is needed, an error will occur.
219
+
220
+ -verbose Enable debug printout. More -v's give more printout.
221
+ or -debug Also, version information is printed at startup.
222
+
223
+ The -restart option inserts extra markers that allow a JPEG decoder to
224
+ resynchronize after a transmission error. Without restart markers, any damage
225
+ to a compressed file will usually ruin the image from the point of the error
226
+ to the end of the image; with restart markers, the damage is usually confined
227
+ to the portion of the image up to the next restart marker. Of course, the
228
+ restart markers occupy extra space. We recommend -restart 1 for images that
229
+ will be transmitted across unreliable networks such as Usenet.
230
+
231
+ The -smooth option filters the input to eliminate fine-scale noise. This is
232
+ often useful when converting dithered images to JPEG: a moderate smoothing
233
+ factor of 10 to 50 gets rid of dithering patterns in the input file, resulting
234
+ in a smaller JPEG file and a better-looking image. Too large a smoothing
235
+ factor will visibly blur the image, however.
236
+
237
+ Switches for wizards:
238
+
239
+ -baseline Create baseline JPEG file (disable progressive coding)
240
+
241
+ -qtables file Use the quantization tables given in the specified
242
+ text file.
243
+
244
+ -qslots N[,...] Select which quantization table to use for each color
245
+ component.
246
+
247
+ -sample HxV[,...] Set JPEG sampling factors for each color component.
248
+
249
+ -scans file Use the scan script given in the specified text file.
250
+
251
+ The "wizard" switches are intended for experimentation with JPEG. If you
252
+ don't know what you are doing, DON'T USE THEM. These switches are documented
253
+ further in the file wizard.txt.
254
+
255
+
256
+ DJPEG DETAILS
257
+
258
+ The basic command line switches for djpeg are:
259
+
260
+ -colors N Reduce image to at most N colors. This reduces the
261
+ or -quantize N number of colors used in the output image, so that it
262
+ can be displayed on a colormapped display or stored in
263
+ a colormapped file format. For example, if you have
264
+ an 8-bit display, you'd need to reduce to 256 or fewer
265
+ colors. (-colors is the recommended name, -quantize
266
+ is provided only for backwards compatibility.)
267
+
268
+ -fast Select recommended processing options for fast, low
269
+ quality output. (The default options are chosen for
270
+ highest quality output.) Currently, this is equivalent
271
+ to "-dct fast -nosmooth -onepass -dither ordered".
272
+
273
+ -grayscale Force grayscale output even if JPEG file is color.
274
+ Useful for viewing on monochrome displays; also,
275
+ djpeg runs noticeably faster in this mode.
276
+
277
+ -rgb Force RGB output even if JPEG file is grayscale.
278
+
279
+ -scale M/N Scale the output image by a factor M/N. Currently
280
+ the scale factor must be M/8, where M is an integer
281
+ between 1 and 16 inclusive, or any reduced fraction
282
+ thereof (such as 1/2, 3/4, etc. Scaling is handy if
283
+ the image is larger than your screen; also, djpeg runs
284
+ much faster when scaling down the output.
285
+
286
+ -bmp Select BMP output format (Windows flavor). 8-bit
287
+ colormapped format is emitted if -colors or -grayscale
288
+ is specified, or if the JPEG file is grayscale;
289
+ otherwise, 24-bit full-color format is emitted.
290
+
291
+ -gif Select GIF output format (LZW-compressed). Since GIF
292
+ does not support more than 256 colors, -colors 256 is
293
+ assumed (unless you specify a smaller number of
294
+ colors). If you specify -fast, the default number of
295
+ colors is 216.
296
+
297
+ -gif0 Select GIF output format (uncompressed). Since GIF
298
+ does not support more than 256 colors, -colors 256 is
299
+ assumed (unless you specify a smaller number of
300
+ colors). If you specify -fast, the default number of
301
+ colors is 216.
302
+
303
+ -os2 Select BMP output format (OS/2 1.x flavor). 8-bit
304
+ colormapped format is emitted if -colors or -grayscale
305
+ is specified, or if the JPEG file is grayscale;
306
+ otherwise, 24-bit full-color format is emitted.
307
+
308
+ -pnm Select PBMPLUS (PPM/PGM) output format (this is the
309
+ default format). PGM is emitted if the JPEG file is
310
+ grayscale or if -grayscale is specified; otherwise
311
+ PPM is emitted.
312
+
313
+ -targa Select Targa output format. Grayscale format is
314
+ emitted if the JPEG file is grayscale or if
315
+ -grayscale is specified; otherwise, colormapped format
316
+ is emitted if -colors is specified; otherwise, 24-bit
317
+ full-color format is emitted.
318
+
319
+ Switches for advanced users:
320
+
321
+ -dct int Use accurate integer DCT method (default).
322
+ -dct fast Use less accurate integer DCT method [legacy feature].
323
+ When the Independent JPEG Group's software was first
324
+ released in 1991, the decompression time for a
325
+ 1-megapixel JPEG image on a mainstream PC was measured
326
+ in minutes. Thus, the fast integer DCT algorithm
327
+ provided noticeable performance benefits. On modern
328
+ CPUs running libjpeg-turbo, however, the decompression
329
+ time for a 1-megapixel JPEG image is measured in
330
+ milliseconds, and thus the performance benefits of the
331
+ fast algorithm are much less noticeable. On modern
332
+ x86/x86-64 CPUs that support AVX2 instructions, the
333
+ fast and int methods have similar performance. On
334
+ other types of CPUs, the fast method is generally about
335
+ 5-15% faster than the int method.
336
+
337
+ If the JPEG image was compressed using a quality level
338
+ of 85 or below, then there should be little or no
339
+ perceptible quality difference between the two
340
+ algorithms. When decompressing images that were
341
+ compressed using quality levels above 85, however, the
342
+ difference between the fast and int methods becomes
343
+ more pronounced. With images compressed using
344
+ quality=97, for instance, the fast method incurs
345
+ generally about a 4-6 dB loss in PSNR relative to the
346
+ int method, but this can be larger for some images. If
347
+ you can avoid it, do not use the fast method when
348
+ decompressing images that were compressed using quality
349
+ levels above 97. The algorithm often degenerates for
350
+ such images and can actually produce a more lossy
351
+ output image than if the JPEG image had been compressed
352
+ using lower quality levels.
353
+ -dct float Use floating-point DCT method [legacy feature].
354
+ The float method does not produce significantly more
355
+ accurate results than the int method, and it is much
356
+ slower. The float method may also give different
357
+ results on different machines due to varying roundoff
358
+ behavior, whereas the integer methods should give the
359
+ same results on all machines.
360
+
361
+ -dither fs Use Floyd-Steinberg dithering in color quantization.
362
+ -dither ordered Use ordered dithering in color quantization.
363
+ -dither none Do not use dithering in color quantization.
364
+ By default, Floyd-Steinberg dithering is applied when
365
+ quantizing colors; this is slow but usually produces
366
+ the best results. Ordered dither is a compromise
367
+ between speed and quality; no dithering is fast but
368
+ usually looks awful. Note that these switches have
369
+ no effect unless color quantization is being done.
370
+ Ordered dither is only available in -onepass mode.
371
+
372
+ -map FILE Quantize to the colors used in the specified image
373
+ file. This is useful for producing multiple files
374
+ with identical color maps, or for forcing a predefined
375
+ set of colors to be used. The FILE must be a GIF
376
+ or PPM file. This option overrides -colors and
377
+ -onepass.
378
+
379
+ -nosmooth Use a faster, lower-quality upsampling routine.
380
+
381
+ -onepass Use one-pass instead of two-pass color quantization.
382
+ The one-pass method is faster and needs less memory,
383
+ but it produces a lower-quality image. -onepass is
384
+ ignored unless you also say -colors N. Also,
385
+ the one-pass method is always used for grayscale
386
+ output (the two-pass method is no improvement then).
387
+
388
+ -maxmemory N Set limit for amount of memory to use in processing
389
+ large images. Value is in thousands of bytes, or
390
+ millions of bytes if "M" is attached to the number.
391
+ For example, -max 4m selects 4000000 bytes. If more
392
+ space is needed, an error will occur.
393
+
394
+ -verbose Enable debug printout. More -v's give more printout.
395
+ or -debug Also, version information is printed at startup.
396
+
397
+
398
+ HINTS FOR CJPEG
399
+
400
+ Color GIF files are not the ideal input for JPEG; JPEG is really intended for
401
+ compressing full-color (24-bit) images. In particular, don't try to convert
402
+ cartoons, line drawings, and other images that have only a few distinct
403
+ colors. GIF works great on these, JPEG does not. If you want to convert a
404
+ GIF to JPEG, you should experiment with cjpeg's -quality and -smooth options
405
+ to get a satisfactory conversion. -smooth 10 or so is often helpful.
406
+
407
+ Avoid running an image through a series of JPEG compression/decompression
408
+ cycles. Image quality loss will accumulate; after ten or so cycles the image
409
+ may be noticeably worse than it was after one cycle. It's best to use a
410
+ lossless format while manipulating an image, then convert to JPEG format when
411
+ you are ready to file the image away.
412
+
413
+ The -optimize option to cjpeg is worth using when you are making a "final"
414
+ version for posting or archiving. It's also a win when you are using low
415
+ quality settings to make very small JPEG files; the percentage improvement
416
+ is often a lot more than it is on larger files. (At present, -optimize
417
+ mode is always selected when generating progressive JPEG files.)
418
+
419
+
420
+ HINTS FOR DJPEG
421
+
422
+ To get a quick preview of an image, use the -grayscale and/or -scale switches.
423
+ "-grayscale -scale 1/8" is the fastest case.
424
+
425
+ Several options are available that trade off image quality to gain speed.
426
+ "-fast" turns on the recommended settings.
427
+
428
+ "-dct fast" and/or "-nosmooth" gain speed at a small sacrifice in quality.
429
+ When producing a color-quantized image, "-onepass -dither ordered" is fast but
430
+ much lower quality than the default behavior. "-dither none" may give
431
+ acceptable results in two-pass mode, but is seldom tolerable in one-pass mode.
432
+
433
+
434
+ HINTS FOR BOTH PROGRAMS
435
+
436
+ If the memory needed by cjpeg or djpeg exceeds the limit specified by
437
+ -maxmemory, an error will occur. You can leave out -progressive and -optimize
438
+ (for cjpeg) or specify -onepass (for djpeg) to reduce memory usage.
439
+
440
+ On machines that have "environment" variables, you can define the environment
441
+ variable JPEGMEM to set the default memory limit. The value is specified as
442
+ described for the -maxmemory switch. JPEGMEM overrides the default value
443
+ specified when the program was compiled, and itself is overridden by an
444
+ explicit -maxmemory switch.
445
+
446
+
447
+ JPEGTRAN
448
+
449
+ jpegtran performs various useful transformations of JPEG files.
450
+ It can translate the coded representation from one variant of JPEG to another,
451
+ for example from baseline JPEG to progressive JPEG or vice versa. It can also
452
+ perform some rearrangements of the image data, for example turning an image
453
+ from landscape to portrait format by rotation. For EXIF files and JPEG files
454
+ containing Exif data, you may prefer to use exiftran instead.
455
+
456
+ jpegtran works by rearranging the compressed data (DCT coefficients), without
457
+ ever fully decoding the image. Therefore, its transformations are lossless:
458
+ there is no image degradation at all, which would not be true if you used
459
+ djpeg followed by cjpeg to accomplish the same conversion. But by the same
460
+ token, jpegtran cannot perform lossy operations such as changing the image
461
+ quality. However, while the image data is losslessly transformed, metadata
462
+ can be removed. See the -copy option for specifics.
463
+
464
+ jpegtran uses a command line syntax similar to cjpeg or djpeg.
465
+ On most systems, you say:
466
+ jpegtran [switches] [inputfile] >outputfile
467
+ If you defined TWO_FILE_COMMANDLINE when compiling the program, you can instead
468
+ say:
469
+ jpegtran [switches] inputfile outputfile
470
+ where both the input and output files are JPEG files.
471
+
472
+ To specify the coded JPEG representation used in the output file,
473
+ jpegtran accepts a subset of the switches recognized by cjpeg:
474
+ -optimize Perform optimization of entropy encoding parameters.
475
+ -progressive Create progressive JPEG file.
476
+ -arithmetic Use arithmetic coding.
477
+ -restart N Emit a JPEG restart marker every N MCU rows, or every
478
+ N MCU blocks if "B" is attached to the number.
479
+ -scans file Use the scan script given in the specified text file.
480
+ See the previous discussion of cjpeg for more details about these switches.
481
+ If you specify none of these switches, you get a plain baseline-JPEG output
482
+ file. The quality setting and so forth are determined by the input file.
483
+
484
+ The image can be losslessly transformed by giving one of these switches:
485
+ -flip horizontal Mirror image horizontally (left-right).
486
+ -flip vertical Mirror image vertically (top-bottom).
487
+ -rotate 90 Rotate image 90 degrees clockwise.
488
+ -rotate 180 Rotate image 180 degrees.
489
+ -rotate 270 Rotate image 270 degrees clockwise (or 90 ccw).
490
+ -transpose Transpose image (across UL-to-LR axis).
491
+ -transverse Transverse transpose (across UR-to-LL axis).
492
+
493
+ The transpose transformation has no restrictions regarding image dimensions.
494
+ The other transformations operate rather oddly if the image dimensions are not
495
+ a multiple of the iMCU size (usually 8 or 16 pixels), because they can only
496
+ transform complete blocks of DCT coefficient data in the desired way.
497
+
498
+ jpegtran's default behavior when transforming an odd-size image is designed
499
+ to preserve exact reversibility and mathematical consistency of the
500
+ transformation set. As stated, transpose is able to flip the entire image
501
+ area. Horizontal mirroring leaves any partial iMCU column at the right edge
502
+ untouched, but is able to flip all rows of the image. Similarly, vertical
503
+ mirroring leaves any partial iMCU row at the bottom edge untouched, but is
504
+ able to flip all columns. The other transforms can be built up as sequences
505
+ of transpose and flip operations; for consistency, their actions on edge
506
+ pixels are defined to be the same as the end result of the corresponding
507
+ transpose-and-flip sequence.
508
+
509
+ For practical use, you may prefer to discard any untransformable edge pixels
510
+ rather than having a strange-looking strip along the right and/or bottom edges
511
+ of a transformed image. To do this, add the -trim switch:
512
+ -trim Drop non-transformable edge blocks.
513
+ Obviously, a transformation with -trim is not reversible, so strictly speaking
514
+ jpegtran with this switch is not lossless. Also, the expected mathematical
515
+ equivalences between the transformations no longer hold. For example,
516
+ "-rot 270 -trim" trims only the bottom edge, but "-rot 90 -trim" followed by
517
+ "-rot 180 -trim" trims both edges.
518
+
519
+ If you are only interested in perfect transformations, add the -perfect switch:
520
+ -perfect Fail with an error if the transformation is not
521
+ perfect.
522
+ For example, you may want to do
523
+ jpegtran -rot 90 -perfect foo.jpg || djpeg foo.jpg | pnmflip -r90 | cjpeg
524
+ to do a perfect rotation, if available, or an approximated one if not.
525
+
526
+ This version of jpegtran also offers a lossless crop option, which discards
527
+ data outside of a given image region but losslessly preserves what is inside.
528
+ Like the rotate and flip transforms, lossless crop is restricted by the current
529
+ JPEG format; the upper left corner of the selected region must fall on an iMCU
530
+ boundary. If it doesn't, then it is silently moved up and/or left to the
531
+ nearest iMCU boundary (the lower right corner is unchanged.) Thus, the output
532
+ image covers at least the requested region, but it may cover more. The
533
+ adjustment of the region dimensions may be optionally disabled by attaching an
534
+ 'f' character ("force") to the width or height number.
535
+
536
+ The image can be losslessly cropped by giving the switch:
537
+ -crop WxH+X+Y Crop to a rectangular region of width W and height H,
538
+ starting at point X,Y.
539
+
540
+ If W or H is larger than the width/height of the input image, then the output
541
+ image is expanded in size, and the expanded region is filled in with zeros
542
+ (neutral gray). Attaching an 'f' character ("flatten") to the width number
543
+ will cause each block in the expanded region to be filled in with the DC
544
+ coefficient of the nearest block in the input image rather than grayed out.
545
+ Attaching an 'r' character ("reflect") to the width number will cause the
546
+ expanded region to be filled in with repeated reflections of the input image
547
+ rather than grayed out.
548
+
549
+ A complementary lossless wipe option is provided to discard (gray out) data
550
+ inside a given image region while losslessly preserving what is outside:
551
+ -wipe WxH+X+Y Wipe (gray out) a rectangular region of width W and
552
+ height H from the input image, starting at point X,Y.
553
+
554
+ Attaching an 'f' character ("flatten") to the width number will cause the
555
+ region to be filled with the average of adjacent blocks rather than grayed out.
556
+ If the wipe region and the region outside the wipe region, when adjusted to the
557
+ nearest iMCU boundary, form two horizontally adjacent rectangles, then
558
+ attaching an 'r' character ("reflect") to the width number will cause the wipe
559
+ region to be filled with repeated reflections of the outside region rather than
560
+ grayed out.
561
+
562
+ A lossless drop option is also provided, which allows another JPEG image to be
563
+ inserted ("dropped") into the input image data at a given position, replacing
564
+ the existing image data at that position:
565
+ -drop +X+Y filename Drop (insert) another image at point X,Y
566
+
567
+ Both the input image and the drop image must have the same subsampling level.
568
+ It is best if they also have the same quantization (quality.) Otherwise, the
569
+ quantization of the output image will be adapted to accommodate the higher of
570
+ the input image quality and the drop image quality. The trim option can be
571
+ used with the drop option to requantize the drop image to match the input
572
+ image. Note that a grayscale image can be dropped into a full-color image or
573
+ vice versa, as long as the full-color image has no vertical subsampling. If
574
+ the input image is grayscale and the drop image is full-color, then the
575
+ chrominance channels from the drop image will be discarded.
576
+
577
+ Other not-strictly-lossless transformation switches are:
578
+
579
+ -grayscale Force grayscale output.
580
+ This option discards the chrominance channels if the input image is YCbCr
581
+ (ie, a standard color JPEG), resulting in a grayscale JPEG file. The
582
+ luminance channel is preserved exactly, so this is a better method of reducing
583
+ to grayscale than decompression, conversion, and recompression. This switch
584
+ is particularly handy for fixing a monochrome picture that was mistakenly
585
+ encoded as a color JPEG. (In such a case, the space savings from getting rid
586
+ of the near-empty chroma channels won't be large; but the decoding time for
587
+ a grayscale JPEG is substantially less than that for a color JPEG.)
588
+
589
+ jpegtran also recognizes these switches that control what to do with "extra"
590
+ markers, such as comment blocks:
591
+ -copy none Copy no extra markers from source file. This setting
592
+ suppresses all comments and other metadata in the
593
+ source file.
594
+ -copy comments Copy only comment markers. This setting copies
595
+ comments from the source file but discards any other
596
+ metadata.
597
+ -copy icc Copy only ICC profile markers. This setting copies the
598
+ ICC profile from the source file but discards any other
599
+ metadata.
600
+ -copy all Copy all extra markers. This setting preserves
601
+ miscellaneous markers found in the source file, such
602
+ as JFIF thumbnails, Exif data, and Photoshop settings.
603
+ In some files, these extra markers can be sizable.
604
+ Note that this option will copy thumbnails as-is;
605
+ they will not be transformed.
606
+ The default behavior is -copy comments. (Note: in IJG releases v6 and v6a,
607
+ jpegtran always did the equivalent of -copy none.)
608
+
609
+ Additional switches recognized by jpegtran are:
610
+ -outfile filename
611
+ -maxmemory N
612
+ -verbose
613
+ -debug
614
+ These work the same as in cjpeg or djpeg.
615
+
616
+
617
+ THE COMMENT UTILITIES
618
+
619
+ The JPEG standard allows "comment" (COM) blocks to occur within a JPEG file.
620
+ Although the standard doesn't actually define what COM blocks are for, they
621
+ are widely used to hold user-supplied text strings. This lets you add
622
+ annotations, titles, index terms, etc to your JPEG files, and later retrieve
623
+ them as text. COM blocks do not interfere with the image stored in the JPEG
624
+ file. The maximum size of a COM block is 64K, but you can have as many of
625
+ them as you like in one JPEG file.
626
+
627
+ We provide two utility programs to display COM block contents and add COM
628
+ blocks to a JPEG file.
629
+
630
+ rdjpgcom searches a JPEG file and prints the contents of any COM blocks on
631
+ standard output. The command line syntax is
632
+ rdjpgcom [-raw] [-verbose] [inputfilename]
633
+ The switch "-raw" (or just "-r") causes rdjpgcom to output non-printable
634
+ characters in JPEG comments. These characters are normally escaped for
635
+ security reasons.
636
+ The switch "-verbose" (or just "-v") causes rdjpgcom to also display the JPEG
637
+ image dimensions. If you omit the input file name from the command line,
638
+ the JPEG file is read from standard input. (This may not work on some
639
+ operating systems, if binary data can't be read from stdin.)
640
+
641
+ wrjpgcom adds a COM block, containing text you provide, to a JPEG file.
642
+ Ordinarily, the COM block is added after any existing COM blocks, but you
643
+ can delete the old COM blocks if you wish. wrjpgcom produces a new JPEG
644
+ file; it does not modify the input file. DO NOT try to overwrite the input
645
+ file by directing wrjpgcom's output back into it; on most systems this will
646
+ just destroy your file.
647
+
648
+ The command line syntax for wrjpgcom is similar to cjpeg's. On most systems,
649
+ it is
650
+ wrjpgcom [switches] [inputfilename]
651
+ The output file is written to standard output. The input file comes from
652
+ the named file, or from standard input if no input file is named.
653
+
654
+ If you defined TWO_FILE_COMMANDLINE when compiling the program, the syntax is:
655
+ wrjpgcom [switches] inputfilename outputfilename
656
+ where both input and output file names must be given explicitly.
657
+
658
+ wrjpgcom understands three switches:
659
+ -replace Delete any existing COM blocks from the file.
660
+ -comment "Comment text" Supply new COM text on command line.
661
+ -cfile name Read text for new COM block from named file.
662
+ (Switch names can be abbreviated.) If you have only one line of comment text
663
+ to add, you can provide it on the command line with -comment. The comment
664
+ text must be surrounded with quotes so that it is treated as a single
665
+ argument. Longer comments can be read from a text file.
666
+
667
+ If you give neither -comment nor -cfile, then wrjpgcom will read the comment
668
+ text from standard input. (In this case an input image file name MUST be
669
+ supplied, so that the source JPEG file comes from somewhere else.) You can
670
+ enter multiple lines, up to 64KB worth. Type an end-of-file indicator
671
+ (usually control-D or control-Z) to terminate the comment text entry.
672
+
673
+ wrjpgcom will not add a COM block if the provided comment string is empty.
674
+ Therefore -replace -comment "" can be used to delete all COM blocks from a
675
+ file.
676
+
677
+ These utility programs do not depend on the IJG JPEG library. In
678
+ particular, the source code for rdjpgcom is intended as an illustration of
679
+ the minimum amount of code required to parse a JPEG file header correctly.