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,415 @@
1
+ /*
2
+ * Loongson MMI optimizations for libjpeg-turbo
3
+ *
4
+ * Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB
5
+ * Copyright (C) 2015, 2019, D. R. Commander. All Rights Reserved.
6
+ * Copyright (C) 2016-2018, Loongson Technology Corporation Limited, BeiJing.
7
+ * All Rights Reserved.
8
+ * Authors: ZhuChen <zhuchen@loongson.cn>
9
+ * SunZhangzhi <sunzhangzhi-cq@loongson.cn>
10
+ * CaiWanwei <caiwanwei@loongson.cn>
11
+ *
12
+ * Based on the x86 SIMD extension for IJG JPEG library
13
+ * Copyright (C) 1999-2006, MIYASAKA Masaru.
14
+ *
15
+ * This software is provided 'as-is', without any express or implied
16
+ * warranty. In no event will the authors be held liable for any damages
17
+ * arising from the use of this software.
18
+ *
19
+ * Permission is granted to anyone to use this software for any purpose,
20
+ * including commercial applications, and to alter it and redistribute it
21
+ * freely, subject to the following restrictions:
22
+ *
23
+ * 1. The origin of this software must not be misrepresented; you must not
24
+ * claim that you wrote the original software. If you use this software
25
+ * in a product, an acknowledgment in the product documentation would be
26
+ * appreciated but is not required.
27
+ * 2. Altered source versions must be plainly marked as such, and must not be
28
+ * misrepresented as being the original software.
29
+ * 3. This notice may not be removed or altered from any source distribution.
30
+ */
31
+
32
+ /* This file is included by jdcolor-mmi.c */
33
+
34
+
35
+ #if RGB_RED == 0
36
+ #define mmA re
37
+ #define mmB ro
38
+ #elif RGB_GREEN == 0
39
+ #define mmA ge
40
+ #define mmB go
41
+ #elif RGB_BLUE == 0
42
+ #define mmA be
43
+ #define mmB bo
44
+ #else
45
+ #define mmA xe
46
+ #define mmB xo
47
+ #endif
48
+
49
+ #if RGB_RED == 1
50
+ #define mmC re
51
+ #define mmD ro
52
+ #elif RGB_GREEN == 1
53
+ #define mmC ge
54
+ #define mmD go
55
+ #elif RGB_BLUE == 1
56
+ #define mmC be
57
+ #define mmD bo
58
+ #else
59
+ #define mmC xe
60
+ #define mmD xo
61
+ #endif
62
+
63
+ #if RGB_RED == 2
64
+ #define mmE re
65
+ #define mmF ro
66
+ #elif RGB_GREEN == 2
67
+ #define mmE ge
68
+ #define mmF go
69
+ #elif RGB_BLUE == 2
70
+ #define mmE be
71
+ #define mmF bo
72
+ #else
73
+ #define mmE xe
74
+ #define mmF xo
75
+ #endif
76
+
77
+ #if RGB_RED == 3
78
+ #define mmG re
79
+ #define mmH ro
80
+ #elif RGB_GREEN == 3
81
+ #define mmG ge
82
+ #define mmH go
83
+ #elif RGB_BLUE == 3
84
+ #define mmG be
85
+ #define mmH bo
86
+ #else
87
+ #define mmG xe
88
+ #define mmH xo
89
+ #endif
90
+
91
+
92
+ void jsimd_ycc_rgb_convert_mmi(JDIMENSION out_width, JSAMPIMAGE input_buf,
93
+ JDIMENSION input_row, JSAMPARRAY output_buf,
94
+ int num_rows)
95
+ {
96
+ JSAMPROW outptr, inptr0, inptr1, inptr2;
97
+ int num_cols, col;
98
+ __m64 ye, yo, y, cbe, cbe2, cbo, cbo2, cb, cre, cre2, cro, cro2, cr;
99
+ __m64 re, ro, gle, ghe, ge, glo, gho, go, be, bo, xe = 0.0, xo = 0.0;
100
+ __m64 decenter, mask;
101
+
102
+ while (--num_rows >= 0) {
103
+ inptr0 = input_buf[0][input_row];
104
+ inptr1 = input_buf[1][input_row];
105
+ inptr2 = input_buf[2][input_row];
106
+ input_row++;
107
+ outptr = *output_buf++;
108
+
109
+ for (num_cols = out_width; num_cols > 0; num_cols -= 8,
110
+ inptr0 += 8, inptr1 += 8, inptr2 += 8) {
111
+
112
+ cb = _mm_load_si64((__m64 *)inptr1);
113
+ cr = _mm_load_si64((__m64 *)inptr2);
114
+ y = _mm_load_si64((__m64 *)inptr0);
115
+
116
+ mask = decenter = 0.0;
117
+ mask = _mm_cmpeq_pi16(mask, mask);
118
+ decenter = _mm_cmpeq_pi16(decenter, decenter);
119
+ mask = _mm_srli_pi16(mask, BYTE_BIT); /* {0xFF 0x00 0xFF 0x00 ..} */
120
+ decenter = _mm_slli_pi16(decenter, 7); /* {0xFF80 0xFF80 0xFF80 0xFF80} */
121
+
122
+ cbe = _mm_and_si64(mask, cb); /* Cb(0246) */
123
+ cbo = _mm_srli_pi16(cb, BYTE_BIT); /* Cb(1357) */
124
+ cre = _mm_and_si64(mask, cr); /* Cr(0246) */
125
+ cro = _mm_srli_pi16(cr, BYTE_BIT); /* Cr(1357) */
126
+ cbe = _mm_add_pi16(cbe, decenter);
127
+ cbo = _mm_add_pi16(cbo, decenter);
128
+ cre = _mm_add_pi16(cre, decenter);
129
+ cro = _mm_add_pi16(cro, decenter);
130
+
131
+ /* (Original)
132
+ * R = Y + 1.40200 * Cr
133
+ * G = Y - 0.34414 * Cb - 0.71414 * Cr
134
+ * B = Y + 1.77200 * Cb
135
+ *
136
+ * (This implementation)
137
+ * R = Y + 0.40200 * Cr + Cr
138
+ * G = Y - 0.34414 * Cb + 0.28586 * Cr - Cr
139
+ * B = Y - 0.22800 * Cb + Cb + Cb
140
+ */
141
+
142
+ cbe2 = _mm_add_pi16(cbe, cbe); /* 2*CbE */
143
+ cbo2 = _mm_add_pi16(cbo, cbo); /* 2*CbO */
144
+ cre2 = _mm_add_pi16(cre, cre); /* 2*CrE */
145
+ cro2 = _mm_add_pi16(cro, cro); /* 2*CrO */
146
+
147
+ be = _mm_mulhi_pi16(cbe2, PW_MF0228); /* (2*CbE * -FIX(0.22800) */
148
+ bo = _mm_mulhi_pi16(cbo2, PW_MF0228); /* (2*CbO * -FIX(0.22800) */
149
+ re = _mm_mulhi_pi16(cre2, PW_F0402); /* (2*CrE * FIX(0.40200)) */
150
+ ro = _mm_mulhi_pi16(cro2, PW_F0402); /* (2*CrO * FIX(0.40200)) */
151
+
152
+ be = _mm_add_pi16(be, PW_ONE);
153
+ bo = _mm_add_pi16(bo, PW_ONE);
154
+ be = _mm_srai_pi16(be, 1); /* (CbE * -FIX(0.22800)) */
155
+ bo = _mm_srai_pi16(bo, 1); /* (CbO * -FIX(0.22800)) */
156
+ re = _mm_add_pi16(re, PW_ONE);
157
+ ro = _mm_add_pi16(ro, PW_ONE);
158
+ re = _mm_srai_pi16(re, 1); /* (CrE * FIX(0.40200)) */
159
+ ro = _mm_srai_pi16(ro, 1); /* (CrO * FIX(0.40200)) */
160
+
161
+ be = _mm_add_pi16(be, cbe);
162
+ bo = _mm_add_pi16(bo, cbo);
163
+ be = _mm_add_pi16(be, cbe); /* (CbE * FIX(1.77200))=(B-Y)E */
164
+ bo = _mm_add_pi16(bo, cbo); /* (CbO * FIX(1.77200))=(B-Y)O */
165
+ re = _mm_add_pi16(re, cre); /* (CrE * FIX(1.40200))=(R-Y)E */
166
+ ro = _mm_add_pi16(ro, cro); /* (CrO * FIX(1.40200))=(R-Y)O */
167
+
168
+ gle = _mm_unpacklo_pi16(cbe, cre);
169
+ ghe = _mm_unpackhi_pi16(cbe, cre);
170
+ gle = _mm_madd_pi16(gle, PW_MF0344_F0285);
171
+ ghe = _mm_madd_pi16(ghe, PW_MF0344_F0285);
172
+ glo = _mm_unpacklo_pi16(cbo, cro);
173
+ gho = _mm_unpackhi_pi16(cbo, cro);
174
+ glo = _mm_madd_pi16(glo, PW_MF0344_F0285);
175
+ gho = _mm_madd_pi16(gho, PW_MF0344_F0285);
176
+
177
+ gle = _mm_add_pi32(gle, PD_ONEHALF);
178
+ ghe = _mm_add_pi32(ghe, PD_ONEHALF);
179
+ gle = _mm_srai_pi32(gle, SCALEBITS);
180
+ ghe = _mm_srai_pi32(ghe, SCALEBITS);
181
+ glo = _mm_add_pi32(glo, PD_ONEHALF);
182
+ gho = _mm_add_pi32(gho, PD_ONEHALF);
183
+ glo = _mm_srai_pi32(glo, SCALEBITS);
184
+ gho = _mm_srai_pi32(gho, SCALEBITS);
185
+
186
+ ge = _mm_packs_pi32(gle, ghe); /* CbE*-FIX(0.344)+CrE*FIX(0.285) */
187
+ go = _mm_packs_pi32(glo, gho); /* CbO*-FIX(0.344)+CrO*FIX(0.285) */
188
+ ge = _mm_sub_pi16(ge, cre); /* CbE*-FIX(0.344)+CrE*-FIX(0.714)=(G-Y)E */
189
+ go = _mm_sub_pi16(go, cro); /* CbO*-FIX(0.344)+CrO*-FIX(0.714)=(G-Y)O */
190
+
191
+ ye = _mm_and_si64(mask, y); /* Y(0246) */
192
+ yo = _mm_srli_pi16(y, BYTE_BIT); /* Y(1357) */
193
+
194
+ re = _mm_add_pi16(re, ye); /* ((R-Y)E+YE)=(R0 R2 R4 R6) */
195
+ ro = _mm_add_pi16(ro, yo); /* ((R-Y)O+YO)=(R1 R3 R5 R7) */
196
+ re = _mm_packs_pu16(re, re); /* (R0 R2 R4 R6 ** ** ** **) */
197
+ ro = _mm_packs_pu16(ro, ro); /* (R1 R3 R5 R7 ** ** ** **) */
198
+
199
+ ge = _mm_add_pi16(ge, ye); /* ((G-Y)E+YE)=(G0 G2 G4 G6) */
200
+ go = _mm_add_pi16(go, yo); /* ((G-Y)O+YO)=(G1 G3 G5 G7) */
201
+ ge = _mm_packs_pu16(ge, ge); /* (G0 G2 G4 G6 ** ** ** **) */
202
+ go = _mm_packs_pu16(go, go); /* (G1 G3 G5 G7 ** ** ** **) */
203
+
204
+ be = _mm_add_pi16(be, ye); /* (YE+(B-Y)E)=(B0 B2 B4 B6) */
205
+ bo = _mm_add_pi16(bo, yo); /* (YO+(B-Y)O)=(B1 B3 B5 B7) */
206
+ be = _mm_packs_pu16(be, be); /* (B0 B2 B4 B6 ** ** ** **) */
207
+ bo = _mm_packs_pu16(bo, bo); /* (B1 B3 B5 B7 ** ** ** **) */
208
+
209
+ #if RGB_PIXELSIZE == 3
210
+
211
+ /* mmA=(00 02 04 06 ** ** ** **), mmB=(01 03 05 07 ** ** ** **) */
212
+ /* mmC=(10 12 14 16 ** ** ** **), mmD=(11 13 15 17 ** ** ** **) */
213
+ mmA = _mm_unpacklo_pi8(mmA, mmC); /* (00 10 02 12 04 14 06 16) */
214
+ mmE = _mm_unpacklo_pi8(mmE, mmB); /* (20 01 22 03 24 05 26 07) */
215
+ mmD = _mm_unpacklo_pi8(mmD, mmF); /* (11 21 13 23 15 25 17 27) */
216
+
217
+ mmH = _mm_srli_si64(mmA, 2 * BYTE_BIT);
218
+
219
+ mmG = _mm_unpackhi_pi16(mmA, mmE); /* (04 14 24 05 06 16 26 07) */
220
+ mmA = _mm_unpacklo_pi16(mmA, mmE); /* (00 10 20 01 02 12 22 03) */
221
+
222
+ mmE = _mm_srli_si64(mmE, 2 * BYTE_BIT);
223
+ mmB = _mm_srli_si64(mmD, 2 * BYTE_BIT); /* (13 23 15 25 17 27 -- --) */
224
+
225
+ mmC = _mm_unpackhi_pi16(mmD, mmH); /* (15 25 06 16 17 27 -- --) */
226
+ mmD = _mm_unpacklo_pi16(mmD, mmH); /* (11 21 02 12 13 23 04 14) */
227
+
228
+ mmF = _mm_unpackhi_pi16(mmE, mmB); /* (26 07 17 27 -- -- -- --) */
229
+ mmE = _mm_unpacklo_pi16(mmE, mmB); /* (22 03 13 23 24 05 15 25) */
230
+
231
+ mmA = _mm_unpacklo_pi32(mmA, mmD); /* (00 10 20 01 11 21 02 12) */
232
+ mmE = _mm_unpacklo_pi32(mmE, mmG); /* (22 03 13 23 04 14 24 05) */
233
+ mmC = _mm_unpacklo_pi32(mmC, mmF); /* (15 25 06 16 26 07 17 27) */
234
+
235
+ if (num_cols >= 8) {
236
+ if (!(((long)outptr) & 7)) {
237
+ _mm_store_si64((__m64 *)outptr, mmA);
238
+ _mm_store_si64((__m64 *)(outptr + 8), mmE);
239
+ _mm_store_si64((__m64 *)(outptr + 16), mmC);
240
+ } else {
241
+ _mm_storeu_si64((__m64 *)outptr, mmA);
242
+ _mm_storeu_si64((__m64 *)(outptr + 8), mmE);
243
+ _mm_storeu_si64((__m64 *)(outptr + 16), mmC);
244
+ }
245
+ outptr += RGB_PIXELSIZE * 8;
246
+ } else {
247
+ col = num_cols * 3;
248
+ asm(".set noreorder\r\n"
249
+
250
+ "li $8, 16\r\n"
251
+ "move $9, %4\r\n"
252
+ "mov.s $f4, %1\r\n"
253
+ "mov.s $f6, %3\r\n"
254
+ "move $10, %5\r\n"
255
+ "bltu $9, $8, 1f\r\n"
256
+ "nop \r\n"
257
+ "gssdlc1 $f4, 7($10)\r\n"
258
+ "gssdrc1 $f4, 0($10)\r\n"
259
+ "gssdlc1 $f6, 7+8($10)\r\n"
260
+ "gssdrc1 $f6, 8($10)\r\n"
261
+ "mov.s $f4, %2\r\n"
262
+ "subu $9, $9, 16\r\n"
263
+ PTR_ADDU "$10, $10, 16\r\n"
264
+ "b 2f\r\n"
265
+ "nop \r\n"
266
+
267
+ "1: \r\n"
268
+ "li $8, 8\r\n" /* st8 */
269
+ "bltu $9, $8, 2f\r\n"
270
+ "nop \r\n"
271
+ "gssdlc1 $f4, 7($10)\r\n"
272
+ "gssdrc1 $f4, 0($10)\r\n"
273
+ "mov.s $f4, %3\r\n"
274
+ "subu $9, $9, 8\r\n"
275
+ PTR_ADDU "$10, $10, 8\r\n"
276
+
277
+ "2: \r\n"
278
+ "li $8, 4\r\n" /* st4 */
279
+ "mfc1 $11, $f4\r\n"
280
+ "bltu $9, $8, 3f\r\n"
281
+ "nop \r\n"
282
+ "swl $11, 3($10)\r\n"
283
+ "swr $11, 0($10)\r\n"
284
+ "li $8, 32\r\n"
285
+ "mtc1 $8, $f6\r\n"
286
+ "dsrl $f4, $f4, $f6\r\n"
287
+ "mfc1 $11, $f4\r\n"
288
+ "subu $9, $9, 4\r\n"
289
+ PTR_ADDU "$10, $10, 4\r\n"
290
+
291
+ "3: \r\n"
292
+ "li $8, 2\r\n" /* st2 */
293
+ "bltu $9, $8, 4f\r\n"
294
+ "nop \r\n"
295
+ "ush $11, 0($10)\r\n"
296
+ "srl $11, 16\r\n"
297
+ "subu $9, $9, 2\r\n"
298
+ PTR_ADDU "$10, $10, 2\r\n"
299
+
300
+ "4: \r\n"
301
+ "li $8, 1\r\n" /* st1 */
302
+ "bltu $9, $8, 5f\r\n"
303
+ "nop \r\n"
304
+ "sb $11, 0($10)\r\n"
305
+
306
+ "5: \r\n"
307
+ "nop \r\n" /* end */
308
+ : "=m" (*outptr)
309
+ : "f" (mmA), "f" (mmC), "f" (mmE), "r" (col), "r" (outptr)
310
+ : "$f4", "$f6", "$8", "$9", "$10", "$11", "memory"
311
+ );
312
+ }
313
+
314
+ #else /* RGB_PIXELSIZE == 4 */
315
+
316
+ #ifdef RGBX_FILLER_0XFF
317
+ xe = _mm_cmpeq_pi8(xe, xe);
318
+ xo = _mm_cmpeq_pi8(xo, xo);
319
+ #else
320
+ xe = _mm_xor_si64(xe, xe);
321
+ xo = _mm_xor_si64(xo, xo);
322
+ #endif
323
+ /* mmA=(00 02 04 06 ** ** ** **), mmB=(01 03 05 07 ** ** ** **) */
324
+ /* mmC=(10 12 14 16 ** ** ** **), mmD=(11 13 15 17 ** ** ** **) */
325
+ /* mmE=(20 22 24 26 ** ** ** **), mmF=(21 23 25 27 ** ** ** **) */
326
+ /* mmG=(30 32 34 36 ** ** ** **), mmH=(31 33 35 37 ** ** ** **) */
327
+
328
+ mmA = _mm_unpacklo_pi8(mmA, mmC); /* (00 10 02 12 04 14 06 16) */
329
+ mmE = _mm_unpacklo_pi8(mmE, mmG); /* (20 30 22 32 24 34 26 36) */
330
+ mmB = _mm_unpacklo_pi8(mmB, mmD); /* (01 11 03 13 05 15 07 17) */
331
+ mmF = _mm_unpacklo_pi8(mmF, mmH); /* (21 31 23 33 25 35 27 37) */
332
+
333
+ mmC = _mm_unpackhi_pi16(mmA, mmE); /* (04 14 24 34 06 16 26 36) */
334
+ mmA = _mm_unpacklo_pi16(mmA, mmE); /* (00 10 20 30 02 12 22 32) */
335
+ mmG = _mm_unpackhi_pi16(mmB, mmF); /* (05 15 25 35 07 17 27 37) */
336
+ mmB = _mm_unpacklo_pi16(mmB, mmF); /* (01 11 21 31 03 13 23 33) */
337
+
338
+ mmD = _mm_unpackhi_pi32(mmA, mmB); /* (02 12 22 32 03 13 23 33) */
339
+ mmA = _mm_unpacklo_pi32(mmA, mmB); /* (00 10 20 30 01 11 21 31) */
340
+ mmH = _mm_unpackhi_pi32(mmC, mmG); /* (06 16 26 36 07 17 27 37) */
341
+ mmC = _mm_unpacklo_pi32(mmC, mmG); /* (04 14 24 34 05 15 25 35) */
342
+
343
+ if (num_cols >= 8) {
344
+ if (!(((long)outptr) & 7)) {
345
+ _mm_store_si64((__m64 *)outptr, mmA);
346
+ _mm_store_si64((__m64 *)(outptr + 8), mmD);
347
+ _mm_store_si64((__m64 *)(outptr + 16), mmC);
348
+ _mm_store_si64((__m64 *)(outptr + 24), mmH);
349
+ } else {
350
+ _mm_storeu_si64((__m64 *)outptr, mmA);
351
+ _mm_storeu_si64((__m64 *)(outptr + 8), mmD);
352
+ _mm_storeu_si64((__m64 *)(outptr + 16), mmC);
353
+ _mm_storeu_si64((__m64 *)(outptr + 24), mmH);
354
+ }
355
+ outptr += RGB_PIXELSIZE * 8;
356
+ } else {
357
+ col = num_cols;
358
+ asm(".set noreorder\r\n" /* st16 */
359
+
360
+ "li $8, 4\r\n"
361
+ "move $9, %6\r\n"
362
+ "move $10, %7\r\n"
363
+ "mov.s $f4, %2\r\n"
364
+ "mov.s $f6, %4\r\n"
365
+ "bltu $9, $8, 1f\r\n"
366
+ "nop \r\n"
367
+ "gssdlc1 $f4, 7($10)\r\n"
368
+ "gssdrc1 $f4, 0($10)\r\n"
369
+ "gssdlc1 $f6, 7+8($10)\r\n"
370
+ "gssdrc1 $f6, 8($10)\r\n"
371
+ "mov.s $f4, %3\r\n"
372
+ "mov.s $f6, %5\r\n"
373
+ "subu $9, $9, 4\r\n"
374
+ PTR_ADDU "$10, $10, 16\r\n"
375
+
376
+ "1: \r\n"
377
+ "li $8, 2\r\n" /* st8 */
378
+ "bltu $9, $8, 2f\r\n"
379
+ "nop \r\n"
380
+ "gssdlc1 $f4, 7($10)\r\n"
381
+ "gssdrc1 $f4, 0($10)\r\n"
382
+ "mov.s $f4, $f6\r\n"
383
+ "subu $9, $9, 2\r\n"
384
+ PTR_ADDU "$10, $10, 8\r\n"
385
+
386
+ "2: \r\n"
387
+ "li $8, 1\r\n" /* st4 */
388
+ "bltu $9, $8, 3f\r\n"
389
+ "nop \r\n"
390
+ "gsswlc1 $f4, 3($10)\r\n"
391
+ "gsswrc1 $f4, 0($10)\r\n"
392
+
393
+ "3: \r\n"
394
+ "li %1, 0\r\n" /* end */
395
+ : "=m" (*outptr), "=r" (col)
396
+ : "f" (mmA), "f" (mmC), "f" (mmD), "f" (mmH), "r" (col),
397
+ "r" (outptr)
398
+ : "$f4", "$f6", "$8", "$9", "$10", "memory"
399
+ );
400
+ }
401
+
402
+ #endif
403
+
404
+ }
405
+ }
406
+ }
407
+
408
+ #undef mmA
409
+ #undef mmB
410
+ #undef mmC
411
+ #undef mmD
412
+ #undef mmE
413
+ #undef mmF
414
+ #undef mmG
415
+ #undef mmH
@@ -0,0 +1,139 @@
1
+ /*
2
+ * Loongson MMI optimizations for libjpeg-turbo
3
+ *
4
+ * Copyright (C) 2011, 2015, D. R. Commander. All Rights Reserved.
5
+ * Copyright (C) 2016-2017, Loongson Technology Corporation Limited, BeiJing.
6
+ * All Rights Reserved.
7
+ * Authors: ZhuChen <zhuchen@loongson.cn>
8
+ * CaiWanwei <caiwanwei@loongson.cn>
9
+ * SunZhangzhi <sunzhangzhi-cq@loongson.cn>
10
+ *
11
+ * This software is provided 'as-is', without any express or implied
12
+ * warranty. In no event will the authors be held liable for any damages
13
+ * arising from the use of this software.
14
+ *
15
+ * Permission is granted to anyone to use this software for any purpose,
16
+ * including commercial applications, and to alter it and redistribute it
17
+ * freely, subject to the following restrictions:
18
+ *
19
+ * 1. The origin of this software must not be misrepresented; you must not
20
+ * claim that you wrote the original software. If you use this software
21
+ * in a product, an acknowledgment in the product documentation would be
22
+ * appreciated but is not required.
23
+ * 2. Altered source versions must be plainly marked as such, and must not be
24
+ * misrepresented as being the original software.
25
+ * 3. This notice may not be removed or altered from any source distribution.
26
+ */
27
+
28
+ /* YCC --> RGB CONVERSION */
29
+
30
+ #include "jsimd_mmi.h"
31
+
32
+
33
+ #define F_0_344 ((short)22554) /* FIX(0.34414) */
34
+ #define F_0_402 ((short)26345) /* FIX(1.40200) - FIX(1) */
35
+ #define F_0_285 ((short)18734) /* FIX(1) - FIX(0.71414) */
36
+ #define F_0_228 ((short)14942) /* FIX(2) - FIX(1.77200) */
37
+
38
+ enum const_index {
39
+ index_PW_ONE,
40
+ index_PW_F0402,
41
+ index_PW_MF0228,
42
+ index_PW_MF0344_F0285,
43
+ index_PD_ONEHALF
44
+ };
45
+
46
+ static uint64_t const_value[] = {
47
+ _uint64_set_pi16(1, 1, 1, 1),
48
+ _uint64_set_pi16(F_0_402, F_0_402, F_0_402, F_0_402),
49
+ _uint64_set_pi16(-F_0_228, -F_0_228, -F_0_228, -F_0_228),
50
+ _uint64_set_pi16(F_0_285, -F_0_344, F_0_285, -F_0_344),
51
+ _uint64_set_pi32((int)(1 << (SCALEBITS - 1)), (int)(1 << (SCALEBITS - 1)))
52
+ };
53
+
54
+ #define PW_ONE get_const_value(index_PW_ONE)
55
+ #define PW_F0402 get_const_value(index_PW_F0402)
56
+ #define PW_MF0228 get_const_value(index_PW_MF0228)
57
+ #define PW_MF0344_F0285 get_const_value(index_PW_MF0344_F0285)
58
+ #define PD_ONEHALF get_const_value(index_PD_ONEHALF)
59
+
60
+ #define RGBX_FILLER_0XFF 1
61
+
62
+
63
+ #include "jdcolext-mmi.c"
64
+ #undef RGB_RED
65
+ #undef RGB_GREEN
66
+ #undef RGB_BLUE
67
+ #undef RGB_PIXELSIZE
68
+
69
+ #define RGB_RED EXT_RGB_RED
70
+ #define RGB_GREEN EXT_RGB_GREEN
71
+ #define RGB_BLUE EXT_RGB_BLUE
72
+ #define RGB_PIXELSIZE EXT_RGB_PIXELSIZE
73
+ #define jsimd_ycc_rgb_convert_mmi jsimd_ycc_extrgb_convert_mmi
74
+ #include "jdcolext-mmi.c"
75
+ #undef RGB_RED
76
+ #undef RGB_GREEN
77
+ #undef RGB_BLUE
78
+ #undef RGB_PIXELSIZE
79
+ #undef jsimd_ycc_rgb_convert_mmi
80
+
81
+ #define RGB_RED EXT_RGBX_RED
82
+ #define RGB_GREEN EXT_RGBX_GREEN
83
+ #define RGB_BLUE EXT_RGBX_BLUE
84
+ #define RGB_PIXELSIZE EXT_RGBX_PIXELSIZE
85
+ #define jsimd_ycc_rgb_convert_mmi jsimd_ycc_extrgbx_convert_mmi
86
+ #include "jdcolext-mmi.c"
87
+ #undef RGB_RED
88
+ #undef RGB_GREEN
89
+ #undef RGB_BLUE
90
+ #undef RGB_PIXELSIZE
91
+ #undef jsimd_ycc_rgb_convert_mmi
92
+
93
+ #define RGB_RED EXT_BGR_RED
94
+ #define RGB_GREEN EXT_BGR_GREEN
95
+ #define RGB_BLUE EXT_BGR_BLUE
96
+ #define RGB_PIXELSIZE EXT_BGR_PIXELSIZE
97
+ #define jsimd_ycc_rgb_convert_mmi jsimd_ycc_extbgr_convert_mmi
98
+ #include "jdcolext-mmi.c"
99
+ #undef RGB_RED
100
+ #undef RGB_GREEN
101
+ #undef RGB_BLUE
102
+ #undef RGB_PIXELSIZE
103
+ #undef jsimd_ycc_rgb_convert_mmi
104
+
105
+ #define RGB_RED EXT_BGRX_RED
106
+ #define RGB_GREEN EXT_BGRX_GREEN
107
+ #define RGB_BLUE EXT_BGRX_BLUE
108
+ #define RGB_PIXELSIZE EXT_BGRX_PIXELSIZE
109
+ #define jsimd_ycc_rgb_convert_mmi jsimd_ycc_extbgrx_convert_mmi
110
+ #include "jdcolext-mmi.c"
111
+ #undef RGB_RED
112
+ #undef RGB_GREEN
113
+ #undef RGB_BLUE
114
+ #undef RGB_PIXELSIZE
115
+ #undef jsimd_ycc_rgb_convert_mmi
116
+
117
+ #define RGB_RED EXT_XBGR_RED
118
+ #define RGB_GREEN EXT_XBGR_GREEN
119
+ #define RGB_BLUE EXT_XBGR_BLUE
120
+ #define RGB_PIXELSIZE EXT_XBGR_PIXELSIZE
121
+ #define jsimd_ycc_rgb_convert_mmi jsimd_ycc_extxbgr_convert_mmi
122
+ #include "jdcolext-mmi.c"
123
+ #undef RGB_RED
124
+ #undef RGB_GREEN
125
+ #undef RGB_BLUE
126
+ #undef RGB_PIXELSIZE
127
+ #undef jsimd_ycc_rgb_convert_mmi
128
+
129
+ #define RGB_RED EXT_XRGB_RED
130
+ #define RGB_GREEN EXT_XRGB_GREEN
131
+ #define RGB_BLUE EXT_XRGB_BLUE
132
+ #define RGB_PIXELSIZE EXT_XRGB_PIXELSIZE
133
+ #define jsimd_ycc_rgb_convert_mmi jsimd_ycc_extxrgb_convert_mmi
134
+ #include "jdcolext-mmi.c"
135
+ #undef RGB_RED
136
+ #undef RGB_GREEN
137
+ #undef RGB_BLUE
138
+ #undef RGB_PIXELSIZE
139
+ #undef jsimd_ycc_rgb_convert_mmi
@@ -0,0 +1,149 @@
1
+ /*
2
+ * Loongson MMI optimizations for libjpeg-turbo
3
+ *
4
+ * Copyright (C) 2011, 2015, D. R. Commander. All Rights Reserved.
5
+ * Copyright (C) 2016-2018, Loongson Technology Corporation Limited, BeiJing.
6
+ * All Rights Reserved.
7
+ * Authors: ZhangLixia <zhanglixia-hf@loongson.cn>
8
+ *
9
+ * This software is provided 'as-is', without any express or implied
10
+ * warranty. In no event will the authors be held liable for any damages
11
+ * arising from the use of this software.
12
+ *
13
+ * Permission is granted to anyone to use this software for any purpose,
14
+ * including commercial applications, and to alter it and redistribute it
15
+ * freely, subject to the following restrictions:
16
+ *
17
+ * 1. The origin of this software must not be misrepresented; you must not
18
+ * claim that you wrote the original software. If you use this software
19
+ * in a product, an acknowledgment in the product documentation would be
20
+ * appreciated but is not required.
21
+ * 2. Altered source versions must be plainly marked as such, and must not be
22
+ * misrepresented as being the original software.
23
+ * 3. This notice may not be removed or altered from any source distribution.
24
+ */
25
+
26
+ /* YCC --> RGB CONVERSION */
27
+
28
+ #include "jsimd_mmi.h"
29
+
30
+
31
+ #define F_0_344 ((short)22554) /* FIX(0.34414) */
32
+ #define F_0_402 ((short)26345) /* FIX(1.40200) - FIX(1) */
33
+ #define F_0_285 ((short)18734) /* FIX(1) - FIX(0.71414) */
34
+ #define F_0_228 ((short)14942) /* FIX(2) - FIX(1.77200) */
35
+
36
+ enum const_index {
37
+ index_PW_ONE,
38
+ index_PW_F0402,
39
+ index_PW_MF0228,
40
+ index_PW_MF0344_F0285,
41
+ index_PD_ONEHALF
42
+ };
43
+
44
+ static uint64_t const_value[] = {
45
+ _uint64_set_pi16(1, 1, 1, 1),
46
+ _uint64_set_pi16(F_0_402, F_0_402, F_0_402, F_0_402),
47
+ _uint64_set_pi16(-F_0_228, -F_0_228, -F_0_228, -F_0_228),
48
+ _uint64_set_pi16(F_0_285, -F_0_344, F_0_285, -F_0_344),
49
+ _uint64_set_pi32((int)(1 << (SCALEBITS - 1)), (int)(1 << (SCALEBITS - 1)))
50
+ };
51
+
52
+ #define PW_ONE get_const_value(index_PW_ONE)
53
+ #define PW_F0402 get_const_value(index_PW_F0402)
54
+ #define PW_MF0228 get_const_value(index_PW_MF0228)
55
+ #define PW_MF0344_F0285 get_const_value(index_PW_MF0344_F0285)
56
+ #define PD_ONEHALF get_const_value(index_PD_ONEHALF)
57
+
58
+ #define RGBX_FILLER_0XFF 1
59
+
60
+
61
+ #include "jdmrgext-mmi.c"
62
+ #undef RGB_RED
63
+ #undef RGB_GREEN
64
+ #undef RGB_BLUE
65
+ #undef RGB_PIXELSIZE
66
+
67
+ #define RGB_RED EXT_RGB_RED
68
+ #define RGB_GREEN EXT_RGB_GREEN
69
+ #define RGB_BLUE EXT_RGB_BLUE
70
+ #define RGB_PIXELSIZE EXT_RGB_PIXELSIZE
71
+ #define jsimd_h2v1_merged_upsample_mmi jsimd_h2v1_extrgb_merged_upsample_mmi
72
+ #define jsimd_h2v2_merged_upsample_mmi jsimd_h2v2_extrgb_merged_upsample_mmi
73
+ #include "jdmrgext-mmi.c"
74
+ #undef RGB_RED
75
+ #undef RGB_GREEN
76
+ #undef RGB_BLUE
77
+ #undef RGB_PIXELSIZE
78
+ #undef jsimd_h2v1_merged_upsample_mmi
79
+ #undef jsimd_h2v2_merged_upsample_mmi
80
+
81
+ #define RGB_RED EXT_RGBX_RED
82
+ #define RGB_GREEN EXT_RGBX_GREEN
83
+ #define RGB_BLUE EXT_RGBX_BLUE
84
+ #define RGB_PIXELSIZE EXT_RGBX_PIXELSIZE
85
+ #define jsimd_h2v1_merged_upsample_mmi jsimd_h2v1_extrgbx_merged_upsample_mmi
86
+ #define jsimd_h2v2_merged_upsample_mmi jsimd_h2v2_extrgbx_merged_upsample_mmi
87
+ #include "jdmrgext-mmi.c"
88
+ #undef RGB_RED
89
+ #undef RGB_GREEN
90
+ #undef RGB_BLUE
91
+ #undef RGB_PIXELSIZE
92
+ #undef jsimd_h2v1_merged_upsample_mmi
93
+ #undef jsimd_h2v2_merged_upsample_mmi
94
+
95
+ #define RGB_RED EXT_BGR_RED
96
+ #define RGB_GREEN EXT_BGR_GREEN
97
+ #define RGB_BLUE EXT_BGR_BLUE
98
+ #define RGB_PIXELSIZE EXT_BGR_PIXELSIZE
99
+ #define jsimd_h2v1_merged_upsample_mmi jsimd_h2v1_extbgr_merged_upsample_mmi
100
+ #define jsimd_h2v2_merged_upsample_mmi jsimd_h2v2_extbgr_merged_upsample_mmi
101
+ #include "jdmrgext-mmi.c"
102
+ #undef RGB_RED
103
+ #undef RGB_GREEN
104
+ #undef RGB_BLUE
105
+ #undef RGB_PIXELSIZE
106
+ #undef jsimd_h2v1_merged_upsample_mmi
107
+ #undef jsimd_h2v2_merged_upsample_mmi
108
+
109
+ #define RGB_RED EXT_BGRX_RED
110
+ #define RGB_GREEN EXT_BGRX_GREEN
111
+ #define RGB_BLUE EXT_BGRX_BLUE
112
+ #define RGB_PIXELSIZE EXT_BGRX_PIXELSIZE
113
+ #define jsimd_h2v1_merged_upsample_mmi jsimd_h2v1_extbgrx_merged_upsample_mmi
114
+ #define jsimd_h2v2_merged_upsample_mmi jsimd_h2v2_extbgrx_merged_upsample_mmi
115
+ #include "jdmrgext-mmi.c"
116
+ #undef RGB_RED
117
+ #undef RGB_GREEN
118
+ #undef RGB_BLUE
119
+ #undef RGB_PIXELSIZE
120
+ #undef jsimd_h2v1_merged_upsample_mmi
121
+ #undef jsimd_h2v2_merged_upsample_mmi
122
+
123
+ #define RGB_RED EXT_XBGR_RED
124
+ #define RGB_GREEN EXT_XBGR_GREEN
125
+ #define RGB_BLUE EXT_XBGR_BLUE
126
+ #define RGB_PIXELSIZE EXT_XBGR_PIXELSIZE
127
+ #define jsimd_h2v1_merged_upsample_mmi jsimd_h2v1_extxbgr_merged_upsample_mmi
128
+ #define jsimd_h2v2_merged_upsample_mmi jsimd_h2v2_extxbgr_merged_upsample_mmi
129
+ #include "jdmrgext-mmi.c"
130
+ #undef RGB_RED
131
+ #undef RGB_GREEN
132
+ #undef RGB_BLUE
133
+ #undef RGB_PIXELSIZE
134
+ #undef jsimd_h2v1_merged_upsample_mmi
135
+ #undef jsimd_h2v2_merged_upsample_mmi
136
+
137
+ #define RGB_RED EXT_XRGB_RED
138
+ #define RGB_GREEN EXT_XRGB_GREEN
139
+ #define RGB_BLUE EXT_XRGB_BLUE
140
+ #define RGB_PIXELSIZE EXT_XRGB_PIXELSIZE
141
+ #define jsimd_h2v1_merged_upsample_mmi jsimd_h2v1_extxrgb_merged_upsample_mmi
142
+ #define jsimd_h2v2_merged_upsample_mmi jsimd_h2v2_extxrgb_merged_upsample_mmi
143
+ #include "jdmrgext-mmi.c"
144
+ #undef RGB_RED
145
+ #undef RGB_GREEN
146
+ #undef RGB_BLUE
147
+ #undef RGB_PIXELSIZE
148
+ #undef jsimd_h2v1_merged_upsample_mmi
149
+ #undef jsimd_h2v2_merged_upsample_mmi