laag-libtiff 4.0.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (629) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +57 -0
  3. data/LICENSE.txt +21 -0
  4. data/README.org +34 -0
  5. data/ext/laag/libtiff/extconf.rb +13 -0
  6. data/laag-libtiff.gemspec +20 -0
  7. data/lib/laag/libtiff.rb +29 -0
  8. data/vendor/gitlab.com/libtiff/libtiff/.appveyor.yml +109 -0
  9. data/vendor/gitlab.com/libtiff/libtiff/.cvsignore +4 -0
  10. data/vendor/gitlab.com/libtiff/libtiff/.travis.yml +34 -0
  11. data/vendor/gitlab.com/libtiff/libtiff/CMakeLists.txt +764 -0
  12. data/vendor/gitlab.com/libtiff/libtiff/COMMITTERS +19 -0
  13. data/vendor/gitlab.com/libtiff/libtiff/COPYRIGHT +21 -0
  14. data/vendor/gitlab.com/libtiff/libtiff/ChangeLog +8073 -0
  15. data/vendor/gitlab.com/libtiff/libtiff/HOWTO-RELEASE +119 -0
  16. data/vendor/gitlab.com/libtiff/libtiff/HOWTO-SECURITY-RELEASE +19 -0
  17. data/vendor/gitlab.com/libtiff/libtiff/Makefile.am +91 -0
  18. data/vendor/gitlab.com/libtiff/libtiff/Makefile.in +995 -0
  19. data/vendor/gitlab.com/libtiff/libtiff/Makefile.vc +58 -0
  20. data/vendor/gitlab.com/libtiff/libtiff/README +61 -0
  21. data/vendor/gitlab.com/libtiff/libtiff/README.vms +12 -0
  22. data/vendor/gitlab.com/libtiff/libtiff/RELEASE-DATE +1 -0
  23. data/vendor/gitlab.com/libtiff/libtiff/SConstruct +171 -0
  24. data/vendor/gitlab.com/libtiff/libtiff/TODO +12 -0
  25. data/vendor/gitlab.com/libtiff/libtiff/VERSION +1 -0
  26. data/vendor/gitlab.com/libtiff/libtiff/aclocal.m4 +1194 -0
  27. data/vendor/gitlab.com/libtiff/libtiff/archive/html/man/bmp2tiff.1.html +121 -0
  28. data/vendor/gitlab.com/libtiff/libtiff/archive/html/man/gif2tiff.1.html +141 -0
  29. data/vendor/gitlab.com/libtiff/libtiff/archive/html/man/ras2tiff.1.html +139 -0
  30. data/vendor/gitlab.com/libtiff/libtiff/archive/html/man/sgi2tiff.1.html +147 -0
  31. data/vendor/gitlab.com/libtiff/libtiff/archive/html/man/tiffsv.1.html +207 -0
  32. data/vendor/gitlab.com/libtiff/libtiff/archive/man/bmp2tiff.1 +85 -0
  33. data/vendor/gitlab.com/libtiff/libtiff/archive/man/gif2tiff.1 +81 -0
  34. data/vendor/gitlab.com/libtiff/libtiff/archive/man/ras2tiff.1 +96 -0
  35. data/vendor/gitlab.com/libtiff/libtiff/archive/man/sgi2tiff.1 +93 -0
  36. data/vendor/gitlab.com/libtiff/libtiff/archive/man/tiffsv.1 +142 -0
  37. data/vendor/gitlab.com/libtiff/libtiff/archive/tools/bmp2tiff.c +937 -0
  38. data/vendor/gitlab.com/libtiff/libtiff/archive/tools/gif2tiff.c +591 -0
  39. data/vendor/gitlab.com/libtiff/libtiff/archive/tools/ras2tiff.c +338 -0
  40. data/vendor/gitlab.com/libtiff/libtiff/archive/tools/rasterfile.h +44 -0
  41. data/vendor/gitlab.com/libtiff/libtiff/archive/tools/sgi2tiff.c +337 -0
  42. data/vendor/gitlab.com/libtiff/libtiff/archive/tools/sgisv.c +318 -0
  43. data/vendor/gitlab.com/libtiff/libtiff/archive/tools/ycbcr.c +168 -0
  44. data/vendor/gitlab.com/libtiff/libtiff/autogen.sh +8 -0
  45. data/vendor/gitlab.com/libtiff/libtiff/build/.cvsignore +1 -0
  46. data/vendor/gitlab.com/libtiff/libtiff/build/CMakeLists.txt +25 -0
  47. data/vendor/gitlab.com/libtiff/libtiff/build/Makefile.am +32 -0
  48. data/vendor/gitlab.com/libtiff/libtiff/build/Makefile.in +680 -0
  49. data/vendor/gitlab.com/libtiff/libtiff/build/README +3 -0
  50. data/vendor/gitlab.com/libtiff/libtiff/build/travis-ci +108 -0
  51. data/vendor/gitlab.com/libtiff/libtiff/commit +233 -0
  52. data/vendor/gitlab.com/libtiff/libtiff/config/compile +347 -0
  53. data/vendor/gitlab.com/libtiff/libtiff/config/config.guess +1526 -0
  54. data/vendor/gitlab.com/libtiff/libtiff/config/config.sub +1658 -0
  55. data/vendor/gitlab.com/libtiff/libtiff/config/depcomp +791 -0
  56. data/vendor/gitlab.com/libtiff/libtiff/config/install-sh +507 -0
  57. data/vendor/gitlab.com/libtiff/libtiff/config/ltmain.sh +11156 -0
  58. data/vendor/gitlab.com/libtiff/libtiff/config/missing +215 -0
  59. data/vendor/gitlab.com/libtiff/libtiff/config/mkinstalldirs +161 -0
  60. data/vendor/gitlab.com/libtiff/libtiff/config/test-driver +127 -0
  61. data/vendor/gitlab.com/libtiff/libtiff/configure +23612 -0
  62. data/vendor/gitlab.com/libtiff/libtiff/configure.ac +1112 -0
  63. data/vendor/gitlab.com/libtiff/libtiff/configure.com +1357 -0
  64. data/vendor/gitlab.com/libtiff/libtiff/contrib/.cvsignore +2 -0
  65. data/vendor/gitlab.com/libtiff/libtiff/contrib/CMakeLists.txt +35 -0
  66. data/vendor/gitlab.com/libtiff/libtiff/contrib/Makefile.am +31 -0
  67. data/vendor/gitlab.com/libtiff/libtiff/contrib/Makefile.in +679 -0
  68. data/vendor/gitlab.com/libtiff/libtiff/contrib/README +2 -0
  69. data/vendor/gitlab.com/libtiff/libtiff/contrib/addtiffo/.cvsignore +5 -0
  70. data/vendor/gitlab.com/libtiff/libtiff/contrib/addtiffo/CMakeLists.txt +34 -0
  71. data/vendor/gitlab.com/libtiff/libtiff/contrib/addtiffo/Makefile.am +39 -0
  72. data/vendor/gitlab.com/libtiff/libtiff/contrib/addtiffo/Makefile.in +652 -0
  73. data/vendor/gitlab.com/libtiff/libtiff/contrib/addtiffo/Makefile.vc +28 -0
  74. data/vendor/gitlab.com/libtiff/libtiff/contrib/addtiffo/README +142 -0
  75. data/vendor/gitlab.com/libtiff/libtiff/contrib/addtiffo/addtiffo.c +181 -0
  76. data/vendor/gitlab.com/libtiff/libtiff/contrib/addtiffo/tif_overview.c +916 -0
  77. data/vendor/gitlab.com/libtiff/libtiff/contrib/addtiffo/tif_ovrcache.c +344 -0
  78. data/vendor/gitlab.com/libtiff/libtiff/contrib/addtiffo/tif_ovrcache.h +103 -0
  79. data/vendor/gitlab.com/libtiff/libtiff/contrib/dbs/.cvsignore +8 -0
  80. data/vendor/gitlab.com/libtiff/libtiff/contrib/dbs/CMakeLists.txt +43 -0
  81. data/vendor/gitlab.com/libtiff/libtiff/contrib/dbs/Makefile.am +46 -0
  82. data/vendor/gitlab.com/libtiff/libtiff/contrib/dbs/Makefile.in +798 -0
  83. data/vendor/gitlab.com/libtiff/libtiff/contrib/dbs/README +7 -0
  84. data/vendor/gitlab.com/libtiff/libtiff/contrib/dbs/tiff-bi.c +91 -0
  85. data/vendor/gitlab.com/libtiff/libtiff/contrib/dbs/tiff-grayscale.c +147 -0
  86. data/vendor/gitlab.com/libtiff/libtiff/contrib/dbs/tiff-palette.c +284 -0
  87. data/vendor/gitlab.com/libtiff/libtiff/contrib/dbs/tiff-rgb.c +201 -0
  88. data/vendor/gitlab.com/libtiff/libtiff/contrib/dbs/xtiff/.cvsignore +2 -0
  89. data/vendor/gitlab.com/libtiff/libtiff/contrib/dbs/xtiff/CMakeLists.txt +29 -0
  90. data/vendor/gitlab.com/libtiff/libtiff/contrib/dbs/xtiff/Makefile.am +47 -0
  91. data/vendor/gitlab.com/libtiff/libtiff/contrib/dbs/xtiff/Makefile.in +516 -0
  92. data/vendor/gitlab.com/libtiff/libtiff/contrib/dbs/xtiff/README +6 -0
  93. data/vendor/gitlab.com/libtiff/libtiff/contrib/dbs/xtiff/patchlevel.h +8 -0
  94. data/vendor/gitlab.com/libtiff/libtiff/contrib/dbs/xtiff/xtiff.c +1290 -0
  95. data/vendor/gitlab.com/libtiff/libtiff/contrib/dbs/xtiff/xtifficon.h +21 -0
  96. data/vendor/gitlab.com/libtiff/libtiff/contrib/iptcutil/.cvsignore +5 -0
  97. data/vendor/gitlab.com/libtiff/libtiff/contrib/iptcutil/CMakeLists.txt +35 -0
  98. data/vendor/gitlab.com/libtiff/libtiff/contrib/iptcutil/Makefile.am +40 -0
  99. data/vendor/gitlab.com/libtiff/libtiff/contrib/iptcutil/Makefile.in +650 -0
  100. data/vendor/gitlab.com/libtiff/libtiff/contrib/iptcutil/README +25 -0
  101. data/vendor/gitlab.com/libtiff/libtiff/contrib/iptcutil/iptcutil.c +954 -0
  102. data/vendor/gitlab.com/libtiff/libtiff/contrib/iptcutil/test.iptc +0 -0
  103. data/vendor/gitlab.com/libtiff/libtiff/contrib/iptcutil/test.txt +32 -0
  104. data/vendor/gitlab.com/libtiff/libtiff/contrib/mfs/.cvsignore +2 -0
  105. data/vendor/gitlab.com/libtiff/libtiff/contrib/mfs/CMakeLists.txt +27 -0
  106. data/vendor/gitlab.com/libtiff/libtiff/contrib/mfs/Makefile.am +29 -0
  107. data/vendor/gitlab.com/libtiff/libtiff/contrib/mfs/Makefile.in +499 -0
  108. data/vendor/gitlab.com/libtiff/libtiff/contrib/mfs/README +37 -0
  109. data/vendor/gitlab.com/libtiff/libtiff/contrib/mfs/mfs_file.c +586 -0
  110. data/vendor/gitlab.com/libtiff/libtiff/contrib/pds/.cvsignore +2 -0
  111. data/vendor/gitlab.com/libtiff/libtiff/contrib/pds/CMakeLists.txt +30 -0
  112. data/vendor/gitlab.com/libtiff/libtiff/contrib/pds/Makefile.am +32 -0
  113. data/vendor/gitlab.com/libtiff/libtiff/contrib/pds/Makefile.in +502 -0
  114. data/vendor/gitlab.com/libtiff/libtiff/contrib/pds/README +90 -0
  115. data/vendor/gitlab.com/libtiff/libtiff/contrib/pds/tif_imageiter.c +525 -0
  116. data/vendor/gitlab.com/libtiff/libtiff/contrib/pds/tif_imageiter.h +64 -0
  117. data/vendor/gitlab.com/libtiff/libtiff/contrib/pds/tif_pdsdirread.c +1131 -0
  118. data/vendor/gitlab.com/libtiff/libtiff/contrib/pds/tif_pdsdirwrite.c +971 -0
  119. data/vendor/gitlab.com/libtiff/libtiff/contrib/ras/.cvsignore +2 -0
  120. data/vendor/gitlab.com/libtiff/libtiff/contrib/ras/CMakeLists.txt +28 -0
  121. data/vendor/gitlab.com/libtiff/libtiff/contrib/ras/Makefile.am +30 -0
  122. data/vendor/gitlab.com/libtiff/libtiff/contrib/ras/Makefile.in +500 -0
  123. data/vendor/gitlab.com/libtiff/libtiff/contrib/ras/README +10 -0
  124. data/vendor/gitlab.com/libtiff/libtiff/contrib/ras/ras2tif.c +254 -0
  125. data/vendor/gitlab.com/libtiff/libtiff/contrib/ras/tif2ras.c +344 -0
  126. data/vendor/gitlab.com/libtiff/libtiff/contrib/stream/.cvsignore +2 -0
  127. data/vendor/gitlab.com/libtiff/libtiff/contrib/stream/CMakeLists.txt +28 -0
  128. data/vendor/gitlab.com/libtiff/libtiff/contrib/stream/Makefile.am +30 -0
  129. data/vendor/gitlab.com/libtiff/libtiff/contrib/stream/Makefile.in +500 -0
  130. data/vendor/gitlab.com/libtiff/libtiff/contrib/stream/README +30 -0
  131. data/vendor/gitlab.com/libtiff/libtiff/contrib/stream/tiffstream.cpp +238 -0
  132. data/vendor/gitlab.com/libtiff/libtiff/contrib/stream/tiffstream.h +70 -0
  133. data/vendor/gitlab.com/libtiff/libtiff/contrib/tags/.cvsignore +2 -0
  134. data/vendor/gitlab.com/libtiff/libtiff/contrib/tags/CMakeLists.txt +32 -0
  135. data/vendor/gitlab.com/libtiff/libtiff/contrib/tags/Makefile.am +33 -0
  136. data/vendor/gitlab.com/libtiff/libtiff/contrib/tags/Makefile.in +503 -0
  137. data/vendor/gitlab.com/libtiff/libtiff/contrib/tags/README +132 -0
  138. data/vendor/gitlab.com/libtiff/libtiff/contrib/tags/listtif.c +39 -0
  139. data/vendor/gitlab.com/libtiff/libtiff/contrib/tags/maketif.c +77 -0
  140. data/vendor/gitlab.com/libtiff/libtiff/contrib/tags/xtif_dir.c +350 -0
  141. data/vendor/gitlab.com/libtiff/libtiff/contrib/tags/xtiffio.h +59 -0
  142. data/vendor/gitlab.com/libtiff/libtiff/contrib/tags/xtiffiop.h +72 -0
  143. data/vendor/gitlab.com/libtiff/libtiff/contrib/win_dib/.cvsignore +2 -0
  144. data/vendor/gitlab.com/libtiff/libtiff/contrib/win_dib/CMakeLists.txt +30 -0
  145. data/vendor/gitlab.com/libtiff/libtiff/contrib/win_dib/Makefile.am +32 -0
  146. data/vendor/gitlab.com/libtiff/libtiff/contrib/win_dib/Makefile.in +502 -0
  147. data/vendor/gitlab.com/libtiff/libtiff/contrib/win_dib/Makefile.w95 +134 -0
  148. data/vendor/gitlab.com/libtiff/libtiff/contrib/win_dib/README.Tiffile +31 -0
  149. data/vendor/gitlab.com/libtiff/libtiff/contrib/win_dib/README.tiff2dib +51 -0
  150. data/vendor/gitlab.com/libtiff/libtiff/contrib/win_dib/Tiffile.cpp +449 -0
  151. data/vendor/gitlab.com/libtiff/libtiff/contrib/win_dib/tiff2dib.c +379 -0
  152. data/vendor/gitlab.com/libtiff/libtiff/html/.cvsignore +5 -0
  153. data/vendor/gitlab.com/libtiff/libtiff/html/BigTIFFProposal.html +99 -0
  154. data/vendor/gitlab.com/libtiff/libtiff/html/CMakeLists.txt +87 -0
  155. data/vendor/gitlab.com/libtiff/libtiff/html/Makefile.am +96 -0
  156. data/vendor/gitlab.com/libtiff/libtiff/html/Makefile.in +798 -0
  157. data/vendor/gitlab.com/libtiff/libtiff/html/TIFFTechNote2.html +707 -0
  158. data/vendor/gitlab.com/libtiff/libtiff/html/addingtags.html +292 -0
  159. data/vendor/gitlab.com/libtiff/libtiff/html/bigtiffdesign.html +80 -0
  160. data/vendor/gitlab.com/libtiff/libtiff/html/bigtiffpr.html +77 -0
  161. data/vendor/gitlab.com/libtiff/libtiff/html/bigtiffpr_images/esri.png +0 -0
  162. data/vendor/gitlab.com/libtiff/libtiff/html/bigtiffpr_images/leica.png +0 -0
  163. data/vendor/gitlab.com/libtiff/libtiff/html/bigtiffpr_images/safe.png +0 -0
  164. data/vendor/gitlab.com/libtiff/libtiff/html/bigtiffpr_images/weogeo.png +0 -0
  165. data/vendor/gitlab.com/libtiff/libtiff/html/bugs.html +61 -0
  166. data/vendor/gitlab.com/libtiff/libtiff/html/build.html +737 -0
  167. data/vendor/gitlab.com/libtiff/libtiff/html/contrib.html +209 -0
  168. data/vendor/gitlab.com/libtiff/libtiff/html/document.html +52 -0
  169. data/vendor/gitlab.com/libtiff/libtiff/html/images.html +41 -0
  170. data/vendor/gitlab.com/libtiff/libtiff/html/images/.cvsignore +2 -0
  171. data/vendor/gitlab.com/libtiff/libtiff/html/images/CMakeLists.txt +46 -0
  172. data/vendor/gitlab.com/libtiff/libtiff/html/images/Makefile.am +49 -0
  173. data/vendor/gitlab.com/libtiff/libtiff/html/images/Makefile.in +572 -0
  174. data/vendor/gitlab.com/libtiff/libtiff/html/images/back.gif +0 -0
  175. data/vendor/gitlab.com/libtiff/libtiff/html/images/bali.jpg +0 -0
  176. data/vendor/gitlab.com/libtiff/libtiff/html/images/cat.gif +0 -0
  177. data/vendor/gitlab.com/libtiff/libtiff/html/images/cover.jpg +0 -0
  178. data/vendor/gitlab.com/libtiff/libtiff/html/images/cramps.gif +0 -0
  179. data/vendor/gitlab.com/libtiff/libtiff/html/images/dave.gif +0 -0
  180. data/vendor/gitlab.com/libtiff/libtiff/html/images/info.gif +0 -0
  181. data/vendor/gitlab.com/libtiff/libtiff/html/images/jello.jpg +0 -0
  182. data/vendor/gitlab.com/libtiff/libtiff/html/images/jim.gif +0 -0
  183. data/vendor/gitlab.com/libtiff/libtiff/html/images/note.gif +0 -0
  184. data/vendor/gitlab.com/libtiff/libtiff/html/images/oxford.gif +0 -0
  185. data/vendor/gitlab.com/libtiff/libtiff/html/images/quad.jpg +0 -0
  186. data/vendor/gitlab.com/libtiff/libtiff/html/images/ring.gif +0 -0
  187. data/vendor/gitlab.com/libtiff/libtiff/html/images/smallliz.jpg +0 -0
  188. data/vendor/gitlab.com/libtiff/libtiff/html/images/strike.gif +0 -0
  189. data/vendor/gitlab.com/libtiff/libtiff/html/images/warning.gif +0 -0
  190. data/vendor/gitlab.com/libtiff/libtiff/html/index.html +122 -0
  191. data/vendor/gitlab.com/libtiff/libtiff/html/internals.html +572 -0
  192. data/vendor/gitlab.com/libtiff/libtiff/html/intro.html +68 -0
  193. data/vendor/gitlab.com/libtiff/libtiff/html/libtiff.html +747 -0
  194. data/vendor/gitlab.com/libtiff/libtiff/html/man/.cvsignore +2 -0
  195. data/vendor/gitlab.com/libtiff/libtiff/html/man/CMakeLists.txt +108 -0
  196. data/vendor/gitlab.com/libtiff/libtiff/html/man/HtmlDoc.cmake +50 -0
  197. data/vendor/gitlab.com/libtiff/libtiff/html/man/Makefile.am +122 -0
  198. data/vendor/gitlab.com/libtiff/libtiff/html/man/Makefile.in +642 -0
  199. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFClose.3tiff.html +87 -0
  200. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFDataWidth.3tiff.html +98 -0
  201. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFError.3tiff.html +106 -0
  202. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFFieldDataType.3tiff.html +89 -0
  203. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFFieldName.3tiff.html +86 -0
  204. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFFieldPassCount.3tiff.html +98 -0
  205. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFFieldReadCount.3tiff.html +101 -0
  206. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFFieldTag.3tiff.html +88 -0
  207. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFFieldWriteCount.3tiff.html +108 -0
  208. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFFlush.3tiff.html +113 -0
  209. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFGetField.3tiff.html +1969 -0
  210. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFOpen.3tiff.html +421 -0
  211. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFPrintDirectory.3tiff.html +225 -0
  212. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFRGBAImage.3tiff.html +319 -0
  213. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFReadDirectory.3tiff.html +218 -0
  214. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFReadEncodedStrip.3tiff.html +133 -0
  215. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFReadEncodedTile.3tiff.html +130 -0
  216. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFReadRGBAImage.3tiff.html +301 -0
  217. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFReadRGBAStrip.3tiff.html +208 -0
  218. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFReadRGBATile.3tiff.html +261 -0
  219. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFReadRawStrip.3tiff.html +109 -0
  220. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFReadRawTile.3tiff.html +111 -0
  221. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFReadScanline.3tiff.html +157 -0
  222. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFReadTile.3tiff.html +133 -0
  223. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFSetDirectory.3tiff.html +122 -0
  224. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFSetField.3tiff.html +1865 -0
  225. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFWarning.3tiff.html +108 -0
  226. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFWriteDirectory.3tiff.html +176 -0
  227. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFWriteEncodedStrip.3tiff.html +153 -0
  228. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFWriteEncodedTile.3tiff.html +147 -0
  229. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFWriteRawStrip.3tiff.html +144 -0
  230. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFWriteRawTile.3tiff.html +128 -0
  231. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFWriteScanline.3tiff.html +206 -0
  232. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFWriteTile.3tiff.html +115 -0
  233. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFbuffer.3tiff.html +116 -0
  234. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFcodec.3tiff.html +116 -0
  235. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFcolor.3tiff.html +975 -0
  236. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFmemory.3tiff.html +110 -0
  237. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFquery.3tiff.html +148 -0
  238. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFsize.3tiff.html +95 -0
  239. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFstrip.3tiff.html +129 -0
  240. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFswab.3tiff.html +110 -0
  241. data/vendor/gitlab.com/libtiff/libtiff/html/man/TIFFtile.3tiff.html +141 -0
  242. data/vendor/gitlab.com/libtiff/libtiff/html/man/fax2ps.1.html +252 -0
  243. data/vendor/gitlab.com/libtiff/libtiff/html/man/fax2tiff.1.html +607 -0
  244. data/vendor/gitlab.com/libtiff/libtiff/html/man/index.html +64 -0
  245. data/vendor/gitlab.com/libtiff/libtiff/html/man/libtiff.3tiff.html +1150 -0
  246. data/vendor/gitlab.com/libtiff/libtiff/html/man/pal2rgb.1.html +189 -0
  247. data/vendor/gitlab.com/libtiff/libtiff/html/man/ppm2tiff.1.html +141 -0
  248. data/vendor/gitlab.com/libtiff/libtiff/html/man/raw2tiff.1.html +510 -0
  249. data/vendor/gitlab.com/libtiff/libtiff/html/man/rgb2ycbcr.1.html +155 -0
  250. data/vendor/gitlab.com/libtiff/libtiff/html/man/thumbnail.1.html +148 -0
  251. data/vendor/gitlab.com/libtiff/libtiff/html/man/tiff2bw.1.html +161 -0
  252. data/vendor/gitlab.com/libtiff/libtiff/html/man/tiff2pdf.1.html +609 -0
  253. data/vendor/gitlab.com/libtiff/libtiff/html/man/tiff2ps.1.html +639 -0
  254. data/vendor/gitlab.com/libtiff/libtiff/html/man/tiff2rgba.1.html +162 -0
  255. data/vendor/gitlab.com/libtiff/libtiff/html/man/tiffcmp.1.html +156 -0
  256. data/vendor/gitlab.com/libtiff/libtiff/html/man/tiffcp.1.html +569 -0
  257. data/vendor/gitlab.com/libtiff/libtiff/html/man/tiffcrop.1.html +684 -0
  258. data/vendor/gitlab.com/libtiff/libtiff/html/man/tiffdither.1.html +196 -0
  259. data/vendor/gitlab.com/libtiff/libtiff/html/man/tiffdump.1.html +145 -0
  260. data/vendor/gitlab.com/libtiff/libtiff/html/man/tiffgt.1.html +551 -0
  261. data/vendor/gitlab.com/libtiff/libtiff/html/man/tiffinfo.1.html +196 -0
  262. data/vendor/gitlab.com/libtiff/libtiff/html/man/tiffmedian.1.html +183 -0
  263. data/vendor/gitlab.com/libtiff/libtiff/html/man/tiffset.1.html +176 -0
  264. data/vendor/gitlab.com/libtiff/libtiff/html/man/tiffsplit.1.html +102 -0
  265. data/vendor/gitlab.com/libtiff/libtiff/html/misc.html +117 -0
  266. data/vendor/gitlab.com/libtiff/libtiff/html/support.html +655 -0
  267. data/vendor/gitlab.com/libtiff/libtiff/html/tools.html +137 -0
  268. data/vendor/gitlab.com/libtiff/libtiff/html/v3.4beta007.html +112 -0
  269. data/vendor/gitlab.com/libtiff/libtiff/html/v3.4beta016.html +122 -0
  270. data/vendor/gitlab.com/libtiff/libtiff/html/v3.4beta018.html +84 -0
  271. data/vendor/gitlab.com/libtiff/libtiff/html/v3.4beta024.html +139 -0
  272. data/vendor/gitlab.com/libtiff/libtiff/html/v3.4beta028.html +146 -0
  273. data/vendor/gitlab.com/libtiff/libtiff/html/v3.4beta029.html +86 -0
  274. data/vendor/gitlab.com/libtiff/libtiff/html/v3.4beta031.html +94 -0
  275. data/vendor/gitlab.com/libtiff/libtiff/html/v3.4beta032.html +90 -0
  276. data/vendor/gitlab.com/libtiff/libtiff/html/v3.4beta033.html +82 -0
  277. data/vendor/gitlab.com/libtiff/libtiff/html/v3.4beta034.html +68 -0
  278. data/vendor/gitlab.com/libtiff/libtiff/html/v3.4beta035.html +63 -0
  279. data/vendor/gitlab.com/libtiff/libtiff/html/v3.4beta036.html +117 -0
  280. data/vendor/gitlab.com/libtiff/libtiff/html/v3.5.1.html +75 -0
  281. data/vendor/gitlab.com/libtiff/libtiff/html/v3.5.2.html +108 -0
  282. data/vendor/gitlab.com/libtiff/libtiff/html/v3.5.3.html +132 -0
  283. data/vendor/gitlab.com/libtiff/libtiff/html/v3.5.4.html +88 -0
  284. data/vendor/gitlab.com/libtiff/libtiff/html/v3.5.5.html +155 -0
  285. data/vendor/gitlab.com/libtiff/libtiff/html/v3.5.6-beta.html +185 -0
  286. data/vendor/gitlab.com/libtiff/libtiff/html/v3.5.7.html +259 -0
  287. data/vendor/gitlab.com/libtiff/libtiff/html/v3.6.0.html +434 -0
  288. data/vendor/gitlab.com/libtiff/libtiff/html/v3.6.1.html +199 -0
  289. data/vendor/gitlab.com/libtiff/libtiff/html/v3.7.0.html +144 -0
  290. data/vendor/gitlab.com/libtiff/libtiff/html/v3.7.0alpha.html +249 -0
  291. data/vendor/gitlab.com/libtiff/libtiff/html/v3.7.0beta.html +162 -0
  292. data/vendor/gitlab.com/libtiff/libtiff/html/v3.7.0beta2.html +131 -0
  293. data/vendor/gitlab.com/libtiff/libtiff/html/v3.7.1.html +233 -0
  294. data/vendor/gitlab.com/libtiff/libtiff/html/v3.7.2.html +222 -0
  295. data/vendor/gitlab.com/libtiff/libtiff/html/v3.7.3.html +230 -0
  296. data/vendor/gitlab.com/libtiff/libtiff/html/v3.7.4.html +133 -0
  297. data/vendor/gitlab.com/libtiff/libtiff/html/v3.8.0.html +199 -0
  298. data/vendor/gitlab.com/libtiff/libtiff/html/v3.8.1.html +217 -0
  299. data/vendor/gitlab.com/libtiff/libtiff/html/v3.8.2.html +137 -0
  300. data/vendor/gitlab.com/libtiff/libtiff/html/v3.9.0.html +261 -0
  301. data/vendor/gitlab.com/libtiff/libtiff/html/v3.9.0beta.html +304 -0
  302. data/vendor/gitlab.com/libtiff/libtiff/html/v3.9.1.html +115 -0
  303. data/vendor/gitlab.com/libtiff/libtiff/html/v3.9.2.html +122 -0
  304. data/vendor/gitlab.com/libtiff/libtiff/html/v3.9.3.html +160 -0
  305. data/vendor/gitlab.com/libtiff/libtiff/html/v3.9.4.html +125 -0
  306. data/vendor/gitlab.com/libtiff/libtiff/html/v3.9.5.html +270 -0
  307. data/vendor/gitlab.com/libtiff/libtiff/html/v4.0.0.html +269 -0
  308. data/vendor/gitlab.com/libtiff/libtiff/html/v4.0.1.html +113 -0
  309. data/vendor/gitlab.com/libtiff/libtiff/html/v4.0.2.html +118 -0
  310. data/vendor/gitlab.com/libtiff/libtiff/html/v4.0.3.html +125 -0
  311. data/vendor/gitlab.com/libtiff/libtiff/html/v4.0.4.html +274 -0
  312. data/vendor/gitlab.com/libtiff/libtiff/html/v4.0.4beta.html +291 -0
  313. data/vendor/gitlab.com/libtiff/libtiff/html/v4.0.5.html +148 -0
  314. data/vendor/gitlab.com/libtiff/libtiff/html/v4.0.6.html +139 -0
  315. data/vendor/gitlab.com/libtiff/libtiff/html/v4.0.7.html +411 -0
  316. data/vendor/gitlab.com/libtiff/libtiff/html/v4.0.8.html +445 -0
  317. data/vendor/gitlab.com/libtiff/libtiff/html/v4.0.9.html +373 -0
  318. data/vendor/gitlab.com/libtiff/libtiff/libtiff-4.pc.in +11 -0
  319. data/vendor/gitlab.com/libtiff/libtiff/libtiff/.cvsignore +22 -0
  320. data/vendor/gitlab.com/libtiff/libtiff/libtiff/CMakeLists.txt +165 -0
  321. data/vendor/gitlab.com/libtiff/libtiff/libtiff/Makefile.am +154 -0
  322. data/vendor/gitlab.com/libtiff/libtiff/libtiff/Makefile.in +966 -0
  323. data/vendor/gitlab.com/libtiff/libtiff/libtiff/Makefile.lcc +129 -0
  324. data/vendor/gitlab.com/libtiff/libtiff/libtiff/Makefile.vc +102 -0
  325. data/vendor/gitlab.com/libtiff/libtiff/libtiff/SConstruct +73 -0
  326. data/vendor/gitlab.com/libtiff/libtiff/libtiff/libtiff.def +168 -0
  327. data/vendor/gitlab.com/libtiff/libtiff/libtiff/libtiff.map +4 -0
  328. data/vendor/gitlab.com/libtiff/libtiff/libtiff/libtiffxx.map +4 -0
  329. data/vendor/gitlab.com/libtiff/libtiff/libtiff/mkg3states.c +454 -0
  330. data/vendor/gitlab.com/libtiff/libtiff/libtiff/mkspans.c +82 -0
  331. data/vendor/gitlab.com/libtiff/libtiff/libtiff/t4.h +292 -0
  332. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_aux.c +376 -0
  333. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_close.c +140 -0
  334. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_codec.c +165 -0
  335. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_color.c +309 -0
  336. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_compress.c +304 -0
  337. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_config.h-vms +46 -0
  338. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_config.h.cmake.in +261 -0
  339. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_config.h.in +410 -0
  340. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_config.vc.h +137 -0
  341. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_config.wince.h +71 -0
  342. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_dir.c +1767 -0
  343. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_dir.h +309 -0
  344. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_dirinfo.c +1070 -0
  345. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_dirread.c +5803 -0
  346. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_dirwrite.c +3024 -0
  347. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_dumpmode.c +143 -0
  348. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_error.c +88 -0
  349. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_extension.c +118 -0
  350. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_fax3.c +1648 -0
  351. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_fax3.h +540 -0
  352. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_fax3sm.c +1260 -0
  353. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_flush.c +118 -0
  354. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_getimage.c +3048 -0
  355. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_jbig.c +214 -0
  356. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_jpeg.c +2601 -0
  357. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_jpeg_12.c +69 -0
  358. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_luv.c +1765 -0
  359. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_lzma.c +495 -0
  360. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_lzw.c +1218 -0
  361. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_next.c +189 -0
  362. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_ojpeg.c +2563 -0
  363. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_open.c +725 -0
  364. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_packbits.c +311 -0
  365. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_pixarlog.c +1485 -0
  366. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_predict.c +881 -0
  367. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_predict.h +79 -0
  368. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_print.c +722 -0
  369. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_read.c +1572 -0
  370. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_stream.cxx +430 -0
  371. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_strip.c +389 -0
  372. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_swab.c +312 -0
  373. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_thunder.c +208 -0
  374. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_tile.c +322 -0
  375. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_unix.c +386 -0
  376. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_version.c +40 -0
  377. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_vms.c +611 -0
  378. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_warning.c +89 -0
  379. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_win32.c +476 -0
  380. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_wince.c +293 -0
  381. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_write.c +834 -0
  382. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tif_zip.c +476 -0
  383. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tiff.h +681 -0
  384. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tiffconf.h-vms +99 -0
  385. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tiffconf.h.cmake.in +130 -0
  386. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tiffconf.h.in +127 -0
  387. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tiffconf.vc.h +161 -0
  388. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tiffconf.wince.h +121 -0
  389. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tiffio.h +560 -0
  390. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tiffio.hxx +49 -0
  391. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tiffiop.h +445 -0
  392. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tiffvers.h +9 -0
  393. data/vendor/gitlab.com/libtiff/libtiff/libtiff/tiffvers.h.in +9 -0
  394. data/vendor/gitlab.com/libtiff/libtiff/libtiff/uvcode.h +180 -0
  395. data/vendor/gitlab.com/libtiff/libtiff/m4/acinclude.m4 +851 -0
  396. data/vendor/gitlab.com/libtiff/libtiff/m4/ice_find_athena.m4 +187 -0
  397. data/vendor/gitlab.com/libtiff/libtiff/m4/libtool.m4 +8388 -0
  398. data/vendor/gitlab.com/libtiff/libtiff/m4/ltoptions.m4 +437 -0
  399. data/vendor/gitlab.com/libtiff/libtiff/m4/ltsugar.m4 +124 -0
  400. data/vendor/gitlab.com/libtiff/libtiff/m4/ltversion.m4 +23 -0
  401. data/vendor/gitlab.com/libtiff/libtiff/m4/lt~obsolete.m4 +99 -0
  402. data/vendor/gitlab.com/libtiff/libtiff/man/.cvsignore +3 -0
  403. data/vendor/gitlab.com/libtiff/libtiff/man/CMakeLists.txt +97 -0
  404. data/vendor/gitlab.com/libtiff/libtiff/man/Makefile.am +94 -0
  405. data/vendor/gitlab.com/libtiff/libtiff/man/Makefile.in +684 -0
  406. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFClose.3tiff +53 -0
  407. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFDataWidth.3tiff +74 -0
  408. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFError.3tiff +69 -0
  409. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFFieldDataType.3tiff +53 -0
  410. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFFieldName.3tiff +52 -0
  411. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFFieldPassCount.3tiff +73 -0
  412. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFFieldReadCount.3tiff +77 -0
  413. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFFieldTag.3tiff +56 -0
  414. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFFieldWriteCount.3tiff +88 -0
  415. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFFlush.3tiff +64 -0
  416. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFGetField.3tiff +229 -0
  417. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFOpen.3tiff +279 -0
  418. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFPrintDirectory.3tiff +70 -0
  419. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFRGBAImage.3tiff +286 -0
  420. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFReadDirectory.3tiff +164 -0
  421. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFReadEncodedStrip.3tiff +78 -0
  422. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFReadEncodedTile.3tiff +76 -0
  423. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFReadRGBAImage.3tiff +218 -0
  424. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFReadRGBAStrip.3tiff +170 -0
  425. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFReadRGBATile.3tiff +171 -0
  426. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFReadRawStrip.3tiff +64 -0
  427. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFReadRawTile.3tiff +65 -0
  428. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFReadScanline.3tiff +94 -0
  429. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFReadTile.3tiff +84 -0
  430. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFSetDirectory.3tiff +79 -0
  431. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFSetField.3tiff +217 -0
  432. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFWarning.3tiff +70 -0
  433. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFWriteDirectory.3tiff +138 -0
  434. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFWriteEncodedStrip.3tiff +102 -0
  435. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFWriteEncodedTile.3tiff +96 -0
  436. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFWriteRawStrip.3tiff +96 -0
  437. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFWriteRawTile.3tiff +84 -0
  438. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFWriteScanline.3tiff +154 -0
  439. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFWriteTile.3tiff +77 -0
  440. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFbuffer.3tiff +77 -0
  441. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFcodec.3tiff +82 -0
  442. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFcolor.3tiff +268 -0
  443. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFmemory.3tiff +90 -0
  444. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFquery.3tiff +142 -0
  445. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFsize.3tiff +59 -0
  446. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFstrip.3tiff +99 -0
  447. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFswab.3tiff +80 -0
  448. data/vendor/gitlab.com/libtiff/libtiff/man/TIFFtile.3tiff +131 -0
  449. data/vendor/gitlab.com/libtiff/libtiff/man/fax2ps.1 +159 -0
  450. data/vendor/gitlab.com/libtiff/libtiff/man/fax2tiff.1 +286 -0
  451. data/vendor/gitlab.com/libtiff/libtiff/man/libtiff.3tiff +545 -0
  452. data/vendor/gitlab.com/libtiff/libtiff/man/pal2rgb.1 +111 -0
  453. data/vendor/gitlab.com/libtiff/libtiff/man/ppm2tiff.1 +105 -0
  454. data/vendor/gitlab.com/libtiff/libtiff/man/raw2tiff.1 +196 -0
  455. data/vendor/gitlab.com/libtiff/libtiff/man/rgb2ycbcr.1 +99 -0
  456. data/vendor/gitlab.com/libtiff/libtiff/man/thumbnail.1 +90 -0
  457. data/vendor/gitlab.com/libtiff/libtiff/man/tiff2bw.1 +94 -0
  458. data/vendor/gitlab.com/libtiff/libtiff/man/tiff2pdf.1 +254 -0
  459. data/vendor/gitlab.com/libtiff/libtiff/man/tiff2ps.1 +294 -0
  460. data/vendor/gitlab.com/libtiff/libtiff/man/tiff2rgba.1 +97 -0
  461. data/vendor/gitlab.com/libtiff/libtiff/man/tiffcmp.1 +87 -0
  462. data/vendor/gitlab.com/libtiff/libtiff/man/tiffcp.1 +317 -0
  463. data/vendor/gitlab.com/libtiff/libtiff/man/tiffcrop.1 +571 -0
  464. data/vendor/gitlab.com/libtiff/libtiff/man/tiffdither.1 +135 -0
  465. data/vendor/gitlab.com/libtiff/libtiff/man/tiffdump.1 +81 -0
  466. data/vendor/gitlab.com/libtiff/libtiff/man/tiffgt.1 +245 -0
  467. data/vendor/gitlab.com/libtiff/libtiff/man/tiffinfo.1 +88 -0
  468. data/vendor/gitlab.com/libtiff/libtiff/man/tiffmedian.1 +112 -0
  469. data/vendor/gitlab.com/libtiff/libtiff/man/tiffset.1 +99 -0
  470. data/vendor/gitlab.com/libtiff/libtiff/man/tiffsplit.1 +69 -0
  471. data/vendor/gitlab.com/libtiff/libtiff/nmake.opt +229 -0
  472. data/vendor/gitlab.com/libtiff/libtiff/port/.cvsignore +7 -0
  473. data/vendor/gitlab.com/libtiff/libtiff/port/CMakeLists.txt +60 -0
  474. data/vendor/gitlab.com/libtiff/libtiff/port/Makefile.am +35 -0
  475. data/vendor/gitlab.com/libtiff/libtiff/port/Makefile.in +656 -0
  476. data/vendor/gitlab.com/libtiff/libtiff/port/Makefile.vc +44 -0
  477. data/vendor/gitlab.com/libtiff/libtiff/port/dummy.c +12 -0
  478. data/vendor/gitlab.com/libtiff/libtiff/port/getopt.c +125 -0
  479. data/vendor/gitlab.com/libtiff/libtiff/port/lfind.c +62 -0
  480. data/vendor/gitlab.com/libtiff/libtiff/port/libport.h +60 -0
  481. data/vendor/gitlab.com/libtiff/libtiff/port/snprintf.c +38 -0
  482. data/vendor/gitlab.com/libtiff/libtiff/port/strcasecmp.c +51 -0
  483. data/vendor/gitlab.com/libtiff/libtiff/port/strtoul.c +109 -0
  484. data/vendor/gitlab.com/libtiff/libtiff/port/strtoull.c +116 -0
  485. data/vendor/gitlab.com/libtiff/libtiff/test/.cvsignore +12 -0
  486. data/vendor/gitlab.com/libtiff/libtiff/test/CMakeLists.txt +382 -0
  487. data/vendor/gitlab.com/libtiff/libtiff/test/Makefile.am +334 -0
  488. data/vendor/gitlab.com/libtiff/libtiff/test/Makefile.in +1987 -0
  489. data/vendor/gitlab.com/libtiff/libtiff/test/TiffSplitTest.cmake +34 -0
  490. data/vendor/gitlab.com/libtiff/libtiff/test/TiffTest.cmake +63 -0
  491. data/vendor/gitlab.com/libtiff/libtiff/test/TiffTestCommon.cmake +108 -0
  492. data/vendor/gitlab.com/libtiff/libtiff/test/ascii_tag.c +177 -0
  493. data/vendor/gitlab.com/libtiff/libtiff/test/check_tag.c +91 -0
  494. data/vendor/gitlab.com/libtiff/libtiff/test/common.sh +122 -0
  495. data/vendor/gitlab.com/libtiff/libtiff/test/custom_dir.c +247 -0
  496. data/vendor/gitlab.com/libtiff/libtiff/test/images/README.txt +29 -0
  497. data/vendor/gitlab.com/libtiff/libtiff/test/images/logluv-3c-16b.tiff +0 -0
  498. data/vendor/gitlab.com/libtiff/libtiff/test/images/minisblack-1c-16b.tiff +0 -0
  499. data/vendor/gitlab.com/libtiff/libtiff/test/images/minisblack-1c-8b.pgm +0 -0
  500. data/vendor/gitlab.com/libtiff/libtiff/test/images/minisblack-1c-8b.tiff +0 -0
  501. data/vendor/gitlab.com/libtiff/libtiff/test/images/minisblack-2c-8b-alpha.tiff +0 -0
  502. data/vendor/gitlab.com/libtiff/libtiff/test/images/miniswhite-1c-1b.pbm +0 -0
  503. data/vendor/gitlab.com/libtiff/libtiff/test/images/miniswhite-1c-1b.tiff +0 -0
  504. data/vendor/gitlab.com/libtiff/libtiff/test/images/palette-1c-1b.tiff +0 -0
  505. data/vendor/gitlab.com/libtiff/libtiff/test/images/palette-1c-4b.tiff +0 -0
  506. data/vendor/gitlab.com/libtiff/libtiff/test/images/palette-1c-8b.tiff +0 -0
  507. data/vendor/gitlab.com/libtiff/libtiff/test/images/quad-lzw-compat.tiff +0 -0
  508. data/vendor/gitlab.com/libtiff/libtiff/test/images/quad-tile.jpg.tiff +0 -0
  509. data/vendor/gitlab.com/libtiff/libtiff/test/images/rgb-3c-16b.tiff +0 -0
  510. data/vendor/gitlab.com/libtiff/libtiff/test/images/rgb-3c-8b.ppm +0 -0
  511. data/vendor/gitlab.com/libtiff/libtiff/test/images/rgb-3c-8b.tiff +0 -0
  512. data/vendor/gitlab.com/libtiff/libtiff/test/long_tag.c +156 -0
  513. data/vendor/gitlab.com/libtiff/libtiff/test/ppm2tiff_pbm.sh +7 -0
  514. data/vendor/gitlab.com/libtiff/libtiff/test/ppm2tiff_pgm.sh +7 -0
  515. data/vendor/gitlab.com/libtiff/libtiff/test/ppm2tiff_ppm.sh +7 -0
  516. data/vendor/gitlab.com/libtiff/libtiff/test/raw_decode.c +304 -0
  517. data/vendor/gitlab.com/libtiff/libtiff/test/rewrite_tag.c +344 -0
  518. data/vendor/gitlab.com/libtiff/libtiff/test/short_tag.c +205 -0
  519. data/vendor/gitlab.com/libtiff/libtiff/test/strip.c +290 -0
  520. data/vendor/gitlab.com/libtiff/libtiff/test/strip_rw.c +157 -0
  521. data/vendor/gitlab.com/libtiff/libtiff/test/test_arrays.c +829 -0
  522. data/vendor/gitlab.com/libtiff/libtiff/test/test_arrays.h +63 -0
  523. data/vendor/gitlab.com/libtiff/libtiff/test/tiff2bw-palette-1c-8b.sh +7 -0
  524. data/vendor/gitlab.com/libtiff/libtiff/test/tiff2bw-quad-lzw-compat.sh +7 -0
  525. data/vendor/gitlab.com/libtiff/libtiff/test/tiff2bw-rgb-3c-8b.sh +7 -0
  526. data/vendor/gitlab.com/libtiff/libtiff/test/tiff2pdf.sh +6 -0
  527. data/vendor/gitlab.com/libtiff/libtiff/test/tiff2ps-EPS1.sh +6 -0
  528. data/vendor/gitlab.com/libtiff/libtiff/test/tiff2ps-PS1.sh +6 -0
  529. data/vendor/gitlab.com/libtiff/libtiff/test/tiff2ps-PS2.sh +6 -0
  530. data/vendor/gitlab.com/libtiff/libtiff/test/tiff2ps-PS3.sh +6 -0
  531. data/vendor/gitlab.com/libtiff/libtiff/test/tiff2rgba-logluv-3c-16b.sh +7 -0
  532. data/vendor/gitlab.com/libtiff/libtiff/test/tiff2rgba-minisblack-1c-16b.sh +7 -0
  533. data/vendor/gitlab.com/libtiff/libtiff/test/tiff2rgba-minisblack-1c-8b.sh +7 -0
  534. data/vendor/gitlab.com/libtiff/libtiff/test/tiff2rgba-minisblack-2c-8b-alpha.sh +7 -0
  535. data/vendor/gitlab.com/libtiff/libtiff/test/tiff2rgba-miniswhite-1c-1b.sh +7 -0
  536. data/vendor/gitlab.com/libtiff/libtiff/test/tiff2rgba-palette-1c-1b.sh +7 -0
  537. data/vendor/gitlab.com/libtiff/libtiff/test/tiff2rgba-palette-1c-4b.sh +7 -0
  538. data/vendor/gitlab.com/libtiff/libtiff/test/tiff2rgba-palette-1c-8b.sh +7 -0
  539. data/vendor/gitlab.com/libtiff/libtiff/test/tiff2rgba-quad-tile.jpg.sh +7 -0
  540. data/vendor/gitlab.com/libtiff/libtiff/test/tiff2rgba-rgb-3c-16b.sh +7 -0
  541. data/vendor/gitlab.com/libtiff/libtiff/test/tiff2rgba-rgb-3c-8b.sh +7 -0
  542. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcp-g3-1d-fill.sh +7 -0
  543. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcp-g3-1d.sh +6 -0
  544. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcp-g3-2d-fill.sh +7 -0
  545. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcp-g3-2d.sh +6 -0
  546. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcp-g3.sh +6 -0
  547. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcp-g4.sh +6 -0
  548. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcp-logluv.sh +7 -0
  549. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcp-lzw-compat.sh +6 -0
  550. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcp-split-join.sh +16 -0
  551. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcp-split.sh +13 -0
  552. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcp-thumbnail.sh +10 -0
  553. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-R90-logluv-3c-16b.sh +7 -0
  554. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-R90-minisblack-1c-16b.sh +7 -0
  555. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-R90-minisblack-1c-8b.sh +7 -0
  556. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-R90-minisblack-2c-8b-alpha.sh +7 -0
  557. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-R90-miniswhite-1c-1b.sh +7 -0
  558. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-R90-palette-1c-1b.sh +7 -0
  559. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-R90-palette-1c-4b.sh +7 -0
  560. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-R90-palette-1c-8b.sh +7 -0
  561. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-R90-quad-tile.jpg.sh +7 -0
  562. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-R90-rgb-3c-16b.sh +7 -0
  563. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-R90-rgb-3c-8b.sh +7 -0
  564. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-doubleflip-logluv-3c-16b.sh +7 -0
  565. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-doubleflip-minisblack-1c-16b.sh +7 -0
  566. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-doubleflip-minisblack-1c-8b.sh +7 -0
  567. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-doubleflip-minisblack-2c-8b-alpha.sh +7 -0
  568. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-doubleflip-miniswhite-1c-1b.sh +7 -0
  569. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-doubleflip-palette-1c-1b.sh +7 -0
  570. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-doubleflip-palette-1c-4b.sh +7 -0
  571. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-doubleflip-palette-1c-8b.sh +7 -0
  572. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-doubleflip-quad-tile.jpg.sh +7 -0
  573. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-doubleflip-rgb-3c-16b.sh +7 -0
  574. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-doubleflip-rgb-3c-8b.sh +7 -0
  575. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-extract-logluv-3c-16b.sh +7 -0
  576. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-extract-minisblack-1c-16b.sh +7 -0
  577. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-extract-minisblack-1c-8b.sh +7 -0
  578. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-extract-minisblack-2c-8b-alpha.sh +7 -0
  579. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-extract-miniswhite-1c-1b.sh +7 -0
  580. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-extract-palette-1c-1b.sh +7 -0
  581. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-extract-palette-1c-4b.sh +7 -0
  582. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-extract-palette-1c-8b.sh +7 -0
  583. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-extract-quad-tile.jpg.sh +7 -0
  584. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-extract-rgb-3c-16b.sh +7 -0
  585. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-extract-rgb-3c-8b.sh +7 -0
  586. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-extractz14-logluv-3c-16b.sh +7 -0
  587. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-extractz14-minisblack-1c-16b.sh +7 -0
  588. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-extractz14-minisblack-1c-8b.sh +7 -0
  589. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-extractz14-minisblack-2c-8b-alpha.sh +7 -0
  590. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-extractz14-miniswhite-1c-1b.sh +7 -0
  591. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-extractz14-palette-1c-1b.sh +7 -0
  592. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-extractz14-palette-1c-4b.sh +7 -0
  593. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-extractz14-palette-1c-8b.sh +7 -0
  594. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-extractz14-quad-tile.jpg.sh +7 -0
  595. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-extractz14-rgb-3c-16b.sh +7 -0
  596. data/vendor/gitlab.com/libtiff/libtiff/test/tiffcrop-extractz14-rgb-3c-8b.sh +7 -0
  597. data/vendor/gitlab.com/libtiff/libtiff/test/tiffdump.sh +6 -0
  598. data/vendor/gitlab.com/libtiff/libtiff/test/tiffinfo.sh +6 -0
  599. data/vendor/gitlab.com/libtiff/libtiff/test/tifftest.h +42 -0
  600. data/vendor/gitlab.com/libtiff/libtiff/tiff.spec +68 -0
  601. data/vendor/gitlab.com/libtiff/libtiff/tools/.cvsignore +27 -0
  602. data/vendor/gitlab.com/libtiff/libtiff/tools/CMakeLists.txt +125 -0
  603. data/vendor/gitlab.com/libtiff/libtiff/tools/Makefile.am +138 -0
  604. data/vendor/gitlab.com/libtiff/libtiff/tools/Makefile.in +955 -0
  605. data/vendor/gitlab.com/libtiff/libtiff/tools/Makefile.lcc +133 -0
  606. data/vendor/gitlab.com/libtiff/libtiff/tools/Makefile.vc +52 -0
  607. data/vendor/gitlab.com/libtiff/libtiff/tools/fax2ps.c +463 -0
  608. data/vendor/gitlab.com/libtiff/libtiff/tools/fax2tiff.c +491 -0
  609. data/vendor/gitlab.com/libtiff/libtiff/tools/pal2rgb.c +438 -0
  610. data/vendor/gitlab.com/libtiff/libtiff/tools/ppm2tiff.c +397 -0
  611. data/vendor/gitlab.com/libtiff/libtiff/tools/raw2tiff.c +690 -0
  612. data/vendor/gitlab.com/libtiff/libtiff/tools/rgb2ycbcr.c +397 -0
  613. data/vendor/gitlab.com/libtiff/libtiff/tools/thumbnail.c +691 -0
  614. data/vendor/gitlab.com/libtiff/libtiff/tools/tiff2bw.c +501 -0
  615. data/vendor/gitlab.com/libtiff/libtiff/tools/tiff2pdf.c +5594 -0
  616. data/vendor/gitlab.com/libtiff/libtiff/tools/tiff2ps.c +3106 -0
  617. data/vendor/gitlab.com/libtiff/libtiff/tools/tiff2rgba.c +569 -0
  618. data/vendor/gitlab.com/libtiff/libtiff/tools/tiffcmp.c +659 -0
  619. data/vendor/gitlab.com/libtiff/libtiff/tools/tiffcp.c +1913 -0
  620. data/vendor/gitlab.com/libtiff/libtiff/tools/tiffcrop.c +9231 -0
  621. data/vendor/gitlab.com/libtiff/libtiff/tools/tiffdither.c +347 -0
  622. data/vendor/gitlab.com/libtiff/libtiff/tools/tiffdump.c +889 -0
  623. data/vendor/gitlab.com/libtiff/libtiff/tools/tiffgt.c +486 -0
  624. data/vendor/gitlab.com/libtiff/libtiff/tools/tiffinfo.c +488 -0
  625. data/vendor/gitlab.com/libtiff/libtiff/tools/tiffinfoce.c +472 -0
  626. data/vendor/gitlab.com/libtiff/libtiff/tools/tiffmedian.c +918 -0
  627. data/vendor/gitlab.com/libtiff/libtiff/tools/tiffset.c +356 -0
  628. data/vendor/gitlab.com/libtiff/libtiff/tools/tiffsplit.c +305 -0
  629. metadata +692 -0
@@ -0,0 +1,143 @@
1
+ /* $Header: /cvs/maptools/cvsroot/libtiff/libtiff/tif_dumpmode.c,v 1.15 2015-12-12 18:04:26 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
+ /*
28
+ * TIFF Library.
29
+ *
30
+ * "Null" Compression Algorithm Support.
31
+ */
32
+ #include "tiffiop.h"
33
+
34
+ static int
35
+ DumpFixupTags(TIFF* tif)
36
+ {
37
+ (void) tif;
38
+ return (1);
39
+ }
40
+
41
+ /*
42
+ * Encode a hunk of pixels.
43
+ */
44
+ static int
45
+ DumpModeEncode(TIFF* tif, uint8* pp, tmsize_t cc, uint16 s)
46
+ {
47
+ (void) s;
48
+ while (cc > 0) {
49
+ tmsize_t n;
50
+
51
+ n = cc;
52
+ if (tif->tif_rawcc + n > tif->tif_rawdatasize)
53
+ n = tif->tif_rawdatasize - tif->tif_rawcc;
54
+
55
+ assert( n > 0 );
56
+
57
+ /*
58
+ * Avoid copy if client has setup raw
59
+ * data buffer to avoid extra copy.
60
+ */
61
+ if (tif->tif_rawcp != pp)
62
+ _TIFFmemcpy(tif->tif_rawcp, pp, n);
63
+ tif->tif_rawcp += n;
64
+ tif->tif_rawcc += n;
65
+ pp += n;
66
+ cc -= n;
67
+ if (tif->tif_rawcc >= tif->tif_rawdatasize &&
68
+ !TIFFFlushData1(tif))
69
+ return (0);
70
+ }
71
+ return (1);
72
+ }
73
+
74
+ /*
75
+ * Decode a hunk of pixels.
76
+ */
77
+ static int
78
+ DumpModeDecode(TIFF* tif, uint8* buf, tmsize_t cc, uint16 s)
79
+ {
80
+ static const char module[] = "DumpModeDecode";
81
+ (void) s;
82
+ if (tif->tif_rawcc < cc) {
83
+ #if defined(__WIN32__) && (defined(_MSC_VER) || defined(__MINGW32__))
84
+ TIFFErrorExt(tif->tif_clientdata, module,
85
+ "Not enough data for scanline %lu, expected a request for at most %I64d bytes, got a request for %I64d bytes",
86
+ (unsigned long) tif->tif_row,
87
+ (signed __int64) tif->tif_rawcc,
88
+ (signed __int64) cc);
89
+ #else
90
+ TIFFErrorExt(tif->tif_clientdata, module,
91
+ "Not enough data for scanline %lu, expected a request for at most %lld bytes, got a request for %lld bytes",
92
+ (unsigned long) tif->tif_row,
93
+ (signed long long) tif->tif_rawcc,
94
+ (signed long long) cc);
95
+ #endif
96
+ return (0);
97
+ }
98
+ /*
99
+ * Avoid copy if client has setup raw
100
+ * data buffer to avoid extra copy.
101
+ */
102
+ if (tif->tif_rawcp != buf)
103
+ _TIFFmemcpy(buf, tif->tif_rawcp, cc);
104
+ tif->tif_rawcp += cc;
105
+ tif->tif_rawcc -= cc;
106
+ return (1);
107
+ }
108
+
109
+ /*
110
+ * Seek forwards nrows in the current strip.
111
+ */
112
+ static int
113
+ DumpModeSeek(TIFF* tif, uint32 nrows)
114
+ {
115
+ tif->tif_rawcp += nrows * tif->tif_scanlinesize;
116
+ tif->tif_rawcc -= nrows * tif->tif_scanlinesize;
117
+ return (1);
118
+ }
119
+
120
+ /*
121
+ * Initialize dump mode.
122
+ */
123
+ int
124
+ TIFFInitDumpMode(TIFF* tif, int scheme)
125
+ {
126
+ (void) scheme;
127
+ tif->tif_fixuptags = DumpFixupTags;
128
+ tif->tif_decoderow = DumpModeDecode;
129
+ tif->tif_decodestrip = DumpModeDecode;
130
+ tif->tif_decodetile = DumpModeDecode;
131
+ tif->tif_encoderow = DumpModeEncode;
132
+ tif->tif_encodestrip = DumpModeEncode;
133
+ tif->tif_encodetile = DumpModeEncode;
134
+ tif->tif_seek = DumpModeSeek;
135
+ return (1);
136
+ }
137
+ /*
138
+ * Local Variables:
139
+ * mode: c
140
+ * c-basic-offset: 8
141
+ * fill-column: 78
142
+ * End:
143
+ */
@@ -0,0 +1,88 @@
1
+ /* $Header: /cvs/maptools/cvsroot/libtiff/libtiff/tif_error.c,v 1.6 2017-07-04 12:54:42 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
+ /*
28
+ * TIFF Library.
29
+ */
30
+ #include "tiffiop.h"
31
+
32
+ TIFFErrorHandlerExt _TIFFerrorHandlerExt = NULL;
33
+
34
+ TIFFErrorHandler
35
+ TIFFSetErrorHandler(TIFFErrorHandler handler)
36
+ {
37
+ TIFFErrorHandler prev = _TIFFerrorHandler;
38
+ _TIFFerrorHandler = handler;
39
+ return (prev);
40
+ }
41
+
42
+ TIFFErrorHandlerExt
43
+ TIFFSetErrorHandlerExt(TIFFErrorHandlerExt handler)
44
+ {
45
+ TIFFErrorHandlerExt prev = _TIFFerrorHandlerExt;
46
+ _TIFFerrorHandlerExt = handler;
47
+ return (prev);
48
+ }
49
+
50
+ void
51
+ TIFFError(const char* module, const char* fmt, ...)
52
+ {
53
+ va_list ap;
54
+ if (_TIFFerrorHandler) {
55
+ va_start(ap, fmt);
56
+ (*_TIFFerrorHandler)(module, fmt, ap);
57
+ va_end(ap);
58
+ }
59
+ if (_TIFFerrorHandlerExt) {
60
+ va_start(ap, fmt);
61
+ (*_TIFFerrorHandlerExt)(0, module, fmt, ap);
62
+ va_end(ap);
63
+ }
64
+ }
65
+
66
+ void
67
+ TIFFErrorExt(thandle_t fd, const char* module, const char* fmt, ...)
68
+ {
69
+ va_list ap;
70
+ if (_TIFFerrorHandler) {
71
+ va_start(ap, fmt);
72
+ (*_TIFFerrorHandler)(module, fmt, ap);
73
+ va_end(ap);
74
+ }
75
+ if (_TIFFerrorHandlerExt) {
76
+ va_start(ap, fmt);
77
+ (*_TIFFerrorHandlerExt)(fd, module, fmt, ap);
78
+ va_end(ap);
79
+ }
80
+ }
81
+
82
+ /*
83
+ * Local Variables:
84
+ * mode: c
85
+ * c-basic-offset: 8
86
+ * fill-column: 78
87
+ * End:
88
+ */
@@ -0,0 +1,118 @@
1
+ /* $Header: /cvs/maptools/cvsroot/libtiff/libtiff/tif_extension.c,v 1.8 2015-12-06 11:13:43 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
+ /*
28
+ * TIFF Library.
29
+ *
30
+ * Various routines support external extension of the tag set, and other
31
+ * application extension capabilities.
32
+ */
33
+
34
+ #include "tiffiop.h"
35
+
36
+ int TIFFGetTagListCount( TIFF *tif )
37
+
38
+ {
39
+ TIFFDirectory* td = &tif->tif_dir;
40
+
41
+ return td->td_customValueCount;
42
+ }
43
+
44
+ uint32 TIFFGetTagListEntry( TIFF *tif, int tag_index )
45
+
46
+ {
47
+ TIFFDirectory* td = &tif->tif_dir;
48
+
49
+ if( tag_index < 0 || tag_index >= td->td_customValueCount )
50
+ return (uint32)(-1);
51
+ else
52
+ return td->td_customValues[tag_index].info->field_tag;
53
+ }
54
+
55
+ /*
56
+ ** This provides read/write access to the TIFFTagMethods within the TIFF
57
+ ** structure to application code without giving access to the private
58
+ ** TIFF structure.
59
+ */
60
+ TIFFTagMethods *TIFFAccessTagMethods( TIFF *tif )
61
+
62
+ {
63
+ return &(tif->tif_tagmethods);
64
+ }
65
+
66
+ void *TIFFGetClientInfo( TIFF *tif, const char *name )
67
+
68
+ {
69
+ TIFFClientInfoLink *psLink = tif->tif_clientinfo;
70
+
71
+ while( psLink != NULL && strcmp(psLink->name,name) != 0 )
72
+ psLink = psLink->next;
73
+
74
+ if( psLink != NULL )
75
+ return psLink->data;
76
+ else
77
+ return NULL;
78
+ }
79
+
80
+ void TIFFSetClientInfo( TIFF *tif, void *data, const char *name )
81
+
82
+ {
83
+ TIFFClientInfoLink *psLink = tif->tif_clientinfo;
84
+
85
+ /*
86
+ ** Do we have an existing link with this name? If so, just
87
+ ** set it.
88
+ */
89
+ while( psLink != NULL && strcmp(psLink->name,name) != 0 )
90
+ psLink = psLink->next;
91
+
92
+ if( psLink != NULL )
93
+ {
94
+ psLink->data = data;
95
+ return;
96
+ }
97
+
98
+ /*
99
+ ** Create a new link.
100
+ */
101
+
102
+ psLink = (TIFFClientInfoLink *) _TIFFmalloc(sizeof(TIFFClientInfoLink));
103
+ assert (psLink != NULL);
104
+ psLink->next = tif->tif_clientinfo;
105
+ psLink->name = (char *) _TIFFmalloc((tmsize_t)(strlen(name)+1));
106
+ assert (psLink->name != NULL);
107
+ strcpy(psLink->name, name);
108
+ psLink->data = data;
109
+
110
+ tif->tif_clientinfo = psLink;
111
+ }
112
+ /*
113
+ * Local Variables:
114
+ * mode: c
115
+ * c-basic-offset: 8
116
+ * fill-column: 78
117
+ * End:
118
+ */
@@ -0,0 +1,1648 @@
1
+ /* $Id: tif_fax3.c,v 1.81 2017-06-18 10:31:50 erouault Exp $ */
2
+
3
+ /*
4
+ * Copyright (c) 1990-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 CCITT_SUPPORT
29
+ /*
30
+ * TIFF Library.
31
+ *
32
+ * CCITT Group 3 (T.4) and Group 4 (T.6) Compression Support.
33
+ *
34
+ * This file contains support for decoding and encoding TIFF
35
+ * compression algorithms 2, 3, 4, and 32771.
36
+ *
37
+ * Decoder support is derived, with permission, from the code
38
+ * in Frank Cringle's viewfax program;
39
+ * Copyright (C) 1990, 1995 Frank D. Cringle.
40
+ */
41
+ #include "tif_fax3.h"
42
+ #define G3CODES
43
+ #include "t4.h"
44
+ #include <stdio.h>
45
+
46
+ /*
47
+ * Compression+decompression state blocks are
48
+ * derived from this ``base state'' block.
49
+ */
50
+ typedef struct {
51
+ int rw_mode; /* O_RDONLY for decode, else encode */
52
+ int mode; /* operating mode */
53
+ tmsize_t rowbytes; /* bytes in a decoded scanline */
54
+ uint32 rowpixels; /* pixels in a scanline */
55
+
56
+ uint16 cleanfaxdata; /* CleanFaxData tag */
57
+ uint32 badfaxrun; /* BadFaxRun tag */
58
+ uint32 badfaxlines; /* BadFaxLines tag */
59
+ uint32 groupoptions; /* Group 3/4 options tag */
60
+
61
+ TIFFVGetMethod vgetparent; /* super-class method */
62
+ TIFFVSetMethod vsetparent; /* super-class method */
63
+ TIFFPrintMethod printdir; /* super-class method */
64
+ } Fax3BaseState;
65
+ #define Fax3State(tif) ((Fax3BaseState*) (tif)->tif_data)
66
+
67
+ typedef enum { G3_1D, G3_2D } Ttag;
68
+ typedef struct {
69
+ Fax3BaseState b;
70
+
71
+ /* Decoder state info */
72
+ const unsigned char* bitmap; /* bit reversal table */
73
+ uint32 data; /* current i/o byte/word */
74
+ int bit; /* current i/o bit in byte */
75
+ int EOLcnt; /* count of EOL codes recognized */
76
+ TIFFFaxFillFunc fill; /* fill routine */
77
+ uint32* runs; /* b&w runs for current/previous row */
78
+ uint32* refruns; /* runs for reference line */
79
+ uint32* curruns; /* runs for current line */
80
+
81
+ /* Encoder state info */
82
+ Ttag tag; /* encoding state */
83
+ unsigned char* refline; /* reference line for 2d decoding */
84
+ int k; /* #rows left that can be 2d encoded */
85
+ int maxk; /* max #rows that can be 2d encoded */
86
+
87
+ int line;
88
+ } Fax3CodecState;
89
+ #define DecoderState(tif) ((Fax3CodecState*) Fax3State(tif))
90
+ #define EncoderState(tif) ((Fax3CodecState*) Fax3State(tif))
91
+
92
+ #define is2DEncoding(sp) (sp->b.groupoptions & GROUP3OPT_2DENCODING)
93
+ #define isAligned(p,t) ((((size_t)(p)) & (sizeof (t)-1)) == 0)
94
+
95
+ /*
96
+ * Group 3 and Group 4 Decoding.
97
+ */
98
+
99
+ /*
100
+ * These macros glue the TIFF library state to
101
+ * the state expected by Frank's decoder.
102
+ */
103
+ #define DECLARE_STATE(tif, sp, mod) \
104
+ static const char module[] = mod; \
105
+ Fax3CodecState* sp = DecoderState(tif); \
106
+ int a0; /* reference element */ \
107
+ int lastx = sp->b.rowpixels; /* last element in row */ \
108
+ uint32 BitAcc; /* bit accumulator */ \
109
+ int BitsAvail; /* # valid bits in BitAcc */ \
110
+ int RunLength; /* length of current run */ \
111
+ unsigned char* cp; /* next byte of input data */ \
112
+ unsigned char* ep; /* end of input data */ \
113
+ uint32* pa; /* place to stuff next run */ \
114
+ uint32* thisrun; /* current row's run array */ \
115
+ int EOLcnt; /* # EOL codes recognized */ \
116
+ const unsigned char* bitmap = sp->bitmap; /* input data bit reverser */ \
117
+ const TIFFFaxTabEnt* TabEnt
118
+ #define DECLARE_STATE_2D(tif, sp, mod) \
119
+ DECLARE_STATE(tif, sp, mod); \
120
+ int b1; /* next change on prev line */ \
121
+ uint32* pb /* next run in reference line */\
122
+ /*
123
+ * Load any state that may be changed during decoding.
124
+ */
125
+ #define CACHE_STATE(tif, sp) do { \
126
+ BitAcc = sp->data; \
127
+ BitsAvail = sp->bit; \
128
+ EOLcnt = sp->EOLcnt; \
129
+ cp = (unsigned char*) tif->tif_rawcp; \
130
+ ep = cp + tif->tif_rawcc; \
131
+ } while (0)
132
+ /*
133
+ * Save state possibly changed during decoding.
134
+ */
135
+ #define UNCACHE_STATE(tif, sp) do { \
136
+ sp->bit = BitsAvail; \
137
+ sp->data = BitAcc; \
138
+ sp->EOLcnt = EOLcnt; \
139
+ tif->tif_rawcc -= (tmsize_t)((uint8*) cp - tif->tif_rawcp); \
140
+ tif->tif_rawcp = (uint8*) cp; \
141
+ } while (0)
142
+
143
+ /*
144
+ * Setup state for decoding a strip.
145
+ */
146
+ static int
147
+ Fax3PreDecode(TIFF* tif, uint16 s)
148
+ {
149
+ Fax3CodecState* sp = DecoderState(tif);
150
+
151
+ (void) s;
152
+ assert(sp != NULL);
153
+ sp->bit = 0; /* force initial read */
154
+ sp->data = 0;
155
+ sp->EOLcnt = 0; /* force initial scan for EOL */
156
+ /*
157
+ * Decoder assumes lsb-to-msb bit order. Note that we select
158
+ * this here rather than in Fax3SetupState so that viewers can
159
+ * hold the image open, fiddle with the FillOrder tag value,
160
+ * and then re-decode the image. Otherwise they'd need to close
161
+ * and open the image to get the state reset.
162
+ */
163
+ sp->bitmap =
164
+ TIFFGetBitRevTable(tif->tif_dir.td_fillorder != FILLORDER_LSB2MSB);
165
+ if (sp->refruns) { /* init reference line to white */
166
+ sp->refruns[0] = (uint32) sp->b.rowpixels;
167
+ sp->refruns[1] = 0;
168
+ }
169
+ sp->line = 0;
170
+ return (1);
171
+ }
172
+
173
+ /*
174
+ * Routine for handling various errors/conditions.
175
+ * Note how they are "glued into the decoder" by
176
+ * overriding the definitions used by the decoder.
177
+ */
178
+
179
+ static void
180
+ Fax3Unexpected(const char* module, TIFF* tif, uint32 line, uint32 a0)
181
+ {
182
+ TIFFErrorExt(tif->tif_clientdata, module, "Bad code word at line %u of %s %u (x %u)",
183
+ line, isTiled(tif) ? "tile" : "strip",
184
+ (isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip),
185
+ a0);
186
+ }
187
+ #define unexpected(table, a0) Fax3Unexpected(module, tif, sp->line, a0)
188
+
189
+ static void
190
+ Fax3Extension(const char* module, TIFF* tif, uint32 line, uint32 a0)
191
+ {
192
+ TIFFErrorExt(tif->tif_clientdata, module,
193
+ "Uncompressed data (not supported) at line %u of %s %u (x %u)",
194
+ line, isTiled(tif) ? "tile" : "strip",
195
+ (isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip),
196
+ a0);
197
+ }
198
+ #define extension(a0) Fax3Extension(module, tif, sp->line, a0)
199
+
200
+ static void
201
+ Fax3BadLength(const char* module, TIFF* tif, uint32 line, uint32 a0, uint32 lastx)
202
+ {
203
+ TIFFWarningExt(tif->tif_clientdata, module, "%s at line %u of %s %u (got %u, expected %u)",
204
+ a0 < lastx ? "Premature EOL" : "Line length mismatch",
205
+ line, isTiled(tif) ? "tile" : "strip",
206
+ (isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip),
207
+ a0, lastx);
208
+ }
209
+ #define badlength(a0,lastx) Fax3BadLength(module, tif, sp->line, a0, lastx)
210
+
211
+ static void
212
+ Fax3PrematureEOF(const char* module, TIFF* tif, uint32 line, uint32 a0)
213
+ {
214
+ TIFFWarningExt(tif->tif_clientdata, module, "Premature EOF at line %u of %s %u (x %u)",
215
+ line, isTiled(tif) ? "tile" : "strip",
216
+ (isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip),
217
+ a0);
218
+ }
219
+ #define prematureEOF(a0) Fax3PrematureEOF(module, tif, sp->line, a0)
220
+
221
+ #define Nop
222
+
223
+ /*
224
+ * Decode the requested amount of G3 1D-encoded data.
225
+ */
226
+ static int
227
+ Fax3Decode1D(TIFF* tif, uint8* buf, tmsize_t occ, uint16 s)
228
+ {
229
+ DECLARE_STATE(tif, sp, "Fax3Decode1D");
230
+ (void) s;
231
+ if (occ % sp->b.rowbytes)
232
+ {
233
+ TIFFErrorExt(tif->tif_clientdata, module, "Fractional scanlines cannot be read");
234
+ return (-1);
235
+ }
236
+ CACHE_STATE(tif, sp);
237
+ thisrun = sp->curruns;
238
+ while (occ > 0) {
239
+ a0 = 0;
240
+ RunLength = 0;
241
+ pa = thisrun;
242
+ #ifdef FAX3_DEBUG
243
+ printf("\nBitAcc=%08X, BitsAvail = %d\n", BitAcc, BitsAvail);
244
+ printf("-------------------- %d\n", tif->tif_row);
245
+ fflush(stdout);
246
+ #endif
247
+ SYNC_EOL(EOF1D);
248
+ EXPAND1D(EOF1Da);
249
+ (*sp->fill)(buf, thisrun, pa, lastx);
250
+ buf += sp->b.rowbytes;
251
+ occ -= sp->b.rowbytes;
252
+ sp->line++;
253
+ continue;
254
+ EOF1D: /* premature EOF */
255
+ CLEANUP_RUNS();
256
+ EOF1Da: /* premature EOF */
257
+ (*sp->fill)(buf, thisrun, pa, lastx);
258
+ UNCACHE_STATE(tif, sp);
259
+ return (-1);
260
+ }
261
+ UNCACHE_STATE(tif, sp);
262
+ return (1);
263
+ }
264
+
265
+ #define SWAP(t,a,b) { t x; x = (a); (a) = (b); (b) = x; }
266
+ /*
267
+ * Decode the requested amount of G3 2D-encoded data.
268
+ */
269
+ static int
270
+ Fax3Decode2D(TIFF* tif, uint8* buf, tmsize_t occ, uint16 s)
271
+ {
272
+ DECLARE_STATE_2D(tif, sp, "Fax3Decode2D");
273
+ int is1D; /* current line is 1d/2d-encoded */
274
+ (void) s;
275
+ if (occ % sp->b.rowbytes)
276
+ {
277
+ TIFFErrorExt(tif->tif_clientdata, module, "Fractional scanlines cannot be read");
278
+ return (-1);
279
+ }
280
+ CACHE_STATE(tif, sp);
281
+ while (occ > 0) {
282
+ a0 = 0;
283
+ RunLength = 0;
284
+ pa = thisrun = sp->curruns;
285
+ #ifdef FAX3_DEBUG
286
+ printf("\nBitAcc=%08X, BitsAvail = %d EOLcnt = %d",
287
+ BitAcc, BitsAvail, EOLcnt);
288
+ #endif
289
+ SYNC_EOL(EOF2D);
290
+ NeedBits8(1, EOF2D);
291
+ is1D = GetBits(1); /* 1D/2D-encoding tag bit */
292
+ ClrBits(1);
293
+ #ifdef FAX3_DEBUG
294
+ printf(" %s\n-------------------- %d\n",
295
+ is1D ? "1D" : "2D", tif->tif_row);
296
+ fflush(stdout);
297
+ #endif
298
+ pb = sp->refruns;
299
+ b1 = *pb++;
300
+ if (is1D)
301
+ EXPAND1D(EOF2Da);
302
+ else
303
+ EXPAND2D(EOF2Da);
304
+ (*sp->fill)(buf, thisrun, pa, lastx);
305
+ SETVALUE(0); /* imaginary change for reference */
306
+ SWAP(uint32*, sp->curruns, sp->refruns);
307
+ buf += sp->b.rowbytes;
308
+ occ -= sp->b.rowbytes;
309
+ sp->line++;
310
+ continue;
311
+ EOF2D: /* premature EOF */
312
+ CLEANUP_RUNS();
313
+ EOF2Da: /* premature EOF */
314
+ (*sp->fill)(buf, thisrun, pa, lastx);
315
+ UNCACHE_STATE(tif, sp);
316
+ return (-1);
317
+ }
318
+ UNCACHE_STATE(tif, sp);
319
+ return (1);
320
+ }
321
+ #undef SWAP
322
+
323
+ /*
324
+ * The ZERO & FILL macros must handle spans < 2*sizeof(long) bytes.
325
+ * For machines with 64-bit longs this is <16 bytes; otherwise
326
+ * this is <8 bytes. We optimize the code here to reflect the
327
+ * machine characteristics.
328
+ */
329
+ #if SIZEOF_UNSIGNED_LONG == 8
330
+ # define FILL(n, cp) \
331
+ switch (n) { \
332
+ case 15:(cp)[14] = 0xff; /*-fallthrough*/ \
333
+ case 14:(cp)[13] = 0xff; /*-fallthrough*/ \
334
+ case 13:(cp)[12] = 0xff; /*-fallthrough*/ \
335
+ case 12:(cp)[11] = 0xff; /*-fallthrough*/ \
336
+ case 11:(cp)[10] = 0xff; /*-fallthrough*/ \
337
+ case 10: (cp)[9] = 0xff; /*-fallthrough*/ \
338
+ case 9: (cp)[8] = 0xff; /*-fallthrough*/ \
339
+ case 8: (cp)[7] = 0xff; /*-fallthrough*/ \
340
+ case 7: (cp)[6] = 0xff; /*-fallthrough*/ \
341
+ case 6: (cp)[5] = 0xff; /*-fallthrough*/ \
342
+ case 5: (cp)[4] = 0xff; /*-fallthrough*/ \
343
+ case 4: (cp)[3] = 0xff; /*-fallthrough*/ \
344
+ case 3: (cp)[2] = 0xff; /*-fallthrough*/ \
345
+ case 2: (cp)[1] = 0xff; /*-fallthrough*/ \
346
+ case 1: (cp)[0] = 0xff; (cp) += (n); /*-fallthrough*/ \
347
+ case 0: ; \
348
+ }
349
+ # define ZERO(n, cp) \
350
+ switch (n) { \
351
+ case 15:(cp)[14] = 0; /*-fallthrough*/ \
352
+ case 14:(cp)[13] = 0; /*-fallthrough*/ \
353
+ case 13:(cp)[12] = 0; /*-fallthrough*/ \
354
+ case 12:(cp)[11] = 0; /*-fallthrough*/ \
355
+ case 11:(cp)[10] = 0; /*-fallthrough*/ \
356
+ case 10: (cp)[9] = 0; /*-fallthrough*/ \
357
+ case 9: (cp)[8] = 0; /*-fallthrough*/ \
358
+ case 8: (cp)[7] = 0; /*-fallthrough*/ \
359
+ case 7: (cp)[6] = 0; /*-fallthrough*/ \
360
+ case 6: (cp)[5] = 0; /*-fallthrough*/ \
361
+ case 5: (cp)[4] = 0; /*-fallthrough*/ \
362
+ case 4: (cp)[3] = 0; /*-fallthrough*/ \
363
+ case 3: (cp)[2] = 0; /*-fallthrough*/ \
364
+ case 2: (cp)[1] = 0; /*-fallthrough*/ \
365
+ case 1: (cp)[0] = 0; (cp) += (n); /*-fallthrough*/ \
366
+ case 0: ; \
367
+ }
368
+ #else
369
+ # define FILL(n, cp) \
370
+ switch (n) { \
371
+ case 7: (cp)[6] = 0xff; /*-fallthrough*/ \
372
+ case 6: (cp)[5] = 0xff; /*-fallthrough*/ \
373
+ case 5: (cp)[4] = 0xff; /*-fallthrough*/ \
374
+ case 4: (cp)[3] = 0xff; /*-fallthrough*/ \
375
+ case 3: (cp)[2] = 0xff; /*-fallthrough*/ \
376
+ case 2: (cp)[1] = 0xff; /*-fallthrough*/ \
377
+ case 1: (cp)[0] = 0xff; (cp) += (n); /*-fallthrough*/ \
378
+ case 0: ; \
379
+ }
380
+ # define ZERO(n, cp) \
381
+ switch (n) { \
382
+ case 7: (cp)[6] = 0; /*-fallthrough*/ \
383
+ case 6: (cp)[5] = 0; /*-fallthrough*/ \
384
+ case 5: (cp)[4] = 0; /*-fallthrough*/ \
385
+ case 4: (cp)[3] = 0; /*-fallthrough*/ \
386
+ case 3: (cp)[2] = 0; /*-fallthrough*/ \
387
+ case 2: (cp)[1] = 0; /*-fallthrough*/ \
388
+ case 1: (cp)[0] = 0; (cp) += (n); /*-fallthrough*/ \
389
+ case 0: ; \
390
+ }
391
+ #endif
392
+
393
+ /*
394
+ * Bit-fill a row according to the white/black
395
+ * runs generated during G3/G4 decoding.
396
+ */
397
+ void
398
+ _TIFFFax3fillruns(unsigned char* buf, uint32* runs, uint32* erun, uint32 lastx)
399
+ {
400
+ static const unsigned char _fillmasks[] =
401
+ { 0x00, 0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc, 0xfe, 0xff };
402
+ unsigned char* cp;
403
+ uint32 x, bx, run;
404
+ int32 n, nw;
405
+ long* lp;
406
+
407
+ if ((erun-runs)&1)
408
+ *erun++ = 0;
409
+ x = 0;
410
+ for (; runs < erun; runs += 2) {
411
+ run = runs[0];
412
+ if (x+run > lastx || run > lastx )
413
+ run = runs[0] = (uint32) (lastx - x);
414
+ if (run) {
415
+ cp = buf + (x>>3);
416
+ bx = x&7;
417
+ if (run > 8-bx) {
418
+ if (bx) { /* align to byte boundary */
419
+ *cp++ &= 0xff << (8-bx);
420
+ run -= 8-bx;
421
+ }
422
+ if( (n = run >> 3) != 0 ) { /* multiple bytes to fill */
423
+ if ((n/sizeof (long)) > 1) {
424
+ /*
425
+ * Align to longword boundary and fill.
426
+ */
427
+ for (; n && !isAligned(cp, long); n--)
428
+ *cp++ = 0x00;
429
+ lp = (long*) cp;
430
+ nw = (int32)(n / sizeof (long));
431
+ n -= nw * sizeof (long);
432
+ do {
433
+ *lp++ = 0L;
434
+ } while (--nw);
435
+ cp = (unsigned char*) lp;
436
+ }
437
+ ZERO(n, cp);
438
+ run &= 7;
439
+ }
440
+ if (run)
441
+ cp[0] &= 0xff >> run;
442
+ } else
443
+ cp[0] &= ~(_fillmasks[run]>>bx);
444
+ x += runs[0];
445
+ }
446
+ run = runs[1];
447
+ if (x+run > lastx || run > lastx )
448
+ run = runs[1] = lastx - x;
449
+ if (run) {
450
+ cp = buf + (x>>3);
451
+ bx = x&7;
452
+ if (run > 8-bx) {
453
+ if (bx) { /* align to byte boundary */
454
+ *cp++ |= 0xff >> bx;
455
+ run -= 8-bx;
456
+ }
457
+ if( (n = run>>3) != 0 ) { /* multiple bytes to fill */
458
+ if ((n/sizeof (long)) > 1) {
459
+ /*
460
+ * Align to longword boundary and fill.
461
+ */
462
+ for (; n && !isAligned(cp, long); n--)
463
+ *cp++ = 0xff;
464
+ lp = (long*) cp;
465
+ nw = (int32)(n / sizeof (long));
466
+ n -= nw * sizeof (long);
467
+ do {
468
+ *lp++ = -1L;
469
+ } while (--nw);
470
+ cp = (unsigned char*) lp;
471
+ }
472
+ FILL(n, cp);
473
+ run &= 7;
474
+ }
475
+ /* Explicit 0xff masking to make icc -check=conversions happy */
476
+ if (run)
477
+ cp[0] = (unsigned char)((cp[0] | (0xff00 >> run))&0xff);
478
+ } else
479
+ cp[0] |= _fillmasks[run]>>bx;
480
+ x += runs[1];
481
+ }
482
+ }
483
+ assert(x == lastx);
484
+ }
485
+ #undef ZERO
486
+ #undef FILL
487
+
488
+ static int
489
+ Fax3FixupTags(TIFF* tif)
490
+ {
491
+ (void) tif;
492
+ return (1);
493
+ }
494
+
495
+ /*
496
+ * Setup G3/G4-related compression/decompression state
497
+ * before data is processed. This routine is called once
498
+ * per image -- it sets up different state based on whether
499
+ * or not decoding or encoding is being done and whether
500
+ * 1D- or 2D-encoded data is involved.
501
+ */
502
+ static int
503
+ Fax3SetupState(TIFF* tif)
504
+ {
505
+ static const char module[] = "Fax3SetupState";
506
+ TIFFDirectory* td = &tif->tif_dir;
507
+ Fax3BaseState* sp = Fax3State(tif);
508
+ int needsRefLine;
509
+ Fax3CodecState* dsp = (Fax3CodecState*) Fax3State(tif);
510
+ tmsize_t rowbytes;
511
+ uint32 rowpixels, nruns;
512
+
513
+ if (td->td_bitspersample != 1) {
514
+ TIFFErrorExt(tif->tif_clientdata, module,
515
+ "Bits/sample must be 1 for Group 3/4 encoding/decoding");
516
+ return (0);
517
+ }
518
+ /*
519
+ * Calculate the scanline/tile widths.
520
+ */
521
+ if (isTiled(tif)) {
522
+ rowbytes = TIFFTileRowSize(tif);
523
+ rowpixels = td->td_tilewidth;
524
+ } else {
525
+ rowbytes = TIFFScanlineSize(tif);
526
+ rowpixels = td->td_imagewidth;
527
+ }
528
+ sp->rowbytes = rowbytes;
529
+ sp->rowpixels = rowpixels;
530
+ /*
531
+ * Allocate any additional space required for decoding/encoding.
532
+ */
533
+ needsRefLine = (
534
+ (sp->groupoptions & GROUP3OPT_2DENCODING) ||
535
+ td->td_compression == COMPRESSION_CCITTFAX4
536
+ );
537
+
538
+ /*
539
+ Assure that allocation computations do not overflow.
540
+
541
+ TIFFroundup and TIFFSafeMultiply return zero on integer overflow
542
+ */
543
+ dsp->runs=(uint32*) NULL;
544
+ nruns = TIFFroundup_32(rowpixels,32);
545
+ if (needsRefLine) {
546
+ nruns = TIFFSafeMultiply(uint32,nruns,2);
547
+ }
548
+ if ((nruns == 0) || (TIFFSafeMultiply(uint32,nruns,2) == 0)) {
549
+ TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
550
+ "Row pixels integer overflow (rowpixels %u)",
551
+ rowpixels);
552
+ return (0);
553
+ }
554
+ dsp->runs = (uint32*) _TIFFCheckMalloc(tif,
555
+ TIFFSafeMultiply(uint32,nruns,2),
556
+ sizeof (uint32),
557
+ "for Group 3/4 run arrays");
558
+ if (dsp->runs == NULL)
559
+ return (0);
560
+ memset( dsp->runs, 0, TIFFSafeMultiply(uint32,nruns,2)*sizeof(uint32));
561
+ dsp->curruns = dsp->runs;
562
+ if (needsRefLine)
563
+ dsp->refruns = dsp->runs + nruns;
564
+ else
565
+ dsp->refruns = NULL;
566
+ if (td->td_compression == COMPRESSION_CCITTFAX3
567
+ && is2DEncoding(dsp)) { /* NB: default is 1D routine */
568
+ tif->tif_decoderow = Fax3Decode2D;
569
+ tif->tif_decodestrip = Fax3Decode2D;
570
+ tif->tif_decodetile = Fax3Decode2D;
571
+ }
572
+
573
+ if (needsRefLine) { /* 2d encoding */
574
+ Fax3CodecState* esp = EncoderState(tif);
575
+ /*
576
+ * 2d encoding requires a scanline
577
+ * buffer for the ``reference line''; the
578
+ * scanline against which delta encoding
579
+ * is referenced. The reference line must
580
+ * be initialized to be ``white'' (done elsewhere).
581
+ */
582
+ esp->refline = (unsigned char*) _TIFFmalloc(rowbytes);
583
+ if (esp->refline == NULL) {
584
+ TIFFErrorExt(tif->tif_clientdata, module,
585
+ "No space for Group 3/4 reference line");
586
+ return (0);
587
+ }
588
+ } else /* 1d encoding */
589
+ EncoderState(tif)->refline = NULL;
590
+
591
+ return (1);
592
+ }
593
+
594
+ /*
595
+ * CCITT Group 3 FAX Encoding.
596
+ */
597
+
598
+ #define Fax3FlushBits(tif, sp) { \
599
+ if ((tif)->tif_rawcc >= (tif)->tif_rawdatasize) \
600
+ (void) TIFFFlushData1(tif); \
601
+ *(tif)->tif_rawcp++ = (uint8) (sp)->data; \
602
+ (tif)->tif_rawcc++; \
603
+ (sp)->data = 0, (sp)->bit = 8; \
604
+ }
605
+ #define _FlushBits(tif) { \
606
+ if ((tif)->tif_rawcc >= (tif)->tif_rawdatasize) \
607
+ (void) TIFFFlushData1(tif); \
608
+ *(tif)->tif_rawcp++ = (uint8) data; \
609
+ (tif)->tif_rawcc++; \
610
+ data = 0, bit = 8; \
611
+ }
612
+ static const int _msbmask[9] =
613
+ { 0x00, 0x01, 0x03, 0x07, 0x0f, 0x1f, 0x3f, 0x7f, 0xff };
614
+ #define _PutBits(tif, bits, length) { \
615
+ while (length > bit) { \
616
+ data |= bits >> (length - bit); \
617
+ length -= bit; \
618
+ _FlushBits(tif); \
619
+ } \
620
+ assert( length < 9 ); \
621
+ data |= (bits & _msbmask[length]) << (bit - length); \
622
+ bit -= length; \
623
+ if (bit == 0) \
624
+ _FlushBits(tif); \
625
+ }
626
+
627
+ /*
628
+ * Write a variable-length bit-value to
629
+ * the output stream. Values are
630
+ * assumed to be at most 16 bits.
631
+ */
632
+ static void
633
+ Fax3PutBits(TIFF* tif, unsigned int bits, unsigned int length)
634
+ {
635
+ Fax3CodecState* sp = EncoderState(tif);
636
+ unsigned int bit = sp->bit;
637
+ int data = sp->data;
638
+
639
+ _PutBits(tif, bits, length);
640
+
641
+ sp->data = data;
642
+ sp->bit = bit;
643
+ }
644
+
645
+ /*
646
+ * Write a code to the output stream.
647
+ */
648
+ #define putcode(tif, te) Fax3PutBits(tif, (te)->code, (te)->length)
649
+
650
+ #ifdef FAX3_DEBUG
651
+ #define DEBUG_COLOR(w) (tab == TIFFFaxWhiteCodes ? w "W" : w "B")
652
+ #define DEBUG_PRINT(what,len) { \
653
+ int t; \
654
+ printf("%08X/%-2d: %s%5d\t", data, bit, DEBUG_COLOR(what), len); \
655
+ for (t = length-1; t >= 0; t--) \
656
+ putchar(code & (1<<t) ? '1' : '0'); \
657
+ putchar('\n'); \
658
+ }
659
+ #endif
660
+
661
+ /*
662
+ * Write the sequence of codes that describes
663
+ * the specified span of zero's or one's. The
664
+ * appropriate table that holds the make-up and
665
+ * terminating codes is supplied.
666
+ */
667
+ static void
668
+ putspan(TIFF* tif, int32 span, const tableentry* tab)
669
+ {
670
+ Fax3CodecState* sp = EncoderState(tif);
671
+ unsigned int bit = sp->bit;
672
+ int data = sp->data;
673
+ unsigned int code, length;
674
+
675
+ while (span >= 2624) {
676
+ const tableentry* te = &tab[63 + (2560>>6)];
677
+ code = te->code;
678
+ length = te->length;
679
+ #ifdef FAX3_DEBUG
680
+ DEBUG_PRINT("MakeUp", te->runlen);
681
+ #endif
682
+ _PutBits(tif, code, length);
683
+ span -= te->runlen;
684
+ }
685
+ if (span >= 64) {
686
+ const tableentry* te = &tab[63 + (span>>6)];
687
+ assert(te->runlen == 64*(span>>6));
688
+ code = te->code;
689
+ length = te->length;
690
+ #ifdef FAX3_DEBUG
691
+ DEBUG_PRINT("MakeUp", te->runlen);
692
+ #endif
693
+ _PutBits(tif, code, length);
694
+ span -= te->runlen;
695
+ }
696
+ code = tab[span].code;
697
+ length = tab[span].length;
698
+ #ifdef FAX3_DEBUG
699
+ DEBUG_PRINT(" Term", tab[span].runlen);
700
+ #endif
701
+ _PutBits(tif, code, length);
702
+
703
+ sp->data = data;
704
+ sp->bit = bit;
705
+ }
706
+
707
+ /*
708
+ * Write an EOL code to the output stream. The zero-fill
709
+ * logic for byte-aligning encoded scanlines is handled
710
+ * here. We also handle writing the tag bit for the next
711
+ * scanline when doing 2d encoding.
712
+ */
713
+ static void
714
+ Fax3PutEOL(TIFF* tif)
715
+ {
716
+ Fax3CodecState* sp = EncoderState(tif);
717
+ unsigned int bit = sp->bit;
718
+ int data = sp->data;
719
+ unsigned int code, length, tparm;
720
+
721
+ if (sp->b.groupoptions & GROUP3OPT_FILLBITS) {
722
+ /*
723
+ * Force bit alignment so EOL will terminate on
724
+ * a byte boundary. That is, force the bit alignment
725
+ * to 16-12 = 4 before putting out the EOL code.
726
+ */
727
+ int align = 8 - 4;
728
+ if (align != sp->bit) {
729
+ if (align > sp->bit)
730
+ align = sp->bit + (8 - align);
731
+ else
732
+ align = sp->bit - align;
733
+ tparm=align;
734
+ _PutBits(tif, 0, tparm);
735
+ }
736
+ }
737
+ code = EOL;
738
+ length = 12;
739
+ if (is2DEncoding(sp)) {
740
+ code = (code<<1) | (sp->tag == G3_1D);
741
+ length++;
742
+ }
743
+ _PutBits(tif, code, length);
744
+
745
+ sp->data = data;
746
+ sp->bit = bit;
747
+ }
748
+
749
+ /*
750
+ * Reset encoding state at the start of a strip.
751
+ */
752
+ static int
753
+ Fax3PreEncode(TIFF* tif, uint16 s)
754
+ {
755
+ Fax3CodecState* sp = EncoderState(tif);
756
+
757
+ (void) s;
758
+ assert(sp != NULL);
759
+ sp->bit = 8;
760
+ sp->data = 0;
761
+ sp->tag = G3_1D;
762
+ /*
763
+ * This is necessary for Group 4; otherwise it isn't
764
+ * needed because the first scanline of each strip ends
765
+ * up being copied into the refline.
766
+ */
767
+ if (sp->refline)
768
+ _TIFFmemset(sp->refline, 0x00, sp->b.rowbytes);
769
+ if (is2DEncoding(sp)) {
770
+ float res = tif->tif_dir.td_yresolution;
771
+ /*
772
+ * The CCITT spec says that when doing 2d encoding, you
773
+ * should only do it on K consecutive scanlines, where K
774
+ * depends on the resolution of the image being encoded
775
+ * (2 for <= 200 lpi, 4 for > 200 lpi). Since the directory
776
+ * code initializes td_yresolution to 0, this code will
777
+ * select a K of 2 unless the YResolution tag is set
778
+ * appropriately. (Note also that we fudge a little here
779
+ * and use 150 lpi to avoid problems with units conversion.)
780
+ */
781
+ if (tif->tif_dir.td_resolutionunit == RESUNIT_CENTIMETER)
782
+ res *= 2.54f; /* convert to inches */
783
+ sp->maxk = (res > 150 ? 4 : 2);
784
+ sp->k = sp->maxk-1;
785
+ } else
786
+ sp->k = sp->maxk = 0;
787
+ sp->line = 0;
788
+ return (1);
789
+ }
790
+
791
+ static const unsigned char zeroruns[256] = {
792
+ 8, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, /* 0x00 - 0x0f */
793
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 0x10 - 0x1f */
794
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 0x20 - 0x2f */
795
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 0x30 - 0x3f */
796
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x40 - 0x4f */
797
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x50 - 0x5f */
798
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x60 - 0x6f */
799
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x70 - 0x7f */
800
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x80 - 0x8f */
801
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x90 - 0x9f */
802
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xa0 - 0xaf */
803
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xb0 - 0xbf */
804
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xc0 - 0xcf */
805
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xd0 - 0xdf */
806
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xe0 - 0xef */
807
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xf0 - 0xff */
808
+ };
809
+ static const unsigned char oneruns[256] = {
810
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x00 - 0x0f */
811
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x10 - 0x1f */
812
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x20 - 0x2f */
813
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x30 - 0x3f */
814
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x40 - 0x4f */
815
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x50 - 0x5f */
816
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x60 - 0x6f */
817
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x70 - 0x7f */
818
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x80 - 0x8f */
819
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x90 - 0x9f */
820
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0xa0 - 0xaf */
821
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0xb0 - 0xbf */
822
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 0xc0 - 0xcf */
823
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 0xd0 - 0xdf */
824
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 0xe0 - 0xef */
825
+ 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 7, 8, /* 0xf0 - 0xff */
826
+ };
827
+
828
+ /*
829
+ * On certain systems it pays to inline
830
+ * the routines that find pixel spans.
831
+ */
832
+ #ifdef VAXC
833
+ static int32 find0span(unsigned char*, int32, int32);
834
+ static int32 find1span(unsigned char*, int32, int32);
835
+ #pragma inline(find0span,find1span)
836
+ #endif
837
+
838
+ /*
839
+ * Find a span of ones or zeros using the supplied
840
+ * table. The ``base'' of the bit string is supplied
841
+ * along with the start+end bit indices.
842
+ */
843
+ inline static int32
844
+ find0span(unsigned char* bp, int32 bs, int32 be)
845
+ {
846
+ int32 bits = be - bs;
847
+ int32 n, span;
848
+
849
+ bp += bs>>3;
850
+ /*
851
+ * Check partial byte on lhs.
852
+ */
853
+ if (bits > 0 && (n = (bs & 7)) != 0) {
854
+ span = zeroruns[(*bp << n) & 0xff];
855
+ if (span > 8-n) /* table value too generous */
856
+ span = 8-n;
857
+ if (span > bits) /* constrain span to bit range */
858
+ span = bits;
859
+ if (n+span < 8) /* doesn't extend to edge of byte */
860
+ return (span);
861
+ bits -= span;
862
+ bp++;
863
+ } else
864
+ span = 0;
865
+ if (bits >= (int32)(2 * 8 * sizeof(long))) {
866
+ long* lp;
867
+ /*
868
+ * Align to longword boundary and check longwords.
869
+ */
870
+ while (!isAligned(bp, long)) {
871
+ if (*bp != 0x00)
872
+ return (span + zeroruns[*bp]);
873
+ span += 8;
874
+ bits -= 8;
875
+ bp++;
876
+ }
877
+ lp = (long*) bp;
878
+ while ((bits >= (int32)(8 * sizeof(long))) && (0 == *lp)) {
879
+ span += 8*sizeof (long);
880
+ bits -= 8*sizeof (long);
881
+ lp++;
882
+ }
883
+ bp = (unsigned char*) lp;
884
+ }
885
+ /*
886
+ * Scan full bytes for all 0's.
887
+ */
888
+ while (bits >= 8) {
889
+ if (*bp != 0x00) /* end of run */
890
+ return (span + zeroruns[*bp]);
891
+ span += 8;
892
+ bits -= 8;
893
+ bp++;
894
+ }
895
+ /*
896
+ * Check partial byte on rhs.
897
+ */
898
+ if (bits > 0) {
899
+ n = zeroruns[*bp];
900
+ span += (n > bits ? bits : n);
901
+ }
902
+ return (span);
903
+ }
904
+
905
+ inline static int32
906
+ find1span(unsigned char* bp, int32 bs, int32 be)
907
+ {
908
+ int32 bits = be - bs;
909
+ int32 n, span;
910
+
911
+ bp += bs>>3;
912
+ /*
913
+ * Check partial byte on lhs.
914
+ */
915
+ if (bits > 0 && (n = (bs & 7)) != 0) {
916
+ span = oneruns[(*bp << n) & 0xff];
917
+ if (span > 8-n) /* table value too generous */
918
+ span = 8-n;
919
+ if (span > bits) /* constrain span to bit range */
920
+ span = bits;
921
+ if (n+span < 8) /* doesn't extend to edge of byte */
922
+ return (span);
923
+ bits -= span;
924
+ bp++;
925
+ } else
926
+ span = 0;
927
+ if (bits >= (int32)(2 * 8 * sizeof(long))) {
928
+ long* lp;
929
+ /*
930
+ * Align to longword boundary and check longwords.
931
+ */
932
+ while (!isAligned(bp, long)) {
933
+ if (*bp != 0xff)
934
+ return (span + oneruns[*bp]);
935
+ span += 8;
936
+ bits -= 8;
937
+ bp++;
938
+ }
939
+ lp = (long*) bp;
940
+ while ((bits >= (int32)(8 * sizeof(long))) && (~0 == *lp)) {
941
+ span += 8*sizeof (long);
942
+ bits -= 8*sizeof (long);
943
+ lp++;
944
+ }
945
+ bp = (unsigned char*) lp;
946
+ }
947
+ /*
948
+ * Scan full bytes for all 1's.
949
+ */
950
+ while (bits >= 8) {
951
+ if (*bp != 0xff) /* end of run */
952
+ return (span + oneruns[*bp]);
953
+ span += 8;
954
+ bits -= 8;
955
+ bp++;
956
+ }
957
+ /*
958
+ * Check partial byte on rhs.
959
+ */
960
+ if (bits > 0) {
961
+ n = oneruns[*bp];
962
+ span += (n > bits ? bits : n);
963
+ }
964
+ return (span);
965
+ }
966
+
967
+ /*
968
+ * Return the offset of the next bit in the range
969
+ * [bs..be] that is different from the specified
970
+ * color. The end, be, is returned if no such bit
971
+ * exists.
972
+ */
973
+ #define finddiff(_cp, _bs, _be, _color) \
974
+ (_bs + (_color ? find1span(_cp,_bs,_be) : find0span(_cp,_bs,_be)))
975
+ /*
976
+ * Like finddiff, but also check the starting bit
977
+ * against the end in case start > end.
978
+ */
979
+ #define finddiff2(_cp, _bs, _be, _color) \
980
+ (_bs < _be ? finddiff(_cp,_bs,_be,_color) : _be)
981
+
982
+ /*
983
+ * 1d-encode a row of pixels. The encoding is
984
+ * a sequence of all-white or all-black spans
985
+ * of pixels encoded with Huffman codes.
986
+ */
987
+ static int
988
+ Fax3Encode1DRow(TIFF* tif, unsigned char* bp, uint32 bits)
989
+ {
990
+ Fax3CodecState* sp = EncoderState(tif);
991
+ int32 span;
992
+ uint32 bs = 0;
993
+
994
+ for (;;) {
995
+ span = find0span(bp, bs, bits); /* white span */
996
+ putspan(tif, span, TIFFFaxWhiteCodes);
997
+ bs += span;
998
+ if (bs >= bits)
999
+ break;
1000
+ span = find1span(bp, bs, bits); /* black span */
1001
+ putspan(tif, span, TIFFFaxBlackCodes);
1002
+ bs += span;
1003
+ if (bs >= bits)
1004
+ break;
1005
+ }
1006
+ if (sp->b.mode & (FAXMODE_BYTEALIGN|FAXMODE_WORDALIGN)) {
1007
+ if (sp->bit != 8) /* byte-align */
1008
+ Fax3FlushBits(tif, sp);
1009
+ if ((sp->b.mode&FAXMODE_WORDALIGN) &&
1010
+ !isAligned(tif->tif_rawcp, uint16))
1011
+ Fax3FlushBits(tif, sp);
1012
+ }
1013
+ return (1);
1014
+ }
1015
+
1016
+ static const tableentry horizcode =
1017
+ { 3, 0x1, 0 }; /* 001 */
1018
+ static const tableentry passcode =
1019
+ { 4, 0x1, 0 }; /* 0001 */
1020
+ static const tableentry vcodes[7] = {
1021
+ { 7, 0x03, 0 }, /* 0000 011 */
1022
+ { 6, 0x03, 0 }, /* 0000 11 */
1023
+ { 3, 0x03, 0 }, /* 011 */
1024
+ { 1, 0x1, 0 }, /* 1 */
1025
+ { 3, 0x2, 0 }, /* 010 */
1026
+ { 6, 0x02, 0 }, /* 0000 10 */
1027
+ { 7, 0x02, 0 } /* 0000 010 */
1028
+ };
1029
+
1030
+ /*
1031
+ * 2d-encode a row of pixels. Consult the CCITT
1032
+ * documentation for the algorithm.
1033
+ */
1034
+ static int
1035
+ Fax3Encode2DRow(TIFF* tif, unsigned char* bp, unsigned char* rp, uint32 bits)
1036
+ {
1037
+ #define PIXEL(buf,ix) ((((buf)[(ix)>>3]) >> (7-((ix)&7))) & 1)
1038
+ uint32 a0 = 0;
1039
+ uint32 a1 = (PIXEL(bp, 0) != 0 ? 0 : finddiff(bp, 0, bits, 0));
1040
+ uint32 b1 = (PIXEL(rp, 0) != 0 ? 0 : finddiff(rp, 0, bits, 0));
1041
+ uint32 a2, b2;
1042
+
1043
+ for (;;) {
1044
+ b2 = finddiff2(rp, b1, bits, PIXEL(rp,b1));
1045
+ if (b2 >= a1) {
1046
+ /* Naive computation triggers -fsanitize=undefined,unsigned-integer-overflow */
1047
+ /* although it is correct unless the difference between both is < 31 bit */
1048
+ /* int32 d = b1 - a1; */
1049
+ int32 d = (b1 >= a1 && b1 - a1 <= 3U) ? (int32)(b1 - a1):
1050
+ (b1 < a1 && a1 - b1 <= 3U) ? -(int32)(a1 - b1) : 0x7FFFFFFF;
1051
+ if (!(-3 <= d && d <= 3)) { /* horizontal mode */
1052
+ a2 = finddiff2(bp, a1, bits, PIXEL(bp,a1));
1053
+ putcode(tif, &horizcode);
1054
+ if (a0+a1 == 0 || PIXEL(bp, a0) == 0) {
1055
+ putspan(tif, a1-a0, TIFFFaxWhiteCodes);
1056
+ putspan(tif, a2-a1, TIFFFaxBlackCodes);
1057
+ } else {
1058
+ putspan(tif, a1-a0, TIFFFaxBlackCodes);
1059
+ putspan(tif, a2-a1, TIFFFaxWhiteCodes);
1060
+ }
1061
+ a0 = a2;
1062
+ } else { /* vertical mode */
1063
+ putcode(tif, &vcodes[d+3]);
1064
+ a0 = a1;
1065
+ }
1066
+ } else { /* pass mode */
1067
+ putcode(tif, &passcode);
1068
+ a0 = b2;
1069
+ }
1070
+ if (a0 >= bits)
1071
+ break;
1072
+ a1 = finddiff(bp, a0, bits, PIXEL(bp,a0));
1073
+ b1 = finddiff(rp, a0, bits, !PIXEL(bp,a0));
1074
+ b1 = finddiff(rp, b1, bits, PIXEL(bp,a0));
1075
+ }
1076
+ return (1);
1077
+ #undef PIXEL
1078
+ }
1079
+
1080
+ /*
1081
+ * Encode a buffer of pixels.
1082
+ */
1083
+ static int
1084
+ Fax3Encode(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s)
1085
+ {
1086
+ static const char module[] = "Fax3Encode";
1087
+ Fax3CodecState* sp = EncoderState(tif);
1088
+ (void) s;
1089
+ if (cc % sp->b.rowbytes)
1090
+ {
1091
+ TIFFErrorExt(tif->tif_clientdata, module, "Fractional scanlines cannot be written");
1092
+ return (0);
1093
+ }
1094
+ while (cc > 0) {
1095
+ if ((sp->b.mode & FAXMODE_NOEOL) == 0)
1096
+ Fax3PutEOL(tif);
1097
+ if (is2DEncoding(sp)) {
1098
+ if (sp->tag == G3_1D) {
1099
+ if (!Fax3Encode1DRow(tif, bp, sp->b.rowpixels))
1100
+ return (0);
1101
+ sp->tag = G3_2D;
1102
+ } else {
1103
+ if (!Fax3Encode2DRow(tif, bp, sp->refline,
1104
+ sp->b.rowpixels))
1105
+ return (0);
1106
+ sp->k--;
1107
+ }
1108
+ if (sp->k == 0) {
1109
+ sp->tag = G3_1D;
1110
+ sp->k = sp->maxk-1;
1111
+ } else
1112
+ _TIFFmemcpy(sp->refline, bp, sp->b.rowbytes);
1113
+ } else {
1114
+ if (!Fax3Encode1DRow(tif, bp, sp->b.rowpixels))
1115
+ return (0);
1116
+ }
1117
+ bp += sp->b.rowbytes;
1118
+ cc -= sp->b.rowbytes;
1119
+ }
1120
+ return (1);
1121
+ }
1122
+
1123
+ static int
1124
+ Fax3PostEncode(TIFF* tif)
1125
+ {
1126
+ Fax3CodecState* sp = EncoderState(tif);
1127
+
1128
+ if (sp->bit != 8)
1129
+ Fax3FlushBits(tif, sp);
1130
+ return (1);
1131
+ }
1132
+
1133
+ static void
1134
+ Fax3Close(TIFF* tif)
1135
+ {
1136
+ if ((Fax3State(tif)->mode & FAXMODE_NORTC) == 0 && tif->tif_rawcp) {
1137
+ Fax3CodecState* sp = EncoderState(tif);
1138
+ unsigned int code = EOL;
1139
+ unsigned int length = 12;
1140
+ int i;
1141
+
1142
+ if (is2DEncoding(sp)) {
1143
+ code = (code<<1) | (sp->tag == G3_1D);
1144
+ length++;
1145
+ }
1146
+ for (i = 0; i < 6; i++)
1147
+ Fax3PutBits(tif, code, length);
1148
+ Fax3FlushBits(tif, sp);
1149
+ }
1150
+ }
1151
+
1152
+ static void
1153
+ Fax3Cleanup(TIFF* tif)
1154
+ {
1155
+ Fax3CodecState* sp = DecoderState(tif);
1156
+
1157
+ assert(sp != 0);
1158
+
1159
+ tif->tif_tagmethods.vgetfield = sp->b.vgetparent;
1160
+ tif->tif_tagmethods.vsetfield = sp->b.vsetparent;
1161
+ tif->tif_tagmethods.printdir = sp->b.printdir;
1162
+
1163
+ if (sp->runs)
1164
+ _TIFFfree(sp->runs);
1165
+ if (sp->refline)
1166
+ _TIFFfree(sp->refline);
1167
+
1168
+ _TIFFfree(tif->tif_data);
1169
+ tif->tif_data = NULL;
1170
+
1171
+ _TIFFSetDefaultCompressionState(tif);
1172
+ }
1173
+
1174
+ #define FIELD_BADFAXLINES (FIELD_CODEC+0)
1175
+ #define FIELD_CLEANFAXDATA (FIELD_CODEC+1)
1176
+ #define FIELD_BADFAXRUN (FIELD_CODEC+2)
1177
+
1178
+ #define FIELD_OPTIONS (FIELD_CODEC+7)
1179
+
1180
+ static const TIFFField faxFields[] = {
1181
+ { TIFFTAG_FAXMODE, 0, 0, TIFF_ANY, 0, TIFF_SETGET_INT, TIFF_SETGET_UNDEFINED, FIELD_PSEUDO, FALSE, FALSE, "FaxMode", NULL },
1182
+ { TIFFTAG_FAXFILLFUNC, 0, 0, TIFF_ANY, 0, TIFF_SETGET_OTHER, TIFF_SETGET_UNDEFINED, FIELD_PSEUDO, FALSE, FALSE, "FaxFillFunc", NULL },
1183
+ { TIFFTAG_BADFAXLINES, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, TIFF_SETGET_UINT32, FIELD_BADFAXLINES, TRUE, FALSE, "BadFaxLines", NULL },
1184
+ { TIFFTAG_CLEANFAXDATA, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UINT16, FIELD_CLEANFAXDATA, TRUE, FALSE, "CleanFaxData", NULL },
1185
+ { TIFFTAG_CONSECUTIVEBADFAXLINES, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, TIFF_SETGET_UINT32, FIELD_BADFAXRUN, TRUE, FALSE, "ConsecutiveBadFaxLines", NULL }};
1186
+ static const TIFFField fax3Fields[] = {
1187
+ { TIFFTAG_GROUP3OPTIONS, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, TIFF_SETGET_UINT32, FIELD_OPTIONS, FALSE, FALSE, "Group3Options", NULL },
1188
+ };
1189
+ static const TIFFField fax4Fields[] = {
1190
+ { TIFFTAG_GROUP4OPTIONS, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, TIFF_SETGET_UINT32, FIELD_OPTIONS, FALSE, FALSE, "Group4Options", NULL },
1191
+ };
1192
+
1193
+ static int
1194
+ Fax3VSetField(TIFF* tif, uint32 tag, va_list ap)
1195
+ {
1196
+ Fax3BaseState* sp = Fax3State(tif);
1197
+ const TIFFField* fip;
1198
+
1199
+ assert(sp != 0);
1200
+ assert(sp->vsetparent != 0);
1201
+
1202
+ switch (tag) {
1203
+ case TIFFTAG_FAXMODE:
1204
+ sp->mode = (int) va_arg(ap, int);
1205
+ return 1; /* NB: pseudo tag */
1206
+ case TIFFTAG_FAXFILLFUNC:
1207
+ DecoderState(tif)->fill = va_arg(ap, TIFFFaxFillFunc);
1208
+ return 1; /* NB: pseudo tag */
1209
+ case TIFFTAG_GROUP3OPTIONS:
1210
+ /* XXX: avoid reading options if compression mismatches. */
1211
+ if (tif->tif_dir.td_compression == COMPRESSION_CCITTFAX3)
1212
+ sp->groupoptions = (uint32) va_arg(ap, uint32);
1213
+ break;
1214
+ case TIFFTAG_GROUP4OPTIONS:
1215
+ /* XXX: avoid reading options if compression mismatches. */
1216
+ if (tif->tif_dir.td_compression == COMPRESSION_CCITTFAX4)
1217
+ sp->groupoptions = (uint32) va_arg(ap, uint32);
1218
+ break;
1219
+ case TIFFTAG_BADFAXLINES:
1220
+ sp->badfaxlines = (uint32) va_arg(ap, uint32);
1221
+ break;
1222
+ case TIFFTAG_CLEANFAXDATA:
1223
+ sp->cleanfaxdata = (uint16) va_arg(ap, uint16_vap);
1224
+ break;
1225
+ case TIFFTAG_CONSECUTIVEBADFAXLINES:
1226
+ sp->badfaxrun = (uint32) va_arg(ap, uint32);
1227
+ break;
1228
+ default:
1229
+ return (*sp->vsetparent)(tif, tag, ap);
1230
+ }
1231
+
1232
+ if ((fip = TIFFFieldWithTag(tif, tag)) != NULL)
1233
+ TIFFSetFieldBit(tif, fip->field_bit);
1234
+ else
1235
+ return 0;
1236
+
1237
+ tif->tif_flags |= TIFF_DIRTYDIRECT;
1238
+ return 1;
1239
+ }
1240
+
1241
+ static int
1242
+ Fax3VGetField(TIFF* tif, uint32 tag, va_list ap)
1243
+ {
1244
+ Fax3BaseState* sp = Fax3State(tif);
1245
+
1246
+ assert(sp != 0);
1247
+
1248
+ switch (tag) {
1249
+ case TIFFTAG_FAXMODE:
1250
+ *va_arg(ap, int*) = sp->mode;
1251
+ break;
1252
+ case TIFFTAG_FAXFILLFUNC:
1253
+ *va_arg(ap, TIFFFaxFillFunc*) = DecoderState(tif)->fill;
1254
+ break;
1255
+ case TIFFTAG_GROUP3OPTIONS:
1256
+ case TIFFTAG_GROUP4OPTIONS:
1257
+ *va_arg(ap, uint32*) = sp->groupoptions;
1258
+ break;
1259
+ case TIFFTAG_BADFAXLINES:
1260
+ *va_arg(ap, uint32*) = sp->badfaxlines;
1261
+ break;
1262
+ case TIFFTAG_CLEANFAXDATA:
1263
+ *va_arg(ap, uint16*) = sp->cleanfaxdata;
1264
+ break;
1265
+ case TIFFTAG_CONSECUTIVEBADFAXLINES:
1266
+ *va_arg(ap, uint32*) = sp->badfaxrun;
1267
+ break;
1268
+ default:
1269
+ return (*sp->vgetparent)(tif, tag, ap);
1270
+ }
1271
+ return (1);
1272
+ }
1273
+
1274
+ static void
1275
+ Fax3PrintDir(TIFF* tif, FILE* fd, long flags)
1276
+ {
1277
+ Fax3BaseState* sp = Fax3State(tif);
1278
+
1279
+ assert(sp != 0);
1280
+
1281
+ (void) flags;
1282
+ if (TIFFFieldSet(tif,FIELD_OPTIONS)) {
1283
+ const char* sep = " ";
1284
+ if (tif->tif_dir.td_compression == COMPRESSION_CCITTFAX4) {
1285
+ fprintf(fd, " Group 4 Options:");
1286
+ if (sp->groupoptions & GROUP4OPT_UNCOMPRESSED)
1287
+ fprintf(fd, "%suncompressed data", sep);
1288
+ } else {
1289
+
1290
+ fprintf(fd, " Group 3 Options:");
1291
+ if (sp->groupoptions & GROUP3OPT_2DENCODING) {
1292
+ fprintf(fd, "%s2-d encoding", sep);
1293
+ sep = "+";
1294
+ }
1295
+ if (sp->groupoptions & GROUP3OPT_FILLBITS) {
1296
+ fprintf(fd, "%sEOL padding", sep);
1297
+ sep = "+";
1298
+ }
1299
+ if (sp->groupoptions & GROUP3OPT_UNCOMPRESSED)
1300
+ fprintf(fd, "%suncompressed data", sep);
1301
+ }
1302
+ fprintf(fd, " (%lu = 0x%lx)\n",
1303
+ (unsigned long) sp->groupoptions,
1304
+ (unsigned long) sp->groupoptions);
1305
+ }
1306
+ if (TIFFFieldSet(tif,FIELD_CLEANFAXDATA)) {
1307
+ fprintf(fd, " Fax Data:");
1308
+ switch (sp->cleanfaxdata) {
1309
+ case CLEANFAXDATA_CLEAN:
1310
+ fprintf(fd, " clean");
1311
+ break;
1312
+ case CLEANFAXDATA_REGENERATED:
1313
+ fprintf(fd, " receiver regenerated");
1314
+ break;
1315
+ case CLEANFAXDATA_UNCLEAN:
1316
+ fprintf(fd, " uncorrected errors");
1317
+ break;
1318
+ }
1319
+ fprintf(fd, " (%u = 0x%x)\n",
1320
+ sp->cleanfaxdata, sp->cleanfaxdata);
1321
+ }
1322
+ if (TIFFFieldSet(tif,FIELD_BADFAXLINES))
1323
+ fprintf(fd, " Bad Fax Lines: %lu\n",
1324
+ (unsigned long) sp->badfaxlines);
1325
+ if (TIFFFieldSet(tif,FIELD_BADFAXRUN))
1326
+ fprintf(fd, " Consecutive Bad Fax Lines: %lu\n",
1327
+ (unsigned long) sp->badfaxrun);
1328
+ if (sp->printdir)
1329
+ (*sp->printdir)(tif, fd, flags);
1330
+ }
1331
+
1332
+ static int
1333
+ InitCCITTFax3(TIFF* tif)
1334
+ {
1335
+ static const char module[] = "InitCCITTFax3";
1336
+ Fax3BaseState* sp;
1337
+
1338
+ /*
1339
+ * Merge codec-specific tag information.
1340
+ */
1341
+ if (!_TIFFMergeFields(tif, faxFields, TIFFArrayCount(faxFields))) {
1342
+ TIFFErrorExt(tif->tif_clientdata, "InitCCITTFax3",
1343
+ "Merging common CCITT Fax codec-specific tags failed");
1344
+ return 0;
1345
+ }
1346
+
1347
+ /*
1348
+ * Allocate state block so tag methods have storage to record values.
1349
+ */
1350
+ tif->tif_data = (uint8*)
1351
+ _TIFFmalloc(sizeof (Fax3CodecState));
1352
+
1353
+ if (tif->tif_data == NULL) {
1354
+ TIFFErrorExt(tif->tif_clientdata, module,
1355
+ "No space for state block");
1356
+ return (0);
1357
+ }
1358
+ _TIFFmemset(tif->tif_data, 0, sizeof (Fax3CodecState));
1359
+
1360
+ sp = Fax3State(tif);
1361
+ sp->rw_mode = tif->tif_mode;
1362
+
1363
+ /*
1364
+ * Override parent get/set field methods.
1365
+ */
1366
+ sp->vgetparent = tif->tif_tagmethods.vgetfield;
1367
+ tif->tif_tagmethods.vgetfield = Fax3VGetField; /* hook for codec tags */
1368
+ sp->vsetparent = tif->tif_tagmethods.vsetfield;
1369
+ tif->tif_tagmethods.vsetfield = Fax3VSetField; /* hook for codec tags */
1370
+ sp->printdir = tif->tif_tagmethods.printdir;
1371
+ tif->tif_tagmethods.printdir = Fax3PrintDir; /* hook for codec tags */
1372
+ sp->groupoptions = 0;
1373
+
1374
+ if (sp->rw_mode == O_RDONLY) /* FIXME: improve for in place update */
1375
+ tif->tif_flags |= TIFF_NOBITREV; /* decoder does bit reversal */
1376
+ DecoderState(tif)->runs = NULL;
1377
+ TIFFSetField(tif, TIFFTAG_FAXFILLFUNC, _TIFFFax3fillruns);
1378
+ EncoderState(tif)->refline = NULL;
1379
+
1380
+ /*
1381
+ * Install codec methods.
1382
+ */
1383
+ tif->tif_fixuptags = Fax3FixupTags;
1384
+ tif->tif_setupdecode = Fax3SetupState;
1385
+ tif->tif_predecode = Fax3PreDecode;
1386
+ tif->tif_decoderow = Fax3Decode1D;
1387
+ tif->tif_decodestrip = Fax3Decode1D;
1388
+ tif->tif_decodetile = Fax3Decode1D;
1389
+ tif->tif_setupencode = Fax3SetupState;
1390
+ tif->tif_preencode = Fax3PreEncode;
1391
+ tif->tif_postencode = Fax3PostEncode;
1392
+ tif->tif_encoderow = Fax3Encode;
1393
+ tif->tif_encodestrip = Fax3Encode;
1394
+ tif->tif_encodetile = Fax3Encode;
1395
+ tif->tif_close = Fax3Close;
1396
+ tif->tif_cleanup = Fax3Cleanup;
1397
+
1398
+ return (1);
1399
+ }
1400
+
1401
+ int
1402
+ TIFFInitCCITTFax3(TIFF* tif, int scheme)
1403
+ {
1404
+ (void) scheme;
1405
+ if (InitCCITTFax3(tif)) {
1406
+ /*
1407
+ * Merge codec-specific tag information.
1408
+ */
1409
+ if (!_TIFFMergeFields(tif, fax3Fields,
1410
+ TIFFArrayCount(fax3Fields))) {
1411
+ TIFFErrorExt(tif->tif_clientdata, "TIFFInitCCITTFax3",
1412
+ "Merging CCITT Fax 3 codec-specific tags failed");
1413
+ return 0;
1414
+ }
1415
+
1416
+ /*
1417
+ * The default format is Class/F-style w/o RTC.
1418
+ */
1419
+ return TIFFSetField(tif, TIFFTAG_FAXMODE, FAXMODE_CLASSF);
1420
+ } else
1421
+ return 01;
1422
+ }
1423
+
1424
+ /*
1425
+ * CCITT Group 4 (T.6) Facsimile-compatible
1426
+ * Compression Scheme Support.
1427
+ */
1428
+
1429
+ #define SWAP(t,a,b) { t x; x = (a); (a) = (b); (b) = x; }
1430
+ /*
1431
+ * Decode the requested amount of G4-encoded data.
1432
+ */
1433
+ static int
1434
+ Fax4Decode(TIFF* tif, uint8* buf, tmsize_t occ, uint16 s)
1435
+ {
1436
+ DECLARE_STATE_2D(tif, sp, "Fax4Decode");
1437
+ (void) s;
1438
+ if (occ % sp->b.rowbytes)
1439
+ {
1440
+ TIFFErrorExt(tif->tif_clientdata, module, "Fractional scanlines cannot be read");
1441
+ return (-1);
1442
+ }
1443
+ CACHE_STATE(tif, sp);
1444
+ while (occ > 0) {
1445
+ a0 = 0;
1446
+ RunLength = 0;
1447
+ pa = thisrun = sp->curruns;
1448
+ pb = sp->refruns;
1449
+ b1 = *pb++;
1450
+ #ifdef FAX3_DEBUG
1451
+ printf("\nBitAcc=%08X, BitsAvail = %d\n", BitAcc, BitsAvail);
1452
+ printf("-------------------- %d\n", tif->tif_row);
1453
+ fflush(stdout);
1454
+ #endif
1455
+ EXPAND2D(EOFG4);
1456
+ if (EOLcnt)
1457
+ goto EOFG4;
1458
+ (*sp->fill)(buf, thisrun, pa, lastx);
1459
+ SETVALUE(0); /* imaginary change for reference */
1460
+ SWAP(uint32*, sp->curruns, sp->refruns);
1461
+ buf += sp->b.rowbytes;
1462
+ occ -= sp->b.rowbytes;
1463
+ sp->line++;
1464
+ continue;
1465
+ EOFG4:
1466
+ NeedBits16( 13, BADG4 );
1467
+ BADG4:
1468
+ #ifdef FAX3_DEBUG
1469
+ if( GetBits(13) != 0x1001 )
1470
+ fputs( "Bad EOFB\n", stderr );
1471
+ #endif
1472
+ ClrBits( 13 );
1473
+ (*sp->fill)(buf, thisrun, pa, lastx);
1474
+ UNCACHE_STATE(tif, sp);
1475
+ return ( sp->line ? 1 : -1); /* don't error on badly-terminated strips */
1476
+ }
1477
+ UNCACHE_STATE(tif, sp);
1478
+ return (1);
1479
+ }
1480
+ #undef SWAP
1481
+
1482
+ /*
1483
+ * Encode the requested amount of data.
1484
+ */
1485
+ static int
1486
+ Fax4Encode(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s)
1487
+ {
1488
+ static const char module[] = "Fax4Encode";
1489
+ Fax3CodecState *sp = EncoderState(tif);
1490
+ (void) s;
1491
+ if (cc % sp->b.rowbytes)
1492
+ {
1493
+ TIFFErrorExt(tif->tif_clientdata, module, "Fractional scanlines cannot be written");
1494
+ return (0);
1495
+ }
1496
+ while (cc > 0) {
1497
+ if (!Fax3Encode2DRow(tif, bp, sp->refline, sp->b.rowpixels))
1498
+ return (0);
1499
+ _TIFFmemcpy(sp->refline, bp, sp->b.rowbytes);
1500
+ bp += sp->b.rowbytes;
1501
+ cc -= sp->b.rowbytes;
1502
+ }
1503
+ return (1);
1504
+ }
1505
+
1506
+ static int
1507
+ Fax4PostEncode(TIFF* tif)
1508
+ {
1509
+ Fax3CodecState *sp = EncoderState(tif);
1510
+
1511
+ /* terminate strip w/ EOFB */
1512
+ Fax3PutBits(tif, EOL, 12);
1513
+ Fax3PutBits(tif, EOL, 12);
1514
+ if (sp->bit != 8)
1515
+ Fax3FlushBits(tif, sp);
1516
+ return (1);
1517
+ }
1518
+
1519
+ int
1520
+ TIFFInitCCITTFax4(TIFF* tif, int scheme)
1521
+ {
1522
+ (void) scheme;
1523
+ if (InitCCITTFax3(tif)) { /* reuse G3 support */
1524
+ /*
1525
+ * Merge codec-specific tag information.
1526
+ */
1527
+ if (!_TIFFMergeFields(tif, fax4Fields,
1528
+ TIFFArrayCount(fax4Fields))) {
1529
+ TIFFErrorExt(tif->tif_clientdata, "TIFFInitCCITTFax4",
1530
+ "Merging CCITT Fax 4 codec-specific tags failed");
1531
+ return 0;
1532
+ }
1533
+
1534
+ tif->tif_decoderow = Fax4Decode;
1535
+ tif->tif_decodestrip = Fax4Decode;
1536
+ tif->tif_decodetile = Fax4Decode;
1537
+ tif->tif_encoderow = Fax4Encode;
1538
+ tif->tif_encodestrip = Fax4Encode;
1539
+ tif->tif_encodetile = Fax4Encode;
1540
+ tif->tif_postencode = Fax4PostEncode;
1541
+ /*
1542
+ * Suppress RTC at the end of each strip.
1543
+ */
1544
+ return TIFFSetField(tif, TIFFTAG_FAXMODE, FAXMODE_NORTC);
1545
+ } else
1546
+ return (0);
1547
+ }
1548
+
1549
+ /*
1550
+ * CCITT Group 3 1-D Modified Huffman RLE Compression Support.
1551
+ * (Compression algorithms 2 and 32771)
1552
+ */
1553
+
1554
+ /*
1555
+ * Decode the requested amount of RLE-encoded data.
1556
+ */
1557
+ static int
1558
+ Fax3DecodeRLE(TIFF* tif, uint8* buf, tmsize_t occ, uint16 s)
1559
+ {
1560
+ DECLARE_STATE(tif, sp, "Fax3DecodeRLE");
1561
+ int mode = sp->b.mode;
1562
+ (void) s;
1563
+ if (occ % sp->b.rowbytes)
1564
+ {
1565
+ TIFFErrorExt(tif->tif_clientdata, module, "Fractional scanlines cannot be read");
1566
+ return (-1);
1567
+ }
1568
+ CACHE_STATE(tif, sp);
1569
+ thisrun = sp->curruns;
1570
+ while (occ > 0) {
1571
+ a0 = 0;
1572
+ RunLength = 0;
1573
+ pa = thisrun;
1574
+ #ifdef FAX3_DEBUG
1575
+ printf("\nBitAcc=%08X, BitsAvail = %d\n", BitAcc, BitsAvail);
1576
+ printf("-------------------- %d\n", tif->tif_row);
1577
+ fflush(stdout);
1578
+ #endif
1579
+ EXPAND1D(EOFRLE);
1580
+ (*sp->fill)(buf, thisrun, pa, lastx);
1581
+ /*
1582
+ * Cleanup at the end of the row.
1583
+ */
1584
+ if (mode & FAXMODE_BYTEALIGN) {
1585
+ int n = BitsAvail - (BitsAvail &~ 7);
1586
+ ClrBits(n);
1587
+ } else if (mode & FAXMODE_WORDALIGN) {
1588
+ int n = BitsAvail - (BitsAvail &~ 15);
1589
+ ClrBits(n);
1590
+ if (BitsAvail == 0 && !isAligned(cp, uint16))
1591
+ cp++;
1592
+ }
1593
+ buf += sp->b.rowbytes;
1594
+ occ -= sp->b.rowbytes;
1595
+ sp->line++;
1596
+ continue;
1597
+ EOFRLE: /* premature EOF */
1598
+ (*sp->fill)(buf, thisrun, pa, lastx);
1599
+ UNCACHE_STATE(tif, sp);
1600
+ return (-1);
1601
+ }
1602
+ UNCACHE_STATE(tif, sp);
1603
+ return (1);
1604
+ }
1605
+
1606
+ int
1607
+ TIFFInitCCITTRLE(TIFF* tif, int scheme)
1608
+ {
1609
+ (void) scheme;
1610
+ if (InitCCITTFax3(tif)) { /* reuse G3 support */
1611
+ tif->tif_decoderow = Fax3DecodeRLE;
1612
+ tif->tif_decodestrip = Fax3DecodeRLE;
1613
+ tif->tif_decodetile = Fax3DecodeRLE;
1614
+ /*
1615
+ * Suppress RTC+EOLs when encoding and byte-align data.
1616
+ */
1617
+ return TIFFSetField(tif, TIFFTAG_FAXMODE,
1618
+ FAXMODE_NORTC|FAXMODE_NOEOL|FAXMODE_BYTEALIGN);
1619
+ } else
1620
+ return (0);
1621
+ }
1622
+
1623
+ int
1624
+ TIFFInitCCITTRLEW(TIFF* tif, int scheme)
1625
+ {
1626
+ (void) scheme;
1627
+ if (InitCCITTFax3(tif)) { /* reuse G3 support */
1628
+ tif->tif_decoderow = Fax3DecodeRLE;
1629
+ tif->tif_decodestrip = Fax3DecodeRLE;
1630
+ tif->tif_decodetile = Fax3DecodeRLE;
1631
+ /*
1632
+ * Suppress RTC+EOLs when encoding and word-align data.
1633
+ */
1634
+ return TIFFSetField(tif, TIFFTAG_FAXMODE,
1635
+ FAXMODE_NORTC|FAXMODE_NOEOL|FAXMODE_WORDALIGN);
1636
+ } else
1637
+ return (0);
1638
+ }
1639
+ #endif /* CCITT_SUPPORT */
1640
+
1641
+ /* vim: set ts=8 sts=8 sw=8 noet: */
1642
+ /*
1643
+ * Local Variables:
1644
+ * mode: c
1645
+ * c-basic-offset: 8
1646
+ * fill-column: 78
1647
+ * End:
1648
+ */