laag-libtiff 4.0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (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,311 @@
1
+ /* $Id: tif_packbits.c,v 1.26 2017-05-14 02:26:07 erouault Exp $ */
2
+
3
+ /*
4
+ * Copyright (c) 1988-1997 Sam Leffler
5
+ * Copyright (c) 1991-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 and Silicon Graphics may not be used in any advertising or
12
+ * publicity relating to the software without the specific, prior written
13
+ * permission of Sam Leffler 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 OR SILICON GRAPHICS BE LIABLE FOR
20
+ * 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 PACKBITS_SUPPORT
29
+ /*
30
+ * TIFF Library.
31
+ *
32
+ * PackBits Compression Algorithm Support
33
+ */
34
+ #include <stdio.h>
35
+
36
+ static int
37
+ PackBitsPreEncode(TIFF* tif, uint16 s)
38
+ {
39
+ (void) s;
40
+
41
+ tif->tif_data = (uint8*)_TIFFmalloc(sizeof(tmsize_t));
42
+ if (tif->tif_data == NULL)
43
+ return (0);
44
+ /*
45
+ * Calculate the scanline/tile-width size in bytes.
46
+ */
47
+ if (isTiled(tif))
48
+ *(tmsize_t*)tif->tif_data = TIFFTileRowSize(tif);
49
+ else
50
+ *(tmsize_t*)tif->tif_data = TIFFScanlineSize(tif);
51
+ return (1);
52
+ }
53
+
54
+ static int
55
+ PackBitsPostEncode(TIFF* tif)
56
+ {
57
+ if (tif->tif_data)
58
+ _TIFFfree(tif->tif_data);
59
+ return (1);
60
+ }
61
+
62
+ /*
63
+ * Encode a run of pixels.
64
+ */
65
+ static int
66
+ PackBitsEncode(TIFF* tif, uint8* buf, tmsize_t cc, uint16 s)
67
+ {
68
+ unsigned char* bp = (unsigned char*) buf;
69
+ uint8* op;
70
+ uint8* ep;
71
+ uint8* lastliteral;
72
+ long n, slop;
73
+ int b;
74
+ enum { BASE, LITERAL, RUN, LITERAL_RUN } state;
75
+
76
+ (void) s;
77
+ op = tif->tif_rawcp;
78
+ ep = tif->tif_rawdata + tif->tif_rawdatasize;
79
+ state = BASE;
80
+ lastliteral = 0;
81
+ while (cc > 0) {
82
+ /*
83
+ * Find the longest string of identical bytes.
84
+ */
85
+ b = *bp++;
86
+ cc--;
87
+ n = 1;
88
+ for (; cc > 0 && b == *bp; cc--, bp++)
89
+ n++;
90
+ again:
91
+ if (op + 2 >= ep) { /* insure space for new data */
92
+ /*
93
+ * Be careful about writing the last
94
+ * literal. Must write up to that point
95
+ * and then copy the remainder to the
96
+ * front of the buffer.
97
+ */
98
+ if (state == LITERAL || state == LITERAL_RUN) {
99
+ slop = (long)(op - lastliteral);
100
+ tif->tif_rawcc += (tmsize_t)(lastliteral - tif->tif_rawcp);
101
+ if (!TIFFFlushData1(tif))
102
+ return (0);
103
+ op = tif->tif_rawcp;
104
+ while (slop-- > 0)
105
+ *op++ = *lastliteral++;
106
+ lastliteral = tif->tif_rawcp;
107
+ } else {
108
+ tif->tif_rawcc += (tmsize_t)(op - tif->tif_rawcp);
109
+ if (!TIFFFlushData1(tif))
110
+ return (0);
111
+ op = tif->tif_rawcp;
112
+ }
113
+ }
114
+ switch (state) {
115
+ case BASE: /* initial state, set run/literal */
116
+ if (n > 1) {
117
+ state = RUN;
118
+ if (n > 128) {
119
+ *op++ = (uint8) -127;
120
+ *op++ = (uint8) b;
121
+ n -= 128;
122
+ goto again;
123
+ }
124
+ *op++ = (uint8)(-(n-1));
125
+ *op++ = (uint8) b;
126
+ } else {
127
+ lastliteral = op;
128
+ *op++ = 0;
129
+ *op++ = (uint8) b;
130
+ state = LITERAL;
131
+ }
132
+ break;
133
+ case LITERAL: /* last object was literal string */
134
+ if (n > 1) {
135
+ state = LITERAL_RUN;
136
+ if (n > 128) {
137
+ *op++ = (uint8) -127;
138
+ *op++ = (uint8) b;
139
+ n -= 128;
140
+ goto again;
141
+ }
142
+ *op++ = (uint8)(-(n-1)); /* encode run */
143
+ *op++ = (uint8) b;
144
+ } else { /* extend literal */
145
+ if (++(*lastliteral) == 127)
146
+ state = BASE;
147
+ *op++ = (uint8) b;
148
+ }
149
+ break;
150
+ case RUN: /* last object was run */
151
+ if (n > 1) {
152
+ if (n > 128) {
153
+ *op++ = (uint8) -127;
154
+ *op++ = (uint8) b;
155
+ n -= 128;
156
+ goto again;
157
+ }
158
+ *op++ = (uint8)(-(n-1));
159
+ *op++ = (uint8) b;
160
+ } else {
161
+ lastliteral = op;
162
+ *op++ = 0;
163
+ *op++ = (uint8) b;
164
+ state = LITERAL;
165
+ }
166
+ break;
167
+ case LITERAL_RUN: /* literal followed by a run */
168
+ /*
169
+ * Check to see if previous run should
170
+ * be converted to a literal, in which
171
+ * case we convert literal-run-literal
172
+ * to a single literal.
173
+ */
174
+ if (n == 1 && op[-2] == (uint8) -1 &&
175
+ *lastliteral < 126) {
176
+ state = (((*lastliteral) += 2) == 127 ?
177
+ BASE : LITERAL);
178
+ op[-2] = op[-1]; /* replicate */
179
+ } else
180
+ state = RUN;
181
+ goto again;
182
+ }
183
+ }
184
+ tif->tif_rawcc += (tmsize_t)(op - tif->tif_rawcp);
185
+ tif->tif_rawcp = op;
186
+ return (1);
187
+ }
188
+
189
+ /*
190
+ * Encode a rectangular chunk of pixels. We break it up
191
+ * into row-sized pieces to insure that encoded runs do
192
+ * not span rows. Otherwise, there can be problems with
193
+ * the decoder if data is read, for example, by scanlines
194
+ * when it was encoded by strips.
195
+ */
196
+ static int
197
+ PackBitsEncodeChunk(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s)
198
+ {
199
+ tmsize_t rowsize = *(tmsize_t*)tif->tif_data;
200
+
201
+ while (cc > 0) {
202
+ tmsize_t chunk = rowsize;
203
+
204
+ if( cc < chunk )
205
+ chunk = cc;
206
+
207
+ if (PackBitsEncode(tif, bp, chunk, s) < 0)
208
+ return (-1);
209
+ bp += chunk;
210
+ cc -= chunk;
211
+ }
212
+ return (1);
213
+ }
214
+
215
+ static int
216
+ PackBitsDecode(TIFF* tif, uint8* op, tmsize_t occ, uint16 s)
217
+ {
218
+ static const char module[] = "PackBitsDecode";
219
+ char *bp;
220
+ tmsize_t cc;
221
+ long n;
222
+ int b;
223
+
224
+ (void) s;
225
+ bp = (char*) tif->tif_rawcp;
226
+ cc = tif->tif_rawcc;
227
+ while (cc > 0 && occ > 0) {
228
+ n = (long) *bp++;
229
+ cc--;
230
+ /*
231
+ * Watch out for compilers that
232
+ * don't sign extend chars...
233
+ */
234
+ if (n >= 128)
235
+ n -= 256;
236
+ if (n < 0) { /* replicate next byte -n+1 times */
237
+ if (n == -128) /* nop */
238
+ continue;
239
+ n = -n + 1;
240
+ if( occ < (tmsize_t)n )
241
+ {
242
+ TIFFWarningExt(tif->tif_clientdata, module,
243
+ "Discarding %lu bytes to avoid buffer overrun",
244
+ (unsigned long) ((tmsize_t)n - occ));
245
+ n = (long)occ;
246
+ }
247
+ if( cc == 0 )
248
+ {
249
+ TIFFWarningExt(tif->tif_clientdata, module,
250
+ "Terminating PackBitsDecode due to lack of data.");
251
+ break;
252
+ }
253
+ occ -= n;
254
+ b = *bp++;
255
+ cc--;
256
+ while (n-- > 0)
257
+ *op++ = (uint8) b;
258
+ } else { /* copy next n+1 bytes literally */
259
+ if (occ < (tmsize_t)(n + 1))
260
+ {
261
+ TIFFWarningExt(tif->tif_clientdata, module,
262
+ "Discarding %lu bytes to avoid buffer overrun",
263
+ (unsigned long) ((tmsize_t)n - occ + 1));
264
+ n = (long)occ - 1;
265
+ }
266
+ if (cc < (tmsize_t) (n+1))
267
+ {
268
+ TIFFWarningExt(tif->tif_clientdata, module,
269
+ "Terminating PackBitsDecode due to lack of data.");
270
+ break;
271
+ }
272
+ _TIFFmemcpy(op, bp, ++n);
273
+ op += n; occ -= n;
274
+ bp += n; cc -= n;
275
+ }
276
+ }
277
+ tif->tif_rawcp = (uint8*) bp;
278
+ tif->tif_rawcc = cc;
279
+ if (occ > 0) {
280
+ TIFFErrorExt(tif->tif_clientdata, module,
281
+ "Not enough data for scanline %lu",
282
+ (unsigned long) tif->tif_row);
283
+ return (0);
284
+ }
285
+ return (1);
286
+ }
287
+
288
+ int
289
+ TIFFInitPackBits(TIFF* tif, int scheme)
290
+ {
291
+ (void) scheme;
292
+ tif->tif_decoderow = PackBitsDecode;
293
+ tif->tif_decodestrip = PackBitsDecode;
294
+ tif->tif_decodetile = PackBitsDecode;
295
+ tif->tif_preencode = PackBitsPreEncode;
296
+ tif->tif_postencode = PackBitsPostEncode;
297
+ tif->tif_encoderow = PackBitsEncode;
298
+ tif->tif_encodestrip = PackBitsEncodeChunk;
299
+ tif->tif_encodetile = PackBitsEncodeChunk;
300
+ return (1);
301
+ }
302
+ #endif /* PACKBITS_SUPPORT */
303
+
304
+ /* vim: set ts=8 sts=8 sw=8 noet: */
305
+ /*
306
+ * Local Variables:
307
+ * mode: c
308
+ * c-basic-offset: 8
309
+ * fill-column: 78
310
+ * End:
311
+ */
@@ -0,0 +1,1485 @@
1
+ /* $Id: tif_pixarlog.c,v 1.54 2017-07-10 10:40:28 erouault Exp $ */
2
+
3
+ /*
4
+ * Copyright (c) 1996-1997 Sam Leffler
5
+ * Copyright (c) 1996 Pixar
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
+ * Pixar, Sam Leffler and Silicon Graphics may not be used in any advertising or
12
+ * publicity relating to the software without the specific, prior written
13
+ * permission of Pixar, Sam Leffler 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 PIXAR, SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
20
+ * 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 PIXARLOG_SUPPORT
29
+
30
+ /*
31
+ * TIFF Library.
32
+ * PixarLog Compression Support
33
+ *
34
+ * Contributed by Dan McCoy.
35
+ *
36
+ * PixarLog film support uses the TIFF library to store companded
37
+ * 11 bit values into a tiff file, which are compressed using the
38
+ * zip compressor.
39
+ *
40
+ * The codec can take as input and produce as output 32-bit IEEE float values
41
+ * as well as 16-bit or 8-bit unsigned integer values.
42
+ *
43
+ * On writing any of the above are converted into the internal
44
+ * 11-bit log format. In the case of 8 and 16 bit values, the
45
+ * input is assumed to be unsigned linear color values that represent
46
+ * the range 0-1. In the case of IEEE values, the 0-1 range is assumed to
47
+ * be the normal linear color range, in addition over 1 values are
48
+ * accepted up to a value of about 25.0 to encode "hot" highlights and such.
49
+ * The encoding is lossless for 8-bit values, slightly lossy for the
50
+ * other bit depths. The actual color precision should be better
51
+ * than the human eye can perceive with extra room to allow for
52
+ * error introduced by further image computation. As with any quantized
53
+ * color format, it is possible to perform image calculations which
54
+ * expose the quantization error. This format should certainly be less
55
+ * susceptible to such errors than standard 8-bit encodings, but more
56
+ * susceptible than straight 16-bit or 32-bit encodings.
57
+ *
58
+ * On reading the internal format is converted to the desired output format.
59
+ * The program can request which format it desires by setting the internal
60
+ * pseudo tag TIFFTAG_PIXARLOGDATAFMT to one of these possible values:
61
+ * PIXARLOGDATAFMT_FLOAT = provide IEEE float values.
62
+ * PIXARLOGDATAFMT_16BIT = provide unsigned 16-bit integer values
63
+ * PIXARLOGDATAFMT_8BIT = provide unsigned 8-bit integer values
64
+ *
65
+ * alternately PIXARLOGDATAFMT_8BITABGR provides unsigned 8-bit integer
66
+ * values with the difference that if there are exactly three or four channels
67
+ * (rgb or rgba) it swaps the channel order (bgr or abgr).
68
+ *
69
+ * PIXARLOGDATAFMT_11BITLOG provides the internal encoding directly
70
+ * packed in 16-bit values. However no tools are supplied for interpreting
71
+ * these values.
72
+ *
73
+ * "hot" (over 1.0) areas written in floating point get clamped to
74
+ * 1.0 in the integer data types.
75
+ *
76
+ * When the file is closed after writing, the bit depth and sample format
77
+ * are set always to appear as if 8-bit data has been written into it.
78
+ * That way a naive program unaware of the particulars of the encoding
79
+ * gets the format it is most likely able to handle.
80
+ *
81
+ * The codec does it's own horizontal differencing step on the coded
82
+ * values so the libraries predictor stuff should be turned off.
83
+ * The codec also handle byte swapping the encoded values as necessary
84
+ * since the library does not have the information necessary
85
+ * to know the bit depth of the raw unencoded buffer.
86
+ *
87
+ * NOTE: This decoder does not appear to update tif_rawcp, and tif_rawcc.
88
+ * This can cause problems with the implementation of CHUNKY_STRIP_READ_SUPPORT
89
+ * as noted in http://trac.osgeo.org/gdal/ticket/3894. FrankW - Jan'11
90
+ */
91
+
92
+ #include "tif_predict.h"
93
+ #include "zlib.h"
94
+
95
+ #include <stdio.h>
96
+ #include <stdlib.h>
97
+ #include <math.h>
98
+
99
+ /* Tables for converting to/from 11 bit coded values */
100
+
101
+ #define TSIZE 2048 /* decode table size (11-bit tokens) */
102
+ #define TSIZEP1 2049 /* Plus one for slop */
103
+ #define ONE 1250 /* token value of 1.0 exactly */
104
+ #define RATIO 1.004 /* nominal ratio for log part */
105
+
106
+ #define CODE_MASK 0x7ff /* 11 bits. */
107
+
108
+ static float Fltsize;
109
+ static float LogK1, LogK2;
110
+
111
+ #define REPEAT(n, op) { int i; i=n; do { i--; op; } while (i>0); }
112
+
113
+ static void
114
+ horizontalAccumulateF(uint16 *wp, int n, int stride, float *op,
115
+ float *ToLinearF)
116
+ {
117
+ register unsigned int cr, cg, cb, ca, mask;
118
+ register float t0, t1, t2, t3;
119
+
120
+ if (n >= stride) {
121
+ mask = CODE_MASK;
122
+ if (stride == 3) {
123
+ t0 = ToLinearF[cr = (wp[0] & mask)];
124
+ t1 = ToLinearF[cg = (wp[1] & mask)];
125
+ t2 = ToLinearF[cb = (wp[2] & mask)];
126
+ op[0] = t0;
127
+ op[1] = t1;
128
+ op[2] = t2;
129
+ n -= 3;
130
+ while (n > 0) {
131
+ wp += 3;
132
+ op += 3;
133
+ n -= 3;
134
+ t0 = ToLinearF[(cr += wp[0]) & mask];
135
+ t1 = ToLinearF[(cg += wp[1]) & mask];
136
+ t2 = ToLinearF[(cb += wp[2]) & mask];
137
+ op[0] = t0;
138
+ op[1] = t1;
139
+ op[2] = t2;
140
+ }
141
+ } else if (stride == 4) {
142
+ t0 = ToLinearF[cr = (wp[0] & mask)];
143
+ t1 = ToLinearF[cg = (wp[1] & mask)];
144
+ t2 = ToLinearF[cb = (wp[2] & mask)];
145
+ t3 = ToLinearF[ca = (wp[3] & mask)];
146
+ op[0] = t0;
147
+ op[1] = t1;
148
+ op[2] = t2;
149
+ op[3] = t3;
150
+ n -= 4;
151
+ while (n > 0) {
152
+ wp += 4;
153
+ op += 4;
154
+ n -= 4;
155
+ t0 = ToLinearF[(cr += wp[0]) & mask];
156
+ t1 = ToLinearF[(cg += wp[1]) & mask];
157
+ t2 = ToLinearF[(cb += wp[2]) & mask];
158
+ t3 = ToLinearF[(ca += wp[3]) & mask];
159
+ op[0] = t0;
160
+ op[1] = t1;
161
+ op[2] = t2;
162
+ op[3] = t3;
163
+ }
164
+ } else {
165
+ REPEAT(stride, *op = ToLinearF[*wp&mask]; wp++; op++)
166
+ n -= stride;
167
+ while (n > 0) {
168
+ REPEAT(stride,
169
+ wp[stride] += *wp; *op = ToLinearF[*wp&mask]; wp++; op++)
170
+ n -= stride;
171
+ }
172
+ }
173
+ }
174
+ }
175
+
176
+ static void
177
+ horizontalAccumulate12(uint16 *wp, int n, int stride, int16 *op,
178
+ float *ToLinearF)
179
+ {
180
+ register unsigned int cr, cg, cb, ca, mask;
181
+ register float t0, t1, t2, t3;
182
+
183
+ #define SCALE12 2048.0F
184
+ #define CLAMP12(t) (((t) < 3071) ? (uint16) (t) : 3071)
185
+
186
+ if (n >= stride) {
187
+ mask = CODE_MASK;
188
+ if (stride == 3) {
189
+ t0 = ToLinearF[cr = (wp[0] & mask)] * SCALE12;
190
+ t1 = ToLinearF[cg = (wp[1] & mask)] * SCALE12;
191
+ t2 = ToLinearF[cb = (wp[2] & mask)] * SCALE12;
192
+ op[0] = CLAMP12(t0);
193
+ op[1] = CLAMP12(t1);
194
+ op[2] = CLAMP12(t2);
195
+ n -= 3;
196
+ while (n > 0) {
197
+ wp += 3;
198
+ op += 3;
199
+ n -= 3;
200
+ t0 = ToLinearF[(cr += wp[0]) & mask] * SCALE12;
201
+ t1 = ToLinearF[(cg += wp[1]) & mask] * SCALE12;
202
+ t2 = ToLinearF[(cb += wp[2]) & mask] * SCALE12;
203
+ op[0] = CLAMP12(t0);
204
+ op[1] = CLAMP12(t1);
205
+ op[2] = CLAMP12(t2);
206
+ }
207
+ } else if (stride == 4) {
208
+ t0 = ToLinearF[cr = (wp[0] & mask)] * SCALE12;
209
+ t1 = ToLinearF[cg = (wp[1] & mask)] * SCALE12;
210
+ t2 = ToLinearF[cb = (wp[2] & mask)] * SCALE12;
211
+ t3 = ToLinearF[ca = (wp[3] & mask)] * SCALE12;
212
+ op[0] = CLAMP12(t0);
213
+ op[1] = CLAMP12(t1);
214
+ op[2] = CLAMP12(t2);
215
+ op[3] = CLAMP12(t3);
216
+ n -= 4;
217
+ while (n > 0) {
218
+ wp += 4;
219
+ op += 4;
220
+ n -= 4;
221
+ t0 = ToLinearF[(cr += wp[0]) & mask] * SCALE12;
222
+ t1 = ToLinearF[(cg += wp[1]) & mask] * SCALE12;
223
+ t2 = ToLinearF[(cb += wp[2]) & mask] * SCALE12;
224
+ t3 = ToLinearF[(ca += wp[3]) & mask] * SCALE12;
225
+ op[0] = CLAMP12(t0);
226
+ op[1] = CLAMP12(t1);
227
+ op[2] = CLAMP12(t2);
228
+ op[3] = CLAMP12(t3);
229
+ }
230
+ } else {
231
+ REPEAT(stride, t0 = ToLinearF[*wp&mask] * SCALE12;
232
+ *op = CLAMP12(t0); wp++; op++)
233
+ n -= stride;
234
+ while (n > 0) {
235
+ REPEAT(stride,
236
+ wp[stride] += *wp; t0 = ToLinearF[wp[stride]&mask]*SCALE12;
237
+ *op = CLAMP12(t0); wp++; op++)
238
+ n -= stride;
239
+ }
240
+ }
241
+ }
242
+ }
243
+
244
+ static void
245
+ horizontalAccumulate16(uint16 *wp, int n, int stride, uint16 *op,
246
+ uint16 *ToLinear16)
247
+ {
248
+ register unsigned int cr, cg, cb, ca, mask;
249
+
250
+ if (n >= stride) {
251
+ mask = CODE_MASK;
252
+ if (stride == 3) {
253
+ op[0] = ToLinear16[cr = (wp[0] & mask)];
254
+ op[1] = ToLinear16[cg = (wp[1] & mask)];
255
+ op[2] = ToLinear16[cb = (wp[2] & mask)];
256
+ n -= 3;
257
+ while (n > 0) {
258
+ wp += 3;
259
+ op += 3;
260
+ n -= 3;
261
+ op[0] = ToLinear16[(cr += wp[0]) & mask];
262
+ op[1] = ToLinear16[(cg += wp[1]) & mask];
263
+ op[2] = ToLinear16[(cb += wp[2]) & mask];
264
+ }
265
+ } else if (stride == 4) {
266
+ op[0] = ToLinear16[cr = (wp[0] & mask)];
267
+ op[1] = ToLinear16[cg = (wp[1] & mask)];
268
+ op[2] = ToLinear16[cb = (wp[2] & mask)];
269
+ op[3] = ToLinear16[ca = (wp[3] & mask)];
270
+ n -= 4;
271
+ while (n > 0) {
272
+ wp += 4;
273
+ op += 4;
274
+ n -= 4;
275
+ op[0] = ToLinear16[(cr += wp[0]) & mask];
276
+ op[1] = ToLinear16[(cg += wp[1]) & mask];
277
+ op[2] = ToLinear16[(cb += wp[2]) & mask];
278
+ op[3] = ToLinear16[(ca += wp[3]) & mask];
279
+ }
280
+ } else {
281
+ REPEAT(stride, *op = ToLinear16[*wp&mask]; wp++; op++)
282
+ n -= stride;
283
+ while (n > 0) {
284
+ REPEAT(stride,
285
+ wp[stride] += *wp; *op = ToLinear16[*wp&mask]; wp++; op++)
286
+ n -= stride;
287
+ }
288
+ }
289
+ }
290
+ }
291
+
292
+ /*
293
+ * Returns the log encoded 11-bit values with the horizontal
294
+ * differencing undone.
295
+ */
296
+ static void
297
+ horizontalAccumulate11(uint16 *wp, int n, int stride, uint16 *op)
298
+ {
299
+ register unsigned int cr, cg, cb, ca, mask;
300
+
301
+ if (n >= stride) {
302
+ mask = CODE_MASK;
303
+ if (stride == 3) {
304
+ op[0] = wp[0]; op[1] = wp[1]; op[2] = wp[2];
305
+ cr = wp[0]; cg = wp[1]; cb = wp[2];
306
+ n -= 3;
307
+ while (n > 0) {
308
+ wp += 3;
309
+ op += 3;
310
+ n -= 3;
311
+ op[0] = (uint16)((cr += wp[0]) & mask);
312
+ op[1] = (uint16)((cg += wp[1]) & mask);
313
+ op[2] = (uint16)((cb += wp[2]) & mask);
314
+ }
315
+ } else if (stride == 4) {
316
+ op[0] = wp[0]; op[1] = wp[1];
317
+ op[2] = wp[2]; op[3] = wp[3];
318
+ cr = wp[0]; cg = wp[1]; cb = wp[2]; ca = wp[3];
319
+ n -= 4;
320
+ while (n > 0) {
321
+ wp += 4;
322
+ op += 4;
323
+ n -= 4;
324
+ op[0] = (uint16)((cr += wp[0]) & mask);
325
+ op[1] = (uint16)((cg += wp[1]) & mask);
326
+ op[2] = (uint16)((cb += wp[2]) & mask);
327
+ op[3] = (uint16)((ca += wp[3]) & mask);
328
+ }
329
+ } else {
330
+ REPEAT(stride, *op = *wp&mask; wp++; op++)
331
+ n -= stride;
332
+ while (n > 0) {
333
+ REPEAT(stride,
334
+ wp[stride] += *wp; *op = *wp&mask; wp++; op++)
335
+ n -= stride;
336
+ }
337
+ }
338
+ }
339
+ }
340
+
341
+ static void
342
+ horizontalAccumulate8(uint16 *wp, int n, int stride, unsigned char *op,
343
+ unsigned char *ToLinear8)
344
+ {
345
+ register unsigned int cr, cg, cb, ca, mask;
346
+
347
+ if (n >= stride) {
348
+ mask = CODE_MASK;
349
+ if (stride == 3) {
350
+ op[0] = ToLinear8[cr = (wp[0] & mask)];
351
+ op[1] = ToLinear8[cg = (wp[1] & mask)];
352
+ op[2] = ToLinear8[cb = (wp[2] & mask)];
353
+ n -= 3;
354
+ while (n > 0) {
355
+ n -= 3;
356
+ wp += 3;
357
+ op += 3;
358
+ op[0] = ToLinear8[(cr += wp[0]) & mask];
359
+ op[1] = ToLinear8[(cg += wp[1]) & mask];
360
+ op[2] = ToLinear8[(cb += wp[2]) & mask];
361
+ }
362
+ } else if (stride == 4) {
363
+ op[0] = ToLinear8[cr = (wp[0] & mask)];
364
+ op[1] = ToLinear8[cg = (wp[1] & mask)];
365
+ op[2] = ToLinear8[cb = (wp[2] & mask)];
366
+ op[3] = ToLinear8[ca = (wp[3] & mask)];
367
+ n -= 4;
368
+ while (n > 0) {
369
+ n -= 4;
370
+ wp += 4;
371
+ op += 4;
372
+ op[0] = ToLinear8[(cr += wp[0]) & mask];
373
+ op[1] = ToLinear8[(cg += wp[1]) & mask];
374
+ op[2] = ToLinear8[(cb += wp[2]) & mask];
375
+ op[3] = ToLinear8[(ca += wp[3]) & mask];
376
+ }
377
+ } else {
378
+ REPEAT(stride, *op = ToLinear8[*wp&mask]; wp++; op++)
379
+ n -= stride;
380
+ while (n > 0) {
381
+ REPEAT(stride,
382
+ wp[stride] += *wp; *op = ToLinear8[*wp&mask]; wp++; op++)
383
+ n -= stride;
384
+ }
385
+ }
386
+ }
387
+ }
388
+
389
+
390
+ static void
391
+ horizontalAccumulate8abgr(uint16 *wp, int n, int stride, unsigned char *op,
392
+ unsigned char *ToLinear8)
393
+ {
394
+ register unsigned int cr, cg, cb, ca, mask;
395
+ register unsigned char t0, t1, t2, t3;
396
+
397
+ if (n >= stride) {
398
+ mask = CODE_MASK;
399
+ if (stride == 3) {
400
+ op[0] = 0;
401
+ t1 = ToLinear8[cb = (wp[2] & mask)];
402
+ t2 = ToLinear8[cg = (wp[1] & mask)];
403
+ t3 = ToLinear8[cr = (wp[0] & mask)];
404
+ op[1] = t1;
405
+ op[2] = t2;
406
+ op[3] = t3;
407
+ n -= 3;
408
+ while (n > 0) {
409
+ n -= 3;
410
+ wp += 3;
411
+ op += 4;
412
+ op[0] = 0;
413
+ t1 = ToLinear8[(cb += wp[2]) & mask];
414
+ t2 = ToLinear8[(cg += wp[1]) & mask];
415
+ t3 = ToLinear8[(cr += wp[0]) & mask];
416
+ op[1] = t1;
417
+ op[2] = t2;
418
+ op[3] = t3;
419
+ }
420
+ } else if (stride == 4) {
421
+ t0 = ToLinear8[ca = (wp[3] & mask)];
422
+ t1 = ToLinear8[cb = (wp[2] & mask)];
423
+ t2 = ToLinear8[cg = (wp[1] & mask)];
424
+ t3 = ToLinear8[cr = (wp[0] & mask)];
425
+ op[0] = t0;
426
+ op[1] = t1;
427
+ op[2] = t2;
428
+ op[3] = t3;
429
+ n -= 4;
430
+ while (n > 0) {
431
+ n -= 4;
432
+ wp += 4;
433
+ op += 4;
434
+ t0 = ToLinear8[(ca += wp[3]) & mask];
435
+ t1 = ToLinear8[(cb += wp[2]) & mask];
436
+ t2 = ToLinear8[(cg += wp[1]) & mask];
437
+ t3 = ToLinear8[(cr += wp[0]) & mask];
438
+ op[0] = t0;
439
+ op[1] = t1;
440
+ op[2] = t2;
441
+ op[3] = t3;
442
+ }
443
+ } else {
444
+ REPEAT(stride, *op = ToLinear8[*wp&mask]; wp++; op++)
445
+ n -= stride;
446
+ while (n > 0) {
447
+ REPEAT(stride,
448
+ wp[stride] += *wp; *op = ToLinear8[*wp&mask]; wp++; op++)
449
+ n -= stride;
450
+ }
451
+ }
452
+ }
453
+ }
454
+
455
+ /*
456
+ * State block for each open TIFF
457
+ * file using PixarLog compression/decompression.
458
+ */
459
+ typedef struct {
460
+ TIFFPredictorState predict;
461
+ z_stream stream;
462
+ tmsize_t tbuf_size; /* only set/used on reading for now */
463
+ uint16 *tbuf;
464
+ uint16 stride;
465
+ int state;
466
+ int user_datafmt;
467
+ int quality;
468
+ #define PLSTATE_INIT 1
469
+
470
+ TIFFVSetMethod vgetparent; /* super-class method */
471
+ TIFFVSetMethod vsetparent; /* super-class method */
472
+
473
+ float *ToLinearF;
474
+ uint16 *ToLinear16;
475
+ unsigned char *ToLinear8;
476
+ uint16 *FromLT2;
477
+ uint16 *From14; /* Really for 16-bit data, but we shift down 2 */
478
+ uint16 *From8;
479
+
480
+ } PixarLogState;
481
+
482
+ static int
483
+ PixarLogMakeTables(PixarLogState *sp)
484
+ {
485
+
486
+ /*
487
+ * We make several tables here to convert between various external
488
+ * representations (float, 16-bit, and 8-bit) and the internal
489
+ * 11-bit companded representation. The 11-bit representation has two
490
+ * distinct regions. A linear bottom end up through .018316 in steps
491
+ * of about .000073, and a region of constant ratio up to about 25.
492
+ * These floating point numbers are stored in the main table ToLinearF.
493
+ * All other tables are derived from this one. The tables (and the
494
+ * ratios) are continuous at the internal seam.
495
+ */
496
+
497
+ int nlin, lt2size;
498
+ int i, j;
499
+ double b, c, linstep, v;
500
+ float *ToLinearF;
501
+ uint16 *ToLinear16;
502
+ unsigned char *ToLinear8;
503
+ uint16 *FromLT2;
504
+ uint16 *From14; /* Really for 16-bit data, but we shift down 2 */
505
+ uint16 *From8;
506
+
507
+ c = log(RATIO);
508
+ nlin = (int)(1./c); /* nlin must be an integer */
509
+ c = 1./nlin;
510
+ b = exp(-c*ONE); /* multiplicative scale factor [b*exp(c*ONE) = 1] */
511
+ linstep = b*c*exp(1.);
512
+
513
+ LogK1 = (float)(1./c); /* if (v >= 2) token = k1*log(v*k2) */
514
+ LogK2 = (float)(1./b);
515
+ lt2size = (int)(2./linstep) + 1;
516
+ FromLT2 = (uint16 *)_TIFFmalloc(lt2size*sizeof(uint16));
517
+ From14 = (uint16 *)_TIFFmalloc(16384*sizeof(uint16));
518
+ From8 = (uint16 *)_TIFFmalloc(256*sizeof(uint16));
519
+ ToLinearF = (float *)_TIFFmalloc(TSIZEP1 * sizeof(float));
520
+ ToLinear16 = (uint16 *)_TIFFmalloc(TSIZEP1 * sizeof(uint16));
521
+ ToLinear8 = (unsigned char *)_TIFFmalloc(TSIZEP1 * sizeof(unsigned char));
522
+ if (FromLT2 == NULL || From14 == NULL || From8 == NULL ||
523
+ ToLinearF == NULL || ToLinear16 == NULL || ToLinear8 == NULL) {
524
+ if (FromLT2) _TIFFfree(FromLT2);
525
+ if (From14) _TIFFfree(From14);
526
+ if (From8) _TIFFfree(From8);
527
+ if (ToLinearF) _TIFFfree(ToLinearF);
528
+ if (ToLinear16) _TIFFfree(ToLinear16);
529
+ if (ToLinear8) _TIFFfree(ToLinear8);
530
+ sp->FromLT2 = NULL;
531
+ sp->From14 = NULL;
532
+ sp->From8 = NULL;
533
+ sp->ToLinearF = NULL;
534
+ sp->ToLinear16 = NULL;
535
+ sp->ToLinear8 = NULL;
536
+ return 0;
537
+ }
538
+
539
+ j = 0;
540
+
541
+ for (i = 0; i < nlin; i++) {
542
+ v = i * linstep;
543
+ ToLinearF[j++] = (float)v;
544
+ }
545
+
546
+ for (i = nlin; i < TSIZE; i++)
547
+ ToLinearF[j++] = (float)(b*exp(c*i));
548
+
549
+ ToLinearF[2048] = ToLinearF[2047];
550
+
551
+ for (i = 0; i < TSIZEP1; i++) {
552
+ v = ToLinearF[i]*65535.0 + 0.5;
553
+ ToLinear16[i] = (v > 65535.0) ? 65535 : (uint16)v;
554
+ v = ToLinearF[i]*255.0 + 0.5;
555
+ ToLinear8[i] = (v > 255.0) ? 255 : (unsigned char)v;
556
+ }
557
+
558
+ j = 0;
559
+ for (i = 0; i < lt2size; i++) {
560
+ if ((i*linstep)*(i*linstep) > ToLinearF[j]*ToLinearF[j+1])
561
+ j++;
562
+ FromLT2[i] = (uint16)j;
563
+ }
564
+
565
+ /*
566
+ * Since we lose info anyway on 16-bit data, we set up a 14-bit
567
+ * table and shift 16-bit values down two bits on input.
568
+ * saves a little table space.
569
+ */
570
+ j = 0;
571
+ for (i = 0; i < 16384; i++) {
572
+ while ((i/16383.)*(i/16383.) > ToLinearF[j]*ToLinearF[j+1])
573
+ j++;
574
+ From14[i] = (uint16)j;
575
+ }
576
+
577
+ j = 0;
578
+ for (i = 0; i < 256; i++) {
579
+ while ((i/255.)*(i/255.) > ToLinearF[j]*ToLinearF[j+1])
580
+ j++;
581
+ From8[i] = (uint16)j;
582
+ }
583
+
584
+ Fltsize = (float)(lt2size/2);
585
+
586
+ sp->ToLinearF = ToLinearF;
587
+ sp->ToLinear16 = ToLinear16;
588
+ sp->ToLinear8 = ToLinear8;
589
+ sp->FromLT2 = FromLT2;
590
+ sp->From14 = From14;
591
+ sp->From8 = From8;
592
+
593
+ return 1;
594
+ }
595
+
596
+ #define DecoderState(tif) ((PixarLogState*) (tif)->tif_data)
597
+ #define EncoderState(tif) ((PixarLogState*) (tif)->tif_data)
598
+
599
+ static int PixarLogEncode(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s);
600
+ static int PixarLogDecode(TIFF* tif, uint8* op, tmsize_t occ, uint16 s);
601
+
602
+ #define PIXARLOGDATAFMT_UNKNOWN -1
603
+
604
+ static int
605
+ PixarLogGuessDataFmt(TIFFDirectory *td)
606
+ {
607
+ int guess = PIXARLOGDATAFMT_UNKNOWN;
608
+ int format = td->td_sampleformat;
609
+
610
+ /* If the user didn't tell us his datafmt,
611
+ * take our best guess from the bitspersample.
612
+ */
613
+ switch (td->td_bitspersample) {
614
+ case 32:
615
+ if (format == SAMPLEFORMAT_IEEEFP)
616
+ guess = PIXARLOGDATAFMT_FLOAT;
617
+ break;
618
+ case 16:
619
+ if (format == SAMPLEFORMAT_VOID || format == SAMPLEFORMAT_UINT)
620
+ guess = PIXARLOGDATAFMT_16BIT;
621
+ break;
622
+ case 12:
623
+ if (format == SAMPLEFORMAT_VOID || format == SAMPLEFORMAT_INT)
624
+ guess = PIXARLOGDATAFMT_12BITPICIO;
625
+ break;
626
+ case 11:
627
+ if (format == SAMPLEFORMAT_VOID || format == SAMPLEFORMAT_UINT)
628
+ guess = PIXARLOGDATAFMT_11BITLOG;
629
+ break;
630
+ case 8:
631
+ if (format == SAMPLEFORMAT_VOID || format == SAMPLEFORMAT_UINT)
632
+ guess = PIXARLOGDATAFMT_8BIT;
633
+ break;
634
+ }
635
+
636
+ return guess;
637
+ }
638
+
639
+ #define TIFF_SIZE_T_MAX ((size_t) ~ ((size_t)0))
640
+ #define TIFF_TMSIZE_T_MAX (tmsize_t)(TIFF_SIZE_T_MAX >> 1)
641
+
642
+ static tmsize_t
643
+ multiply_ms(tmsize_t m1, tmsize_t m2)
644
+ {
645
+ if( m1 == 0 || m2 > TIFF_TMSIZE_T_MAX / m1 )
646
+ return 0;
647
+ return m1 * m2;
648
+ }
649
+
650
+ static tmsize_t
651
+ add_ms(tmsize_t m1, tmsize_t m2)
652
+ {
653
+ /* if either input is zero, assume overflow already occurred */
654
+ if (m1 == 0 || m2 == 0)
655
+ return 0;
656
+ else if (m1 > TIFF_TMSIZE_T_MAX - m2)
657
+ return 0;
658
+
659
+ return m1 + m2;
660
+ }
661
+
662
+ static int
663
+ PixarLogFixupTags(TIFF* tif)
664
+ {
665
+ (void) tif;
666
+ return (1);
667
+ }
668
+
669
+ static int
670
+ PixarLogSetupDecode(TIFF* tif)
671
+ {
672
+ static const char module[] = "PixarLogSetupDecode";
673
+ TIFFDirectory *td = &tif->tif_dir;
674
+ PixarLogState* sp = DecoderState(tif);
675
+ tmsize_t tbuf_size;
676
+ uint32 strip_height;
677
+
678
+ assert(sp != NULL);
679
+
680
+ /* This function can possibly be called several times by */
681
+ /* PredictorSetupDecode() if this function succeeds but */
682
+ /* PredictorSetup() fails */
683
+ if( (sp->state & PLSTATE_INIT) != 0 )
684
+ return 1;
685
+
686
+ strip_height = td->td_rowsperstrip;
687
+ if( strip_height > td->td_imagelength )
688
+ strip_height = td->td_imagelength;
689
+
690
+ /* Make sure no byte swapping happens on the data
691
+ * after decompression. */
692
+ tif->tif_postdecode = _TIFFNoPostDecode;
693
+
694
+ /* for some reason, we can't do this in TIFFInitPixarLog */
695
+
696
+ sp->stride = (td->td_planarconfig == PLANARCONFIG_CONTIG ?
697
+ td->td_samplesperpixel : 1);
698
+ tbuf_size = multiply_ms(multiply_ms(multiply_ms(sp->stride, td->td_imagewidth),
699
+ strip_height), sizeof(uint16));
700
+ /* add one more stride in case input ends mid-stride */
701
+ tbuf_size = add_ms(tbuf_size, sizeof(uint16) * sp->stride);
702
+ if (tbuf_size == 0)
703
+ return (0); /* TODO: this is an error return without error report through TIFFErrorExt */
704
+ sp->tbuf = (uint16 *) _TIFFmalloc(tbuf_size);
705
+ if (sp->tbuf == NULL)
706
+ return (0);
707
+ sp->tbuf_size = tbuf_size;
708
+ if (sp->user_datafmt == PIXARLOGDATAFMT_UNKNOWN)
709
+ sp->user_datafmt = PixarLogGuessDataFmt(td);
710
+ if (sp->user_datafmt == PIXARLOGDATAFMT_UNKNOWN) {
711
+ _TIFFfree(sp->tbuf);
712
+ sp->tbuf = NULL;
713
+ sp->tbuf_size = 0;
714
+ TIFFErrorExt(tif->tif_clientdata, module,
715
+ "PixarLog compression can't handle bits depth/data format combination (depth: %d)",
716
+ td->td_bitspersample);
717
+ return (0);
718
+ }
719
+
720
+ if (inflateInit(&sp->stream) != Z_OK) {
721
+ _TIFFfree(sp->tbuf);
722
+ sp->tbuf = NULL;
723
+ sp->tbuf_size = 0;
724
+ TIFFErrorExt(tif->tif_clientdata, module, "%s", sp->stream.msg ? sp->stream.msg : "(null)");
725
+ return (0);
726
+ } else {
727
+ sp->state |= PLSTATE_INIT;
728
+ return (1);
729
+ }
730
+ }
731
+
732
+ /*
733
+ * Setup state for decoding a strip.
734
+ */
735
+ static int
736
+ PixarLogPreDecode(TIFF* tif, uint16 s)
737
+ {
738
+ static const char module[] = "PixarLogPreDecode";
739
+ PixarLogState* sp = DecoderState(tif);
740
+
741
+ (void) s;
742
+ assert(sp != NULL);
743
+ sp->stream.next_in = tif->tif_rawdata;
744
+ assert(sizeof(sp->stream.avail_in)==4); /* if this assert gets raised,
745
+ we need to simplify this code to reflect a ZLib that is likely updated
746
+ to deal with 8byte memory sizes, though this code will respond
747
+ appropriately even before we simplify it */
748
+ sp->stream.avail_in = (uInt) tif->tif_rawcc;
749
+ if ((tmsize_t)sp->stream.avail_in != tif->tif_rawcc)
750
+ {
751
+ TIFFErrorExt(tif->tif_clientdata, module, "ZLib cannot deal with buffers this size");
752
+ return (0);
753
+ }
754
+ return (inflateReset(&sp->stream) == Z_OK);
755
+ }
756
+
757
+ static int
758
+ PixarLogDecode(TIFF* tif, uint8* op, tmsize_t occ, uint16 s)
759
+ {
760
+ static const char module[] = "PixarLogDecode";
761
+ TIFFDirectory *td = &tif->tif_dir;
762
+ PixarLogState* sp = DecoderState(tif);
763
+ tmsize_t i;
764
+ tmsize_t nsamples;
765
+ int llen;
766
+ uint16 *up;
767
+
768
+ switch (sp->user_datafmt) {
769
+ case PIXARLOGDATAFMT_FLOAT:
770
+ nsamples = occ / sizeof(float); /* XXX float == 32 bits */
771
+ break;
772
+ case PIXARLOGDATAFMT_16BIT:
773
+ case PIXARLOGDATAFMT_12BITPICIO:
774
+ case PIXARLOGDATAFMT_11BITLOG:
775
+ nsamples = occ / sizeof(uint16); /* XXX uint16 == 16 bits */
776
+ break;
777
+ case PIXARLOGDATAFMT_8BIT:
778
+ case PIXARLOGDATAFMT_8BITABGR:
779
+ nsamples = occ;
780
+ break;
781
+ default:
782
+ TIFFErrorExt(tif->tif_clientdata, module,
783
+ "%d bit input not supported in PixarLog",
784
+ td->td_bitspersample);
785
+ return 0;
786
+ }
787
+
788
+ llen = sp->stride * td->td_imagewidth;
789
+
790
+ (void) s;
791
+ assert(sp != NULL);
792
+
793
+ sp->stream.next_in = tif->tif_rawcp;
794
+ sp->stream.avail_in = (uInt) tif->tif_rawcc;
795
+
796
+ sp->stream.next_out = (unsigned char *) sp->tbuf;
797
+ assert(sizeof(sp->stream.avail_out)==4); /* if this assert gets raised,
798
+ we need to simplify this code to reflect a ZLib that is likely updated
799
+ to deal with 8byte memory sizes, though this code will respond
800
+ appropriately even before we simplify it */
801
+ sp->stream.avail_out = (uInt) (nsamples * sizeof(uint16));
802
+ if (sp->stream.avail_out != nsamples * sizeof(uint16))
803
+ {
804
+ TIFFErrorExt(tif->tif_clientdata, module, "ZLib cannot deal with buffers this size");
805
+ return (0);
806
+ }
807
+ /* Check that we will not fill more than what was allocated */
808
+ if ((tmsize_t)sp->stream.avail_out > sp->tbuf_size)
809
+ {
810
+ TIFFErrorExt(tif->tif_clientdata, module, "sp->stream.avail_out > sp->tbuf_size");
811
+ return (0);
812
+ }
813
+ do {
814
+ int state = inflate(&sp->stream, Z_PARTIAL_FLUSH);
815
+ if (state == Z_STREAM_END) {
816
+ break; /* XXX */
817
+ }
818
+ if (state == Z_DATA_ERROR) {
819
+ TIFFErrorExt(tif->tif_clientdata, module,
820
+ "Decoding error at scanline %lu, %s",
821
+ (unsigned long) tif->tif_row, sp->stream.msg ? sp->stream.msg : "(null)");
822
+ if (inflateSync(&sp->stream) != Z_OK)
823
+ return (0);
824
+ continue;
825
+ }
826
+ if (state != Z_OK) {
827
+ TIFFErrorExt(tif->tif_clientdata, module, "ZLib error: %s",
828
+ sp->stream.msg ? sp->stream.msg : "(null)");
829
+ return (0);
830
+ }
831
+ } while (sp->stream.avail_out > 0);
832
+
833
+ /* hopefully, we got all the bytes we needed */
834
+ if (sp->stream.avail_out != 0) {
835
+ TIFFErrorExt(tif->tif_clientdata, module,
836
+ "Not enough data at scanline %lu (short " TIFF_UINT64_FORMAT " bytes)",
837
+ (unsigned long) tif->tif_row, (TIFF_UINT64_T) sp->stream.avail_out);
838
+ return (0);
839
+ }
840
+
841
+ tif->tif_rawcp = sp->stream.next_in;
842
+ tif->tif_rawcc = sp->stream.avail_in;
843
+
844
+ up = sp->tbuf;
845
+ /* Swap bytes in the data if from a different endian machine. */
846
+ if (tif->tif_flags & TIFF_SWAB)
847
+ TIFFSwabArrayOfShort(up, nsamples);
848
+
849
+ /*
850
+ * if llen is not an exact multiple of nsamples, the decode operation
851
+ * may overflow the output buffer, so truncate it enough to prevent
852
+ * that but still salvage as much data as possible.
853
+ */
854
+ if (nsamples % llen) {
855
+ TIFFWarningExt(tif->tif_clientdata, module,
856
+ "stride %lu is not a multiple of sample count, "
857
+ "%lu, data truncated.", (unsigned long) llen, (unsigned long) nsamples);
858
+ nsamples -= nsamples % llen;
859
+ }
860
+
861
+ for (i = 0; i < nsamples; i += llen, up += llen) {
862
+ switch (sp->user_datafmt) {
863
+ case PIXARLOGDATAFMT_FLOAT:
864
+ horizontalAccumulateF(up, llen, sp->stride,
865
+ (float *)op, sp->ToLinearF);
866
+ op += llen * sizeof(float);
867
+ break;
868
+ case PIXARLOGDATAFMT_16BIT:
869
+ horizontalAccumulate16(up, llen, sp->stride,
870
+ (uint16 *)op, sp->ToLinear16);
871
+ op += llen * sizeof(uint16);
872
+ break;
873
+ case PIXARLOGDATAFMT_12BITPICIO:
874
+ horizontalAccumulate12(up, llen, sp->stride,
875
+ (int16 *)op, sp->ToLinearF);
876
+ op += llen * sizeof(int16);
877
+ break;
878
+ case PIXARLOGDATAFMT_11BITLOG:
879
+ horizontalAccumulate11(up, llen, sp->stride,
880
+ (uint16 *)op);
881
+ op += llen * sizeof(uint16);
882
+ break;
883
+ case PIXARLOGDATAFMT_8BIT:
884
+ horizontalAccumulate8(up, llen, sp->stride,
885
+ (unsigned char *)op, sp->ToLinear8);
886
+ op += llen * sizeof(unsigned char);
887
+ break;
888
+ case PIXARLOGDATAFMT_8BITABGR:
889
+ horizontalAccumulate8abgr(up, llen, sp->stride,
890
+ (unsigned char *)op, sp->ToLinear8);
891
+ op += llen * sizeof(unsigned char);
892
+ break;
893
+ default:
894
+ TIFFErrorExt(tif->tif_clientdata, module,
895
+ "Unsupported bits/sample: %d",
896
+ td->td_bitspersample);
897
+ return (0);
898
+ }
899
+ }
900
+
901
+ return (1);
902
+ }
903
+
904
+ static int
905
+ PixarLogSetupEncode(TIFF* tif)
906
+ {
907
+ static const char module[] = "PixarLogSetupEncode";
908
+ TIFFDirectory *td = &tif->tif_dir;
909
+ PixarLogState* sp = EncoderState(tif);
910
+ tmsize_t tbuf_size;
911
+
912
+ assert(sp != NULL);
913
+
914
+ /* for some reason, we can't do this in TIFFInitPixarLog */
915
+
916
+ sp->stride = (td->td_planarconfig == PLANARCONFIG_CONTIG ?
917
+ td->td_samplesperpixel : 1);
918
+ tbuf_size = multiply_ms(multiply_ms(multiply_ms(sp->stride, td->td_imagewidth),
919
+ td->td_rowsperstrip), sizeof(uint16));
920
+ if (tbuf_size == 0)
921
+ return (0); /* TODO: this is an error return without error report through TIFFErrorExt */
922
+ sp->tbuf = (uint16 *) _TIFFmalloc(tbuf_size);
923
+ if (sp->tbuf == NULL)
924
+ return (0);
925
+ if (sp->user_datafmt == PIXARLOGDATAFMT_UNKNOWN)
926
+ sp->user_datafmt = PixarLogGuessDataFmt(td);
927
+ if (sp->user_datafmt == PIXARLOGDATAFMT_UNKNOWN) {
928
+ TIFFErrorExt(tif->tif_clientdata, module, "PixarLog compression can't handle %d bit linear encodings", td->td_bitspersample);
929
+ return (0);
930
+ }
931
+
932
+ if (deflateInit(&sp->stream, sp->quality) != Z_OK) {
933
+ TIFFErrorExt(tif->tif_clientdata, module, "%s", sp->stream.msg ? sp->stream.msg : "(null)");
934
+ return (0);
935
+ } else {
936
+ sp->state |= PLSTATE_INIT;
937
+ return (1);
938
+ }
939
+ }
940
+
941
+ /*
942
+ * Reset encoding state at the start of a strip.
943
+ */
944
+ static int
945
+ PixarLogPreEncode(TIFF* tif, uint16 s)
946
+ {
947
+ static const char module[] = "PixarLogPreEncode";
948
+ PixarLogState *sp = EncoderState(tif);
949
+
950
+ (void) s;
951
+ assert(sp != NULL);
952
+ sp->stream.next_out = tif->tif_rawdata;
953
+ assert(sizeof(sp->stream.avail_out)==4); /* if this assert gets raised,
954
+ we need to simplify this code to reflect a ZLib that is likely updated
955
+ to deal with 8byte memory sizes, though this code will respond
956
+ appropriately even before we simplify it */
957
+ sp->stream.avail_out = (uInt)tif->tif_rawdatasize;
958
+ if ((tmsize_t)sp->stream.avail_out != tif->tif_rawdatasize)
959
+ {
960
+ TIFFErrorExt(tif->tif_clientdata, module, "ZLib cannot deal with buffers this size");
961
+ return (0);
962
+ }
963
+ return (deflateReset(&sp->stream) == Z_OK);
964
+ }
965
+
966
+ static void
967
+ horizontalDifferenceF(float *ip, int n, int stride, uint16 *wp, uint16 *FromLT2)
968
+ {
969
+ int32 r1, g1, b1, a1, r2, g2, b2, a2, mask;
970
+ float fltsize = Fltsize;
971
+
972
+ #define CLAMP(v) ( (v<(float)0.) ? 0 \
973
+ : (v<(float)2.) ? FromLT2[(int)(v*fltsize)] \
974
+ : (v>(float)24.2) ? 2047 \
975
+ : LogK1*log(v*LogK2) + 0.5 )
976
+
977
+ mask = CODE_MASK;
978
+ if (n >= stride) {
979
+ if (stride == 3) {
980
+ r2 = wp[0] = (uint16) CLAMP(ip[0]);
981
+ g2 = wp[1] = (uint16) CLAMP(ip[1]);
982
+ b2 = wp[2] = (uint16) CLAMP(ip[2]);
983
+ n -= 3;
984
+ while (n > 0) {
985
+ n -= 3;
986
+ wp += 3;
987
+ ip += 3;
988
+ r1 = (int32) CLAMP(ip[0]); wp[0] = (uint16)((r1-r2) & mask); r2 = r1;
989
+ g1 = (int32) CLAMP(ip[1]); wp[1] = (uint16)((g1-g2) & mask); g2 = g1;
990
+ b1 = (int32) CLAMP(ip[2]); wp[2] = (uint16)((b1-b2) & mask); b2 = b1;
991
+ }
992
+ } else if (stride == 4) {
993
+ r2 = wp[0] = (uint16) CLAMP(ip[0]);
994
+ g2 = wp[1] = (uint16) CLAMP(ip[1]);
995
+ b2 = wp[2] = (uint16) CLAMP(ip[2]);
996
+ a2 = wp[3] = (uint16) CLAMP(ip[3]);
997
+ n -= 4;
998
+ while (n > 0) {
999
+ n -= 4;
1000
+ wp += 4;
1001
+ ip += 4;
1002
+ r1 = (int32) CLAMP(ip[0]); wp[0] = (uint16)((r1-r2) & mask); r2 = r1;
1003
+ g1 = (int32) CLAMP(ip[1]); wp[1] = (uint16)((g1-g2) & mask); g2 = g1;
1004
+ b1 = (int32) CLAMP(ip[2]); wp[2] = (uint16)((b1-b2) & mask); b2 = b1;
1005
+ a1 = (int32) CLAMP(ip[3]); wp[3] = (uint16)((a1-a2) & mask); a2 = a1;
1006
+ }
1007
+ } else {
1008
+ REPEAT(stride, wp[0] = (uint16) CLAMP(ip[0]); wp++; ip++)
1009
+ n -= stride;
1010
+ while (n > 0) {
1011
+ REPEAT(stride,
1012
+ wp[0] = (uint16)(((int32)CLAMP(ip[0])-(int32)CLAMP(ip[-stride])) & mask);
1013
+ wp++; ip++)
1014
+ n -= stride;
1015
+ }
1016
+ }
1017
+ }
1018
+ }
1019
+
1020
+ static void
1021
+ horizontalDifference16(unsigned short *ip, int n, int stride,
1022
+ unsigned short *wp, uint16 *From14)
1023
+ {
1024
+ register int r1, g1, b1, a1, r2, g2, b2, a2, mask;
1025
+
1026
+ /* assumption is unsigned pixel values */
1027
+ #undef CLAMP
1028
+ #define CLAMP(v) From14[(v) >> 2]
1029
+
1030
+ mask = CODE_MASK;
1031
+ if (n >= stride) {
1032
+ if (stride == 3) {
1033
+ r2 = wp[0] = CLAMP(ip[0]); g2 = wp[1] = CLAMP(ip[1]);
1034
+ b2 = wp[2] = CLAMP(ip[2]);
1035
+ n -= 3;
1036
+ while (n > 0) {
1037
+ n -= 3;
1038
+ wp += 3;
1039
+ ip += 3;
1040
+ r1 = CLAMP(ip[0]); wp[0] = (uint16)((r1-r2) & mask); r2 = r1;
1041
+ g1 = CLAMP(ip[1]); wp[1] = (uint16)((g1-g2) & mask); g2 = g1;
1042
+ b1 = CLAMP(ip[2]); wp[2] = (uint16)((b1-b2) & mask); b2 = b1;
1043
+ }
1044
+ } else if (stride == 4) {
1045
+ r2 = wp[0] = CLAMP(ip[0]); g2 = wp[1] = CLAMP(ip[1]);
1046
+ b2 = wp[2] = CLAMP(ip[2]); a2 = wp[3] = CLAMP(ip[3]);
1047
+ n -= 4;
1048
+ while (n > 0) {
1049
+ n -= 4;
1050
+ wp += 4;
1051
+ ip += 4;
1052
+ r1 = CLAMP(ip[0]); wp[0] = (uint16)((r1-r2) & mask); r2 = r1;
1053
+ g1 = CLAMP(ip[1]); wp[1] = (uint16)((g1-g2) & mask); g2 = g1;
1054
+ b1 = CLAMP(ip[2]); wp[2] = (uint16)((b1-b2) & mask); b2 = b1;
1055
+ a1 = CLAMP(ip[3]); wp[3] = (uint16)((a1-a2) & mask); a2 = a1;
1056
+ }
1057
+ } else {
1058
+ REPEAT(stride, wp[0] = CLAMP(ip[0]); wp++; ip++)
1059
+ n -= stride;
1060
+ while (n > 0) {
1061
+ REPEAT(stride,
1062
+ wp[0] = (uint16)((CLAMP(ip[0])-CLAMP(ip[-stride])) & mask);
1063
+ wp++; ip++)
1064
+ n -= stride;
1065
+ }
1066
+ }
1067
+ }
1068
+ }
1069
+
1070
+
1071
+ static void
1072
+ horizontalDifference8(unsigned char *ip, int n, int stride,
1073
+ unsigned short *wp, uint16 *From8)
1074
+ {
1075
+ register int r1, g1, b1, a1, r2, g2, b2, a2, mask;
1076
+
1077
+ #undef CLAMP
1078
+ #define CLAMP(v) (From8[(v)])
1079
+
1080
+ mask = CODE_MASK;
1081
+ if (n >= stride) {
1082
+ if (stride == 3) {
1083
+ r2 = wp[0] = CLAMP(ip[0]); g2 = wp[1] = CLAMP(ip[1]);
1084
+ b2 = wp[2] = CLAMP(ip[2]);
1085
+ n -= 3;
1086
+ while (n > 0) {
1087
+ n -= 3;
1088
+ r1 = CLAMP(ip[3]); wp[3] = (uint16)((r1-r2) & mask); r2 = r1;
1089
+ g1 = CLAMP(ip[4]); wp[4] = (uint16)((g1-g2) & mask); g2 = g1;
1090
+ b1 = CLAMP(ip[5]); wp[5] = (uint16)((b1-b2) & mask); b2 = b1;
1091
+ wp += 3;
1092
+ ip += 3;
1093
+ }
1094
+ } else if (stride == 4) {
1095
+ r2 = wp[0] = CLAMP(ip[0]); g2 = wp[1] = CLAMP(ip[1]);
1096
+ b2 = wp[2] = CLAMP(ip[2]); a2 = wp[3] = CLAMP(ip[3]);
1097
+ n -= 4;
1098
+ while (n > 0) {
1099
+ n -= 4;
1100
+ r1 = CLAMP(ip[4]); wp[4] = (uint16)((r1-r2) & mask); r2 = r1;
1101
+ g1 = CLAMP(ip[5]); wp[5] = (uint16)((g1-g2) & mask); g2 = g1;
1102
+ b1 = CLAMP(ip[6]); wp[6] = (uint16)((b1-b2) & mask); b2 = b1;
1103
+ a1 = CLAMP(ip[7]); wp[7] = (uint16)((a1-a2) & mask); a2 = a1;
1104
+ wp += 4;
1105
+ ip += 4;
1106
+ }
1107
+ } else {
1108
+ REPEAT(stride, wp[0] = CLAMP(ip[0]); wp++; ip++)
1109
+ n -= stride;
1110
+ while (n > 0) {
1111
+ REPEAT(stride,
1112
+ wp[0] = (uint16)((CLAMP(ip[0])-CLAMP(ip[-stride])) & mask);
1113
+ wp++; ip++)
1114
+ n -= stride;
1115
+ }
1116
+ }
1117
+ }
1118
+ }
1119
+
1120
+ /*
1121
+ * Encode a chunk of pixels.
1122
+ */
1123
+ static int
1124
+ PixarLogEncode(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s)
1125
+ {
1126
+ static const char module[] = "PixarLogEncode";
1127
+ TIFFDirectory *td = &tif->tif_dir;
1128
+ PixarLogState *sp = EncoderState(tif);
1129
+ tmsize_t i;
1130
+ tmsize_t n;
1131
+ int llen;
1132
+ unsigned short * up;
1133
+
1134
+ (void) s;
1135
+
1136
+ switch (sp->user_datafmt) {
1137
+ case PIXARLOGDATAFMT_FLOAT:
1138
+ n = cc / sizeof(float); /* XXX float == 32 bits */
1139
+ break;
1140
+ case PIXARLOGDATAFMT_16BIT:
1141
+ case PIXARLOGDATAFMT_12BITPICIO:
1142
+ case PIXARLOGDATAFMT_11BITLOG:
1143
+ n = cc / sizeof(uint16); /* XXX uint16 == 16 bits */
1144
+ break;
1145
+ case PIXARLOGDATAFMT_8BIT:
1146
+ case PIXARLOGDATAFMT_8BITABGR:
1147
+ n = cc;
1148
+ break;
1149
+ default:
1150
+ TIFFErrorExt(tif->tif_clientdata, module,
1151
+ "%d bit input not supported in PixarLog",
1152
+ td->td_bitspersample);
1153
+ return 0;
1154
+ }
1155
+
1156
+ llen = sp->stride * td->td_imagewidth;
1157
+ /* Check against the number of elements (of size uint16) of sp->tbuf */
1158
+ if( n > (tmsize_t)(td->td_rowsperstrip * llen) )
1159
+ {
1160
+ TIFFErrorExt(tif->tif_clientdata, module,
1161
+ "Too many input bytes provided");
1162
+ return 0;
1163
+ }
1164
+
1165
+ for (i = 0, up = sp->tbuf; i < n; i += llen, up += llen) {
1166
+ switch (sp->user_datafmt) {
1167
+ case PIXARLOGDATAFMT_FLOAT:
1168
+ horizontalDifferenceF((float *)bp, llen,
1169
+ sp->stride, up, sp->FromLT2);
1170
+ bp += llen * sizeof(float);
1171
+ break;
1172
+ case PIXARLOGDATAFMT_16BIT:
1173
+ horizontalDifference16((uint16 *)bp, llen,
1174
+ sp->stride, up, sp->From14);
1175
+ bp += llen * sizeof(uint16);
1176
+ break;
1177
+ case PIXARLOGDATAFMT_8BIT:
1178
+ horizontalDifference8((unsigned char *)bp, llen,
1179
+ sp->stride, up, sp->From8);
1180
+ bp += llen * sizeof(unsigned char);
1181
+ break;
1182
+ default:
1183
+ TIFFErrorExt(tif->tif_clientdata, module,
1184
+ "%d bit input not supported in PixarLog",
1185
+ td->td_bitspersample);
1186
+ return 0;
1187
+ }
1188
+ }
1189
+
1190
+ sp->stream.next_in = (unsigned char *) sp->tbuf;
1191
+ assert(sizeof(sp->stream.avail_in)==4); /* if this assert gets raised,
1192
+ we need to simplify this code to reflect a ZLib that is likely updated
1193
+ to deal with 8byte memory sizes, though this code will respond
1194
+ appropriately even before we simplify it */
1195
+ sp->stream.avail_in = (uInt) (n * sizeof(uint16));
1196
+ if ((sp->stream.avail_in / sizeof(uint16)) != (uInt) n)
1197
+ {
1198
+ TIFFErrorExt(tif->tif_clientdata, module,
1199
+ "ZLib cannot deal with buffers this size");
1200
+ return (0);
1201
+ }
1202
+
1203
+ do {
1204
+ if (deflate(&sp->stream, Z_NO_FLUSH) != Z_OK) {
1205
+ TIFFErrorExt(tif->tif_clientdata, module, "Encoder error: %s",
1206
+ sp->stream.msg ? sp->stream.msg : "(null)");
1207
+ return (0);
1208
+ }
1209
+ if (sp->stream.avail_out == 0) {
1210
+ tif->tif_rawcc = tif->tif_rawdatasize;
1211
+ TIFFFlushData1(tif);
1212
+ sp->stream.next_out = tif->tif_rawdata;
1213
+ sp->stream.avail_out = (uInt) tif->tif_rawdatasize; /* this is a safe typecast, as check is made already in PixarLogPreEncode */
1214
+ }
1215
+ } while (sp->stream.avail_in > 0);
1216
+ return (1);
1217
+ }
1218
+
1219
+ /*
1220
+ * Finish off an encoded strip by flushing the last
1221
+ * string and tacking on an End Of Information code.
1222
+ */
1223
+
1224
+ static int
1225
+ PixarLogPostEncode(TIFF* tif)
1226
+ {
1227
+ static const char module[] = "PixarLogPostEncode";
1228
+ PixarLogState *sp = EncoderState(tif);
1229
+ int state;
1230
+
1231
+ sp->stream.avail_in = 0;
1232
+
1233
+ do {
1234
+ state = deflate(&sp->stream, Z_FINISH);
1235
+ switch (state) {
1236
+ case Z_STREAM_END:
1237
+ case Z_OK:
1238
+ if ((tmsize_t)sp->stream.avail_out != tif->tif_rawdatasize) {
1239
+ tif->tif_rawcc =
1240
+ tif->tif_rawdatasize - sp->stream.avail_out;
1241
+ TIFFFlushData1(tif);
1242
+ sp->stream.next_out = tif->tif_rawdata;
1243
+ sp->stream.avail_out = (uInt) tif->tif_rawdatasize; /* this is a safe typecast, as check is made already in PixarLogPreEncode */
1244
+ }
1245
+ break;
1246
+ default:
1247
+ TIFFErrorExt(tif->tif_clientdata, module, "ZLib error: %s",
1248
+ sp->stream.msg ? sp->stream.msg : "(null)");
1249
+ return (0);
1250
+ }
1251
+ } while (state != Z_STREAM_END);
1252
+ return (1);
1253
+ }
1254
+
1255
+ static void
1256
+ PixarLogClose(TIFF* tif)
1257
+ {
1258
+ PixarLogState* sp = (PixarLogState*) tif->tif_data;
1259
+ TIFFDirectory *td = &tif->tif_dir;
1260
+
1261
+ assert(sp != 0);
1262
+ /* In a really sneaky (and really incorrect, and untruthful, and
1263
+ * troublesome, and error-prone) maneuver that completely goes against
1264
+ * the spirit of TIFF, and breaks TIFF, on close, we covertly
1265
+ * modify both bitspersample and sampleformat in the directory to
1266
+ * indicate 8-bit linear. This way, the decode "just works" even for
1267
+ * readers that don't know about PixarLog, or how to set
1268
+ * the PIXARLOGDATFMT pseudo-tag.
1269
+ */
1270
+
1271
+ if (sp->state&PLSTATE_INIT) {
1272
+ /* We test the state to avoid an issue such as in
1273
+ * http://bugzilla.maptools.org/show_bug.cgi?id=2604
1274
+ * What appends in that case is that the bitspersample is 1 and
1275
+ * a TransferFunction is set. The size of the TransferFunction
1276
+ * depends on 1<<bitspersample. So if we increase it, an access
1277
+ * out of the buffer will happen at directory flushing.
1278
+ * Another option would be to clear those targs.
1279
+ */
1280
+ td->td_bitspersample = 8;
1281
+ td->td_sampleformat = SAMPLEFORMAT_UINT;
1282
+ }
1283
+ }
1284
+
1285
+ static void
1286
+ PixarLogCleanup(TIFF* tif)
1287
+ {
1288
+ PixarLogState* sp = (PixarLogState*) tif->tif_data;
1289
+
1290
+ assert(sp != 0);
1291
+
1292
+ (void)TIFFPredictorCleanup(tif);
1293
+
1294
+ tif->tif_tagmethods.vgetfield = sp->vgetparent;
1295
+ tif->tif_tagmethods.vsetfield = sp->vsetparent;
1296
+
1297
+ if (sp->FromLT2) _TIFFfree(sp->FromLT2);
1298
+ if (sp->From14) _TIFFfree(sp->From14);
1299
+ if (sp->From8) _TIFFfree(sp->From8);
1300
+ if (sp->ToLinearF) _TIFFfree(sp->ToLinearF);
1301
+ if (sp->ToLinear16) _TIFFfree(sp->ToLinear16);
1302
+ if (sp->ToLinear8) _TIFFfree(sp->ToLinear8);
1303
+ if (sp->state&PLSTATE_INIT) {
1304
+ if (tif->tif_mode == O_RDONLY)
1305
+ inflateEnd(&sp->stream);
1306
+ else
1307
+ deflateEnd(&sp->stream);
1308
+ }
1309
+ if (sp->tbuf)
1310
+ _TIFFfree(sp->tbuf);
1311
+ _TIFFfree(sp);
1312
+ tif->tif_data = NULL;
1313
+
1314
+ _TIFFSetDefaultCompressionState(tif);
1315
+ }
1316
+
1317
+ static int
1318
+ PixarLogVSetField(TIFF* tif, uint32 tag, va_list ap)
1319
+ {
1320
+ static const char module[] = "PixarLogVSetField";
1321
+ PixarLogState *sp = (PixarLogState *)tif->tif_data;
1322
+ int result;
1323
+
1324
+ switch (tag) {
1325
+ case TIFFTAG_PIXARLOGQUALITY:
1326
+ sp->quality = (int) va_arg(ap, int);
1327
+ if (tif->tif_mode != O_RDONLY && (sp->state&PLSTATE_INIT)) {
1328
+ if (deflateParams(&sp->stream,
1329
+ sp->quality, Z_DEFAULT_STRATEGY) != Z_OK) {
1330
+ TIFFErrorExt(tif->tif_clientdata, module, "ZLib error: %s",
1331
+ sp->stream.msg ? sp->stream.msg : "(null)");
1332
+ return (0);
1333
+ }
1334
+ }
1335
+ return (1);
1336
+ case TIFFTAG_PIXARLOGDATAFMT:
1337
+ sp->user_datafmt = (int) va_arg(ap, int);
1338
+ /* Tweak the TIFF header so that the rest of libtiff knows what
1339
+ * size of data will be passed between app and library, and
1340
+ * assume that the app knows what it is doing and is not
1341
+ * confused by these header manipulations...
1342
+ */
1343
+ switch (sp->user_datafmt) {
1344
+ case PIXARLOGDATAFMT_8BIT:
1345
+ case PIXARLOGDATAFMT_8BITABGR:
1346
+ TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, 8);
1347
+ TIFFSetField(tif, TIFFTAG_SAMPLEFORMAT, SAMPLEFORMAT_UINT);
1348
+ break;
1349
+ case PIXARLOGDATAFMT_11BITLOG:
1350
+ TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, 16);
1351
+ TIFFSetField(tif, TIFFTAG_SAMPLEFORMAT, SAMPLEFORMAT_UINT);
1352
+ break;
1353
+ case PIXARLOGDATAFMT_12BITPICIO:
1354
+ TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, 16);
1355
+ TIFFSetField(tif, TIFFTAG_SAMPLEFORMAT, SAMPLEFORMAT_INT);
1356
+ break;
1357
+ case PIXARLOGDATAFMT_16BIT:
1358
+ TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, 16);
1359
+ TIFFSetField(tif, TIFFTAG_SAMPLEFORMAT, SAMPLEFORMAT_UINT);
1360
+ break;
1361
+ case PIXARLOGDATAFMT_FLOAT:
1362
+ TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, 32);
1363
+ TIFFSetField(tif, TIFFTAG_SAMPLEFORMAT, SAMPLEFORMAT_IEEEFP);
1364
+ break;
1365
+ }
1366
+ /*
1367
+ * Must recalculate sizes should bits/sample change.
1368
+ */
1369
+ tif->tif_tilesize = isTiled(tif) ? TIFFTileSize(tif) : (tmsize_t)(-1);
1370
+ tif->tif_scanlinesize = TIFFScanlineSize(tif);
1371
+ result = 1; /* NB: pseudo tag */
1372
+ break;
1373
+ default:
1374
+ result = (*sp->vsetparent)(tif, tag, ap);
1375
+ }
1376
+ return (result);
1377
+ }
1378
+
1379
+ static int
1380
+ PixarLogVGetField(TIFF* tif, uint32 tag, va_list ap)
1381
+ {
1382
+ PixarLogState *sp = (PixarLogState *)tif->tif_data;
1383
+
1384
+ switch (tag) {
1385
+ case TIFFTAG_PIXARLOGQUALITY:
1386
+ *va_arg(ap, int*) = sp->quality;
1387
+ break;
1388
+ case TIFFTAG_PIXARLOGDATAFMT:
1389
+ *va_arg(ap, int*) = sp->user_datafmt;
1390
+ break;
1391
+ default:
1392
+ return (*sp->vgetparent)(tif, tag, ap);
1393
+ }
1394
+ return (1);
1395
+ }
1396
+
1397
+ static const TIFFField pixarlogFields[] = {
1398
+ {TIFFTAG_PIXARLOGDATAFMT, 0, 0, TIFF_ANY, 0, TIFF_SETGET_INT, TIFF_SETGET_UNDEFINED, FIELD_PSEUDO, FALSE, FALSE, "", NULL},
1399
+ {TIFFTAG_PIXARLOGQUALITY, 0, 0, TIFF_ANY, 0, TIFF_SETGET_INT, TIFF_SETGET_UNDEFINED, FIELD_PSEUDO, FALSE, FALSE, "", NULL}
1400
+ };
1401
+
1402
+ int
1403
+ TIFFInitPixarLog(TIFF* tif, int scheme)
1404
+ {
1405
+ static const char module[] = "TIFFInitPixarLog";
1406
+
1407
+ PixarLogState* sp;
1408
+
1409
+ assert(scheme == COMPRESSION_PIXARLOG);
1410
+
1411
+ /*
1412
+ * Merge codec-specific tag information.
1413
+ */
1414
+ if (!_TIFFMergeFields(tif, pixarlogFields,
1415
+ TIFFArrayCount(pixarlogFields))) {
1416
+ TIFFErrorExt(tif->tif_clientdata, module,
1417
+ "Merging PixarLog codec-specific tags failed");
1418
+ return 0;
1419
+ }
1420
+
1421
+ /*
1422
+ * Allocate state block so tag methods have storage to record values.
1423
+ */
1424
+ tif->tif_data = (uint8*) _TIFFmalloc(sizeof (PixarLogState));
1425
+ if (tif->tif_data == NULL)
1426
+ goto bad;
1427
+ sp = (PixarLogState*) tif->tif_data;
1428
+ _TIFFmemset(sp, 0, sizeof (*sp));
1429
+ sp->stream.data_type = Z_BINARY;
1430
+ sp->user_datafmt = PIXARLOGDATAFMT_UNKNOWN;
1431
+
1432
+ /*
1433
+ * Install codec methods.
1434
+ */
1435
+ tif->tif_fixuptags = PixarLogFixupTags;
1436
+ tif->tif_setupdecode = PixarLogSetupDecode;
1437
+ tif->tif_predecode = PixarLogPreDecode;
1438
+ tif->tif_decoderow = PixarLogDecode;
1439
+ tif->tif_decodestrip = PixarLogDecode;
1440
+ tif->tif_decodetile = PixarLogDecode;
1441
+ tif->tif_setupencode = PixarLogSetupEncode;
1442
+ tif->tif_preencode = PixarLogPreEncode;
1443
+ tif->tif_postencode = PixarLogPostEncode;
1444
+ tif->tif_encoderow = PixarLogEncode;
1445
+ tif->tif_encodestrip = PixarLogEncode;
1446
+ tif->tif_encodetile = PixarLogEncode;
1447
+ tif->tif_close = PixarLogClose;
1448
+ tif->tif_cleanup = PixarLogCleanup;
1449
+
1450
+ /* Override SetField so we can handle our private pseudo-tag */
1451
+ sp->vgetparent = tif->tif_tagmethods.vgetfield;
1452
+ tif->tif_tagmethods.vgetfield = PixarLogVGetField; /* hook for codec tags */
1453
+ sp->vsetparent = tif->tif_tagmethods.vsetfield;
1454
+ tif->tif_tagmethods.vsetfield = PixarLogVSetField; /* hook for codec tags */
1455
+
1456
+ /* Default values for codec-specific fields */
1457
+ sp->quality = Z_DEFAULT_COMPRESSION; /* default comp. level */
1458
+ sp->state = 0;
1459
+
1460
+ /* we don't wish to use the predictor,
1461
+ * the default is none, which predictor value 1
1462
+ */
1463
+ (void) TIFFPredictorInit(tif);
1464
+
1465
+ /*
1466
+ * build the companding tables
1467
+ */
1468
+ PixarLogMakeTables(sp);
1469
+
1470
+ return (1);
1471
+ bad:
1472
+ TIFFErrorExt(tif->tif_clientdata, module,
1473
+ "No space for PixarLog state block");
1474
+ return (0);
1475
+ }
1476
+ #endif /* PIXARLOG_SUPPORT */
1477
+
1478
+ /* vim: set ts=8 sts=8 sw=8 noet: */
1479
+ /*
1480
+ * Local Variables:
1481
+ * mode: c
1482
+ * c-basic-offset: 8
1483
+ * fill-column: 78
1484
+ * End:
1485
+ */