rfreeimage 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (860) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +21 -0
  3. data/README.md +1 -0
  4. data/Rakefile +34 -0
  5. data/ext/rfreeimage/extconf.rb +35 -0
  6. data/ext/rfreeimage/rfi_main.c +389 -0
  7. data/lib/rfreeimage/image.rb +26 -0
  8. data/lib/rfreeimage/version.rb +3 -0
  9. data/lib/rfreeimage.rb +3 -0
  10. data/rfreeimage.gemspec +32 -0
  11. data/vendor/FreeImage/Makefile +34 -0
  12. data/vendor/FreeImage/Makefile.cygwin +74 -0
  13. data/vendor/FreeImage/Makefile.fip +84 -0
  14. data/vendor/FreeImage/Makefile.gnu +83 -0
  15. data/vendor/FreeImage/Makefile.iphone +96 -0
  16. data/vendor/FreeImage/Makefile.mingw +136 -0
  17. data/vendor/FreeImage/Makefile.osx +115 -0
  18. data/vendor/FreeImage/Makefile.solaris +66 -0
  19. data/vendor/FreeImage/Makefile.srcs +6 -0
  20. data/vendor/FreeImage/README.iphone +19 -0
  21. data/vendor/FreeImage/README.linux +50 -0
  22. data/vendor/FreeImage/README.minGW +236 -0
  23. data/vendor/FreeImage/README.osx +44 -0
  24. data/vendor/FreeImage/README.solaris +67 -0
  25. data/vendor/FreeImage/Source/CacheFile.h +92 -0
  26. data/vendor/FreeImage/Source/DeprecationManager/Deprecated.cpp +36 -0
  27. data/vendor/FreeImage/Source/DeprecationManager/DeprecationMgr.cpp +103 -0
  28. data/vendor/FreeImage/Source/DeprecationManager/DeprecationMgr.h +83 -0
  29. data/vendor/FreeImage/Source/FreeImage/BitmapAccess.cpp +1573 -0
  30. data/vendor/FreeImage/Source/FreeImage/CacheFile.cpp +271 -0
  31. data/vendor/FreeImage/Source/FreeImage/ColorLookup.cpp +785 -0
  32. data/vendor/FreeImage/Source/FreeImage/Conversion.cpp +551 -0
  33. data/vendor/FreeImage/Source/FreeImage/Conversion16_555.cpp +209 -0
  34. data/vendor/FreeImage/Source/FreeImage/Conversion16_565.cpp +204 -0
  35. data/vendor/FreeImage/Source/FreeImage/Conversion24.cpp +252 -0
  36. data/vendor/FreeImage/Source/FreeImage/Conversion32.cpp +345 -0
  37. data/vendor/FreeImage/Source/FreeImage/Conversion4.cpp +246 -0
  38. data/vendor/FreeImage/Source/FreeImage/Conversion8.cpp +305 -0
  39. data/vendor/FreeImage/Source/FreeImage/ConversionFloat.cpp +194 -0
  40. data/vendor/FreeImage/Source/FreeImage/ConversionRGB16.cpp +144 -0
  41. data/vendor/FreeImage/Source/FreeImage/ConversionRGBA16.cpp +147 -0
  42. data/vendor/FreeImage/Source/FreeImage/ConversionRGBAF.cpp +250 -0
  43. data/vendor/FreeImage/Source/FreeImage/ConversionRGBF.cpp +243 -0
  44. data/vendor/FreeImage/Source/FreeImage/ConversionType.cpp +699 -0
  45. data/vendor/FreeImage/Source/FreeImage/ConversionUINT16.cpp +134 -0
  46. data/vendor/FreeImage/Source/FreeImage/FreeImage.cpp +226 -0
  47. data/vendor/FreeImage/Source/FreeImage/FreeImageC.c +22 -0
  48. data/vendor/FreeImage/Source/FreeImage/FreeImageIO.cpp +175 -0
  49. data/vendor/FreeImage/Source/FreeImage/GetType.cpp +92 -0
  50. data/vendor/FreeImage/Source/FreeImage/Halftoning.cpp +474 -0
  51. data/vendor/FreeImage/Source/FreeImage/J2KHelper.cpp +591 -0
  52. data/vendor/FreeImage/Source/FreeImage/J2KHelper.h +36 -0
  53. data/vendor/FreeImage/Source/FreeImage/LFPQuantizer.cpp +208 -0
  54. data/vendor/FreeImage/Source/FreeImage/MNGHelper.cpp +1320 -0
  55. data/vendor/FreeImage/Source/FreeImage/MemoryIO.cpp +237 -0
  56. data/vendor/FreeImage/Source/FreeImage/MultiPage.cpp +974 -0
  57. data/vendor/FreeImage/Source/FreeImage/NNQuantizer.cpp +507 -0
  58. data/vendor/FreeImage/Source/FreeImage/PSDParser.cpp +1057 -0
  59. data/vendor/FreeImage/Source/FreeImage/PSDParser.h +271 -0
  60. data/vendor/FreeImage/Source/FreeImage/PixelAccess.cpp +197 -0
  61. data/vendor/FreeImage/Source/FreeImage/Plugin.cpp +822 -0
  62. data/vendor/FreeImage/Source/FreeImage/PluginBMP.cpp +1494 -0
  63. data/vendor/FreeImage/Source/FreeImage/PluginCUT.cpp +240 -0
  64. data/vendor/FreeImage/Source/FreeImage/PluginDDS.cpp +655 -0
  65. data/vendor/FreeImage/Source/FreeImage/PluginEXR.cpp +773 -0
  66. data/vendor/FreeImage/Source/FreeImage/PluginG3.cpp +433 -0
  67. data/vendor/FreeImage/Source/FreeImage/PluginGIF.cpp +1407 -0
  68. data/vendor/FreeImage/Source/FreeImage/PluginHDR.cpp +722 -0
  69. data/vendor/FreeImage/Source/FreeImage/PluginICO.cpp +824 -0
  70. data/vendor/FreeImage/Source/FreeImage/PluginIFF.cpp +459 -0
  71. data/vendor/FreeImage/Source/FreeImage/PluginJ2K.cpp +328 -0
  72. data/vendor/FreeImage/Source/FreeImage/PluginJNG.cpp +162 -0
  73. data/vendor/FreeImage/Source/FreeImage/PluginJP2.cpp +328 -0
  74. data/vendor/FreeImage/Source/FreeImage/PluginJPEG.cpp +1706 -0
  75. data/vendor/FreeImage/Source/FreeImage/PluginJXR.cpp +1475 -0
  76. data/vendor/FreeImage/Source/FreeImage/PluginKOALA.cpp +243 -0
  77. data/vendor/FreeImage/Source/FreeImage/PluginMNG.cpp +153 -0
  78. data/vendor/FreeImage/Source/FreeImage/PluginPCD.cpp +251 -0
  79. data/vendor/FreeImage/Source/FreeImage/PluginPCX.cpp +659 -0
  80. data/vendor/FreeImage/Source/FreeImage/PluginPFM.cpp +409 -0
  81. data/vendor/FreeImage/Source/FreeImage/PluginPICT.cpp +1343 -0
  82. data/vendor/FreeImage/Source/FreeImage/PluginPNG.cpp +1115 -0
  83. data/vendor/FreeImage/Source/FreeImage/PluginPNM.cpp +838 -0
  84. data/vendor/FreeImage/Source/FreeImage/PluginPSD.cpp +131 -0
  85. data/vendor/FreeImage/Source/FreeImage/PluginRAS.cpp +512 -0
  86. data/vendor/FreeImage/Source/FreeImage/PluginRAW.cpp +793 -0
  87. data/vendor/FreeImage/Source/FreeImage/PluginSGI.cpp +425 -0
  88. data/vendor/FreeImage/Source/FreeImage/PluginTARGA.cpp +1591 -0
  89. data/vendor/FreeImage/Source/FreeImage/PluginTIFF.cpp +2631 -0
  90. data/vendor/FreeImage/Source/FreeImage/PluginWBMP.cpp +372 -0
  91. data/vendor/FreeImage/Source/FreeImage/PluginWebP.cpp +698 -0
  92. data/vendor/FreeImage/Source/FreeImage/PluginXBM.cpp +399 -0
  93. data/vendor/FreeImage/Source/FreeImage/PluginXPM.cpp +487 -0
  94. data/vendor/FreeImage/Source/FreeImage/TIFFLogLuv.cpp +65 -0
  95. data/vendor/FreeImage/Source/FreeImage/ToneMapping.cpp +75 -0
  96. data/vendor/FreeImage/Source/FreeImage/WuQuantizer.cpp +559 -0
  97. data/vendor/FreeImage/Source/FreeImage/ZLibInterface.cpp +223 -0
  98. data/vendor/FreeImage/Source/FreeImage/tmoColorConvert.cpp +479 -0
  99. data/vendor/FreeImage/Source/FreeImage/tmoDrago03.cpp +295 -0
  100. data/vendor/FreeImage/Source/FreeImage/tmoFattal02.cpp +689 -0
  101. data/vendor/FreeImage/Source/FreeImage/tmoReinhard05.cpp +260 -0
  102. data/vendor/FreeImage/Source/FreeImage.h +1153 -0
  103. data/vendor/FreeImage/Source/FreeImageIO.h +63 -0
  104. data/vendor/FreeImage/Source/FreeImageToolkit/BSplineRotate.cpp +730 -0
  105. data/vendor/FreeImage/Source/FreeImageToolkit/Background.cpp +895 -0
  106. data/vendor/FreeImage/Source/FreeImageToolkit/Channels.cpp +488 -0
  107. data/vendor/FreeImage/Source/FreeImageToolkit/ClassicRotate.cpp +917 -0
  108. data/vendor/FreeImage/Source/FreeImageToolkit/Colors.cpp +967 -0
  109. data/vendor/FreeImage/Source/FreeImageToolkit/CopyPaste.cpp +861 -0
  110. data/vendor/FreeImage/Source/FreeImageToolkit/Display.cpp +230 -0
  111. data/vendor/FreeImage/Source/FreeImageToolkit/Filters.h +287 -0
  112. data/vendor/FreeImage/Source/FreeImageToolkit/Flip.cpp +166 -0
  113. data/vendor/FreeImage/Source/FreeImageToolkit/JPEGTransform.cpp +623 -0
  114. data/vendor/FreeImage/Source/FreeImageToolkit/MultigridPoissonSolver.cpp +505 -0
  115. data/vendor/FreeImage/Source/FreeImageToolkit/Rescale.cpp +192 -0
  116. data/vendor/FreeImage/Source/FreeImageToolkit/Resize.cpp +2116 -0
  117. data/vendor/FreeImage/Source/FreeImageToolkit/Resize.h +196 -0
  118. data/vendor/FreeImage/Source/LibJPEG/ansi2knr.c +739 -0
  119. data/vendor/FreeImage/Source/LibJPEG/cderror.h +134 -0
  120. data/vendor/FreeImage/Source/LibJPEG/cdjpeg.c +181 -0
  121. data/vendor/FreeImage/Source/LibJPEG/cdjpeg.h +187 -0
  122. data/vendor/FreeImage/Source/LibJPEG/cjpeg.c +664 -0
  123. data/vendor/FreeImage/Source/LibJPEG/ckconfig.c +402 -0
  124. data/vendor/FreeImage/Source/LibJPEG/djpeg.c +617 -0
  125. data/vendor/FreeImage/Source/LibJPEG/example.c +433 -0
  126. data/vendor/FreeImage/Source/LibJPEG/jaricom.c +153 -0
  127. data/vendor/FreeImage/Source/LibJPEG/jcapimin.c +288 -0
  128. data/vendor/FreeImage/Source/LibJPEG/jcapistd.c +162 -0
  129. data/vendor/FreeImage/Source/LibJPEG/jcarith.c +944 -0
  130. data/vendor/FreeImage/Source/LibJPEG/jccoefct.c +454 -0
  131. data/vendor/FreeImage/Source/LibJPEG/jccolor.c +604 -0
  132. data/vendor/FreeImage/Source/LibJPEG/jcdctmgr.c +477 -0
  133. data/vendor/FreeImage/Source/LibJPEG/jchuff.c +1573 -0
  134. data/vendor/FreeImage/Source/LibJPEG/jcinit.c +84 -0
  135. data/vendor/FreeImage/Source/LibJPEG/jcmainct.c +297 -0
  136. data/vendor/FreeImage/Source/LibJPEG/jcmarker.c +719 -0
  137. data/vendor/FreeImage/Source/LibJPEG/jcmaster.c +856 -0
  138. data/vendor/FreeImage/Source/LibJPEG/jcomapi.c +106 -0
  139. data/vendor/FreeImage/Source/LibJPEG/jconfig.h +161 -0
  140. data/vendor/FreeImage/Source/LibJPEG/jcparam.c +675 -0
  141. data/vendor/FreeImage/Source/LibJPEG/jcprepct.c +358 -0
  142. data/vendor/FreeImage/Source/LibJPEG/jcsample.c +545 -0
  143. data/vendor/FreeImage/Source/LibJPEG/jctrans.c +385 -0
  144. data/vendor/FreeImage/Source/LibJPEG/jdapimin.c +399 -0
  145. data/vendor/FreeImage/Source/LibJPEG/jdapistd.c +276 -0
  146. data/vendor/FreeImage/Source/LibJPEG/jdarith.c +796 -0
  147. data/vendor/FreeImage/Source/LibJPEG/jdatadst.c +270 -0
  148. data/vendor/FreeImage/Source/LibJPEG/jdatasrc.c +275 -0
  149. data/vendor/FreeImage/Source/LibJPEG/jdcoefct.c +741 -0
  150. data/vendor/FreeImage/Source/LibJPEG/jdcolor.c +748 -0
  151. data/vendor/FreeImage/Source/LibJPEG/jdct.h +393 -0
  152. data/vendor/FreeImage/Source/LibJPEG/jddctmgr.c +384 -0
  153. data/vendor/FreeImage/Source/LibJPEG/jdhuff.c +1554 -0
  154. data/vendor/FreeImage/Source/LibJPEG/jdinput.c +662 -0
  155. data/vendor/FreeImage/Source/LibJPEG/jdmainct.c +513 -0
  156. data/vendor/FreeImage/Source/LibJPEG/jdmarker.c +1511 -0
  157. data/vendor/FreeImage/Source/LibJPEG/jdmaster.c +543 -0
  158. data/vendor/FreeImage/Source/LibJPEG/jdmerge.c +401 -0
  159. data/vendor/FreeImage/Source/LibJPEG/jdpostct.c +290 -0
  160. data/vendor/FreeImage/Source/LibJPEG/jdsample.c +361 -0
  161. data/vendor/FreeImage/Source/LibJPEG/jdtrans.c +140 -0
  162. data/vendor/FreeImage/Source/LibJPEG/jerror.c +253 -0
  163. data/vendor/FreeImage/Source/LibJPEG/jerror.h +304 -0
  164. data/vendor/FreeImage/Source/LibJPEG/jfdctflt.c +174 -0
  165. data/vendor/FreeImage/Source/LibJPEG/jfdctfst.c +230 -0
  166. data/vendor/FreeImage/Source/LibJPEG/jfdctint.c +4406 -0
  167. data/vendor/FreeImage/Source/LibJPEG/jidctflt.c +235 -0
  168. data/vendor/FreeImage/Source/LibJPEG/jidctfst.c +368 -0
  169. data/vendor/FreeImage/Source/LibJPEG/jidctint.c +5179 -0
  170. data/vendor/FreeImage/Source/LibJPEG/jinclude.h +91 -0
  171. data/vendor/FreeImage/Source/LibJPEG/jmemansi.c +167 -0
  172. data/vendor/FreeImage/Source/LibJPEG/jmemdos.c +638 -0
  173. data/vendor/FreeImage/Source/LibJPEG/jmemmac.c +289 -0
  174. data/vendor/FreeImage/Source/LibJPEG/jmemmgr.c +1119 -0
  175. data/vendor/FreeImage/Source/LibJPEG/jmemname.c +276 -0
  176. data/vendor/FreeImage/Source/LibJPEG/jmemnobs.c +109 -0
  177. data/vendor/FreeImage/Source/LibJPEG/jmemsys.h +198 -0
  178. data/vendor/FreeImage/Source/LibJPEG/jmorecfg.h +442 -0
  179. data/vendor/FreeImage/Source/LibJPEG/jpegint.h +426 -0
  180. data/vendor/FreeImage/Source/LibJPEG/jpeglib.h +1180 -0
  181. data/vendor/FreeImage/Source/LibJPEG/jpegtran.c +577 -0
  182. data/vendor/FreeImage/Source/LibJPEG/jquant1.c +857 -0
  183. data/vendor/FreeImage/Source/LibJPEG/jquant2.c +1311 -0
  184. data/vendor/FreeImage/Source/LibJPEG/jutils.c +227 -0
  185. data/vendor/FreeImage/Source/LibJPEG/jversion.h +14 -0
  186. data/vendor/FreeImage/Source/LibJPEG/rdbmp.c +480 -0
  187. data/vendor/FreeImage/Source/LibJPEG/rdcolmap.c +253 -0
  188. data/vendor/FreeImage/Source/LibJPEG/rdgif.c +38 -0
  189. data/vendor/FreeImage/Source/LibJPEG/rdjpgcom.c +515 -0
  190. data/vendor/FreeImage/Source/LibJPEG/rdppm.c +459 -0
  191. data/vendor/FreeImage/Source/LibJPEG/rdrle.c +387 -0
  192. data/vendor/FreeImage/Source/LibJPEG/rdswitch.c +365 -0
  193. data/vendor/FreeImage/Source/LibJPEG/rdtarga.c +500 -0
  194. data/vendor/FreeImage/Source/LibJPEG/transupp.c +1763 -0
  195. data/vendor/FreeImage/Source/LibJPEG/transupp.h +219 -0
  196. data/vendor/FreeImage/Source/LibJPEG/wrbmp.c +442 -0
  197. data/vendor/FreeImage/Source/LibJPEG/wrgif.c +399 -0
  198. data/vendor/FreeImage/Source/LibJPEG/wrjpgcom.c +583 -0
  199. data/vendor/FreeImage/Source/LibJPEG/wrppm.c +269 -0
  200. data/vendor/FreeImage/Source/LibJPEG/wrrle.c +305 -0
  201. data/vendor/FreeImage/Source/LibJPEG/wrtarga.c +253 -0
  202. data/vendor/FreeImage/Source/LibJXR/common/include/guiddef.h +230 -0
  203. data/vendor/FreeImage/Source/LibJXR/common/include/wmsal.h +757 -0
  204. data/vendor/FreeImage/Source/LibJXR/common/include/wmspecstring.h +342 -0
  205. data/vendor/FreeImage/Source/LibJXR/common/include/wmspecstrings_adt.h +71 -0
  206. data/vendor/FreeImage/Source/LibJXR/common/include/wmspecstrings_strict.h +1096 -0
  207. data/vendor/FreeImage/Source/LibJXR/common/include/wmspecstrings_undef.h +406 -0
  208. data/vendor/FreeImage/Source/LibJXR/image/decode/JXRTranscode.c +987 -0
  209. data/vendor/FreeImage/Source/LibJXR/image/decode/decode.c +200 -0
  210. data/vendor/FreeImage/Source/LibJXR/image/decode/decode.h +143 -0
  211. data/vendor/FreeImage/Source/LibJXR/image/decode/postprocess.c +288 -0
  212. data/vendor/FreeImage/Source/LibJXR/image/decode/segdec.c +1205 -0
  213. data/vendor/FreeImage/Source/LibJXR/image/decode/strInvTransform.c +1888 -0
  214. data/vendor/FreeImage/Source/LibJXR/image/decode/strPredQuantDec.c +539 -0
  215. data/vendor/FreeImage/Source/LibJXR/image/decode/strdec.c +3628 -0
  216. data/vendor/FreeImage/Source/LibJXR/image/decode/strdec_x86.c +1640 -0
  217. data/vendor/FreeImage/Source/LibJXR/image/encode/encode.c +144 -0
  218. data/vendor/FreeImage/Source/LibJXR/image/encode/encode.h +113 -0
  219. data/vendor/FreeImage/Source/LibJXR/image/encode/segenc.c +1186 -0
  220. data/vendor/FreeImage/Source/LibJXR/image/encode/strFwdTransform.c +1111 -0
  221. data/vendor/FreeImage/Source/LibJXR/image/encode/strPredQuantEnc.c +511 -0
  222. data/vendor/FreeImage/Source/LibJXR/image/encode/strenc.c +2370 -0
  223. data/vendor/FreeImage/Source/LibJXR/image/encode/strenc_x86.c +409 -0
  224. data/vendor/FreeImage/Source/LibJXR/image/sys/adapthuff.c +511 -0
  225. data/vendor/FreeImage/Source/LibJXR/image/sys/ansi.h +61 -0
  226. data/vendor/FreeImage/Source/LibJXR/image/sys/common.h +131 -0
  227. data/vendor/FreeImage/Source/LibJXR/image/sys/image.c +183 -0
  228. data/vendor/FreeImage/Source/LibJXR/image/sys/perfTimer.h +115 -0
  229. data/vendor/FreeImage/Source/LibJXR/image/sys/perfTimerANSI.c +274 -0
  230. data/vendor/FreeImage/Source/LibJXR/image/sys/strPredQuant.c +306 -0
  231. data/vendor/FreeImage/Source/LibJXR/image/sys/strTransform.c +85 -0
  232. data/vendor/FreeImage/Source/LibJXR/image/sys/strTransform.h +50 -0
  233. data/vendor/FreeImage/Source/LibJXR/image/sys/strcodec.c +1251 -0
  234. data/vendor/FreeImage/Source/LibJXR/image/sys/strcodec.h +681 -0
  235. data/vendor/FreeImage/Source/LibJXR/image/sys/windowsmediaphoto.h +515 -0
  236. data/vendor/FreeImage/Source/LibJXR/image/sys/xplatform_image.h +84 -0
  237. data/vendor/FreeImage/Source/LibJXR/image/x86/x86.h +58 -0
  238. data/vendor/FreeImage/Source/LibJXR/jxrgluelib/JXRGlue.c +930 -0
  239. data/vendor/FreeImage/Source/LibJXR/jxrgluelib/JXRGlue.h +636 -0
  240. data/vendor/FreeImage/Source/LibJXR/jxrgluelib/JXRGlueJxr.c +2246 -0
  241. data/vendor/FreeImage/Source/LibJXR/jxrgluelib/JXRGluePFC.c +2338 -0
  242. data/vendor/FreeImage/Source/LibJXR/jxrgluelib/JXRMeta.c +905 -0
  243. data/vendor/FreeImage/Source/LibJXR/jxrgluelib/JXRMeta.h +258 -0
  244. data/vendor/FreeImage/Source/LibOpenJPEG/bio.c +188 -0
  245. data/vendor/FreeImage/Source/LibOpenJPEG/bio.h +128 -0
  246. data/vendor/FreeImage/Source/LibOpenJPEG/cidx_manager.c +239 -0
  247. data/vendor/FreeImage/Source/LibOpenJPEG/cidx_manager.h +68 -0
  248. data/vendor/FreeImage/Source/LibOpenJPEG/cio.c +644 -0
  249. data/vendor/FreeImage/Source/LibOpenJPEG/cio.h +393 -0
  250. data/vendor/FreeImage/Source/LibOpenJPEG/dwt.c +919 -0
  251. data/vendor/FreeImage/Source/LibOpenJPEG/dwt.h +116 -0
  252. data/vendor/FreeImage/Source/LibOpenJPEG/event.c +141 -0
  253. data/vendor/FreeImage/Source/LibOpenJPEG/event.h +97 -0
  254. data/vendor/FreeImage/Source/LibOpenJPEG/function_list.c +114 -0
  255. data/vendor/FreeImage/Source/LibOpenJPEG/function_list.h +126 -0
  256. data/vendor/FreeImage/Source/LibOpenJPEG/image.c +235 -0
  257. data/vendor/FreeImage/Source/LibOpenJPEG/image.h +63 -0
  258. data/vendor/FreeImage/Source/LibOpenJPEG/indexbox_manager.h +148 -0
  259. data/vendor/FreeImage/Source/LibOpenJPEG/invert.c +289 -0
  260. data/vendor/FreeImage/Source/LibOpenJPEG/invert.h +59 -0
  261. data/vendor/FreeImage/Source/LibOpenJPEG/j2k.c +10238 -0
  262. data/vendor/FreeImage/Source/LibOpenJPEG/j2k.h +838 -0
  263. data/vendor/FreeImage/Source/LibOpenJPEG/jp2.c +2776 -0
  264. data/vendor/FreeImage/Source/LibOpenJPEG/jp2.h +490 -0
  265. data/vendor/FreeImage/Source/LibOpenJPEG/mct.c +319 -0
  266. data/vendor/FreeImage/Source/LibOpenJPEG/mct.h +149 -0
  267. data/vendor/FreeImage/Source/LibOpenJPEG/mqc.c +604 -0
  268. data/vendor/FreeImage/Source/LibOpenJPEG/mqc.h +201 -0
  269. data/vendor/FreeImage/Source/LibOpenJPEG/openjpeg.c +955 -0
  270. data/vendor/FreeImage/Source/LibOpenJPEG/openjpeg.h +1475 -0
  271. data/vendor/FreeImage/Source/LibOpenJPEG/opj_clock.c +59 -0
  272. data/vendor/FreeImage/Source/LibOpenJPEG/opj_clock.h +54 -0
  273. data/vendor/FreeImage/Source/LibOpenJPEG/opj_codec.h +160 -0
  274. data/vendor/FreeImage/Source/LibOpenJPEG/opj_config.h +9 -0
  275. data/vendor/FreeImage/Source/LibOpenJPEG/opj_config_private.h +16 -0
  276. data/vendor/FreeImage/Source/LibOpenJPEG/opj_includes.h +175 -0
  277. data/vendor/FreeImage/Source/LibOpenJPEG/opj_intmath.h +172 -0
  278. data/vendor/FreeImage/Source/LibOpenJPEG/opj_inttypes.h +43 -0
  279. data/vendor/FreeImage/Source/LibOpenJPEG/opj_malloc.h +180 -0
  280. data/vendor/FreeImage/Source/LibOpenJPEG/opj_stdint.h +47 -0
  281. data/vendor/FreeImage/Source/LibOpenJPEG/phix_manager.c +191 -0
  282. data/vendor/FreeImage/Source/LibOpenJPEG/pi.c +1870 -0
  283. data/vendor/FreeImage/Source/LibOpenJPEG/pi.h +182 -0
  284. data/vendor/FreeImage/Source/LibOpenJPEG/ppix_manager.c +194 -0
  285. data/vendor/FreeImage/Source/LibOpenJPEG/raw.c +89 -0
  286. data/vendor/FreeImage/Source/LibOpenJPEG/raw.h +100 -0
  287. data/vendor/FreeImage/Source/LibOpenJPEG/t1.c +1751 -0
  288. data/vendor/FreeImage/Source/LibOpenJPEG/t1.h +157 -0
  289. data/vendor/FreeImage/Source/LibOpenJPEG/t1_generate_luts.c +276 -0
  290. data/vendor/FreeImage/Source/LibOpenJPEG/t1_luts.h +143 -0
  291. data/vendor/FreeImage/Source/LibOpenJPEG/t2.c +1334 -0
  292. data/vendor/FreeImage/Source/LibOpenJPEG/t2.h +127 -0
  293. data/vendor/FreeImage/Source/LibOpenJPEG/tcd.c +2123 -0
  294. data/vendor/FreeImage/Source/LibOpenJPEG/tcd.h +348 -0
  295. data/vendor/FreeImage/Source/LibOpenJPEG/tgt.c +331 -0
  296. data/vendor/FreeImage/Source/LibOpenJPEG/tgt.h +140 -0
  297. data/vendor/FreeImage/Source/LibOpenJPEG/thix_manager.c +134 -0
  298. data/vendor/FreeImage/Source/LibOpenJPEG/tpix_manager.c +185 -0
  299. data/vendor/FreeImage/Source/LibPNG/example.c +1061 -0
  300. data/vendor/FreeImage/Source/LibPNG/png.c +4493 -0
  301. data/vendor/FreeImage/Source/LibPNG/png.h +3282 -0
  302. data/vendor/FreeImage/Source/LibPNG/pngconf.h +644 -0
  303. data/vendor/FreeImage/Source/LibPNG/pngdebug.h +154 -0
  304. data/vendor/FreeImage/Source/LibPNG/pngerror.c +963 -0
  305. data/vendor/FreeImage/Source/LibPNG/pngget.c +1213 -0
  306. data/vendor/FreeImage/Source/LibPNG/pnginfo.h +260 -0
  307. data/vendor/FreeImage/Source/LibPNG/pnglibconf.h +218 -0
  308. data/vendor/FreeImage/Source/LibPNG/pngmem.c +281 -0
  309. data/vendor/FreeImage/Source/LibPNG/pngpread.c +1168 -0
  310. data/vendor/FreeImage/Source/LibPNG/pngpriv.h +1944 -0
  311. data/vendor/FreeImage/Source/LibPNG/pngread.c +4121 -0
  312. data/vendor/FreeImage/Source/LibPNG/pngrio.c +120 -0
  313. data/vendor/FreeImage/Source/LibPNG/pngrtran.c +4994 -0
  314. data/vendor/FreeImage/Source/LibPNG/pngrutil.c +4474 -0
  315. data/vendor/FreeImage/Source/LibPNG/pngset.c +1611 -0
  316. data/vendor/FreeImage/Source/LibPNG/pngstruct.h +489 -0
  317. data/vendor/FreeImage/Source/LibPNG/pngtest.c +2011 -0
  318. data/vendor/FreeImage/Source/LibPNG/pngtrans.c +849 -0
  319. data/vendor/FreeImage/Source/LibPNG/pngwio.c +168 -0
  320. data/vendor/FreeImage/Source/LibPNG/pngwrite.c +2455 -0
  321. data/vendor/FreeImage/Source/LibPNG/pngwtran.c +574 -0
  322. data/vendor/FreeImage/Source/LibPNG/pngwutil.c +3029 -0
  323. data/vendor/FreeImage/Source/LibRawLite/dcraw/dcraw.c +15462 -0
  324. data/vendor/FreeImage/Source/LibRawLite/internal/aahd_demosaic.cpp +706 -0
  325. data/vendor/FreeImage/Source/LibRawLite/internal/dcb_demosaicing.c +710 -0
  326. data/vendor/FreeImage/Source/LibRawLite/internal/dcraw_common.cpp +13593 -0
  327. data/vendor/FreeImage/Source/LibRawLite/internal/dcraw_fileio.cpp +240 -0
  328. data/vendor/FreeImage/Source/LibRawLite/internal/defines.h +167 -0
  329. data/vendor/FreeImage/Source/LibRawLite/internal/demosaic_packs.cpp +99 -0
  330. data/vendor/FreeImage/Source/LibRawLite/internal/dht_demosaic.cpp +873 -0
  331. data/vendor/FreeImage/Source/LibRawLite/internal/libraw_internal_funcs.h +282 -0
  332. data/vendor/FreeImage/Source/LibRawLite/internal/libraw_x3f.cpp +1919 -0
  333. data/vendor/FreeImage/Source/LibRawLite/internal/var_defines.h +216 -0
  334. data/vendor/FreeImage/Source/LibRawLite/internal/wf_filtering.cpp +1950 -0
  335. data/vendor/FreeImage/Source/LibRawLite/libraw/libraw.h +338 -0
  336. data/vendor/FreeImage/Source/LibRawLite/libraw/libraw_alloc.h +99 -0
  337. data/vendor/FreeImage/Source/LibRawLite/libraw/libraw_const.h +233 -0
  338. data/vendor/FreeImage/Source/LibRawLite/libraw/libraw_datastream.h +238 -0
  339. data/vendor/FreeImage/Source/LibRawLite/libraw/libraw_internal.h +225 -0
  340. data/vendor/FreeImage/Source/LibRawLite/libraw/libraw_types.h +442 -0
  341. data/vendor/FreeImage/Source/LibRawLite/libraw/libraw_version.h +62 -0
  342. data/vendor/FreeImage/Source/LibRawLite/src/libraw_c_api.cpp +230 -0
  343. data/vendor/FreeImage/Source/LibRawLite/src/libraw_cxx.cpp +4533 -0
  344. data/vendor/FreeImage/Source/LibRawLite/src/libraw_datastream.cpp +703 -0
  345. data/vendor/FreeImage/Source/LibTIFF4/mkg3states.c +451 -0
  346. data/vendor/FreeImage/Source/LibTIFF4/mkspans.c +82 -0
  347. data/vendor/FreeImage/Source/LibTIFF4/t4.h +292 -0
  348. data/vendor/FreeImage/Source/LibTIFF4/tif_aux.c +358 -0
  349. data/vendor/FreeImage/Source/LibTIFF4/tif_close.c +140 -0
  350. data/vendor/FreeImage/Source/LibTIFF4/tif_codec.c +166 -0
  351. data/vendor/FreeImage/Source/LibTIFF4/tif_color.c +287 -0
  352. data/vendor/FreeImage/Source/LibTIFF4/tif_compress.c +304 -0
  353. data/vendor/FreeImage/Source/LibTIFF4/tif_config.h +97 -0
  354. data/vendor/FreeImage/Source/LibTIFF4/tif_config.vc.h +74 -0
  355. data/vendor/FreeImage/Source/LibTIFF4/tif_config.wince.h +71 -0
  356. data/vendor/FreeImage/Source/LibTIFF4/tif_dir.c +1700 -0
  357. data/vendor/FreeImage/Source/LibTIFF4/tif_dir.h +308 -0
  358. data/vendor/FreeImage/Source/LibTIFF4/tif_dirinfo.c +959 -0
  359. data/vendor/FreeImage/Source/LibTIFF4/tif_dirread.c +5640 -0
  360. data/vendor/FreeImage/Source/LibTIFF4/tif_dirwrite.c +2910 -0
  361. data/vendor/FreeImage/Source/LibTIFF4/tif_dumpmode.c +143 -0
  362. data/vendor/FreeImage/Source/LibTIFF4/tif_error.c +80 -0
  363. data/vendor/FreeImage/Source/LibTIFF4/tif_extension.c +118 -0
  364. data/vendor/FreeImage/Source/LibTIFF4/tif_fax3.c +1595 -0
  365. data/vendor/FreeImage/Source/LibTIFF4/tif_fax3.h +538 -0
  366. data/vendor/FreeImage/Source/LibTIFF4/tif_fax3sm.c +1260 -0
  367. data/vendor/FreeImage/Source/LibTIFF4/tif_flush.c +118 -0
  368. data/vendor/FreeImage/Source/LibTIFF4/tif_getimage.c +2890 -0
  369. data/vendor/FreeImage/Source/LibTIFF4/tif_jbig.c +213 -0
  370. data/vendor/FreeImage/Source/LibTIFF4/tif_jpeg.c +2354 -0
  371. data/vendor/FreeImage/Source/LibTIFF4/tif_jpeg_12.c +65 -0
  372. data/vendor/FreeImage/Source/LibTIFF4/tif_luv.c +1683 -0
  373. data/vendor/FreeImage/Source/LibTIFF4/tif_lzma.c +495 -0
  374. data/vendor/FreeImage/Source/LibTIFF4/tif_lzw.c +1169 -0
  375. data/vendor/FreeImage/Source/LibTIFF4/tif_next.c +181 -0
  376. data/vendor/FreeImage/Source/LibTIFF4/tif_ojpeg.c +2501 -0
  377. data/vendor/FreeImage/Source/LibTIFF4/tif_open.c +725 -0
  378. data/vendor/FreeImage/Source/LibTIFF4/tif_packbits.c +300 -0
  379. data/vendor/FreeImage/Source/LibTIFF4/tif_pixarlog.c +1442 -0
  380. data/vendor/FreeImage/Source/LibTIFF4/tif_predict.c +764 -0
  381. data/vendor/FreeImage/Source/LibTIFF4/tif_predict.h +77 -0
  382. data/vendor/FreeImage/Source/LibTIFF4/tif_print.c +716 -0
  383. data/vendor/FreeImage/Source/LibTIFF4/tif_read.c +1086 -0
  384. data/vendor/FreeImage/Source/LibTIFF4/tif_strip.c +383 -0
  385. data/vendor/FreeImage/Source/LibTIFF4/tif_swab.c +310 -0
  386. data/vendor/FreeImage/Source/LibTIFF4/tif_thunder.c +207 -0
  387. data/vendor/FreeImage/Source/LibTIFF4/tif_tile.c +299 -0
  388. data/vendor/FreeImage/Source/LibTIFF4/tif_unix.c +325 -0
  389. data/vendor/FreeImage/Source/LibTIFF4/tif_version.c +40 -0
  390. data/vendor/FreeImage/Source/LibTIFF4/tif_vms.c +603 -0
  391. data/vendor/FreeImage/Source/LibTIFF4/tif_warning.c +81 -0
  392. data/vendor/FreeImage/Source/LibTIFF4/tif_win32.c +443 -0
  393. data/vendor/FreeImage/Source/LibTIFF4/tif_wince.c +293 -0
  394. data/vendor/FreeImage/Source/LibTIFF4/tif_write.c +771 -0
  395. data/vendor/FreeImage/Source/LibTIFF4/tif_zip.c +472 -0
  396. data/vendor/FreeImage/Source/LibTIFF4/tiff.h +681 -0
  397. data/vendor/FreeImage/Source/LibTIFF4/tiffconf.h +170 -0
  398. data/vendor/FreeImage/Source/LibTIFF4/tiffconf.vc.h +160 -0
  399. data/vendor/FreeImage/Source/LibTIFF4/tiffconf.wince.h +121 -0
  400. data/vendor/FreeImage/Source/LibTIFF4/tiffio.h +557 -0
  401. data/vendor/FreeImage/Source/LibTIFF4/tiffiop.h +367 -0
  402. data/vendor/FreeImage/Source/LibTIFF4/tiffvers.h +9 -0
  403. data/vendor/FreeImage/Source/LibTIFF4/uvcode.h +180 -0
  404. data/vendor/FreeImage/Source/LibWebP/src/dec/alphai.h +55 -0
  405. data/vendor/FreeImage/Source/LibWebP/src/dec/dec.alpha.c +167 -0
  406. data/vendor/FreeImage/Source/LibWebP/src/dec/dec.buffer.c +249 -0
  407. data/vendor/FreeImage/Source/LibWebP/src/dec/dec.frame.c +827 -0
  408. data/vendor/FreeImage/Source/LibWebP/src/dec/dec.idec.c +857 -0
  409. data/vendor/FreeImage/Source/LibWebP/src/dec/dec.io.c +640 -0
  410. data/vendor/FreeImage/Source/LibWebP/src/dec/dec.quant.c +110 -0
  411. data/vendor/FreeImage/Source/LibWebP/src/dec/dec.tree.c +525 -0
  412. data/vendor/FreeImage/Source/LibWebP/src/dec/dec.vp8.c +663 -0
  413. data/vendor/FreeImage/Source/LibWebP/src/dec/dec.vp8l.c +1584 -0
  414. data/vendor/FreeImage/Source/LibWebP/src/dec/dec.webp.c +834 -0
  415. data/vendor/FreeImage/Source/LibWebP/src/dec/decode_vp8.h +185 -0
  416. data/vendor/FreeImage/Source/LibWebP/src/dec/vp8i.h +353 -0
  417. data/vendor/FreeImage/Source/LibWebP/src/dec/vp8li.h +136 -0
  418. data/vendor/FreeImage/Source/LibWebP/src/dec/webpi.h +120 -0
  419. data/vendor/FreeImage/Source/LibWebP/src/demux/demux.demux.c +957 -0
  420. data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.alpha_processing.c +377 -0
  421. data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.alpha_processing_mips_dsp_r2.c +139 -0
  422. data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.alpha_processing_sse2.c +296 -0
  423. data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.argb.c +68 -0
  424. data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.argb_mips_dsp_r2.c +108 -0
  425. data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.argb_sse2.c +62 -0
  426. data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.cost.c +412 -0
  427. data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.cost_mips32.c +154 -0
  428. data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.cost_mips_dsp_r2.c +107 -0
  429. data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.cost_sse2.c +121 -0
  430. data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.cpu.c +138 -0
  431. data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.dec.c +760 -0
  432. data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.dec_clip_tables.c +366 -0
  433. data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.dec_mips32.c +585 -0
  434. data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.dec_mips_dsp_r2.c +992 -0
  435. data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.dec_neon.c +1489 -0
  436. data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.dec_sse2.c +1284 -0
  437. data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.enc.c +788 -0
  438. data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.enc_avx2.c +24 -0
  439. data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.enc_mips32.c +670 -0
  440. data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.enc_mips_dsp_r2.c +1510 -0
  441. data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.enc_neon.c +932 -0
  442. data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.enc_sse2.c +940 -0
  443. data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.filters.c +240 -0
  444. data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.filters_mips_dsp_r2.c +404 -0
  445. data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.filters_sse2.c +349 -0
  446. data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.h +434 -0
  447. data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.lossless.c +1838 -0
  448. data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.lossless_mips32.c +416 -0
  449. data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.lossless_mips_dsp_r2.c +921 -0
  450. data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.lossless_neon.c +357 -0
  451. data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.lossless_sse2.c +535 -0
  452. data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.rescaler.c +115 -0
  453. data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.rescaler_mips32.c +192 -0
  454. data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.rescaler_mips_dsp_r2.c +210 -0
  455. data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.upsampling.c +252 -0
  456. data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.upsampling_mips_dsp_r2.c +280 -0
  457. data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.upsampling_neon.c +267 -0
  458. data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.upsampling_sse2.c +214 -0
  459. data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.yuv.c +166 -0
  460. data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.yuv_mips32.c +100 -0
  461. data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.yuv_mips_dsp_r2.c +131 -0
  462. data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.yuv_sse2.c +322 -0
  463. data/vendor/FreeImage/Source/LibWebP/src/dsp/lossless.h +313 -0
  464. data/vendor/FreeImage/Source/LibWebP/src/dsp/mips_macro.h +200 -0
  465. data/vendor/FreeImage/Source/LibWebP/src/dsp/neon.h +82 -0
  466. data/vendor/FreeImage/Source/LibWebP/src/dsp/yuv.h +321 -0
  467. data/vendor/FreeImage/Source/LibWebP/src/dsp/yuv_tables_sse2.h +536 -0
  468. data/vendor/FreeImage/Source/LibWebP/src/enc/backward_references.h +202 -0
  469. data/vendor/FreeImage/Source/LibWebP/src/enc/cost.h +69 -0
  470. data/vendor/FreeImage/Source/LibWebP/src/enc/enc.alpha.c +440 -0
  471. data/vendor/FreeImage/Source/LibWebP/src/enc/enc.analysis.c +501 -0
  472. data/vendor/FreeImage/Source/LibWebP/src/enc/enc.backward_references.c +1076 -0
  473. data/vendor/FreeImage/Source/LibWebP/src/enc/enc.config.c +163 -0
  474. data/vendor/FreeImage/Source/LibWebP/src/enc/enc.cost.c +355 -0
  475. data/vendor/FreeImage/Source/LibWebP/src/enc/enc.filter.c +296 -0
  476. data/vendor/FreeImage/Source/LibWebP/src/enc/enc.frame.c +850 -0
  477. data/vendor/FreeImage/Source/LibWebP/src/enc/enc.histogram.c +897 -0
  478. data/vendor/FreeImage/Source/LibWebP/src/enc/enc.iterator.c +456 -0
  479. data/vendor/FreeImage/Source/LibWebP/src/enc/enc.near_lossless.c +160 -0
  480. data/vendor/FreeImage/Source/LibWebP/src/enc/enc.picture.c +290 -0
  481. data/vendor/FreeImage/Source/LibWebP/src/enc/enc.picture_csp.c +1100 -0
  482. data/vendor/FreeImage/Source/LibWebP/src/enc/enc.picture_psnr.c +150 -0
  483. data/vendor/FreeImage/Source/LibWebP/src/enc/enc.picture_rescale.c +285 -0
  484. data/vendor/FreeImage/Source/LibWebP/src/enc/enc.picture_tools.c +206 -0
  485. data/vendor/FreeImage/Source/LibWebP/src/enc/enc.quant.c +1191 -0
  486. data/vendor/FreeImage/Source/LibWebP/src/enc/enc.syntax.c +383 -0
  487. data/vendor/FreeImage/Source/LibWebP/src/enc/enc.token.c +285 -0
  488. data/vendor/FreeImage/Source/LibWebP/src/enc/enc.tree.c +504 -0
  489. data/vendor/FreeImage/Source/LibWebP/src/enc/enc.vp8l.c +1437 -0
  490. data/vendor/FreeImage/Source/LibWebP/src/enc/enc.webpenc.c +379 -0
  491. data/vendor/FreeImage/Source/LibWebP/src/enc/histogram.h +114 -0
  492. data/vendor/FreeImage/Source/LibWebP/src/enc/vp8enci.h +551 -0
  493. data/vendor/FreeImage/Source/LibWebP/src/enc/vp8li.h +78 -0
  494. data/vendor/FreeImage/Source/LibWebP/src/mux/mux.anim_encode.c +1241 -0
  495. data/vendor/FreeImage/Source/LibWebP/src/mux/mux.muxedit.c +696 -0
  496. data/vendor/FreeImage/Source/LibWebP/src/mux/mux.muxinternal.c +551 -0
  497. data/vendor/FreeImage/Source/LibWebP/src/mux/mux.muxread.c +544 -0
  498. data/vendor/FreeImage/Source/LibWebP/src/mux/muxi.h +232 -0
  499. data/vendor/FreeImage/Source/LibWebP/src/utils/bit_reader.h +168 -0
  500. data/vendor/FreeImage/Source/LibWebP/src/utils/bit_reader_inl.h +172 -0
  501. data/vendor/FreeImage/Source/LibWebP/src/utils/bit_writer.h +120 -0
  502. data/vendor/FreeImage/Source/LibWebP/src/utils/color_cache.h +74 -0
  503. data/vendor/FreeImage/Source/LibWebP/src/utils/endian_inl.h +100 -0
  504. data/vendor/FreeImage/Source/LibWebP/src/utils/filters.h +32 -0
  505. data/vendor/FreeImage/Source/LibWebP/src/utils/huffman.h +67 -0
  506. data/vendor/FreeImage/Source/LibWebP/src/utils/huffman_encode.h +60 -0
  507. data/vendor/FreeImage/Source/LibWebP/src/utils/quant_levels.h +36 -0
  508. data/vendor/FreeImage/Source/LibWebP/src/utils/quant_levels_dec.h +35 -0
  509. data/vendor/FreeImage/Source/LibWebP/src/utils/random.h +63 -0
  510. data/vendor/FreeImage/Source/LibWebP/src/utils/rescaler.h +78 -0
  511. data/vendor/FreeImage/Source/LibWebP/src/utils/thread.h +93 -0
  512. data/vendor/FreeImage/Source/LibWebP/src/utils/utils.bit_reader.c +208 -0
  513. data/vendor/FreeImage/Source/LibWebP/src/utils/utils.bit_writer.c +308 -0
  514. data/vendor/FreeImage/Source/LibWebP/src/utils/utils.color_cache.c +49 -0
  515. data/vendor/FreeImage/Source/LibWebP/src/utils/utils.filters.c +76 -0
  516. data/vendor/FreeImage/Source/LibWebP/src/utils/utils.h +121 -0
  517. data/vendor/FreeImage/Source/LibWebP/src/utils/utils.huffman.c +205 -0
  518. data/vendor/FreeImage/Source/LibWebP/src/utils/utils.huffman_encode.c +417 -0
  519. data/vendor/FreeImage/Source/LibWebP/src/utils/utils.quant_levels.c +140 -0
  520. data/vendor/FreeImage/Source/LibWebP/src/utils/utils.quant_levels_dec.c +279 -0
  521. data/vendor/FreeImage/Source/LibWebP/src/utils/utils.random.c +43 -0
  522. data/vendor/FreeImage/Source/LibWebP/src/utils/utils.rescaler.c +82 -0
  523. data/vendor/FreeImage/Source/LibWebP/src/utils/utils.thread.c +309 -0
  524. data/vendor/FreeImage/Source/LibWebP/src/utils/utils.utils.c +211 -0
  525. data/vendor/FreeImage/Source/LibWebP/src/webp/decode.h +493 -0
  526. data/vendor/FreeImage/Source/LibWebP/src/webp/demux.h +224 -0
  527. data/vendor/FreeImage/Source/LibWebP/src/webp/encode.h +515 -0
  528. data/vendor/FreeImage/Source/LibWebP/src/webp/format_constants.h +88 -0
  529. data/vendor/FreeImage/Source/LibWebP/src/webp/mux.h +507 -0
  530. data/vendor/FreeImage/Source/LibWebP/src/webp/mux_types.h +97 -0
  531. data/vendor/FreeImage/Source/LibWebP/src/webp/types.h +52 -0
  532. data/vendor/FreeImage/Source/MapIntrospector.h +212 -0
  533. data/vendor/FreeImage/Source/Metadata/Exif.cpp +1253 -0
  534. data/vendor/FreeImage/Source/Metadata/FIRational.cpp +176 -0
  535. data/vendor/FreeImage/Source/Metadata/FIRational.h +108 -0
  536. data/vendor/FreeImage/Source/Metadata/FreeImageTag.cpp +353 -0
  537. data/vendor/FreeImage/Source/Metadata/FreeImageTag.h +500 -0
  538. data/vendor/FreeImage/Source/Metadata/IPTC.cpp +342 -0
  539. data/vendor/FreeImage/Source/Metadata/TagConversion.cpp +1094 -0
  540. data/vendor/FreeImage/Source/Metadata/TagLib.cpp +1618 -0
  541. data/vendor/FreeImage/Source/Metadata/XTIFF.cpp +766 -0
  542. data/vendor/FreeImage/Source/OpenEXR/Half/eLut.cpp +114 -0
  543. data/vendor/FreeImage/Source/OpenEXR/Half/eLut.h +71 -0
  544. data/vendor/FreeImage/Source/OpenEXR/Half/half.cpp +310 -0
  545. data/vendor/FreeImage/Source/OpenEXR/Half/half.h +757 -0
  546. data/vendor/FreeImage/Source/OpenEXR/Half/halfExport.h +27 -0
  547. data/vendor/FreeImage/Source/OpenEXR/Half/halfFunction.h +179 -0
  548. data/vendor/FreeImage/Source/OpenEXR/Half/halfLimits.h +102 -0
  549. data/vendor/FreeImage/Source/OpenEXR/Half/toFloat.cpp +164 -0
  550. data/vendor/FreeImage/Source/OpenEXR/Half/toFloat.h +16391 -0
  551. data/vendor/FreeImage/Source/OpenEXR/Iex/Iex.h +60 -0
  552. data/vendor/FreeImage/Source/OpenEXR/Iex/IexBaseExc.cpp +156 -0
  553. data/vendor/FreeImage/Source/OpenEXR/Iex/IexBaseExc.h +264 -0
  554. data/vendor/FreeImage/Source/OpenEXR/Iex/IexErrnoExc.h +208 -0
  555. data/vendor/FreeImage/Source/OpenEXR/Iex/IexExport.h +51 -0
  556. data/vendor/FreeImage/Source/OpenEXR/Iex/IexForward.h +229 -0
  557. data/vendor/FreeImage/Source/OpenEXR/Iex/IexMacros.h +170 -0
  558. data/vendor/FreeImage/Source/OpenEXR/Iex/IexMathExc.h +57 -0
  559. data/vendor/FreeImage/Source/OpenEXR/Iex/IexNamespace.h +112 -0
  560. data/vendor/FreeImage/Source/OpenEXR/Iex/IexThrowErrnoExc.cpp +873 -0
  561. data/vendor/FreeImage/Source/OpenEXR/Iex/IexThrowErrnoExc.h +97 -0
  562. data/vendor/FreeImage/Source/OpenEXR/IexMath/IexMathFloatExc.cpp +113 -0
  563. data/vendor/FreeImage/Source/OpenEXR/IexMath/IexMathFloatExc.h +146 -0
  564. data/vendor/FreeImage/Source/OpenEXR/IexMath/IexMathFpu.cpp +530 -0
  565. data/vendor/FreeImage/Source/OpenEXR/IexMath/IexMathFpu.h +91 -0
  566. data/vendor/FreeImage/Source/OpenEXR/IexMath/IexMathIeeeExc.h +62 -0
  567. data/vendor/FreeImage/Source/OpenEXR/IlmBaseConfig.h +61 -0
  568. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfAcesFile.cpp +633 -0
  569. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfAcesFile.h +324 -0
  570. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfArray.h +285 -0
  571. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfAttribute.cpp +158 -0
  572. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfAttribute.h +407 -0
  573. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfAutoArray.h +95 -0
  574. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfB44Compressor.cpp +1072 -0
  575. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfB44Compressor.h +118 -0
  576. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfBoxAttribute.cpp +111 -0
  577. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfBoxAttribute.h +87 -0
  578. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfCRgbaFile.cpp +1438 -0
  579. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfCRgbaFile.h +555 -0
  580. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfChannelList.cpp +322 -0
  581. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfChannelList.h +436 -0
  582. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfChannelListAttribute.cpp +150 -0
  583. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfChannelListAttribute.h +74 -0
  584. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfCheckedArithmetic.h +163 -0
  585. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfChromaticities.cpp +151 -0
  586. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfChromaticities.h +131 -0
  587. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfChromaticitiesAttribute.cpp +87 -0
  588. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfChromaticitiesAttribute.h +73 -0
  589. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfCompositeDeepScanLine.cpp +591 -0
  590. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfCompositeDeepScanLine.h +142 -0
  591. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfCompression.h +84 -0
  592. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfCompressionAttribute.cpp +78 -0
  593. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfCompressionAttribute.h +64 -0
  594. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfCompressor.cpp +226 -0
  595. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfCompressor.h +265 -0
  596. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfConvert.cpp +143 -0
  597. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfConvert.h +107 -0
  598. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfDeepCompositing.cpp +110 -0
  599. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfDeepCompositing.h +132 -0
  600. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfDeepFrameBuffer.cpp +230 -0
  601. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfDeepFrameBuffer.h +339 -0
  602. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfDeepImageState.h +96 -0
  603. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfDeepImageStateAttribute.cpp +78 -0
  604. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfDeepImageStateAttribute.h +68 -0
  605. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfDeepScanLineInputFile.cpp +2025 -0
  606. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfDeepScanLineInputFile.h +276 -0
  607. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfDeepScanLineInputPart.cpp +149 -0
  608. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfDeepScanLineInputPart.h +181 -0
  609. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfDeepScanLineOutputFile.cpp +1552 -0
  610. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfDeepScanLineOutputFile.h +244 -0
  611. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfDeepScanLineOutputPart.cpp +107 -0
  612. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfDeepScanLineOutputPart.h +168 -0
  613. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfDeepTiledInputFile.cpp +1979 -0
  614. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfDeepTiledInputFile.h +437 -0
  615. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfDeepTiledInputPart.cpp +273 -0
  616. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfDeepTiledInputPart.h +362 -0
  617. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfDeepTiledOutputFile.cpp +2055 -0
  618. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfDeepTiledOutputFile.h +475 -0
  619. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfDeepTiledOutputPart.cpp +250 -0
  620. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfDeepTiledOutputPart.h +394 -0
  621. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfDoubleAttribute.cpp +57 -0
  622. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfDoubleAttribute.h +59 -0
  623. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfDwaCompressor.cpp +3424 -0
  624. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfDwaCompressor.h +210 -0
  625. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfDwaCompressorSimd.h +2145 -0
  626. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfEnvmap.cpp +335 -0
  627. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfEnvmap.h +336 -0
  628. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfEnvmapAttribute.cpp +76 -0
  629. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfEnvmapAttribute.h +68 -0
  630. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfExport.h +46 -0
  631. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfFastHuf.cpp +768 -0
  632. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfFastHuf.h +148 -0
  633. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfFloatAttribute.cpp +57 -0
  634. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfFloatAttribute.h +58 -0
  635. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfFloatVectorAttribute.cpp +84 -0
  636. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfFloatVectorAttribute.h +76 -0
  637. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfForward.h +127 -0
  638. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfFrameBuffer.cpp +228 -0
  639. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfFrameBuffer.h +386 -0
  640. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfFramesPerSecond.cpp +76 -0
  641. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfFramesPerSecond.h +94 -0
  642. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfGenericInputFile.cpp +76 -0
  643. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfGenericInputFile.h +58 -0
  644. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfGenericOutputFile.cpp +112 -0
  645. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfGenericOutputFile.h +62 -0
  646. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfHeader.cpp +1283 -0
  647. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfHeader.h +699 -0
  648. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfHuf.cpp +1114 -0
  649. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfHuf.h +82 -0
  650. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfIO.cpp +110 -0
  651. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfIO.h +255 -0
  652. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfInputFile.cpp +895 -0
  653. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfInputFile.h +240 -0
  654. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfInputPart.cpp +114 -0
  655. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfInputPart.h +84 -0
  656. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfInputPartData.cpp +51 -0
  657. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfInputPartData.h +69 -0
  658. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfInputStreamMutex.h +68 -0
  659. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfInt64.h +56 -0
  660. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfIntAttribute.cpp +57 -0
  661. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfIntAttribute.h +58 -0
  662. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfKeyCode.cpp +217 -0
  663. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfKeyCode.h +167 -0
  664. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfKeyCodeAttribute.cpp +99 -0
  665. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfKeyCodeAttribute.h +73 -0
  666. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfLineOrder.h +69 -0
  667. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfLineOrderAttribute.cpp +78 -0
  668. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfLineOrderAttribute.h +72 -0
  669. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfLut.cpp +178 -0
  670. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfLut.h +188 -0
  671. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfMatrixAttribute.cpp +263 -0
  672. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfMatrixAttribute.h +83 -0
  673. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfMisc.cpp +1872 -0
  674. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfMisc.h +466 -0
  675. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfMultiPartInputFile.cpp +783 -0
  676. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfMultiPartInputFile.h +128 -0
  677. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfMultiPartOutputFile.cpp +519 -0
  678. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfMultiPartOutputFile.h +118 -0
  679. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfMultiView.cpp +435 -0
  680. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfMultiView.h +187 -0
  681. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfName.h +150 -0
  682. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfNamespace.h +115 -0
  683. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfOpaqueAttribute.cpp +126 -0
  684. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfOpaqueAttribute.h +110 -0
  685. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfOptimizedPixelReading.h +646 -0
  686. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfOutputFile.cpp +1378 -0
  687. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfOutputFile.h +263 -0
  688. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfOutputPart.cpp +105 -0
  689. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfOutputPart.h +77 -0
  690. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfOutputPartData.cpp +52 -0
  691. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfOutputPartData.h +62 -0
  692. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfOutputStreamMutex.h +70 -0
  693. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfPartHelper.h +262 -0
  694. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfPartType.cpp +63 -0
  695. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfPartType.h +62 -0
  696. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfPixelType.h +67 -0
  697. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfPizCompressor.cpp +667 -0
  698. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfPizCompressor.h +117 -0
  699. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfPreviewImage.cpp +104 -0
  700. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfPreviewImage.h +135 -0
  701. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfPreviewImageAttribute.cpp +103 -0
  702. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfPreviewImageAttribute.h +70 -0
  703. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfPxr24Compressor.cpp +553 -0
  704. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfPxr24Compressor.h +109 -0
  705. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfRational.cpp +127 -0
  706. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfRational.h +98 -0
  707. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfRationalAttribute.cpp +74 -0
  708. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfRationalAttribute.h +69 -0
  709. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfRgba.h +109 -0
  710. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfRgbaFile.cpp +1405 -0
  711. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfRgbaFile.h +346 -0
  712. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfRgbaYca.cpp +497 -0
  713. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfRgbaYca.h +259 -0
  714. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfRle.cpp +157 -0
  715. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfRle.h +63 -0
  716. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfRleCompressor.cpp +220 -0
  717. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfRleCompressor.h +80 -0
  718. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfScanLineInputFile.cpp +1702 -0
  719. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfScanLineInputFile.h +210 -0
  720. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfSimd.h +59 -0
  721. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfStandardAttributes.cpp +125 -0
  722. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfStandardAttributes.h +382 -0
  723. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfStdIO.cpp +242 -0
  724. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfStdIO.h +160 -0
  725. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfStringAttribute.cpp +80 -0
  726. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfStringAttribute.h +71 -0
  727. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfStringVectorAttribute.cpp +100 -0
  728. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfStringVectorAttribute.h +74 -0
  729. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfSystemSpecific.cpp +129 -0
  730. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfSystemSpecific.h +172 -0
  731. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfTestFile.cpp +216 -0
  732. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfTestFile.h +97 -0
  733. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfThreading.cpp +62 -0
  734. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfThreading.h +95 -0
  735. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfTileDescription.h +107 -0
  736. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfTileDescriptionAttribute.cpp +86 -0
  737. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfTileDescriptionAttribute.h +72 -0
  738. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfTileOffsets.cpp +552 -0
  739. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfTileOffsets.h +125 -0
  740. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfTiledInputFile.cpp +1533 -0
  741. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfTiledInputFile.h +401 -0
  742. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfTiledInputPart.cpp +208 -0
  743. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfTiledInputPart.h +100 -0
  744. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfTiledMisc.cpp +389 -0
  745. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfTiledMisc.h +106 -0
  746. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfTiledOutputFile.cpp +1841 -0
  747. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfTiledOutputFile.h +495 -0
  748. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfTiledOutputPart.cpp +228 -0
  749. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfTiledOutputPart.h +105 -0
  750. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfTiledRgbaFile.cpp +1163 -0
  751. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfTiledRgbaFile.h +482 -0
  752. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfTimeCode.cpp +431 -0
  753. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfTimeCode.h +242 -0
  754. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfTimeCodeAttribute.cpp +79 -0
  755. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfTimeCodeAttribute.h +74 -0
  756. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfVecAttribute.cpp +217 -0
  757. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfVecAttribute.h +100 -0
  758. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfVersion.cpp +60 -0
  759. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfVersion.h +136 -0
  760. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfWav.cpp +391 -0
  761. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfWav.h +78 -0
  762. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfXdr.h +927 -0
  763. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfZip.cpp +196 -0
  764. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfZip.h +78 -0
  765. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfZipCompressor.cpp +127 -0
  766. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfZipCompressor.h +89 -0
  767. data/vendor/FreeImage/Source/OpenEXR/IlmImf/b44ExpLogTable.cpp +136 -0
  768. data/vendor/FreeImage/Source/OpenEXR/IlmImf/b44ExpLogTable.h +16396 -0
  769. data/vendor/FreeImage/Source/OpenEXR/IlmImf/dwaLookups.cpp +573 -0
  770. data/vendor/FreeImage/Source/OpenEXR/IlmImf/dwaLookups.h +98334 -0
  771. data/vendor/FreeImage/Source/OpenEXR/IlmThread/IlmThread.cpp +80 -0
  772. data/vendor/FreeImage/Source/OpenEXR/IlmThread/IlmThread.h +143 -0
  773. data/vendor/FreeImage/Source/OpenEXR/IlmThread/IlmThreadExport.h +46 -0
  774. data/vendor/FreeImage/Source/OpenEXR/IlmThread/IlmThreadForward.h +52 -0
  775. data/vendor/FreeImage/Source/OpenEXR/IlmThread/IlmThreadMutex.cpp +59 -0
  776. data/vendor/FreeImage/Source/OpenEXR/IlmThread/IlmThreadMutex.h +160 -0
  777. data/vendor/FreeImage/Source/OpenEXR/IlmThread/IlmThreadMutexPosix.cpp +85 -0
  778. data/vendor/FreeImage/Source/OpenEXR/IlmThread/IlmThreadMutexWin32.cpp +79 -0
  779. data/vendor/FreeImage/Source/OpenEXR/IlmThread/IlmThreadNamespace.h +114 -0
  780. data/vendor/FreeImage/Source/OpenEXR/IlmThread/IlmThreadPool.cpp +483 -0
  781. data/vendor/FreeImage/Source/OpenEXR/IlmThread/IlmThreadPool.h +160 -0
  782. data/vendor/FreeImage/Source/OpenEXR/IlmThread/IlmThreadPosix.cpp +98 -0
  783. data/vendor/FreeImage/Source/OpenEXR/IlmThread/IlmThreadSemaphore.cpp +60 -0
  784. data/vendor/FreeImage/Source/OpenEXR/IlmThread/IlmThreadSemaphore.h +112 -0
  785. data/vendor/FreeImage/Source/OpenEXR/IlmThread/IlmThreadSemaphorePosix.cpp +106 -0
  786. data/vendor/FreeImage/Source/OpenEXR/IlmThread/IlmThreadSemaphorePosixCompat.cpp +155 -0
  787. data/vendor/FreeImage/Source/OpenEXR/IlmThread/IlmThreadSemaphoreWin32.cpp +153 -0
  788. data/vendor/FreeImage/Source/OpenEXR/IlmThread/IlmThreadWin32.cpp +100 -0
  789. data/vendor/FreeImage/Source/OpenEXR/Imath/ImathBox.cpp +37 -0
  790. data/vendor/FreeImage/Source/OpenEXR/Imath/ImathBox.h +849 -0
  791. data/vendor/FreeImage/Source/OpenEXR/Imath/ImathBoxAlgo.h +1016 -0
  792. data/vendor/FreeImage/Source/OpenEXR/Imath/ImathColor.h +736 -0
  793. data/vendor/FreeImage/Source/OpenEXR/Imath/ImathColorAlgo.cpp +178 -0
  794. data/vendor/FreeImage/Source/OpenEXR/Imath/ImathColorAlgo.h +257 -0
  795. data/vendor/FreeImage/Source/OpenEXR/Imath/ImathEuler.h +926 -0
  796. data/vendor/FreeImage/Source/OpenEXR/Imath/ImathExc.h +73 -0
  797. data/vendor/FreeImage/Source/OpenEXR/Imath/ImathExport.h +46 -0
  798. data/vendor/FreeImage/Source/OpenEXR/Imath/ImathForward.h +72 -0
  799. data/vendor/FreeImage/Source/OpenEXR/Imath/ImathFrame.h +192 -0
  800. data/vendor/FreeImage/Source/OpenEXR/Imath/ImathFrustum.h +741 -0
  801. data/vendor/FreeImage/Source/OpenEXR/Imath/ImathFrustumTest.h +417 -0
  802. data/vendor/FreeImage/Source/OpenEXR/Imath/ImathFun.cpp +181 -0
  803. data/vendor/FreeImage/Source/OpenEXR/Imath/ImathFun.h +269 -0
  804. data/vendor/FreeImage/Source/OpenEXR/Imath/ImathGL.h +166 -0
  805. data/vendor/FreeImage/Source/OpenEXR/Imath/ImathGLU.h +54 -0
  806. data/vendor/FreeImage/Source/OpenEXR/Imath/ImathHalfLimits.h +68 -0
  807. data/vendor/FreeImage/Source/OpenEXR/Imath/ImathInt64.h +62 -0
  808. data/vendor/FreeImage/Source/OpenEXR/Imath/ImathInterval.h +226 -0
  809. data/vendor/FreeImage/Source/OpenEXR/Imath/ImathLimits.h +268 -0
  810. data/vendor/FreeImage/Source/OpenEXR/Imath/ImathLine.h +185 -0
  811. data/vendor/FreeImage/Source/OpenEXR/Imath/ImathLineAlgo.h +288 -0
  812. data/vendor/FreeImage/Source/OpenEXR/Imath/ImathMath.h +208 -0
  813. data/vendor/FreeImage/Source/OpenEXR/Imath/ImathMatrix.h +3441 -0
  814. data/vendor/FreeImage/Source/OpenEXR/Imath/ImathMatrixAlgo.cpp +1252 -0
  815. data/vendor/FreeImage/Source/OpenEXR/Imath/ImathMatrixAlgo.h +1425 -0
  816. data/vendor/FreeImage/Source/OpenEXR/Imath/ImathNamespace.h +115 -0
  817. data/vendor/FreeImage/Source/OpenEXR/Imath/ImathPlane.h +257 -0
  818. data/vendor/FreeImage/Source/OpenEXR/Imath/ImathPlatform.h +112 -0
  819. data/vendor/FreeImage/Source/OpenEXR/Imath/ImathQuat.h +964 -0
  820. data/vendor/FreeImage/Source/OpenEXR/Imath/ImathRandom.cpp +194 -0
  821. data/vendor/FreeImage/Source/OpenEXR/Imath/ImathRandom.h +401 -0
  822. data/vendor/FreeImage/Source/OpenEXR/Imath/ImathRoots.h +219 -0
  823. data/vendor/FreeImage/Source/OpenEXR/Imath/ImathShear.cpp +54 -0
  824. data/vendor/FreeImage/Source/OpenEXR/Imath/ImathShear.h +656 -0
  825. data/vendor/FreeImage/Source/OpenEXR/Imath/ImathSphere.h +177 -0
  826. data/vendor/FreeImage/Source/OpenEXR/Imath/ImathVec.cpp +583 -0
  827. data/vendor/FreeImage/Source/OpenEXR/Imath/ImathVec.h +2227 -0
  828. data/vendor/FreeImage/Source/OpenEXR/Imath/ImathVecAlgo.h +147 -0
  829. data/vendor/FreeImage/Source/OpenEXR/OpenEXRConfig.h +72 -0
  830. data/vendor/FreeImage/Source/Plugin.h +144 -0
  831. data/vendor/FreeImage/Source/Quantizers.h +354 -0
  832. data/vendor/FreeImage/Source/ToneMapping.h +44 -0
  833. data/vendor/FreeImage/Source/Utilities.h +516 -0
  834. data/vendor/FreeImage/Source/ZLib/adler32.c +179 -0
  835. data/vendor/FreeImage/Source/ZLib/compress.c +80 -0
  836. data/vendor/FreeImage/Source/ZLib/crc32.c +425 -0
  837. data/vendor/FreeImage/Source/ZLib/crc32.h +441 -0
  838. data/vendor/FreeImage/Source/ZLib/deflate.c +1967 -0
  839. data/vendor/FreeImage/Source/ZLib/deflate.h +346 -0
  840. data/vendor/FreeImage/Source/ZLib/gzclose.c +25 -0
  841. data/vendor/FreeImage/Source/ZLib/gzguts.h +209 -0
  842. data/vendor/FreeImage/Source/ZLib/gzlib.c +634 -0
  843. data/vendor/FreeImage/Source/ZLib/gzread.c +594 -0
  844. data/vendor/FreeImage/Source/ZLib/gzwrite.c +577 -0
  845. data/vendor/FreeImage/Source/ZLib/infback.c +640 -0
  846. data/vendor/FreeImage/Source/ZLib/inffast.c +340 -0
  847. data/vendor/FreeImage/Source/ZLib/inffast.h +11 -0
  848. data/vendor/FreeImage/Source/ZLib/inffixed.h +94 -0
  849. data/vendor/FreeImage/Source/ZLib/inflate.c +1512 -0
  850. data/vendor/FreeImage/Source/ZLib/inflate.h +122 -0
  851. data/vendor/FreeImage/Source/ZLib/inftrees.c +306 -0
  852. data/vendor/FreeImage/Source/ZLib/inftrees.h +62 -0
  853. data/vendor/FreeImage/Source/ZLib/trees.c +1226 -0
  854. data/vendor/FreeImage/Source/ZLib/trees.h +128 -0
  855. data/vendor/FreeImage/Source/ZLib/uncompr.c +59 -0
  856. data/vendor/FreeImage/Source/ZLib/zconf.h +511 -0
  857. data/vendor/FreeImage/Source/ZLib/zlib.h +1768 -0
  858. data/vendor/FreeImage/Source/ZLib/zutil.c +324 -0
  859. data/vendor/FreeImage/Source/ZLib/zutil.h +253 -0
  860. metadata +931 -0
@@ -0,0 +1,940 @@
1
+ // Copyright 2011 Google Inc. All Rights Reserved.
2
+ //
3
+ // Use of this source code is governed by a BSD-style license
4
+ // that can be found in the COPYING file in the root of the source
5
+ // tree. An additional intellectual property rights grant can be found
6
+ // in the file PATENTS. All contributing project authors may
7
+ // be found in the AUTHORS file in the root of the source tree.
8
+ // -----------------------------------------------------------------------------
9
+ //
10
+ // SSE2 version of speed-critical encoding functions.
11
+ //
12
+ // Author: Christian Duvivier (cduvivier@google.com)
13
+
14
+ #include "./dsp.h"
15
+
16
+ #if defined(WEBP_USE_SSE2)
17
+ #include <stdlib.h> // for abs()
18
+ #include <emmintrin.h>
19
+
20
+ #include "../enc/cost.h"
21
+ #include "../enc/vp8enci.h"
22
+ #include "../utils/utils.h"
23
+
24
+ //------------------------------------------------------------------------------
25
+ // Quite useful macro for debugging. Left here for convenience.
26
+
27
+ #if 0
28
+ #include <stdio.h>
29
+ static void PrintReg(const __m128i r, const char* const name, int size) {
30
+ int n;
31
+ union {
32
+ __m128i r;
33
+ uint8_t i8[16];
34
+ uint16_t i16[8];
35
+ uint32_t i32[4];
36
+ uint64_t i64[2];
37
+ } tmp;
38
+ tmp.r = r;
39
+ fprintf(stderr, "%s\t: ", name);
40
+ if (size == 8) {
41
+ for (n = 0; n < 16; ++n) fprintf(stderr, "%.2x ", tmp.i8[n]);
42
+ } else if (size == 16) {
43
+ for (n = 0; n < 8; ++n) fprintf(stderr, "%.4x ", tmp.i16[n]);
44
+ } else if (size == 32) {
45
+ for (n = 0; n < 4; ++n) fprintf(stderr, "%.8x ", tmp.i32[n]);
46
+ } else {
47
+ for (n = 0; n < 2; ++n) fprintf(stderr, "%.16lx ", tmp.i64[n]);
48
+ }
49
+ fprintf(stderr, "\n");
50
+ }
51
+ #endif
52
+
53
+ //------------------------------------------------------------------------------
54
+ // Compute susceptibility based on DCT-coeff histograms:
55
+ // the higher, the "easier" the macroblock is to compress.
56
+
57
+ static void CollectHistogram(const uint8_t* ref, const uint8_t* pred,
58
+ int start_block, int end_block,
59
+ VP8Histogram* const histo) {
60
+ const __m128i max_coeff_thresh = _mm_set1_epi16(MAX_COEFF_THRESH);
61
+ int j;
62
+ int distribution[MAX_COEFF_THRESH + 1] = { 0 };
63
+ for (j = start_block; j < end_block; ++j) {
64
+ int16_t out[16];
65
+ int k;
66
+
67
+ VP8FTransform(ref + VP8DspScan[j], pred + VP8DspScan[j], out);
68
+
69
+ // Convert coefficients to bin (within out[]).
70
+ {
71
+ // Load.
72
+ const __m128i out0 = _mm_loadu_si128((__m128i*)&out[0]);
73
+ const __m128i out1 = _mm_loadu_si128((__m128i*)&out[8]);
74
+ // sign(out) = out >> 15 (0x0000 if positive, 0xffff if negative)
75
+ const __m128i sign0 = _mm_srai_epi16(out0, 15);
76
+ const __m128i sign1 = _mm_srai_epi16(out1, 15);
77
+ // abs(out) = (out ^ sign) - sign
78
+ const __m128i xor0 = _mm_xor_si128(out0, sign0);
79
+ const __m128i xor1 = _mm_xor_si128(out1, sign1);
80
+ const __m128i abs0 = _mm_sub_epi16(xor0, sign0);
81
+ const __m128i abs1 = _mm_sub_epi16(xor1, sign1);
82
+ // v = abs(out) >> 3
83
+ const __m128i v0 = _mm_srai_epi16(abs0, 3);
84
+ const __m128i v1 = _mm_srai_epi16(abs1, 3);
85
+ // bin = min(v, MAX_COEFF_THRESH)
86
+ const __m128i bin0 = _mm_min_epi16(v0, max_coeff_thresh);
87
+ const __m128i bin1 = _mm_min_epi16(v1, max_coeff_thresh);
88
+ // Store.
89
+ _mm_storeu_si128((__m128i*)&out[0], bin0);
90
+ _mm_storeu_si128((__m128i*)&out[8], bin1);
91
+ }
92
+
93
+ // Convert coefficients to bin.
94
+ for (k = 0; k < 16; ++k) {
95
+ ++distribution[out[k]];
96
+ }
97
+ }
98
+ VP8LSetHistogramData(distribution, histo);
99
+ }
100
+
101
+ //------------------------------------------------------------------------------
102
+ // Transforms (Paragraph 14.4)
103
+
104
+ // Does one or two inverse transforms.
105
+ static void ITransform(const uint8_t* ref, const int16_t* in, uint8_t* dst,
106
+ int do_two) {
107
+ // This implementation makes use of 16-bit fixed point versions of two
108
+ // multiply constants:
109
+ // K1 = sqrt(2) * cos (pi/8) ~= 85627 / 2^16
110
+ // K2 = sqrt(2) * sin (pi/8) ~= 35468 / 2^16
111
+ //
112
+ // To be able to use signed 16-bit integers, we use the following trick to
113
+ // have constants within range:
114
+ // - Associated constants are obtained by subtracting the 16-bit fixed point
115
+ // version of one:
116
+ // k = K - (1 << 16) => K = k + (1 << 16)
117
+ // K1 = 85267 => k1 = 20091
118
+ // K2 = 35468 => k2 = -30068
119
+ // - The multiplication of a variable by a constant become the sum of the
120
+ // variable and the multiplication of that variable by the associated
121
+ // constant:
122
+ // (x * K) >> 16 = (x * (k + (1 << 16))) >> 16 = ((x * k ) >> 16) + x
123
+ const __m128i k1 = _mm_set1_epi16(20091);
124
+ const __m128i k2 = _mm_set1_epi16(-30068);
125
+ __m128i T0, T1, T2, T3;
126
+
127
+ // Load and concatenate the transform coefficients (we'll do two inverse
128
+ // transforms in parallel). In the case of only one inverse transform, the
129
+ // second half of the vectors will just contain random value we'll never
130
+ // use nor store.
131
+ __m128i in0, in1, in2, in3;
132
+ {
133
+ in0 = _mm_loadl_epi64((const __m128i*)&in[0]);
134
+ in1 = _mm_loadl_epi64((const __m128i*)&in[4]);
135
+ in2 = _mm_loadl_epi64((const __m128i*)&in[8]);
136
+ in3 = _mm_loadl_epi64((const __m128i*)&in[12]);
137
+ // a00 a10 a20 a30 x x x x
138
+ // a01 a11 a21 a31 x x x x
139
+ // a02 a12 a22 a32 x x x x
140
+ // a03 a13 a23 a33 x x x x
141
+ if (do_two) {
142
+ const __m128i inB0 = _mm_loadl_epi64((const __m128i*)&in[16]);
143
+ const __m128i inB1 = _mm_loadl_epi64((const __m128i*)&in[20]);
144
+ const __m128i inB2 = _mm_loadl_epi64((const __m128i*)&in[24]);
145
+ const __m128i inB3 = _mm_loadl_epi64((const __m128i*)&in[28]);
146
+ in0 = _mm_unpacklo_epi64(in0, inB0);
147
+ in1 = _mm_unpacklo_epi64(in1, inB1);
148
+ in2 = _mm_unpacklo_epi64(in2, inB2);
149
+ in3 = _mm_unpacklo_epi64(in3, inB3);
150
+ // a00 a10 a20 a30 b00 b10 b20 b30
151
+ // a01 a11 a21 a31 b01 b11 b21 b31
152
+ // a02 a12 a22 a32 b02 b12 b22 b32
153
+ // a03 a13 a23 a33 b03 b13 b23 b33
154
+ }
155
+ }
156
+
157
+ // Vertical pass and subsequent transpose.
158
+ {
159
+ // First pass, c and d calculations are longer because of the "trick"
160
+ // multiplications.
161
+ const __m128i a = _mm_add_epi16(in0, in2);
162
+ const __m128i b = _mm_sub_epi16(in0, in2);
163
+ // c = MUL(in1, K2) - MUL(in3, K1) = MUL(in1, k2) - MUL(in3, k1) + in1 - in3
164
+ const __m128i c1 = _mm_mulhi_epi16(in1, k2);
165
+ const __m128i c2 = _mm_mulhi_epi16(in3, k1);
166
+ const __m128i c3 = _mm_sub_epi16(in1, in3);
167
+ const __m128i c4 = _mm_sub_epi16(c1, c2);
168
+ const __m128i c = _mm_add_epi16(c3, c4);
169
+ // d = MUL(in1, K1) + MUL(in3, K2) = MUL(in1, k1) + MUL(in3, k2) + in1 + in3
170
+ const __m128i d1 = _mm_mulhi_epi16(in1, k1);
171
+ const __m128i d2 = _mm_mulhi_epi16(in3, k2);
172
+ const __m128i d3 = _mm_add_epi16(in1, in3);
173
+ const __m128i d4 = _mm_add_epi16(d1, d2);
174
+ const __m128i d = _mm_add_epi16(d3, d4);
175
+
176
+ // Second pass.
177
+ const __m128i tmp0 = _mm_add_epi16(a, d);
178
+ const __m128i tmp1 = _mm_add_epi16(b, c);
179
+ const __m128i tmp2 = _mm_sub_epi16(b, c);
180
+ const __m128i tmp3 = _mm_sub_epi16(a, d);
181
+
182
+ // Transpose the two 4x4.
183
+ // a00 a01 a02 a03 b00 b01 b02 b03
184
+ // a10 a11 a12 a13 b10 b11 b12 b13
185
+ // a20 a21 a22 a23 b20 b21 b22 b23
186
+ // a30 a31 a32 a33 b30 b31 b32 b33
187
+ const __m128i transpose0_0 = _mm_unpacklo_epi16(tmp0, tmp1);
188
+ const __m128i transpose0_1 = _mm_unpacklo_epi16(tmp2, tmp3);
189
+ const __m128i transpose0_2 = _mm_unpackhi_epi16(tmp0, tmp1);
190
+ const __m128i transpose0_3 = _mm_unpackhi_epi16(tmp2, tmp3);
191
+ // a00 a10 a01 a11 a02 a12 a03 a13
192
+ // a20 a30 a21 a31 a22 a32 a23 a33
193
+ // b00 b10 b01 b11 b02 b12 b03 b13
194
+ // b20 b30 b21 b31 b22 b32 b23 b33
195
+ const __m128i transpose1_0 = _mm_unpacklo_epi32(transpose0_0, transpose0_1);
196
+ const __m128i transpose1_1 = _mm_unpacklo_epi32(transpose0_2, transpose0_3);
197
+ const __m128i transpose1_2 = _mm_unpackhi_epi32(transpose0_0, transpose0_1);
198
+ const __m128i transpose1_3 = _mm_unpackhi_epi32(transpose0_2, transpose0_3);
199
+ // a00 a10 a20 a30 a01 a11 a21 a31
200
+ // b00 b10 b20 b30 b01 b11 b21 b31
201
+ // a02 a12 a22 a32 a03 a13 a23 a33
202
+ // b02 b12 a22 b32 b03 b13 b23 b33
203
+ T0 = _mm_unpacklo_epi64(transpose1_0, transpose1_1);
204
+ T1 = _mm_unpackhi_epi64(transpose1_0, transpose1_1);
205
+ T2 = _mm_unpacklo_epi64(transpose1_2, transpose1_3);
206
+ T3 = _mm_unpackhi_epi64(transpose1_2, transpose1_3);
207
+ // a00 a10 a20 a30 b00 b10 b20 b30
208
+ // a01 a11 a21 a31 b01 b11 b21 b31
209
+ // a02 a12 a22 a32 b02 b12 b22 b32
210
+ // a03 a13 a23 a33 b03 b13 b23 b33
211
+ }
212
+
213
+ // Horizontal pass and subsequent transpose.
214
+ {
215
+ // First pass, c and d calculations are longer because of the "trick"
216
+ // multiplications.
217
+ const __m128i four = _mm_set1_epi16(4);
218
+ const __m128i dc = _mm_add_epi16(T0, four);
219
+ const __m128i a = _mm_add_epi16(dc, T2);
220
+ const __m128i b = _mm_sub_epi16(dc, T2);
221
+ // c = MUL(T1, K2) - MUL(T3, K1) = MUL(T1, k2) - MUL(T3, k1) + T1 - T3
222
+ const __m128i c1 = _mm_mulhi_epi16(T1, k2);
223
+ const __m128i c2 = _mm_mulhi_epi16(T3, k1);
224
+ const __m128i c3 = _mm_sub_epi16(T1, T3);
225
+ const __m128i c4 = _mm_sub_epi16(c1, c2);
226
+ const __m128i c = _mm_add_epi16(c3, c4);
227
+ // d = MUL(T1, K1) + MUL(T3, K2) = MUL(T1, k1) + MUL(T3, k2) + T1 + T3
228
+ const __m128i d1 = _mm_mulhi_epi16(T1, k1);
229
+ const __m128i d2 = _mm_mulhi_epi16(T3, k2);
230
+ const __m128i d3 = _mm_add_epi16(T1, T3);
231
+ const __m128i d4 = _mm_add_epi16(d1, d2);
232
+ const __m128i d = _mm_add_epi16(d3, d4);
233
+
234
+ // Second pass.
235
+ const __m128i tmp0 = _mm_add_epi16(a, d);
236
+ const __m128i tmp1 = _mm_add_epi16(b, c);
237
+ const __m128i tmp2 = _mm_sub_epi16(b, c);
238
+ const __m128i tmp3 = _mm_sub_epi16(a, d);
239
+ const __m128i shifted0 = _mm_srai_epi16(tmp0, 3);
240
+ const __m128i shifted1 = _mm_srai_epi16(tmp1, 3);
241
+ const __m128i shifted2 = _mm_srai_epi16(tmp2, 3);
242
+ const __m128i shifted3 = _mm_srai_epi16(tmp3, 3);
243
+
244
+ // Transpose the two 4x4.
245
+ // a00 a01 a02 a03 b00 b01 b02 b03
246
+ // a10 a11 a12 a13 b10 b11 b12 b13
247
+ // a20 a21 a22 a23 b20 b21 b22 b23
248
+ // a30 a31 a32 a33 b30 b31 b32 b33
249
+ const __m128i transpose0_0 = _mm_unpacklo_epi16(shifted0, shifted1);
250
+ const __m128i transpose0_1 = _mm_unpacklo_epi16(shifted2, shifted3);
251
+ const __m128i transpose0_2 = _mm_unpackhi_epi16(shifted0, shifted1);
252
+ const __m128i transpose0_3 = _mm_unpackhi_epi16(shifted2, shifted3);
253
+ // a00 a10 a01 a11 a02 a12 a03 a13
254
+ // a20 a30 a21 a31 a22 a32 a23 a33
255
+ // b00 b10 b01 b11 b02 b12 b03 b13
256
+ // b20 b30 b21 b31 b22 b32 b23 b33
257
+ const __m128i transpose1_0 = _mm_unpacklo_epi32(transpose0_0, transpose0_1);
258
+ const __m128i transpose1_1 = _mm_unpacklo_epi32(transpose0_2, transpose0_3);
259
+ const __m128i transpose1_2 = _mm_unpackhi_epi32(transpose0_0, transpose0_1);
260
+ const __m128i transpose1_3 = _mm_unpackhi_epi32(transpose0_2, transpose0_3);
261
+ // a00 a10 a20 a30 a01 a11 a21 a31
262
+ // b00 b10 b20 b30 b01 b11 b21 b31
263
+ // a02 a12 a22 a32 a03 a13 a23 a33
264
+ // b02 b12 a22 b32 b03 b13 b23 b33
265
+ T0 = _mm_unpacklo_epi64(transpose1_0, transpose1_1);
266
+ T1 = _mm_unpackhi_epi64(transpose1_0, transpose1_1);
267
+ T2 = _mm_unpacklo_epi64(transpose1_2, transpose1_3);
268
+ T3 = _mm_unpackhi_epi64(transpose1_2, transpose1_3);
269
+ // a00 a10 a20 a30 b00 b10 b20 b30
270
+ // a01 a11 a21 a31 b01 b11 b21 b31
271
+ // a02 a12 a22 a32 b02 b12 b22 b32
272
+ // a03 a13 a23 a33 b03 b13 b23 b33
273
+ }
274
+
275
+ // Add inverse transform to 'ref' and store.
276
+ {
277
+ const __m128i zero = _mm_setzero_si128();
278
+ // Load the reference(s).
279
+ __m128i ref0, ref1, ref2, ref3;
280
+ if (do_two) {
281
+ // Load eight bytes/pixels per line.
282
+ ref0 = _mm_loadl_epi64((const __m128i*)&ref[0 * BPS]);
283
+ ref1 = _mm_loadl_epi64((const __m128i*)&ref[1 * BPS]);
284
+ ref2 = _mm_loadl_epi64((const __m128i*)&ref[2 * BPS]);
285
+ ref3 = _mm_loadl_epi64((const __m128i*)&ref[3 * BPS]);
286
+ } else {
287
+ // Load four bytes/pixels per line.
288
+ ref0 = _mm_cvtsi32_si128(*(const int*)&ref[0 * BPS]);
289
+ ref1 = _mm_cvtsi32_si128(*(const int*)&ref[1 * BPS]);
290
+ ref2 = _mm_cvtsi32_si128(*(const int*)&ref[2 * BPS]);
291
+ ref3 = _mm_cvtsi32_si128(*(const int*)&ref[3 * BPS]);
292
+ }
293
+ // Convert to 16b.
294
+ ref0 = _mm_unpacklo_epi8(ref0, zero);
295
+ ref1 = _mm_unpacklo_epi8(ref1, zero);
296
+ ref2 = _mm_unpacklo_epi8(ref2, zero);
297
+ ref3 = _mm_unpacklo_epi8(ref3, zero);
298
+ // Add the inverse transform(s).
299
+ ref0 = _mm_add_epi16(ref0, T0);
300
+ ref1 = _mm_add_epi16(ref1, T1);
301
+ ref2 = _mm_add_epi16(ref2, T2);
302
+ ref3 = _mm_add_epi16(ref3, T3);
303
+ // Unsigned saturate to 8b.
304
+ ref0 = _mm_packus_epi16(ref0, ref0);
305
+ ref1 = _mm_packus_epi16(ref1, ref1);
306
+ ref2 = _mm_packus_epi16(ref2, ref2);
307
+ ref3 = _mm_packus_epi16(ref3, ref3);
308
+ // Store the results.
309
+ if (do_two) {
310
+ // Store eight bytes/pixels per line.
311
+ _mm_storel_epi64((__m128i*)&dst[0 * BPS], ref0);
312
+ _mm_storel_epi64((__m128i*)&dst[1 * BPS], ref1);
313
+ _mm_storel_epi64((__m128i*)&dst[2 * BPS], ref2);
314
+ _mm_storel_epi64((__m128i*)&dst[3 * BPS], ref3);
315
+ } else {
316
+ // Store four bytes/pixels per line.
317
+ *((int32_t *)&dst[0 * BPS]) = _mm_cvtsi128_si32(ref0);
318
+ *((int32_t *)&dst[1 * BPS]) = _mm_cvtsi128_si32(ref1);
319
+ *((int32_t *)&dst[2 * BPS]) = _mm_cvtsi128_si32(ref2);
320
+ *((int32_t *)&dst[3 * BPS]) = _mm_cvtsi128_si32(ref3);
321
+ }
322
+ }
323
+ }
324
+
325
+ static void FTransform(const uint8_t* src, const uint8_t* ref, int16_t* out) {
326
+ const __m128i zero = _mm_setzero_si128();
327
+ const __m128i seven = _mm_set1_epi16(7);
328
+ const __m128i k937 = _mm_set1_epi32(937);
329
+ const __m128i k1812 = _mm_set1_epi32(1812);
330
+ const __m128i k51000 = _mm_set1_epi32(51000);
331
+ const __m128i k12000_plus_one = _mm_set1_epi32(12000 + (1 << 16));
332
+ const __m128i k5352_2217 = _mm_set_epi16(5352, 2217, 5352, 2217,
333
+ 5352, 2217, 5352, 2217);
334
+ const __m128i k2217_5352 = _mm_set_epi16(2217, -5352, 2217, -5352,
335
+ 2217, -5352, 2217, -5352);
336
+ const __m128i k88p = _mm_set_epi16(8, 8, 8, 8, 8, 8, 8, 8);
337
+ const __m128i k88m = _mm_set_epi16(-8, 8, -8, 8, -8, 8, -8, 8);
338
+ const __m128i k5352_2217p = _mm_set_epi16(2217, 5352, 2217, 5352,
339
+ 2217, 5352, 2217, 5352);
340
+ const __m128i k5352_2217m = _mm_set_epi16(-5352, 2217, -5352, 2217,
341
+ -5352, 2217, -5352, 2217);
342
+ __m128i v01, v32;
343
+
344
+
345
+ // Difference between src and ref and initial transpose.
346
+ {
347
+ // Load src and convert to 16b.
348
+ const __m128i src0 = _mm_loadl_epi64((const __m128i*)&src[0 * BPS]);
349
+ const __m128i src1 = _mm_loadl_epi64((const __m128i*)&src[1 * BPS]);
350
+ const __m128i src2 = _mm_loadl_epi64((const __m128i*)&src[2 * BPS]);
351
+ const __m128i src3 = _mm_loadl_epi64((const __m128i*)&src[3 * BPS]);
352
+ const __m128i src_0 = _mm_unpacklo_epi8(src0, zero);
353
+ const __m128i src_1 = _mm_unpacklo_epi8(src1, zero);
354
+ const __m128i src_2 = _mm_unpacklo_epi8(src2, zero);
355
+ const __m128i src_3 = _mm_unpacklo_epi8(src3, zero);
356
+ // Load ref and convert to 16b.
357
+ const __m128i ref0 = _mm_loadl_epi64((const __m128i*)&ref[0 * BPS]);
358
+ const __m128i ref1 = _mm_loadl_epi64((const __m128i*)&ref[1 * BPS]);
359
+ const __m128i ref2 = _mm_loadl_epi64((const __m128i*)&ref[2 * BPS]);
360
+ const __m128i ref3 = _mm_loadl_epi64((const __m128i*)&ref[3 * BPS]);
361
+ const __m128i ref_0 = _mm_unpacklo_epi8(ref0, zero);
362
+ const __m128i ref_1 = _mm_unpacklo_epi8(ref1, zero);
363
+ const __m128i ref_2 = _mm_unpacklo_epi8(ref2, zero);
364
+ const __m128i ref_3 = _mm_unpacklo_epi8(ref3, zero);
365
+ // Compute difference. -> 00 01 02 03 00 00 00 00
366
+ const __m128i diff0 = _mm_sub_epi16(src_0, ref_0);
367
+ const __m128i diff1 = _mm_sub_epi16(src_1, ref_1);
368
+ const __m128i diff2 = _mm_sub_epi16(src_2, ref_2);
369
+ const __m128i diff3 = _mm_sub_epi16(src_3, ref_3);
370
+
371
+
372
+ // Unpack and shuffle
373
+ // 00 01 02 03 0 0 0 0
374
+ // 10 11 12 13 0 0 0 0
375
+ // 20 21 22 23 0 0 0 0
376
+ // 30 31 32 33 0 0 0 0
377
+ const __m128i shuf01 = _mm_unpacklo_epi32(diff0, diff1);
378
+ const __m128i shuf23 = _mm_unpacklo_epi32(diff2, diff3);
379
+ // 00 01 10 11 02 03 12 13
380
+ // 20 21 30 31 22 23 32 33
381
+ const __m128i shuf01_p =
382
+ _mm_shufflehi_epi16(shuf01, _MM_SHUFFLE(2, 3, 0, 1));
383
+ const __m128i shuf23_p =
384
+ _mm_shufflehi_epi16(shuf23, _MM_SHUFFLE(2, 3, 0, 1));
385
+ // 00 01 10 11 03 02 13 12
386
+ // 20 21 30 31 23 22 33 32
387
+ const __m128i s01 = _mm_unpacklo_epi64(shuf01_p, shuf23_p);
388
+ const __m128i s32 = _mm_unpackhi_epi64(shuf01_p, shuf23_p);
389
+ // 00 01 10 11 20 21 30 31
390
+ // 03 02 13 12 23 22 33 32
391
+ const __m128i a01 = _mm_add_epi16(s01, s32);
392
+ const __m128i a32 = _mm_sub_epi16(s01, s32);
393
+ // [d0 + d3 | d1 + d2 | ...] = [a0 a1 | a0' a1' | ... ]
394
+ // [d0 - d3 | d1 - d2 | ...] = [a3 a2 | a3' a2' | ... ]
395
+
396
+ const __m128i tmp0 = _mm_madd_epi16(a01, k88p); // [ (a0 + a1) << 3, ... ]
397
+ const __m128i tmp2 = _mm_madd_epi16(a01, k88m); // [ (a0 - a1) << 3, ... ]
398
+ const __m128i tmp1_1 = _mm_madd_epi16(a32, k5352_2217p);
399
+ const __m128i tmp3_1 = _mm_madd_epi16(a32, k5352_2217m);
400
+ const __m128i tmp1_2 = _mm_add_epi32(tmp1_1, k1812);
401
+ const __m128i tmp3_2 = _mm_add_epi32(tmp3_1, k937);
402
+ const __m128i tmp1 = _mm_srai_epi32(tmp1_2, 9);
403
+ const __m128i tmp3 = _mm_srai_epi32(tmp3_2, 9);
404
+ const __m128i s03 = _mm_packs_epi32(tmp0, tmp2);
405
+ const __m128i s12 = _mm_packs_epi32(tmp1, tmp3);
406
+ const __m128i s_lo = _mm_unpacklo_epi16(s03, s12); // 0 1 0 1 0 1...
407
+ const __m128i s_hi = _mm_unpackhi_epi16(s03, s12); // 2 3 2 3 2 3
408
+ const __m128i v23 = _mm_unpackhi_epi32(s_lo, s_hi);
409
+ v01 = _mm_unpacklo_epi32(s_lo, s_hi);
410
+ v32 = _mm_shuffle_epi32(v23, _MM_SHUFFLE(1, 0, 3, 2)); // 3 2 3 2 3 2..
411
+ }
412
+
413
+ // Second pass
414
+ {
415
+ // Same operations are done on the (0,3) and (1,2) pairs.
416
+ // a0 = v0 + v3
417
+ // a1 = v1 + v2
418
+ // a3 = v0 - v3
419
+ // a2 = v1 - v2
420
+ const __m128i a01 = _mm_add_epi16(v01, v32);
421
+ const __m128i a32 = _mm_sub_epi16(v01, v32);
422
+ const __m128i a11 = _mm_unpackhi_epi64(a01, a01);
423
+ const __m128i a22 = _mm_unpackhi_epi64(a32, a32);
424
+ const __m128i a01_plus_7 = _mm_add_epi16(a01, seven);
425
+
426
+ // d0 = (a0 + a1 + 7) >> 4;
427
+ // d2 = (a0 - a1 + 7) >> 4;
428
+ const __m128i c0 = _mm_add_epi16(a01_plus_7, a11);
429
+ const __m128i c2 = _mm_sub_epi16(a01_plus_7, a11);
430
+ const __m128i d0 = _mm_srai_epi16(c0, 4);
431
+ const __m128i d2 = _mm_srai_epi16(c2, 4);
432
+
433
+ // f1 = ((b3 * 5352 + b2 * 2217 + 12000) >> 16)
434
+ // f3 = ((b3 * 2217 - b2 * 5352 + 51000) >> 16)
435
+ const __m128i b23 = _mm_unpacklo_epi16(a22, a32);
436
+ const __m128i c1 = _mm_madd_epi16(b23, k5352_2217);
437
+ const __m128i c3 = _mm_madd_epi16(b23, k2217_5352);
438
+ const __m128i d1 = _mm_add_epi32(c1, k12000_plus_one);
439
+ const __m128i d3 = _mm_add_epi32(c3, k51000);
440
+ const __m128i e1 = _mm_srai_epi32(d1, 16);
441
+ const __m128i e3 = _mm_srai_epi32(d3, 16);
442
+ const __m128i f1 = _mm_packs_epi32(e1, e1);
443
+ const __m128i f3 = _mm_packs_epi32(e3, e3);
444
+ // f1 = f1 + (a3 != 0);
445
+ // The compare will return (0xffff, 0) for (==0, !=0). To turn that into the
446
+ // desired (0, 1), we add one earlier through k12000_plus_one.
447
+ // -> f1 = f1 + 1 - (a3 == 0)
448
+ const __m128i g1 = _mm_add_epi16(f1, _mm_cmpeq_epi16(a32, zero));
449
+
450
+ const __m128i d0_g1 = _mm_unpacklo_epi64(d0, g1);
451
+ const __m128i d2_f3 = _mm_unpacklo_epi64(d2, f3);
452
+ _mm_storeu_si128((__m128i*)&out[0], d0_g1);
453
+ _mm_storeu_si128((__m128i*)&out[8], d2_f3);
454
+ }
455
+ }
456
+
457
+ static void FTransformWHT(const int16_t* in, int16_t* out) {
458
+ int32_t tmp[16];
459
+ int i;
460
+ for (i = 0; i < 4; ++i, in += 64) {
461
+ const int a0 = (in[0 * 16] + in[2 * 16]);
462
+ const int a1 = (in[1 * 16] + in[3 * 16]);
463
+ const int a2 = (in[1 * 16] - in[3 * 16]);
464
+ const int a3 = (in[0 * 16] - in[2 * 16]);
465
+ tmp[0 + i * 4] = a0 + a1;
466
+ tmp[1 + i * 4] = a3 + a2;
467
+ tmp[2 + i * 4] = a3 - a2;
468
+ tmp[3 + i * 4] = a0 - a1;
469
+ }
470
+ {
471
+ const __m128i src0 = _mm_loadu_si128((__m128i*)&tmp[0]);
472
+ const __m128i src1 = _mm_loadu_si128((__m128i*)&tmp[4]);
473
+ const __m128i src2 = _mm_loadu_si128((__m128i*)&tmp[8]);
474
+ const __m128i src3 = _mm_loadu_si128((__m128i*)&tmp[12]);
475
+ const __m128i a0 = _mm_add_epi32(src0, src2);
476
+ const __m128i a1 = _mm_add_epi32(src1, src3);
477
+ const __m128i a2 = _mm_sub_epi32(src1, src3);
478
+ const __m128i a3 = _mm_sub_epi32(src0, src2);
479
+ const __m128i b0 = _mm_srai_epi32(_mm_add_epi32(a0, a1), 1);
480
+ const __m128i b1 = _mm_srai_epi32(_mm_add_epi32(a3, a2), 1);
481
+ const __m128i b2 = _mm_srai_epi32(_mm_sub_epi32(a3, a2), 1);
482
+ const __m128i b3 = _mm_srai_epi32(_mm_sub_epi32(a0, a1), 1);
483
+ const __m128i out0 = _mm_packs_epi32(b0, b1);
484
+ const __m128i out1 = _mm_packs_epi32(b2, b3);
485
+ _mm_storeu_si128((__m128i*)&out[0], out0);
486
+ _mm_storeu_si128((__m128i*)&out[8], out1);
487
+ }
488
+ }
489
+
490
+ //------------------------------------------------------------------------------
491
+ // Metric
492
+
493
+ static WEBP_INLINE __m128i SubtractAndAccumulate(const __m128i a,
494
+ const __m128i b) {
495
+ const __m128i zero = _mm_setzero_si128();
496
+ // convert to 16b
497
+ const __m128i A0 = _mm_unpacklo_epi8(a, zero);
498
+ const __m128i B0 = _mm_unpacklo_epi8(b, zero);
499
+ const __m128i A1 = _mm_unpackhi_epi8(a, zero);
500
+ const __m128i B1 = _mm_unpackhi_epi8(b, zero);
501
+ // subtract
502
+ const __m128i C0 = _mm_subs_epi16(A0, B0);
503
+ const __m128i C1 = _mm_subs_epi16(A1, B1);
504
+ // multiply with self
505
+ const __m128i D0 = _mm_madd_epi16(C0, C0);
506
+ const __m128i D1 = _mm_madd_epi16(C1, C1);
507
+ // accumulate
508
+ const __m128i sum = _mm_add_epi32(D0, D1);
509
+ return sum;
510
+ }
511
+
512
+ static int SSE_16xN(const uint8_t* a, const uint8_t* b, int num_pairs) {
513
+ __m128i sum = _mm_setzero_si128();
514
+ int32_t tmp[4];
515
+
516
+ while (num_pairs-- > 0) {
517
+ const __m128i a0 = _mm_loadu_si128((const __m128i*)&a[BPS * 0]);
518
+ const __m128i a1 = _mm_loadu_si128((const __m128i*)&a[BPS * 1]);
519
+ const __m128i b0 = _mm_loadu_si128((const __m128i*)&b[BPS * 0]);
520
+ const __m128i b1 = _mm_loadu_si128((const __m128i*)&b[BPS * 1]);
521
+ const __m128i sum1 = SubtractAndAccumulate(a0, b0);
522
+ const __m128i sum2 = SubtractAndAccumulate(a1, b1);
523
+ const __m128i sum12 = _mm_add_epi32(sum1, sum2);
524
+ sum = _mm_add_epi32(sum, sum12);
525
+ a += 2 * BPS;
526
+ b += 2 * BPS;
527
+ }
528
+ _mm_storeu_si128((__m128i*)tmp, sum);
529
+ return (tmp[3] + tmp[2] + tmp[1] + tmp[0]);
530
+ }
531
+
532
+ static int SSE16x16(const uint8_t* a, const uint8_t* b) {
533
+ return SSE_16xN(a, b, 8);
534
+ }
535
+
536
+ static int SSE16x8(const uint8_t* a, const uint8_t* b) {
537
+ return SSE_16xN(a, b, 4);
538
+ }
539
+
540
+ #define LOAD_8x16b(ptr) \
541
+ _mm_unpacklo_epi8(_mm_loadl_epi64((const __m128i*)(ptr)), zero)
542
+
543
+ static int SSE8x8(const uint8_t* a, const uint8_t* b) {
544
+ const __m128i zero = _mm_setzero_si128();
545
+ int num_pairs = 4;
546
+ __m128i sum = zero;
547
+ int32_t tmp[4];
548
+ while (num_pairs-- > 0) {
549
+ const __m128i a0 = LOAD_8x16b(&a[BPS * 0]);
550
+ const __m128i a1 = LOAD_8x16b(&a[BPS * 1]);
551
+ const __m128i b0 = LOAD_8x16b(&b[BPS * 0]);
552
+ const __m128i b1 = LOAD_8x16b(&b[BPS * 1]);
553
+ // subtract
554
+ const __m128i c0 = _mm_subs_epi16(a0, b0);
555
+ const __m128i c1 = _mm_subs_epi16(a1, b1);
556
+ // multiply/accumulate with self
557
+ const __m128i d0 = _mm_madd_epi16(c0, c0);
558
+ const __m128i d1 = _mm_madd_epi16(c1, c1);
559
+ // collect
560
+ const __m128i sum01 = _mm_add_epi32(d0, d1);
561
+ sum = _mm_add_epi32(sum, sum01);
562
+ a += 2 * BPS;
563
+ b += 2 * BPS;
564
+ }
565
+ _mm_storeu_si128((__m128i*)tmp, sum);
566
+ return (tmp[3] + tmp[2] + tmp[1] + tmp[0]);
567
+ }
568
+ #undef LOAD_8x16b
569
+
570
+ static int SSE4x4(const uint8_t* a, const uint8_t* b) {
571
+ const __m128i zero = _mm_setzero_si128();
572
+
573
+ // Load values. Note that we read 8 pixels instead of 4,
574
+ // but the a/b buffers are over-allocated to that effect.
575
+ const __m128i a0 = _mm_loadl_epi64((const __m128i*)&a[BPS * 0]);
576
+ const __m128i a1 = _mm_loadl_epi64((const __m128i*)&a[BPS * 1]);
577
+ const __m128i a2 = _mm_loadl_epi64((const __m128i*)&a[BPS * 2]);
578
+ const __m128i a3 = _mm_loadl_epi64((const __m128i*)&a[BPS * 3]);
579
+ const __m128i b0 = _mm_loadl_epi64((const __m128i*)&b[BPS * 0]);
580
+ const __m128i b1 = _mm_loadl_epi64((const __m128i*)&b[BPS * 1]);
581
+ const __m128i b2 = _mm_loadl_epi64((const __m128i*)&b[BPS * 2]);
582
+ const __m128i b3 = _mm_loadl_epi64((const __m128i*)&b[BPS * 3]);
583
+ // Combine pair of lines.
584
+ const __m128i a01 = _mm_unpacklo_epi32(a0, a1);
585
+ const __m128i a23 = _mm_unpacklo_epi32(a2, a3);
586
+ const __m128i b01 = _mm_unpacklo_epi32(b0, b1);
587
+ const __m128i b23 = _mm_unpacklo_epi32(b2, b3);
588
+ // Convert to 16b.
589
+ const __m128i a01s = _mm_unpacklo_epi8(a01, zero);
590
+ const __m128i a23s = _mm_unpacklo_epi8(a23, zero);
591
+ const __m128i b01s = _mm_unpacklo_epi8(b01, zero);
592
+ const __m128i b23s = _mm_unpacklo_epi8(b23, zero);
593
+ // subtract, square and accumulate
594
+ const __m128i d0 = _mm_subs_epi16(a01s, b01s);
595
+ const __m128i d1 = _mm_subs_epi16(a23s, b23s);
596
+ const __m128i e0 = _mm_madd_epi16(d0, d0);
597
+ const __m128i e1 = _mm_madd_epi16(d1, d1);
598
+ const __m128i sum = _mm_add_epi32(e0, e1);
599
+
600
+ int32_t tmp[4];
601
+ _mm_storeu_si128((__m128i*)tmp, sum);
602
+ return (tmp[3] + tmp[2] + tmp[1] + tmp[0]);
603
+ }
604
+
605
+ //------------------------------------------------------------------------------
606
+ // Texture distortion
607
+ //
608
+ // We try to match the spectral content (weighted) between source and
609
+ // reconstructed samples.
610
+
611
+ // Hadamard transform
612
+ // Returns the difference between the weighted sum of the absolute value of
613
+ // transformed coefficients.
614
+ static int TTransform(const uint8_t* inA, const uint8_t* inB,
615
+ const uint16_t* const w) {
616
+ int32_t sum[4];
617
+ __m128i tmp_0, tmp_1, tmp_2, tmp_3;
618
+ const __m128i zero = _mm_setzero_si128();
619
+
620
+ // Load, combine and transpose inputs.
621
+ {
622
+ const __m128i inA_0 = _mm_loadl_epi64((const __m128i*)&inA[BPS * 0]);
623
+ const __m128i inA_1 = _mm_loadl_epi64((const __m128i*)&inA[BPS * 1]);
624
+ const __m128i inA_2 = _mm_loadl_epi64((const __m128i*)&inA[BPS * 2]);
625
+ const __m128i inA_3 = _mm_loadl_epi64((const __m128i*)&inA[BPS * 3]);
626
+ const __m128i inB_0 = _mm_loadl_epi64((const __m128i*)&inB[BPS * 0]);
627
+ const __m128i inB_1 = _mm_loadl_epi64((const __m128i*)&inB[BPS * 1]);
628
+ const __m128i inB_2 = _mm_loadl_epi64((const __m128i*)&inB[BPS * 2]);
629
+ const __m128i inB_3 = _mm_loadl_epi64((const __m128i*)&inB[BPS * 3]);
630
+
631
+ // Combine inA and inB (we'll do two transforms in parallel).
632
+ const __m128i inAB_0 = _mm_unpacklo_epi8(inA_0, inB_0);
633
+ const __m128i inAB_1 = _mm_unpacklo_epi8(inA_1, inB_1);
634
+ const __m128i inAB_2 = _mm_unpacklo_epi8(inA_2, inB_2);
635
+ const __m128i inAB_3 = _mm_unpacklo_epi8(inA_3, inB_3);
636
+ // a00 b00 a01 b01 a02 b03 a03 b03 0 0 0 0 0 0 0 0
637
+ // a10 b10 a11 b11 a12 b12 a13 b13 0 0 0 0 0 0 0 0
638
+ // a20 b20 a21 b21 a22 b22 a23 b23 0 0 0 0 0 0 0 0
639
+ // a30 b30 a31 b31 a32 b32 a33 b33 0 0 0 0 0 0 0 0
640
+
641
+ // Transpose the two 4x4, discarding the filling zeroes.
642
+ const __m128i transpose0_0 = _mm_unpacklo_epi8(inAB_0, inAB_2);
643
+ const __m128i transpose0_1 = _mm_unpacklo_epi8(inAB_1, inAB_3);
644
+ // a00 a20 b00 b20 a01 a21 b01 b21 a02 a22 b02 b22 a03 a23 b03 b23
645
+ // a10 a30 b10 b30 a11 a31 b11 b31 a12 a32 b12 b32 a13 a33 b13 b33
646
+ const __m128i transpose1_0 = _mm_unpacklo_epi8(transpose0_0, transpose0_1);
647
+ const __m128i transpose1_1 = _mm_unpackhi_epi8(transpose0_0, transpose0_1);
648
+ // a00 a10 a20 a30 b00 b10 b20 b30 a01 a11 a21 a31 b01 b11 b21 b31
649
+ // a02 a12 a22 a32 b02 b12 b22 b32 a03 a13 a23 a33 b03 b13 b23 b33
650
+
651
+ // Convert to 16b.
652
+ tmp_0 = _mm_unpacklo_epi8(transpose1_0, zero);
653
+ tmp_1 = _mm_unpackhi_epi8(transpose1_0, zero);
654
+ tmp_2 = _mm_unpacklo_epi8(transpose1_1, zero);
655
+ tmp_3 = _mm_unpackhi_epi8(transpose1_1, zero);
656
+ // a00 a10 a20 a30 b00 b10 b20 b30
657
+ // a01 a11 a21 a31 b01 b11 b21 b31
658
+ // a02 a12 a22 a32 b02 b12 b22 b32
659
+ // a03 a13 a23 a33 b03 b13 b23 b33
660
+ }
661
+
662
+ // Horizontal pass and subsequent transpose.
663
+ {
664
+ // Calculate a and b (two 4x4 at once).
665
+ const __m128i a0 = _mm_add_epi16(tmp_0, tmp_2);
666
+ const __m128i a1 = _mm_add_epi16(tmp_1, tmp_3);
667
+ const __m128i a2 = _mm_sub_epi16(tmp_1, tmp_3);
668
+ const __m128i a3 = _mm_sub_epi16(tmp_0, tmp_2);
669
+ const __m128i b0 = _mm_add_epi16(a0, a1);
670
+ const __m128i b1 = _mm_add_epi16(a3, a2);
671
+ const __m128i b2 = _mm_sub_epi16(a3, a2);
672
+ const __m128i b3 = _mm_sub_epi16(a0, a1);
673
+ // a00 a01 a02 a03 b00 b01 b02 b03
674
+ // a10 a11 a12 a13 b10 b11 b12 b13
675
+ // a20 a21 a22 a23 b20 b21 b22 b23
676
+ // a30 a31 a32 a33 b30 b31 b32 b33
677
+
678
+ // Transpose the two 4x4.
679
+ const __m128i transpose0_0 = _mm_unpacklo_epi16(b0, b1);
680
+ const __m128i transpose0_1 = _mm_unpacklo_epi16(b2, b3);
681
+ const __m128i transpose0_2 = _mm_unpackhi_epi16(b0, b1);
682
+ const __m128i transpose0_3 = _mm_unpackhi_epi16(b2, b3);
683
+ // a00 a10 a01 a11 a02 a12 a03 a13
684
+ // a20 a30 a21 a31 a22 a32 a23 a33
685
+ // b00 b10 b01 b11 b02 b12 b03 b13
686
+ // b20 b30 b21 b31 b22 b32 b23 b33
687
+ const __m128i transpose1_0 = _mm_unpacklo_epi32(transpose0_0, transpose0_1);
688
+ const __m128i transpose1_1 = _mm_unpacklo_epi32(transpose0_2, transpose0_3);
689
+ const __m128i transpose1_2 = _mm_unpackhi_epi32(transpose0_0, transpose0_1);
690
+ const __m128i transpose1_3 = _mm_unpackhi_epi32(transpose0_2, transpose0_3);
691
+ // a00 a10 a20 a30 a01 a11 a21 a31
692
+ // b00 b10 b20 b30 b01 b11 b21 b31
693
+ // a02 a12 a22 a32 a03 a13 a23 a33
694
+ // b02 b12 a22 b32 b03 b13 b23 b33
695
+ tmp_0 = _mm_unpacklo_epi64(transpose1_0, transpose1_1);
696
+ tmp_1 = _mm_unpackhi_epi64(transpose1_0, transpose1_1);
697
+ tmp_2 = _mm_unpacklo_epi64(transpose1_2, transpose1_3);
698
+ tmp_3 = _mm_unpackhi_epi64(transpose1_2, transpose1_3);
699
+ // a00 a10 a20 a30 b00 b10 b20 b30
700
+ // a01 a11 a21 a31 b01 b11 b21 b31
701
+ // a02 a12 a22 a32 b02 b12 b22 b32
702
+ // a03 a13 a23 a33 b03 b13 b23 b33
703
+ }
704
+
705
+ // Vertical pass and difference of weighted sums.
706
+ {
707
+ // Load all inputs.
708
+ // TODO(cduvivier): Make variable declarations and allocations aligned so
709
+ // we can use _mm_load_si128 instead of _mm_loadu_si128.
710
+ const __m128i w_0 = _mm_loadu_si128((const __m128i*)&w[0]);
711
+ const __m128i w_8 = _mm_loadu_si128((const __m128i*)&w[8]);
712
+
713
+ // Calculate a and b (two 4x4 at once).
714
+ const __m128i a0 = _mm_add_epi16(tmp_0, tmp_2);
715
+ const __m128i a1 = _mm_add_epi16(tmp_1, tmp_3);
716
+ const __m128i a2 = _mm_sub_epi16(tmp_1, tmp_3);
717
+ const __m128i a3 = _mm_sub_epi16(tmp_0, tmp_2);
718
+ const __m128i b0 = _mm_add_epi16(a0, a1);
719
+ const __m128i b1 = _mm_add_epi16(a3, a2);
720
+ const __m128i b2 = _mm_sub_epi16(a3, a2);
721
+ const __m128i b3 = _mm_sub_epi16(a0, a1);
722
+
723
+ // Separate the transforms of inA and inB.
724
+ __m128i A_b0 = _mm_unpacklo_epi64(b0, b1);
725
+ __m128i A_b2 = _mm_unpacklo_epi64(b2, b3);
726
+ __m128i B_b0 = _mm_unpackhi_epi64(b0, b1);
727
+ __m128i B_b2 = _mm_unpackhi_epi64(b2, b3);
728
+
729
+ {
730
+ // sign(b) = b >> 15 (0x0000 if positive, 0xffff if negative)
731
+ const __m128i sign_A_b0 = _mm_srai_epi16(A_b0, 15);
732
+ const __m128i sign_A_b2 = _mm_srai_epi16(A_b2, 15);
733
+ const __m128i sign_B_b0 = _mm_srai_epi16(B_b0, 15);
734
+ const __m128i sign_B_b2 = _mm_srai_epi16(B_b2, 15);
735
+
736
+ // b = abs(b) = (b ^ sign) - sign
737
+ A_b0 = _mm_xor_si128(A_b0, sign_A_b0);
738
+ A_b2 = _mm_xor_si128(A_b2, sign_A_b2);
739
+ B_b0 = _mm_xor_si128(B_b0, sign_B_b0);
740
+ B_b2 = _mm_xor_si128(B_b2, sign_B_b2);
741
+ A_b0 = _mm_sub_epi16(A_b0, sign_A_b0);
742
+ A_b2 = _mm_sub_epi16(A_b2, sign_A_b2);
743
+ B_b0 = _mm_sub_epi16(B_b0, sign_B_b0);
744
+ B_b2 = _mm_sub_epi16(B_b2, sign_B_b2);
745
+ }
746
+
747
+ // weighted sums
748
+ A_b0 = _mm_madd_epi16(A_b0, w_0);
749
+ A_b2 = _mm_madd_epi16(A_b2, w_8);
750
+ B_b0 = _mm_madd_epi16(B_b0, w_0);
751
+ B_b2 = _mm_madd_epi16(B_b2, w_8);
752
+ A_b0 = _mm_add_epi32(A_b0, A_b2);
753
+ B_b0 = _mm_add_epi32(B_b0, B_b2);
754
+
755
+ // difference of weighted sums
756
+ A_b0 = _mm_sub_epi32(A_b0, B_b0);
757
+ _mm_storeu_si128((__m128i*)&sum[0], A_b0);
758
+ }
759
+ return sum[0] + sum[1] + sum[2] + sum[3];
760
+ }
761
+
762
+ static int Disto4x4(const uint8_t* const a, const uint8_t* const b,
763
+ const uint16_t* const w) {
764
+ const int diff_sum = TTransform(a, b, w);
765
+ return abs(diff_sum) >> 5;
766
+ }
767
+
768
+ static int Disto16x16(const uint8_t* const a, const uint8_t* const b,
769
+ const uint16_t* const w) {
770
+ int D = 0;
771
+ int x, y;
772
+ for (y = 0; y < 16 * BPS; y += 4 * BPS) {
773
+ for (x = 0; x < 16; x += 4) {
774
+ D += Disto4x4(a + x + y, b + x + y, w);
775
+ }
776
+ }
777
+ return D;
778
+ }
779
+
780
+ //------------------------------------------------------------------------------
781
+ // Quantization
782
+ //
783
+
784
+ static WEBP_INLINE int DoQuantizeBlock(int16_t in[16], int16_t out[16],
785
+ const uint16_t* const sharpen,
786
+ const VP8Matrix* const mtx) {
787
+ const __m128i max_coeff_2047 = _mm_set1_epi16(MAX_LEVEL);
788
+ const __m128i zero = _mm_setzero_si128();
789
+ __m128i coeff0, coeff8;
790
+ __m128i out0, out8;
791
+ __m128i packed_out;
792
+
793
+ // Load all inputs.
794
+ // TODO(cduvivier): Make variable declarations and allocations aligned so that
795
+ // we can use _mm_load_si128 instead of _mm_loadu_si128.
796
+ __m128i in0 = _mm_loadu_si128((__m128i*)&in[0]);
797
+ __m128i in8 = _mm_loadu_si128((__m128i*)&in[8]);
798
+ const __m128i iq0 = _mm_loadu_si128((const __m128i*)&mtx->iq_[0]);
799
+ const __m128i iq8 = _mm_loadu_si128((const __m128i*)&mtx->iq_[8]);
800
+ const __m128i q0 = _mm_loadu_si128((const __m128i*)&mtx->q_[0]);
801
+ const __m128i q8 = _mm_loadu_si128((const __m128i*)&mtx->q_[8]);
802
+
803
+ // extract sign(in) (0x0000 if positive, 0xffff if negative)
804
+ const __m128i sign0 = _mm_cmpgt_epi16(zero, in0);
805
+ const __m128i sign8 = _mm_cmpgt_epi16(zero, in8);
806
+
807
+ // coeff = abs(in) = (in ^ sign) - sign
808
+ coeff0 = _mm_xor_si128(in0, sign0);
809
+ coeff8 = _mm_xor_si128(in8, sign8);
810
+ coeff0 = _mm_sub_epi16(coeff0, sign0);
811
+ coeff8 = _mm_sub_epi16(coeff8, sign8);
812
+
813
+ // coeff = abs(in) + sharpen
814
+ if (sharpen != NULL) {
815
+ const __m128i sharpen0 = _mm_loadu_si128((const __m128i*)&sharpen[0]);
816
+ const __m128i sharpen8 = _mm_loadu_si128((const __m128i*)&sharpen[8]);
817
+ coeff0 = _mm_add_epi16(coeff0, sharpen0);
818
+ coeff8 = _mm_add_epi16(coeff8, sharpen8);
819
+ }
820
+
821
+ // out = (coeff * iQ + B) >> QFIX
822
+ {
823
+ // doing calculations with 32b precision (QFIX=17)
824
+ // out = (coeff * iQ)
825
+ const __m128i coeff_iQ0H = _mm_mulhi_epu16(coeff0, iq0);
826
+ const __m128i coeff_iQ0L = _mm_mullo_epi16(coeff0, iq0);
827
+ const __m128i coeff_iQ8H = _mm_mulhi_epu16(coeff8, iq8);
828
+ const __m128i coeff_iQ8L = _mm_mullo_epi16(coeff8, iq8);
829
+ __m128i out_00 = _mm_unpacklo_epi16(coeff_iQ0L, coeff_iQ0H);
830
+ __m128i out_04 = _mm_unpackhi_epi16(coeff_iQ0L, coeff_iQ0H);
831
+ __m128i out_08 = _mm_unpacklo_epi16(coeff_iQ8L, coeff_iQ8H);
832
+ __m128i out_12 = _mm_unpackhi_epi16(coeff_iQ8L, coeff_iQ8H);
833
+ // out = (coeff * iQ + B)
834
+ const __m128i bias_00 = _mm_loadu_si128((const __m128i*)&mtx->bias_[0]);
835
+ const __m128i bias_04 = _mm_loadu_si128((const __m128i*)&mtx->bias_[4]);
836
+ const __m128i bias_08 = _mm_loadu_si128((const __m128i*)&mtx->bias_[8]);
837
+ const __m128i bias_12 = _mm_loadu_si128((const __m128i*)&mtx->bias_[12]);
838
+ out_00 = _mm_add_epi32(out_00, bias_00);
839
+ out_04 = _mm_add_epi32(out_04, bias_04);
840
+ out_08 = _mm_add_epi32(out_08, bias_08);
841
+ out_12 = _mm_add_epi32(out_12, bias_12);
842
+ // out = QUANTDIV(coeff, iQ, B, QFIX)
843
+ out_00 = _mm_srai_epi32(out_00, QFIX);
844
+ out_04 = _mm_srai_epi32(out_04, QFIX);
845
+ out_08 = _mm_srai_epi32(out_08, QFIX);
846
+ out_12 = _mm_srai_epi32(out_12, QFIX);
847
+
848
+ // pack result as 16b
849
+ out0 = _mm_packs_epi32(out_00, out_04);
850
+ out8 = _mm_packs_epi32(out_08, out_12);
851
+
852
+ // if (coeff > 2047) coeff = 2047
853
+ out0 = _mm_min_epi16(out0, max_coeff_2047);
854
+ out8 = _mm_min_epi16(out8, max_coeff_2047);
855
+ }
856
+
857
+ // get sign back (if (sign[j]) out_n = -out_n)
858
+ out0 = _mm_xor_si128(out0, sign0);
859
+ out8 = _mm_xor_si128(out8, sign8);
860
+ out0 = _mm_sub_epi16(out0, sign0);
861
+ out8 = _mm_sub_epi16(out8, sign8);
862
+
863
+ // in = out * Q
864
+ in0 = _mm_mullo_epi16(out0, q0);
865
+ in8 = _mm_mullo_epi16(out8, q8);
866
+
867
+ _mm_storeu_si128((__m128i*)&in[0], in0);
868
+ _mm_storeu_si128((__m128i*)&in[8], in8);
869
+
870
+ // zigzag the output before storing it.
871
+ //
872
+ // The zigzag pattern can almost be reproduced with a small sequence of
873
+ // shuffles. After it, we only need to swap the 7th (ending up in third
874
+ // position instead of twelfth) and 8th values.
875
+ {
876
+ __m128i outZ0, outZ8;
877
+ outZ0 = _mm_shufflehi_epi16(out0, _MM_SHUFFLE(2, 1, 3, 0));
878
+ outZ0 = _mm_shuffle_epi32 (outZ0, _MM_SHUFFLE(3, 1, 2, 0));
879
+ outZ0 = _mm_shufflehi_epi16(outZ0, _MM_SHUFFLE(3, 1, 0, 2));
880
+ outZ8 = _mm_shufflelo_epi16(out8, _MM_SHUFFLE(3, 0, 2, 1));
881
+ outZ8 = _mm_shuffle_epi32 (outZ8, _MM_SHUFFLE(3, 1, 2, 0));
882
+ outZ8 = _mm_shufflelo_epi16(outZ8, _MM_SHUFFLE(1, 3, 2, 0));
883
+ _mm_storeu_si128((__m128i*)&out[0], outZ0);
884
+ _mm_storeu_si128((__m128i*)&out[8], outZ8);
885
+ packed_out = _mm_packs_epi16(outZ0, outZ8);
886
+ }
887
+ {
888
+ const int16_t outZ_12 = out[12];
889
+ const int16_t outZ_3 = out[3];
890
+ out[3] = outZ_12;
891
+ out[12] = outZ_3;
892
+ }
893
+
894
+ // detect if all 'out' values are zeroes or not
895
+ return (_mm_movemask_epi8(_mm_cmpeq_epi8(packed_out, zero)) != 0xffff);
896
+ }
897
+
898
+ static int QuantizeBlock(int16_t in[16], int16_t out[16],
899
+ const VP8Matrix* const mtx) {
900
+ return DoQuantizeBlock(in, out, &mtx->sharpen_[0], mtx);
901
+ }
902
+
903
+ static int QuantizeBlockWHT(int16_t in[16], int16_t out[16],
904
+ const VP8Matrix* const mtx) {
905
+ return DoQuantizeBlock(in, out, NULL, mtx);
906
+ }
907
+
908
+ static int Quantize2Blocks(int16_t in[32], int16_t out[32],
909
+ const VP8Matrix* const mtx) {
910
+ int nz;
911
+ const uint16_t* const sharpen = &mtx->sharpen_[0];
912
+ nz = DoQuantizeBlock(in + 0 * 16, out + 0 * 16, sharpen, mtx) << 0;
913
+ nz |= DoQuantizeBlock(in + 1 * 16, out + 1 * 16, sharpen, mtx) << 1;
914
+ return nz;
915
+ }
916
+
917
+ #endif // WEBP_USE_SSE2
918
+
919
+ //------------------------------------------------------------------------------
920
+ // Entry point
921
+
922
+ extern void VP8EncDspInitSSE2(void);
923
+
924
+ WEBP_TSAN_IGNORE_FUNCTION void VP8EncDspInitSSE2(void) {
925
+ #if defined(WEBP_USE_SSE2)
926
+ VP8CollectHistogram = CollectHistogram;
927
+ VP8EncQuantizeBlock = QuantizeBlock;
928
+ VP8EncQuantize2Blocks = Quantize2Blocks;
929
+ VP8EncQuantizeBlockWHT = QuantizeBlockWHT;
930
+ VP8ITransform = ITransform;
931
+ VP8FTransform = FTransform;
932
+ VP8FTransformWHT = FTransformWHT;
933
+ VP8SSE16x16 = SSE16x16;
934
+ VP8SSE16x8 = SSE16x8;
935
+ VP8SSE8x8 = SSE8x8;
936
+ VP8SSE4x4 = SSE4x4;
937
+ VP8TDisto4x4 = Disto4x4;
938
+ VP8TDisto16x16 = Disto16x16;
939
+ #endif // WEBP_USE_SSE2
940
+ }