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,1100 @@
1
+ // Copyright 2014 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
+ // WebPPicture utils for colorspace conversion
11
+ //
12
+ // Author: Skal (pascal.massimino@gmail.com)
13
+
14
+ #include <assert.h>
15
+ #include <stdlib.h>
16
+ #include <math.h>
17
+
18
+ #include "./vp8enci.h"
19
+ #include "../utils/random.h"
20
+ #include "../utils/utils.h"
21
+ #include "../dsp/yuv.h"
22
+
23
+ // Uncomment to disable gamma-compression during RGB->U/V averaging
24
+ #define USE_GAMMA_COMPRESSION
25
+
26
+ // If defined, use table to compute x / alpha.
27
+ #define USE_INVERSE_ALPHA_TABLE
28
+
29
+ static const union {
30
+ uint32_t argb;
31
+ uint8_t bytes[4];
32
+ } test_endian = { 0xff000000u };
33
+ #define ALPHA_IS_LAST (test_endian.bytes[3] == 0xff)
34
+
35
+ //------------------------------------------------------------------------------
36
+ // Detection of non-trivial transparency
37
+
38
+ // Returns true if alpha[] has non-0xff values.
39
+ static int CheckNonOpaque(const uint8_t* alpha, int width, int height,
40
+ int x_step, int y_step) {
41
+ if (alpha == NULL) return 0;
42
+ while (height-- > 0) {
43
+ int x;
44
+ for (x = 0; x < width * x_step; x += x_step) {
45
+ if (alpha[x] != 0xff) return 1; // TODO(skal): check 4/8 bytes at a time.
46
+ }
47
+ alpha += y_step;
48
+ }
49
+ return 0;
50
+ }
51
+
52
+ // Checking for the presence of non-opaque alpha.
53
+ int WebPPictureHasTransparency(const WebPPicture* picture) {
54
+ if (picture == NULL) return 0;
55
+ if (!picture->use_argb) {
56
+ return CheckNonOpaque(picture->a, picture->width, picture->height,
57
+ 1, picture->a_stride);
58
+ } else {
59
+ int x, y;
60
+ const uint32_t* argb = picture->argb;
61
+ if (argb == NULL) return 0;
62
+ for (y = 0; y < picture->height; ++y) {
63
+ for (x = 0; x < picture->width; ++x) {
64
+ if (argb[x] < 0xff000000u) return 1; // test any alpha values != 0xff
65
+ }
66
+ argb += picture->argb_stride;
67
+ }
68
+ }
69
+ return 0;
70
+ }
71
+
72
+ //------------------------------------------------------------------------------
73
+ // Code for gamma correction
74
+
75
+ #if defined(USE_GAMMA_COMPRESSION)
76
+
77
+ // gamma-compensates loss of resolution during chroma subsampling
78
+ #define kGamma 0.80 // for now we use a different gamma value than kGammaF
79
+ #define kGammaFix 12 // fixed-point precision for linear values
80
+ #define kGammaScale ((1 << kGammaFix) - 1)
81
+ #define kGammaTabFix 7 // fixed-point fractional bits precision
82
+ #define kGammaTabScale (1 << kGammaTabFix)
83
+ #define kGammaTabRounder (kGammaTabScale >> 1)
84
+ #define kGammaTabSize (1 << (kGammaFix - kGammaTabFix))
85
+
86
+ static int kLinearToGammaTab[kGammaTabSize + 1];
87
+ static uint16_t kGammaToLinearTab[256];
88
+ static volatile int kGammaTablesOk = 0;
89
+
90
+ static WEBP_TSAN_IGNORE_FUNCTION void InitGammaTables(void) {
91
+ if (!kGammaTablesOk) {
92
+ int v;
93
+ const double scale = (double)(1 << kGammaTabFix) / kGammaScale;
94
+ const double norm = 1. / 255.;
95
+ for (v = 0; v <= 255; ++v) {
96
+ kGammaToLinearTab[v] =
97
+ (uint16_t)(pow(norm * v, kGamma) * kGammaScale + .5);
98
+ }
99
+ for (v = 0; v <= kGammaTabSize; ++v) {
100
+ kLinearToGammaTab[v] = (int)(255. * pow(scale * v, 1. / kGamma) + .5);
101
+ }
102
+ kGammaTablesOk = 1;
103
+ }
104
+ }
105
+
106
+ static WEBP_INLINE uint32_t GammaToLinear(uint8_t v) {
107
+ return kGammaToLinearTab[v];
108
+ }
109
+
110
+ static WEBP_INLINE int Interpolate(int v) {
111
+ const int tab_pos = v >> (kGammaTabFix + 2); // integer part
112
+ const int x = v & ((kGammaTabScale << 2) - 1); // fractional part
113
+ const int v0 = kLinearToGammaTab[tab_pos];
114
+ const int v1 = kLinearToGammaTab[tab_pos + 1];
115
+ const int y = v1 * x + v0 * ((kGammaTabScale << 2) - x); // interpolate
116
+ assert(tab_pos + 1 < kGammaTabSize + 1);
117
+ return y;
118
+ }
119
+
120
+ // Convert a linear value 'v' to YUV_FIX+2 fixed-point precision
121
+ // U/V value, suitable for RGBToU/V calls.
122
+ static WEBP_INLINE int LinearToGamma(uint32_t base_value, int shift) {
123
+ const int y = Interpolate(base_value << shift); // final uplifted value
124
+ return (y + kGammaTabRounder) >> kGammaTabFix; // descale
125
+ }
126
+
127
+ #else
128
+
129
+ static WEBP_TSAN_IGNORE_FUNCTION void InitGammaTables(void) {}
130
+ static WEBP_INLINE uint32_t GammaToLinear(uint8_t v) { return v; }
131
+ static WEBP_INLINE int LinearToGamma(uint32_t base_value, int shift) {
132
+ return (int)(base_value << shift);
133
+ }
134
+
135
+ #endif // USE_GAMMA_COMPRESSION
136
+
137
+ //------------------------------------------------------------------------------
138
+ // RGB -> YUV conversion
139
+
140
+ static int RGBToY(int r, int g, int b, VP8Random* const rg) {
141
+ return (rg == NULL) ? VP8RGBToY(r, g, b, YUV_HALF)
142
+ : VP8RGBToY(r, g, b, VP8RandomBits(rg, YUV_FIX));
143
+ }
144
+
145
+ static int RGBToU(int r, int g, int b, VP8Random* const rg) {
146
+ return (rg == NULL) ? VP8RGBToU(r, g, b, YUV_HALF << 2)
147
+ : VP8RGBToU(r, g, b, VP8RandomBits(rg, YUV_FIX + 2));
148
+ }
149
+
150
+ static int RGBToV(int r, int g, int b, VP8Random* const rg) {
151
+ return (rg == NULL) ? VP8RGBToV(r, g, b, YUV_HALF << 2)
152
+ : VP8RGBToV(r, g, b, VP8RandomBits(rg, YUV_FIX + 2));
153
+ }
154
+
155
+ //------------------------------------------------------------------------------
156
+ // Smart RGB->YUV conversion
157
+
158
+ static const int kNumIterations = 6;
159
+ static const int kMinDimensionIterativeConversion = 4;
160
+
161
+ // We use a-priori a different precision for storing RGB and Y/W components
162
+ // We could use YFIX=0 and only uint8_t for fixed_y_t, but it produces some
163
+ // banding sometimes. Better use extra precision.
164
+ // TODO(skal): cleanup once TFIX/YFIX values are fixed.
165
+
166
+ typedef int16_t fixed_t; // signed type with extra TFIX precision for UV
167
+ typedef uint16_t fixed_y_t; // unsigned type with extra YFIX precision for W
168
+ #define TFIX 2 // fixed-point precision of RGB
169
+ #define YFIX 2 // fixed point precision for Y/W
170
+
171
+ #define THALF ((1 << TFIX) >> 1)
172
+ #define MAX_Y_T ((256 << YFIX) - 1)
173
+ #define TROUNDER (1 << (YUV_FIX + TFIX - 1))
174
+
175
+ #if defined(USE_GAMMA_COMPRESSION)
176
+
177
+ // float variant of gamma-correction
178
+ // We use tables of different size and precision, along with a 'real-world'
179
+ // Gamma value close to ~2.
180
+ #define kGammaF 2.2
181
+ static float kGammaToLinearTabF[MAX_Y_T + 1]; // size scales with Y_FIX
182
+ static float kLinearToGammaTabF[kGammaTabSize + 2];
183
+ static volatile int kGammaTablesFOk = 0;
184
+
185
+ static WEBP_TSAN_IGNORE_FUNCTION void InitGammaTablesF(void) {
186
+ if (!kGammaTablesFOk) {
187
+ int v;
188
+ const double norm = 1. / MAX_Y_T;
189
+ const double scale = 1. / kGammaTabSize;
190
+ for (v = 0; v <= MAX_Y_T; ++v) {
191
+ kGammaToLinearTabF[v] = (float)pow(norm * v, kGammaF);
192
+ }
193
+ for (v = 0; v <= kGammaTabSize; ++v) {
194
+ kLinearToGammaTabF[v] = (float)(MAX_Y_T * pow(scale * v, 1. / kGammaF));
195
+ }
196
+ // to prevent small rounding errors to cause read-overflow:
197
+ kLinearToGammaTabF[kGammaTabSize + 1] = kLinearToGammaTabF[kGammaTabSize];
198
+ kGammaTablesFOk = 1;
199
+ }
200
+ }
201
+
202
+ static WEBP_INLINE float GammaToLinearF(int v) {
203
+ return kGammaToLinearTabF[v];
204
+ }
205
+
206
+ static WEBP_INLINE int LinearToGammaF(float value) {
207
+ const float v = value * kGammaTabSize;
208
+ const int tab_pos = (int)v;
209
+ const float x = v - (float)tab_pos; // fractional part
210
+ const float v0 = kLinearToGammaTabF[tab_pos + 0];
211
+ const float v1 = kLinearToGammaTabF[tab_pos + 1];
212
+ const float y = v1 * x + v0 * (1.f - x); // interpolate
213
+ return (int)(y + .5);
214
+ }
215
+
216
+ #else
217
+
218
+ static WEBP_TSAN_IGNORE_FUNCTION void InitGammaTablesF(void) {}
219
+ static WEBP_INLINE float GammaToLinearF(int v) {
220
+ const float norm = 1.f / MAX_Y_T;
221
+ return norm * v;
222
+ }
223
+ static WEBP_INLINE int LinearToGammaF(float value) {
224
+ return (int)(MAX_Y_T * value + .5);
225
+ }
226
+
227
+ #endif // USE_GAMMA_COMPRESSION
228
+
229
+ //------------------------------------------------------------------------------
230
+
231
+ // precision: YFIX -> TFIX
232
+ static WEBP_INLINE int FixedYToW(int v) { return v; }
233
+ static WEBP_INLINE int FixedWToY(int v) { return v; }
234
+
235
+ static uint8_t clip_8b(fixed_t v) {
236
+ return (!(v & ~0xff)) ? (uint8_t)v : (v < 0) ? 0u : 255u;
237
+ }
238
+
239
+ static fixed_y_t clip_y(int y) {
240
+ return (!(y & ~MAX_Y_T)) ? (fixed_y_t)y : (y < 0) ? 0 : MAX_Y_T;
241
+ }
242
+
243
+ // precision: TFIX -> YFIX
244
+ static fixed_y_t clip_fixed_t(fixed_t v) {
245
+ const int y = FixedWToY(v);
246
+ const fixed_y_t w = clip_y(y);
247
+ return w;
248
+ }
249
+
250
+ //------------------------------------------------------------------------------
251
+
252
+ static int RGBToGray(int r, int g, int b) {
253
+ const int luma = 19595 * r + 38470 * g + 7471 * b + YUV_HALF;
254
+ return (luma >> YUV_FIX);
255
+ }
256
+
257
+ static float RGBToGrayF(float r, float g, float b) {
258
+ return 0.299f * r + 0.587f * g + 0.114f * b;
259
+ }
260
+
261
+ static int ScaleDown(int a, int b, int c, int d) {
262
+ const float A = GammaToLinearF(a);
263
+ const float B = GammaToLinearF(b);
264
+ const float C = GammaToLinearF(c);
265
+ const float D = GammaToLinearF(d);
266
+ return LinearToGammaF(0.25f * (A + B + C + D));
267
+ }
268
+
269
+ static WEBP_INLINE void UpdateW(const fixed_y_t* src, fixed_y_t* dst, int len) {
270
+ while (len-- > 0) {
271
+ const float R = GammaToLinearF(src[0]);
272
+ const float G = GammaToLinearF(src[1]);
273
+ const float B = GammaToLinearF(src[2]);
274
+ const float Y = RGBToGrayF(R, G, B);
275
+ *dst++ = (fixed_y_t)LinearToGammaF(Y);
276
+ src += 3;
277
+ }
278
+ }
279
+
280
+ static WEBP_INLINE void UpdateChroma(const fixed_y_t* src1,
281
+ const fixed_y_t* src2,
282
+ fixed_t* dst, fixed_y_t* tmp, int len) {
283
+ while (len--> 0) {
284
+ const int r = ScaleDown(src1[0], src1[3], src2[0], src2[3]);
285
+ const int g = ScaleDown(src1[1], src1[4], src2[1], src2[4]);
286
+ const int b = ScaleDown(src1[2], src1[5], src2[2], src2[5]);
287
+ const int W = RGBToGray(r, g, b);
288
+ dst[0] = (fixed_t)FixedYToW(r - W);
289
+ dst[1] = (fixed_t)FixedYToW(g - W);
290
+ dst[2] = (fixed_t)FixedYToW(b - W);
291
+ dst += 3;
292
+ src1 += 6;
293
+ src2 += 6;
294
+ if (tmp != NULL) {
295
+ tmp[0] = tmp[1] = clip_y((int)(W + .5));
296
+ tmp += 2;
297
+ }
298
+ }
299
+ }
300
+
301
+ //------------------------------------------------------------------------------
302
+
303
+ static WEBP_INLINE int Filter(const fixed_t* const A, const fixed_t* const B,
304
+ int rightwise) {
305
+ int v;
306
+ if (!rightwise) {
307
+ v = (A[0] * 9 + A[-3] * 3 + B[0] * 3 + B[-3]);
308
+ } else {
309
+ v = (A[0] * 9 + A[+3] * 3 + B[0] * 3 + B[+3]);
310
+ }
311
+ return (v + 8) >> 4;
312
+ }
313
+
314
+ static WEBP_INLINE int Filter2(int A, int B) { return (A * 3 + B + 2) >> 2; }
315
+
316
+ //------------------------------------------------------------------------------
317
+
318
+ // 8bit -> YFIX
319
+ static WEBP_INLINE fixed_y_t UpLift(uint8_t a) {
320
+ return ((fixed_y_t)a << YFIX) | (1 << (YFIX - 1));
321
+ }
322
+
323
+ static void ImportOneRow(const uint8_t* const r_ptr,
324
+ const uint8_t* const g_ptr,
325
+ const uint8_t* const b_ptr,
326
+ int step,
327
+ int pic_width,
328
+ fixed_y_t* const dst) {
329
+ int i;
330
+ for (i = 0; i < pic_width; ++i) {
331
+ const int off = i * step;
332
+ dst[3 * i + 0] = UpLift(r_ptr[off]);
333
+ dst[3 * i + 1] = UpLift(g_ptr[off]);
334
+ dst[3 * i + 2] = UpLift(b_ptr[off]);
335
+ }
336
+ if (pic_width & 1) { // replicate rightmost pixel
337
+ memcpy(dst + 3 * pic_width, dst + 3 * (pic_width - 1), 3 * sizeof(*dst));
338
+ }
339
+ }
340
+
341
+ static void InterpolateTwoRows(const fixed_y_t* const best_y,
342
+ const fixed_t* const prev_uv,
343
+ const fixed_t* const cur_uv,
344
+ const fixed_t* const next_uv,
345
+ int w,
346
+ fixed_y_t* const out1,
347
+ fixed_y_t* const out2) {
348
+ int i, k;
349
+ { // special boundary case for i==0
350
+ const int W0 = FixedYToW(best_y[0]);
351
+ const int W1 = FixedYToW(best_y[w]);
352
+ for (k = 0; k <= 2; ++k) {
353
+ out1[k] = clip_fixed_t(Filter2(cur_uv[k], prev_uv[k]) + W0);
354
+ out2[k] = clip_fixed_t(Filter2(cur_uv[k], next_uv[k]) + W1);
355
+ }
356
+ }
357
+ for (i = 1; i < w - 1; ++i) {
358
+ const int W0 = FixedYToW(best_y[i + 0]);
359
+ const int W1 = FixedYToW(best_y[i + w]);
360
+ const int off = 3 * (i >> 1);
361
+ for (k = 0; k <= 2; ++k) {
362
+ const int tmp0 = Filter(cur_uv + off + k, prev_uv + off + k, i & 1);
363
+ const int tmp1 = Filter(cur_uv + off + k, next_uv + off + k, i & 1);
364
+ out1[3 * i + k] = clip_fixed_t(tmp0 + W0);
365
+ out2[3 * i + k] = clip_fixed_t(tmp1 + W1);
366
+ }
367
+ }
368
+ { // special boundary case for i == w - 1
369
+ const int W0 = FixedYToW(best_y[i + 0]);
370
+ const int W1 = FixedYToW(best_y[i + w]);
371
+ const int off = 3 * (i >> 1);
372
+ for (k = 0; k <= 2; ++k) {
373
+ out1[3 * i + k] =
374
+ clip_fixed_t(Filter2(cur_uv[off + k], prev_uv[off + k]) + W0);
375
+ out2[3 * i + k] =
376
+ clip_fixed_t(Filter2(cur_uv[off + k], next_uv[off + k]) + W1);
377
+ }
378
+ }
379
+ }
380
+
381
+ static WEBP_INLINE uint8_t ConvertRGBToY(int r, int g, int b) {
382
+ const int luma = 16839 * r + 33059 * g + 6420 * b + TROUNDER;
383
+ return clip_8b(16 + (luma >> (YUV_FIX + TFIX)));
384
+ }
385
+
386
+ static WEBP_INLINE uint8_t ConvertRGBToU(int r, int g, int b) {
387
+ const int u = -9719 * r - 19081 * g + 28800 * b + TROUNDER;
388
+ return clip_8b(128 + (u >> (YUV_FIX + TFIX)));
389
+ }
390
+
391
+ static WEBP_INLINE uint8_t ConvertRGBToV(int r, int g, int b) {
392
+ const int v = +28800 * r - 24116 * g - 4684 * b + TROUNDER;
393
+ return clip_8b(128 + (v >> (YUV_FIX + TFIX)));
394
+ }
395
+
396
+ static int ConvertWRGBToYUV(const fixed_y_t* const best_y,
397
+ const fixed_t* const best_uv,
398
+ WebPPicture* const picture) {
399
+ int i, j;
400
+ const int w = (picture->width + 1) & ~1;
401
+ const int h = (picture->height + 1) & ~1;
402
+ const int uv_w = w >> 1;
403
+ const int uv_h = h >> 1;
404
+ for (j = 0; j < picture->height; ++j) {
405
+ for (i = 0; i < picture->width; ++i) {
406
+ const int off = 3 * ((i >> 1) + (j >> 1) * uv_w);
407
+ const int off2 = i + j * picture->y_stride;
408
+ const int W = FixedYToW(best_y[i + j * w]);
409
+ const int r = best_uv[off + 0] + W;
410
+ const int g = best_uv[off + 1] + W;
411
+ const int b = best_uv[off + 2] + W;
412
+ picture->y[off2] = ConvertRGBToY(r, g, b);
413
+ }
414
+ }
415
+ for (j = 0; j < uv_h; ++j) {
416
+ uint8_t* const dst_u = picture->u + j * picture->uv_stride;
417
+ uint8_t* const dst_v = picture->v + j * picture->uv_stride;
418
+ for (i = 0; i < uv_w; ++i) {
419
+ const int off = 3 * (i + j * uv_w);
420
+ const int r = best_uv[off + 0];
421
+ const int g = best_uv[off + 1];
422
+ const int b = best_uv[off + 2];
423
+ dst_u[i] = ConvertRGBToU(r, g, b);
424
+ dst_v[i] = ConvertRGBToV(r, g, b);
425
+ }
426
+ }
427
+ return 1;
428
+ }
429
+
430
+ //------------------------------------------------------------------------------
431
+ // Main function
432
+
433
+ #define SAFE_ALLOC(W, H, T) ((T*)WebPSafeMalloc((W) * (H), sizeof(T)))
434
+
435
+ static int PreprocessARGB(const uint8_t* const r_ptr,
436
+ const uint8_t* const g_ptr,
437
+ const uint8_t* const b_ptr,
438
+ int step, int rgb_stride,
439
+ WebPPicture* const picture) {
440
+ // we expand the right/bottom border if needed
441
+ const int w = (picture->width + 1) & ~1;
442
+ const int h = (picture->height + 1) & ~1;
443
+ const int uv_w = w >> 1;
444
+ const int uv_h = h >> 1;
445
+ int i, j, iter;
446
+
447
+ // TODO(skal): allocate one big memory chunk. But for now, it's easier
448
+ // for valgrind debugging to have several chunks.
449
+ fixed_y_t* const tmp_buffer = SAFE_ALLOC(w * 3, 2, fixed_y_t); // scratch
450
+ fixed_y_t* const best_y = SAFE_ALLOC(w, h, fixed_y_t);
451
+ fixed_y_t* const target_y = SAFE_ALLOC(w, h, fixed_y_t);
452
+ fixed_y_t* const best_rgb_y = SAFE_ALLOC(w, 2, fixed_y_t);
453
+ fixed_t* const best_uv = SAFE_ALLOC(uv_w * 3, uv_h, fixed_t);
454
+ fixed_t* const target_uv = SAFE_ALLOC(uv_w * 3, uv_h, fixed_t);
455
+ fixed_t* const best_rgb_uv = SAFE_ALLOC(uv_w * 3, 1, fixed_t);
456
+ int ok;
457
+
458
+ if (best_y == NULL || best_uv == NULL ||
459
+ target_y == NULL || target_uv == NULL ||
460
+ best_rgb_y == NULL || best_rgb_uv == NULL ||
461
+ tmp_buffer == NULL) {
462
+ ok = WebPEncodingSetError(picture, VP8_ENC_ERROR_OUT_OF_MEMORY);
463
+ goto End;
464
+ }
465
+ assert(picture->width >= kMinDimensionIterativeConversion);
466
+ assert(picture->height >= kMinDimensionIterativeConversion);
467
+
468
+ // Import RGB samples to W/RGB representation.
469
+ for (j = 0; j < picture->height; j += 2) {
470
+ const int is_last_row = (j == picture->height - 1);
471
+ fixed_y_t* const src1 = tmp_buffer;
472
+ fixed_y_t* const src2 = tmp_buffer + 3 * w;
473
+ const int off1 = j * rgb_stride;
474
+ const int off2 = off1 + rgb_stride;
475
+ const int uv_off = (j >> 1) * 3 * uv_w;
476
+ fixed_y_t* const dst_y = best_y + j * w;
477
+
478
+ // prepare two rows of input
479
+ ImportOneRow(r_ptr + off1, g_ptr + off1, b_ptr + off1,
480
+ step, picture->width, src1);
481
+ if (!is_last_row) {
482
+ ImportOneRow(r_ptr + off2, g_ptr + off2, b_ptr + off2,
483
+ step, picture->width, src2);
484
+ } else {
485
+ memcpy(src2, src1, 3 * w * sizeof(*src2));
486
+ }
487
+ UpdateW(src1, target_y + (j + 0) * w, w);
488
+ UpdateW(src2, target_y + (j + 1) * w, w);
489
+ UpdateChroma(src1, src2, target_uv + uv_off, dst_y, uv_w);
490
+ memcpy(best_uv + uv_off, target_uv + uv_off, 3 * uv_w * sizeof(*best_uv));
491
+ memcpy(dst_y + w, dst_y, w * sizeof(*dst_y));
492
+ }
493
+
494
+ // Iterate and resolve clipping conflicts.
495
+ for (iter = 0; iter < kNumIterations; ++iter) {
496
+ int k;
497
+ const fixed_t* cur_uv = best_uv;
498
+ const fixed_t* prev_uv = best_uv;
499
+ for (j = 0; j < h; j += 2) {
500
+ fixed_y_t* const src1 = tmp_buffer;
501
+ fixed_y_t* const src2 = tmp_buffer + 3 * w;
502
+
503
+ {
504
+ const fixed_t* const next_uv = cur_uv + ((j < h - 2) ? 3 * uv_w : 0);
505
+ InterpolateTwoRows(best_y + j * w, prev_uv, cur_uv, next_uv,
506
+ w, src1, src2);
507
+ prev_uv = cur_uv;
508
+ cur_uv = next_uv;
509
+ }
510
+
511
+ UpdateW(src1, best_rgb_y + 0 * w, w);
512
+ UpdateW(src2, best_rgb_y + 1 * w, w);
513
+ UpdateChroma(src1, src2, best_rgb_uv, NULL, uv_w);
514
+
515
+ // update two rows of Y and one row of RGB
516
+ for (i = 0; i < 2 * w; ++i) {
517
+ const int off = i + j * w;
518
+ const int diff_y = target_y[off] - best_rgb_y[i];
519
+ const int new_y = (int)best_y[off] + diff_y;
520
+ best_y[off] = clip_y(new_y);
521
+ }
522
+ for (i = 0; i < uv_w; ++i) {
523
+ const int off = 3 * (i + (j >> 1) * uv_w);
524
+ int W;
525
+ for (k = 0; k <= 2; ++k) {
526
+ const int diff_uv = (int)target_uv[off + k] - best_rgb_uv[3 * i + k];
527
+ best_uv[off + k] += diff_uv;
528
+ }
529
+ W = RGBToGray(best_uv[off + 0], best_uv[off + 1], best_uv[off + 2]);
530
+ for (k = 0; k <= 2; ++k) {
531
+ best_uv[off + k] -= W;
532
+ }
533
+ }
534
+ }
535
+ // TODO(skal): add early-termination criterion
536
+ }
537
+
538
+ // final reconstruction
539
+ ok = ConvertWRGBToYUV(best_y, best_uv, picture);
540
+
541
+ End:
542
+ WebPSafeFree(best_y);
543
+ WebPSafeFree(best_uv);
544
+ WebPSafeFree(target_y);
545
+ WebPSafeFree(target_uv);
546
+ WebPSafeFree(best_rgb_y);
547
+ WebPSafeFree(best_rgb_uv);
548
+ WebPSafeFree(tmp_buffer);
549
+ return ok;
550
+ }
551
+ #undef SAFE_ALLOC
552
+
553
+ //------------------------------------------------------------------------------
554
+ // "Fast" regular RGB->YUV
555
+
556
+ #define SUM4(ptr, step) LinearToGamma( \
557
+ GammaToLinear((ptr)[0]) + \
558
+ GammaToLinear((ptr)[(step)]) + \
559
+ GammaToLinear((ptr)[rgb_stride]) + \
560
+ GammaToLinear((ptr)[rgb_stride + (step)]), 0) \
561
+
562
+ #define SUM2(ptr) \
563
+ LinearToGamma(GammaToLinear((ptr)[0]) + GammaToLinear((ptr)[rgb_stride]), 1)
564
+
565
+ #define SUM2ALPHA(ptr) ((ptr)[0] + (ptr)[rgb_stride])
566
+ #define SUM4ALPHA(ptr) (SUM2ALPHA(ptr) + SUM2ALPHA((ptr) + 4))
567
+
568
+ #if defined(USE_INVERSE_ALPHA_TABLE)
569
+
570
+ static const int kAlphaFix = 19;
571
+ // Following table is (1 << kAlphaFix) / a. The (v * kInvAlpha[a]) >> kAlphaFix
572
+ // formula is then equal to v / a in most (99.6%) cases. Note that this table
573
+ // and constant are adjusted very tightly to fit 32b arithmetic.
574
+ // In particular, they use the fact that the operands for 'v / a' are actually
575
+ // derived as v = (a0.p0 + a1.p1 + a2.p2 + a3.p3) and a = a0 + a1 + a2 + a3
576
+ // with ai in [0..255] and pi in [0..1<<kGammaFix). The constraint to avoid
577
+ // overflow is: kGammaFix + kAlphaFix <= 31.
578
+ static const uint32_t kInvAlpha[4 * 0xff + 1] = {
579
+ 0, /* alpha = 0 */
580
+ 524288, 262144, 174762, 131072, 104857, 87381, 74898, 65536,
581
+ 58254, 52428, 47662, 43690, 40329, 37449, 34952, 32768,
582
+ 30840, 29127, 27594, 26214, 24966, 23831, 22795, 21845,
583
+ 20971, 20164, 19418, 18724, 18078, 17476, 16912, 16384,
584
+ 15887, 15420, 14979, 14563, 14169, 13797, 13443, 13107,
585
+ 12787, 12483, 12192, 11915, 11650, 11397, 11155, 10922,
586
+ 10699, 10485, 10280, 10082, 9892, 9709, 9532, 9362,
587
+ 9198, 9039, 8886, 8738, 8594, 8456, 8322, 8192,
588
+ 8065, 7943, 7825, 7710, 7598, 7489, 7384, 7281,
589
+ 7182, 7084, 6990, 6898, 6808, 6721, 6636, 6553,
590
+ 6472, 6393, 6316, 6241, 6168, 6096, 6026, 5957,
591
+ 5890, 5825, 5761, 5698, 5637, 5577, 5518, 5461,
592
+ 5405, 5349, 5295, 5242, 5190, 5140, 5090, 5041,
593
+ 4993, 4946, 4899, 4854, 4809, 4766, 4723, 4681,
594
+ 4639, 4599, 4559, 4519, 4481, 4443, 4405, 4369,
595
+ 4332, 4297, 4262, 4228, 4194, 4161, 4128, 4096,
596
+ 4064, 4032, 4002, 3971, 3942, 3912, 3883, 3855,
597
+ 3826, 3799, 3771, 3744, 3718, 3692, 3666, 3640,
598
+ 3615, 3591, 3566, 3542, 3518, 3495, 3472, 3449,
599
+ 3426, 3404, 3382, 3360, 3339, 3318, 3297, 3276,
600
+ 3256, 3236, 3216, 3196, 3177, 3158, 3139, 3120,
601
+ 3102, 3084, 3066, 3048, 3030, 3013, 2995, 2978,
602
+ 2962, 2945, 2928, 2912, 2896, 2880, 2864, 2849,
603
+ 2833, 2818, 2803, 2788, 2774, 2759, 2744, 2730,
604
+ 2716, 2702, 2688, 2674, 2661, 2647, 2634, 2621,
605
+ 2608, 2595, 2582, 2570, 2557, 2545, 2532, 2520,
606
+ 2508, 2496, 2484, 2473, 2461, 2449, 2438, 2427,
607
+ 2416, 2404, 2394, 2383, 2372, 2361, 2351, 2340,
608
+ 2330, 2319, 2309, 2299, 2289, 2279, 2269, 2259,
609
+ 2250, 2240, 2231, 2221, 2212, 2202, 2193, 2184,
610
+ 2175, 2166, 2157, 2148, 2139, 2131, 2122, 2114,
611
+ 2105, 2097, 2088, 2080, 2072, 2064, 2056, 2048,
612
+ 2040, 2032, 2024, 2016, 2008, 2001, 1993, 1985,
613
+ 1978, 1971, 1963, 1956, 1949, 1941, 1934, 1927,
614
+ 1920, 1913, 1906, 1899, 1892, 1885, 1879, 1872,
615
+ 1865, 1859, 1852, 1846, 1839, 1833, 1826, 1820,
616
+ 1814, 1807, 1801, 1795, 1789, 1783, 1777, 1771,
617
+ 1765, 1759, 1753, 1747, 1741, 1736, 1730, 1724,
618
+ 1718, 1713, 1707, 1702, 1696, 1691, 1685, 1680,
619
+ 1675, 1669, 1664, 1659, 1653, 1648, 1643, 1638,
620
+ 1633, 1628, 1623, 1618, 1613, 1608, 1603, 1598,
621
+ 1593, 1588, 1583, 1579, 1574, 1569, 1565, 1560,
622
+ 1555, 1551, 1546, 1542, 1537, 1533, 1528, 1524,
623
+ 1519, 1515, 1510, 1506, 1502, 1497, 1493, 1489,
624
+ 1485, 1481, 1476, 1472, 1468, 1464, 1460, 1456,
625
+ 1452, 1448, 1444, 1440, 1436, 1432, 1428, 1424,
626
+ 1420, 1416, 1413, 1409, 1405, 1401, 1398, 1394,
627
+ 1390, 1387, 1383, 1379, 1376, 1372, 1368, 1365,
628
+ 1361, 1358, 1354, 1351, 1347, 1344, 1340, 1337,
629
+ 1334, 1330, 1327, 1323, 1320, 1317, 1314, 1310,
630
+ 1307, 1304, 1300, 1297, 1294, 1291, 1288, 1285,
631
+ 1281, 1278, 1275, 1272, 1269, 1266, 1263, 1260,
632
+ 1257, 1254, 1251, 1248, 1245, 1242, 1239, 1236,
633
+ 1233, 1230, 1227, 1224, 1222, 1219, 1216, 1213,
634
+ 1210, 1208, 1205, 1202, 1199, 1197, 1194, 1191,
635
+ 1188, 1186, 1183, 1180, 1178, 1175, 1172, 1170,
636
+ 1167, 1165, 1162, 1159, 1157, 1154, 1152, 1149,
637
+ 1147, 1144, 1142, 1139, 1137, 1134, 1132, 1129,
638
+ 1127, 1125, 1122, 1120, 1117, 1115, 1113, 1110,
639
+ 1108, 1106, 1103, 1101, 1099, 1096, 1094, 1092,
640
+ 1089, 1087, 1085, 1083, 1081, 1078, 1076, 1074,
641
+ 1072, 1069, 1067, 1065, 1063, 1061, 1059, 1057,
642
+ 1054, 1052, 1050, 1048, 1046, 1044, 1042, 1040,
643
+ 1038, 1036, 1034, 1032, 1030, 1028, 1026, 1024,
644
+ 1022, 1020, 1018, 1016, 1014, 1012, 1010, 1008,
645
+ 1006, 1004, 1002, 1000, 998, 996, 994, 992,
646
+ 991, 989, 987, 985, 983, 981, 979, 978,
647
+ 976, 974, 972, 970, 969, 967, 965, 963,
648
+ 961, 960, 958, 956, 954, 953, 951, 949,
649
+ 948, 946, 944, 942, 941, 939, 937, 936,
650
+ 934, 932, 931, 929, 927, 926, 924, 923,
651
+ 921, 919, 918, 916, 914, 913, 911, 910,
652
+ 908, 907, 905, 903, 902, 900, 899, 897,
653
+ 896, 894, 893, 891, 890, 888, 887, 885,
654
+ 884, 882, 881, 879, 878, 876, 875, 873,
655
+ 872, 870, 869, 868, 866, 865, 863, 862,
656
+ 860, 859, 858, 856, 855, 853, 852, 851,
657
+ 849, 848, 846, 845, 844, 842, 841, 840,
658
+ 838, 837, 836, 834, 833, 832, 830, 829,
659
+ 828, 826, 825, 824, 823, 821, 820, 819,
660
+ 817, 816, 815, 814, 812, 811, 810, 809,
661
+ 807, 806, 805, 804, 802, 801, 800, 799,
662
+ 798, 796, 795, 794, 793, 791, 790, 789,
663
+ 788, 787, 786, 784, 783, 782, 781, 780,
664
+ 779, 777, 776, 775, 774, 773, 772, 771,
665
+ 769, 768, 767, 766, 765, 764, 763, 762,
666
+ 760, 759, 758, 757, 756, 755, 754, 753,
667
+ 752, 751, 750, 748, 747, 746, 745, 744,
668
+ 743, 742, 741, 740, 739, 738, 737, 736,
669
+ 735, 734, 733, 732, 731, 730, 729, 728,
670
+ 727, 726, 725, 724, 723, 722, 721, 720,
671
+ 719, 718, 717, 716, 715, 714, 713, 712,
672
+ 711, 710, 709, 708, 707, 706, 705, 704,
673
+ 703, 702, 701, 700, 699, 699, 698, 697,
674
+ 696, 695, 694, 693, 692, 691, 690, 689,
675
+ 688, 688, 687, 686, 685, 684, 683, 682,
676
+ 681, 680, 680, 679, 678, 677, 676, 675,
677
+ 674, 673, 673, 672, 671, 670, 669, 668,
678
+ 667, 667, 666, 665, 664, 663, 662, 661,
679
+ 661, 660, 659, 658, 657, 657, 656, 655,
680
+ 654, 653, 652, 652, 651, 650, 649, 648,
681
+ 648, 647, 646, 645, 644, 644, 643, 642,
682
+ 641, 640, 640, 639, 638, 637, 637, 636,
683
+ 635, 634, 633, 633, 632, 631, 630, 630,
684
+ 629, 628, 627, 627, 626, 625, 624, 624,
685
+ 623, 622, 621, 621, 620, 619, 618, 618,
686
+ 617, 616, 616, 615, 614, 613, 613, 612,
687
+ 611, 611, 610, 609, 608, 608, 607, 606,
688
+ 606, 605, 604, 604, 603, 602, 601, 601,
689
+ 600, 599, 599, 598, 597, 597, 596, 595,
690
+ 595, 594, 593, 593, 592, 591, 591, 590,
691
+ 589, 589, 588, 587, 587, 586, 585, 585,
692
+ 584, 583, 583, 582, 581, 581, 580, 579,
693
+ 579, 578, 578, 577, 576, 576, 575, 574,
694
+ 574, 573, 572, 572, 571, 571, 570, 569,
695
+ 569, 568, 568, 567, 566, 566, 565, 564,
696
+ 564, 563, 563, 562, 561, 561, 560, 560,
697
+ 559, 558, 558, 557, 557, 556, 555, 555,
698
+ 554, 554, 553, 553, 552, 551, 551, 550,
699
+ 550, 549, 548, 548, 547, 547, 546, 546,
700
+ 545, 544, 544, 543, 543, 542, 542, 541,
701
+ 541, 540, 539, 539, 538, 538, 537, 537,
702
+ 536, 536, 535, 534, 534, 533, 533, 532,
703
+ 532, 531, 531, 530, 530, 529, 529, 528,
704
+ 527, 527, 526, 526, 525, 525, 524, 524,
705
+ 523, 523, 522, 522, 521, 521, 520, 520,
706
+ 519, 519, 518, 518, 517, 517, 516, 516,
707
+ 515, 515, 514, 514
708
+ };
709
+
710
+ // Note that LinearToGamma() expects the values to be premultiplied by 4,
711
+ // so we incorporate this factor 4 inside the DIVIDE_BY_ALPHA macro directly.
712
+ #define DIVIDE_BY_ALPHA(sum, a) (((sum) * kInvAlpha[(a)]) >> (kAlphaFix - 2))
713
+
714
+ #else
715
+
716
+ #define DIVIDE_BY_ALPHA(sum, a) (4 * (sum) / (a))
717
+
718
+ #endif // USE_INVERSE_ALPHA_TABLE
719
+
720
+ static WEBP_INLINE int LinearToGammaWeighted(const uint8_t* src,
721
+ const uint8_t* a_ptr,
722
+ uint32_t total_a, int step,
723
+ int rgb_stride) {
724
+ const uint32_t sum =
725
+ a_ptr[0] * GammaToLinear(src[0]) +
726
+ a_ptr[step] * GammaToLinear(src[step]) +
727
+ a_ptr[rgb_stride] * GammaToLinear(src[rgb_stride]) +
728
+ a_ptr[rgb_stride + step] * GammaToLinear(src[rgb_stride + step]);
729
+ assert(total_a > 0 && total_a <= 4 * 0xff);
730
+ #if defined(USE_INVERSE_ALPHA_TABLE)
731
+ assert((uint64_t)sum * kInvAlpha[total_a] < ((uint64_t)1 << 32));
732
+ #endif
733
+ return LinearToGamma(DIVIDE_BY_ALPHA(sum, total_a), 0);
734
+ }
735
+
736
+ static WEBP_INLINE void ConvertRowToY(const uint8_t* const r_ptr,
737
+ const uint8_t* const g_ptr,
738
+ const uint8_t* const b_ptr,
739
+ int step,
740
+ uint8_t* const dst_y,
741
+ int width,
742
+ VP8Random* const rg) {
743
+ int i, j;
744
+ for (i = 0, j = 0; i < width; ++i, j += step) {
745
+ dst_y[i] = RGBToY(r_ptr[j], g_ptr[j], b_ptr[j], rg);
746
+ }
747
+ }
748
+
749
+ static WEBP_INLINE void ConvertRowsToUVWithAlpha(const uint8_t* const r_ptr,
750
+ const uint8_t* const g_ptr,
751
+ const uint8_t* const b_ptr,
752
+ const uint8_t* const a_ptr,
753
+ int rgb_stride,
754
+ uint8_t* const dst_u,
755
+ uint8_t* const dst_v,
756
+ int width,
757
+ VP8Random* const rg) {
758
+ int i, j;
759
+ // we loop over 2x2 blocks and produce one U/V value for each.
760
+ for (i = 0, j = 0; i < (width >> 1); ++i, j += 2 * sizeof(uint32_t)) {
761
+ const uint32_t a = SUM4ALPHA(a_ptr + j);
762
+ int r, g, b;
763
+ if (a == 4 * 0xff || a == 0) {
764
+ r = SUM4(r_ptr + j, 4);
765
+ g = SUM4(g_ptr + j, 4);
766
+ b = SUM4(b_ptr + j, 4);
767
+ } else {
768
+ r = LinearToGammaWeighted(r_ptr + j, a_ptr + j, a, 4, rgb_stride);
769
+ g = LinearToGammaWeighted(g_ptr + j, a_ptr + j, a, 4, rgb_stride);
770
+ b = LinearToGammaWeighted(b_ptr + j, a_ptr + j, a, 4, rgb_stride);
771
+ }
772
+ dst_u[i] = RGBToU(r, g, b, rg);
773
+ dst_v[i] = RGBToV(r, g, b, rg);
774
+ }
775
+ if (width & 1) {
776
+ const uint32_t a = 2u * SUM2ALPHA(a_ptr + j);
777
+ int r, g, b;
778
+ if (a == 4 * 0xff || a == 0) {
779
+ r = SUM2(r_ptr + j);
780
+ g = SUM2(g_ptr + j);
781
+ b = SUM2(b_ptr + j);
782
+ } else {
783
+ r = LinearToGammaWeighted(r_ptr + j, a_ptr + j, a, 0, rgb_stride);
784
+ g = LinearToGammaWeighted(g_ptr + j, a_ptr + j, a, 0, rgb_stride);
785
+ b = LinearToGammaWeighted(b_ptr + j, a_ptr + j, a, 0, rgb_stride);
786
+ }
787
+ dst_u[i] = RGBToU(r, g, b, rg);
788
+ dst_v[i] = RGBToV(r, g, b, rg);
789
+ }
790
+ }
791
+
792
+ static WEBP_INLINE void ConvertRowsToUV(const uint8_t* const r_ptr,
793
+ const uint8_t* const g_ptr,
794
+ const uint8_t* const b_ptr,
795
+ int step, int rgb_stride,
796
+ uint8_t* const dst_u,
797
+ uint8_t* const dst_v,
798
+ int width,
799
+ VP8Random* const rg) {
800
+ int i, j;
801
+ for (i = 0, j = 0; i < (width >> 1); ++i, j += 2 * step) {
802
+ const int r = SUM4(r_ptr + j, step);
803
+ const int g = SUM4(g_ptr + j, step);
804
+ const int b = SUM4(b_ptr + j, step);
805
+ dst_u[i] = RGBToU(r, g, b, rg);
806
+ dst_v[i] = RGBToV(r, g, b, rg);
807
+ }
808
+ if (width & 1) {
809
+ const int r = SUM2(r_ptr + j);
810
+ const int g = SUM2(g_ptr + j);
811
+ const int b = SUM2(b_ptr + j);
812
+ dst_u[i] = RGBToU(r, g, b, rg);
813
+ dst_v[i] = RGBToV(r, g, b, rg);
814
+ }
815
+ }
816
+
817
+ static int ImportYUVAFromRGBA(const uint8_t* const r_ptr,
818
+ const uint8_t* const g_ptr,
819
+ const uint8_t* const b_ptr,
820
+ const uint8_t* const a_ptr,
821
+ int step, // bytes per pixel
822
+ int rgb_stride, // bytes per scanline
823
+ float dithering,
824
+ int use_iterative_conversion,
825
+ WebPPicture* const picture) {
826
+ int y;
827
+ const int width = picture->width;
828
+ const int height = picture->height;
829
+ const int has_alpha = CheckNonOpaque(a_ptr, width, height, step, rgb_stride);
830
+
831
+ picture->colorspace = has_alpha ? WEBP_YUV420A : WEBP_YUV420;
832
+ picture->use_argb = 0;
833
+
834
+ // disable smart conversion if source is too small (overkill).
835
+ if (width < kMinDimensionIterativeConversion ||
836
+ height < kMinDimensionIterativeConversion) {
837
+ use_iterative_conversion = 0;
838
+ }
839
+
840
+ if (!WebPPictureAllocYUVA(picture, width, height)) {
841
+ return 0;
842
+ }
843
+ if (has_alpha) {
844
+ WebPInitAlphaProcessing();
845
+ assert(step == 4);
846
+ #if defined(USE_GAMMA_COMPRESSION) && defined(USE_INVERSE_ALPHA_TABLE)
847
+ assert(kAlphaFix + kGammaFix <= 31);
848
+ #endif
849
+ }
850
+
851
+ if (use_iterative_conversion) {
852
+ InitGammaTablesF();
853
+ if (!PreprocessARGB(r_ptr, g_ptr, b_ptr, step, rgb_stride, picture)) {
854
+ return 0;
855
+ }
856
+ if (has_alpha) {
857
+ WebPExtractAlpha(a_ptr, rgb_stride, width, height,
858
+ picture->a, picture->a_stride);
859
+ }
860
+ } else {
861
+ uint8_t* dst_y = picture->y;
862
+ uint8_t* dst_u = picture->u;
863
+ uint8_t* dst_v = picture->v;
864
+ uint8_t* dst_a = picture->a;
865
+
866
+ VP8Random base_rg;
867
+ VP8Random* rg = NULL;
868
+ if (dithering > 0.) {
869
+ VP8InitRandom(&base_rg, dithering);
870
+ rg = &base_rg;
871
+ }
872
+
873
+ InitGammaTables();
874
+
875
+ // Downsample Y/U/V planes, two rows at a time
876
+ for (y = 0; y < (height >> 1); ++y) {
877
+ int rows_have_alpha = has_alpha;
878
+ const int off1 = (2 * y + 0) * rgb_stride;
879
+ const int off2 = (2 * y + 1) * rgb_stride;
880
+ ConvertRowToY(r_ptr + off1, g_ptr + off1, b_ptr + off1, step,
881
+ dst_y, width, rg);
882
+ ConvertRowToY(r_ptr + off2, g_ptr + off2, b_ptr + off2, step,
883
+ dst_y + picture->y_stride, width, rg);
884
+ dst_y += 2 * picture->y_stride;
885
+ if (has_alpha) {
886
+ rows_have_alpha &= !WebPExtractAlpha(a_ptr + off1, rgb_stride,
887
+ width, 2,
888
+ dst_a, picture->a_stride);
889
+ dst_a += 2 * picture->a_stride;
890
+ }
891
+ if (!rows_have_alpha) {
892
+ ConvertRowsToUV(r_ptr + off1, g_ptr + off1, b_ptr + off1,
893
+ step, rgb_stride, dst_u, dst_v, width, rg);
894
+ } else {
895
+ ConvertRowsToUVWithAlpha(r_ptr + off1, g_ptr + off1, b_ptr + off1,
896
+ a_ptr + off1, rgb_stride,
897
+ dst_u, dst_v, width, rg);
898
+ }
899
+ dst_u += picture->uv_stride;
900
+ dst_v += picture->uv_stride;
901
+ }
902
+ if (height & 1) { // extra last row
903
+ const int off = 2 * y * rgb_stride;
904
+ int row_has_alpha = has_alpha;
905
+ ConvertRowToY(r_ptr + off, g_ptr + off, b_ptr + off, step,
906
+ dst_y, width, rg);
907
+ if (row_has_alpha) {
908
+ row_has_alpha &= !WebPExtractAlpha(a_ptr + off, 0, width, 1, dst_a, 0);
909
+ }
910
+ if (!row_has_alpha) {
911
+ ConvertRowsToUV(r_ptr + off, g_ptr + off, b_ptr + off,
912
+ step, 0, dst_u, dst_v, width, rg);
913
+ } else {
914
+ ConvertRowsToUVWithAlpha(r_ptr + off, g_ptr + off, b_ptr + off,
915
+ a_ptr + off, 0,
916
+ dst_u, dst_v, width, rg);
917
+ }
918
+ }
919
+ }
920
+ return 1;
921
+ }
922
+
923
+ #undef SUM4
924
+ #undef SUM2
925
+ #undef SUM4ALPHA
926
+ #undef SUM2ALPHA
927
+
928
+ //------------------------------------------------------------------------------
929
+ // call for ARGB->YUVA conversion
930
+
931
+ static int PictureARGBToYUVA(WebPPicture* picture, WebPEncCSP colorspace,
932
+ float dithering, int use_iterative_conversion) {
933
+ if (picture == NULL) return 0;
934
+ if (picture->argb == NULL) {
935
+ return WebPEncodingSetError(picture, VP8_ENC_ERROR_NULL_PARAMETER);
936
+ } else if ((colorspace & WEBP_CSP_UV_MASK) != WEBP_YUV420) {
937
+ return WebPEncodingSetError(picture, VP8_ENC_ERROR_INVALID_CONFIGURATION);
938
+ } else {
939
+ const uint8_t* const argb = (const uint8_t*)picture->argb;
940
+ const uint8_t* const r = ALPHA_IS_LAST ? argb + 2 : argb + 1;
941
+ const uint8_t* const g = ALPHA_IS_LAST ? argb + 1 : argb + 2;
942
+ const uint8_t* const b = ALPHA_IS_LAST ? argb + 0 : argb + 3;
943
+ const uint8_t* const a = ALPHA_IS_LAST ? argb + 3 : argb + 0;
944
+
945
+ picture->colorspace = WEBP_YUV420;
946
+ return ImportYUVAFromRGBA(r, g, b, a, 4, 4 * picture->argb_stride,
947
+ dithering, use_iterative_conversion, picture);
948
+ }
949
+ }
950
+
951
+ int WebPPictureARGBToYUVADithered(WebPPicture* picture, WebPEncCSP colorspace,
952
+ float dithering) {
953
+ return PictureARGBToYUVA(picture, colorspace, dithering, 0);
954
+ }
955
+
956
+ int WebPPictureARGBToYUVA(WebPPicture* picture, WebPEncCSP colorspace) {
957
+ return PictureARGBToYUVA(picture, colorspace, 0.f, 0);
958
+ }
959
+
960
+ int WebPPictureSmartARGBToYUVA(WebPPicture* picture) {
961
+ return PictureARGBToYUVA(picture, WEBP_YUV420, 0.f, 1);
962
+ }
963
+
964
+ //------------------------------------------------------------------------------
965
+ // call for YUVA -> ARGB conversion
966
+
967
+ int WebPPictureYUVAToARGB(WebPPicture* picture) {
968
+ if (picture == NULL) return 0;
969
+ if (picture->y == NULL || picture->u == NULL || picture->v == NULL) {
970
+ return WebPEncodingSetError(picture, VP8_ENC_ERROR_NULL_PARAMETER);
971
+ }
972
+ if ((picture->colorspace & WEBP_CSP_ALPHA_BIT) && picture->a == NULL) {
973
+ return WebPEncodingSetError(picture, VP8_ENC_ERROR_NULL_PARAMETER);
974
+ }
975
+ if ((picture->colorspace & WEBP_CSP_UV_MASK) != WEBP_YUV420) {
976
+ return WebPEncodingSetError(picture, VP8_ENC_ERROR_INVALID_CONFIGURATION);
977
+ }
978
+ // Allocate a new argb buffer (discarding the previous one).
979
+ if (!WebPPictureAllocARGB(picture, picture->width, picture->height)) return 0;
980
+ picture->use_argb = 1;
981
+
982
+ // Convert
983
+ {
984
+ int y;
985
+ const int width = picture->width;
986
+ const int height = picture->height;
987
+ const int argb_stride = 4 * picture->argb_stride;
988
+ uint8_t* dst = (uint8_t*)picture->argb;
989
+ const uint8_t *cur_u = picture->u, *cur_v = picture->v, *cur_y = picture->y;
990
+ WebPUpsampleLinePairFunc upsample = WebPGetLinePairConverter(ALPHA_IS_LAST);
991
+
992
+ // First row, with replicated top samples.
993
+ upsample(cur_y, NULL, cur_u, cur_v, cur_u, cur_v, dst, NULL, width);
994
+ cur_y += picture->y_stride;
995
+ dst += argb_stride;
996
+ // Center rows.
997
+ for (y = 1; y + 1 < height; y += 2) {
998
+ const uint8_t* const top_u = cur_u;
999
+ const uint8_t* const top_v = cur_v;
1000
+ cur_u += picture->uv_stride;
1001
+ cur_v += picture->uv_stride;
1002
+ upsample(cur_y, cur_y + picture->y_stride, top_u, top_v, cur_u, cur_v,
1003
+ dst, dst + argb_stride, width);
1004
+ cur_y += 2 * picture->y_stride;
1005
+ dst += 2 * argb_stride;
1006
+ }
1007
+ // Last row (if needed), with replicated bottom samples.
1008
+ if (height > 1 && !(height & 1)) {
1009
+ upsample(cur_y, NULL, cur_u, cur_v, cur_u, cur_v, dst, NULL, width);
1010
+ }
1011
+ // Insert alpha values if needed, in replacement for the default 0xff ones.
1012
+ if (picture->colorspace & WEBP_CSP_ALPHA_BIT) {
1013
+ for (y = 0; y < height; ++y) {
1014
+ uint32_t* const argb_dst = picture->argb + y * picture->argb_stride;
1015
+ const uint8_t* const src = picture->a + y * picture->a_stride;
1016
+ int x;
1017
+ for (x = 0; x < width; ++x) {
1018
+ argb_dst[x] = (argb_dst[x] & 0x00ffffffu) | ((uint32_t)src[x] << 24);
1019
+ }
1020
+ }
1021
+ }
1022
+ }
1023
+ return 1;
1024
+ }
1025
+
1026
+ //------------------------------------------------------------------------------
1027
+ // automatic import / conversion
1028
+
1029
+ static int Import(WebPPicture* const picture,
1030
+ const uint8_t* const rgb, int rgb_stride,
1031
+ int step, int swap_rb, int import_alpha) {
1032
+ int y;
1033
+ const uint8_t* const r_ptr = rgb + (swap_rb ? 2 : 0);
1034
+ const uint8_t* const g_ptr = rgb + 1;
1035
+ const uint8_t* const b_ptr = rgb + (swap_rb ? 0 : 2);
1036
+ const uint8_t* const a_ptr = import_alpha ? rgb + 3 : NULL;
1037
+ const int width = picture->width;
1038
+ const int height = picture->height;
1039
+
1040
+ if (!picture->use_argb) {
1041
+ return ImportYUVAFromRGBA(r_ptr, g_ptr, b_ptr, a_ptr, step, rgb_stride,
1042
+ 0.f /* no dithering */, 0, picture);
1043
+ }
1044
+ if (!WebPPictureAlloc(picture)) return 0;
1045
+
1046
+ VP8EncDspARGBInit();
1047
+
1048
+ if (import_alpha) {
1049
+ assert(step == 4);
1050
+ for (y = 0; y < height; ++y) {
1051
+ uint32_t* const dst = &picture->argb[y * picture->argb_stride];
1052
+ const int offset = y * rgb_stride;
1053
+ VP8PackARGB(a_ptr + offset, r_ptr + offset, g_ptr + offset,
1054
+ b_ptr + offset, width, dst);
1055
+ }
1056
+ } else {
1057
+ assert(step >= 3);
1058
+ for (y = 0; y < height; ++y) {
1059
+ uint32_t* const dst = &picture->argb[y * picture->argb_stride];
1060
+ const int offset = y * rgb_stride;
1061
+ VP8PackRGB(r_ptr + offset, g_ptr + offset, b_ptr + offset,
1062
+ width, step, dst);
1063
+ }
1064
+ }
1065
+ return 1;
1066
+ }
1067
+
1068
+ // Public API
1069
+
1070
+ int WebPPictureImportRGB(WebPPicture* picture,
1071
+ const uint8_t* rgb, int rgb_stride) {
1072
+ return (picture != NULL) ? Import(picture, rgb, rgb_stride, 3, 0, 0) : 0;
1073
+ }
1074
+
1075
+ int WebPPictureImportBGR(WebPPicture* picture,
1076
+ const uint8_t* rgb, int rgb_stride) {
1077
+ return (picture != NULL) ? Import(picture, rgb, rgb_stride, 3, 1, 0) : 0;
1078
+ }
1079
+
1080
+ int WebPPictureImportRGBA(WebPPicture* picture,
1081
+ const uint8_t* rgba, int rgba_stride) {
1082
+ return (picture != NULL) ? Import(picture, rgba, rgba_stride, 4, 0, 1) : 0;
1083
+ }
1084
+
1085
+ int WebPPictureImportBGRA(WebPPicture* picture,
1086
+ const uint8_t* rgba, int rgba_stride) {
1087
+ return (picture != NULL) ? Import(picture, rgba, rgba_stride, 4, 1, 1) : 0;
1088
+ }
1089
+
1090
+ int WebPPictureImportRGBX(WebPPicture* picture,
1091
+ const uint8_t* rgba, int rgba_stride) {
1092
+ return (picture != NULL) ? Import(picture, rgba, rgba_stride, 4, 0, 0) : 0;
1093
+ }
1094
+
1095
+ int WebPPictureImportBGRX(WebPPicture* picture,
1096
+ const uint8_t* rgba, int rgba_stride) {
1097
+ return (picture != NULL) ? Import(picture, rgba, rgba_stride, 4, 1, 0) : 0;
1098
+ }
1099
+
1100
+ //------------------------------------------------------------------------------