laag-libtiff 4.0.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (629) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +57 -0
  3. data/LICENSE.txt +21 -0
  4. data/README.org +34 -0
  5. data/ext/laag/libtiff/extconf.rb +13 -0
  6. data/laag-libtiff.gemspec +20 -0
  7. data/lib/laag/libtiff.rb +29 -0
  8. data/vendor/gitlab.com/libtiff/libtiff/.appveyor.yml +109 -0
  9. data/vendor/gitlab.com/libtiff/libtiff/.cvsignore +4 -0
  10. data/vendor/gitlab.com/libtiff/libtiff/.travis.yml +34 -0
  11. data/vendor/gitlab.com/libtiff/libtiff/CMakeLists.txt +764 -0
  12. data/vendor/gitlab.com/libtiff/libtiff/COMMITTERS +19 -0
  13. data/vendor/gitlab.com/libtiff/libtiff/COPYRIGHT +21 -0
  14. data/vendor/gitlab.com/libtiff/libtiff/ChangeLog +8073 -0
  15. data/vendor/gitlab.com/libtiff/libtiff/HOWTO-RELEASE +119 -0
  16. data/vendor/gitlab.com/libtiff/libtiff/HOWTO-SECURITY-RELEASE +19 -0
  17. data/vendor/gitlab.com/libtiff/libtiff/Makefile.am +91 -0
  18. data/vendor/gitlab.com/libtiff/libtiff/Makefile.in +995 -0
  19. data/vendor/gitlab.com/libtiff/libtiff/Makefile.vc +58 -0
  20. data/vendor/gitlab.com/libtiff/libtiff/README +61 -0
  21. data/vendor/gitlab.com/libtiff/libtiff/README.vms +12 -0
  22. data/vendor/gitlab.com/libtiff/libtiff/RELEASE-DATE +1 -0
  23. data/vendor/gitlab.com/libtiff/libtiff/SConstruct +171 -0
  24. data/vendor/gitlab.com/libtiff/libtiff/TODO +12 -0
  25. data/vendor/gitlab.com/libtiff/libtiff/VERSION +1 -0
  26. data/vendor/gitlab.com/libtiff/libtiff/aclocal.m4 +1194 -0
  27. data/vendor/gitlab.com/libtiff/libtiff/archive/html/man/bmp2tiff.1.html +121 -0
  28. data/vendor/gitlab.com/libtiff/libtiff/archive/html/man/gif2tiff.1.html +141 -0
  29. data/vendor/gitlab.com/libtiff/libtiff/archive/html/man/ras2tiff.1.html +139 -0
  30. data/vendor/gitlab.com/libtiff/libtiff/archive/html/man/sgi2tiff.1.html +147 -0
  31. data/vendor/gitlab.com/libtiff/libtiff/archive/html/man/tiffsv.1.html +207 -0
  32. data/vendor/gitlab.com/libtiff/libtiff/archive/man/bmp2tiff.1 +85 -0
  33. data/vendor/gitlab.com/libtiff/libtiff/archive/man/gif2tiff.1 +81 -0
  34. data/vendor/gitlab.com/libtiff/libtiff/archive/man/ras2tiff.1 +96 -0
  35. data/vendor/gitlab.com/libtiff/libtiff/archive/man/sgi2tiff.1 +93 -0
  36. data/vendor/gitlab.com/libtiff/libtiff/archive/man/tiffsv.1 +142 -0
  37. data/vendor/gitlab.com/libtiff/libtiff/archive/tools/bmp2tiff.c +937 -0
  38. data/vendor/gitlab.com/libtiff/libtiff/archive/tools/gif2tiff.c +591 -0
  39. data/vendor/gitlab.com/libtiff/libtiff/archive/tools/ras2tiff.c +338 -0
  40. data/vendor/gitlab.com/libtiff/libtiff/archive/tools/rasterfile.h +44 -0
  41. data/vendor/gitlab.com/libtiff/libtiff/archive/tools/sgi2tiff.c +337 -0
  42. data/vendor/gitlab.com/libtiff/libtiff/archive/tools/sgisv.c +318 -0
  43. data/vendor/gitlab.com/libtiff/libtiff/archive/tools/ycbcr.c +168 -0
  44. data/vendor/gitlab.com/libtiff/libtiff/autogen.sh +8 -0
  45. data/vendor/gitlab.com/libtiff/libtiff/build/.cvsignore +1 -0
  46. data/vendor/gitlab.com/libtiff/libtiff/build/CMakeLists.txt +25 -0
  47. data/vendor/gitlab.com/libtiff/libtiff/build/Makefile.am +32 -0
  48. data/vendor/gitlab.com/libtiff/libtiff/build/Makefile.in +680 -0
  49. data/vendor/gitlab.com/libtiff/libtiff/build/README +3 -0
  50. data/vendor/gitlab.com/libtiff/libtiff/build/travis-ci +108 -0
  51. data/vendor/gitlab.com/libtiff/libtiff/commit +233 -0
  52. data/vendor/gitlab.com/libtiff/libtiff/config/compile +347 -0
  53. data/vendor/gitlab.com/libtiff/libtiff/config/config.guess +1526 -0
  54. data/vendor/gitlab.com/libtiff/libtiff/config/config.sub +1658 -0
  55. data/vendor/gitlab.com/libtiff/libtiff/config/depcomp +791 -0
  56. data/vendor/gitlab.com/libtiff/libtiff/config/install-sh +507 -0
  57. data/vendor/gitlab.com/libtiff/libtiff/config/ltmain.sh +11156 -0
  58. data/vendor/gitlab.com/libtiff/libtiff/config/missing +215 -0
  59. data/vendor/gitlab.com/libtiff/libtiff/config/mkinstalldirs +161 -0
  60. data/vendor/gitlab.com/libtiff/libtiff/config/test-driver +127 -0
  61. data/vendor/gitlab.com/libtiff/libtiff/configure +23612 -0
  62. data/vendor/gitlab.com/libtiff/libtiff/configure.ac +1112 -0
  63. data/vendor/gitlab.com/libtiff/libtiff/configure.com +1357 -0
  64. data/vendor/gitlab.com/libtiff/libtiff/contrib/.cvsignore +2 -0
  65. data/vendor/gitlab.com/libtiff/libtiff/contrib/CMakeLists.txt +35 -0
  66. data/vendor/gitlab.com/libtiff/libtiff/contrib/Makefile.am +31 -0
  67. data/vendor/gitlab.com/libtiff/libtiff/contrib/Makefile.in +679 -0
  68. data/vendor/gitlab.com/libtiff/libtiff/contrib/README +2 -0
  69. data/vendor/gitlab.com/libtiff/libtiff/contrib/addtiffo/.cvsignore +5 -0
  70. data/vendor/gitlab.com/libtiff/libtiff/contrib/addtiffo/CMakeLists.txt +34 -0
  71. data/vendor/gitlab.com/libtiff/libtiff/contrib/addtiffo/Makefile.am +39 -0
  72. data/vendor/gitlab.com/libtiff/libtiff/contrib/addtiffo/Makefile.in +652 -0
  73. data/vendor/gitlab.com/libtiff/libtiff/contrib/addtiffo/Makefile.vc +28 -0
  74. data/vendor/gitlab.com/libtiff/libtiff/contrib/addtiffo/README +142 -0
  75. data/vendor/gitlab.com/libtiff/libtiff/contrib/addtiffo/addtiffo.c +181 -0
  76. data/vendor/gitlab.com/libtiff/libtiff/contrib/addtiffo/tif_overview.c +916 -0
  77. data/vendor/gitlab.com/libtiff/libtiff/contrib/addtiffo/tif_ovrcache.c +344 -0
  78. data/vendor/gitlab.com/libtiff/libtiff/contrib/addtiffo/tif_ovrcache.h +103 -0
  79. data/vendor/gitlab.com/libtiff/libtiff/contrib/dbs/.cvsignore +8 -0
  80. data/vendor/gitlab.com/libtiff/libtiff/contrib/dbs/CMakeLists.txt +43 -0
  81. data/vendor/gitlab.com/libtiff/libtiff/contrib/dbs/Makefile.am +46 -0
  82. data/vendor/gitlab.com/libtiff/libtiff/contrib/dbs/Makefile.in +798 -0
  83. data/vendor/gitlab.com/libtiff/libtiff/contrib/dbs/README +7 -0
  84. data/vendor/gitlab.com/libtiff/libtiff/contrib/dbs/tiff-bi.c +91 -0
  85. data/vendor/gitlab.com/libtiff/libtiff/contrib/dbs/tiff-grayscale.c +147 -0
  86. data/vendor/gitlab.com/libtiff/libtiff/contrib/dbs/tiff-palette.c +284 -0
  87. data/vendor/gitlab.com/libtiff/libtiff/contrib/dbs/tiff-rgb.c +201 -0
  88. data/vendor/gitlab.com/libtiff/libtiff/contrib/dbs/xtiff/.cvsignore +2 -0
  89. data/vendor/gitlab.com/libtiff/libtiff/contrib/dbs/xtiff/CMakeLists.txt +29 -0
  90. data/vendor/gitlab.com/libtiff/libtiff/contrib/dbs/xtiff/Makefile.am +47 -0
  91. data/vendor/gitlab.com/libtiff/libtiff/contrib/dbs/xtiff/Makefile.in +516 -0
  92. data/vendor/gitlab.com/libtiff/libtiff/contrib/dbs/xtiff/README +6 -0
  93. data/vendor/gitlab.com/libtiff/libtiff/contrib/dbs/xtiff/patchlevel.h +8 -0
  94. data/vendor/gitlab.com/libtiff/libtiff/contrib/dbs/xtiff/xtiff.c +1290 -0
  95. data/vendor/gitlab.com/libtiff/libtiff/contrib/dbs/xtiff/xtifficon.h +21 -0
  96. data/vendor/gitlab.com/libtiff/libtiff/contrib/iptcutil/.cvsignore +5 -0
  97. data/vendor/gitlab.com/libtiff/libtiff/contrib/iptcutil/CMakeLists.txt +35 -0
  98. data/vendor/gitlab.com/libtiff/libtiff/contrib/iptcutil/Makefile.am +40 -0
  99. data/vendor/gitlab.com/libtiff/libtiff/contrib/iptcutil/Makefile.in +650 -0
  100. data/vendor/gitlab.com/libtiff/libtiff/contrib/iptcutil/README +25 -0
  101. data/vendor/gitlab.com/libtiff/libtiff/contrib/iptcutil/iptcutil.c +954 -0
  102. data/vendor/gitlab.com/libtiff/libtiff/contrib/iptcutil/test.iptc +0 -0
  103. data/vendor/gitlab.com/libtiff/libtiff/contrib/iptcutil/test.txt +32 -0
  104. data/vendor/gitlab.com/libtiff/libtiff/contrib/mfs/.cvsignore +2 -0
  105. data/vendor/gitlab.com/libtiff/libtiff/contrib/mfs/CMakeLists.txt +27 -0
  106. data/vendor/gitlab.com/libtiff/libtiff/contrib/mfs/Makefile.am +29 -0
  107. data/vendor/gitlab.com/libtiff/libtiff/contrib/mfs/Makefile.in +499 -0
  108. data/vendor/gitlab.com/libtiff/libtiff/contrib/mfs/README +37 -0
  109. data/vendor/gitlab.com/libtiff/libtiff/contrib/mfs/mfs_file.c +586 -0
  110. data/vendor/gitlab.com/libtiff/libtiff/contrib/pds/.cvsignore +2 -0
  111. data/vendor/gitlab.com/libtiff/libtiff/contrib/pds/CMakeLists.txt +30 -0
  112. data/vendor/gitlab.com/libtiff/libtiff/contrib/pds/Makefile.am +32 -0
  113. data/vendor/gitlab.com/libtiff/libtiff/contrib/pds/Makefile.in +502 -0
  114. data/vendor/gitlab.com/libtiff/libtiff/contrib/pds/README +90 -0
  115. data/vendor/gitlab.com/libtiff/libtiff/contrib/pds/tif_imageiter.c +525 -0
  116. data/vendor/gitlab.com/libtiff/libtiff/contrib/pds/tif_imageiter.h +64 -0
  117. data/vendor/gitlab.com/libtiff/libtiff/contrib/pds/tif_pdsdirread.c +1131 -0
  118. data/vendor/gitlab.com/libtiff/libtiff/contrib/pds/tif_pdsdirwrite.c +971 -0
  119. data/vendor/gitlab.com/libtiff/libtiff/contrib/ras/.cvsignore +2 -0
  120. data/vendor/gitlab.com/libtiff/libtiff/contrib/ras/CMakeLists.txt +28 -0
  121. data/vendor/gitlab.com/libtiff/libtiff/contrib/ras/Makefile.am +30 -0
  122. data/vendor/gitlab.com/libtiff/libtiff/contrib/ras/Makefile.in +500 -0
  123. data/vendor/gitlab.com/libtiff/libtiff/contrib/ras/README +10 -0
  124. data/vendor/gitlab.com/libtiff/libtiff/contrib/ras/ras2tif.c +254 -0
  125. data/vendor/gitlab.com/libtiff/libtiff/contrib/ras/tif2ras.c +344 -0
  126. data/vendor/gitlab.com/libtiff/libtiff/contrib/stream/.cvsignore +2 -0
  127. data/vendor/gitlab.com/libtiff/libtiff/contrib/stream/CMakeLists.txt +28 -0
  128. data/vendor/gitlab.com/libtiff/libtiff/contrib/stream/Makefile.am +30 -0
  129. data/vendor/gitlab.com/libtiff/libtiff/contrib/stream/Makefile.in +500 -0
  130. data/vendor/gitlab.com/libtiff/libtiff/contrib/stream/README +30 -0
  131. data/vendor/gitlab.com/libtiff/libtiff/contrib/stream/tiffstream.cpp +238 -0
  132. data/vendor/gitlab.com/libtiff/libtiff/contrib/stream/tiffstream.h +70 -0
  133. data/vendor/gitlab.com/libtiff/libtiff/contrib/tags/.cvsignore +2 -0
  134. data/vendor/gitlab.com/libtiff/libtiff/contrib/tags/CMakeLists.txt +32 -0
  135. data/vendor/gitlab.com/libtiff/libtiff/contrib/tags/Makefile.am +33 -0
  136. data/vendor/gitlab.com/libtiff/libtiff/contrib/tags/Makefile.in +503 -0
  137. data/vendor/gitlab.com/libtiff/libtiff/contrib/tags/README +132 -0
  138. data/vendor/gitlab.com/libtiff/libtiff/contrib/tags/listtif.c +39 -0
  139. data/vendor/gitlab.com/libtiff/libtiff/contrib/tags/maketif.c +77 -0
  140. data/vendor/gitlab.com/libtiff/libtiff/contrib/tags/xtif_dir.c +350 -0
  141. data/vendor/gitlab.com/libtiff/libtiff/contrib/tags/xtiffio.h +59 -0
  142. data/vendor/gitlab.com/libtiff/libtiff/contrib/tags/xtiffiop.h +72 -0
  143. data/vendor/gitlab.com/libtiff/libtiff/contrib/win_dib/.cvsignore +2 -0
  144. data/vendor/gitlab.com/libtiff/libtiff/contrib/win_dib/CMakeLists.txt +30 -0
  145. data/vendor/gitlab.com/libtiff/libtiff/contrib/win_dib/Makefile.am +32 -0
  146. data/vendor/gitlab.com/libtiff/libtiff/contrib/win_dib/Makefile.in +502 -0
  147. data/vendor/gitlab.com/libtiff/libtiff/contrib/win_dib/Makefile.w95 +134 -0
  148. data/vendor/gitlab.com/libtiff/libtiff/contrib/win_dib/README.Tiffile +31 -0
  149. data/vendor/gitlab.com/libtiff/libtiff/contrib/win_dib/README.tiff2dib +51 -0
  150. data/vendor/gitlab.com/libtiff/libtiff/contrib/win_dib/Tiffile.cpp +449 -0
  151. data/vendor/gitlab.com/libtiff/libtiff/contrib/win_dib/tiff2dib.c +379 -0
  152. data/vendor/gitlab.com/libtiff/libtiff/html/.cvsignore +5 -0
  153. data/vendor/gitlab.com/libtiff/libtiff/html/BigTIFFProposal.html +99 -0
  154. data/vendor/gitlab.com/libtiff/libtiff/html/CMakeLists.txt +87 -0
  155. data/vendor/gitlab.com/libtiff/libtiff/html/Makefile.am +96 -0
  156. data/vendor/gitlab.com/libtiff/libtiff/html/Makefile.in +798 -0
  157. data/vendor/gitlab.com/libtiff/libtiff/html/TIFFTechNote2.html +707 -0
  158. data/vendor/gitlab.com/libtiff/libtiff/html/addingtags.html +292 -0
  159. data/vendor/gitlab.com/libtiff/libtiff/html/bigtiffdesign.html +80 -0
  160. data/vendor/gitlab.com/libtiff/libtiff/html/bigtiffpr.html +77 -0
  161. data/vendor/gitlab.com/libtiff/libtiff/html/bigtiffpr_images/esri.png +0 -0
  162. data/vendor/gitlab.com/libtiff/libtiff/html/bigtiffpr_images/leica.png +0 -0
  163. data/vendor/gitlab.com/libtiff/libtiff/html/bigtiffpr_images/safe.png +0 -0
  164. data/vendor/gitlab.com/libtiff/libtiff/html/bigtiffpr_images/weogeo.png +0 -0
  165. data/vendor/gitlab.com/libtiff/libtiff/html/bugs.html +61 -0
  166. data/vendor/gitlab.com/libtiff/libtiff/html/build.html +737 -0
  167. data/vendor/gitlab.com/libtiff/libtiff/html/contrib.html +209 -0
  168. data/vendor/gitlab.com/libtiff/libtiff/html/document.html +52 -0
  169. data/vendor/gitlab.com/libtiff/libtiff/html/images.html +41 -0
  170. data/vendor/gitlab.com/libtiff/libtiff/html/images/.cvsignore +2 -0
  171. data/vendor/gitlab.com/libtiff/libtiff/html/images/CMakeLists.txt +46 -0
  172. data/vendor/gitlab.com/libtiff/libtiff/html/images/Makefile.am +49 -0
  173. data/vendor/gitlab.com/libtiff/libtiff/html/images/Makefile.in +572 -0
  174. data/vendor/gitlab.com/libtiff/libtiff/html/images/back.gif +0 -0
  175. data/vendor/gitlab.com/libtiff/libtiff/html/images/bali.jpg +0 -0
  176. data/vendor/gitlab.com/libtiff/libtiff/html/images/cat.gif +0 -0
  177. data/vendor/gitlab.com/libtiff/libtiff/html/images/cover.jpg +0 -0
  178. data/vendor/gitlab.com/libtiff/libtiff/html/images/cramps.gif +0 -0
  179. data/vendor/gitlab.com/libtiff/libtiff/html/images/dave.gif +0 -0
  180. data/vendor/gitlab.com/libtiff/libtiff/html/images/info.gif +0 -0
  181. data/vendor/gitlab.com/libtiff/libtiff/html/images/jello.jpg +0 -0
  182. data/vendor/gitlab.com/libtiff/libtiff/html/images/jim.gif +0 -0
  183. data/vendor/gitlab.com/libtiff/libtiff/html/images/note.gif +0 -0
  184. data/vendor/gitlab.com/libtiff/libtiff/html/images/oxford.gif +0 -0
  185. data/vendor/gitlab.com/libtiff/libtiff/html/images/quad.jpg +0 -0
  186. data/vendor/gitlab.com/libtiff/libtiff/html/images/ring.gif +0 -0
  187. data/vendor/gitlab.com/libtiff/libtiff/html/images/smallliz.jpg +0 -0
  188. data/vendor/gitlab.com/libtiff/libtiff/html/images/strike.gif +0 -0
  189. data/vendor/gitlab.com/libtiff/libtiff/html/images/warning.gif +0 -0
  190. data/vendor/gitlab.com/libtiff/libtiff/html/index.html +122 -0
  191. data/vendor/gitlab.com/libtiff/libtiff/html/internals.html +572 -0
  192. data/vendor/gitlab.com/libtiff/libtiff/html/intro.html +68 -0
  193. data/vendor/gitlab.com/libtiff/libtiff/html/libtiff.html +747 -0
  194. data/vendor/gitlab.com/libtiff/libtiff/html/man/.cvsignore +2 -0
  195. data/vendor/gitlab.com/libtiff/libtiff/html/man/CMakeLists.txt +108 -0
  196. data/vendor/gitlab.com/libtiff/libtiff/html/man/HtmlDoc.cmake +50 -0
  197. data/vendor/gitlab.com/libtiff/libtiff/html/man/Makefile.am +122 -0
  198. data/vendor/gitlab.com/libtiff/libtiff/html/man/Makefile.in +642 -0
  199. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFClose.3tiff.html +87 -0
  200. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFDataWidth.3tiff.html +98 -0
  201. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFError.3tiff.html +106 -0
  202. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFFieldDataType.3tiff.html +89 -0
  203. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFFieldName.3tiff.html +86 -0
  204. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFFieldPassCount.3tiff.html +98 -0
  205. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFFieldReadCount.3tiff.html +101 -0
  206. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFFieldTag.3tiff.html +88 -0
  207. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFFieldWriteCount.3tiff.html +108 -0
  208. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFFlush.3tiff.html +113 -0
  209. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFGetField.3tiff.html +1969 -0
  210. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFOpen.3tiff.html +421 -0
  211. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFPrintDirectory.3tiff.html +225 -0
  212. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFRGBAImage.3tiff.html +319 -0
  213. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFReadDirectory.3tiff.html +218 -0
  214. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFReadEncodedStrip.3tiff.html +133 -0
  215. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFReadEncodedTile.3tiff.html +130 -0
  216. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFReadRGBAImage.3tiff.html +301 -0
  217. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFReadRGBAStrip.3tiff.html +208 -0
  218. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFReadRGBATile.3tiff.html +261 -0
  219. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFReadRawStrip.3tiff.html +109 -0
  220. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFReadRawTile.3tiff.html +111 -0
  221. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFReadScanline.3tiff.html +157 -0
  222. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFReadTile.3tiff.html +133 -0
  223. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFSetDirectory.3tiff.html +122 -0
  224. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFSetField.3tiff.html +1865 -0
  225. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFWarning.3tiff.html +108 -0
  226. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFWriteDirectory.3tiff.html +176 -0
  227. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFWriteEncodedStrip.3tiff.html +153 -0
  228. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFWriteEncodedTile.3tiff.html +147 -0
  229. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFWriteRawStrip.3tiff.html +144 -0
  230. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFWriteRawTile.3tiff.html +128 -0
  231. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFWriteScanline.3tiff.html +206 -0
  232. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFWriteTile.3tiff.html +115 -0
  233. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFbuffer.3tiff.html +116 -0
  234. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFcodec.3tiff.html +116 -0
  235. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFcolor.3tiff.html +975 -0
  236. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFmemory.3tiff.html +110 -0
  237. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFquery.3tiff.html +148 -0
  238. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFsize.3tiff.html +95 -0
  239. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFstrip.3tiff.html +129 -0
  240. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFswab.3tiff.html +110 -0
  241. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFtile.3tiff.html +141 -0
  242. data/vendor/gitlab.com/libtiff/libtiff/html/man/fax2ps.1.html +252 -0
  243. data/vendor/gitlab.com/libtiff/libtiff/html/man/fax2tiff.1.html +607 -0
  244. data/vendor/gitlab.com/libtiff/libtiff/html/man/index.html +64 -0
  245. data/vendor/gitlab.com/libtiff/libtiff/html/man/libtiff.3tiff.html +1150 -0
  246. data/vendor/gitlab.com/libtiff/libtiff/html/man/pal2rgb.1.html +189 -0
  247. data/vendor/gitlab.com/libtiff/libtiff/html/man/ppm2tiff.1.html +141 -0
  248. data/vendor/gitlab.com/libtiff/libtiff/html/man/raw2tiff.1.html +510 -0
  249. data/vendor/gitlab.com/libtiff/libtiff/html/man/rgb2ycbcr.1.html +155 -0
  250. data/vendor/gitlab.com/libtiff/libtiff/html/man/thumbnail.1.html +148 -0
  251. data/vendor/gitlab.com/libtiff/libtiff/html/man/tiff2bw.1.html +161 -0
  252. data/vendor/gitlab.com/libtiff/libtiff/html/man/tiff2pdf.1.html +609 -0
  253. data/vendor/gitlab.com/libtiff/libtiff/html/man/tiff2ps.1.html +639 -0
  254. data/vendor/gitlab.com/libtiff/libtiff/html/man/tiff2rgba.1.html +162 -0
  255. data/vendor/gitlab.com/libtiff/libtiff/html/man/tiffcmp.1.html +156 -0
  256. data/vendor/gitlab.com/libtiff/libtiff/html/man/tiffcp.1.html +569 -0
  257. data/vendor/gitlab.com/libtiff/libtiff/html/man/tiffcrop.1.html +684 -0
  258. data/vendor/gitlab.com/libtiff/libtiff/html/man/tiffdither.1.html +196 -0
  259. data/vendor/gitlab.com/libtiff/libtiff/html/man/tiffdump.1.html +145 -0
  260. data/vendor/gitlab.com/libtiff/libtiff/html/man/tiffgt.1.html +551 -0
  261. data/vendor/gitlab.com/libtiff/libtiff/html/man/tiffinfo.1.html +196 -0
  262. data/vendor/gitlab.com/libtiff/libtiff/html/man/tiffmedian.1.html +183 -0
  263. data/vendor/gitlab.com/libtiff/libtiff/html/man/tiffset.1.html +176 -0
  264. data/vendor/gitlab.com/libtiff/libtiff/html/man/tiffsplit.1.html +102 -0
  265. data/vendor/gitlab.com/libtiff/libtiff/html/misc.html +117 -0
  266. data/vendor/gitlab.com/libtiff/libtiff/html/support.html +655 -0
  267. data/vendor/gitlab.com/libtiff/libtiff/html/tools.html +137 -0
  268. data/vendor/gitlab.com/libtiff/libtiff/html/v3.4beta007.html +112 -0
  269. data/vendor/gitlab.com/libtiff/libtiff/html/v3.4beta016.html +122 -0
  270. data/vendor/gitlab.com/libtiff/libtiff/html/v3.4beta018.html +84 -0
  271. data/vendor/gitlab.com/libtiff/libtiff/html/v3.4beta024.html +139 -0
  272. data/vendor/gitlab.com/libtiff/libtiff/html/v3.4beta028.html +146 -0
  273. data/vendor/gitlab.com/libtiff/libtiff/html/v3.4beta029.html +86 -0
  274. data/vendor/gitlab.com/libtiff/libtiff/html/v3.4beta031.html +94 -0
  275. data/vendor/gitlab.com/libtiff/libtiff/html/v3.4beta032.html +90 -0
  276. data/vendor/gitlab.com/libtiff/libtiff/html/v3.4beta033.html +82 -0
  277. data/vendor/gitlab.com/libtiff/libtiff/html/v3.4beta034.html +68 -0
  278. data/vendor/gitlab.com/libtiff/libtiff/html/v3.4beta035.html +63 -0
  279. data/vendor/gitlab.com/libtiff/libtiff/html/v3.4beta036.html +117 -0
  280. data/vendor/gitlab.com/libtiff/libtiff/html/v3.5.1.html +75 -0
  281. data/vendor/gitlab.com/libtiff/libtiff/html/v3.5.2.html +108 -0
  282. data/vendor/gitlab.com/libtiff/libtiff/html/v3.5.3.html +132 -0
  283. data/vendor/gitlab.com/libtiff/libtiff/html/v3.5.4.html +88 -0
  284. data/vendor/gitlab.com/libtiff/libtiff/html/v3.5.5.html +155 -0
  285. data/vendor/gitlab.com/libtiff/libtiff/html/v3.5.6-beta.html +185 -0
  286. data/vendor/gitlab.com/libtiff/libtiff/html/v3.5.7.html +259 -0
  287. data/vendor/gitlab.com/libtiff/libtiff/html/v3.6.0.html +434 -0
  288. data/vendor/gitlab.com/libtiff/libtiff/html/v3.6.1.html +199 -0
  289. data/vendor/gitlab.com/libtiff/libtiff/html/v3.7.0.html +144 -0
  290. data/vendor/gitlab.com/libtiff/libtiff/html/v3.7.0alpha.html +249 -0
  291. data/vendor/gitlab.com/libtiff/libtiff/html/v3.7.0beta.html +162 -0
  292. data/vendor/gitlab.com/libtiff/libtiff/html/v3.7.0beta2.html +131 -0
  293. data/vendor/gitlab.com/libtiff/libtiff/html/v3.7.1.html +233 -0
  294. data/vendor/gitlab.com/libtiff/libtiff/html/v3.7.2.html +222 -0
  295. data/vendor/gitlab.com/libtiff/libtiff/html/v3.7.3.html +230 -0
  296. data/vendor/gitlab.com/libtiff/libtiff/html/v3.7.4.html +133 -0
  297. data/vendor/gitlab.com/libtiff/libtiff/html/v3.8.0.html +199 -0
  298. data/vendor/gitlab.com/libtiff/libtiff/html/v3.8.1.html +217 -0
  299. data/vendor/gitlab.com/libtiff/libtiff/html/v3.8.2.html +137 -0
  300. data/vendor/gitlab.com/libtiff/libtiff/html/v3.9.0.html +261 -0
  301. data/vendor/gitlab.com/libtiff/libtiff/html/v3.9.0beta.html +304 -0
  302. data/vendor/gitlab.com/libtiff/libtiff/html/v3.9.1.html +115 -0
  303. data/vendor/gitlab.com/libtiff/libtiff/html/v3.9.2.html +122 -0
  304. data/vendor/gitlab.com/libtiff/libtiff/html/v3.9.3.html +160 -0
  305. data/vendor/gitlab.com/libtiff/libtiff/html/v3.9.4.html +125 -0
  306. data/vendor/gitlab.com/libtiff/libtiff/html/v3.9.5.html +270 -0
  307. data/vendor/gitlab.com/libtiff/libtiff/html/v4.0.0.html +269 -0
  308. data/vendor/gitlab.com/libtiff/libtiff/html/v4.0.1.html +113 -0
  309. data/vendor/gitlab.com/libtiff/libtiff/html/v4.0.2.html +118 -0
  310. data/vendor/gitlab.com/libtiff/libtiff/html/v4.0.3.html +125 -0
  311. data/vendor/gitlab.com/libtiff/libtiff/html/v4.0.4.html +274 -0
  312. data/vendor/gitlab.com/libtiff/libtiff/html/v4.0.4beta.html +291 -0
  313. data/vendor/gitlab.com/libtiff/libtiff/html/v4.0.5.html +148 -0
  314. data/vendor/gitlab.com/libtiff/libtiff/html/v4.0.6.html +139 -0
  315. data/vendor/gitlab.com/libtiff/libtiff/html/v4.0.7.html +411 -0
  316. data/vendor/gitlab.com/libtiff/libtiff/html/v4.0.8.html +445 -0
  317. data/vendor/gitlab.com/libtiff/libtiff/html/v4.0.9.html +373 -0
  318. data/vendor/gitlab.com/libtiff/libtiff/libtiff-4.pc.in +11 -0
  319. data/vendor/gitlab.com/libtiff/libtiff/libtiff/.cvsignore +22 -0
  320. data/vendor/gitlab.com/libtiff/libtiff/libtiff/CMakeLists.txt +165 -0
  321. data/vendor/gitlab.com/libtiff/libtiff/libtiff/Makefile.am +154 -0
  322. data/vendor/gitlab.com/libtiff/libtiff/libtiff/Makefile.in +966 -0
  323. data/vendor/gitlab.com/libtiff/libtiff/libtiff/Makefile.lcc +129 -0
  324. data/vendor/gitlab.com/libtiff/libtiff/libtiff/Makefile.vc +102 -0
  325. data/vendor/gitlab.com/libtiff/libtiff/libtiff/SConstruct +73 -0
  326. data/vendor/gitlab.com/libtiff/libtiff/libtiff/libtiff.def +168 -0
  327. data/vendor/gitlab.com/libtiff/libtiff/libtiff/libtiff.map +4 -0
  328. data/vendor/gitlab.com/libtiff/libtiff/libtiff/libtiffxx.map +4 -0
  329. data/vendor/gitlab.com/libtiff/libtiff/libtiff/mkg3states.c +454 -0
  330. data/vendor/gitlab.com/libtiff/libtiff/libtiff/mkspans.c +82 -0
  331. data/vendor/gitlab.com/libtiff/libtiff/libtiff/t4.h +292 -0
  332. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_aux.c +376 -0
  333. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_close.c +140 -0
  334. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_codec.c +165 -0
  335. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_color.c +309 -0
  336. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_compress.c +304 -0
  337. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_config.h-vms +46 -0
  338. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_config.h.cmake.in +261 -0
  339. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_config.h.in +410 -0
  340. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_config.vc.h +137 -0
  341. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_config.wince.h +71 -0
  342. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_dir.c +1767 -0
  343. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_dir.h +309 -0
  344. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_dirinfo.c +1070 -0
  345. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_dirread.c +5803 -0
  346. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_dirwrite.c +3024 -0
  347. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_dumpmode.c +143 -0
  348. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_error.c +88 -0
  349. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_extension.c +118 -0
  350. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_fax3.c +1648 -0
  351. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_fax3.h +540 -0
  352. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_fax3sm.c +1260 -0
  353. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_flush.c +118 -0
  354. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_getimage.c +3048 -0
  355. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_jbig.c +214 -0
  356. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_jpeg.c +2601 -0
  357. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_jpeg_12.c +69 -0
  358. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_luv.c +1765 -0
  359. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_lzma.c +495 -0
  360. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_lzw.c +1218 -0
  361. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_next.c +189 -0
  362. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_ojpeg.c +2563 -0
  363. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_open.c +725 -0
  364. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_packbits.c +311 -0
  365. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_pixarlog.c +1485 -0
  366. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_predict.c +881 -0
  367. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_predict.h +79 -0
  368. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_print.c +722 -0
  369. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_read.c +1572 -0
  370. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_stream.cxx +430 -0
  371. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_strip.c +389 -0
  372. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_swab.c +312 -0
  373. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_thunder.c +208 -0
  374. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_tile.c +322 -0
  375. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_unix.c +386 -0
  376. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_version.c +40 -0
  377. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_vms.c +611 -0
  378. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_warning.c +89 -0
  379. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_win32.c +476 -0
  380. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_wince.c +293 -0
  381. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_write.c +834 -0
  382. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_zip.c +476 -0
  383. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tiff.h +681 -0
  384. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tiffconf.h-vms +99 -0
  385. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tiffconf.h.cmake.in +130 -0
  386. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tiffconf.h.in +127 -0
  387. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tiffconf.vc.h +161 -0
  388. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tiffconf.wince.h +121 -0
  389. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tiffio.h +560 -0
  390. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tiffio.hxx +49 -0
  391. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tiffiop.h +445 -0
  392. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tiffvers.h +9 -0
  393. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tiffvers.h.in +9 -0
  394. data/vendor/gitlab.com/libtiff/libtiff/libtiff/uvcode.h +180 -0
  395. data/vendor/gitlab.com/libtiff/libtiff/m4/acinclude.m4 +851 -0
  396. data/vendor/gitlab.com/libtiff/libtiff/m4/ice_find_athena.m4 +187 -0
  397. data/vendor/gitlab.com/libtiff/libtiff/m4/libtool.m4 +8388 -0
  398. data/vendor/gitlab.com/libtiff/libtiff/m4/ltoptions.m4 +437 -0
  399. data/vendor/gitlab.com/libtiff/libtiff/m4/ltsugar.m4 +124 -0
  400. data/vendor/gitlab.com/libtiff/libtiff/m4/ltversion.m4 +23 -0
  401. data/vendor/gitlab.com/libtiff/libtiff/m4/lt~obsolete.m4 +99 -0
  402. data/vendor/gitlab.com/libtiff/libtiff/man/.cvsignore +3 -0
  403. data/vendor/gitlab.com/libtiff/libtiff/man/CMakeLists.txt +97 -0
  404. data/vendor/gitlab.com/libtiff/libtiff/man/Makefile.am +94 -0
  405. data/vendor/gitlab.com/libtiff/libtiff/man/Makefile.in +684 -0
  406. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFClose.3tiff +53 -0
  407. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFDataWidth.3tiff +74 -0
  408. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFError.3tiff +69 -0
  409. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFFieldDataType.3tiff +53 -0
  410. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFFieldName.3tiff +52 -0
  411. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFFieldPassCount.3tiff +73 -0
  412. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFFieldReadCount.3tiff +77 -0
  413. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFFieldTag.3tiff +56 -0
  414. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFFieldWriteCount.3tiff +88 -0
  415. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFFlush.3tiff +64 -0
  416. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFGetField.3tiff +229 -0
  417. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFOpen.3tiff +279 -0
  418. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFPrintDirectory.3tiff +70 -0
  419. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFRGBAImage.3tiff +286 -0
  420. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFReadDirectory.3tiff +164 -0
  421. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFReadEncodedStrip.3tiff +78 -0
  422. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFReadEncodedTile.3tiff +76 -0
  423. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFReadRGBAImage.3tiff +218 -0
  424. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFReadRGBAStrip.3tiff +170 -0
  425. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFReadRGBATile.3tiff +171 -0
  426. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFReadRawStrip.3tiff +64 -0
  427. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFReadRawTile.3tiff +65 -0
  428. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFReadScanline.3tiff +94 -0
  429. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFReadTile.3tiff +84 -0
  430. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFSetDirectory.3tiff +79 -0
  431. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFSetField.3tiff +217 -0
  432. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFWarning.3tiff +70 -0
  433. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFWriteDirectory.3tiff +138 -0
  434. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFWriteEncodedStrip.3tiff +102 -0
  435. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFWriteEncodedTile.3tiff +96 -0
  436. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFWriteRawStrip.3tiff +96 -0
  437. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFWriteRawTile.3tiff +84 -0
  438. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFWriteScanline.3tiff +154 -0
  439. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFWriteTile.3tiff +77 -0
  440. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFbuffer.3tiff +77 -0
  441. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFcodec.3tiff +82 -0
  442. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFcolor.3tiff +268 -0
  443. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFmemory.3tiff +90 -0
  444. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFquery.3tiff +142 -0
  445. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFsize.3tiff +59 -0
  446. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFstrip.3tiff +99 -0
  447. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFswab.3tiff +80 -0
  448. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFtile.3tiff +131 -0
  449. data/vendor/gitlab.com/libtiff/libtiff/man/fax2ps.1 +159 -0
  450. data/vendor/gitlab.com/libtiff/libtiff/man/fax2tiff.1 +286 -0
  451. data/vendor/gitlab.com/libtiff/libtiff/man/libtiff.3tiff +545 -0
  452. data/vendor/gitlab.com/libtiff/libtiff/man/pal2rgb.1 +111 -0
  453. data/vendor/gitlab.com/libtiff/libtiff/man/ppm2tiff.1 +105 -0
  454. data/vendor/gitlab.com/libtiff/libtiff/man/raw2tiff.1 +196 -0
  455. data/vendor/gitlab.com/libtiff/libtiff/man/rgb2ycbcr.1 +99 -0
  456. data/vendor/gitlab.com/libtiff/libtiff/man/thumbnail.1 +90 -0
  457. data/vendor/gitlab.com/libtiff/libtiff/man/tiff2bw.1 +94 -0
  458. data/vendor/gitlab.com/libtiff/libtiff/man/tiff2pdf.1 +254 -0
  459. data/vendor/gitlab.com/libtiff/libtiff/man/tiff2ps.1 +294 -0
  460. data/vendor/gitlab.com/libtiff/libtiff/man/tiff2rgba.1 +97 -0
  461. data/vendor/gitlab.com/libtiff/libtiff/man/tiffcmp.1 +87 -0
  462. data/vendor/gitlab.com/libtiff/libtiff/man/tiffcp.1 +317 -0
  463. data/vendor/gitlab.com/libtiff/libtiff/man/tiffcrop.1 +571 -0
  464. data/vendor/gitlab.com/libtiff/libtiff/man/tiffdither.1 +135 -0
  465. data/vendor/gitlab.com/libtiff/libtiff/man/tiffdump.1 +81 -0
  466. data/vendor/gitlab.com/libtiff/libtiff/man/tiffgt.1 +245 -0
  467. data/vendor/gitlab.com/libtiff/libtiff/man/tiffinfo.1 +88 -0
  468. data/vendor/gitlab.com/libtiff/libtiff/man/tiffmedian.1 +112 -0
  469. data/vendor/gitlab.com/libtiff/libtiff/man/tiffset.1 +99 -0
  470. data/vendor/gitlab.com/libtiff/libtiff/man/tiffsplit.1 +69 -0
  471. data/vendor/gitlab.com/libtiff/libtiff/nmake.opt +229 -0
  472. data/vendor/gitlab.com/libtiff/libtiff/port/.cvsignore +7 -0
  473. data/vendor/gitlab.com/libtiff/libtiff/port/CMakeLists.txt +60 -0
  474. data/vendor/gitlab.com/libtiff/libtiff/port/Makefile.am +35 -0
  475. data/vendor/gitlab.com/libtiff/libtiff/port/Makefile.in +656 -0
  476. data/vendor/gitlab.com/libtiff/libtiff/port/Makefile.vc +44 -0
  477. data/vendor/gitlab.com/libtiff/libtiff/port/dummy.c +12 -0
  478. data/vendor/gitlab.com/libtiff/libtiff/port/getopt.c +125 -0
  479. data/vendor/gitlab.com/libtiff/libtiff/port/lfind.c +62 -0
  480. data/vendor/gitlab.com/libtiff/libtiff/port/libport.h +60 -0
  481. data/vendor/gitlab.com/libtiff/libtiff/port/snprintf.c +38 -0
  482. data/vendor/gitlab.com/libtiff/libtiff/port/strcasecmp.c +51 -0
  483. data/vendor/gitlab.com/libtiff/libtiff/port/strtoul.c +109 -0
  484. data/vendor/gitlab.com/libtiff/libtiff/port/strtoull.c +116 -0
  485. data/vendor/gitlab.com/libtiff/libtiff/test/.cvsignore +12 -0
  486. data/vendor/gitlab.com/libtiff/libtiff/test/CMakeLists.txt +382 -0
  487. data/vendor/gitlab.com/libtiff/libtiff/test/Makefile.am +334 -0
  488. data/vendor/gitlab.com/libtiff/libtiff/test/Makefile.in +1987 -0
  489. data/vendor/gitlab.com/libtiff/libtiff/test/TiffSplitTest.cmake +34 -0
  490. data/vendor/gitlab.com/libtiff/libtiff/test/TiffTest.cmake +63 -0
  491. data/vendor/gitlab.com/libtiff/libtiff/test/TiffTestCommon.cmake +108 -0
  492. data/vendor/gitlab.com/libtiff/libtiff/test/ascii_tag.c +177 -0
  493. data/vendor/gitlab.com/libtiff/libtiff/test/check_tag.c +91 -0
  494. data/vendor/gitlab.com/libtiff/libtiff/test/common.sh +122 -0
  495. data/vendor/gitlab.com/libtiff/libtiff/test/custom_dir.c +247 -0
  496. data/vendor/gitlab.com/libtiff/libtiff/test/images/README.txt +29 -0
  497. data/vendor/gitlab.com/libtiff/libtiff/test/images/logluv-3c-16b.tiff +0 -0
  498. data/vendor/gitlab.com/libtiff/libtiff/test/images/minisblack-1c-16b.tiff +0 -0
  499. data/vendor/gitlab.com/libtiff/libtiff/test/images/minisblack-1c-8b.pgm +0 -0
  500. data/vendor/gitlab.com/libtiff/libtiff/test/images/minisblack-1c-8b.tiff +0 -0
  501. data/vendor/gitlab.com/libtiff/libtiff/test/images/minisblack-2c-8b-alpha.tiff +0 -0
  502. data/vendor/gitlab.com/libtiff/libtiff/test/images/miniswhite-1c-1b.pbm +0 -0
  503. data/vendor/gitlab.com/libtiff/libtiff/test/images/miniswhite-1c-1b.tiff +0 -0
  504. data/vendor/gitlab.com/libtiff/libtiff/test/images/palette-1c-1b.tiff +0 -0
  505. data/vendor/gitlab.com/libtiff/libtiff/test/images/palette-1c-4b.tiff +0 -0
  506. data/vendor/gitlab.com/libtiff/libtiff/test/images/palette-1c-8b.tiff +0 -0
  507. data/vendor/gitlab.com/libtiff/libtiff/test/images/quad-lzw-compat.tiff +0 -0
  508. data/vendor/gitlab.com/libtiff/libtiff/test/images/quad-tile.jpg.tiff +0 -0
  509. data/vendor/gitlab.com/libtiff/libtiff/test/images/rgb-3c-16b.tiff +0 -0
  510. data/vendor/gitlab.com/libtiff/libtiff/test/images/rgb-3c-8b.ppm +0 -0
  511. data/vendor/gitlab.com/libtiff/libtiff/test/images/rgb-3c-8b.tiff +0 -0
  512. data/vendor/gitlab.com/libtiff/libtiff/test/long_tag.c +156 -0
  513. data/vendor/gitlab.com/libtiff/libtiff/test/ppm2tiff_pbm.sh +7 -0
  514. data/vendor/gitlab.com/libtiff/libtiff/test/ppm2tiff_pgm.sh +7 -0
  515. data/vendor/gitlab.com/libtiff/libtiff/test/ppm2tiff_ppm.sh +7 -0
  516. data/vendor/gitlab.com/libtiff/libtiff/test/raw_decode.c +304 -0
  517. data/vendor/gitlab.com/libtiff/libtiff/test/rewrite_tag.c +344 -0
  518. data/vendor/gitlab.com/libtiff/libtiff/test/short_tag.c +205 -0
  519. data/vendor/gitlab.com/libtiff/libtiff/test/strip.c +290 -0
  520. data/vendor/gitlab.com/libtiff/libtiff/test/strip_rw.c +157 -0
  521. data/vendor/gitlab.com/libtiff/libtiff/test/test_arrays.c +829 -0
  522. data/vendor/gitlab.com/libtiff/libtiff/test/test_arrays.h +63 -0
  523. data/vendor/gitlab.com/libtiff/libtiff/test/tiff2bw-palette-1c-8b.sh +7 -0
  524. data/vendor/gitlab.com/libtiff/libtiff/test/tiff2bw-quad-lzw-compat.sh +7 -0
  525. data/vendor/gitlab.com/libtiff/libtiff/test/tiff2bw-rgb-3c-8b.sh +7 -0
  526. data/vendor/gitlab.com/libtiff/libtiff/test/tiff2pdf.sh +6 -0
  527. data/vendor/gitlab.com/libtiff/libtiff/test/tiff2ps-EPS1.sh +6 -0
  528. data/vendor/gitlab.com/libtiff/libtiff/test/tiff2ps-PS1.sh +6 -0
  529. data/vendor/gitlab.com/libtiff/libtiff/test/tiff2ps-PS2.sh +6 -0
  530. data/vendor/gitlab.com/libtiff/libtiff/test/tiff2ps-PS3.sh +6 -0
  531. data/vendor/gitlab.com/libtiff/libtiff/test/tiff2rgba-logluv-3c-16b.sh +7 -0
  532. data/vendor/gitlab.com/libtiff/libtiff/test/tiff2rgba-minisblack-1c-16b.sh +7 -0
  533. data/vendor/gitlab.com/libtiff/libtiff/test/tiff2rgba-minisblack-1c-8b.sh +7 -0
  534. data/vendor/gitlab.com/libtiff/libtiff/test/tiff2rgba-minisblack-2c-8b-alpha.sh +7 -0
  535. data/vendor/gitlab.com/libtiff/libtiff/test/tiff2rgba-miniswhite-1c-1b.sh +7 -0
  536. data/vendor/gitlab.com/libtiff/libtiff/test/tiff2rgba-palette-1c-1b.sh +7 -0
  537. data/vendor/gitlab.com/libtiff/libtiff/test/tiff2rgba-palette-1c-4b.sh +7 -0
  538. data/vendor/gitlab.com/libtiff/libtiff/test/tiff2rgba-palette-1c-8b.sh +7 -0
  539. data/vendor/gitlab.com/libtiff/libtiff/test/tiff2rgba-quad-tile.jpg.sh +7 -0
  540. data/vendor/gitlab.com/libtiff/libtiff/test/tiff2rgba-rgb-3c-16b.sh +7 -0
  541. data/vendor/gitlab.com/libtiff/libtiff/test/tiff2rgba-rgb-3c-8b.sh +7 -0
  542. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcp-g3-1d-fill.sh +7 -0
  543. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcp-g3-1d.sh +6 -0
  544. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcp-g3-2d-fill.sh +7 -0
  545. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcp-g3-2d.sh +6 -0
  546. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcp-g3.sh +6 -0
  547. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcp-g4.sh +6 -0
  548. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcp-logluv.sh +7 -0
  549. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcp-lzw-compat.sh +6 -0
  550. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcp-split-join.sh +16 -0
  551. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcp-split.sh +13 -0
  552. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcp-thumbnail.sh +10 -0
  553. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-R90-logluv-3c-16b.sh +7 -0
  554. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-R90-minisblack-1c-16b.sh +7 -0
  555. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-R90-minisblack-1c-8b.sh +7 -0
  556. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-R90-minisblack-2c-8b-alpha.sh +7 -0
  557. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-R90-miniswhite-1c-1b.sh +7 -0
  558. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-R90-palette-1c-1b.sh +7 -0
  559. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-R90-palette-1c-4b.sh +7 -0
  560. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-R90-palette-1c-8b.sh +7 -0
  561. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-R90-quad-tile.jpg.sh +7 -0
  562. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-R90-rgb-3c-16b.sh +7 -0
  563. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-R90-rgb-3c-8b.sh +7 -0
  564. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-doubleflip-logluv-3c-16b.sh +7 -0
  565. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-doubleflip-minisblack-1c-16b.sh +7 -0
  566. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-doubleflip-minisblack-1c-8b.sh +7 -0
  567. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-doubleflip-minisblack-2c-8b-alpha.sh +7 -0
  568. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-doubleflip-miniswhite-1c-1b.sh +7 -0
  569. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-doubleflip-palette-1c-1b.sh +7 -0
  570. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-doubleflip-palette-1c-4b.sh +7 -0
  571. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-doubleflip-palette-1c-8b.sh +7 -0
  572. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-doubleflip-quad-tile.jpg.sh +7 -0
  573. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-doubleflip-rgb-3c-16b.sh +7 -0
  574. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-doubleflip-rgb-3c-8b.sh +7 -0
  575. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-extract-logluv-3c-16b.sh +7 -0
  576. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-extract-minisblack-1c-16b.sh +7 -0
  577. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-extract-minisblack-1c-8b.sh +7 -0
  578. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-extract-minisblack-2c-8b-alpha.sh +7 -0
  579. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-extract-miniswhite-1c-1b.sh +7 -0
  580. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-extract-palette-1c-1b.sh +7 -0
  581. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-extract-palette-1c-4b.sh +7 -0
  582. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-extract-palette-1c-8b.sh +7 -0
  583. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-extract-quad-tile.jpg.sh +7 -0
  584. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-extract-rgb-3c-16b.sh +7 -0
  585. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-extract-rgb-3c-8b.sh +7 -0
  586. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-extractz14-logluv-3c-16b.sh +7 -0
  587. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-extractz14-minisblack-1c-16b.sh +7 -0
  588. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-extractz14-minisblack-1c-8b.sh +7 -0
  589. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-extractz14-minisblack-2c-8b-alpha.sh +7 -0
  590. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-extractz14-miniswhite-1c-1b.sh +7 -0
  591. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-extractz14-palette-1c-1b.sh +7 -0
  592. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-extractz14-palette-1c-4b.sh +7 -0
  593. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-extractz14-palette-1c-8b.sh +7 -0
  594. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-extractz14-quad-tile.jpg.sh +7 -0
  595. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-extractz14-rgb-3c-16b.sh +7 -0
  596. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-extractz14-rgb-3c-8b.sh +7 -0
  597. data/vendor/gitlab.com/libtiff/libtiff/test/tiffdump.sh +6 -0
  598. data/vendor/gitlab.com/libtiff/libtiff/test/tiffinfo.sh +6 -0
  599. data/vendor/gitlab.com/libtiff/libtiff/test/tifftest.h +42 -0
  600. data/vendor/gitlab.com/libtiff/libtiff/tiff.spec +68 -0
  601. data/vendor/gitlab.com/libtiff/libtiff/tools/.cvsignore +27 -0
  602. data/vendor/gitlab.com/libtiff/libtiff/tools/CMakeLists.txt +125 -0
  603. data/vendor/gitlab.com/libtiff/libtiff/tools/Makefile.am +138 -0
  604. data/vendor/gitlab.com/libtiff/libtiff/tools/Makefile.in +955 -0
  605. data/vendor/gitlab.com/libtiff/libtiff/tools/Makefile.lcc +133 -0
  606. data/vendor/gitlab.com/libtiff/libtiff/tools/Makefile.vc +52 -0
  607. data/vendor/gitlab.com/libtiff/libtiff/tools/fax2ps.c +463 -0
  608. data/vendor/gitlab.com/libtiff/libtiff/tools/fax2tiff.c +491 -0
  609. data/vendor/gitlab.com/libtiff/libtiff/tools/pal2rgb.c +438 -0
  610. data/vendor/gitlab.com/libtiff/libtiff/tools/ppm2tiff.c +397 -0
  611. data/vendor/gitlab.com/libtiff/libtiff/tools/raw2tiff.c +690 -0
  612. data/vendor/gitlab.com/libtiff/libtiff/tools/rgb2ycbcr.c +397 -0
  613. data/vendor/gitlab.com/libtiff/libtiff/tools/thumbnail.c +691 -0
  614. data/vendor/gitlab.com/libtiff/libtiff/tools/tiff2bw.c +501 -0
  615. data/vendor/gitlab.com/libtiff/libtiff/tools/tiff2pdf.c +5594 -0
  616. data/vendor/gitlab.com/libtiff/libtiff/tools/tiff2ps.c +3106 -0
  617. data/vendor/gitlab.com/libtiff/libtiff/tools/tiff2rgba.c +569 -0
  618. data/vendor/gitlab.com/libtiff/libtiff/tools/tiffcmp.c +659 -0
  619. data/vendor/gitlab.com/libtiff/libtiff/tools/tiffcp.c +1913 -0
  620. data/vendor/gitlab.com/libtiff/libtiff/tools/tiffcrop.c +9231 -0
  621. data/vendor/gitlab.com/libtiff/libtiff/tools/tiffdither.c +347 -0
  622. data/vendor/gitlab.com/libtiff/libtiff/tools/tiffdump.c +889 -0
  623. data/vendor/gitlab.com/libtiff/libtiff/tools/tiffgt.c +486 -0
  624. data/vendor/gitlab.com/libtiff/libtiff/tools/tiffinfo.c +488 -0
  625. data/vendor/gitlab.com/libtiff/libtiff/tools/tiffinfoce.c +472 -0
  626. data/vendor/gitlab.com/libtiff/libtiff/tools/tiffmedian.c +918 -0
  627. data/vendor/gitlab.com/libtiff/libtiff/tools/tiffset.c +356 -0
  628. data/vendor/gitlab.com/libtiff/libtiff/tools/tiffsplit.c +305 -0
  629. metadata +692 -0
@@ -0,0 +1,69 @@
1
+
2
+ #include "tiffiop.h"
3
+
4
+ #if defined(JPEG_DUAL_MODE_8_12)
5
+
6
+ # define TIFFInitJPEG TIFFInitJPEG_12
7
+ # define TIFFJPEGIsFullStripRequired TIFFJPEGIsFullStripRequired_12
8
+
9
+ int
10
+ TIFFInitJPEG_12(TIFF* tif, int scheme);
11
+
12
+ # include LIBJPEG_12_PATH
13
+
14
+ # include "tif_jpeg.c"
15
+
16
+ int TIFFReInitJPEG_12( TIFF *tif, int scheme, int is_encode )
17
+
18
+ {
19
+ JPEGState* sp;
20
+
21
+ assert(scheme == COMPRESSION_JPEG);
22
+
23
+ sp = JState(tif);
24
+ sp->tif = tif; /* back link */
25
+
26
+ /*
27
+ * Override parent get/set field methods.
28
+ */
29
+ tif->tif_tagmethods.vgetfield = JPEGVGetField; /* hook for codec tags */
30
+ tif->tif_tagmethods.vsetfield = JPEGVSetField; /* hook for codec tags */
31
+ tif->tif_tagmethods.printdir = JPEGPrintDir; /* hook for codec tags */
32
+
33
+ /*
34
+ * Install codec methods.
35
+ */
36
+ tif->tif_fixuptags = JPEGFixupTags;
37
+ tif->tif_setupdecode = JPEGSetupDecode;
38
+ tif->tif_predecode = JPEGPreDecode;
39
+ tif->tif_decoderow = JPEGDecode;
40
+ tif->tif_decodestrip = JPEGDecode;
41
+ tif->tif_decodetile = JPEGDecode;
42
+ tif->tif_setupencode = JPEGSetupEncode;
43
+ tif->tif_preencode = JPEGPreEncode;
44
+ tif->tif_postencode = JPEGPostEncode;
45
+ tif->tif_encoderow = JPEGEncode;
46
+ tif->tif_encodestrip = JPEGEncode;
47
+ tif->tif_encodetile = JPEGEncode;
48
+ tif->tif_cleanup = JPEGCleanup;
49
+ tif->tif_defstripsize = JPEGDefaultStripSize;
50
+ tif->tif_deftilesize = JPEGDefaultTileSize;
51
+ tif->tif_flags |= TIFF_NOBITREV; /* no bit reversal, please */
52
+
53
+ sp->cinfo_initialized = FALSE;
54
+
55
+ if( is_encode )
56
+ return JPEGSetupEncode(tif);
57
+ else
58
+ return JPEGSetupDecode(tif);
59
+ }
60
+
61
+ #endif /* defined(JPEG_DUAL_MODE_8_12) */
62
+
63
+ /*
64
+ * Local Variables:
65
+ * mode: c
66
+ * c-basic-offset: 8
67
+ * fill-column: 78
68
+ * End:
69
+ */
@@ -0,0 +1,1765 @@
1
+ /* $Id: tif_luv.c,v 1.49 2017-07-24 12:47:30 erouault Exp $ */
2
+
3
+ /*
4
+ * Copyright (c) 1997 Greg Ward Larson
5
+ * Copyright (c) 1997 Silicon Graphics, Inc.
6
+ *
7
+ * Permission to use, copy, modify, distribute, and sell this software and
8
+ * its documentation for any purpose is hereby granted without fee, provided
9
+ * that (i) the above copyright notices and this permission notice appear in
10
+ * all copies of the software and related documentation, and (ii) the names of
11
+ * Sam Leffler, Greg Larson and Silicon Graphics may not be used in any
12
+ * advertising or publicity relating to the software without the specific,
13
+ * prior written permission of Sam Leffler, Greg Larson and Silicon Graphics.
14
+ *
15
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
16
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
17
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
18
+ *
19
+ * IN NO EVENT SHALL SAM LEFFLER, GREG LARSON OR SILICON GRAPHICS BE LIABLE
20
+ * FOR ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
21
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
22
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
23
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
24
+ * OF THIS SOFTWARE.
25
+ */
26
+
27
+ #include "tiffiop.h"
28
+ #ifdef LOGLUV_SUPPORT
29
+
30
+ /*
31
+ * TIFF Library.
32
+ * LogLuv compression support for high dynamic range images.
33
+ *
34
+ * Contributed by Greg Larson.
35
+ *
36
+ * LogLuv image support uses the TIFF library to store 16 or 10-bit
37
+ * log luminance values with 8 bits each of u and v or a 14-bit index.
38
+ *
39
+ * The codec can take as input and produce as output 32-bit IEEE float values
40
+ * as well as 16-bit integer values. A 16-bit luminance is interpreted
41
+ * as a sign bit followed by a 15-bit integer that is converted
42
+ * to and from a linear magnitude using the transformation:
43
+ *
44
+ * L = 2^( (Le+.5)/256 - 64 ) # real from 15-bit
45
+ *
46
+ * Le = floor( 256*(log2(L) + 64) ) # 15-bit from real
47
+ *
48
+ * The actual conversion to world luminance units in candelas per sq. meter
49
+ * requires an additional multiplier, which is stored in the TIFFTAG_STONITS.
50
+ * This value is usually set such that a reasonable exposure comes from
51
+ * clamping decoded luminances above 1 to 1 in the displayed image.
52
+ *
53
+ * The 16-bit values for u and v may be converted to real values by dividing
54
+ * each by 32768. (This allows for negative values, which aren't useful as
55
+ * far as we know, but are left in case of future improvements in human
56
+ * color vision.)
57
+ *
58
+ * Conversion from (u,v), which is actually the CIE (u',v') system for
59
+ * you color scientists, is accomplished by the following transformation:
60
+ *
61
+ * u = 4*x / (-2*x + 12*y + 3)
62
+ * v = 9*y / (-2*x + 12*y + 3)
63
+ *
64
+ * x = 9*u / (6*u - 16*v + 12)
65
+ * y = 4*v / (6*u - 16*v + 12)
66
+ *
67
+ * This process is greatly simplified by passing 32-bit IEEE floats
68
+ * for each of three CIE XYZ coordinates. The codec then takes care
69
+ * of conversion to and from LogLuv, though the application is still
70
+ * responsible for interpreting the TIFFTAG_STONITS calibration factor.
71
+ *
72
+ * By definition, a CIE XYZ vector of [1 1 1] corresponds to a neutral white
73
+ * point of (x,y)=(1/3,1/3). However, most color systems assume some other
74
+ * white point, such as D65, and an absolute color conversion to XYZ then
75
+ * to another color space with a different white point may introduce an
76
+ * unwanted color cast to the image. It is often desirable, therefore, to
77
+ * perform a white point conversion that maps the input white to [1 1 1]
78
+ * in XYZ, then record the original white point using the TIFFTAG_WHITEPOINT
79
+ * tag value. A decoder that demands absolute color calibration may use
80
+ * this white point tag to get back the original colors, but usually it
81
+ * will be ignored and the new white point will be used instead that
82
+ * matches the output color space.
83
+ *
84
+ * Pixel information is compressed into one of two basic encodings, depending
85
+ * on the setting of the compression tag, which is one of COMPRESSION_SGILOG
86
+ * or COMPRESSION_SGILOG24. For COMPRESSION_SGILOG, greyscale data is
87
+ * stored as:
88
+ *
89
+ * 1 15
90
+ * |-+---------------|
91
+ *
92
+ * COMPRESSION_SGILOG color data is stored as:
93
+ *
94
+ * 1 15 8 8
95
+ * |-+---------------|--------+--------|
96
+ * S Le ue ve
97
+ *
98
+ * For the 24-bit COMPRESSION_SGILOG24 color format, the data is stored as:
99
+ *
100
+ * 10 14
101
+ * |----------|--------------|
102
+ * Le' Ce
103
+ *
104
+ * There is no sign bit in the 24-bit case, and the (u,v) chromaticity is
105
+ * encoded as an index for optimal color resolution. The 10 log bits are
106
+ * defined by the following conversions:
107
+ *
108
+ * L = 2^((Le'+.5)/64 - 12) # real from 10-bit
109
+ *
110
+ * Le' = floor( 64*(log2(L) + 12) ) # 10-bit from real
111
+ *
112
+ * The 10 bits of the smaller format may be converted into the 15 bits of
113
+ * the larger format by multiplying by 4 and adding 13314. Obviously,
114
+ * a smaller range of magnitudes is covered (about 5 orders of magnitude
115
+ * instead of 38), and the lack of a sign bit means that negative luminances
116
+ * are not allowed. (Well, they aren't allowed in the real world, either,
117
+ * but they are useful for certain types of image processing.)
118
+ *
119
+ * The desired user format is controlled by the setting the internal
120
+ * pseudo tag TIFFTAG_SGILOGDATAFMT to one of:
121
+ * SGILOGDATAFMT_FLOAT = IEEE 32-bit float XYZ values
122
+ * SGILOGDATAFMT_16BIT = 16-bit integer encodings of logL, u and v
123
+ * Raw data i/o is also possible using:
124
+ * SGILOGDATAFMT_RAW = 32-bit unsigned integer with encoded pixel
125
+ * In addition, the following decoding is provided for ease of display:
126
+ * SGILOGDATAFMT_8BIT = 8-bit default RGB gamma-corrected values
127
+ *
128
+ * For grayscale images, we provide the following data formats:
129
+ * SGILOGDATAFMT_FLOAT = IEEE 32-bit float Y values
130
+ * SGILOGDATAFMT_16BIT = 16-bit integer w/ encoded luminance
131
+ * SGILOGDATAFMT_8BIT = 8-bit gray monitor values
132
+ *
133
+ * Note that the COMPRESSION_SGILOG applies a simple run-length encoding
134
+ * scheme by separating the logL, u and v bytes for each row and applying
135
+ * a PackBits type of compression. Since the 24-bit encoding is not
136
+ * adaptive, the 32-bit color format takes less space in many cases.
137
+ *
138
+ * Further control is provided over the conversion from higher-resolution
139
+ * formats to final encoded values through the pseudo tag
140
+ * TIFFTAG_SGILOGENCODE:
141
+ * SGILOGENCODE_NODITHER = do not dither encoded values
142
+ * SGILOGENCODE_RANDITHER = apply random dithering during encoding
143
+ *
144
+ * The default value of this tag is SGILOGENCODE_NODITHER for
145
+ * COMPRESSION_SGILOG to maximize run-length encoding and
146
+ * SGILOGENCODE_RANDITHER for COMPRESSION_SGILOG24 to turn
147
+ * quantization errors into noise.
148
+ */
149
+
150
+ #include <stdio.h>
151
+ #include <stdlib.h>
152
+ #include <math.h>
153
+
154
+ /*
155
+ * State block for each open TIFF
156
+ * file using LogLuv compression/decompression.
157
+ */
158
+ typedef struct logLuvState LogLuvState;
159
+
160
+ struct logLuvState {
161
+ int encoder_state; /* 1 if encoder correctly initialized */
162
+ int user_datafmt; /* user data format */
163
+ int encode_meth; /* encoding method */
164
+ int pixel_size; /* bytes per pixel */
165
+
166
+ uint8* tbuf; /* translation buffer */
167
+ tmsize_t tbuflen; /* buffer length */
168
+ void (*tfunc)(LogLuvState*, uint8*, tmsize_t);
169
+
170
+ TIFFVSetMethod vgetparent; /* super-class method */
171
+ TIFFVSetMethod vsetparent; /* super-class method */
172
+ };
173
+
174
+ #define DecoderState(tif) ((LogLuvState*) (tif)->tif_data)
175
+ #define EncoderState(tif) ((LogLuvState*) (tif)->tif_data)
176
+
177
+ #define SGILOGDATAFMT_UNKNOWN -1
178
+
179
+ #define MINRUN 4 /* minimum run length */
180
+
181
+ /*
182
+ * Decode a string of 16-bit gray pixels.
183
+ */
184
+ static int
185
+ LogL16Decode(TIFF* tif, uint8* op, tmsize_t occ, uint16 s)
186
+ {
187
+ static const char module[] = "LogL16Decode";
188
+ LogLuvState* sp = DecoderState(tif);
189
+ int shft;
190
+ tmsize_t i;
191
+ tmsize_t npixels;
192
+ unsigned char* bp;
193
+ int16* tp;
194
+ int16 b;
195
+ tmsize_t cc;
196
+ int rc;
197
+
198
+ assert(s == 0);
199
+ assert(sp != NULL);
200
+
201
+ npixels = occ / sp->pixel_size;
202
+
203
+ if (sp->user_datafmt == SGILOGDATAFMT_16BIT)
204
+ tp = (int16*) op;
205
+ else {
206
+ if(sp->tbuflen < npixels) {
207
+ TIFFErrorExt(tif->tif_clientdata, module,
208
+ "Translation buffer too short");
209
+ return (0);
210
+ }
211
+ tp = (int16*) sp->tbuf;
212
+ }
213
+ _TIFFmemset((void*) tp, 0, npixels*sizeof (tp[0]));
214
+
215
+ bp = (unsigned char*) tif->tif_rawcp;
216
+ cc = tif->tif_rawcc;
217
+ /* get each byte string */
218
+ for (shft = 2*8; (shft -= 8) >= 0; ) {
219
+ for (i = 0; i < npixels && cc > 0; ) {
220
+ if (*bp >= 128) { /* run */
221
+ if( cc < 2 )
222
+ break;
223
+ rc = *bp++ + (2-128);
224
+ b = (int16)(*bp++ << shft);
225
+ cc -= 2;
226
+ while (rc-- && i < npixels)
227
+ tp[i++] |= b;
228
+ } else { /* non-run */
229
+ rc = *bp++; /* nul is noop */
230
+ while (--cc && rc-- && i < npixels)
231
+ tp[i++] |= (int16)*bp++ << shft;
232
+ }
233
+ }
234
+ if (i != npixels) {
235
+ #if defined(__WIN32__) && (defined(_MSC_VER) || defined(__MINGW32__))
236
+ TIFFErrorExt(tif->tif_clientdata, module,
237
+ "Not enough data at row %lu (short %I64d pixels)",
238
+ (unsigned long) tif->tif_row,
239
+ (unsigned __int64) (npixels - i));
240
+ #else
241
+ TIFFErrorExt(tif->tif_clientdata, module,
242
+ "Not enough data at row %lu (short %llu pixels)",
243
+ (unsigned long) tif->tif_row,
244
+ (unsigned long long) (npixels - i));
245
+ #endif
246
+ tif->tif_rawcp = (uint8*) bp;
247
+ tif->tif_rawcc = cc;
248
+ return (0);
249
+ }
250
+ }
251
+ (*sp->tfunc)(sp, op, npixels);
252
+ tif->tif_rawcp = (uint8*) bp;
253
+ tif->tif_rawcc = cc;
254
+ return (1);
255
+ }
256
+
257
+ /*
258
+ * Decode a string of 24-bit pixels.
259
+ */
260
+ static int
261
+ LogLuvDecode24(TIFF* tif, uint8* op, tmsize_t occ, uint16 s)
262
+ {
263
+ static const char module[] = "LogLuvDecode24";
264
+ LogLuvState* sp = DecoderState(tif);
265
+ tmsize_t cc;
266
+ tmsize_t i;
267
+ tmsize_t npixels;
268
+ unsigned char* bp;
269
+ uint32* tp;
270
+
271
+ assert(s == 0);
272
+ assert(sp != NULL);
273
+
274
+ npixels = occ / sp->pixel_size;
275
+
276
+ if (sp->user_datafmt == SGILOGDATAFMT_RAW)
277
+ tp = (uint32 *)op;
278
+ else {
279
+ if(sp->tbuflen < npixels) {
280
+ TIFFErrorExt(tif->tif_clientdata, module,
281
+ "Translation buffer too short");
282
+ return (0);
283
+ }
284
+ tp = (uint32 *) sp->tbuf;
285
+ }
286
+ /* copy to array of uint32 */
287
+ bp = (unsigned char*) tif->tif_rawcp;
288
+ cc = tif->tif_rawcc;
289
+ for (i = 0; i < npixels && cc >= 3; i++) {
290
+ tp[i] = bp[0] << 16 | bp[1] << 8 | bp[2];
291
+ bp += 3;
292
+ cc -= 3;
293
+ }
294
+ tif->tif_rawcp = (uint8*) bp;
295
+ tif->tif_rawcc = cc;
296
+ if (i != npixels) {
297
+ #if defined(__WIN32__) && (defined(_MSC_VER) || defined(__MINGW32__))
298
+ TIFFErrorExt(tif->tif_clientdata, module,
299
+ "Not enough data at row %lu (short %I64d pixels)",
300
+ (unsigned long) tif->tif_row,
301
+ (unsigned __int64) (npixels - i));
302
+ #else
303
+ TIFFErrorExt(tif->tif_clientdata, module,
304
+ "Not enough data at row %lu (short %llu pixels)",
305
+ (unsigned long) tif->tif_row,
306
+ (unsigned long long) (npixels - i));
307
+ #endif
308
+ return (0);
309
+ }
310
+ (*sp->tfunc)(sp, op, npixels);
311
+ return (1);
312
+ }
313
+
314
+ /*
315
+ * Decode a string of 32-bit pixels.
316
+ */
317
+ static int
318
+ LogLuvDecode32(TIFF* tif, uint8* op, tmsize_t occ, uint16 s)
319
+ {
320
+ static const char module[] = "LogLuvDecode32";
321
+ LogLuvState* sp;
322
+ int shft;
323
+ tmsize_t i;
324
+ tmsize_t npixels;
325
+ unsigned char* bp;
326
+ uint32* tp;
327
+ uint32 b;
328
+ tmsize_t cc;
329
+ int rc;
330
+
331
+ assert(s == 0);
332
+ sp = DecoderState(tif);
333
+ assert(sp != NULL);
334
+
335
+ npixels = occ / sp->pixel_size;
336
+
337
+ if (sp->user_datafmt == SGILOGDATAFMT_RAW)
338
+ tp = (uint32*) op;
339
+ else {
340
+ if(sp->tbuflen < npixels) {
341
+ TIFFErrorExt(tif->tif_clientdata, module,
342
+ "Translation buffer too short");
343
+ return (0);
344
+ }
345
+ tp = (uint32*) sp->tbuf;
346
+ }
347
+ _TIFFmemset((void*) tp, 0, npixels*sizeof (tp[0]));
348
+
349
+ bp = (unsigned char*) tif->tif_rawcp;
350
+ cc = tif->tif_rawcc;
351
+ /* get each byte string */
352
+ for (shft = 4*8; (shft -= 8) >= 0; ) {
353
+ for (i = 0; i < npixels && cc > 0; ) {
354
+ if (*bp >= 128) { /* run */
355
+ if( cc < 2 )
356
+ break;
357
+ rc = *bp++ + (2-128);
358
+ b = (uint32)*bp++ << shft;
359
+ cc -= 2;
360
+ while (rc-- && i < npixels)
361
+ tp[i++] |= b;
362
+ } else { /* non-run */
363
+ rc = *bp++; /* nul is noop */
364
+ while (--cc && rc-- && i < npixels)
365
+ tp[i++] |= (uint32)*bp++ << shft;
366
+ }
367
+ }
368
+ if (i != npixels) {
369
+ #if defined(__WIN32__) && (defined(_MSC_VER) || defined(__MINGW32__))
370
+ TIFFErrorExt(tif->tif_clientdata, module,
371
+ "Not enough data at row %lu (short %I64d pixels)",
372
+ (unsigned long) tif->tif_row,
373
+ (unsigned __int64) (npixels - i));
374
+ #else
375
+ TIFFErrorExt(tif->tif_clientdata, module,
376
+ "Not enough data at row %lu (short %llu pixels)",
377
+ (unsigned long) tif->tif_row,
378
+ (unsigned long long) (npixels - i));
379
+ #endif
380
+ tif->tif_rawcp = (uint8*) bp;
381
+ tif->tif_rawcc = cc;
382
+ return (0);
383
+ }
384
+ }
385
+ (*sp->tfunc)(sp, op, npixels);
386
+ tif->tif_rawcp = (uint8*) bp;
387
+ tif->tif_rawcc = cc;
388
+ return (1);
389
+ }
390
+
391
+ /*
392
+ * Decode a strip of pixels. We break it into rows to
393
+ * maintain synchrony with the encode algorithm, which
394
+ * is row by row.
395
+ */
396
+ static int
397
+ LogLuvDecodeStrip(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s)
398
+ {
399
+ tmsize_t rowlen = TIFFScanlineSize(tif);
400
+
401
+ if (rowlen == 0)
402
+ return 0;
403
+
404
+ assert(cc%rowlen == 0);
405
+ while (cc && (*tif->tif_decoderow)(tif, bp, rowlen, s)) {
406
+ bp += rowlen;
407
+ cc -= rowlen;
408
+ }
409
+ return (cc == 0);
410
+ }
411
+
412
+ /*
413
+ * Decode a tile of pixels. We break it into rows to
414
+ * maintain synchrony with the encode algorithm, which
415
+ * is row by row.
416
+ */
417
+ static int
418
+ LogLuvDecodeTile(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s)
419
+ {
420
+ tmsize_t rowlen = TIFFTileRowSize(tif);
421
+
422
+ if (rowlen == 0)
423
+ return 0;
424
+
425
+ assert(cc%rowlen == 0);
426
+ while (cc && (*tif->tif_decoderow)(tif, bp, rowlen, s)) {
427
+ bp += rowlen;
428
+ cc -= rowlen;
429
+ }
430
+ return (cc == 0);
431
+ }
432
+
433
+ /*
434
+ * Encode a row of 16-bit pixels.
435
+ */
436
+ static int
437
+ LogL16Encode(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s)
438
+ {
439
+ static const char module[] = "LogL16Encode";
440
+ LogLuvState* sp = EncoderState(tif);
441
+ int shft;
442
+ tmsize_t i;
443
+ tmsize_t j;
444
+ tmsize_t npixels;
445
+ uint8* op;
446
+ int16* tp;
447
+ int16 b;
448
+ tmsize_t occ;
449
+ int rc=0, mask;
450
+ tmsize_t beg;
451
+
452
+ assert(s == 0);
453
+ assert(sp != NULL);
454
+ npixels = cc / sp->pixel_size;
455
+
456
+ if (sp->user_datafmt == SGILOGDATAFMT_16BIT)
457
+ tp = (int16*) bp;
458
+ else {
459
+ tp = (int16*) sp->tbuf;
460
+ if(sp->tbuflen < npixels) {
461
+ TIFFErrorExt(tif->tif_clientdata, module,
462
+ "Translation buffer too short");
463
+ return (0);
464
+ }
465
+ (*sp->tfunc)(sp, bp, npixels);
466
+ }
467
+ /* compress each byte string */
468
+ op = tif->tif_rawcp;
469
+ occ = tif->tif_rawdatasize - tif->tif_rawcc;
470
+ for (shft = 2*8; (shft -= 8) >= 0; )
471
+ for (i = 0; i < npixels; i += rc) {
472
+ if (occ < 4) {
473
+ tif->tif_rawcp = op;
474
+ tif->tif_rawcc = tif->tif_rawdatasize - occ;
475
+ if (!TIFFFlushData1(tif))
476
+ return (0);
477
+ op = tif->tif_rawcp;
478
+ occ = tif->tif_rawdatasize - tif->tif_rawcc;
479
+ }
480
+ mask = 0xff << shft; /* find next run */
481
+ for (beg = i; beg < npixels; beg += rc) {
482
+ b = (int16) (tp[beg] & mask);
483
+ rc = 1;
484
+ while (rc < 127+2 && beg+rc < npixels &&
485
+ (tp[beg+rc] & mask) == b)
486
+ rc++;
487
+ if (rc >= MINRUN)
488
+ break; /* long enough */
489
+ }
490
+ if (beg-i > 1 && beg-i < MINRUN) {
491
+ b = (int16) (tp[i] & mask);/*check short run */
492
+ j = i+1;
493
+ while ((tp[j++] & mask) == b)
494
+ if (j == beg) {
495
+ *op++ = (uint8)(128-2+j-i);
496
+ *op++ = (uint8)(b >> shft);
497
+ occ -= 2;
498
+ i = beg;
499
+ break;
500
+ }
501
+ }
502
+ while (i < beg) { /* write out non-run */
503
+ if ((j = beg-i) > 127) j = 127;
504
+ if (occ < j+3) {
505
+ tif->tif_rawcp = op;
506
+ tif->tif_rawcc = tif->tif_rawdatasize - occ;
507
+ if (!TIFFFlushData1(tif))
508
+ return (0);
509
+ op = tif->tif_rawcp;
510
+ occ = tif->tif_rawdatasize - tif->tif_rawcc;
511
+ }
512
+ *op++ = (uint8) j; occ--;
513
+ while (j--) {
514
+ *op++ = (uint8) (tp[i++] >> shft & 0xff);
515
+ occ--;
516
+ }
517
+ }
518
+ if (rc >= MINRUN) { /* write out run */
519
+ *op++ = (uint8) (128-2+rc);
520
+ *op++ = (uint8) (tp[beg] >> shft & 0xff);
521
+ occ -= 2;
522
+ } else
523
+ rc = 0;
524
+ }
525
+ tif->tif_rawcp = op;
526
+ tif->tif_rawcc = tif->tif_rawdatasize - occ;
527
+
528
+ return (1);
529
+ }
530
+
531
+ /*
532
+ * Encode a row of 24-bit pixels.
533
+ */
534
+ static int
535
+ LogLuvEncode24(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s)
536
+ {
537
+ static const char module[] = "LogLuvEncode24";
538
+ LogLuvState* sp = EncoderState(tif);
539
+ tmsize_t i;
540
+ tmsize_t npixels;
541
+ tmsize_t occ;
542
+ uint8* op;
543
+ uint32* tp;
544
+
545
+ assert(s == 0);
546
+ assert(sp != NULL);
547
+ npixels = cc / sp->pixel_size;
548
+
549
+ if (sp->user_datafmt == SGILOGDATAFMT_RAW)
550
+ tp = (uint32*) bp;
551
+ else {
552
+ tp = (uint32*) sp->tbuf;
553
+ if(sp->tbuflen < npixels) {
554
+ TIFFErrorExt(tif->tif_clientdata, module,
555
+ "Translation buffer too short");
556
+ return (0);
557
+ }
558
+ (*sp->tfunc)(sp, bp, npixels);
559
+ }
560
+ /* write out encoded pixels */
561
+ op = tif->tif_rawcp;
562
+ occ = tif->tif_rawdatasize - tif->tif_rawcc;
563
+ for (i = npixels; i--; ) {
564
+ if (occ < 3) {
565
+ tif->tif_rawcp = op;
566
+ tif->tif_rawcc = tif->tif_rawdatasize - occ;
567
+ if (!TIFFFlushData1(tif))
568
+ return (0);
569
+ op = tif->tif_rawcp;
570
+ occ = tif->tif_rawdatasize - tif->tif_rawcc;
571
+ }
572
+ *op++ = (uint8)(*tp >> 16);
573
+ *op++ = (uint8)(*tp >> 8 & 0xff);
574
+ *op++ = (uint8)(*tp++ & 0xff);
575
+ occ -= 3;
576
+ }
577
+ tif->tif_rawcp = op;
578
+ tif->tif_rawcc = tif->tif_rawdatasize - occ;
579
+
580
+ return (1);
581
+ }
582
+
583
+ /*
584
+ * Encode a row of 32-bit pixels.
585
+ */
586
+ static int
587
+ LogLuvEncode32(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s)
588
+ {
589
+ static const char module[] = "LogLuvEncode32";
590
+ LogLuvState* sp = EncoderState(tif);
591
+ int shft;
592
+ tmsize_t i;
593
+ tmsize_t j;
594
+ tmsize_t npixels;
595
+ uint8* op;
596
+ uint32* tp;
597
+ uint32 b;
598
+ tmsize_t occ;
599
+ int rc=0, mask;
600
+ tmsize_t beg;
601
+
602
+ assert(s == 0);
603
+ assert(sp != NULL);
604
+
605
+ npixels = cc / sp->pixel_size;
606
+
607
+ if (sp->user_datafmt == SGILOGDATAFMT_RAW)
608
+ tp = (uint32*) bp;
609
+ else {
610
+ tp = (uint32*) sp->tbuf;
611
+ if(sp->tbuflen < npixels) {
612
+ TIFFErrorExt(tif->tif_clientdata, module,
613
+ "Translation buffer too short");
614
+ return (0);
615
+ }
616
+ (*sp->tfunc)(sp, bp, npixels);
617
+ }
618
+ /* compress each byte string */
619
+ op = tif->tif_rawcp;
620
+ occ = tif->tif_rawdatasize - tif->tif_rawcc;
621
+ for (shft = 4*8; (shft -= 8) >= 0; )
622
+ for (i = 0; i < npixels; i += rc) {
623
+ if (occ < 4) {
624
+ tif->tif_rawcp = op;
625
+ tif->tif_rawcc = tif->tif_rawdatasize - occ;
626
+ if (!TIFFFlushData1(tif))
627
+ return (0);
628
+ op = tif->tif_rawcp;
629
+ occ = tif->tif_rawdatasize - tif->tif_rawcc;
630
+ }
631
+ mask = 0xff << shft; /* find next run */
632
+ for (beg = i; beg < npixels; beg += rc) {
633
+ b = tp[beg] & mask;
634
+ rc = 1;
635
+ while (rc < 127+2 && beg+rc < npixels &&
636
+ (tp[beg+rc] & mask) == b)
637
+ rc++;
638
+ if (rc >= MINRUN)
639
+ break; /* long enough */
640
+ }
641
+ if (beg-i > 1 && beg-i < MINRUN) {
642
+ b = tp[i] & mask; /* check short run */
643
+ j = i+1;
644
+ while ((tp[j++] & mask) == b)
645
+ if (j == beg) {
646
+ *op++ = (uint8)(128-2+j-i);
647
+ *op++ = (uint8)(b >> shft);
648
+ occ -= 2;
649
+ i = beg;
650
+ break;
651
+ }
652
+ }
653
+ while (i < beg) { /* write out non-run */
654
+ if ((j = beg-i) > 127) j = 127;
655
+ if (occ < j+3) {
656
+ tif->tif_rawcp = op;
657
+ tif->tif_rawcc = tif->tif_rawdatasize - occ;
658
+ if (!TIFFFlushData1(tif))
659
+ return (0);
660
+ op = tif->tif_rawcp;
661
+ occ = tif->tif_rawdatasize - tif->tif_rawcc;
662
+ }
663
+ *op++ = (uint8) j; occ--;
664
+ while (j--) {
665
+ *op++ = (uint8)(tp[i++] >> shft & 0xff);
666
+ occ--;
667
+ }
668
+ }
669
+ if (rc >= MINRUN) { /* write out run */
670
+ *op++ = (uint8) (128-2+rc);
671
+ *op++ = (uint8)(tp[beg] >> shft & 0xff);
672
+ occ -= 2;
673
+ } else
674
+ rc = 0;
675
+ }
676
+ tif->tif_rawcp = op;
677
+ tif->tif_rawcc = tif->tif_rawdatasize - occ;
678
+
679
+ return (1);
680
+ }
681
+
682
+ /*
683
+ * Encode a strip of pixels. We break it into rows to
684
+ * avoid encoding runs across row boundaries.
685
+ */
686
+ static int
687
+ LogLuvEncodeStrip(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s)
688
+ {
689
+ tmsize_t rowlen = TIFFScanlineSize(tif);
690
+
691
+ if (rowlen == 0)
692
+ return 0;
693
+
694
+ assert(cc%rowlen == 0);
695
+ while (cc && (*tif->tif_encoderow)(tif, bp, rowlen, s) == 1) {
696
+ bp += rowlen;
697
+ cc -= rowlen;
698
+ }
699
+ return (cc == 0);
700
+ }
701
+
702
+ /*
703
+ * Encode a tile of pixels. We break it into rows to
704
+ * avoid encoding runs across row boundaries.
705
+ */
706
+ static int
707
+ LogLuvEncodeTile(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s)
708
+ {
709
+ tmsize_t rowlen = TIFFTileRowSize(tif);
710
+
711
+ if (rowlen == 0)
712
+ return 0;
713
+
714
+ assert(cc%rowlen == 0);
715
+ while (cc && (*tif->tif_encoderow)(tif, bp, rowlen, s) == 1) {
716
+ bp += rowlen;
717
+ cc -= rowlen;
718
+ }
719
+ return (cc == 0);
720
+ }
721
+
722
+ /*
723
+ * Encode/Decode functions for converting to and from user formats.
724
+ */
725
+
726
+ #include "uvcode.h"
727
+
728
+ #ifndef UVSCALE
729
+ #define U_NEU 0.210526316
730
+ #define V_NEU 0.473684211
731
+ #define UVSCALE 410.
732
+ #endif
733
+
734
+ #ifndef M_LN2
735
+ #define M_LN2 0.69314718055994530942
736
+ #endif
737
+ #ifndef M_PI
738
+ #define M_PI 3.14159265358979323846
739
+ #endif
740
+ #undef log2 /* Conflict with C'99 function */
741
+ #define log2(x) ((1./M_LN2)*log(x))
742
+ #undef exp2 /* Conflict with C'99 function */
743
+ #define exp2(x) exp(M_LN2*(x))
744
+
745
+ #define itrunc(x,m) ((m)==SGILOGENCODE_NODITHER ? \
746
+ (int)(x) : \
747
+ (int)((x) + rand()*(1./RAND_MAX) - .5))
748
+
749
+ #if !LOGLUV_PUBLIC
750
+ static
751
+ #endif
752
+ double
753
+ LogL16toY(int p16) /* compute luminance from 16-bit LogL */
754
+ {
755
+ int Le = p16 & 0x7fff;
756
+ double Y;
757
+
758
+ if (!Le)
759
+ return (0.);
760
+ Y = exp(M_LN2/256.*(Le+.5) - M_LN2*64.);
761
+ return (!(p16 & 0x8000) ? Y : -Y);
762
+ }
763
+
764
+ #if !LOGLUV_PUBLIC
765
+ static
766
+ #endif
767
+ int
768
+ LogL16fromY(double Y, int em) /* get 16-bit LogL from Y */
769
+ {
770
+ if (Y >= 1.8371976e19)
771
+ return (0x7fff);
772
+ if (Y <= -1.8371976e19)
773
+ return (0xffff);
774
+ if (Y > 5.4136769e-20)
775
+ return itrunc(256.*(log2(Y) + 64.), em);
776
+ if (Y < -5.4136769e-20)
777
+ return (~0x7fff | itrunc(256.*(log2(-Y) + 64.), em));
778
+ return (0);
779
+ }
780
+
781
+ static void
782
+ L16toY(LogLuvState* sp, uint8* op, tmsize_t n)
783
+ {
784
+ int16* l16 = (int16*) sp->tbuf;
785
+ float* yp = (float*) op;
786
+
787
+ while (n-- > 0)
788
+ *yp++ = (float)LogL16toY(*l16++);
789
+ }
790
+
791
+ static void
792
+ L16toGry(LogLuvState* sp, uint8* op, tmsize_t n)
793
+ {
794
+ int16* l16 = (int16*) sp->tbuf;
795
+ uint8* gp = (uint8*) op;
796
+
797
+ while (n-- > 0) {
798
+ double Y = LogL16toY(*l16++);
799
+ *gp++ = (uint8) ((Y <= 0.) ? 0 : (Y >= 1.) ? 255 : (int)(256.*sqrt(Y)));
800
+ }
801
+ }
802
+
803
+ static void
804
+ L16fromY(LogLuvState* sp, uint8* op, tmsize_t n)
805
+ {
806
+ int16* l16 = (int16*) sp->tbuf;
807
+ float* yp = (float*) op;
808
+
809
+ while (n-- > 0)
810
+ *l16++ = (int16) (LogL16fromY(*yp++, sp->encode_meth));
811
+ }
812
+
813
+ #if !LOGLUV_PUBLIC
814
+ static
815
+ #endif
816
+ void
817
+ XYZtoRGB24(float xyz[3], uint8 rgb[3])
818
+ {
819
+ double r, g, b;
820
+ /* assume CCIR-709 primaries */
821
+ r = 2.690*xyz[0] + -1.276*xyz[1] + -0.414*xyz[2];
822
+ g = -1.022*xyz[0] + 1.978*xyz[1] + 0.044*xyz[2];
823
+ b = 0.061*xyz[0] + -0.224*xyz[1] + 1.163*xyz[2];
824
+ /* assume 2.0 gamma for speed */
825
+ /* could use integer sqrt approx., but this is probably faster */
826
+ rgb[0] = (uint8)((r<=0.) ? 0 : (r >= 1.) ? 255 : (int)(256.*sqrt(r)));
827
+ rgb[1] = (uint8)((g<=0.) ? 0 : (g >= 1.) ? 255 : (int)(256.*sqrt(g)));
828
+ rgb[2] = (uint8)((b<=0.) ? 0 : (b >= 1.) ? 255 : (int)(256.*sqrt(b)));
829
+ }
830
+
831
+ #if !LOGLUV_PUBLIC
832
+ static
833
+ #endif
834
+ double
835
+ LogL10toY(int p10) /* compute luminance from 10-bit LogL */
836
+ {
837
+ if (p10 == 0)
838
+ return (0.);
839
+ return (exp(M_LN2/64.*(p10+.5) - M_LN2*12.));
840
+ }
841
+
842
+ #if !LOGLUV_PUBLIC
843
+ static
844
+ #endif
845
+ int
846
+ LogL10fromY(double Y, int em) /* get 10-bit LogL from Y */
847
+ {
848
+ if (Y >= 15.742)
849
+ return (0x3ff);
850
+ else if (Y <= .00024283)
851
+ return (0);
852
+ else
853
+ return itrunc(64.*(log2(Y) + 12.), em);
854
+ }
855
+
856
+ #define NANGLES 100
857
+ #define uv2ang(u, v) ( (NANGLES*.499999999/M_PI) \
858
+ * atan2((v)-V_NEU,(u)-U_NEU) + .5*NANGLES )
859
+
860
+ static int
861
+ oog_encode(double u, double v) /* encode out-of-gamut chroma */
862
+ {
863
+ static int oog_table[NANGLES];
864
+ static int initialized = 0;
865
+ register int i;
866
+
867
+ if (!initialized) { /* set up perimeter table */
868
+ double eps[NANGLES], ua, va, ang, epsa;
869
+ int ui, vi, ustep;
870
+ for (i = NANGLES; i--; )
871
+ eps[i] = 2.;
872
+ for (vi = UV_NVS; vi--; ) {
873
+ va = UV_VSTART + (vi+.5)*UV_SQSIZ;
874
+ ustep = uv_row[vi].nus-1;
875
+ if (vi == UV_NVS-1 || vi == 0 || ustep <= 0)
876
+ ustep = 1;
877
+ for (ui = uv_row[vi].nus-1; ui >= 0; ui -= ustep) {
878
+ ua = uv_row[vi].ustart + (ui+.5)*UV_SQSIZ;
879
+ ang = uv2ang(ua, va);
880
+ i = (int) ang;
881
+ epsa = fabs(ang - (i+.5));
882
+ if (epsa < eps[i]) {
883
+ oog_table[i] = uv_row[vi].ncum + ui;
884
+ eps[i] = epsa;
885
+ }
886
+ }
887
+ }
888
+ for (i = NANGLES; i--; ) /* fill any holes */
889
+ if (eps[i] > 1.5) {
890
+ int i1, i2;
891
+ for (i1 = 1; i1 < NANGLES/2; i1++)
892
+ if (eps[(i+i1)%NANGLES] < 1.5)
893
+ break;
894
+ for (i2 = 1; i2 < NANGLES/2; i2++)
895
+ if (eps[(i+NANGLES-i2)%NANGLES] < 1.5)
896
+ break;
897
+ if (i1 < i2)
898
+ oog_table[i] =
899
+ oog_table[(i+i1)%NANGLES];
900
+ else
901
+ oog_table[i] =
902
+ oog_table[(i+NANGLES-i2)%NANGLES];
903
+ }
904
+ initialized = 1;
905
+ }
906
+ i = (int) uv2ang(u, v); /* look up hue angle */
907
+ return (oog_table[i]);
908
+ }
909
+
910
+ #undef uv2ang
911
+ #undef NANGLES
912
+
913
+ #if !LOGLUV_PUBLIC
914
+ static
915
+ #endif
916
+ int
917
+ uv_encode(double u, double v, int em) /* encode (u',v') coordinates */
918
+ {
919
+ register int vi, ui;
920
+
921
+ if (v < UV_VSTART)
922
+ return oog_encode(u, v);
923
+ vi = itrunc((v - UV_VSTART)*(1./UV_SQSIZ), em);
924
+ if (vi >= UV_NVS)
925
+ return oog_encode(u, v);
926
+ if (u < uv_row[vi].ustart)
927
+ return oog_encode(u, v);
928
+ ui = itrunc((u - uv_row[vi].ustart)*(1./UV_SQSIZ), em);
929
+ if (ui >= uv_row[vi].nus)
930
+ return oog_encode(u, v);
931
+
932
+ return (uv_row[vi].ncum + ui);
933
+ }
934
+
935
+ #if !LOGLUV_PUBLIC
936
+ static
937
+ #endif
938
+ int
939
+ uv_decode(double *up, double *vp, int c) /* decode (u',v') index */
940
+ {
941
+ int upper, lower;
942
+ register int ui, vi;
943
+
944
+ if (c < 0 || c >= UV_NDIVS)
945
+ return (-1);
946
+ lower = 0; /* binary search */
947
+ upper = UV_NVS;
948
+ while (upper - lower > 1) {
949
+ vi = (lower + upper) >> 1;
950
+ ui = c - uv_row[vi].ncum;
951
+ if (ui > 0)
952
+ lower = vi;
953
+ else if (ui < 0)
954
+ upper = vi;
955
+ else {
956
+ lower = vi;
957
+ break;
958
+ }
959
+ }
960
+ vi = lower;
961
+ ui = c - uv_row[vi].ncum;
962
+ *up = uv_row[vi].ustart + (ui+.5)*UV_SQSIZ;
963
+ *vp = UV_VSTART + (vi+.5)*UV_SQSIZ;
964
+ return (0);
965
+ }
966
+
967
+ #if !LOGLUV_PUBLIC
968
+ static
969
+ #endif
970
+ void
971
+ LogLuv24toXYZ(uint32 p, float XYZ[3])
972
+ {
973
+ int Ce;
974
+ double L, u, v, s, x, y;
975
+ /* decode luminance */
976
+ L = LogL10toY(p>>14 & 0x3ff);
977
+ if (L <= 0.) {
978
+ XYZ[0] = XYZ[1] = XYZ[2] = 0.;
979
+ return;
980
+ }
981
+ /* decode color */
982
+ Ce = p & 0x3fff;
983
+ if (uv_decode(&u, &v, Ce) < 0) {
984
+ u = U_NEU; v = V_NEU;
985
+ }
986
+ s = 1./(6.*u - 16.*v + 12.);
987
+ x = 9.*u * s;
988
+ y = 4.*v * s;
989
+ /* convert to XYZ */
990
+ XYZ[0] = (float)(x/y * L);
991
+ XYZ[1] = (float)L;
992
+ XYZ[2] = (float)((1.-x-y)/y * L);
993
+ }
994
+
995
+ #if !LOGLUV_PUBLIC
996
+ static
997
+ #endif
998
+ uint32
999
+ LogLuv24fromXYZ(float XYZ[3], int em)
1000
+ {
1001
+ int Le, Ce;
1002
+ double u, v, s;
1003
+ /* encode luminance */
1004
+ Le = LogL10fromY(XYZ[1], em);
1005
+ /* encode color */
1006
+ s = XYZ[0] + 15.*XYZ[1] + 3.*XYZ[2];
1007
+ if (!Le || s <= 0.) {
1008
+ u = U_NEU;
1009
+ v = V_NEU;
1010
+ } else {
1011
+ u = 4.*XYZ[0] / s;
1012
+ v = 9.*XYZ[1] / s;
1013
+ }
1014
+ Ce = uv_encode(u, v, em);
1015
+ if (Ce < 0) /* never happens */
1016
+ Ce = uv_encode(U_NEU, V_NEU, SGILOGENCODE_NODITHER);
1017
+ /* combine encodings */
1018
+ return (Le << 14 | Ce);
1019
+ }
1020
+
1021
+ static void
1022
+ Luv24toXYZ(LogLuvState* sp, uint8* op, tmsize_t n)
1023
+ {
1024
+ uint32* luv = (uint32*) sp->tbuf;
1025
+ float* xyz = (float*) op;
1026
+
1027
+ while (n-- > 0) {
1028
+ LogLuv24toXYZ(*luv, xyz);
1029
+ xyz += 3;
1030
+ luv++;
1031
+ }
1032
+ }
1033
+
1034
+ static void
1035
+ Luv24toLuv48(LogLuvState* sp, uint8* op, tmsize_t n)
1036
+ {
1037
+ uint32* luv = (uint32*) sp->tbuf;
1038
+ int16* luv3 = (int16*) op;
1039
+
1040
+ while (n-- > 0) {
1041
+ double u, v;
1042
+
1043
+ *luv3++ = (int16)((*luv >> 12 & 0xffd) + 13314);
1044
+ if (uv_decode(&u, &v, *luv&0x3fff) < 0) {
1045
+ u = U_NEU;
1046
+ v = V_NEU;
1047
+ }
1048
+ *luv3++ = (int16)(u * (1L<<15));
1049
+ *luv3++ = (int16)(v * (1L<<15));
1050
+ luv++;
1051
+ }
1052
+ }
1053
+
1054
+ static void
1055
+ Luv24toRGB(LogLuvState* sp, uint8* op, tmsize_t n)
1056
+ {
1057
+ uint32* luv = (uint32*) sp->tbuf;
1058
+ uint8* rgb = (uint8*) op;
1059
+
1060
+ while (n-- > 0) {
1061
+ float xyz[3];
1062
+
1063
+ LogLuv24toXYZ(*luv++, xyz);
1064
+ XYZtoRGB24(xyz, rgb);
1065
+ rgb += 3;
1066
+ }
1067
+ }
1068
+
1069
+ static void
1070
+ Luv24fromXYZ(LogLuvState* sp, uint8* op, tmsize_t n)
1071
+ {
1072
+ uint32* luv = (uint32*) sp->tbuf;
1073
+ float* xyz = (float*) op;
1074
+
1075
+ while (n-- > 0) {
1076
+ *luv++ = LogLuv24fromXYZ(xyz, sp->encode_meth);
1077
+ xyz += 3;
1078
+ }
1079
+ }
1080
+
1081
+ static void
1082
+ Luv24fromLuv48(LogLuvState* sp, uint8* op, tmsize_t n)
1083
+ {
1084
+ uint32* luv = (uint32*) sp->tbuf;
1085
+ int16* luv3 = (int16*) op;
1086
+
1087
+ while (n-- > 0) {
1088
+ int Le, Ce;
1089
+
1090
+ if (luv3[0] <= 0)
1091
+ Le = 0;
1092
+ else if (luv3[0] >= (1<<12)+3314)
1093
+ Le = (1<<10) - 1;
1094
+ else if (sp->encode_meth == SGILOGENCODE_NODITHER)
1095
+ Le = (luv3[0]-3314) >> 2;
1096
+ else
1097
+ Le = itrunc(.25*(luv3[0]-3314.), sp->encode_meth);
1098
+
1099
+ Ce = uv_encode((luv3[1]+.5)/(1<<15), (luv3[2]+.5)/(1<<15),
1100
+ sp->encode_meth);
1101
+ if (Ce < 0) /* never happens */
1102
+ Ce = uv_encode(U_NEU, V_NEU, SGILOGENCODE_NODITHER);
1103
+ *luv++ = (uint32)Le << 14 | Ce;
1104
+ luv3 += 3;
1105
+ }
1106
+ }
1107
+
1108
+ #if !LOGLUV_PUBLIC
1109
+ static
1110
+ #endif
1111
+ void
1112
+ LogLuv32toXYZ(uint32 p, float XYZ[3])
1113
+ {
1114
+ double L, u, v, s, x, y;
1115
+ /* decode luminance */
1116
+ L = LogL16toY((int)p >> 16);
1117
+ if (L <= 0.) {
1118
+ XYZ[0] = XYZ[1] = XYZ[2] = 0.;
1119
+ return;
1120
+ }
1121
+ /* decode color */
1122
+ u = 1./UVSCALE * ((p>>8 & 0xff) + .5);
1123
+ v = 1./UVSCALE * ((p & 0xff) + .5);
1124
+ s = 1./(6.*u - 16.*v + 12.);
1125
+ x = 9.*u * s;
1126
+ y = 4.*v * s;
1127
+ /* convert to XYZ */
1128
+ XYZ[0] = (float)(x/y * L);
1129
+ XYZ[1] = (float)L;
1130
+ XYZ[2] = (float)((1.-x-y)/y * L);
1131
+ }
1132
+
1133
+ #if !LOGLUV_PUBLIC
1134
+ static
1135
+ #endif
1136
+ uint32
1137
+ LogLuv32fromXYZ(float XYZ[3], int em)
1138
+ {
1139
+ unsigned int Le, ue, ve;
1140
+ double u, v, s;
1141
+ /* encode luminance */
1142
+ Le = (unsigned int)LogL16fromY(XYZ[1], em);
1143
+ /* encode color */
1144
+ s = XYZ[0] + 15.*XYZ[1] + 3.*XYZ[2];
1145
+ if (!Le || s <= 0.) {
1146
+ u = U_NEU;
1147
+ v = V_NEU;
1148
+ } else {
1149
+ u = 4.*XYZ[0] / s;
1150
+ v = 9.*XYZ[1] / s;
1151
+ }
1152
+ if (u <= 0.) ue = 0;
1153
+ else ue = itrunc(UVSCALE*u, em);
1154
+ if (ue > 255) ue = 255;
1155
+ if (v <= 0.) ve = 0;
1156
+ else ve = itrunc(UVSCALE*v, em);
1157
+ if (ve > 255) ve = 255;
1158
+ /* combine encodings */
1159
+ return (Le << 16 | ue << 8 | ve);
1160
+ }
1161
+
1162
+ static void
1163
+ Luv32toXYZ(LogLuvState* sp, uint8* op, tmsize_t n)
1164
+ {
1165
+ uint32* luv = (uint32*) sp->tbuf;
1166
+ float* xyz = (float*) op;
1167
+
1168
+ while (n-- > 0) {
1169
+ LogLuv32toXYZ(*luv++, xyz);
1170
+ xyz += 3;
1171
+ }
1172
+ }
1173
+
1174
+ static void
1175
+ Luv32toLuv48(LogLuvState* sp, uint8* op, tmsize_t n)
1176
+ {
1177
+ uint32* luv = (uint32*) sp->tbuf;
1178
+ int16* luv3 = (int16*) op;
1179
+
1180
+ while (n-- > 0) {
1181
+ double u, v;
1182
+
1183
+ *luv3++ = (int16)(*luv >> 16);
1184
+ u = 1./UVSCALE * ((*luv>>8 & 0xff) + .5);
1185
+ v = 1./UVSCALE * ((*luv & 0xff) + .5);
1186
+ *luv3++ = (int16)(u * (1L<<15));
1187
+ *luv3++ = (int16)(v * (1L<<15));
1188
+ luv++;
1189
+ }
1190
+ }
1191
+
1192
+ static void
1193
+ Luv32toRGB(LogLuvState* sp, uint8* op, tmsize_t n)
1194
+ {
1195
+ uint32* luv = (uint32*) sp->tbuf;
1196
+ uint8* rgb = (uint8*) op;
1197
+
1198
+ while (n-- > 0) {
1199
+ float xyz[3];
1200
+
1201
+ LogLuv32toXYZ(*luv++, xyz);
1202
+ XYZtoRGB24(xyz, rgb);
1203
+ rgb += 3;
1204
+ }
1205
+ }
1206
+
1207
+ static void
1208
+ Luv32fromXYZ(LogLuvState* sp, uint8* op, tmsize_t n)
1209
+ {
1210
+ uint32* luv = (uint32*) sp->tbuf;
1211
+ float* xyz = (float*) op;
1212
+
1213
+ while (n-- > 0) {
1214
+ *luv++ = LogLuv32fromXYZ(xyz, sp->encode_meth);
1215
+ xyz += 3;
1216
+ }
1217
+ }
1218
+
1219
+ static void
1220
+ Luv32fromLuv48(LogLuvState* sp, uint8* op, tmsize_t n)
1221
+ {
1222
+ uint32* luv = (uint32*) sp->tbuf;
1223
+ int16* luv3 = (int16*) op;
1224
+
1225
+ if (sp->encode_meth == SGILOGENCODE_NODITHER) {
1226
+ while (n-- > 0) {
1227
+ *luv++ = (uint32)luv3[0] << 16 |
1228
+ (luv3[1]*(uint32)(UVSCALE+.5) >> 7 & 0xff00) |
1229
+ (luv3[2]*(uint32)(UVSCALE+.5) >> 15 & 0xff);
1230
+ luv3 += 3;
1231
+ }
1232
+ return;
1233
+ }
1234
+ while (n-- > 0) {
1235
+ *luv++ = (uint32)luv3[0] << 16 |
1236
+ (itrunc(luv3[1]*(UVSCALE/(1<<15)), sp->encode_meth) << 8 & 0xff00) |
1237
+ (itrunc(luv3[2]*(UVSCALE/(1<<15)), sp->encode_meth) & 0xff);
1238
+ luv3 += 3;
1239
+ }
1240
+ }
1241
+
1242
+ static void
1243
+ _logLuvNop(LogLuvState* sp, uint8* op, tmsize_t n)
1244
+ {
1245
+ (void) sp; (void) op; (void) n;
1246
+ }
1247
+
1248
+ static int
1249
+ LogL16GuessDataFmt(TIFFDirectory *td)
1250
+ {
1251
+ #define PACK(s,b,f) (((b)<<6)|((s)<<3)|(f))
1252
+ switch (PACK(td->td_samplesperpixel, td->td_bitspersample, td->td_sampleformat)) {
1253
+ case PACK(1, 32, SAMPLEFORMAT_IEEEFP):
1254
+ return (SGILOGDATAFMT_FLOAT);
1255
+ case PACK(1, 16, SAMPLEFORMAT_VOID):
1256
+ case PACK(1, 16, SAMPLEFORMAT_INT):
1257
+ case PACK(1, 16, SAMPLEFORMAT_UINT):
1258
+ return (SGILOGDATAFMT_16BIT);
1259
+ case PACK(1, 8, SAMPLEFORMAT_VOID):
1260
+ case PACK(1, 8, SAMPLEFORMAT_UINT):
1261
+ return (SGILOGDATAFMT_8BIT);
1262
+ }
1263
+ #undef PACK
1264
+ return (SGILOGDATAFMT_UNKNOWN);
1265
+ }
1266
+
1267
+
1268
+ #define TIFF_SIZE_T_MAX ((size_t) ~ ((size_t)0))
1269
+ #define TIFF_TMSIZE_T_MAX (tmsize_t)(TIFF_SIZE_T_MAX >> 1)
1270
+
1271
+ static tmsize_t
1272
+ multiply_ms(tmsize_t m1, tmsize_t m2)
1273
+ {
1274
+ if( m1 == 0 || m2 > TIFF_TMSIZE_T_MAX / m1 )
1275
+ return 0;
1276
+ return m1 * m2;
1277
+ }
1278
+
1279
+ static int
1280
+ LogL16InitState(TIFF* tif)
1281
+ {
1282
+ static const char module[] = "LogL16InitState";
1283
+ TIFFDirectory *td = &tif->tif_dir;
1284
+ LogLuvState* sp = DecoderState(tif);
1285
+
1286
+ assert(sp != NULL);
1287
+ assert(td->td_photometric == PHOTOMETRIC_LOGL);
1288
+
1289
+ if( td->td_samplesperpixel != 1 )
1290
+ {
1291
+ TIFFErrorExt(tif->tif_clientdata, module,
1292
+ "Sorry, can not handle LogL image with %s=%d",
1293
+ "Samples/pixel", td->td_samplesperpixel);
1294
+ return 0;
1295
+ }
1296
+
1297
+ /* for some reason, we can't do this in TIFFInitLogL16 */
1298
+ if (sp->user_datafmt == SGILOGDATAFMT_UNKNOWN)
1299
+ sp->user_datafmt = LogL16GuessDataFmt(td);
1300
+ switch (sp->user_datafmt) {
1301
+ case SGILOGDATAFMT_FLOAT:
1302
+ sp->pixel_size = sizeof (float);
1303
+ break;
1304
+ case SGILOGDATAFMT_16BIT:
1305
+ sp->pixel_size = sizeof (int16);
1306
+ break;
1307
+ case SGILOGDATAFMT_8BIT:
1308
+ sp->pixel_size = sizeof (uint8);
1309
+ break;
1310
+ default:
1311
+ TIFFErrorExt(tif->tif_clientdata, module,
1312
+ "No support for converting user data format to LogL");
1313
+ return (0);
1314
+ }
1315
+ if( isTiled(tif) )
1316
+ sp->tbuflen = multiply_ms(td->td_tilewidth, td->td_tilelength);
1317
+ else if( td->td_rowsperstrip < td->td_imagelength )
1318
+ sp->tbuflen = multiply_ms(td->td_imagewidth, td->td_rowsperstrip);
1319
+ else
1320
+ sp->tbuflen = multiply_ms(td->td_imagewidth, td->td_imagelength);
1321
+ if (multiply_ms(sp->tbuflen, sizeof (int16)) == 0 ||
1322
+ (sp->tbuf = (uint8*) _TIFFmalloc(sp->tbuflen * sizeof (int16))) == NULL) {
1323
+ TIFFErrorExt(tif->tif_clientdata, module, "No space for SGILog translation buffer");
1324
+ return (0);
1325
+ }
1326
+ return (1);
1327
+ }
1328
+
1329
+ static int
1330
+ LogLuvGuessDataFmt(TIFFDirectory *td)
1331
+ {
1332
+ int guess;
1333
+
1334
+ /*
1335
+ * If the user didn't tell us their datafmt,
1336
+ * take our best guess from the bitspersample.
1337
+ */
1338
+ #define PACK(a,b) (((a)<<3)|(b))
1339
+ switch (PACK(td->td_bitspersample, td->td_sampleformat)) {
1340
+ case PACK(32, SAMPLEFORMAT_IEEEFP):
1341
+ guess = SGILOGDATAFMT_FLOAT;
1342
+ break;
1343
+ case PACK(32, SAMPLEFORMAT_VOID):
1344
+ case PACK(32, SAMPLEFORMAT_UINT):
1345
+ case PACK(32, SAMPLEFORMAT_INT):
1346
+ guess = SGILOGDATAFMT_RAW;
1347
+ break;
1348
+ case PACK(16, SAMPLEFORMAT_VOID):
1349
+ case PACK(16, SAMPLEFORMAT_INT):
1350
+ case PACK(16, SAMPLEFORMAT_UINT):
1351
+ guess = SGILOGDATAFMT_16BIT;
1352
+ break;
1353
+ case PACK( 8, SAMPLEFORMAT_VOID):
1354
+ case PACK( 8, SAMPLEFORMAT_UINT):
1355
+ guess = SGILOGDATAFMT_8BIT;
1356
+ break;
1357
+ default:
1358
+ guess = SGILOGDATAFMT_UNKNOWN;
1359
+ break;
1360
+ #undef PACK
1361
+ }
1362
+ /*
1363
+ * Double-check samples per pixel.
1364
+ */
1365
+ switch (td->td_samplesperpixel) {
1366
+ case 1:
1367
+ if (guess != SGILOGDATAFMT_RAW)
1368
+ guess = SGILOGDATAFMT_UNKNOWN;
1369
+ break;
1370
+ case 3:
1371
+ if (guess == SGILOGDATAFMT_RAW)
1372
+ guess = SGILOGDATAFMT_UNKNOWN;
1373
+ break;
1374
+ default:
1375
+ guess = SGILOGDATAFMT_UNKNOWN;
1376
+ break;
1377
+ }
1378
+ return (guess);
1379
+ }
1380
+
1381
+ static int
1382
+ LogLuvInitState(TIFF* tif)
1383
+ {
1384
+ static const char module[] = "LogLuvInitState";
1385
+ TIFFDirectory* td = &tif->tif_dir;
1386
+ LogLuvState* sp = DecoderState(tif);
1387
+
1388
+ assert(sp != NULL);
1389
+ assert(td->td_photometric == PHOTOMETRIC_LOGLUV);
1390
+
1391
+ /* for some reason, we can't do this in TIFFInitLogLuv */
1392
+ if (td->td_planarconfig != PLANARCONFIG_CONTIG) {
1393
+ TIFFErrorExt(tif->tif_clientdata, module,
1394
+ "SGILog compression cannot handle non-contiguous data");
1395
+ return (0);
1396
+ }
1397
+ if (sp->user_datafmt == SGILOGDATAFMT_UNKNOWN)
1398
+ sp->user_datafmt = LogLuvGuessDataFmt(td);
1399
+ switch (sp->user_datafmt) {
1400
+ case SGILOGDATAFMT_FLOAT:
1401
+ sp->pixel_size = 3*sizeof (float);
1402
+ break;
1403
+ case SGILOGDATAFMT_16BIT:
1404
+ sp->pixel_size = 3*sizeof (int16);
1405
+ break;
1406
+ case SGILOGDATAFMT_RAW:
1407
+ sp->pixel_size = sizeof (uint32);
1408
+ break;
1409
+ case SGILOGDATAFMT_8BIT:
1410
+ sp->pixel_size = 3*sizeof (uint8);
1411
+ break;
1412
+ default:
1413
+ TIFFErrorExt(tif->tif_clientdata, module,
1414
+ "No support for converting user data format to LogLuv");
1415
+ return (0);
1416
+ }
1417
+ if( isTiled(tif) )
1418
+ sp->tbuflen = multiply_ms(td->td_tilewidth, td->td_tilelength);
1419
+ else if( td->td_rowsperstrip < td->td_imagelength )
1420
+ sp->tbuflen = multiply_ms(td->td_imagewidth, td->td_rowsperstrip);
1421
+ else
1422
+ sp->tbuflen = multiply_ms(td->td_imagewidth, td->td_imagelength);
1423
+ if (multiply_ms(sp->tbuflen, sizeof (uint32)) == 0 ||
1424
+ (sp->tbuf = (uint8*) _TIFFmalloc(sp->tbuflen * sizeof (uint32))) == NULL) {
1425
+ TIFFErrorExt(tif->tif_clientdata, module, "No space for SGILog translation buffer");
1426
+ return (0);
1427
+ }
1428
+ return (1);
1429
+ }
1430
+
1431
+ static int
1432
+ LogLuvFixupTags(TIFF* tif)
1433
+ {
1434
+ (void) tif;
1435
+ return (1);
1436
+ }
1437
+
1438
+ static int
1439
+ LogLuvSetupDecode(TIFF* tif)
1440
+ {
1441
+ static const char module[] = "LogLuvSetupDecode";
1442
+ LogLuvState* sp = DecoderState(tif);
1443
+ TIFFDirectory* td = &tif->tif_dir;
1444
+
1445
+ tif->tif_postdecode = _TIFFNoPostDecode;
1446
+ switch (td->td_photometric) {
1447
+ case PHOTOMETRIC_LOGLUV:
1448
+ if (!LogLuvInitState(tif))
1449
+ break;
1450
+ if (td->td_compression == COMPRESSION_SGILOG24) {
1451
+ tif->tif_decoderow = LogLuvDecode24;
1452
+ switch (sp->user_datafmt) {
1453
+ case SGILOGDATAFMT_FLOAT:
1454
+ sp->tfunc = Luv24toXYZ;
1455
+ break;
1456
+ case SGILOGDATAFMT_16BIT:
1457
+ sp->tfunc = Luv24toLuv48;
1458
+ break;
1459
+ case SGILOGDATAFMT_8BIT:
1460
+ sp->tfunc = Luv24toRGB;
1461
+ break;
1462
+ }
1463
+ } else {
1464
+ tif->tif_decoderow = LogLuvDecode32;
1465
+ switch (sp->user_datafmt) {
1466
+ case SGILOGDATAFMT_FLOAT:
1467
+ sp->tfunc = Luv32toXYZ;
1468
+ break;
1469
+ case SGILOGDATAFMT_16BIT:
1470
+ sp->tfunc = Luv32toLuv48;
1471
+ break;
1472
+ case SGILOGDATAFMT_8BIT:
1473
+ sp->tfunc = Luv32toRGB;
1474
+ break;
1475
+ }
1476
+ }
1477
+ return (1);
1478
+ case PHOTOMETRIC_LOGL:
1479
+ if (!LogL16InitState(tif))
1480
+ break;
1481
+ tif->tif_decoderow = LogL16Decode;
1482
+ switch (sp->user_datafmt) {
1483
+ case SGILOGDATAFMT_FLOAT:
1484
+ sp->tfunc = L16toY;
1485
+ break;
1486
+ case SGILOGDATAFMT_8BIT:
1487
+ sp->tfunc = L16toGry;
1488
+ break;
1489
+ }
1490
+ return (1);
1491
+ default:
1492
+ TIFFErrorExt(tif->tif_clientdata, module,
1493
+ "Inappropriate photometric interpretation %d for SGILog compression; %s",
1494
+ td->td_photometric, "must be either LogLUV or LogL");
1495
+ break;
1496
+ }
1497
+ return (0);
1498
+ }
1499
+
1500
+ static int
1501
+ LogLuvSetupEncode(TIFF* tif)
1502
+ {
1503
+ static const char module[] = "LogLuvSetupEncode";
1504
+ LogLuvState* sp = EncoderState(tif);
1505
+ TIFFDirectory* td = &tif->tif_dir;
1506
+
1507
+ switch (td->td_photometric) {
1508
+ case PHOTOMETRIC_LOGLUV:
1509
+ if (!LogLuvInitState(tif))
1510
+ break;
1511
+ if (td->td_compression == COMPRESSION_SGILOG24) {
1512
+ tif->tif_encoderow = LogLuvEncode24;
1513
+ switch (sp->user_datafmt) {
1514
+ case SGILOGDATAFMT_FLOAT:
1515
+ sp->tfunc = Luv24fromXYZ;
1516
+ break;
1517
+ case SGILOGDATAFMT_16BIT:
1518
+ sp->tfunc = Luv24fromLuv48;
1519
+ break;
1520
+ case SGILOGDATAFMT_RAW:
1521
+ break;
1522
+ default:
1523
+ goto notsupported;
1524
+ }
1525
+ } else {
1526
+ tif->tif_encoderow = LogLuvEncode32;
1527
+ switch (sp->user_datafmt) {
1528
+ case SGILOGDATAFMT_FLOAT:
1529
+ sp->tfunc = Luv32fromXYZ;
1530
+ break;
1531
+ case SGILOGDATAFMT_16BIT:
1532
+ sp->tfunc = Luv32fromLuv48;
1533
+ break;
1534
+ case SGILOGDATAFMT_RAW:
1535
+ break;
1536
+ default:
1537
+ goto notsupported;
1538
+ }
1539
+ }
1540
+ break;
1541
+ case PHOTOMETRIC_LOGL:
1542
+ if (!LogL16InitState(tif))
1543
+ break;
1544
+ tif->tif_encoderow = LogL16Encode;
1545
+ switch (sp->user_datafmt) {
1546
+ case SGILOGDATAFMT_FLOAT:
1547
+ sp->tfunc = L16fromY;
1548
+ break;
1549
+ case SGILOGDATAFMT_16BIT:
1550
+ break;
1551
+ default:
1552
+ goto notsupported;
1553
+ }
1554
+ break;
1555
+ default:
1556
+ TIFFErrorExt(tif->tif_clientdata, module,
1557
+ "Inappropriate photometric interpretation %d for SGILog compression; %s",
1558
+ td->td_photometric, "must be either LogLUV or LogL");
1559
+ break;
1560
+ }
1561
+ sp->encoder_state = 1;
1562
+ return (1);
1563
+ notsupported:
1564
+ TIFFErrorExt(tif->tif_clientdata, module,
1565
+ "SGILog compression supported only for %s, or raw data",
1566
+ td->td_photometric == PHOTOMETRIC_LOGL ? "Y, L" : "XYZ, Luv");
1567
+ return (0);
1568
+ }
1569
+
1570
+ static void
1571
+ LogLuvClose(TIFF* tif)
1572
+ {
1573
+ LogLuvState* sp = (LogLuvState*) tif->tif_data;
1574
+ TIFFDirectory *td = &tif->tif_dir;
1575
+
1576
+ assert(sp != 0);
1577
+ /*
1578
+ * For consistency, we always want to write out the same
1579
+ * bitspersample and sampleformat for our TIFF file,
1580
+ * regardless of the data format being used by the application.
1581
+ * Since this routine is called after tags have been set but
1582
+ * before they have been recorded in the file, we reset them here.
1583
+ * Note: this is really a nasty approach. See PixarLogClose
1584
+ */
1585
+ if( sp->encoder_state )
1586
+ {
1587
+ /* See PixarLogClose. Might avoid issues with tags whose size depends
1588
+ * on those below, but not completely sure this is enough. */
1589
+ td->td_samplesperpixel =
1590
+ (td->td_photometric == PHOTOMETRIC_LOGL) ? 1 : 3;
1591
+ td->td_bitspersample = 16;
1592
+ td->td_sampleformat = SAMPLEFORMAT_INT;
1593
+ }
1594
+ }
1595
+
1596
+ static void
1597
+ LogLuvCleanup(TIFF* tif)
1598
+ {
1599
+ LogLuvState* sp = (LogLuvState *)tif->tif_data;
1600
+
1601
+ assert(sp != 0);
1602
+
1603
+ tif->tif_tagmethods.vgetfield = sp->vgetparent;
1604
+ tif->tif_tagmethods.vsetfield = sp->vsetparent;
1605
+
1606
+ if (sp->tbuf)
1607
+ _TIFFfree(sp->tbuf);
1608
+ _TIFFfree(sp);
1609
+ tif->tif_data = NULL;
1610
+
1611
+ _TIFFSetDefaultCompressionState(tif);
1612
+ }
1613
+
1614
+ static int
1615
+ LogLuvVSetField(TIFF* tif, uint32 tag, va_list ap)
1616
+ {
1617
+ static const char module[] = "LogLuvVSetField";
1618
+ LogLuvState* sp = DecoderState(tif);
1619
+ int bps, fmt;
1620
+
1621
+ switch (tag) {
1622
+ case TIFFTAG_SGILOGDATAFMT:
1623
+ sp->user_datafmt = (int) va_arg(ap, int);
1624
+ /*
1625
+ * Tweak the TIFF header so that the rest of libtiff knows what
1626
+ * size of data will be passed between app and library, and
1627
+ * assume that the app knows what it is doing and is not
1628
+ * confused by these header manipulations...
1629
+ */
1630
+ switch (sp->user_datafmt) {
1631
+ case SGILOGDATAFMT_FLOAT:
1632
+ bps = 32;
1633
+ fmt = SAMPLEFORMAT_IEEEFP;
1634
+ break;
1635
+ case SGILOGDATAFMT_16BIT:
1636
+ bps = 16;
1637
+ fmt = SAMPLEFORMAT_INT;
1638
+ break;
1639
+ case SGILOGDATAFMT_RAW:
1640
+ bps = 32;
1641
+ fmt = SAMPLEFORMAT_UINT;
1642
+ TIFFSetField(tif, TIFFTAG_SAMPLESPERPIXEL, 1);
1643
+ break;
1644
+ case SGILOGDATAFMT_8BIT:
1645
+ bps = 8;
1646
+ fmt = SAMPLEFORMAT_UINT;
1647
+ break;
1648
+ default:
1649
+ TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
1650
+ "Unknown data format %d for LogLuv compression",
1651
+ sp->user_datafmt);
1652
+ return (0);
1653
+ }
1654
+ TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, bps);
1655
+ TIFFSetField(tif, TIFFTAG_SAMPLEFORMAT, fmt);
1656
+ /*
1657
+ * Must recalculate sizes should bits/sample change.
1658
+ */
1659
+ tif->tif_tilesize = isTiled(tif) ? TIFFTileSize(tif) : (tmsize_t) -1;
1660
+ tif->tif_scanlinesize = TIFFScanlineSize(tif);
1661
+ return (1);
1662
+ case TIFFTAG_SGILOGENCODE:
1663
+ sp->encode_meth = (int) va_arg(ap, int);
1664
+ if (sp->encode_meth != SGILOGENCODE_NODITHER &&
1665
+ sp->encode_meth != SGILOGENCODE_RANDITHER) {
1666
+ TIFFErrorExt(tif->tif_clientdata, module,
1667
+ "Unknown encoding %d for LogLuv compression",
1668
+ sp->encode_meth);
1669
+ return (0);
1670
+ }
1671
+ return (1);
1672
+ default:
1673
+ return (*sp->vsetparent)(tif, tag, ap);
1674
+ }
1675
+ }
1676
+
1677
+ static int
1678
+ LogLuvVGetField(TIFF* tif, uint32 tag, va_list ap)
1679
+ {
1680
+ LogLuvState *sp = (LogLuvState *)tif->tif_data;
1681
+
1682
+ switch (tag) {
1683
+ case TIFFTAG_SGILOGDATAFMT:
1684
+ *va_arg(ap, int*) = sp->user_datafmt;
1685
+ return (1);
1686
+ default:
1687
+ return (*sp->vgetparent)(tif, tag, ap);
1688
+ }
1689
+ }
1690
+
1691
+ static const TIFFField LogLuvFields[] = {
1692
+ { TIFFTAG_SGILOGDATAFMT, 0, 0, TIFF_SHORT, 0, TIFF_SETGET_INT, TIFF_SETGET_UNDEFINED, FIELD_PSEUDO, TRUE, FALSE, "SGILogDataFmt", NULL},
1693
+ { TIFFTAG_SGILOGENCODE, 0, 0, TIFF_SHORT, 0, TIFF_SETGET_INT, TIFF_SETGET_UNDEFINED, FIELD_PSEUDO, TRUE, FALSE, "SGILogEncode", NULL}
1694
+ };
1695
+
1696
+ int
1697
+ TIFFInitSGILog(TIFF* tif, int scheme)
1698
+ {
1699
+ static const char module[] = "TIFFInitSGILog";
1700
+ LogLuvState* sp;
1701
+
1702
+ assert(scheme == COMPRESSION_SGILOG24 || scheme == COMPRESSION_SGILOG);
1703
+
1704
+ /*
1705
+ * Merge codec-specific tag information.
1706
+ */
1707
+ if (!_TIFFMergeFields(tif, LogLuvFields,
1708
+ TIFFArrayCount(LogLuvFields))) {
1709
+ TIFFErrorExt(tif->tif_clientdata, module,
1710
+ "Merging SGILog codec-specific tags failed");
1711
+ return 0;
1712
+ }
1713
+
1714
+ /*
1715
+ * Allocate state block so tag methods have storage to record values.
1716
+ */
1717
+ tif->tif_data = (uint8*) _TIFFmalloc(sizeof (LogLuvState));
1718
+ if (tif->tif_data == NULL)
1719
+ goto bad;
1720
+ sp = (LogLuvState*) tif->tif_data;
1721
+ _TIFFmemset((void*)sp, 0, sizeof (*sp));
1722
+ sp->user_datafmt = SGILOGDATAFMT_UNKNOWN;
1723
+ sp->encode_meth = (scheme == COMPRESSION_SGILOG24) ?
1724
+ SGILOGENCODE_RANDITHER : SGILOGENCODE_NODITHER;
1725
+ sp->tfunc = _logLuvNop;
1726
+
1727
+ /*
1728
+ * Install codec methods.
1729
+ * NB: tif_decoderow & tif_encoderow are filled
1730
+ * in at setup time.
1731
+ */
1732
+ tif->tif_fixuptags = LogLuvFixupTags;
1733
+ tif->tif_setupdecode = LogLuvSetupDecode;
1734
+ tif->tif_decodestrip = LogLuvDecodeStrip;
1735
+ tif->tif_decodetile = LogLuvDecodeTile;
1736
+ tif->tif_setupencode = LogLuvSetupEncode;
1737
+ tif->tif_encodestrip = LogLuvEncodeStrip;
1738
+ tif->tif_encodetile = LogLuvEncodeTile;
1739
+ tif->tif_close = LogLuvClose;
1740
+ tif->tif_cleanup = LogLuvCleanup;
1741
+
1742
+ /*
1743
+ * Override parent get/set field methods.
1744
+ */
1745
+ sp->vgetparent = tif->tif_tagmethods.vgetfield;
1746
+ tif->tif_tagmethods.vgetfield = LogLuvVGetField; /* hook for codec tags */
1747
+ sp->vsetparent = tif->tif_tagmethods.vsetfield;
1748
+ tif->tif_tagmethods.vsetfield = LogLuvVSetField; /* hook for codec tags */
1749
+
1750
+ return (1);
1751
+ bad:
1752
+ TIFFErrorExt(tif->tif_clientdata, module,
1753
+ "%s: No space for LogLuv state block", tif->tif_name);
1754
+ return (0);
1755
+ }
1756
+ #endif /* LOGLUV_SUPPORT */
1757
+
1758
+ /* vim: set ts=8 sts=8 sw=8 noet: */
1759
+ /*
1760
+ * Local Variables:
1761
+ * mode: c
1762
+ * c-basic-offset: 8
1763
+ * fill-column: 78
1764
+ * End:
1765
+ */