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,1191 @@
1
+ // Copyright 2011 Google Inc. All Rights Reserved.
2
+ //
3
+ // Use of this source code is governed by a BSD-style license
4
+ // that can be found in the COPYING file in the root of the source
5
+ // tree. An additional intellectual property rights grant can be found
6
+ // in the file PATENTS. All contributing project authors may
7
+ // be found in the AUTHORS file in the root of the source tree.
8
+ // -----------------------------------------------------------------------------
9
+ //
10
+ // Quantization
11
+ //
12
+ // Author: Skal (pascal.massimino@gmail.com)
13
+
14
+ #include <assert.h>
15
+ #include <math.h>
16
+ #include <stdlib.h> // for abs()
17
+
18
+ #include "./vp8enci.h"
19
+ #include "./cost.h"
20
+
21
+ #define DO_TRELLIS_I4 1
22
+ #define DO_TRELLIS_I16 1 // not a huge gain, but ok at low bitrate.
23
+ #define DO_TRELLIS_UV 0 // disable trellis for UV. Risky. Not worth.
24
+ #define USE_TDISTO 1
25
+
26
+ #define MID_ALPHA 64 // neutral value for susceptibility
27
+ #define MIN_ALPHA 30 // lowest usable value for susceptibility
28
+ #define MAX_ALPHA 100 // higher meaningful value for susceptibility
29
+
30
+ #define SNS_TO_DQ 0.9 // Scaling constant between the sns value and the QP
31
+ // power-law modulation. Must be strictly less than 1.
32
+
33
+ #define I4_PENALTY 4000 // Rate-penalty for quick i4/i16 decision
34
+
35
+ // number of non-zero coeffs below which we consider the block very flat
36
+ // (and apply a penalty to complex predictions)
37
+ #define FLATNESS_LIMIT_I16 10 // I16 mode
38
+ #define FLATNESS_LIMIT_I4 3 // I4 mode
39
+ #define FLATNESS_LIMIT_UV 2 // UV mode
40
+ #define FLATNESS_PENALTY 140 // roughly ~1bit per block
41
+
42
+ #define MULT_8B(a, b) (((a) * (b) + 128) >> 8)
43
+
44
+ // #define DEBUG_BLOCK
45
+
46
+ //------------------------------------------------------------------------------
47
+
48
+ #if defined(DEBUG_BLOCK)
49
+
50
+ #include <stdio.h>
51
+ #include <stdlib.h>
52
+
53
+ static void PrintBlockInfo(const VP8EncIterator* const it,
54
+ const VP8ModeScore* const rd) {
55
+ int i, j;
56
+ const int is_i16 = (it->mb_->type_ == 1);
57
+ printf("SOURCE / OUTPUT / ABS DELTA\n");
58
+ for (j = 0; j < 24; ++j) {
59
+ if (j == 16) printf("\n"); // newline before the U/V block
60
+ for (i = 0; i < 16; ++i) printf("%3d ", it->yuv_in_[i + j * BPS]);
61
+ printf(" ");
62
+ for (i = 0; i < 16; ++i) printf("%3d ", it->yuv_out_[i + j * BPS]);
63
+ printf(" ");
64
+ for (i = 0; i < 16; ++i) {
65
+ printf("%1d ", abs(it->yuv_out_[i + j * BPS] - it->yuv_in_[i + j * BPS]));
66
+ }
67
+ printf("\n");
68
+ }
69
+ printf("\nD:%d SD:%d R:%d H:%d nz:0x%x score:%d\n",
70
+ (int)rd->D, (int)rd->SD, (int)rd->R, (int)rd->H, (int)rd->nz,
71
+ (int)rd->score);
72
+ if (is_i16) {
73
+ printf("Mode: %d\n", rd->mode_i16);
74
+ printf("y_dc_levels:");
75
+ for (i = 0; i < 16; ++i) printf("%3d ", rd->y_dc_levels[i]);
76
+ printf("\n");
77
+ } else {
78
+ printf("Modes[16]: ");
79
+ for (i = 0; i < 16; ++i) printf("%d ", rd->modes_i4[i]);
80
+ printf("\n");
81
+ }
82
+ printf("y_ac_levels:\n");
83
+ for (j = 0; j < 16; ++j) {
84
+ for (i = is_i16 ? 1 : 0; i < 16; ++i) {
85
+ printf("%4d ", rd->y_ac_levels[j][i]);
86
+ }
87
+ printf("\n");
88
+ }
89
+ printf("\n");
90
+ printf("uv_levels (mode=%d):\n", rd->mode_uv);
91
+ for (j = 0; j < 8; ++j) {
92
+ for (i = 0; i < 16; ++i) {
93
+ printf("%4d ", rd->uv_levels[j][i]);
94
+ }
95
+ printf("\n");
96
+ }
97
+ }
98
+
99
+ #endif // DEBUG_BLOCK
100
+
101
+ //------------------------------------------------------------------------------
102
+
103
+ static WEBP_INLINE int clip(int v, int m, int M) {
104
+ return v < m ? m : v > M ? M : v;
105
+ }
106
+
107
+ static const uint8_t kZigzag[16] = {
108
+ 0, 1, 4, 8, 5, 2, 3, 6, 9, 12, 13, 10, 7, 11, 14, 15
109
+ };
110
+
111
+ static const uint8_t kDcTable[128] = {
112
+ 4, 5, 6, 7, 8, 9, 10, 10,
113
+ 11, 12, 13, 14, 15, 16, 17, 17,
114
+ 18, 19, 20, 20, 21, 21, 22, 22,
115
+ 23, 23, 24, 25, 25, 26, 27, 28,
116
+ 29, 30, 31, 32, 33, 34, 35, 36,
117
+ 37, 37, 38, 39, 40, 41, 42, 43,
118
+ 44, 45, 46, 46, 47, 48, 49, 50,
119
+ 51, 52, 53, 54, 55, 56, 57, 58,
120
+ 59, 60, 61, 62, 63, 64, 65, 66,
121
+ 67, 68, 69, 70, 71, 72, 73, 74,
122
+ 75, 76, 76, 77, 78, 79, 80, 81,
123
+ 82, 83, 84, 85, 86, 87, 88, 89,
124
+ 91, 93, 95, 96, 98, 100, 101, 102,
125
+ 104, 106, 108, 110, 112, 114, 116, 118,
126
+ 122, 124, 126, 128, 130, 132, 134, 136,
127
+ 138, 140, 143, 145, 148, 151, 154, 157
128
+ };
129
+
130
+ static const uint16_t kAcTable[128] = {
131
+ 4, 5, 6, 7, 8, 9, 10, 11,
132
+ 12, 13, 14, 15, 16, 17, 18, 19,
133
+ 20, 21, 22, 23, 24, 25, 26, 27,
134
+ 28, 29, 30, 31, 32, 33, 34, 35,
135
+ 36, 37, 38, 39, 40, 41, 42, 43,
136
+ 44, 45, 46, 47, 48, 49, 50, 51,
137
+ 52, 53, 54, 55, 56, 57, 58, 60,
138
+ 62, 64, 66, 68, 70, 72, 74, 76,
139
+ 78, 80, 82, 84, 86, 88, 90, 92,
140
+ 94, 96, 98, 100, 102, 104, 106, 108,
141
+ 110, 112, 114, 116, 119, 122, 125, 128,
142
+ 131, 134, 137, 140, 143, 146, 149, 152,
143
+ 155, 158, 161, 164, 167, 170, 173, 177,
144
+ 181, 185, 189, 193, 197, 201, 205, 209,
145
+ 213, 217, 221, 225, 229, 234, 239, 245,
146
+ 249, 254, 259, 264, 269, 274, 279, 284
147
+ };
148
+
149
+ static const uint16_t kAcTable2[128] = {
150
+ 8, 8, 9, 10, 12, 13, 15, 17,
151
+ 18, 20, 21, 23, 24, 26, 27, 29,
152
+ 31, 32, 34, 35, 37, 38, 40, 41,
153
+ 43, 44, 46, 48, 49, 51, 52, 54,
154
+ 55, 57, 58, 60, 62, 63, 65, 66,
155
+ 68, 69, 71, 72, 74, 75, 77, 79,
156
+ 80, 82, 83, 85, 86, 88, 89, 93,
157
+ 96, 99, 102, 105, 108, 111, 114, 117,
158
+ 120, 124, 127, 130, 133, 136, 139, 142,
159
+ 145, 148, 151, 155, 158, 161, 164, 167,
160
+ 170, 173, 176, 179, 184, 189, 193, 198,
161
+ 203, 207, 212, 217, 221, 226, 230, 235,
162
+ 240, 244, 249, 254, 258, 263, 268, 274,
163
+ 280, 286, 292, 299, 305, 311, 317, 323,
164
+ 330, 336, 342, 348, 354, 362, 370, 379,
165
+ 385, 393, 401, 409, 416, 424, 432, 440
166
+ };
167
+
168
+ static const uint8_t kBiasMatrices[3][2] = { // [luma-ac,luma-dc,chroma][dc,ac]
169
+ { 96, 110 }, { 96, 108 }, { 110, 115 }
170
+ };
171
+
172
+ // Sharpening by (slightly) raising the hi-frequency coeffs.
173
+ // Hack-ish but helpful for mid-bitrate range. Use with care.
174
+ #define SHARPEN_BITS 11 // number of descaling bits for sharpening bias
175
+ static const uint8_t kFreqSharpening[16] = {
176
+ 0, 30, 60, 90,
177
+ 30, 60, 90, 90,
178
+ 60, 90, 90, 90,
179
+ 90, 90, 90, 90
180
+ };
181
+
182
+ //------------------------------------------------------------------------------
183
+ // Initialize quantization parameters in VP8Matrix
184
+
185
+ // Returns the average quantizer
186
+ static int ExpandMatrix(VP8Matrix* const m, int type) {
187
+ int i, sum;
188
+ for (i = 0; i < 2; ++i) {
189
+ const int is_ac_coeff = (i > 0);
190
+ const int bias = kBiasMatrices[type][is_ac_coeff];
191
+ m->iq_[i] = (1 << QFIX) / m->q_[i];
192
+ m->bias_[i] = BIAS(bias);
193
+ // zthresh_ is the exact value such that QUANTDIV(coeff, iQ, B) is:
194
+ // * zero if coeff <= zthresh
195
+ // * non-zero if coeff > zthresh
196
+ m->zthresh_[i] = ((1 << QFIX) - 1 - m->bias_[i]) / m->iq_[i];
197
+ }
198
+ for (i = 2; i < 16; ++i) {
199
+ m->q_[i] = m->q_[1];
200
+ m->iq_[i] = m->iq_[1];
201
+ m->bias_[i] = m->bias_[1];
202
+ m->zthresh_[i] = m->zthresh_[1];
203
+ }
204
+ for (sum = 0, i = 0; i < 16; ++i) {
205
+ if (type == 0) { // we only use sharpening for AC luma coeffs
206
+ m->sharpen_[i] = (kFreqSharpening[i] * m->q_[i]) >> SHARPEN_BITS;
207
+ } else {
208
+ m->sharpen_[i] = 0;
209
+ }
210
+ sum += m->q_[i];
211
+ }
212
+ return (sum + 8) >> 4;
213
+ }
214
+
215
+ static void SetupMatrices(VP8Encoder* enc) {
216
+ int i;
217
+ const int tlambda_scale =
218
+ (enc->method_ >= 4) ? enc->config_->sns_strength
219
+ : 0;
220
+ const int num_segments = enc->segment_hdr_.num_segments_;
221
+ for (i = 0; i < num_segments; ++i) {
222
+ VP8SegmentInfo* const m = &enc->dqm_[i];
223
+ const int q = m->quant_;
224
+ int q4, q16, quv;
225
+ m->y1_.q_[0] = kDcTable[clip(q + enc->dq_y1_dc_, 0, 127)];
226
+ m->y1_.q_[1] = kAcTable[clip(q, 0, 127)];
227
+
228
+ m->y2_.q_[0] = kDcTable[ clip(q + enc->dq_y2_dc_, 0, 127)] * 2;
229
+ m->y2_.q_[1] = kAcTable2[clip(q + enc->dq_y2_ac_, 0, 127)];
230
+
231
+ m->uv_.q_[0] = kDcTable[clip(q + enc->dq_uv_dc_, 0, 117)];
232
+ m->uv_.q_[1] = kAcTable[clip(q + enc->dq_uv_ac_, 0, 127)];
233
+
234
+ q4 = ExpandMatrix(&m->y1_, 0);
235
+ q16 = ExpandMatrix(&m->y2_, 1);
236
+ quv = ExpandMatrix(&m->uv_, 2);
237
+
238
+ m->lambda_i4_ = (3 * q4 * q4) >> 7;
239
+ m->lambda_i16_ = (3 * q16 * q16);
240
+ m->lambda_uv_ = (3 * quv * quv) >> 6;
241
+ m->lambda_mode_ = (1 * q4 * q4) >> 7;
242
+ m->lambda_trellis_i4_ = (7 * q4 * q4) >> 3;
243
+ m->lambda_trellis_i16_ = (q16 * q16) >> 2;
244
+ m->lambda_trellis_uv_ = (quv *quv) << 1;
245
+ m->tlambda_ = (tlambda_scale * q4) >> 5;
246
+
247
+ m->min_disto_ = 10 * m->y1_.q_[0]; // quantization-aware min disto
248
+ m->max_edge_ = 0;
249
+ }
250
+ }
251
+
252
+ //------------------------------------------------------------------------------
253
+ // Initialize filtering parameters
254
+
255
+ // Very small filter-strength values have close to no visual effect. So we can
256
+ // save a little decoding-CPU by turning filtering off for these.
257
+ #define FSTRENGTH_CUTOFF 2
258
+
259
+ static void SetupFilterStrength(VP8Encoder* const enc) {
260
+ int i;
261
+ // level0 is in [0..500]. Using '-f 50' as filter_strength is mid-filtering.
262
+ const int level0 = 5 * enc->config_->filter_strength;
263
+ for (i = 0; i < NUM_MB_SEGMENTS; ++i) {
264
+ VP8SegmentInfo* const m = &enc->dqm_[i];
265
+ // We focus on the quantization of AC coeffs.
266
+ const int qstep = kAcTable[clip(m->quant_, 0, 127)] >> 2;
267
+ const int base_strength =
268
+ VP8FilterStrengthFromDelta(enc->filter_hdr_.sharpness_, qstep);
269
+ // Segments with lower complexity ('beta') will be less filtered.
270
+ const int f = base_strength * level0 / (256 + m->beta_);
271
+ m->fstrength_ = (f < FSTRENGTH_CUTOFF) ? 0 : (f > 63) ? 63 : f;
272
+ }
273
+ // We record the initial strength (mainly for the case of 1-segment only).
274
+ enc->filter_hdr_.level_ = enc->dqm_[0].fstrength_;
275
+ enc->filter_hdr_.simple_ = (enc->config_->filter_type == 0);
276
+ enc->filter_hdr_.sharpness_ = enc->config_->filter_sharpness;
277
+ }
278
+
279
+ //------------------------------------------------------------------------------
280
+
281
+ // Note: if you change the values below, remember that the max range
282
+ // allowed by the syntax for DQ_UV is [-16,16].
283
+ #define MAX_DQ_UV (6)
284
+ #define MIN_DQ_UV (-4)
285
+
286
+ // We want to emulate jpeg-like behaviour where the expected "good" quality
287
+ // is around q=75. Internally, our "good" middle is around c=50. So we
288
+ // map accordingly using linear piece-wise function
289
+ static double QualityToCompression(double c) {
290
+ const double linear_c = (c < 0.75) ? c * (2. / 3.) : 2. * c - 1.;
291
+ // The file size roughly scales as pow(quantizer, 3.). Actually, the
292
+ // exponent is somewhere between 2.8 and 3.2, but we're mostly interested
293
+ // in the mid-quant range. So we scale the compressibility inversely to
294
+ // this power-law: quant ~= compression ^ 1/3. This law holds well for
295
+ // low quant. Finer modeling for high-quant would make use of kAcTable[]
296
+ // more explicitly.
297
+ const double v = pow(linear_c, 1 / 3.);
298
+ return v;
299
+ }
300
+
301
+ static double QualityToJPEGCompression(double c, double alpha) {
302
+ // We map the complexity 'alpha' and quality setting 'c' to a compression
303
+ // exponent empirically matched to the compression curve of libjpeg6b.
304
+ // On average, the WebP output size will be roughly similar to that of a
305
+ // JPEG file compressed with same quality factor.
306
+ const double amin = 0.30;
307
+ const double amax = 0.85;
308
+ const double exp_min = 0.4;
309
+ const double exp_max = 0.9;
310
+ const double slope = (exp_min - exp_max) / (amax - amin);
311
+ // Linearly interpolate 'expn' from exp_min to exp_max
312
+ // in the [amin, amax] range.
313
+ const double expn = (alpha > amax) ? exp_min
314
+ : (alpha < amin) ? exp_max
315
+ : exp_max + slope * (alpha - amin);
316
+ const double v = pow(c, expn);
317
+ return v;
318
+ }
319
+
320
+ static int SegmentsAreEquivalent(const VP8SegmentInfo* const S1,
321
+ const VP8SegmentInfo* const S2) {
322
+ return (S1->quant_ == S2->quant_) && (S1->fstrength_ == S2->fstrength_);
323
+ }
324
+
325
+ static void SimplifySegments(VP8Encoder* const enc) {
326
+ int map[NUM_MB_SEGMENTS] = { 0, 1, 2, 3 };
327
+ const int num_segments = enc->segment_hdr_.num_segments_;
328
+ int num_final_segments = 1;
329
+ int s1, s2;
330
+ for (s1 = 1; s1 < num_segments; ++s1) { // find similar segments
331
+ const VP8SegmentInfo* const S1 = &enc->dqm_[s1];
332
+ int found = 0;
333
+ // check if we already have similar segment
334
+ for (s2 = 0; s2 < num_final_segments; ++s2) {
335
+ const VP8SegmentInfo* const S2 = &enc->dqm_[s2];
336
+ if (SegmentsAreEquivalent(S1, S2)) {
337
+ found = 1;
338
+ break;
339
+ }
340
+ }
341
+ map[s1] = s2;
342
+ if (!found) {
343
+ if (num_final_segments != s1) {
344
+ enc->dqm_[num_final_segments] = enc->dqm_[s1];
345
+ }
346
+ ++num_final_segments;
347
+ }
348
+ }
349
+ if (num_final_segments < num_segments) { // Remap
350
+ int i = enc->mb_w_ * enc->mb_h_;
351
+ while (i-- > 0) enc->mb_info_[i].segment_ = map[enc->mb_info_[i].segment_];
352
+ enc->segment_hdr_.num_segments_ = num_final_segments;
353
+ // Replicate the trailing segment infos (it's mostly cosmetics)
354
+ for (i = num_final_segments; i < num_segments; ++i) {
355
+ enc->dqm_[i] = enc->dqm_[num_final_segments - 1];
356
+ }
357
+ }
358
+ }
359
+
360
+ void VP8SetSegmentParams(VP8Encoder* const enc, float quality) {
361
+ int i;
362
+ int dq_uv_ac, dq_uv_dc;
363
+ const int num_segments = enc->segment_hdr_.num_segments_;
364
+ const double amp = SNS_TO_DQ * enc->config_->sns_strength / 100. / 128.;
365
+ const double Q = quality / 100.;
366
+ const double c_base = enc->config_->emulate_jpeg_size ?
367
+ QualityToJPEGCompression(Q, enc->alpha_ / 255.) :
368
+ QualityToCompression(Q);
369
+ for (i = 0; i < num_segments; ++i) {
370
+ // We modulate the base coefficient to accommodate for the quantization
371
+ // susceptibility and allow denser segments to be quantized more.
372
+ const double expn = 1. - amp * enc->dqm_[i].alpha_;
373
+ const double c = pow(c_base, expn);
374
+ const int q = (int)(127. * (1. - c));
375
+ assert(expn > 0.);
376
+ enc->dqm_[i].quant_ = clip(q, 0, 127);
377
+ }
378
+
379
+ // purely indicative in the bitstream (except for the 1-segment case)
380
+ enc->base_quant_ = enc->dqm_[0].quant_;
381
+
382
+ // fill-in values for the unused segments (required by the syntax)
383
+ for (i = num_segments; i < NUM_MB_SEGMENTS; ++i) {
384
+ enc->dqm_[i].quant_ = enc->base_quant_;
385
+ }
386
+
387
+ // uv_alpha_ is normally spread around ~60. The useful range is
388
+ // typically ~30 (quite bad) to ~100 (ok to decimate UV more).
389
+ // We map it to the safe maximal range of MAX/MIN_DQ_UV for dq_uv.
390
+ dq_uv_ac = (enc->uv_alpha_ - MID_ALPHA) * (MAX_DQ_UV - MIN_DQ_UV)
391
+ / (MAX_ALPHA - MIN_ALPHA);
392
+ // we rescale by the user-defined strength of adaptation
393
+ dq_uv_ac = dq_uv_ac * enc->config_->sns_strength / 100;
394
+ // and make it safe.
395
+ dq_uv_ac = clip(dq_uv_ac, MIN_DQ_UV, MAX_DQ_UV);
396
+ // We also boost the dc-uv-quant a little, based on sns-strength, since
397
+ // U/V channels are quite more reactive to high quants (flat DC-blocks
398
+ // tend to appear, and are unpleasant).
399
+ dq_uv_dc = -4 * enc->config_->sns_strength / 100;
400
+ dq_uv_dc = clip(dq_uv_dc, -15, 15); // 4bit-signed max allowed
401
+
402
+ enc->dq_y1_dc_ = 0; // TODO(skal): dq-lum
403
+ enc->dq_y2_dc_ = 0;
404
+ enc->dq_y2_ac_ = 0;
405
+ enc->dq_uv_dc_ = dq_uv_dc;
406
+ enc->dq_uv_ac_ = dq_uv_ac;
407
+
408
+ SetupFilterStrength(enc); // initialize segments' filtering, eventually
409
+
410
+ if (num_segments > 1) SimplifySegments(enc);
411
+
412
+ SetupMatrices(enc); // finalize quantization matrices
413
+ }
414
+
415
+ //------------------------------------------------------------------------------
416
+ // Form the predictions in cache
417
+
418
+ // Must be ordered using {DC_PRED, TM_PRED, V_PRED, H_PRED} as index
419
+ const int VP8I16ModeOffsets[4] = { I16DC16, I16TM16, I16VE16, I16HE16 };
420
+ const int VP8UVModeOffsets[4] = { C8DC8, C8TM8, C8VE8, C8HE8 };
421
+
422
+ // Must be indexed using {B_DC_PRED -> B_HU_PRED} as index
423
+ const int VP8I4ModeOffsets[NUM_BMODES] = {
424
+ I4DC4, I4TM4, I4VE4, I4HE4, I4RD4, I4VR4, I4LD4, I4VL4, I4HD4, I4HU4
425
+ };
426
+
427
+ void VP8MakeLuma16Preds(const VP8EncIterator* const it) {
428
+ const uint8_t* const left = it->x_ ? it->y_left_ : NULL;
429
+ const uint8_t* const top = it->y_ ? it->y_top_ : NULL;
430
+ VP8EncPredLuma16(it->yuv_p_, left, top);
431
+ }
432
+
433
+ void VP8MakeChroma8Preds(const VP8EncIterator* const it) {
434
+ const uint8_t* const left = it->x_ ? it->u_left_ : NULL;
435
+ const uint8_t* const top = it->y_ ? it->uv_top_ : NULL;
436
+ VP8EncPredChroma8(it->yuv_p_, left, top);
437
+ }
438
+
439
+ void VP8MakeIntra4Preds(const VP8EncIterator* const it) {
440
+ VP8EncPredLuma4(it->yuv_p_, it->i4_top_);
441
+ }
442
+
443
+ //------------------------------------------------------------------------------
444
+ // Quantize
445
+
446
+ // Layout:
447
+ // +----+----+
448
+ // |YYYY|UUVV| 0
449
+ // |YYYY|UUVV| 4
450
+ // |YYYY|....| 8
451
+ // |YYYY|....| 12
452
+ // +----+----+
453
+
454
+ const int VP8Scan[16] = { // Luma
455
+ 0 + 0 * BPS, 4 + 0 * BPS, 8 + 0 * BPS, 12 + 0 * BPS,
456
+ 0 + 4 * BPS, 4 + 4 * BPS, 8 + 4 * BPS, 12 + 4 * BPS,
457
+ 0 + 8 * BPS, 4 + 8 * BPS, 8 + 8 * BPS, 12 + 8 * BPS,
458
+ 0 + 12 * BPS, 4 + 12 * BPS, 8 + 12 * BPS, 12 + 12 * BPS,
459
+ };
460
+
461
+ static const int VP8ScanUV[4 + 4] = {
462
+ 0 + 0 * BPS, 4 + 0 * BPS, 0 + 4 * BPS, 4 + 4 * BPS, // U
463
+ 8 + 0 * BPS, 12 + 0 * BPS, 8 + 4 * BPS, 12 + 4 * BPS // V
464
+ };
465
+
466
+ //------------------------------------------------------------------------------
467
+ // Distortion measurement
468
+
469
+ static const uint16_t kWeightY[16] = {
470
+ 38, 32, 20, 9, 32, 28, 17, 7, 20, 17, 10, 4, 9, 7, 4, 2
471
+ };
472
+
473
+ static const uint16_t kWeightTrellis[16] = {
474
+ #if USE_TDISTO == 0
475
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16
476
+ #else
477
+ 30, 27, 19, 11,
478
+ 27, 24, 17, 10,
479
+ 19, 17, 12, 8,
480
+ 11, 10, 8, 6
481
+ #endif
482
+ };
483
+
484
+ // Init/Copy the common fields in score.
485
+ static void InitScore(VP8ModeScore* const rd) {
486
+ rd->D = 0;
487
+ rd->SD = 0;
488
+ rd->R = 0;
489
+ rd->H = 0;
490
+ rd->nz = 0;
491
+ rd->score = MAX_COST;
492
+ }
493
+
494
+ static void CopyScore(VP8ModeScore* const dst, const VP8ModeScore* const src) {
495
+ dst->D = src->D;
496
+ dst->SD = src->SD;
497
+ dst->R = src->R;
498
+ dst->H = src->H;
499
+ dst->nz = src->nz; // note that nz is not accumulated, but just copied.
500
+ dst->score = src->score;
501
+ }
502
+
503
+ static void AddScore(VP8ModeScore* const dst, const VP8ModeScore* const src) {
504
+ dst->D += src->D;
505
+ dst->SD += src->SD;
506
+ dst->R += src->R;
507
+ dst->H += src->H;
508
+ dst->nz |= src->nz; // here, new nz bits are accumulated.
509
+ dst->score += src->score;
510
+ }
511
+
512
+ //------------------------------------------------------------------------------
513
+ // Performs trellis-optimized quantization.
514
+
515
+ // Trellis node
516
+ typedef struct {
517
+ int8_t prev; // best previous node
518
+ int8_t sign; // sign of coeff_i
519
+ int16_t level; // level
520
+ } Node;
521
+
522
+ // Score state
523
+ typedef struct {
524
+ score_t score; // partial RD score
525
+ const uint16_t* costs; // shortcut to cost tables
526
+ } ScoreState;
527
+
528
+ // If a coefficient was quantized to a value Q (using a neutral bias),
529
+ // we test all alternate possibilities between [Q-MIN_DELTA, Q+MAX_DELTA]
530
+ // We don't test negative values though.
531
+ #define MIN_DELTA 0 // how much lower level to try
532
+ #define MAX_DELTA 1 // how much higher
533
+ #define NUM_NODES (MIN_DELTA + 1 + MAX_DELTA)
534
+ #define NODE(n, l) (nodes[(n)][(l) + MIN_DELTA])
535
+ #define SCORE_STATE(n, l) (score_states[n][(l) + MIN_DELTA])
536
+
537
+ static WEBP_INLINE void SetRDScore(int lambda, VP8ModeScore* const rd) {
538
+ // TODO: incorporate the "* 256" in the tables?
539
+ rd->score = (rd->R + rd->H) * lambda + 256 * (rd->D + rd->SD);
540
+ }
541
+
542
+ static WEBP_INLINE score_t RDScoreTrellis(int lambda, score_t rate,
543
+ score_t distortion) {
544
+ return rate * lambda + 256 * distortion;
545
+ }
546
+
547
+ static int TrellisQuantizeBlock(const VP8Encoder* const enc,
548
+ int16_t in[16], int16_t out[16],
549
+ int ctx0, int coeff_type,
550
+ const VP8Matrix* const mtx,
551
+ int lambda) {
552
+ const ProbaArray* const probas = enc->proba_.coeffs_[coeff_type];
553
+ CostArrayPtr const costs =
554
+ (CostArrayPtr)enc->proba_.remapped_costs_[coeff_type];
555
+ const int first = (coeff_type == 0) ? 1 : 0;
556
+ Node nodes[16][NUM_NODES];
557
+ ScoreState score_states[2][NUM_NODES];
558
+ ScoreState* ss_cur = &SCORE_STATE(0, MIN_DELTA);
559
+ ScoreState* ss_prev = &SCORE_STATE(1, MIN_DELTA);
560
+ int best_path[3] = {-1, -1, -1}; // store best-last/best-level/best-previous
561
+ score_t best_score;
562
+ int n, m, p, last;
563
+
564
+ {
565
+ score_t cost;
566
+ const int thresh = mtx->q_[1] * mtx->q_[1] / 4;
567
+ const int last_proba = probas[VP8EncBands[first]][ctx0][0];
568
+
569
+ // compute the position of the last interesting coefficient
570
+ last = first - 1;
571
+ for (n = 15; n >= first; --n) {
572
+ const int j = kZigzag[n];
573
+ const int err = in[j] * in[j];
574
+ if (err > thresh) {
575
+ last = n;
576
+ break;
577
+ }
578
+ }
579
+ // we don't need to go inspect up to n = 16 coeffs. We can just go up
580
+ // to last + 1 (inclusive) without losing much.
581
+ if (last < 15) ++last;
582
+
583
+ // compute 'skip' score. This is the max score one can do.
584
+ cost = VP8BitCost(0, last_proba);
585
+ best_score = RDScoreTrellis(lambda, cost, 0);
586
+
587
+ // initialize source node.
588
+ for (m = -MIN_DELTA; m <= MAX_DELTA; ++m) {
589
+ const score_t rate = (ctx0 == 0) ? VP8BitCost(1, last_proba) : 0;
590
+ ss_cur[m].score = RDScoreTrellis(lambda, rate, 0);
591
+ ss_cur[m].costs = costs[first][ctx0];
592
+ }
593
+ }
594
+
595
+ // traverse trellis.
596
+ for (n = first; n <= last; ++n) {
597
+ const int j = kZigzag[n];
598
+ const uint32_t Q = mtx->q_[j];
599
+ const uint32_t iQ = mtx->iq_[j];
600
+ const uint32_t B = BIAS(0x00); // neutral bias
601
+ // note: it's important to take sign of the _original_ coeff,
602
+ // so we don't have to consider level < 0 afterward.
603
+ const int sign = (in[j] < 0);
604
+ const uint32_t coeff0 = (sign ? -in[j] : in[j]) + mtx->sharpen_[j];
605
+ int level0 = QUANTDIV(coeff0, iQ, B);
606
+ if (level0 > MAX_LEVEL) level0 = MAX_LEVEL;
607
+
608
+ { // Swap current and previous score states
609
+ ScoreState* const tmp = ss_cur;
610
+ ss_cur = ss_prev;
611
+ ss_prev = tmp;
612
+ }
613
+
614
+ // test all alternate level values around level0.
615
+ for (m = -MIN_DELTA; m <= MAX_DELTA; ++m) {
616
+ Node* const cur = &NODE(n, m);
617
+ int level = level0 + m;
618
+ const int ctx = (level > 2) ? 2 : level;
619
+ const int band = VP8EncBands[n + 1];
620
+ score_t base_score, last_pos_score;
621
+ score_t best_cur_score = MAX_COST;
622
+ int best_prev = 0; // default, in case
623
+
624
+ ss_cur[m].score = MAX_COST;
625
+ ss_cur[m].costs = costs[n + 1][ctx];
626
+ if (level > MAX_LEVEL || level < 0) { // node is dead?
627
+ continue;
628
+ }
629
+
630
+ // Compute extra rate cost if last coeff's position is < 15
631
+ {
632
+ const score_t last_pos_cost =
633
+ (n < 15) ? VP8BitCost(0, probas[band][ctx][0]) : 0;
634
+ last_pos_score = RDScoreTrellis(lambda, last_pos_cost, 0);
635
+ }
636
+
637
+ {
638
+ // Compute delta_error = how much coding this level will
639
+ // subtract to max_error as distortion.
640
+ // Here, distortion = sum of (|coeff_i| - level_i * Q_i)^2
641
+ const int new_error = coeff0 - level * Q;
642
+ const int delta_error =
643
+ kWeightTrellis[j] * (new_error * new_error - coeff0 * coeff0);
644
+ base_score = RDScoreTrellis(lambda, 0, delta_error);
645
+ }
646
+
647
+ // Inspect all possible non-dead predecessors. Retain only the best one.
648
+ for (p = -MIN_DELTA; p <= MAX_DELTA; ++p) {
649
+ // Dead nodes (with ss_prev[p].score >= MAX_COST) are automatically
650
+ // eliminated since their score can't be better than the current best.
651
+ const score_t cost = VP8LevelCost(ss_prev[p].costs, level);
652
+ // Examine node assuming it's a non-terminal one.
653
+ const score_t score =
654
+ base_score + ss_prev[p].score + RDScoreTrellis(lambda, cost, 0);
655
+ if (score < best_cur_score) {
656
+ best_cur_score = score;
657
+ best_prev = p;
658
+ }
659
+ }
660
+ // Store best finding in current node.
661
+ cur->sign = sign;
662
+ cur->level = level;
663
+ cur->prev = best_prev;
664
+ ss_cur[m].score = best_cur_score;
665
+
666
+ // Now, record best terminal node (and thus best entry in the graph).
667
+ if (level != 0) {
668
+ const score_t score = best_cur_score + last_pos_score;
669
+ if (score < best_score) {
670
+ best_score = score;
671
+ best_path[0] = n; // best eob position
672
+ best_path[1] = m; // best node index
673
+ best_path[2] = best_prev; // best predecessor
674
+ }
675
+ }
676
+ }
677
+ }
678
+
679
+ // Fresh start
680
+ memset(in + first, 0, (16 - first) * sizeof(*in));
681
+ memset(out + first, 0, (16 - first) * sizeof(*out));
682
+ if (best_path[0] == -1) {
683
+ return 0; // skip!
684
+ }
685
+
686
+ {
687
+ // Unwind the best path.
688
+ // Note: best-prev on terminal node is not necessarily equal to the
689
+ // best_prev for non-terminal. So we patch best_path[2] in.
690
+ int nz = 0;
691
+ int best_node = best_path[1];
692
+ n = best_path[0];
693
+ NODE(n, best_node).prev = best_path[2]; // force best-prev for terminal
694
+
695
+ for (; n >= first; --n) {
696
+ const Node* const node = &NODE(n, best_node);
697
+ const int j = kZigzag[n];
698
+ out[n] = node->sign ? -node->level : node->level;
699
+ nz |= node->level;
700
+ in[j] = out[n] * mtx->q_[j];
701
+ best_node = node->prev;
702
+ }
703
+ return (nz != 0);
704
+ }
705
+ }
706
+
707
+ #undef NODE
708
+
709
+ //------------------------------------------------------------------------------
710
+ // Performs: difference, transform, quantize, back-transform, add
711
+ // all at once. Output is the reconstructed block in *yuv_out, and the
712
+ // quantized levels in *levels.
713
+
714
+ static int ReconstructIntra16(VP8EncIterator* const it,
715
+ VP8ModeScore* const rd,
716
+ uint8_t* const yuv_out,
717
+ int mode) {
718
+ const VP8Encoder* const enc = it->enc_;
719
+ const uint8_t* const ref = it->yuv_p_ + VP8I16ModeOffsets[mode];
720
+ const uint8_t* const src = it->yuv_in_ + Y_OFF;
721
+ const VP8SegmentInfo* const dqm = &enc->dqm_[it->mb_->segment_];
722
+ int nz = 0;
723
+ int n;
724
+ int16_t tmp[16][16], dc_tmp[16];
725
+
726
+ for (n = 0; n < 16; ++n) {
727
+ VP8FTransform(src + VP8Scan[n], ref + VP8Scan[n], tmp[n]);
728
+ }
729
+ VP8FTransformWHT(tmp[0], dc_tmp);
730
+ nz |= VP8EncQuantizeBlockWHT(dc_tmp, rd->y_dc_levels, &dqm->y2_) << 24;
731
+
732
+ if (DO_TRELLIS_I16 && it->do_trellis_) {
733
+ int x, y;
734
+ VP8IteratorNzToBytes(it);
735
+ for (y = 0, n = 0; y < 4; ++y) {
736
+ for (x = 0; x < 4; ++x, ++n) {
737
+ const int ctx = it->top_nz_[x] + it->left_nz_[y];
738
+ const int non_zero =
739
+ TrellisQuantizeBlock(enc, tmp[n], rd->y_ac_levels[n], ctx, 0,
740
+ &dqm->y1_, dqm->lambda_trellis_i16_);
741
+ it->top_nz_[x] = it->left_nz_[y] = non_zero;
742
+ rd->y_ac_levels[n][0] = 0;
743
+ nz |= non_zero << n;
744
+ }
745
+ }
746
+ } else {
747
+ for (n = 0; n < 16; n += 2) {
748
+ // Zero-out the first coeff, so that: a) nz is correct below, and
749
+ // b) finding 'last' non-zero coeffs in SetResidualCoeffs() is simplified.
750
+ tmp[n][0] = tmp[n + 1][0] = 0;
751
+ nz |= VP8EncQuantize2Blocks(tmp[n], rd->y_ac_levels[n], &dqm->y1_) << n;
752
+ assert(rd->y_ac_levels[n + 0][0] == 0);
753
+ assert(rd->y_ac_levels[n + 1][0] == 0);
754
+ }
755
+ }
756
+
757
+ // Transform back
758
+ VP8TransformWHT(dc_tmp, tmp[0]);
759
+ for (n = 0; n < 16; n += 2) {
760
+ VP8ITransform(ref + VP8Scan[n], tmp[n], yuv_out + VP8Scan[n], 1);
761
+ }
762
+
763
+ return nz;
764
+ }
765
+
766
+ static int ReconstructIntra4(VP8EncIterator* const it,
767
+ int16_t levels[16],
768
+ const uint8_t* const src,
769
+ uint8_t* const yuv_out,
770
+ int mode) {
771
+ const VP8Encoder* const enc = it->enc_;
772
+ const uint8_t* const ref = it->yuv_p_ + VP8I4ModeOffsets[mode];
773
+ const VP8SegmentInfo* const dqm = &enc->dqm_[it->mb_->segment_];
774
+ int nz = 0;
775
+ int16_t tmp[16];
776
+
777
+ VP8FTransform(src, ref, tmp);
778
+ if (DO_TRELLIS_I4 && it->do_trellis_) {
779
+ const int x = it->i4_ & 3, y = it->i4_ >> 2;
780
+ const int ctx = it->top_nz_[x] + it->left_nz_[y];
781
+ nz = TrellisQuantizeBlock(enc, tmp, levels, ctx, 3, &dqm->y1_,
782
+ dqm->lambda_trellis_i4_);
783
+ } else {
784
+ nz = VP8EncQuantizeBlock(tmp, levels, &dqm->y1_);
785
+ }
786
+ VP8ITransform(ref, tmp, yuv_out, 0);
787
+ return nz;
788
+ }
789
+
790
+ static int ReconstructUV(VP8EncIterator* const it, VP8ModeScore* const rd,
791
+ uint8_t* const yuv_out, int mode) {
792
+ const VP8Encoder* const enc = it->enc_;
793
+ const uint8_t* const ref = it->yuv_p_ + VP8UVModeOffsets[mode];
794
+ const uint8_t* const src = it->yuv_in_ + U_OFF;
795
+ const VP8SegmentInfo* const dqm = &enc->dqm_[it->mb_->segment_];
796
+ int nz = 0;
797
+ int n;
798
+ int16_t tmp[8][16];
799
+
800
+ for (n = 0; n < 8; ++n) {
801
+ VP8FTransform(src + VP8ScanUV[n], ref + VP8ScanUV[n], tmp[n]);
802
+ }
803
+ if (DO_TRELLIS_UV && it->do_trellis_) {
804
+ int ch, x, y;
805
+ for (ch = 0, n = 0; ch <= 2; ch += 2) {
806
+ for (y = 0; y < 2; ++y) {
807
+ for (x = 0; x < 2; ++x, ++n) {
808
+ const int ctx = it->top_nz_[4 + ch + x] + it->left_nz_[4 + ch + y];
809
+ const int non_zero =
810
+ TrellisQuantizeBlock(enc, tmp[n], rd->uv_levels[n], ctx, 2,
811
+ &dqm->uv_, dqm->lambda_trellis_uv_);
812
+ it->top_nz_[4 + ch + x] = it->left_nz_[4 + ch + y] = non_zero;
813
+ nz |= non_zero << n;
814
+ }
815
+ }
816
+ }
817
+ } else {
818
+ for (n = 0; n < 8; n += 2) {
819
+ nz |= VP8EncQuantize2Blocks(tmp[n], rd->uv_levels[n], &dqm->uv_) << n;
820
+ }
821
+ }
822
+
823
+ for (n = 0; n < 8; n += 2) {
824
+ VP8ITransform(ref + VP8ScanUV[n], tmp[n], yuv_out + VP8ScanUV[n], 1);
825
+ }
826
+ return (nz << 16);
827
+ }
828
+
829
+ //------------------------------------------------------------------------------
830
+ // RD-opt decision. Reconstruct each modes, evalue distortion and bit-cost.
831
+ // Pick the mode is lower RD-cost = Rate + lambda * Distortion.
832
+
833
+ static void StoreMaxDelta(VP8SegmentInfo* const dqm, const int16_t DCs[16]) {
834
+ // We look at the first three AC coefficients to determine what is the average
835
+ // delta between each sub-4x4 block.
836
+ const int v0 = abs(DCs[1]);
837
+ const int v1 = abs(DCs[4]);
838
+ const int v2 = abs(DCs[5]);
839
+ int max_v = (v0 > v1) ? v1 : v0;
840
+ max_v = (v2 > max_v) ? v2 : max_v;
841
+ if (max_v > dqm->max_edge_) dqm->max_edge_ = max_v;
842
+ }
843
+
844
+ static void SwapModeScore(VP8ModeScore** a, VP8ModeScore** b) {
845
+ VP8ModeScore* const tmp = *a;
846
+ *a = *b;
847
+ *b = tmp;
848
+ }
849
+
850
+ static void SwapPtr(uint8_t** a, uint8_t** b) {
851
+ uint8_t* const tmp = *a;
852
+ *a = *b;
853
+ *b = tmp;
854
+ }
855
+
856
+ static void SwapOut(VP8EncIterator* const it) {
857
+ SwapPtr(&it->yuv_out_, &it->yuv_out2_);
858
+ }
859
+
860
+ static score_t IsFlat(const int16_t* levels, int num_blocks, score_t thresh) {
861
+ score_t score = 0;
862
+ while (num_blocks-- > 0) { // TODO(skal): refine positional scoring?
863
+ int i;
864
+ for (i = 1; i < 16; ++i) { // omit DC, we're only interested in AC
865
+ score += (levels[i] != 0);
866
+ if (score > thresh) return 0;
867
+ }
868
+ levels += 16;
869
+ }
870
+ return 1;
871
+ }
872
+
873
+ static void PickBestIntra16(VP8EncIterator* const it, VP8ModeScore* rd) {
874
+ const int kNumBlocks = 16;
875
+ VP8SegmentInfo* const dqm = &it->enc_->dqm_[it->mb_->segment_];
876
+ const int lambda = dqm->lambda_i16_;
877
+ const int tlambda = dqm->tlambda_;
878
+ const uint8_t* const src = it->yuv_in_ + Y_OFF;
879
+ VP8ModeScore rd_tmp;
880
+ VP8ModeScore* rd_cur = &rd_tmp;
881
+ VP8ModeScore* rd_best = rd;
882
+ int mode;
883
+
884
+ rd->mode_i16 = -1;
885
+ for (mode = 0; mode < NUM_PRED_MODES; ++mode) {
886
+ uint8_t* const tmp_dst = it->yuv_out2_ + Y_OFF; // scratch buffer
887
+ rd_cur->mode_i16 = mode;
888
+
889
+ // Reconstruct
890
+ rd_cur->nz = ReconstructIntra16(it, rd_cur, tmp_dst, mode);
891
+
892
+ // Measure RD-score
893
+ rd_cur->D = VP8SSE16x16(src, tmp_dst);
894
+ rd_cur->SD =
895
+ tlambda ? MULT_8B(tlambda, VP8TDisto16x16(src, tmp_dst, kWeightY)) : 0;
896
+ rd_cur->H = VP8FixedCostsI16[mode];
897
+ rd_cur->R = VP8GetCostLuma16(it, rd_cur);
898
+ if (mode > 0 &&
899
+ IsFlat(rd_cur->y_ac_levels[0], kNumBlocks, FLATNESS_LIMIT_I16)) {
900
+ // penalty to avoid flat area to be mispredicted by complex mode
901
+ rd_cur->R += FLATNESS_PENALTY * kNumBlocks;
902
+ }
903
+
904
+ // Since we always examine Intra16 first, we can overwrite *rd directly.
905
+ SetRDScore(lambda, rd_cur);
906
+ if (mode == 0 || rd_cur->score < rd_best->score) {
907
+ SwapModeScore(&rd_cur, &rd_best);
908
+ SwapOut(it);
909
+ }
910
+ }
911
+ if (rd_best != rd) {
912
+ memcpy(rd, rd_best, sizeof(*rd));
913
+ }
914
+ SetRDScore(dqm->lambda_mode_, rd); // finalize score for mode decision.
915
+ VP8SetIntra16Mode(it, rd->mode_i16);
916
+
917
+ // we have a blocky macroblock (only DCs are non-zero) with fairly high
918
+ // distortion, record max delta so we can later adjust the minimal filtering
919
+ // strength needed to smooth these blocks out.
920
+ if ((rd->nz & 0xffff) == 0 && rd->D > dqm->min_disto_) {
921
+ StoreMaxDelta(dqm, rd->y_dc_levels);
922
+ }
923
+ }
924
+
925
+ //------------------------------------------------------------------------------
926
+
927
+ // return the cost array corresponding to the surrounding prediction modes.
928
+ static const uint16_t* GetCostModeI4(VP8EncIterator* const it,
929
+ const uint8_t modes[16]) {
930
+ const int preds_w = it->enc_->preds_w_;
931
+ const int x = (it->i4_ & 3), y = it->i4_ >> 2;
932
+ const int left = (x == 0) ? it->preds_[y * preds_w - 1] : modes[it->i4_ - 1];
933
+ const int top = (y == 0) ? it->preds_[-preds_w + x] : modes[it->i4_ - 4];
934
+ return VP8FixedCostsI4[top][left];
935
+ }
936
+
937
+ static int PickBestIntra4(VP8EncIterator* const it, VP8ModeScore* const rd) {
938
+ const VP8Encoder* const enc = it->enc_;
939
+ const VP8SegmentInfo* const dqm = &enc->dqm_[it->mb_->segment_];
940
+ const int lambda = dqm->lambda_i4_;
941
+ const int tlambda = dqm->tlambda_;
942
+ const uint8_t* const src0 = it->yuv_in_ + Y_OFF;
943
+ uint8_t* const best_blocks = it->yuv_out2_ + Y_OFF;
944
+ int total_header_bits = 0;
945
+ VP8ModeScore rd_best;
946
+
947
+ if (enc->max_i4_header_bits_ == 0) {
948
+ return 0;
949
+ }
950
+
951
+ InitScore(&rd_best);
952
+ rd_best.H = 211; // '211' is the value of VP8BitCost(0, 145)
953
+ SetRDScore(dqm->lambda_mode_, &rd_best);
954
+ VP8IteratorStartI4(it);
955
+ do {
956
+ const int kNumBlocks = 1;
957
+ VP8ModeScore rd_i4;
958
+ int mode;
959
+ int best_mode = -1;
960
+ const uint8_t* const src = src0 + VP8Scan[it->i4_];
961
+ const uint16_t* const mode_costs = GetCostModeI4(it, rd->modes_i4);
962
+ uint8_t* best_block = best_blocks + VP8Scan[it->i4_];
963
+ uint8_t* tmp_dst = it->yuv_p_ + I4TMP; // scratch buffer.
964
+
965
+ InitScore(&rd_i4);
966
+ VP8MakeIntra4Preds(it);
967
+ for (mode = 0; mode < NUM_BMODES; ++mode) {
968
+ VP8ModeScore rd_tmp;
969
+ int16_t tmp_levels[16];
970
+
971
+ // Reconstruct
972
+ rd_tmp.nz =
973
+ ReconstructIntra4(it, tmp_levels, src, tmp_dst, mode) << it->i4_;
974
+
975
+ // Compute RD-score
976
+ rd_tmp.D = VP8SSE4x4(src, tmp_dst);
977
+ rd_tmp.SD =
978
+ tlambda ? MULT_8B(tlambda, VP8TDisto4x4(src, tmp_dst, kWeightY))
979
+ : 0;
980
+ rd_tmp.H = mode_costs[mode];
981
+
982
+ // Add flatness penalty
983
+ if (mode > 0 && IsFlat(tmp_levels, kNumBlocks, FLATNESS_LIMIT_I4)) {
984
+ rd_tmp.R = FLATNESS_PENALTY * kNumBlocks;
985
+ } else {
986
+ rd_tmp.R = 0;
987
+ }
988
+
989
+ // early-out check
990
+ SetRDScore(lambda, &rd_tmp);
991
+ if (best_mode >= 0 && rd_tmp.score >= rd_i4.score) continue;
992
+
993
+ // finish computing score
994
+ rd_tmp.R += VP8GetCostLuma4(it, tmp_levels);
995
+ SetRDScore(lambda, &rd_tmp);
996
+
997
+ if (best_mode < 0 || rd_tmp.score < rd_i4.score) {
998
+ CopyScore(&rd_i4, &rd_tmp);
999
+ best_mode = mode;
1000
+ SwapPtr(&tmp_dst, &best_block);
1001
+ memcpy(rd_best.y_ac_levels[it->i4_], tmp_levels,
1002
+ sizeof(rd_best.y_ac_levels[it->i4_]));
1003
+ }
1004
+ }
1005
+ SetRDScore(dqm->lambda_mode_, &rd_i4);
1006
+ AddScore(&rd_best, &rd_i4);
1007
+ if (rd_best.score >= rd->score) {
1008
+ return 0;
1009
+ }
1010
+ total_header_bits += (int)rd_i4.H; // <- equal to mode_costs[best_mode];
1011
+ if (total_header_bits > enc->max_i4_header_bits_) {
1012
+ return 0;
1013
+ }
1014
+ // Copy selected samples if not in the right place already.
1015
+ if (best_block != best_blocks + VP8Scan[it->i4_]) {
1016
+ VP8Copy4x4(best_block, best_blocks + VP8Scan[it->i4_]);
1017
+ }
1018
+ rd->modes_i4[it->i4_] = best_mode;
1019
+ it->top_nz_[it->i4_ & 3] = it->left_nz_[it->i4_ >> 2] = (rd_i4.nz ? 1 : 0);
1020
+ } while (VP8IteratorRotateI4(it, best_blocks));
1021
+
1022
+ // finalize state
1023
+ CopyScore(rd, &rd_best);
1024
+ VP8SetIntra4Mode(it, rd->modes_i4);
1025
+ SwapOut(it);
1026
+ memcpy(rd->y_ac_levels, rd_best.y_ac_levels, sizeof(rd->y_ac_levels));
1027
+ return 1; // select intra4x4 over intra16x16
1028
+ }
1029
+
1030
+ //------------------------------------------------------------------------------
1031
+
1032
+ static void PickBestUV(VP8EncIterator* const it, VP8ModeScore* const rd) {
1033
+ const int kNumBlocks = 8;
1034
+ const VP8SegmentInfo* const dqm = &it->enc_->dqm_[it->mb_->segment_];
1035
+ const int lambda = dqm->lambda_uv_;
1036
+ const uint8_t* const src = it->yuv_in_ + U_OFF;
1037
+ uint8_t* tmp_dst = it->yuv_out2_ + U_OFF; // scratch buffer
1038
+ uint8_t* dst0 = it->yuv_out_ + U_OFF;
1039
+ uint8_t* dst = dst0;
1040
+ VP8ModeScore rd_best;
1041
+ int mode;
1042
+
1043
+ rd->mode_uv = -1;
1044
+ InitScore(&rd_best);
1045
+ for (mode = 0; mode < NUM_PRED_MODES; ++mode) {
1046
+ VP8ModeScore rd_uv;
1047
+
1048
+ // Reconstruct
1049
+ rd_uv.nz = ReconstructUV(it, &rd_uv, tmp_dst, mode);
1050
+
1051
+ // Compute RD-score
1052
+ rd_uv.D = VP8SSE16x8(src, tmp_dst);
1053
+ rd_uv.SD = 0; // TODO: should we call TDisto? it tends to flatten areas.
1054
+ rd_uv.H = VP8FixedCostsUV[mode];
1055
+ rd_uv.R = VP8GetCostUV(it, &rd_uv);
1056
+ if (mode > 0 && IsFlat(rd_uv.uv_levels[0], kNumBlocks, FLATNESS_LIMIT_UV)) {
1057
+ rd_uv.R += FLATNESS_PENALTY * kNumBlocks;
1058
+ }
1059
+
1060
+ SetRDScore(lambda, &rd_uv);
1061
+ if (mode == 0 || rd_uv.score < rd_best.score) {
1062
+ CopyScore(&rd_best, &rd_uv);
1063
+ rd->mode_uv = mode;
1064
+ memcpy(rd->uv_levels, rd_uv.uv_levels, sizeof(rd->uv_levels));
1065
+ SwapPtr(&dst, &tmp_dst);
1066
+ }
1067
+ }
1068
+ VP8SetIntraUVMode(it, rd->mode_uv);
1069
+ AddScore(rd, &rd_best);
1070
+ if (dst != dst0) { // copy 16x8 block if needed
1071
+ VP8Copy16x8(dst, dst0);
1072
+ }
1073
+ }
1074
+
1075
+ //------------------------------------------------------------------------------
1076
+ // Final reconstruction and quantization.
1077
+
1078
+ static void SimpleQuantize(VP8EncIterator* const it, VP8ModeScore* const rd) {
1079
+ const VP8Encoder* const enc = it->enc_;
1080
+ const int is_i16 = (it->mb_->type_ == 1);
1081
+ int nz = 0;
1082
+
1083
+ if (is_i16) {
1084
+ nz = ReconstructIntra16(it, rd, it->yuv_out_ + Y_OFF, it->preds_[0]);
1085
+ } else {
1086
+ VP8IteratorStartI4(it);
1087
+ do {
1088
+ const int mode =
1089
+ it->preds_[(it->i4_ & 3) + (it->i4_ >> 2) * enc->preds_w_];
1090
+ const uint8_t* const src = it->yuv_in_ + Y_OFF + VP8Scan[it->i4_];
1091
+ uint8_t* const dst = it->yuv_out_ + Y_OFF + VP8Scan[it->i4_];
1092
+ VP8MakeIntra4Preds(it);
1093
+ nz |= ReconstructIntra4(it, rd->y_ac_levels[it->i4_],
1094
+ src, dst, mode) << it->i4_;
1095
+ } while (VP8IteratorRotateI4(it, it->yuv_out_ + Y_OFF));
1096
+ }
1097
+
1098
+ nz |= ReconstructUV(it, rd, it->yuv_out_ + U_OFF, it->mb_->uv_mode_);
1099
+ rd->nz = nz;
1100
+ }
1101
+
1102
+ // Refine intra16/intra4 sub-modes based on distortion only (not rate).
1103
+ static void DistoRefine(VP8EncIterator* const it, int try_both_i4_i16) {
1104
+ const int is_i16 = (it->mb_->type_ == 1);
1105
+ score_t best_score = MAX_COST;
1106
+
1107
+ if (try_both_i4_i16 || is_i16) {
1108
+ int mode;
1109
+ int best_mode = -1;
1110
+ for (mode = 0; mode < NUM_PRED_MODES; ++mode) {
1111
+ const uint8_t* const ref = it->yuv_p_ + VP8I16ModeOffsets[mode];
1112
+ const uint8_t* const src = it->yuv_in_ + Y_OFF;
1113
+ const score_t score = VP8SSE16x16(src, ref);
1114
+ if (score < best_score) {
1115
+ best_mode = mode;
1116
+ best_score = score;
1117
+ }
1118
+ }
1119
+ VP8SetIntra16Mode(it, best_mode);
1120
+ }
1121
+ if (try_both_i4_i16 || !is_i16) {
1122
+ uint8_t modes_i4[16];
1123
+ // We don't evaluate the rate here, but just account for it through a
1124
+ // constant penalty (i4 mode usually needs more bits compared to i16).
1125
+ score_t score_i4 = (score_t)I4_PENALTY;
1126
+
1127
+ VP8IteratorStartI4(it);
1128
+ do {
1129
+ int mode;
1130
+ int best_sub_mode = -1;
1131
+ score_t best_sub_score = MAX_COST;
1132
+ const uint8_t* const src = it->yuv_in_ + Y_OFF + VP8Scan[it->i4_];
1133
+
1134
+ // TODO(skal): we don't really need the prediction pixels here,
1135
+ // but just the distortion against 'src'.
1136
+ VP8MakeIntra4Preds(it);
1137
+ for (mode = 0; mode < NUM_BMODES; ++mode) {
1138
+ const uint8_t* const ref = it->yuv_p_ + VP8I4ModeOffsets[mode];
1139
+ const score_t score = VP8SSE4x4(src, ref);
1140
+ if (score < best_sub_score) {
1141
+ best_sub_mode = mode;
1142
+ best_sub_score = score;
1143
+ }
1144
+ }
1145
+ modes_i4[it->i4_] = best_sub_mode;
1146
+ score_i4 += best_sub_score;
1147
+ if (score_i4 >= best_score) break;
1148
+ } while (VP8IteratorRotateI4(it, it->yuv_in_ + Y_OFF));
1149
+ if (score_i4 < best_score) {
1150
+ VP8SetIntra4Mode(it, modes_i4);
1151
+ }
1152
+ }
1153
+ }
1154
+
1155
+ //------------------------------------------------------------------------------
1156
+ // Entry point
1157
+
1158
+ int VP8Decimate(VP8EncIterator* const it, VP8ModeScore* const rd,
1159
+ VP8RDLevel rd_opt) {
1160
+ int is_skipped;
1161
+ const int method = it->enc_->method_;
1162
+
1163
+ InitScore(rd);
1164
+
1165
+ // We can perform predictions for Luma16x16 and Chroma8x8 already.
1166
+ // Luma4x4 predictions needs to be done as-we-go.
1167
+ VP8MakeLuma16Preds(it);
1168
+ VP8MakeChroma8Preds(it);
1169
+
1170
+ if (rd_opt > RD_OPT_NONE) {
1171
+ it->do_trellis_ = (rd_opt >= RD_OPT_TRELLIS_ALL);
1172
+ PickBestIntra16(it, rd);
1173
+ if (method >= 2) {
1174
+ PickBestIntra4(it, rd);
1175
+ }
1176
+ PickBestUV(it, rd);
1177
+ if (rd_opt == RD_OPT_TRELLIS) { // finish off with trellis-optim now
1178
+ it->do_trellis_ = 1;
1179
+ SimpleQuantize(it, rd);
1180
+ }
1181
+ } else {
1182
+ // For method == 2, pick the best intra4/intra16 based on SSE (~tad slower).
1183
+ // For method <= 1, we refine intra4 or intra16 (but don't re-examine mode).
1184
+ DistoRefine(it, (method >= 2));
1185
+ SimpleQuantize(it, rd);
1186
+ }
1187
+ is_skipped = (rd->nz == 0);
1188
+ VP8SetSkip(it, is_skipped);
1189
+ return is_skipped;
1190
+ }
1191
+