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,132 @@
1
+ libjpeg-turbo Licenses
2
+ ======================
3
+
4
+ libjpeg-turbo is covered by three compatible BSD-style open source licenses:
5
+
6
+ - The IJG (Independent JPEG Group) License, which is listed in
7
+ [README.ijg](README.ijg)
8
+
9
+ This license applies to the libjpeg API library and associated programs
10
+ (any code inherited from libjpeg, and any modifications to that code.)
11
+
12
+ - The Modified (3-clause) BSD License, which is listed below
13
+
14
+ This license covers the TurboJPEG API library and associated programs, as
15
+ well as the build system.
16
+
17
+ - The [zlib License](https://opensource.org/licenses/Zlib)
18
+
19
+ This license is a subset of the other two, and it covers the libjpeg-turbo
20
+ SIMD extensions.
21
+
22
+
23
+ Complying with the libjpeg-turbo Licenses
24
+ =========================================
25
+
26
+ This section provides a roll-up of the libjpeg-turbo licensing terms, to the
27
+ best of our understanding.
28
+
29
+ 1. If you are distributing a modified version of the libjpeg-turbo source,
30
+ then:
31
+
32
+ 1. You cannot alter or remove any existing copyright or license notices
33
+ from the source.
34
+
35
+ **Origin**
36
+ - Clause 1 of the IJG License
37
+ - Clause 1 of the Modified BSD License
38
+ - Clauses 1 and 3 of the zlib License
39
+
40
+ 2. You must add your own copyright notice to the header of each source
41
+ file you modified, so others can tell that you modified that file (if
42
+ there is not an existing copyright header in that file, then you can
43
+ simply add a notice stating that you modified the file.)
44
+
45
+ **Origin**
46
+ - Clause 1 of the IJG License
47
+ - Clause 2 of the zlib License
48
+
49
+ 3. You must include the IJG README file, and you must not alter any of the
50
+ copyright or license text in that file.
51
+
52
+ **Origin**
53
+ - Clause 1 of the IJG License
54
+
55
+ 2. If you are distributing only libjpeg-turbo binaries without the source, or
56
+ if you are distributing an application that statically links with
57
+ libjpeg-turbo, then:
58
+
59
+ 1. Your product documentation must include a message stating:
60
+
61
+ This software is based in part on the work of the Independent JPEG
62
+ Group.
63
+
64
+ **Origin**
65
+ - Clause 2 of the IJG license
66
+
67
+ 2. If your binary distribution includes or uses the TurboJPEG API, then
68
+ your product documentation must include the text of the Modified BSD
69
+ License (see below.)
70
+
71
+ **Origin**
72
+ - Clause 2 of the Modified BSD License
73
+
74
+ 3. You cannot use the name of the IJG or The libjpeg-turbo Project or the
75
+ contributors thereof in advertising, publicity, etc.
76
+
77
+ **Origin**
78
+ - IJG License
79
+ - Clause 3 of the Modified BSD License
80
+
81
+ 4. The IJG and The libjpeg-turbo Project do not warrant libjpeg-turbo to be
82
+ free of defects, nor do we accept any liability for undesirable
83
+ consequences resulting from your use of the software.
84
+
85
+ **Origin**
86
+ - IJG License
87
+ - Modified BSD License
88
+ - zlib License
89
+
90
+
91
+ The Modified (3-clause) BSD License
92
+ ===================================
93
+
94
+ Copyright (C)2009-2023 D. R. Commander. All Rights Reserved.<br>
95
+ Copyright (C)2015 Viktor Szathmáry. All Rights Reserved.
96
+
97
+ Redistribution and use in source and binary forms, with or without
98
+ modification, are permitted provided that the following conditions are met:
99
+
100
+ - Redistributions of source code must retain the above copyright notice,
101
+ this list of conditions and the following disclaimer.
102
+ - Redistributions in binary form must reproduce the above copyright notice,
103
+ this list of conditions and the following disclaimer in the documentation
104
+ and/or other materials provided with the distribution.
105
+ - Neither the name of the libjpeg-turbo Project nor the names of its
106
+ contributors may be used to endorse or promote products derived from this
107
+ software without specific prior written permission.
108
+
109
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS",
110
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
111
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
112
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
113
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
114
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
115
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
116
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
117
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
118
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
119
+ POSSIBILITY OF SUCH DAMAGE.
120
+
121
+
122
+ Why Three Licenses?
123
+ ===================
124
+
125
+ The zlib License could have been used instead of the Modified (3-clause) BSD
126
+ License, and since the IJG License effectively subsumes the distribution
127
+ conditions of the zlib License, this would have effectively placed
128
+ libjpeg-turbo binary distributions under the IJG License. However, the IJG
129
+ License specifically refers to the Independent JPEG Group and does not extend
130
+ attribution and endorsement protections to other entities. Thus, it was
131
+ desirable to choose a license that granted us the same protections for new code
132
+ that were granted to the IJG for code derived from their software.
@@ -0,0 +1,194 @@
1
+ Mozilla JPEG Encoder Project
2
+ ============================
3
+
4
+ mozjpeg is a fork of libjpeg-turbo that aims to speed up load times of web
5
+ pages by reducing the size (and, by extension, the transmission time) of JPEG
6
+ files. It accomplishes this by enabling optimized Huffman trees and
7
+ progressive entropy coding by default in the JPEG compressor, as well as
8
+ splitting the spectrum of DCT coefficients into separate scans and using
9
+ Trellis quantisation.
10
+
11
+ Although it is based on libjpeg-turbo, mozjpeg is not intended to be a
12
+ general-purpose or high-performance JPEG library. Its performance is highly
13
+ "asymmetric". That is, the JPEG files it generates require much more time to
14
+ compress than to decompress. When the default settings are used, mozjpeg is
15
+ considerably slower than libjpeg-turbo or even libjpeg at compressing images.
16
+ Thus, it is not generally suitable for real-time compression. It is best used
17
+ as part of a web encoding workflow.
18
+
19
+
20
+ libjpeg API Extensibility Framework
21
+ ===================================
22
+
23
+ mozjpeg's implementation of the libjpeg API includes an extensibility framework
24
+ that allows new features to be added without modifying the transparent libjpeg
25
+ compress/decompress structures (which would break backward ABI compatibility.)
26
+ Extension parameters are placed into the opaque jpeg_comp_master structure, and
27
+ a set of accessor functions and globally unique tokens allows for
28
+ getting/setting those parameters without directly accessing the structure.
29
+
30
+ Currently, only the accessor functions necessary to support the mozjpeg
31
+ extensions are implemented, but the framework can be easily extended in the
32
+ future to accommodate additional simple parameter types, complex or
33
+ multi-valued parameters, or decompressor extensions.
34
+
35
+
36
+ The currently-implemented accessor functions are as follows:
37
+
38
+ boolean jpeg_c_bool_param_supported (j_compress_ptr cinfo,
39
+ J_BOOLEAN_PARAM param)
40
+ Returns TRUE if the given boolean extension parameter is supported by
41
+ this implementation of the libjpeg API, or FALSE otherwise.
42
+
43
+ void jpeg_c_set_bool_param (j_compress_ptr cinfo,
44
+ J_BOOLEAN_PARAM param, boolean value);
45
+ Set the given boolean extension parameter to the given value (TRUE or
46
+ FALSE.)
47
+
48
+ boolean jpeg_c_get_bool_param (j_compress_ptr cinfo, J_BOOLEAN_PARAM param)
49
+ Get the value of the given boolean extension parameter (TRUE or FALSE.)
50
+
51
+ boolean jpeg_c_float_param_supported (j_compress_ptr cinfo,
52
+ J_FLOAT_PARAM param)
53
+ Returns TRUE if the given floating point extension parameter is
54
+ supported by this implementation of the libjpeg API, or FALSE
55
+ otherwise.
56
+
57
+ void jpeg_c_set_float_param (j_compress_ptr cinfo, J_FLOAT_PARAM param,
58
+ float value)
59
+ Set the given floating point extension parameter to the given value.
60
+
61
+ float jpeg_c_get_float_param (j_compress_ptr cinfo, J_FLOAT_PARAM param);
62
+ Get the value of the given floating point extension parameter.
63
+
64
+ boolean jpeg_c_int_param_supported (j_compress_ptr cinfo,
65
+ J_INT_PARAM param)
66
+ Returns TRUE if the given integer extension parameter is supported by
67
+ this implementation of the libjpeg API, or FALSE otherwise.
68
+
69
+ void jpeg_c_set_int_param (j_compress_ptr cinfo, J_INT_PARAM param,
70
+ int value)
71
+ Set the given integer extension parameter to the given value.
72
+
73
+ int jpeg_c_get_int_param (j_compress_ptr cinfo, J_INT_PARAM param)
74
+ Get the value of the given integer extension parameter.
75
+
76
+
77
+ Boolean Extension Parameters Supported by mozjpeg
78
+ -------------------------------------------------
79
+
80
+ * JBOOLEAN_OPTIMIZE_SCANS (default: TRUE)
81
+ Specifies whether scan parameters should be optimized. Parameter
82
+ optimization is done as in jpgcrush. jpeg_simple_progression() should be called
83
+ after setting JBOOLEAN_OPTIMIZE_SCANS.
84
+ When disabling JBOOLEAN_OPTIMIZE_SCANS, cinfo.scan_info should additionally be
85
+ set to NULL to disable use of the progressive coding mode, if so desired.
86
+
87
+ * JBOOLEAN_TRELLIS_QUANT (default: TRUE)
88
+ Specifies whether to apply trellis quantization. For each 8x8 block, trellis
89
+ quantization determines the best tradeoff between rate and distortion.
90
+
91
+ * JBOOLEAN_TRELLIS_QUANT_DC (default: TRUE)
92
+ Specifies whether to apply trellis quantization to DC coefficients.
93
+
94
+ * JBOOLEAN_TRELLIS_EOB_OPT (default: FALSE)
95
+ Specifies whether to optimize runs of zero blocks in trellis quantization.
96
+ This is applicable only when JBOOLEAN_USE_SCANS_IN_TRELLIS is enabled.
97
+
98
+ * JBOOLEAN_USE_LAMBDA_WEIGHT_TBL currently has no effect.
99
+
100
+ * JBOOLEAN_USE_SCANS_IN_TRELLIS (default: FALSE)
101
+ Specifies whether multiple scans should be considered during trellis
102
+ quantization.
103
+
104
+ * JBOOLEAN_TRELLIS_Q_OPT (default: FALSE)
105
+ Specifies whether to optimize the quantization table after trellis
106
+ quantization. If enabled, then a revised quantization table is derived so
107
+ as to minimize the reconstruction error of the quantized coefficients.
108
+
109
+ * JBOOLEAN_OVERSHOOT_DERINGING (default: TRUE)
110
+ Specifies whether overshooting is applied to samples with extreme values
111
+ (for example, 0 and 255 for 8-bit samples). Overshooting may reduce ringing
112
+ artifacts from compression, in particular in areas where black text appears
113
+ on a white background.
114
+
115
+
116
+ Floating Point Extension Parameters Supported by mozjpeg
117
+ --------------------------------------------------------
118
+
119
+ * JFLOAT_LAMBDA_LOG_SCALE1 (default: 14.75)
120
+ JFLOAT_LAMBDA_LOG_SCALE2 (default: 16.5)
121
+ These parameters specify the lambda value used in trellis quantization. The
122
+ lambda value (Lagrange multiplier) in the
123
+ R + lambda * D
124
+ equation is derived from
125
+ lambda = 2^s1 / ((2^s2 + n) * q^2),
126
+ where s1 and s2 are the values of JFLOAT_LAMBDA_LOG_SCALE1 and
127
+ JFLOAT_LAMBDA_LOG_SCALE2, n is the average of the squared unquantized AC
128
+ coefficients within the current 8x8 block, and q is the quantization table
129
+ entry associated with the current coefficient frequency. If
130
+ JFLOAT_LAMBDA_LOG_SCALE2 is 0, then an alternate form is used that does not
131
+ rely on n:
132
+ lambda = 2^(s1-12) / q^2.
133
+
134
+ * JFLOAT_TRELLIS_DELTA_DC_WEIGHT (default: 0.0)
135
+ This parameter controls how distortion is calculated in DC trellis quantization
136
+ (enabled with JBOOLEAN_TRELLIS_QUANT_DC). It defines weighting between distortion
137
+ of the DC coefficient and distortion of the vertical gradient of DC coefficients.
138
+ The value of the parameter corresponds to the weight applied to the distortion
139
+ of the vertical gradient.
140
+
141
+
142
+ Integer Extension Parameters Supported by mozjpeg
143
+ -------------------------------------------------
144
+
145
+ * JINT_COMPRESS_PROFILE (default: JCP_MAX_COMPRESSION)
146
+ Select a compression profile, which is a set of default parameters that will
147
+ achieve a desired compression goal. This parameter controls the behavior of
148
+ the jpeg_set_defaults() function. Thus, setting JINT_COMPRESS_PROFILE does
149
+ not cause any other parameters to be modified until jpeg_set_defaults() is
150
+ called. The following compression profiles are supported:
151
+
152
+ - JCP_MAX_COMPRESSION (default)
153
+ Increase the compression ratio as much as possible, at the expense of
154
+ increased encoding time. This enables progressive entropy coding and all
155
+ mozjpeg extensions.
156
+
157
+ - JCP_FASTEST
158
+ Use the libjpeg[-turbo] defaults (baseline entropy coding, no mozjpeg
159
+ extensions enabled.)
160
+
161
+ * JINT_TRELLIS_FREQ_SPLIT (default: 8)
162
+ Specifies the position within the zigzag scan at which the split between
163
+ scans is positioned in the context of trellis quantization.
164
+ JBOOLEAN_USE_SCANS_IN_TRELLIS must be enabled for this parameter to have any
165
+ effect.
166
+
167
+ * JINT_TRELLIS_NUM_LOOPS (default: 1)
168
+ Specifies the number of trellis quantization passes. Huffman tables are
169
+ updated between passes.
170
+
171
+ * JINT_BASE_QUANT_TBL_IDX (default: 3)
172
+ Specifies which quantization table set to use. The following options are
173
+ available:
174
+ 0 = Tables from JPEG Annex K
175
+ 1 = Flat table
176
+ 2 = Table tuned for MSSIM on Kodak image set
177
+ 3 = Table from http://www.imagemagick.org/discourse-server/viewtopic.php?f=22&t=20333&p=98008#p98008
178
+ 4 = Table tuned for PSNR-HVS-M on Kodak image set
179
+ 5 = Table from: Relevance of Human Vision to JPEG-DCT Compression
180
+ (1992) Klein, Silverstein and Carney
181
+ 6 = Table from: DCTune Perceptual Optimization of Compressed Dental X-Rays
182
+ (1997) Watson, Taylor, Borthwick
183
+ 7 = Table from: A Visual Detection Model for DCT Coefficient Quantization
184
+ (12/9/93) Ahumada, Watson, Peterson
185
+ 8 = Table from: An Improved Detection Model for DCT Coefficient Quantization
186
+ (1993) Peterson, Ahumada and Watson
187
+
188
+ * JINT_DC_SCAN_OPT_MODE (default: 0)
189
+ Specifies the DC scan optimization mode. The following options are
190
+ available:
191
+ 0 = One scan for all components
192
+ 1 = One scan per component
193
+ 2 = Optimize between one scan for all components and one scan for the first
194
+ component plus one scan for the remaining components
@@ -0,0 +1,346 @@
1
+ Background
2
+ ==========
3
+
4
+ libjpeg-turbo is a JPEG image codec that uses SIMD instructions (MMX, SSE2,
5
+ AVX2, NEON, AltiVec) to accelerate baseline JPEG compression and decompression
6
+ on x86, x86-64, ARM, and PowerPC systems, as well as progressive JPEG
7
+ compression on x86 and x86-64 systems. On such systems, libjpeg-turbo is
8
+ generally 2-6x as fast as libjpeg, all else being equal. On other types of
9
+ systems, libjpeg-turbo can still outperform libjpeg by a significant amount, by
10
+ virtue of its highly-optimized Huffman coding routines. In many cases, the
11
+ performance of libjpeg-turbo rivals that of proprietary high-speed JPEG codecs.
12
+
13
+ libjpeg-turbo implements both the traditional libjpeg API as well as the less
14
+ powerful but more straightforward TurboJPEG API. libjpeg-turbo also features
15
+ colorspace extensions that allow it to compress from/decompress to 32-bit and
16
+ big-endian pixel buffers (RGBX, XBGR, etc.), as well as a full-featured Java
17
+ interface.
18
+
19
+ libjpeg-turbo was originally based on libjpeg/SIMD, an MMX-accelerated
20
+ derivative of libjpeg v6b developed by Miyasaka Masaru. The TigerVNC and
21
+ VirtualGL projects made numerous enhancements to the codec in 2009, and in
22
+ early 2010, libjpeg-turbo spun off into an independent project, with the goal
23
+ of making high-speed JPEG compression/decompression technology available to a
24
+ broader range of users and developers.
25
+
26
+
27
+ License
28
+ =======
29
+
30
+ libjpeg-turbo is covered by three compatible BSD-style open source licenses.
31
+ Refer to [LICENSE.md](LICENSE.md) for a roll-up of license terms.
32
+
33
+
34
+ Building libjpeg-turbo
35
+ ======================
36
+
37
+ Refer to [BUILDING.md](BUILDING.md) for complete instructions.
38
+
39
+
40
+ Using libjpeg-turbo
41
+ ===================
42
+
43
+ libjpeg-turbo includes two APIs that can be used to compress and decompress
44
+ JPEG images:
45
+
46
+ - **TurboJPEG API**<br>
47
+ This API provides an easy-to-use interface for compressing and decompressing
48
+ JPEG images in memory. It also provides some functionality that would not be
49
+ straightforward to achieve using the underlying libjpeg API, such as
50
+ generating planar YUV images and performing multiple simultaneous lossless
51
+ transforms on an image. The Java interface for libjpeg-turbo is written on
52
+ top of the TurboJPEG API. The TurboJPEG API is recommended for first-time
53
+ users of libjpeg-turbo. Refer to [tjexample.c](tjexample.c) and
54
+ [TJExample.java](java/TJExample.java) for examples of its usage and to
55
+ <http://libjpeg-turbo.org/Documentation/Documentation> for API documentation.
56
+
57
+ - **libjpeg API**<br>
58
+ This is the de facto industry-standard API for compressing and decompressing
59
+ JPEG images. It is more difficult to use than the TurboJPEG API but also
60
+ more powerful. The libjpeg API implementation in libjpeg-turbo is both
61
+ API/ABI-compatible and mathematically compatible with libjpeg v6b. It can
62
+ also optionally be configured to be API/ABI-compatible with libjpeg v7 and v8
63
+ (see below.) Refer to [cjpeg.c](cjpeg.c) and [djpeg.c](djpeg.c) for examples
64
+ of its usage and to [libjpeg.txt](libjpeg.txt) for API documentation.
65
+
66
+ There is no significant performance advantage to either API when both are used
67
+ to perform similar operations.
68
+
69
+ Colorspace Extensions
70
+ ---------------------
71
+
72
+ libjpeg-turbo includes extensions that allow JPEG images to be compressed
73
+ directly from (and decompressed directly to) buffers that use BGR, BGRX,
74
+ RGBX, XBGR, and XRGB pixel ordering. This is implemented with ten new
75
+ colorspace constants:
76
+
77
+ JCS_EXT_RGB /* red/green/blue */
78
+ JCS_EXT_RGBX /* red/green/blue/x */
79
+ JCS_EXT_BGR /* blue/green/red */
80
+ JCS_EXT_BGRX /* blue/green/red/x */
81
+ JCS_EXT_XBGR /* x/blue/green/red */
82
+ JCS_EXT_XRGB /* x/red/green/blue */
83
+ JCS_EXT_RGBA /* red/green/blue/alpha */
84
+ JCS_EXT_BGRA /* blue/green/red/alpha */
85
+ JCS_EXT_ABGR /* alpha/blue/green/red */
86
+ JCS_EXT_ARGB /* alpha/red/green/blue */
87
+
88
+ Setting `cinfo.in_color_space` (compression) or `cinfo.out_color_space`
89
+ (decompression) to one of these values will cause libjpeg-turbo to read the
90
+ red, green, and blue values from (or write them to) the appropriate position in
91
+ the pixel when compressing from/decompressing to an RGB buffer.
92
+
93
+ Your application can check for the existence of these extensions at compile
94
+ time with:
95
+
96
+ #ifdef JCS_EXTENSIONS
97
+
98
+ At run time, attempting to use these extensions with a libjpeg implementation
99
+ that does not support them will result in a "Bogus input colorspace" error.
100
+ Applications can trap this error in order to test whether run-time support is
101
+ available for the colorspace extensions.
102
+
103
+ When using the RGBX, BGRX, XBGR, and XRGB colorspaces during decompression, the
104
+ X byte is undefined, and in order to ensure the best performance, libjpeg-turbo
105
+ can set that byte to whatever value it wishes. If an application expects the X
106
+ byte to be used as an alpha channel, then it should specify `JCS_EXT_RGBA`,
107
+ `JCS_EXT_BGRA`, `JCS_EXT_ABGR`, or `JCS_EXT_ARGB`. When these colorspace
108
+ constants are used, the X byte is guaranteed to be 0xFF, which is interpreted
109
+ as opaque.
110
+
111
+ Your application can check for the existence of the alpha channel colorspace
112
+ extensions at compile time with:
113
+
114
+ #ifdef JCS_ALPHA_EXTENSIONS
115
+
116
+ [jcstest.c](jcstest.c), located in the libjpeg-turbo source tree, demonstrates
117
+ how to check for the existence of the colorspace extensions at compile time and
118
+ run time.
119
+
120
+ libjpeg v7 and v8 API/ABI Emulation
121
+ -----------------------------------
122
+
123
+ With libjpeg v7 and v8, new features were added that necessitated extending the
124
+ compression and decompression structures. Unfortunately, due to the exposed
125
+ nature of those structures, extending them also necessitated breaking backward
126
+ ABI compatibility with previous libjpeg releases. Thus, programs that were
127
+ built to use libjpeg v7 or v8 did not work with libjpeg-turbo, since it is
128
+ based on the libjpeg v6b code base. Although libjpeg v7 and v8 are not
129
+ as widely used as v6b, enough programs (including a few Linux distros) made
130
+ the switch that there was a demand to emulate the libjpeg v7 and v8 ABIs
131
+ in libjpeg-turbo. It should be noted, however, that this feature was added
132
+ primarily so that applications that had already been compiled to use libjpeg
133
+ v7+ could take advantage of accelerated baseline JPEG encoding/decoding
134
+ without recompiling. libjpeg-turbo does not claim to support all of the
135
+ libjpeg v7+ features, nor to produce identical output to libjpeg v7+ in all
136
+ cases (see below.)
137
+
138
+ By passing an argument of `--with-jpeg7` or `--with-jpeg8` to `configure`, or
139
+ an argument of `-DWITH_JPEG7=1` or `-DWITH_JPEG8=1` to `cmake`, you can build a
140
+ version of libjpeg-turbo that emulates the libjpeg v7 or v8 ABI, so that
141
+ programs that are built against libjpeg v7 or v8 can be run with libjpeg-turbo.
142
+ The following section describes which libjpeg v7+ features are supported and
143
+ which aren't.
144
+
145
+ ### Support for libjpeg v7 and v8 Features
146
+
147
+ #### Fully supported
148
+
149
+ - **libjpeg: IDCT scaling extensions in decompressor**<br>
150
+ libjpeg-turbo supports IDCT scaling with scaling factors of 1/8, 1/4, 3/8,
151
+ 1/2, 5/8, 3/4, 7/8, 9/8, 5/4, 11/8, 3/2, 13/8, 7/4, 15/8, and 2/1 (only 1/4
152
+ and 1/2 are SIMD-accelerated.)
153
+
154
+ - **libjpeg: Arithmetic coding**
155
+
156
+ - **libjpeg: In-memory source and destination managers**<br>
157
+ See notes below.
158
+
159
+ - **cjpeg: Separate quality settings for luminance and chrominance**<br>
160
+ Note that the libpjeg v7+ API was extended to accommodate this feature only
161
+ for convenience purposes. It has always been possible to implement this
162
+ feature with libjpeg v6b (see rdswitch.c for an example.)
163
+
164
+ - **cjpeg: 32-bit BMP support**
165
+
166
+ - **cjpeg: `-rgb` option**
167
+
168
+ - **jpegtran: Lossless cropping**
169
+
170
+ - **jpegtran: `-perfect` option**
171
+
172
+ - **jpegtran: Forcing width/height when performing lossless crop**
173
+
174
+ - **rdjpgcom: `-raw` option**
175
+
176
+ - **rdjpgcom: Locale awareness**
177
+
178
+
179
+ #### Not supported
180
+
181
+ NOTE: As of this writing, extensive research has been conducted into the
182
+ usefulness of DCT scaling as a means of data reduction and SmartScale as a
183
+ means of quality improvement. The reader is invited to peruse the research at
184
+ <http://www.libjpeg-turbo.org/About/SmartScale> and draw his/her own conclusions,
185
+ but it is the general belief of our project that these features have not
186
+ demonstrated sufficient usefulness to justify inclusion in libjpeg-turbo.
187
+
188
+ - **libjpeg: DCT scaling in compressor**<br>
189
+ `cinfo.scale_num` and `cinfo.scale_denom` are silently ignored.
190
+ There is no technical reason why DCT scaling could not be supported when
191
+ emulating the libjpeg v7+ API/ABI, but without the SmartScale extension (see
192
+ below), only scaling factors of 1/2, 8/15, 4/7, 8/13, 2/3, 8/11, 4/5, and
193
+ 8/9 would be available, which is of limited usefulness.
194
+
195
+ - **libjpeg: SmartScale**<br>
196
+ `cinfo.block_size` is silently ignored.
197
+ SmartScale is an extension to the JPEG format that allows for DCT block
198
+ sizes other than 8x8. Providing support for this new format would be
199
+ feasible (particularly without full acceleration.) However, until/unless
200
+ the format becomes either an official industry standard or, at minimum, an
201
+ accepted solution in the community, we are hesitant to implement it, as
202
+ there is no sense of whether or how it might change in the future. It is
203
+ our belief that SmartScale has not demonstrated sufficient usefulness as a
204
+ lossless format nor as a means of quality enhancement, and thus our primary
205
+ interest in providing this feature would be as a means of supporting
206
+ additional DCT scaling factors.
207
+
208
+ - **libjpeg: Fancy downsampling in compressor**<br>
209
+ `cinfo.do_fancy_downsampling` is silently ignored.
210
+ This requires the DCT scaling feature, which is not supported.
211
+
212
+ - **jpegtran: Scaling**<br>
213
+ This requires both the DCT scaling and SmartScale features, which are not
214
+ supported.
215
+
216
+ - **Lossless RGB JPEG files**<br>
217
+ This requires the SmartScale feature, which is not supported.
218
+
219
+ ### What About libjpeg v9?
220
+
221
+ libjpeg v9 introduced yet another field to the JPEG compression structure
222
+ (`color_transform`), thus making the ABI backward incompatible with that of
223
+ libjpeg v8. This new field was introduced solely for the purpose of supporting
224
+ lossless SmartScale encoding. Furthermore, there was actually no reason to
225
+ extend the API in this manner, as the color transform could have just as easily
226
+ been activated by way of a new JPEG colorspace constant, thus preserving
227
+ backward ABI compatibility.
228
+
229
+ Our research (see link above) has shown that lossless SmartScale does not
230
+ generally accomplish anything that can't already be accomplished better with
231
+ existing, standard lossless formats. Therefore, at this time it is our belief
232
+ that there is not sufficient technical justification for software projects to
233
+ upgrade from libjpeg v8 to libjpeg v9, and thus there is not sufficient
234
+ technical justification for us to emulate the libjpeg v9 ABI.
235
+
236
+ In-Memory Source/Destination Managers
237
+ -------------------------------------
238
+
239
+ By default, libjpeg-turbo 1.3 and later includes the `jpeg_mem_src()` and
240
+ `jpeg_mem_dest()` functions, even when not emulating the libjpeg v8 API/ABI.
241
+ Previously, it was necessary to build libjpeg-turbo from source with libjpeg v8
242
+ API/ABI emulation in order to use the in-memory source/destination managers,
243
+ but several projects requested that those functions be included when emulating
244
+ the libjpeg v6b API/ABI as well. This allows the use of those functions by
245
+ programs that need them, without breaking ABI compatibility for programs that
246
+ don't, and it allows those functions to be provided in the "official"
247
+ libjpeg-turbo binaries.
248
+
249
+ Those who are concerned about maintaining strict conformance with the libjpeg
250
+ v6b or v7 API can pass an argument of `--without-mem-srcdst` to `configure` or
251
+ an argument of `-DWITH_MEM_SRCDST=0` to `cmake` prior to building
252
+ libjpeg-turbo. This will restore the pre-1.3 behavior, in which
253
+ `jpeg_mem_src()` and `jpeg_mem_dest()` are only included when emulating the
254
+ libjpeg v8 API/ABI.
255
+
256
+ On Un*x systems, including the in-memory source/destination managers changes
257
+ the dynamic library version from 62.1.0 to 62.2.0 if using libjpeg v6b API/ABI
258
+ emulation and from 7.1.0 to 7.2.0 if using libjpeg v7 API/ABI emulation.
259
+
260
+ Note that, on most Un*x systems, the dynamic linker will not look for a
261
+ function in a library until that function is actually used. Thus, if a program
262
+ is built against libjpeg-turbo 1.3+ and uses `jpeg_mem_src()` or
263
+ `jpeg_mem_dest()`, that program will not fail if run against an older version
264
+ of libjpeg-turbo or against libjpeg v7- until the program actually tries to
265
+ call `jpeg_mem_src()` or `jpeg_mem_dest()`. Such is not the case on Windows.
266
+ If a program is built against the libjpeg-turbo 1.3+ DLL and uses
267
+ `jpeg_mem_src()` or `jpeg_mem_dest()`, then it must use the libjpeg-turbo 1.3+
268
+ DLL at run time.
269
+
270
+ Both cjpeg and djpeg have been extended to allow testing the in-memory
271
+ source/destination manager functions. See their respective man pages for more
272
+ details.
273
+
274
+
275
+ Mathematical Compatibility
276
+ ==========================
277
+
278
+ For the most part, libjpeg-turbo should produce identical output to libjpeg
279
+ v6b. The one exception to this is when using the floating point DCT/IDCT, in
280
+ which case the outputs of libjpeg v6b and libjpeg-turbo can differ for the
281
+ following reasons:
282
+
283
+ - The SSE/SSE2 floating point DCT implementation in libjpeg-turbo is ever so
284
+ slightly more accurate than the implementation in libjpeg v6b, but not by
285
+ any amount perceptible to human vision (generally in the range of 0.01 to
286
+ 0.08 dB gain in PNSR.)
287
+
288
+ - When not using the SIMD extensions, libjpeg-turbo uses the more accurate
289
+ (and slightly faster) floating point IDCT algorithm introduced in libjpeg
290
+ v8a as opposed to the algorithm used in libjpeg v6b. It should be noted,
291
+ however, that this algorithm basically brings the accuracy of the floating
292
+ point IDCT in line with the accuracy of the slow integer IDCT. The floating
293
+ point DCT/IDCT algorithms are mainly a legacy feature, and they do not
294
+ produce significantly more accuracy than the slow integer algorithms (to put
295
+ numbers on this, the typical difference in PNSR between the two algorithms
296
+ is less than 0.10 dB, whereas changing the quality level by 1 in the upper
297
+ range of the quality scale is typically more like a 1.0 dB difference.)
298
+
299
+ - If the floating point algorithms in libjpeg-turbo are not implemented using
300
+ SIMD instructions on a particular platform, then the accuracy of the
301
+ floating point DCT/IDCT can depend on the compiler settings.
302
+
303
+ While libjpeg-turbo does emulate the libjpeg v8 API/ABI, under the hood it is
304
+ still using the same algorithms as libjpeg v6b, so there are several specific
305
+ cases in which libjpeg-turbo cannot be expected to produce the same output as
306
+ libjpeg v8:
307
+
308
+ - When decompressing using scaling factors of 1/2 and 1/4, because libjpeg v8
309
+ implements those scaling algorithms differently than libjpeg v6b does, and
310
+ libjpeg-turbo's SIMD extensions are based on the libjpeg v6b behavior.
311
+
312
+ - When using chrominance subsampling, because libjpeg v8 implements this
313
+ with its DCT/IDCT scaling algorithms rather than with a separate
314
+ downsampling/upsampling algorithm. In our testing, the subsampled/upsampled
315
+ output of libjpeg v8 is less accurate than that of libjpeg v6b for this
316
+ reason.
317
+
318
+ - When decompressing using a scaling factor > 1 and merged (AKA "non-fancy" or
319
+ "non-smooth") chrominance upsampling, because libjpeg v8 does not support
320
+ merged upsampling with scaling factors > 1.
321
+
322
+
323
+ Performance Pitfalls
324
+ ====================
325
+
326
+ Restart Markers
327
+ ---------------
328
+
329
+ The optimized Huffman decoder in libjpeg-turbo does not handle restart markers
330
+ in a way that makes the rest of the libjpeg infrastructure happy, so it is
331
+ necessary to use the slow Huffman decoder when decompressing a JPEG image that
332
+ has restart markers. This can cause the decompression performance to drop by
333
+ as much as 20%, but the performance will still be much greater than that of
334
+ libjpeg. Many consumer packages, such as PhotoShop, use restart markers when
335
+ generating JPEG images, so images generated by those programs will experience
336
+ this issue.
337
+
338
+ Fast Integer Forward DCT at High Quality Levels
339
+ -----------------------------------------------
340
+
341
+ The algorithm used by the SIMD-accelerated quantization function cannot produce
342
+ correct results whenever the fast integer forward DCT is used along with a JPEG
343
+ quality of 98-100. Thus, libjpeg-turbo must use the non-SIMD quantization
344
+ function in those cases. This causes performance to drop by as much as 40%.
345
+ It is therefore strongly advised that you use the slow integer forward DCT
346
+ whenever encoding images with a JPEG quality of 98 or higher.