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,472 @@
1
+ /*
2
+ * jidctfst-neon.c - fast integer IDCT (Arm Neon)
3
+ *
4
+ * Copyright (C) 2020, Arm Limited. All Rights Reserved.
5
+ *
6
+ * This software is provided 'as-is', without any express or implied
7
+ * warranty. In no event will the authors be held liable for any damages
8
+ * arising from the use of this software.
9
+ *
10
+ * Permission is granted to anyone to use this software for any purpose,
11
+ * including commercial applications, and to alter it and redistribute it
12
+ * freely, subject to the following restrictions:
13
+ *
14
+ * 1. The origin of this software must not be misrepresented; you must not
15
+ * claim that you wrote the original software. If you use this software
16
+ * in a product, an acknowledgment in the product documentation would be
17
+ * appreciated but is not required.
18
+ * 2. Altered source versions must be plainly marked as such, and must not be
19
+ * misrepresented as being the original software.
20
+ * 3. This notice may not be removed or altered from any source distribution.
21
+ */
22
+
23
+ #define JPEG_INTERNALS
24
+ #include "../../jinclude.h"
25
+ #include "../../jpeglib.h"
26
+ #include "../../jsimd.h"
27
+ #include "../../jdct.h"
28
+ #include "../../jsimddct.h"
29
+ #include "../jsimd.h"
30
+ #include "align.h"
31
+
32
+ #include <arm_neon.h>
33
+
34
+
35
+ /* jsimd_idct_ifast_neon() performs dequantization and a fast, not so accurate
36
+ * inverse DCT (Discrete Cosine Transform) on one block of coefficients. It
37
+ * uses the same calculations and produces exactly the same output as IJG's
38
+ * original jpeg_idct_ifast() function, which can be found in jidctfst.c.
39
+ *
40
+ * Scaled integer constants are used to avoid floating-point arithmetic:
41
+ * 0.082392200 = 2688 * 2^-15
42
+ * 0.414213562 = 13568 * 2^-15
43
+ * 0.847759065 = 27776 * 2^-15
44
+ * 0.613125930 = 20096 * 2^-15
45
+ *
46
+ * See jidctfst.c for further details of the IDCT algorithm. Where possible,
47
+ * the variable names and comments here in jsimd_idct_ifast_neon() match up
48
+ * with those in jpeg_idct_ifast().
49
+ */
50
+
51
+ #define PASS1_BITS 2
52
+
53
+ #define F_0_082 2688
54
+ #define F_0_414 13568
55
+ #define F_0_847 27776
56
+ #define F_0_613 20096
57
+
58
+
59
+ ALIGN(16) static const int16_t jsimd_idct_ifast_neon_consts[] = {
60
+ F_0_082, F_0_414, F_0_847, F_0_613
61
+ };
62
+
63
+ void jsimd_idct_ifast_neon(void *dct_table, JCOEFPTR coef_block,
64
+ JSAMPARRAY output_buf, JDIMENSION output_col)
65
+ {
66
+ IFAST_MULT_TYPE *quantptr = dct_table;
67
+
68
+ /* Load DCT coefficients. */
69
+ int16x8_t row0 = vld1q_s16(coef_block + 0 * DCTSIZE);
70
+ int16x8_t row1 = vld1q_s16(coef_block + 1 * DCTSIZE);
71
+ int16x8_t row2 = vld1q_s16(coef_block + 2 * DCTSIZE);
72
+ int16x8_t row3 = vld1q_s16(coef_block + 3 * DCTSIZE);
73
+ int16x8_t row4 = vld1q_s16(coef_block + 4 * DCTSIZE);
74
+ int16x8_t row5 = vld1q_s16(coef_block + 5 * DCTSIZE);
75
+ int16x8_t row6 = vld1q_s16(coef_block + 6 * DCTSIZE);
76
+ int16x8_t row7 = vld1q_s16(coef_block + 7 * DCTSIZE);
77
+
78
+ /* Load quantization table values for DC coefficients. */
79
+ int16x8_t quant_row0 = vld1q_s16(quantptr + 0 * DCTSIZE);
80
+ /* Dequantize DC coefficients. */
81
+ row0 = vmulq_s16(row0, quant_row0);
82
+
83
+ /* Construct bitmap to test if all AC coefficients are 0. */
84
+ int16x8_t bitmap = vorrq_s16(row1, row2);
85
+ bitmap = vorrq_s16(bitmap, row3);
86
+ bitmap = vorrq_s16(bitmap, row4);
87
+ bitmap = vorrq_s16(bitmap, row5);
88
+ bitmap = vorrq_s16(bitmap, row6);
89
+ bitmap = vorrq_s16(bitmap, row7);
90
+
91
+ int64_t left_ac_bitmap = vgetq_lane_s64(vreinterpretq_s64_s16(bitmap), 0);
92
+ int64_t right_ac_bitmap = vgetq_lane_s64(vreinterpretq_s64_s16(bitmap), 1);
93
+
94
+ /* Load IDCT conversion constants. */
95
+ const int16x4_t consts = vld1_s16(jsimd_idct_ifast_neon_consts);
96
+
97
+ if (left_ac_bitmap == 0 && right_ac_bitmap == 0) {
98
+ /* All AC coefficients are zero.
99
+ * Compute DC values and duplicate into vectors.
100
+ */
101
+ int16x8_t dcval = row0;
102
+ row1 = dcval;
103
+ row2 = dcval;
104
+ row3 = dcval;
105
+ row4 = dcval;
106
+ row5 = dcval;
107
+ row6 = dcval;
108
+ row7 = dcval;
109
+ } else if (left_ac_bitmap == 0) {
110
+ /* AC coefficients are zero for columns 0, 1, 2, and 3.
111
+ * Use DC values for these columns.
112
+ */
113
+ int16x4_t dcval = vget_low_s16(row0);
114
+
115
+ /* Commence regular fast IDCT computation for columns 4, 5, 6, and 7. */
116
+
117
+ /* Load quantization table. */
118
+ int16x4_t quant_row1 = vld1_s16(quantptr + 1 * DCTSIZE + 4);
119
+ int16x4_t quant_row2 = vld1_s16(quantptr + 2 * DCTSIZE + 4);
120
+ int16x4_t quant_row3 = vld1_s16(quantptr + 3 * DCTSIZE + 4);
121
+ int16x4_t quant_row4 = vld1_s16(quantptr + 4 * DCTSIZE + 4);
122
+ int16x4_t quant_row5 = vld1_s16(quantptr + 5 * DCTSIZE + 4);
123
+ int16x4_t quant_row6 = vld1_s16(quantptr + 6 * DCTSIZE + 4);
124
+ int16x4_t quant_row7 = vld1_s16(quantptr + 7 * DCTSIZE + 4);
125
+
126
+ /* Even part: dequantize DCT coefficients. */
127
+ int16x4_t tmp0 = vget_high_s16(row0);
128
+ int16x4_t tmp1 = vmul_s16(vget_high_s16(row2), quant_row2);
129
+ int16x4_t tmp2 = vmul_s16(vget_high_s16(row4), quant_row4);
130
+ int16x4_t tmp3 = vmul_s16(vget_high_s16(row6), quant_row6);
131
+
132
+ int16x4_t tmp10 = vadd_s16(tmp0, tmp2); /* phase 3 */
133
+ int16x4_t tmp11 = vsub_s16(tmp0, tmp2);
134
+
135
+ int16x4_t tmp13 = vadd_s16(tmp1, tmp3); /* phases 5-3 */
136
+ int16x4_t tmp1_sub_tmp3 = vsub_s16(tmp1, tmp3);
137
+ int16x4_t tmp12 = vqdmulh_lane_s16(tmp1_sub_tmp3, consts, 1);
138
+ tmp12 = vadd_s16(tmp12, tmp1_sub_tmp3);
139
+ tmp12 = vsub_s16(tmp12, tmp13);
140
+
141
+ tmp0 = vadd_s16(tmp10, tmp13); /* phase 2 */
142
+ tmp3 = vsub_s16(tmp10, tmp13);
143
+ tmp1 = vadd_s16(tmp11, tmp12);
144
+ tmp2 = vsub_s16(tmp11, tmp12);
145
+
146
+ /* Odd part: dequantize DCT coefficients. */
147
+ int16x4_t tmp4 = vmul_s16(vget_high_s16(row1), quant_row1);
148
+ int16x4_t tmp5 = vmul_s16(vget_high_s16(row3), quant_row3);
149
+ int16x4_t tmp6 = vmul_s16(vget_high_s16(row5), quant_row5);
150
+ int16x4_t tmp7 = vmul_s16(vget_high_s16(row7), quant_row7);
151
+
152
+ int16x4_t z13 = vadd_s16(tmp6, tmp5); /* phase 6 */
153
+ int16x4_t neg_z10 = vsub_s16(tmp5, tmp6);
154
+ int16x4_t z11 = vadd_s16(tmp4, tmp7);
155
+ int16x4_t z12 = vsub_s16(tmp4, tmp7);
156
+
157
+ tmp7 = vadd_s16(z11, z13); /* phase 5 */
158
+ int16x4_t z11_sub_z13 = vsub_s16(z11, z13);
159
+ tmp11 = vqdmulh_lane_s16(z11_sub_z13, consts, 1);
160
+ tmp11 = vadd_s16(tmp11, z11_sub_z13);
161
+
162
+ int16x4_t z10_add_z12 = vsub_s16(z12, neg_z10);
163
+ int16x4_t z5 = vqdmulh_lane_s16(z10_add_z12, consts, 2);
164
+ z5 = vadd_s16(z5, z10_add_z12);
165
+ tmp10 = vqdmulh_lane_s16(z12, consts, 0);
166
+ tmp10 = vadd_s16(tmp10, z12);
167
+ tmp10 = vsub_s16(tmp10, z5);
168
+ tmp12 = vqdmulh_lane_s16(neg_z10, consts, 3);
169
+ tmp12 = vadd_s16(tmp12, vadd_s16(neg_z10, neg_z10));
170
+ tmp12 = vadd_s16(tmp12, z5);
171
+
172
+ tmp6 = vsub_s16(tmp12, tmp7); /* phase 2 */
173
+ tmp5 = vsub_s16(tmp11, tmp6);
174
+ tmp4 = vadd_s16(tmp10, tmp5);
175
+
176
+ row0 = vcombine_s16(dcval, vadd_s16(tmp0, tmp7));
177
+ row7 = vcombine_s16(dcval, vsub_s16(tmp0, tmp7));
178
+ row1 = vcombine_s16(dcval, vadd_s16(tmp1, tmp6));
179
+ row6 = vcombine_s16(dcval, vsub_s16(tmp1, tmp6));
180
+ row2 = vcombine_s16(dcval, vadd_s16(tmp2, tmp5));
181
+ row5 = vcombine_s16(dcval, vsub_s16(tmp2, tmp5));
182
+ row4 = vcombine_s16(dcval, vadd_s16(tmp3, tmp4));
183
+ row3 = vcombine_s16(dcval, vsub_s16(tmp3, tmp4));
184
+ } else if (right_ac_bitmap == 0) {
185
+ /* AC coefficients are zero for columns 4, 5, 6, and 7.
186
+ * Use DC values for these columns.
187
+ */
188
+ int16x4_t dcval = vget_high_s16(row0);
189
+
190
+ /* Commence regular fast IDCT computation for columns 0, 1, 2, and 3. */
191
+
192
+ /* Load quantization table. */
193
+ int16x4_t quant_row1 = vld1_s16(quantptr + 1 * DCTSIZE);
194
+ int16x4_t quant_row2 = vld1_s16(quantptr + 2 * DCTSIZE);
195
+ int16x4_t quant_row3 = vld1_s16(quantptr + 3 * DCTSIZE);
196
+ int16x4_t quant_row4 = vld1_s16(quantptr + 4 * DCTSIZE);
197
+ int16x4_t quant_row5 = vld1_s16(quantptr + 5 * DCTSIZE);
198
+ int16x4_t quant_row6 = vld1_s16(quantptr + 6 * DCTSIZE);
199
+ int16x4_t quant_row7 = vld1_s16(quantptr + 7 * DCTSIZE);
200
+
201
+ /* Even part: dequantize DCT coefficients. */
202
+ int16x4_t tmp0 = vget_low_s16(row0);
203
+ int16x4_t tmp1 = vmul_s16(vget_low_s16(row2), quant_row2);
204
+ int16x4_t tmp2 = vmul_s16(vget_low_s16(row4), quant_row4);
205
+ int16x4_t tmp3 = vmul_s16(vget_low_s16(row6), quant_row6);
206
+
207
+ int16x4_t tmp10 = vadd_s16(tmp0, tmp2); /* phase 3 */
208
+ int16x4_t tmp11 = vsub_s16(tmp0, tmp2);
209
+
210
+ int16x4_t tmp13 = vadd_s16(tmp1, tmp3); /* phases 5-3 */
211
+ int16x4_t tmp1_sub_tmp3 = vsub_s16(tmp1, tmp3);
212
+ int16x4_t tmp12 = vqdmulh_lane_s16(tmp1_sub_tmp3, consts, 1);
213
+ tmp12 = vadd_s16(tmp12, tmp1_sub_tmp3);
214
+ tmp12 = vsub_s16(tmp12, tmp13);
215
+
216
+ tmp0 = vadd_s16(tmp10, tmp13); /* phase 2 */
217
+ tmp3 = vsub_s16(tmp10, tmp13);
218
+ tmp1 = vadd_s16(tmp11, tmp12);
219
+ tmp2 = vsub_s16(tmp11, tmp12);
220
+
221
+ /* Odd part: dequantize DCT coefficients. */
222
+ int16x4_t tmp4 = vmul_s16(vget_low_s16(row1), quant_row1);
223
+ int16x4_t tmp5 = vmul_s16(vget_low_s16(row3), quant_row3);
224
+ int16x4_t tmp6 = vmul_s16(vget_low_s16(row5), quant_row5);
225
+ int16x4_t tmp7 = vmul_s16(vget_low_s16(row7), quant_row7);
226
+
227
+ int16x4_t z13 = vadd_s16(tmp6, tmp5); /* phase 6 */
228
+ int16x4_t neg_z10 = vsub_s16(tmp5, tmp6);
229
+ int16x4_t z11 = vadd_s16(tmp4, tmp7);
230
+ int16x4_t z12 = vsub_s16(tmp4, tmp7);
231
+
232
+ tmp7 = vadd_s16(z11, z13); /* phase 5 */
233
+ int16x4_t z11_sub_z13 = vsub_s16(z11, z13);
234
+ tmp11 = vqdmulh_lane_s16(z11_sub_z13, consts, 1);
235
+ tmp11 = vadd_s16(tmp11, z11_sub_z13);
236
+
237
+ int16x4_t z10_add_z12 = vsub_s16(z12, neg_z10);
238
+ int16x4_t z5 = vqdmulh_lane_s16(z10_add_z12, consts, 2);
239
+ z5 = vadd_s16(z5, z10_add_z12);
240
+ tmp10 = vqdmulh_lane_s16(z12, consts, 0);
241
+ tmp10 = vadd_s16(tmp10, z12);
242
+ tmp10 = vsub_s16(tmp10, z5);
243
+ tmp12 = vqdmulh_lane_s16(neg_z10, consts, 3);
244
+ tmp12 = vadd_s16(tmp12, vadd_s16(neg_z10, neg_z10));
245
+ tmp12 = vadd_s16(tmp12, z5);
246
+
247
+ tmp6 = vsub_s16(tmp12, tmp7); /* phase 2 */
248
+ tmp5 = vsub_s16(tmp11, tmp6);
249
+ tmp4 = vadd_s16(tmp10, tmp5);
250
+
251
+ row0 = vcombine_s16(vadd_s16(tmp0, tmp7), dcval);
252
+ row7 = vcombine_s16(vsub_s16(tmp0, tmp7), dcval);
253
+ row1 = vcombine_s16(vadd_s16(tmp1, tmp6), dcval);
254
+ row6 = vcombine_s16(vsub_s16(tmp1, tmp6), dcval);
255
+ row2 = vcombine_s16(vadd_s16(tmp2, tmp5), dcval);
256
+ row5 = vcombine_s16(vsub_s16(tmp2, tmp5), dcval);
257
+ row4 = vcombine_s16(vadd_s16(tmp3, tmp4), dcval);
258
+ row3 = vcombine_s16(vsub_s16(tmp3, tmp4), dcval);
259
+ } else {
260
+ /* Some AC coefficients are non-zero; full IDCT calculation required. */
261
+
262
+ /* Load quantization table. */
263
+ int16x8_t quant_row1 = vld1q_s16(quantptr + 1 * DCTSIZE);
264
+ int16x8_t quant_row2 = vld1q_s16(quantptr + 2 * DCTSIZE);
265
+ int16x8_t quant_row3 = vld1q_s16(quantptr + 3 * DCTSIZE);
266
+ int16x8_t quant_row4 = vld1q_s16(quantptr + 4 * DCTSIZE);
267
+ int16x8_t quant_row5 = vld1q_s16(quantptr + 5 * DCTSIZE);
268
+ int16x8_t quant_row6 = vld1q_s16(quantptr + 6 * DCTSIZE);
269
+ int16x8_t quant_row7 = vld1q_s16(quantptr + 7 * DCTSIZE);
270
+
271
+ /* Even part: dequantize DCT coefficients. */
272
+ int16x8_t tmp0 = row0;
273
+ int16x8_t tmp1 = vmulq_s16(row2, quant_row2);
274
+ int16x8_t tmp2 = vmulq_s16(row4, quant_row4);
275
+ int16x8_t tmp3 = vmulq_s16(row6, quant_row6);
276
+
277
+ int16x8_t tmp10 = vaddq_s16(tmp0, tmp2); /* phase 3 */
278
+ int16x8_t tmp11 = vsubq_s16(tmp0, tmp2);
279
+
280
+ int16x8_t tmp13 = vaddq_s16(tmp1, tmp3); /* phases 5-3 */
281
+ int16x8_t tmp1_sub_tmp3 = vsubq_s16(tmp1, tmp3);
282
+ int16x8_t tmp12 = vqdmulhq_lane_s16(tmp1_sub_tmp3, consts, 1);
283
+ tmp12 = vaddq_s16(tmp12, tmp1_sub_tmp3);
284
+ tmp12 = vsubq_s16(tmp12, tmp13);
285
+
286
+ tmp0 = vaddq_s16(tmp10, tmp13); /* phase 2 */
287
+ tmp3 = vsubq_s16(tmp10, tmp13);
288
+ tmp1 = vaddq_s16(tmp11, tmp12);
289
+ tmp2 = vsubq_s16(tmp11, tmp12);
290
+
291
+ /* Odd part: dequantize DCT coefficients. */
292
+ int16x8_t tmp4 = vmulq_s16(row1, quant_row1);
293
+ int16x8_t tmp5 = vmulq_s16(row3, quant_row3);
294
+ int16x8_t tmp6 = vmulq_s16(row5, quant_row5);
295
+ int16x8_t tmp7 = vmulq_s16(row7, quant_row7);
296
+
297
+ int16x8_t z13 = vaddq_s16(tmp6, tmp5); /* phase 6 */
298
+ int16x8_t neg_z10 = vsubq_s16(tmp5, tmp6);
299
+ int16x8_t z11 = vaddq_s16(tmp4, tmp7);
300
+ int16x8_t z12 = vsubq_s16(tmp4, tmp7);
301
+
302
+ tmp7 = vaddq_s16(z11, z13); /* phase 5 */
303
+ int16x8_t z11_sub_z13 = vsubq_s16(z11, z13);
304
+ tmp11 = vqdmulhq_lane_s16(z11_sub_z13, consts, 1);
305
+ tmp11 = vaddq_s16(tmp11, z11_sub_z13);
306
+
307
+ int16x8_t z10_add_z12 = vsubq_s16(z12, neg_z10);
308
+ int16x8_t z5 = vqdmulhq_lane_s16(z10_add_z12, consts, 2);
309
+ z5 = vaddq_s16(z5, z10_add_z12);
310
+ tmp10 = vqdmulhq_lane_s16(z12, consts, 0);
311
+ tmp10 = vaddq_s16(tmp10, z12);
312
+ tmp10 = vsubq_s16(tmp10, z5);
313
+ tmp12 = vqdmulhq_lane_s16(neg_z10, consts, 3);
314
+ tmp12 = vaddq_s16(tmp12, vaddq_s16(neg_z10, neg_z10));
315
+ tmp12 = vaddq_s16(tmp12, z5);
316
+
317
+ tmp6 = vsubq_s16(tmp12, tmp7); /* phase 2 */
318
+ tmp5 = vsubq_s16(tmp11, tmp6);
319
+ tmp4 = vaddq_s16(tmp10, tmp5);
320
+
321
+ row0 = vaddq_s16(tmp0, tmp7);
322
+ row7 = vsubq_s16(tmp0, tmp7);
323
+ row1 = vaddq_s16(tmp1, tmp6);
324
+ row6 = vsubq_s16(tmp1, tmp6);
325
+ row2 = vaddq_s16(tmp2, tmp5);
326
+ row5 = vsubq_s16(tmp2, tmp5);
327
+ row4 = vaddq_s16(tmp3, tmp4);
328
+ row3 = vsubq_s16(tmp3, tmp4);
329
+ }
330
+
331
+ /* Transpose rows to work on columns in pass 2. */
332
+ int16x8x2_t rows_01 = vtrnq_s16(row0, row1);
333
+ int16x8x2_t rows_23 = vtrnq_s16(row2, row3);
334
+ int16x8x2_t rows_45 = vtrnq_s16(row4, row5);
335
+ int16x8x2_t rows_67 = vtrnq_s16(row6, row7);
336
+
337
+ int32x4x2_t rows_0145_l = vtrnq_s32(vreinterpretq_s32_s16(rows_01.val[0]),
338
+ vreinterpretq_s32_s16(rows_45.val[0]));
339
+ int32x4x2_t rows_0145_h = vtrnq_s32(vreinterpretq_s32_s16(rows_01.val[1]),
340
+ vreinterpretq_s32_s16(rows_45.val[1]));
341
+ int32x4x2_t rows_2367_l = vtrnq_s32(vreinterpretq_s32_s16(rows_23.val[0]),
342
+ vreinterpretq_s32_s16(rows_67.val[0]));
343
+ int32x4x2_t rows_2367_h = vtrnq_s32(vreinterpretq_s32_s16(rows_23.val[1]),
344
+ vreinterpretq_s32_s16(rows_67.val[1]));
345
+
346
+ int32x4x2_t cols_04 = vzipq_s32(rows_0145_l.val[0], rows_2367_l.val[0]);
347
+ int32x4x2_t cols_15 = vzipq_s32(rows_0145_h.val[0], rows_2367_h.val[0]);
348
+ int32x4x2_t cols_26 = vzipq_s32(rows_0145_l.val[1], rows_2367_l.val[1]);
349
+ int32x4x2_t cols_37 = vzipq_s32(rows_0145_h.val[1], rows_2367_h.val[1]);
350
+
351
+ int16x8_t col0 = vreinterpretq_s16_s32(cols_04.val[0]);
352
+ int16x8_t col1 = vreinterpretq_s16_s32(cols_15.val[0]);
353
+ int16x8_t col2 = vreinterpretq_s16_s32(cols_26.val[0]);
354
+ int16x8_t col3 = vreinterpretq_s16_s32(cols_37.val[0]);
355
+ int16x8_t col4 = vreinterpretq_s16_s32(cols_04.val[1]);
356
+ int16x8_t col5 = vreinterpretq_s16_s32(cols_15.val[1]);
357
+ int16x8_t col6 = vreinterpretq_s16_s32(cols_26.val[1]);
358
+ int16x8_t col7 = vreinterpretq_s16_s32(cols_37.val[1]);
359
+
360
+ /* 1-D IDCT, pass 2 */
361
+
362
+ /* Even part */
363
+ int16x8_t tmp10 = vaddq_s16(col0, col4);
364
+ int16x8_t tmp11 = vsubq_s16(col0, col4);
365
+
366
+ int16x8_t tmp13 = vaddq_s16(col2, col6);
367
+ int16x8_t col2_sub_col6 = vsubq_s16(col2, col6);
368
+ int16x8_t tmp12 = vqdmulhq_lane_s16(col2_sub_col6, consts, 1);
369
+ tmp12 = vaddq_s16(tmp12, col2_sub_col6);
370
+ tmp12 = vsubq_s16(tmp12, tmp13);
371
+
372
+ int16x8_t tmp0 = vaddq_s16(tmp10, tmp13);
373
+ int16x8_t tmp3 = vsubq_s16(tmp10, tmp13);
374
+ int16x8_t tmp1 = vaddq_s16(tmp11, tmp12);
375
+ int16x8_t tmp2 = vsubq_s16(tmp11, tmp12);
376
+
377
+ /* Odd part */
378
+ int16x8_t z13 = vaddq_s16(col5, col3);
379
+ int16x8_t neg_z10 = vsubq_s16(col3, col5);
380
+ int16x8_t z11 = vaddq_s16(col1, col7);
381
+ int16x8_t z12 = vsubq_s16(col1, col7);
382
+
383
+ int16x8_t tmp7 = vaddq_s16(z11, z13); /* phase 5 */
384
+ int16x8_t z11_sub_z13 = vsubq_s16(z11, z13);
385
+ tmp11 = vqdmulhq_lane_s16(z11_sub_z13, consts, 1);
386
+ tmp11 = vaddq_s16(tmp11, z11_sub_z13);
387
+
388
+ int16x8_t z10_add_z12 = vsubq_s16(z12, neg_z10);
389
+ int16x8_t z5 = vqdmulhq_lane_s16(z10_add_z12, consts, 2);
390
+ z5 = vaddq_s16(z5, z10_add_z12);
391
+ tmp10 = vqdmulhq_lane_s16(z12, consts, 0);
392
+ tmp10 = vaddq_s16(tmp10, z12);
393
+ tmp10 = vsubq_s16(tmp10, z5);
394
+ tmp12 = vqdmulhq_lane_s16(neg_z10, consts, 3);
395
+ tmp12 = vaddq_s16(tmp12, vaddq_s16(neg_z10, neg_z10));
396
+ tmp12 = vaddq_s16(tmp12, z5);
397
+
398
+ int16x8_t tmp6 = vsubq_s16(tmp12, tmp7); /* phase 2 */
399
+ int16x8_t tmp5 = vsubq_s16(tmp11, tmp6);
400
+ int16x8_t tmp4 = vaddq_s16(tmp10, tmp5);
401
+
402
+ col0 = vaddq_s16(tmp0, tmp7);
403
+ col7 = vsubq_s16(tmp0, tmp7);
404
+ col1 = vaddq_s16(tmp1, tmp6);
405
+ col6 = vsubq_s16(tmp1, tmp6);
406
+ col2 = vaddq_s16(tmp2, tmp5);
407
+ col5 = vsubq_s16(tmp2, tmp5);
408
+ col4 = vaddq_s16(tmp3, tmp4);
409
+ col3 = vsubq_s16(tmp3, tmp4);
410
+
411
+ /* Scale down by a factor of 8, narrowing to 8-bit. */
412
+ int8x16_t cols_01_s8 = vcombine_s8(vqshrn_n_s16(col0, PASS1_BITS + 3),
413
+ vqshrn_n_s16(col1, PASS1_BITS + 3));
414
+ int8x16_t cols_45_s8 = vcombine_s8(vqshrn_n_s16(col4, PASS1_BITS + 3),
415
+ vqshrn_n_s16(col5, PASS1_BITS + 3));
416
+ int8x16_t cols_23_s8 = vcombine_s8(vqshrn_n_s16(col2, PASS1_BITS + 3),
417
+ vqshrn_n_s16(col3, PASS1_BITS + 3));
418
+ int8x16_t cols_67_s8 = vcombine_s8(vqshrn_n_s16(col6, PASS1_BITS + 3),
419
+ vqshrn_n_s16(col7, PASS1_BITS + 3));
420
+ /* Clamp to range [0-255]. */
421
+ uint8x16_t cols_01 =
422
+ vreinterpretq_u8_s8
423
+ (vaddq_s8(cols_01_s8, vreinterpretq_s8_u8(vdupq_n_u8(CENTERJSAMPLE))));
424
+ uint8x16_t cols_45 =
425
+ vreinterpretq_u8_s8
426
+ (vaddq_s8(cols_45_s8, vreinterpretq_s8_u8(vdupq_n_u8(CENTERJSAMPLE))));
427
+ uint8x16_t cols_23 =
428
+ vreinterpretq_u8_s8
429
+ (vaddq_s8(cols_23_s8, vreinterpretq_s8_u8(vdupq_n_u8(CENTERJSAMPLE))));
430
+ uint8x16_t cols_67 =
431
+ vreinterpretq_u8_s8
432
+ (vaddq_s8(cols_67_s8, vreinterpretq_s8_u8(vdupq_n_u8(CENTERJSAMPLE))));
433
+
434
+ /* Transpose block to prepare for store. */
435
+ uint32x4x2_t cols_0415 = vzipq_u32(vreinterpretq_u32_u8(cols_01),
436
+ vreinterpretq_u32_u8(cols_45));
437
+ uint32x4x2_t cols_2637 = vzipq_u32(vreinterpretq_u32_u8(cols_23),
438
+ vreinterpretq_u32_u8(cols_67));
439
+
440
+ uint8x16x2_t cols_0145 = vtrnq_u8(vreinterpretq_u8_u32(cols_0415.val[0]),
441
+ vreinterpretq_u8_u32(cols_0415.val[1]));
442
+ uint8x16x2_t cols_2367 = vtrnq_u8(vreinterpretq_u8_u32(cols_2637.val[0]),
443
+ vreinterpretq_u8_u32(cols_2637.val[1]));
444
+ uint16x8x2_t rows_0426 = vtrnq_u16(vreinterpretq_u16_u8(cols_0145.val[0]),
445
+ vreinterpretq_u16_u8(cols_2367.val[0]));
446
+ uint16x8x2_t rows_1537 = vtrnq_u16(vreinterpretq_u16_u8(cols_0145.val[1]),
447
+ vreinterpretq_u16_u8(cols_2367.val[1]));
448
+
449
+ uint8x16_t rows_04 = vreinterpretq_u8_u16(rows_0426.val[0]);
450
+ uint8x16_t rows_15 = vreinterpretq_u8_u16(rows_1537.val[0]);
451
+ uint8x16_t rows_26 = vreinterpretq_u8_u16(rows_0426.val[1]);
452
+ uint8x16_t rows_37 = vreinterpretq_u8_u16(rows_1537.val[1]);
453
+
454
+ JSAMPROW outptr0 = output_buf[0] + output_col;
455
+ JSAMPROW outptr1 = output_buf[1] + output_col;
456
+ JSAMPROW outptr2 = output_buf[2] + output_col;
457
+ JSAMPROW outptr3 = output_buf[3] + output_col;
458
+ JSAMPROW outptr4 = output_buf[4] + output_col;
459
+ JSAMPROW outptr5 = output_buf[5] + output_col;
460
+ JSAMPROW outptr6 = output_buf[6] + output_col;
461
+ JSAMPROW outptr7 = output_buf[7] + output_col;
462
+
463
+ /* Store DCT block to memory. */
464
+ vst1q_lane_u64((uint64_t *)outptr0, vreinterpretq_u64_u8(rows_04), 0);
465
+ vst1q_lane_u64((uint64_t *)outptr1, vreinterpretq_u64_u8(rows_15), 0);
466
+ vst1q_lane_u64((uint64_t *)outptr2, vreinterpretq_u64_u8(rows_26), 0);
467
+ vst1q_lane_u64((uint64_t *)outptr3, vreinterpretq_u64_u8(rows_37), 0);
468
+ vst1q_lane_u64((uint64_t *)outptr4, vreinterpretq_u64_u8(rows_04), 1);
469
+ vst1q_lane_u64((uint64_t *)outptr5, vreinterpretq_u64_u8(rows_15), 1);
470
+ vst1q_lane_u64((uint64_t *)outptr6, vreinterpretq_u64_u8(rows_26), 1);
471
+ vst1q_lane_u64((uint64_t *)outptr7, vreinterpretq_u64_u8(rows_37), 1);
472
+ }