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,881 @@
1
+ /*
2
+ * jdcolor.c
3
+ *
4
+ * This file was part of the Independent JPEG Group's software:
5
+ * Copyright (C) 1991-1997, Thomas G. Lane.
6
+ * Modified 2011 by Guido Vollbeding.
7
+ * libjpeg-turbo Modifications:
8
+ * Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB
9
+ * Copyright (C) 2009, 2011-2012, 2014-2015, D. R. Commander.
10
+ * Copyright (C) 2013, Linaro Limited.
11
+ * For conditions of distribution and use, see the accompanying README.ijg
12
+ * file.
13
+ *
14
+ * This file contains output colorspace conversion routines.
15
+ */
16
+
17
+ #define JPEG_INTERNALS
18
+ #include "jinclude.h"
19
+ #include "jpeglib.h"
20
+ #include "jsimd.h"
21
+
22
+
23
+ /* Private subobject */
24
+
25
+ typedef struct {
26
+ struct jpeg_color_deconverter pub; /* public fields */
27
+
28
+ /* Private state for YCC->RGB conversion */
29
+ int *Cr_r_tab; /* => table for Cr to R conversion */
30
+ int *Cb_b_tab; /* => table for Cb to B conversion */
31
+ JLONG *Cr_g_tab; /* => table for Cr to G conversion */
32
+ JLONG *Cb_g_tab; /* => table for Cb to G conversion */
33
+
34
+ /* Private state for RGB->Y conversion */
35
+ JLONG *rgb_y_tab; /* => table for RGB to Y conversion */
36
+ } my_color_deconverter;
37
+
38
+ typedef my_color_deconverter *my_cconvert_ptr;
39
+
40
+
41
+ /**************** YCbCr -> RGB conversion: most common case **************/
42
+ /**************** RGB -> Y conversion: less common case **************/
43
+
44
+ /*
45
+ * YCbCr is defined per CCIR 601-1, except that Cb and Cr are
46
+ * normalized to the range 0..MAXJSAMPLE rather than -0.5 .. 0.5.
47
+ * The conversion equations to be implemented are therefore
48
+ *
49
+ * R = Y + 1.40200 * Cr
50
+ * G = Y - 0.34414 * Cb - 0.71414 * Cr
51
+ * B = Y + 1.77200 * Cb
52
+ *
53
+ * Y = 0.29900 * R + 0.58700 * G + 0.11400 * B
54
+ *
55
+ * where Cb and Cr represent the incoming values less CENTERJSAMPLE.
56
+ * (These numbers are derived from TIFF 6.0 section 21, dated 3-June-92.)
57
+ *
58
+ * To avoid floating-point arithmetic, we represent the fractional constants
59
+ * as integers scaled up by 2^16 (about 4 digits precision); we have to divide
60
+ * the products by 2^16, with appropriate rounding, to get the correct answer.
61
+ * Notice that Y, being an integral input, does not contribute any fraction
62
+ * so it need not participate in the rounding.
63
+ *
64
+ * For even more speed, we avoid doing any multiplications in the inner loop
65
+ * by precalculating the constants times Cb and Cr for all possible values.
66
+ * For 8-bit JSAMPLEs this is very reasonable (only 256 entries per table);
67
+ * for 12-bit samples it is still acceptable. It's not very reasonable for
68
+ * 16-bit samples, but if you want lossless storage you shouldn't be changing
69
+ * colorspace anyway.
70
+ * The Cr=>R and Cb=>B values can be rounded to integers in advance; the
71
+ * values for the G calculation are left scaled up, since we must add them
72
+ * together before rounding.
73
+ */
74
+
75
+ #define SCALEBITS 16 /* speediest right-shift on some machines */
76
+ #define ONE_HALF ((JLONG)1 << (SCALEBITS - 1))
77
+ #define FIX(x) ((JLONG)((x) * (1L << SCALEBITS) + 0.5))
78
+
79
+ /* We allocate one big table for RGB->Y conversion and divide it up into
80
+ * three parts, instead of doing three alloc_small requests. This lets us
81
+ * use a single table base address, which can be held in a register in the
82
+ * inner loops on many machines (more than can hold all three addresses,
83
+ * anyway).
84
+ */
85
+
86
+ #define R_Y_OFF 0 /* offset to R => Y section */
87
+ #define G_Y_OFF (1 * (MAXJSAMPLE + 1)) /* offset to G => Y section */
88
+ #define B_Y_OFF (2 * (MAXJSAMPLE + 1)) /* etc. */
89
+ #define TABLE_SIZE (3 * (MAXJSAMPLE + 1))
90
+
91
+
92
+ /* Include inline routines for colorspace extensions */
93
+
94
+ #include "jdcolext.c"
95
+ #undef RGB_RED
96
+ #undef RGB_GREEN
97
+ #undef RGB_BLUE
98
+ #undef RGB_PIXELSIZE
99
+
100
+ #define RGB_RED EXT_RGB_RED
101
+ #define RGB_GREEN EXT_RGB_GREEN
102
+ #define RGB_BLUE EXT_RGB_BLUE
103
+ #define RGB_PIXELSIZE EXT_RGB_PIXELSIZE
104
+ #define ycc_rgb_convert_internal ycc_extrgb_convert_internal
105
+ #define gray_rgb_convert_internal gray_extrgb_convert_internal
106
+ #define rgb_rgb_convert_internal rgb_extrgb_convert_internal
107
+ #include "jdcolext.c"
108
+ #undef RGB_RED
109
+ #undef RGB_GREEN
110
+ #undef RGB_BLUE
111
+ #undef RGB_PIXELSIZE
112
+ #undef ycc_rgb_convert_internal
113
+ #undef gray_rgb_convert_internal
114
+ #undef rgb_rgb_convert_internal
115
+
116
+ #define RGB_RED EXT_RGBX_RED
117
+ #define RGB_GREEN EXT_RGBX_GREEN
118
+ #define RGB_BLUE EXT_RGBX_BLUE
119
+ #define RGB_ALPHA 3
120
+ #define RGB_PIXELSIZE EXT_RGBX_PIXELSIZE
121
+ #define ycc_rgb_convert_internal ycc_extrgbx_convert_internal
122
+ #define gray_rgb_convert_internal gray_extrgbx_convert_internal
123
+ #define rgb_rgb_convert_internal rgb_extrgbx_convert_internal
124
+ #include "jdcolext.c"
125
+ #undef RGB_RED
126
+ #undef RGB_GREEN
127
+ #undef RGB_BLUE
128
+ #undef RGB_ALPHA
129
+ #undef RGB_PIXELSIZE
130
+ #undef ycc_rgb_convert_internal
131
+ #undef gray_rgb_convert_internal
132
+ #undef rgb_rgb_convert_internal
133
+
134
+ #define RGB_RED EXT_BGR_RED
135
+ #define RGB_GREEN EXT_BGR_GREEN
136
+ #define RGB_BLUE EXT_BGR_BLUE
137
+ #define RGB_PIXELSIZE EXT_BGR_PIXELSIZE
138
+ #define ycc_rgb_convert_internal ycc_extbgr_convert_internal
139
+ #define gray_rgb_convert_internal gray_extbgr_convert_internal
140
+ #define rgb_rgb_convert_internal rgb_extbgr_convert_internal
141
+ #include "jdcolext.c"
142
+ #undef RGB_RED
143
+ #undef RGB_GREEN
144
+ #undef RGB_BLUE
145
+ #undef RGB_PIXELSIZE
146
+ #undef ycc_rgb_convert_internal
147
+ #undef gray_rgb_convert_internal
148
+ #undef rgb_rgb_convert_internal
149
+
150
+ #define RGB_RED EXT_BGRX_RED
151
+ #define RGB_GREEN EXT_BGRX_GREEN
152
+ #define RGB_BLUE EXT_BGRX_BLUE
153
+ #define RGB_ALPHA 3
154
+ #define RGB_PIXELSIZE EXT_BGRX_PIXELSIZE
155
+ #define ycc_rgb_convert_internal ycc_extbgrx_convert_internal
156
+ #define gray_rgb_convert_internal gray_extbgrx_convert_internal
157
+ #define rgb_rgb_convert_internal rgb_extbgrx_convert_internal
158
+ #include "jdcolext.c"
159
+ #undef RGB_RED
160
+ #undef RGB_GREEN
161
+ #undef RGB_BLUE
162
+ #undef RGB_ALPHA
163
+ #undef RGB_PIXELSIZE
164
+ #undef ycc_rgb_convert_internal
165
+ #undef gray_rgb_convert_internal
166
+ #undef rgb_rgb_convert_internal
167
+
168
+ #define RGB_RED EXT_XBGR_RED
169
+ #define RGB_GREEN EXT_XBGR_GREEN
170
+ #define RGB_BLUE EXT_XBGR_BLUE
171
+ #define RGB_ALPHA 0
172
+ #define RGB_PIXELSIZE EXT_XBGR_PIXELSIZE
173
+ #define ycc_rgb_convert_internal ycc_extxbgr_convert_internal
174
+ #define gray_rgb_convert_internal gray_extxbgr_convert_internal
175
+ #define rgb_rgb_convert_internal rgb_extxbgr_convert_internal
176
+ #include "jdcolext.c"
177
+ #undef RGB_RED
178
+ #undef RGB_GREEN
179
+ #undef RGB_BLUE
180
+ #undef RGB_ALPHA
181
+ #undef RGB_PIXELSIZE
182
+ #undef ycc_rgb_convert_internal
183
+ #undef gray_rgb_convert_internal
184
+ #undef rgb_rgb_convert_internal
185
+
186
+ #define RGB_RED EXT_XRGB_RED
187
+ #define RGB_GREEN EXT_XRGB_GREEN
188
+ #define RGB_BLUE EXT_XRGB_BLUE
189
+ #define RGB_ALPHA 0
190
+ #define RGB_PIXELSIZE EXT_XRGB_PIXELSIZE
191
+ #define ycc_rgb_convert_internal ycc_extxrgb_convert_internal
192
+ #define gray_rgb_convert_internal gray_extxrgb_convert_internal
193
+ #define rgb_rgb_convert_internal rgb_extxrgb_convert_internal
194
+ #include "jdcolext.c"
195
+ #undef RGB_RED
196
+ #undef RGB_GREEN
197
+ #undef RGB_BLUE
198
+ #undef RGB_ALPHA
199
+ #undef RGB_PIXELSIZE
200
+ #undef ycc_rgb_convert_internal
201
+ #undef gray_rgb_convert_internal
202
+ #undef rgb_rgb_convert_internal
203
+
204
+
205
+ /*
206
+ * Initialize tables for YCC->RGB colorspace conversion.
207
+ */
208
+
209
+ LOCAL(void)
210
+ build_ycc_rgb_table(j_decompress_ptr cinfo)
211
+ {
212
+ my_cconvert_ptr cconvert = (my_cconvert_ptr)cinfo->cconvert;
213
+ int i;
214
+ JLONG x;
215
+ SHIFT_TEMPS
216
+
217
+ cconvert->Cr_r_tab = (int *)
218
+ (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
219
+ (MAXJSAMPLE + 1) * sizeof(int));
220
+ cconvert->Cb_b_tab = (int *)
221
+ (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
222
+ (MAXJSAMPLE + 1) * sizeof(int));
223
+ cconvert->Cr_g_tab = (JLONG *)
224
+ (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
225
+ (MAXJSAMPLE + 1) * sizeof(JLONG));
226
+ cconvert->Cb_g_tab = (JLONG *)
227
+ (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
228
+ (MAXJSAMPLE + 1) * sizeof(JLONG));
229
+
230
+ for (i = 0, x = -CENTERJSAMPLE; i <= MAXJSAMPLE; i++, x++) {
231
+ /* i is the actual input pixel value, in the range 0..MAXJSAMPLE */
232
+ /* The Cb or Cr value we are thinking of is x = i - CENTERJSAMPLE */
233
+ /* Cr=>R value is nearest int to 1.40200 * x */
234
+ cconvert->Cr_r_tab[i] = (int)
235
+ RIGHT_SHIFT(FIX(1.40200) * x + ONE_HALF, SCALEBITS);
236
+ /* Cb=>B value is nearest int to 1.77200 * x */
237
+ cconvert->Cb_b_tab[i] = (int)
238
+ RIGHT_SHIFT(FIX(1.77200) * x + ONE_HALF, SCALEBITS);
239
+ /* Cr=>G value is scaled-up -0.71414 * x */
240
+ cconvert->Cr_g_tab[i] = (-FIX(0.71414)) * x;
241
+ /* Cb=>G value is scaled-up -0.34414 * x */
242
+ /* We also add in ONE_HALF so that need not do it in inner loop */
243
+ cconvert->Cb_g_tab[i] = (-FIX(0.34414)) * x + ONE_HALF;
244
+ }
245
+ }
246
+
247
+
248
+ /*
249
+ * Convert some rows of samples to the output colorspace.
250
+ */
251
+
252
+ METHODDEF(void)
253
+ ycc_rgb_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
254
+ JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows)
255
+ {
256
+ switch (cinfo->out_color_space) {
257
+ case JCS_EXT_RGB:
258
+ ycc_extrgb_convert_internal(cinfo, input_buf, input_row, output_buf,
259
+ num_rows);
260
+ break;
261
+ case JCS_EXT_RGBX:
262
+ case JCS_EXT_RGBA:
263
+ ycc_extrgbx_convert_internal(cinfo, input_buf, input_row, output_buf,
264
+ num_rows);
265
+ break;
266
+ case JCS_EXT_BGR:
267
+ ycc_extbgr_convert_internal(cinfo, input_buf, input_row, output_buf,
268
+ num_rows);
269
+ break;
270
+ case JCS_EXT_BGRX:
271
+ case JCS_EXT_BGRA:
272
+ ycc_extbgrx_convert_internal(cinfo, input_buf, input_row, output_buf,
273
+ num_rows);
274
+ break;
275
+ case JCS_EXT_XBGR:
276
+ case JCS_EXT_ABGR:
277
+ ycc_extxbgr_convert_internal(cinfo, input_buf, input_row, output_buf,
278
+ num_rows);
279
+ break;
280
+ case JCS_EXT_XRGB:
281
+ case JCS_EXT_ARGB:
282
+ ycc_extxrgb_convert_internal(cinfo, input_buf, input_row, output_buf,
283
+ num_rows);
284
+ break;
285
+ default:
286
+ ycc_rgb_convert_internal(cinfo, input_buf, input_row, output_buf,
287
+ num_rows);
288
+ break;
289
+ }
290
+ }
291
+
292
+
293
+ /**************** Cases other than YCbCr -> RGB **************/
294
+
295
+
296
+ /*
297
+ * Initialize for RGB->grayscale colorspace conversion.
298
+ */
299
+
300
+ LOCAL(void)
301
+ build_rgb_y_table(j_decompress_ptr cinfo)
302
+ {
303
+ my_cconvert_ptr cconvert = (my_cconvert_ptr)cinfo->cconvert;
304
+ JLONG *rgb_y_tab;
305
+ JLONG i;
306
+
307
+ /* Allocate and fill in the conversion tables. */
308
+ cconvert->rgb_y_tab = rgb_y_tab = (JLONG *)
309
+ (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
310
+ (TABLE_SIZE * sizeof(JLONG)));
311
+
312
+ for (i = 0; i <= MAXJSAMPLE; i++) {
313
+ rgb_y_tab[i + R_Y_OFF] = FIX(0.29900) * i;
314
+ rgb_y_tab[i + G_Y_OFF] = FIX(0.58700) * i;
315
+ rgb_y_tab[i + B_Y_OFF] = FIX(0.11400) * i + ONE_HALF;
316
+ }
317
+ }
318
+
319
+
320
+ /*
321
+ * Convert RGB to grayscale.
322
+ */
323
+
324
+ METHODDEF(void)
325
+ rgb_gray_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
326
+ JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows)
327
+ {
328
+ my_cconvert_ptr cconvert = (my_cconvert_ptr)cinfo->cconvert;
329
+ register int r, g, b;
330
+ register JLONG *ctab = cconvert->rgb_y_tab;
331
+ register JSAMPROW outptr;
332
+ register JSAMPROW inptr0, inptr1, inptr2;
333
+ register JDIMENSION col;
334
+ JDIMENSION num_cols = cinfo->output_width;
335
+
336
+ while (--num_rows >= 0) {
337
+ inptr0 = input_buf[0][input_row];
338
+ inptr1 = input_buf[1][input_row];
339
+ inptr2 = input_buf[2][input_row];
340
+ input_row++;
341
+ outptr = *output_buf++;
342
+ for (col = 0; col < num_cols; col++) {
343
+ r = inptr0[col];
344
+ g = inptr1[col];
345
+ b = inptr2[col];
346
+ /* Y */
347
+ outptr[col] = (JSAMPLE)((ctab[r + R_Y_OFF] + ctab[g + G_Y_OFF] +
348
+ ctab[b + B_Y_OFF]) >> SCALEBITS);
349
+ }
350
+ }
351
+ }
352
+
353
+
354
+ /*
355
+ * Color conversion for no colorspace change: just copy the data,
356
+ * converting from separate-planes to interleaved representation.
357
+ */
358
+
359
+ METHODDEF(void)
360
+ null_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
361
+ JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows)
362
+ {
363
+ register JSAMPROW inptr, inptr0, inptr1, inptr2, inptr3, outptr;
364
+ register JDIMENSION col;
365
+ register int num_components = cinfo->num_components;
366
+ JDIMENSION num_cols = cinfo->output_width;
367
+ int ci;
368
+
369
+ if (num_components == 3) {
370
+ while (--num_rows >= 0) {
371
+ inptr0 = input_buf[0][input_row];
372
+ inptr1 = input_buf[1][input_row];
373
+ inptr2 = input_buf[2][input_row];
374
+ input_row++;
375
+ outptr = *output_buf++;
376
+ for (col = 0; col < num_cols; col++) {
377
+ *outptr++ = inptr0[col];
378
+ *outptr++ = inptr1[col];
379
+ *outptr++ = inptr2[col];
380
+ }
381
+ }
382
+ } else if (num_components == 4) {
383
+ while (--num_rows >= 0) {
384
+ inptr0 = input_buf[0][input_row];
385
+ inptr1 = input_buf[1][input_row];
386
+ inptr2 = input_buf[2][input_row];
387
+ inptr3 = input_buf[3][input_row];
388
+ input_row++;
389
+ outptr = *output_buf++;
390
+ for (col = 0; col < num_cols; col++) {
391
+ *outptr++ = inptr0[col];
392
+ *outptr++ = inptr1[col];
393
+ *outptr++ = inptr2[col];
394
+ *outptr++ = inptr3[col];
395
+ }
396
+ }
397
+ } else {
398
+ while (--num_rows >= 0) {
399
+ for (ci = 0; ci < num_components; ci++) {
400
+ inptr = input_buf[ci][input_row];
401
+ outptr = *output_buf;
402
+ for (col = 0; col < num_cols; col++) {
403
+ outptr[ci] = inptr[col];
404
+ outptr += num_components;
405
+ }
406
+ }
407
+ output_buf++;
408
+ input_row++;
409
+ }
410
+ }
411
+ }
412
+
413
+
414
+ /*
415
+ * Color conversion for grayscale: just copy the data.
416
+ * This also works for YCbCr -> grayscale conversion, in which
417
+ * we just copy the Y (luminance) component and ignore chrominance.
418
+ */
419
+
420
+ METHODDEF(void)
421
+ grayscale_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
422
+ JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows)
423
+ {
424
+ jcopy_sample_rows(input_buf[0], (int)input_row, output_buf, 0, num_rows,
425
+ cinfo->output_width);
426
+ }
427
+
428
+
429
+ /*
430
+ * Convert grayscale to RGB
431
+ */
432
+
433
+ METHODDEF(void)
434
+ gray_rgb_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
435
+ JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows)
436
+ {
437
+ switch (cinfo->out_color_space) {
438
+ case JCS_EXT_RGB:
439
+ gray_extrgb_convert_internal(cinfo, input_buf, input_row, output_buf,
440
+ num_rows);
441
+ break;
442
+ case JCS_EXT_RGBX:
443
+ case JCS_EXT_RGBA:
444
+ gray_extrgbx_convert_internal(cinfo, input_buf, input_row, output_buf,
445
+ num_rows);
446
+ break;
447
+ case JCS_EXT_BGR:
448
+ gray_extbgr_convert_internal(cinfo, input_buf, input_row, output_buf,
449
+ num_rows);
450
+ break;
451
+ case JCS_EXT_BGRX:
452
+ case JCS_EXT_BGRA:
453
+ gray_extbgrx_convert_internal(cinfo, input_buf, input_row, output_buf,
454
+ num_rows);
455
+ break;
456
+ case JCS_EXT_XBGR:
457
+ case JCS_EXT_ABGR:
458
+ gray_extxbgr_convert_internal(cinfo, input_buf, input_row, output_buf,
459
+ num_rows);
460
+ break;
461
+ case JCS_EXT_XRGB:
462
+ case JCS_EXT_ARGB:
463
+ gray_extxrgb_convert_internal(cinfo, input_buf, input_row, output_buf,
464
+ num_rows);
465
+ break;
466
+ default:
467
+ gray_rgb_convert_internal(cinfo, input_buf, input_row, output_buf,
468
+ num_rows);
469
+ break;
470
+ }
471
+ }
472
+
473
+
474
+ /*
475
+ * Convert plain RGB to extended RGB
476
+ */
477
+
478
+ METHODDEF(void)
479
+ rgb_rgb_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
480
+ JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows)
481
+ {
482
+ switch (cinfo->out_color_space) {
483
+ case JCS_EXT_RGB:
484
+ rgb_extrgb_convert_internal(cinfo, input_buf, input_row, output_buf,
485
+ num_rows);
486
+ break;
487
+ case JCS_EXT_RGBX:
488
+ case JCS_EXT_RGBA:
489
+ rgb_extrgbx_convert_internal(cinfo, input_buf, input_row, output_buf,
490
+ num_rows);
491
+ break;
492
+ case JCS_EXT_BGR:
493
+ rgb_extbgr_convert_internal(cinfo, input_buf, input_row, output_buf,
494
+ num_rows);
495
+ break;
496
+ case JCS_EXT_BGRX:
497
+ case JCS_EXT_BGRA:
498
+ rgb_extbgrx_convert_internal(cinfo, input_buf, input_row, output_buf,
499
+ num_rows);
500
+ break;
501
+ case JCS_EXT_XBGR:
502
+ case JCS_EXT_ABGR:
503
+ rgb_extxbgr_convert_internal(cinfo, input_buf, input_row, output_buf,
504
+ num_rows);
505
+ break;
506
+ case JCS_EXT_XRGB:
507
+ case JCS_EXT_ARGB:
508
+ rgb_extxrgb_convert_internal(cinfo, input_buf, input_row, output_buf,
509
+ num_rows);
510
+ break;
511
+ default:
512
+ rgb_rgb_convert_internal(cinfo, input_buf, input_row, output_buf,
513
+ num_rows);
514
+ break;
515
+ }
516
+ }
517
+
518
+
519
+ /*
520
+ * Adobe-style YCCK->CMYK conversion.
521
+ * We convert YCbCr to R=1-C, G=1-M, and B=1-Y using the same
522
+ * conversion as above, while passing K (black) unchanged.
523
+ * We assume build_ycc_rgb_table has been called.
524
+ */
525
+
526
+ METHODDEF(void)
527
+ ycck_cmyk_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
528
+ JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows)
529
+ {
530
+ my_cconvert_ptr cconvert = (my_cconvert_ptr)cinfo->cconvert;
531
+ register int y, cb, cr;
532
+ register JSAMPROW outptr;
533
+ register JSAMPROW inptr0, inptr1, inptr2, inptr3;
534
+ register JDIMENSION col;
535
+ JDIMENSION num_cols = cinfo->output_width;
536
+ /* copy these pointers into registers if possible */
537
+ register JSAMPLE *range_limit = cinfo->sample_range_limit;
538
+ register int *Crrtab = cconvert->Cr_r_tab;
539
+ register int *Cbbtab = cconvert->Cb_b_tab;
540
+ register JLONG *Crgtab = cconvert->Cr_g_tab;
541
+ register JLONG *Cbgtab = cconvert->Cb_g_tab;
542
+ SHIFT_TEMPS
543
+
544
+ while (--num_rows >= 0) {
545
+ inptr0 = input_buf[0][input_row];
546
+ inptr1 = input_buf[1][input_row];
547
+ inptr2 = input_buf[2][input_row];
548
+ inptr3 = input_buf[3][input_row];
549
+ input_row++;
550
+ outptr = *output_buf++;
551
+ for (col = 0; col < num_cols; col++) {
552
+ y = inptr0[col];
553
+ cb = inptr1[col];
554
+ cr = inptr2[col];
555
+ /* Range-limiting is essential due to noise introduced by DCT losses. */
556
+ outptr[0] = range_limit[MAXJSAMPLE - (y + Crrtab[cr])]; /* red */
557
+ outptr[1] = range_limit[MAXJSAMPLE - (y + /* green */
558
+ ((int)RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr],
559
+ SCALEBITS)))];
560
+ outptr[2] = range_limit[MAXJSAMPLE - (y + Cbbtab[cb])]; /* blue */
561
+ /* K passes through unchanged */
562
+ outptr[3] = inptr3[col];
563
+ outptr += 4;
564
+ }
565
+ }
566
+ }
567
+
568
+
569
+ /*
570
+ * RGB565 conversion
571
+ */
572
+
573
+ #define PACK_SHORT_565_LE(r, g, b) \
574
+ ((((r) << 8) & 0xF800) | (((g) << 3) & 0x7E0) | ((b) >> 3))
575
+ #define PACK_SHORT_565_BE(r, g, b) \
576
+ (((r) & 0xF8) | ((g) >> 5) | (((g) << 11) & 0xE000) | (((b) << 5) & 0x1F00))
577
+
578
+ #define PACK_TWO_PIXELS_LE(l, r) ((r << 16) | l)
579
+ #define PACK_TWO_PIXELS_BE(l, r) ((l << 16) | r)
580
+
581
+ #define PACK_NEED_ALIGNMENT(ptr) (((size_t)(ptr)) & 3)
582
+
583
+ #define WRITE_TWO_ALIGNED_PIXELS(addr, pixels) ((*(int *)(addr)) = pixels)
584
+
585
+ #define DITHER_565_R(r, dither) ((r) + ((dither) & 0xFF))
586
+ #define DITHER_565_G(g, dither) ((g) + (((dither) & 0xFF) >> 1))
587
+ #define DITHER_565_B(b, dither) ((b) + ((dither) & 0xFF))
588
+
589
+
590
+ /* Declarations for ordered dithering
591
+ *
592
+ * We use a 4x4 ordered dither array packed into 32 bits. This array is
593
+ * sufficient for dithering RGB888 to RGB565.
594
+ */
595
+
596
+ #define DITHER_MASK 0x3
597
+ #define DITHER_ROTATE(x) ((((x) & 0xFF) << 24) | (((x) >> 8) & 0x00FFFFFF))
598
+ static const JLONG dither_matrix[4] = {
599
+ 0x0008020A,
600
+ 0x0C040E06,
601
+ 0x030B0109,
602
+ 0x0F070D05
603
+ };
604
+
605
+
606
+ static INLINE boolean is_big_endian(void)
607
+ {
608
+ int test_value = 1;
609
+ if (*(char *)&test_value != 1)
610
+ return TRUE;
611
+ return FALSE;
612
+ }
613
+
614
+
615
+ /* Include inline routines for RGB565 conversion */
616
+
617
+ #define PACK_SHORT_565 PACK_SHORT_565_LE
618
+ #define PACK_TWO_PIXELS PACK_TWO_PIXELS_LE
619
+ #define ycc_rgb565_convert_internal ycc_rgb565_convert_le
620
+ #define ycc_rgb565D_convert_internal ycc_rgb565D_convert_le
621
+ #define rgb_rgb565_convert_internal rgb_rgb565_convert_le
622
+ #define rgb_rgb565D_convert_internal rgb_rgb565D_convert_le
623
+ #define gray_rgb565_convert_internal gray_rgb565_convert_le
624
+ #define gray_rgb565D_convert_internal gray_rgb565D_convert_le
625
+ #include "jdcol565.c"
626
+ #undef PACK_SHORT_565
627
+ #undef PACK_TWO_PIXELS
628
+ #undef ycc_rgb565_convert_internal
629
+ #undef ycc_rgb565D_convert_internal
630
+ #undef rgb_rgb565_convert_internal
631
+ #undef rgb_rgb565D_convert_internal
632
+ #undef gray_rgb565_convert_internal
633
+ #undef gray_rgb565D_convert_internal
634
+
635
+ #define PACK_SHORT_565 PACK_SHORT_565_BE
636
+ #define PACK_TWO_PIXELS PACK_TWO_PIXELS_BE
637
+ #define ycc_rgb565_convert_internal ycc_rgb565_convert_be
638
+ #define ycc_rgb565D_convert_internal ycc_rgb565D_convert_be
639
+ #define rgb_rgb565_convert_internal rgb_rgb565_convert_be
640
+ #define rgb_rgb565D_convert_internal rgb_rgb565D_convert_be
641
+ #define gray_rgb565_convert_internal gray_rgb565_convert_be
642
+ #define gray_rgb565D_convert_internal gray_rgb565D_convert_be
643
+ #include "jdcol565.c"
644
+ #undef PACK_SHORT_565
645
+ #undef PACK_TWO_PIXELS
646
+ #undef ycc_rgb565_convert_internal
647
+ #undef ycc_rgb565D_convert_internal
648
+ #undef rgb_rgb565_convert_internal
649
+ #undef rgb_rgb565D_convert_internal
650
+ #undef gray_rgb565_convert_internal
651
+ #undef gray_rgb565D_convert_internal
652
+
653
+
654
+ METHODDEF(void)
655
+ ycc_rgb565_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
656
+ JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows)
657
+ {
658
+ if (is_big_endian())
659
+ ycc_rgb565_convert_be(cinfo, input_buf, input_row, output_buf, num_rows);
660
+ else
661
+ ycc_rgb565_convert_le(cinfo, input_buf, input_row, output_buf, num_rows);
662
+ }
663
+
664
+
665
+ METHODDEF(void)
666
+ ycc_rgb565D_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
667
+ JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows)
668
+ {
669
+ if (is_big_endian())
670
+ ycc_rgb565D_convert_be(cinfo, input_buf, input_row, output_buf, num_rows);
671
+ else
672
+ ycc_rgb565D_convert_le(cinfo, input_buf, input_row, output_buf, num_rows);
673
+ }
674
+
675
+
676
+ METHODDEF(void)
677
+ rgb_rgb565_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
678
+ JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows)
679
+ {
680
+ if (is_big_endian())
681
+ rgb_rgb565_convert_be(cinfo, input_buf, input_row, output_buf, num_rows);
682
+ else
683
+ rgb_rgb565_convert_le(cinfo, input_buf, input_row, output_buf, num_rows);
684
+ }
685
+
686
+
687
+ METHODDEF(void)
688
+ rgb_rgb565D_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
689
+ JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows)
690
+ {
691
+ if (is_big_endian())
692
+ rgb_rgb565D_convert_be(cinfo, input_buf, input_row, output_buf, num_rows);
693
+ else
694
+ rgb_rgb565D_convert_le(cinfo, input_buf, input_row, output_buf, num_rows);
695
+ }
696
+
697
+
698
+ METHODDEF(void)
699
+ gray_rgb565_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
700
+ JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows)
701
+ {
702
+ if (is_big_endian())
703
+ gray_rgb565_convert_be(cinfo, input_buf, input_row, output_buf, num_rows);
704
+ else
705
+ gray_rgb565_convert_le(cinfo, input_buf, input_row, output_buf, num_rows);
706
+ }
707
+
708
+
709
+ METHODDEF(void)
710
+ gray_rgb565D_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
711
+ JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows)
712
+ {
713
+ if (is_big_endian())
714
+ gray_rgb565D_convert_be(cinfo, input_buf, input_row, output_buf, num_rows);
715
+ else
716
+ gray_rgb565D_convert_le(cinfo, input_buf, input_row, output_buf, num_rows);
717
+ }
718
+
719
+
720
+ /*
721
+ * Empty method for start_pass.
722
+ */
723
+
724
+ METHODDEF(void)
725
+ start_pass_dcolor(j_decompress_ptr cinfo)
726
+ {
727
+ /* no work needed */
728
+ }
729
+
730
+
731
+ /*
732
+ * Module initialization routine for output colorspace conversion.
733
+ */
734
+
735
+ GLOBAL(void)
736
+ jinit_color_deconverter(j_decompress_ptr cinfo)
737
+ {
738
+ my_cconvert_ptr cconvert;
739
+ int ci;
740
+
741
+ cconvert = (my_cconvert_ptr)
742
+ (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
743
+ sizeof(my_color_deconverter));
744
+ cinfo->cconvert = (struct jpeg_color_deconverter *)cconvert;
745
+ cconvert->pub.start_pass = start_pass_dcolor;
746
+
747
+ /* Make sure num_components agrees with jpeg_color_space */
748
+ switch (cinfo->jpeg_color_space) {
749
+ case JCS_GRAYSCALE:
750
+ if (cinfo->num_components != 1)
751
+ ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
752
+ break;
753
+
754
+ case JCS_RGB:
755
+ case JCS_YCbCr:
756
+ if (cinfo->num_components != 3)
757
+ ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
758
+ break;
759
+
760
+ case JCS_CMYK:
761
+ case JCS_YCCK:
762
+ if (cinfo->num_components != 4)
763
+ ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
764
+ break;
765
+
766
+ default: /* JCS_UNKNOWN can be anything */
767
+ if (cinfo->num_components < 1)
768
+ ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
769
+ break;
770
+ }
771
+
772
+ /* Set out_color_components and conversion method based on requested space.
773
+ * Also clear the component_needed flags for any unused components,
774
+ * so that earlier pipeline stages can avoid useless computation.
775
+ */
776
+
777
+ switch (cinfo->out_color_space) {
778
+ case JCS_GRAYSCALE:
779
+ cinfo->out_color_components = 1;
780
+ if (cinfo->jpeg_color_space == JCS_GRAYSCALE ||
781
+ cinfo->jpeg_color_space == JCS_YCbCr) {
782
+ cconvert->pub.color_convert = grayscale_convert;
783
+ /* For color->grayscale conversion, only the Y (0) component is needed */
784
+ for (ci = 1; ci < cinfo->num_components; ci++)
785
+ cinfo->comp_info[ci].component_needed = FALSE;
786
+ } else if (cinfo->jpeg_color_space == JCS_RGB) {
787
+ cconvert->pub.color_convert = rgb_gray_convert;
788
+ build_rgb_y_table(cinfo);
789
+ } else
790
+ ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
791
+ break;
792
+
793
+ case JCS_RGB:
794
+ case JCS_EXT_RGB:
795
+ case JCS_EXT_RGBX:
796
+ case JCS_EXT_BGR:
797
+ case JCS_EXT_BGRX:
798
+ case JCS_EXT_XBGR:
799
+ case JCS_EXT_XRGB:
800
+ case JCS_EXT_RGBA:
801
+ case JCS_EXT_BGRA:
802
+ case JCS_EXT_ABGR:
803
+ case JCS_EXT_ARGB:
804
+ cinfo->out_color_components = rgb_pixelsize[cinfo->out_color_space];
805
+ if (cinfo->jpeg_color_space == JCS_YCbCr) {
806
+ if (jsimd_can_ycc_rgb())
807
+ cconvert->pub.color_convert = jsimd_ycc_rgb_convert;
808
+ else {
809
+ cconvert->pub.color_convert = ycc_rgb_convert;
810
+ build_ycc_rgb_table(cinfo);
811
+ }
812
+ } else if (cinfo->jpeg_color_space == JCS_GRAYSCALE) {
813
+ cconvert->pub.color_convert = gray_rgb_convert;
814
+ } else if (cinfo->jpeg_color_space == JCS_RGB) {
815
+ if (rgb_red[cinfo->out_color_space] == 0 &&
816
+ rgb_green[cinfo->out_color_space] == 1 &&
817
+ rgb_blue[cinfo->out_color_space] == 2 &&
818
+ rgb_pixelsize[cinfo->out_color_space] == 3)
819
+ cconvert->pub.color_convert = null_convert;
820
+ else
821
+ cconvert->pub.color_convert = rgb_rgb_convert;
822
+ } else
823
+ ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
824
+ break;
825
+
826
+ case JCS_RGB565:
827
+ cinfo->out_color_components = 3;
828
+ if (cinfo->dither_mode == JDITHER_NONE) {
829
+ if (cinfo->jpeg_color_space == JCS_YCbCr) {
830
+ if (jsimd_can_ycc_rgb565())
831
+ cconvert->pub.color_convert = jsimd_ycc_rgb565_convert;
832
+ else {
833
+ cconvert->pub.color_convert = ycc_rgb565_convert;
834
+ build_ycc_rgb_table(cinfo);
835
+ }
836
+ } else if (cinfo->jpeg_color_space == JCS_GRAYSCALE) {
837
+ cconvert->pub.color_convert = gray_rgb565_convert;
838
+ } else if (cinfo->jpeg_color_space == JCS_RGB) {
839
+ cconvert->pub.color_convert = rgb_rgb565_convert;
840
+ } else
841
+ ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
842
+ } else {
843
+ /* only ordered dithering is supported */
844
+ if (cinfo->jpeg_color_space == JCS_YCbCr) {
845
+ cconvert->pub.color_convert = ycc_rgb565D_convert;
846
+ build_ycc_rgb_table(cinfo);
847
+ } else if (cinfo->jpeg_color_space == JCS_GRAYSCALE) {
848
+ cconvert->pub.color_convert = gray_rgb565D_convert;
849
+ } else if (cinfo->jpeg_color_space == JCS_RGB) {
850
+ cconvert->pub.color_convert = rgb_rgb565D_convert;
851
+ } else
852
+ ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
853
+ }
854
+ break;
855
+
856
+ case JCS_CMYK:
857
+ cinfo->out_color_components = 4;
858
+ if (cinfo->jpeg_color_space == JCS_YCCK) {
859
+ cconvert->pub.color_convert = ycck_cmyk_convert;
860
+ build_ycc_rgb_table(cinfo);
861
+ } else if (cinfo->jpeg_color_space == JCS_CMYK) {
862
+ cconvert->pub.color_convert = null_convert;
863
+ } else
864
+ ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
865
+ break;
866
+
867
+ default:
868
+ /* Permit null conversion to same output space */
869
+ if (cinfo->out_color_space == cinfo->jpeg_color_space) {
870
+ cinfo->out_color_components = cinfo->num_components;
871
+ cconvert->pub.color_convert = null_convert;
872
+ } else /* unsupported non-null conversion */
873
+ ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
874
+ break;
875
+ }
876
+
877
+ if (cinfo->quantize_colors)
878
+ cinfo->output_components = 1; /* single colormapped output component */
879
+ else
880
+ cinfo->output_components = cinfo->out_color_components;
881
+ }