Compare commits

..
9 Commits
Author SHA1 Message Date
Sam Leffler 773e971189 v3.4beta035 release 2022-06-22 19:38:01 +01:00
Sam Leffler 717c3420db v3.4beta034 release 2022-06-22 19:36:47 +01:00
Sam Leffler 901d6d6f2f v3.4beta033 release
Note: VERSION is 3.4 and original release archive is named
tiff-v3.4-tar.gz but the actual content of the archive has
the changes for v3.4beta033 and the changes fit into the
sequence between v3.4beta032 and v3.4beta034.
2022-06-22 18:38:42 +01:00
Sam Leffler c205122210 v3.4beta032 release 2022-06-22 18:38:21 +01:00
Sam Leffler 9b8fa7705c v3.4beta031 release 2022-06-22 18:37:51 +01:00
Sam Leffler 963e9c6bc0 v3.4beta029 release 2022-06-22 18:37:14 +01:00
Sam Leffler 98ce01d427 v3.4beta028 release 2022-06-22 18:36:16 +01:00
Sam Leffler 74a4ba75cb v3.4beta024 release 2022-06-22 18:34:45 +01:00
Sam Leffler 9448a913ed v3.4beta018 release 2022-06-22 18:34:33 +01:00
786 changed files with 51596 additions and 160431 deletions
-109
View File
@@ -1,109 +0,0 @@
# Operating system (build VM template)
image:
- "Visual Studio 2022"
- "Visual Studio 2019"
platform: x64
configuration:
- Release
- Debug
environment:
AV_PROJECTS: 'c:\projects'
AV_TIFF_DOWNLOAD: 'c:\projects\download'
AV_TIFF_SOURCE: 'c:\projects\libtiff'
AV_TIFF_BUILD: 'c:\projects\build'
AV_TIFF_INSTALL: 'c:\projects\install'
matrix:
- compiler: vc-cmake
- compiler: cygwin-cmake
- compiler: mingw-cmake
matrix:
exclude:
- image: "Visual Studio 2019"
compiler: cygwin-cmake
configuration: Release
- image: "Visual Studio 2019"
compiler: cygwin-cmake
configuration: Debug
- image: "Visual Studio 2019"
compiler: mingw-cmake
configuration: Release
- image: "Visual Studio 2019"
compiler: mingw-cmake
configuration: Debug
cache:
#- 'c:\projects\download -> appveyor.yml'
# Clone directory
clone_folder: 'c:\projects\libtiff'
clone_depth: 5
init:
- git config --global core.autocrlf input
before_build:
- 'if %compiler%==vc-cmake if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2022" set "generator=Visual Studio 17 2022"'
- 'if %compiler%==vc-cmake if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2019" set "generator=Visual Studio 16 2019"'
- 'if %compiler%==cygwin-cmake set "generator=Unix Makefiles"'
- 'if %compiler%==mingw-cmake set "generator=Ninja"'
- 'if %Configuration%==Release set "shared=ON"'
- 'if %Configuration%==Debug set "shared=OFF"'
- 'if %compiler%==vc-cmake if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2022" set "arch=x64"'
- 'if %compiler%==vc-cmake if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2019" set "arch=Win32"'
- 'FOR /F "tokens=* USEBACKQ" %%F IN (`C:\cygwin64\bin\cygpath -u %AV_TIFF_SOURCE%`) DO SET AV_TIFF_CYG_SOURCE=%%F'
- 'FOR /F "tokens=* USEBACKQ" %%F IN (`C:\cygwin64\bin\cygpath -u %AV_TIFF_INSTALL%`) DO SET AV_TIFF_CYG_INSTALL=%%F'
- 'if %compiler%==cygwin-cmake C:\cygwin64\setup-x86_64 -q -R C:\cygwin64 -s http://cygwin.mirror.constant.com -l %AV_TIFF_DOWNLOAD%\cygwin -g -P cmake,libjpeg-devel,zlib-devel'
- 'if %compiler%==cygwin-cmake set "PATH=C:\cygwin64\bin;%PATH%"'
- 'if %compiler%==cygwin-cmake cygpath --version || echo cygpath not found'
- 'if %compiler%==cygwin-cmake cmake --version || echo CMake not found'
- set "AV_CMAKE_ARGS=-DBUILD_SHARED_LIBS:BOOL=%shared%"
- 'if %compiler%==cygwin-cmake set "AV_CMAKE_ARGS=%AV_CMAKE_ARGS% -Dfatal-warnings=ON"'
- 'if %compiler%==mingw-cmake set "AV_CMAKE_ARGS=%AV_CMAKE_ARGS% -Dfatal-warnings=ON"'
- set "AV_TIFF_CMAKE_SOURCE=%AV_TIFF_SOURCE%"
- set "AV_TIFF_CMAKE_INSTALL=%AV_TIFF_INSTALL%"
- 'if %compiler%==cygwin-cmake set "AV_TIFF_CMAKE_SOURCE=%AV_TIFF_CYG_SOURCE%'
- 'if %compiler%==cygwin-cmake set "AV_TIFF_CMAKE_INSTALL=%AV_TIFF_CYG_INSTALL%'
- 'if %compiler%==mingw-cmake C:\msys64\usr\bin\bash -lc "pacman -Syuu --noconfirm"'
- 'if %compiler%==mingw-cmake C:\msys64\usr\bin\bash -lc "pacman -Syuu --noconfirm"'
- 'if %compiler%==mingw-cmake C:\msys64\usr\bin\bash -lc "pacman -S --needed --noconfirm mingw-w64-ucrt-x86_64-{toolchain,cmake,ninja,zlib,libjpeg-turbo}"'
- 'if %compiler%==mingw-cmake set "PATH=C:\msys64\ucrt64\bin;C:\msys64\usr\bin;%PATH%"'
- mkdir %AV_TIFF_BUILD%
- cd %AV_TIFF_BUILD%
- set
- echo Running cmake -G "%generator%" -DCMAKE_INSTALL_PREFIX=%AV_TIFF_CMAKE_INSTALL% -DCMAKE_BUILD_TYPE=%configuration% %AV_TIFF_CMAKE_SOURCE%
# Disable doc building because of 'Could not import extension sphinxcontrib.applehelp (exception: No module named 'sphinxcontrib.applehelp')'
- 'if %compiler%==cygwin-cmake bash -c "cmake -G \"%generator%\" -DCMAKE_INSTALL_PREFIX:PATH=%AV_TIFF_CMAKE_INSTALL% -DCMAKE_BUILD_TYPE=%configuration% %AV_CMAKE_ARGS% %AV_TIFF_CMAKE_SOURCE% -Dtiff-docs=off"'
- 'if %compiler%==mingw-cmake cmake -G "%generator%" -DCMAKE_INSTALL_PREFIX:PATH=%AV_TIFF_CMAKE_INSTALL% -DCMAKE_BUILD_TYPE=%configuration% %AV_CMAKE_ARGS% %AV_TIFF_CMAKE_SOURCE%'
- 'if %compiler%==vc-cmake cmake -G "%generator%" -A %arch% -DCMAKE_INSTALL_PREFIX:PATH=%AV_TIFF_CMAKE_INSTALL% -DCMAKE_BUILD_TYPE=%configuration% %AV_CMAKE_ARGS% %AV_TIFF_CMAKE_SOURCE%'
build_script:
- cd %AV_TIFF_BUILD%
- 'if %compiler%==cygwin-cmake bash -c "cmake --build . --config %configuration% --target install"'
- 'if %compiler%==mingw-cmake cmake --build . --config %configuration% --target install'
- 'if %compiler%==vc-cmake cmake --build . --config %configuration% --target install'
# scripts to run after build
after_build:
- cd %AV_TIFF_BUILD%
- '7z a %AV_TIFF_SOURCE%\libtiff-build.zip * -tzip'
- cd %AV_TIFF_INSTALL%
- '7z a %AV_TIFF_SOURCE%\libtiff.zip * -tzip'
before_test:
- cd %AV_TIFF_BUILD%
- 'if %compiler%==cygwin-cmake bash -c "ctest -V -C %configuration%"'
- 'if %compiler%==mingw-cmake ctest -V -C %configuration%'
- 'if %compiler%==vc-cmake ctest -V -C %configuration%'
# AppVeyor don't yet have a configurable retention policy, so this will
# eventually use up all the storage allowance.
#artifacts:
# - path: libtiff.zip
# name: libtiff.zip
# - path: libtiff-build.zip
# name: libtiff-build.zip
-6
View File
@@ -1,6 +0,0 @@
---
BasedOnStyle: llvm
IndentWidth: 4
ColumnLimit: 80
BreakBeforeBraces: Allman
IndentCaseLabels: true
-4
View File
@@ -1,4 +0,0 @@
42173d6ace476b5228d866640b5355f74e5a108d
b0ae5d7071890160da67d2e833d84a400e0406d0
dee020782c17c1388ca5774f9904d318b51b288b
aee0113f5ec1fd39b97458539bd79a1447425ac4
-82
View File
@@ -1,82 +0,0 @@
aclocal.m4
autom4te.cache
configure
Makefile.in
config/compile
config/config.guess
config/config.h
config/config.h.in
config/config.sub
config/depcomp
config/install-sh
config/ltmain.sh
config/missing
config/mkinstalldirs
config/test-driver
**/Makefile
*.o
*.la
*.lo
.deps
.libs
config.log
config.status
contrib/addtiffo/addtiffo
contrib/dbs/tiff-bi
contrib/dbs/tiff-grayscale
contrib/dbs/tiff-palette
contrib/dbs/tiff-rgb
contrib/iptcutil/iptcutil
libtiff-4.pc
libtiff/mkg3states
libtiff/stamp-h1
libtiff/stamp-h2
libtiff/tif_config.h
libtiff/tiffconf.h
libtool
m4/libtool.m4
m4/ltoptions.m4
m4/ltsugar.m4
m4/ltversion.m4
m4/lt~obsolete.m4
tools/fax2ps
tools/fax2tiff
tools/pal2rgb
tools/ppm2tiff
tools/raw2tiff
tools/rgb2ycbcr
tools/thumbnail
tools/tiff2bw
tools/tiff2pdf
tools/tiff2ps
tools/tiff2rgba
tools/tiffcmp
tools/tiffcp
tools/tiffcrop
tools/tiffdither
tools/tiffdump
tools/tiffgt
tools/tiffinfo
tools/tiffmedian
tools/tiffset
tools/tiffsplit
test/ascii_tag
test/custom_dir
test/long_tag
test/raw_decode
test/rewrite
test/short_tag
test/strip_rw
test/defer_strile_loading
test/defer_strile_writing
test/testtypes
test/custom_dir_EXIF_231
test/rational_precision2double
test/*.log
test/*.trs
test/o-*
*~
.idea
.vs
cmake-build*
build*
-68
View File
@@ -1,68 +0,0 @@
image: registry.gitlab.com/libtiff/libtiff-ci-ubuntu24.04:latest
stages:
- build
- static-analysis
- pages
autoconf-current:
stage: build
script:
- sh build/gitlab-ci autoconf
after_script:
- 'cat autoconf-build/test/test-suite.log'
artifacts:
name: distribution
paths:
- distribution
autoconf-old:
stage: build
image: registry.gitlab.com/libtiff/libtiff-ci-ubuntu22.04:latest
script:
- sh build/gitlab-ci autoconf-minimal
after_script:
- 'cat autoconf-build/test/test-suite.log'
cmake-makefiles-current:
stage: build
script:
- sh build/gitlab-ci cmake "Unix Makefiles" Release
cmake-makefiles-current-static:
stage: build
script:
- sh build/gitlab-ci cmake "Unix Makefiles" Release static
cmake-ninja-current:
stage: build
script:
- sh build/gitlab-ci cmake "Ninja" Debug
cmake-makefiles-old:
stage: build
image: registry.gitlab.com/libtiff/libtiff-ci-ubuntu22.04:latest
script:
- sh build/gitlab-ci cmake "Unix Makefiles" Release
coverity:
stage: static-analysis
image: registry.gitlab.com/libtiff/libtiff-ci-ubuntu24.04-coverity:latest
script:
- sh build/gitlab-ci coverity "Ninja" Debug
only:
refs:
- master
pages:
stage: pages
script:
- sh build/gitlab-ci cmake "Ninja" Debug
- cp -r cmake-install/share/doc/tiff/manual/html public
artifacts:
name: $CI_PROJECT_NAME-$CI_JOB_NAME
paths:
- public
only:
- master
-22
View File
@@ -1,22 +0,0 @@
repos:
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: 'v15.0.4'
hooks:
- id: clang-format
# tif_fax3sm.c is a generated file
# tiffvers.h as well, and its formatting is sensitive for
# FindTIFF.cmake to detect the version number
# Furthermore, the .in files are formatting sensitive for
# cmake functions.
exclude: >
(?x)^(
libtiff/tif_fax3sm.c|
libtiff/tiffvers.h|
libtiff/tiffvers.h.in|
libtiff/tif_config.h|
libtiff/tif_config.h.in|
libtiff/tif_config.h.cmake.in|
libtiff/tiffconf.h|
libtiff/tiffconf.h.in|
libtiff/tiffconf.h.cmake.in
)
-232
View File
@@ -1,232 +0,0 @@
# CMake build for libtiff
# Run "cmake" to generate the build files for your platform
#
# Copyright © 2015 Open Microscopy Environment / University of Dundee
# Copyright © 2021 Roger Leigh <rleigh@codelibre.net>
# Written by Roger Leigh <rleigh@codelibre.net>
#
# Permission to use, copy, modify, distribute, and sell this software and
# its documentation for any purpose is hereby granted without fee, provided
# that (i) the above copyright notices and this permission notice appear in
# all copies of the software and related documentation, and (ii) the names of
# Sam Leffler and Silicon Graphics may not be used in any advertising or
# publicity relating to the software without the specific, prior written
# permission of Sam Leffler and Silicon Graphics.
#
# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
#
# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
# OF THIS SOFTWARE.
cmake_minimum_required(VERSION 3.9.0)
# Default policy is from 3.9.0
cmake_policy(VERSION 3.9.0)
# Find CMake modules in cmake/
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
# Read version information from configure.ac.
include(AutotoolsVersion)
message(STATUS "Building tiff version ${LIBTIFF_VERSION_FULL}")
# Project definition
set(CMAKE_C_STANDARD 99)
project(tiff
VERSION "${LIBTIFF_VERSION}"
LANGUAGES C CXX)
if(NOT CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
# libtiff is being included as a subproject of some other project.
set(TIFF_INSTALL_DEFAULT OFF)
else()
set(TIFF_INSTALL_DEFAULT ON)
option(BUILD_SHARED_LIBS "Build shared libraries" ON)
endif()
option(tiff-tools "build TIFF tools" ON)
option(tiff-tests "build TIFF tests" ON)
option(tiff-contrib "build TIFF contrib" ON)
option(tiff-docs "build TIFF documentation" ON)
option(tiff-deprecated "build TIFF deprecated features" OFF)
option(tiff-install "install TIFF targets" ${TIFF_INSTALL_DEFAULT})
# Disable deprecated features to ensure clean build
if (tiff-deprecated)
add_definitions(-DTIFF_DISABLE_DEPRECATED)
endif()
# Autotools compatibility
include(AutotoolsCompat)
# Compiler checks (warning flags, etc.)
include(CompilerChecks)
# Linker checks (version script, etc.)
include(LinkerChecks)
# Processor checks (endianness, fill order, floating point, etc.)
include(ProcessorChecks)
# Checks for headers
include(IncludeChecks)
# Checks for functions and other symbols
include(SymbolChecks)
# Standard installation paths
include(GNUInstallDirs)
# Documentation install directory (default to cmake project docdir)
set(LIBTIFF_DOCDIR "${CMAKE_INSTALL_DOCDIR}")
# CTest testing
enable_testing()
# Checks for type presence and size
include(TypeSizeChecks)
# Check for POSIX Large File Support (LFS)
include(LargeFileSupport)
# Options for internal codec support
include(InternalCodecs)
# Check for Deflate codec
include(DeflateCodec)
# Check for PixarLog codec
include(PixarLogCodec)
# Check for JPEG codec
include(JPEGCodec)
# Check for JBIG codec
include(JBIGCodec)
# Check for LERC codec
include(LERCCodec)
# Check for LZMA codec
include(LZMACodec)
# Check for ZSTD codec
include(ZSTDCodec)
# Check for WebP codec
include(WebPCodec)
# Option for C++ libtiffxx library
include(CXXLibrary)
# Checks for OpenGL support
include(OpenGLChecks)
# Windows support
include(WindowsSupport)
# Orthogonal features
include(LibraryFeatures)
# math.h/libm portability
find_package(CMath REQUIRED)
# Release support
include(Release)
# Process subdirectories
add_subdirectory(port)
add_subdirectory(libtiff)
if(tiff-tools)
add_subdirectory(tools)
endif()
if(tiff-tests)
add_subdirectory(test)
endif()
if(tiff-contrib)
add_subdirectory(contrib)
endif()
add_subdirectory(build)
if(tiff-docs)
add_subdirectory(doc)
endif()
# pkg-config support
include(PkgConfig)
message(STATUS "")
message(STATUS "Libtiff is now configured for ${CMAKE_SYSTEM}")
message(STATUS "")
if (NOT LIBTIFF_RELEASE_VERSION STREQUAL LIBTIFF_VERSION_FULL)
message(STATUS " Libtiff release version ${LIBTIFF_RELEASE_VERSION} is not equal to build version!")
endif()
message(STATUS " Libtiff build version: ${LIBTIFF_VERSION_FULL}")
message(STATUS " Libtiff library version: ${SO_VERSION}")
message(STATUS " Libtiff release date: ${LIBTIFF_RELEASE_DATE}")
message(STATUS "")
message(STATUS " Installation directory: ${prefix}")
message(STATUS " Documentation directory: ${LIBTIFF_DOCDIR}")
message(STATUS " C compiler: ${CMAKE_C_COMPILER}")
message(STATUS " C++ compiler: ${CMAKE_CXX_COMPILER}")
message(STATUS " Build shared libraries: ${BUILD_SHARED_LIBS}")
message(STATUS " Build tools: ${tiff-tools}")
message(STATUS " Build tests: ${tiff-tests}")
message(STATUS " Build contrib: ${tiff-contrib}")
message(STATUS " Build docs: ${tiff-docs}")
message(STATUS " Build deprecated features: ${tiff-deprecated}")
message(STATUS " Enable linker symbol versioning: ${HAVE_LD_VERSION_SCRIPT}")
message(STATUS " Support Microsoft Document Imaging: ${mdi}")
message(STATUS " Use win32 IO: ${USE_WIN32_FILEIO}")
message(STATUS "")
message(STATUS " Support for internal codecs:")
message(STATUS " CCITT Group 3 & 4 algorithms: ${ccitt}")
message(STATUS " Macintosh PackBits algorithm: ${packbits}")
message(STATUS " LZW algorithm: ${lzw}")
message(STATUS " ThunderScan 4-bit RLE algorithm: ${thunder}")
message(STATUS " NeXT 2-bit RLE algorithm: ${next}")
message(STATUS " LogLuv high dynamic range encoding: ${logluv}")
message(STATUS "")
message(STATUS " Support for external codecs:")
message(STATUS " ZLIB support: Requested:${zlib} Availability:${ZLIB_FOUND} Support:${ZLIB_SUPPORT}")
if(ZLIB_SUPPORT)
message(STATUS " libdeflate support: Requested:${libdeflate} Availability:${DEFLATE_FOUND} Support:${LIBDEFLATE_SUPPORT}")
else()
message(STATUS " libdeflate support: Requested:${libdeflate} Availability:${DEFLATE_FOUND} Support:${LIBDEFLATE_SUPPORT} (Depends on ZLIB Support)")
endif()
if(ZLIB_SUPPORT)
message(STATUS " Pixar log-format algorithm: Requested:${pixarlog} Availability:${ZLIB_FOUND} Support:${PIXARLOG_SUPPORT}")
else()
message(STATUS " Pixar log-format algorithm: Requested:${pixarlog} Availability:${ZLIB_FOUND} Support:${PIXARLOG_SUPPORT} (Depends on ZLIB Support)")
endif()
message(STATUS " JPEG support: Requested:${jpeg} Availability:${JPEG_FOUND} Support:${JPEG_SUPPORT}")
if(JPEG_SUPPORT)
message(STATUS " Old JPEG support: Requested:${old-jpeg} Availability:${JPEG_SUPPORT} Support:${OJPEG_SUPPORT}")
else()
message(STATUS " Old JPEG support: Requested:${old-jpeg} Availability:${JPEG_SUPPORT} Support:${OJPEG_SUPPORT} (Depends on JPEG Support)")
endif()
if(JPEG_SUPPORT AND HAVE_JPEGTURBO_DUAL_MODE_8_12)
message(STATUS " JPEG 8/12 bit dual mode: Support: yes (libjpeg turbo >= 3.0 dual mode)")
else()
message(STATUS " JPEG 8/12 bit dual mode: Requested:${jpeg12} Availability:${JPEG12_FOUND} Support:${JPEG_DUAL_MODE_8_12}")
endif()
message(STATUS " ISO JBIG support: Requested:${jbig} Availability:${JBIG_FOUND} Support:${JBIG_SUPPORT}")
if(ZLIB_SUPPORT)
message(STATUS " LERC support: Requested:${lerc} Availability:${LERC_FOUND} Support:${LERC_SUPPORT}")
else()
message(STATUS " LERC support: Requested:${lerc} Availability:${LERC_FOUND} Support:${LERC_SUPPORT} (Depends on ZLIB Support)")
endif()
message(STATUS " LZMA2 support: Requested:${lzma} Availability:${liblzma_FOUND} Support:${LZMA_SUPPORT}")
message(STATUS " ZSTD support: Requested:${zstd} Availability:${ZSTD_USABLE} Support:${ZSTD_SUPPORT}")
message(STATUS " WEBP support: Requested:${webp} Availability:${WebP_FOUND} Support:${WEBP_SUPPORT}")
message(STATUS "")
message(STATUS " C++ support: ${cxx} (requested) ${CXX_SUPPORT} (availability)")
message(STATUS "")
# message(STATUS " X Athena Widgets support: ${HAVE_XAW}")
message(STATUS " OpenGL support: Requested:${tiff-opengl} Availability:${HAVE_OPENGL} Support:${OPENGL_SUPPORT}")
message(STATUS "")
-19
View File
@@ -1,19 +0,0 @@
Active Libtiff Committers
-------------------------
Frank Warmerdam (fwarmerdam): warmerdam@pobox.com
Andrey Kiselev (dron): dron@ak4719.spb.edu
Bob Friesenhahn (bfriesen): bfriesen@simple.dallas.tx.us
Joris Van Damme (joris): info@awaresystems.be
Lee Howard (faxguy): faxguy@howardsilvan.com
Olivier Paquet (olivier): olivier.paquet@gmail.com
Tom Lane (tgl): tgl@sss.pgh.pa.us
Even Rouault (erouault): even.rouault@spatialys.com
-19
View File
@@ -1,19 +0,0 @@
Contributing
------------
libtiff uses a ``.clang-format`` file to enforce code formatting rules.
Automatic code reformatting can be done with pre-commit.
Install (once) pre-commit with ``python -m pip install pre-commit``.
Install it (once) in the libtiff git repository with ``pre-commit install``.
Then the rules defined in the ``.pre-commit-config.yaml`` file will be
enforced at ``git commit`` time, with automatic reformatting.
Due to whole-tree code reformatting done during libtiff 4.5 development,
``git blame`` information might be misleading. To avoid that, you need
to modify your git configuration as following to ignore the revision of
the whole-tree reformatting:
``git config blame.ignoreRevsFile .git-blame-ignore-revs``.
+2 -4
View File
@@ -1,7 +1,5 @@
# LibTIFF license
Copyright © 1988-1997 Sam Leffler\
Copyright © 1991-1997 Silicon Graphics, Inc.
Copyright (c) 1988-1996 Sam Leffler
Copyright (c) 1991-1996 Silicon Graphics, Inc.
Permission to use, copy, modify, distribute, and sell this software and
its documentation for any purpose is hereby granted without fee, provided
-17406
View File
File diff suppressed because it is too large Load Diff
-155
View File
@@ -1,155 +0,0 @@
HOWTO-RELEASE:
Notes on releasing.
0. Make sure that you have current FSF releases of autoconf, automake,
and libtool packages installed under a common installation prefix
and that these tools are in your executable search path prior to
any other installed versions. Versions delivered with Linux may be
altered so it is best to install official FSF releases. GNU 'm4'
1.4.16 is needed in order to avoid bugs in m4. These packages may
be downloaded from the following ftp locations:
m4 - ftp://ftp.gnu.org/pub/gnu/m4
autoconf - ftp://ftp.gnu.org/pub/gnu/autoconf
automake - ftp://ftp.gnu.org/pub/gnu/automake
libtool - ftp://ftp.gnu.org/pub/gnu/libtool
It is recommended to install m4 before autoconf, since the later
requires the former.
Release builds should only be done on a system with a functioning
and correctly set system clock and on a filesystem which accurately
records file update times. Use of GNU make is recommended.
1. Commit any unsaved changes.
2. Use gnulib's gitlog-to-changelog script to add new (since the last
release) entries to the traditional ChangeLog file.
http://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=blob_plain;f=build-aux/gitlog-to-changelog
Take note of
the most recent change note time stamp and use that as the starting
point. Concatenate the old logs to the new logs. The added logs
may be used to help produce the release notes (in next step). For
example:
gitlog-to-changelog --since=`head -n 1 ChangeLog | sed -e 's/ .*//g'` --append-dot > ChangeLog.added
printf "\n" >> ChangeLog.added
cat ChangeLog.added ChangeLog > ChangeLog.new
mv ChangeLog.new ChangeLog
rm ChangeLog.added
3. Create doc/releases/vX.X.rst and add it to git with 'git add doc/releases/vX.X.rst'.
Update doc/releases/index.rst to point to the new file
Take ChangeLog entries and rst-ify in there.
Easist thing to do is take doc/releases/vX.(X-1).rst and use it as a template.
4. Add vX.X.rst file to the list of 'rst_sources' files in the doc/Makefile.am.
5. Update "Latest Stable Release" in doc/index.rst.
6. Increment the release version in configure.ac. Put 'alpha' or
'beta' after the version, if applicable. For example:
4.0.0
or
4.0.0beta7
Version should be updated in two places: in the second argument of the
AC_INIT macro and in LIBTIFF_xxx_VERSION variables.
7. Update library ELF versioning in configure.ac (LIBTIFF_CURRENT,
LIBTIFF_REVISION, and LIBTIFF_AGE). These numbers have nothing to
do with the libtiff release version numbers.
Note that as of libtiff 4.X, proper ELF versioning is used so
please follow the rules listed in configure.ac. At a bare minimum,
you should increment LIBTIFF_REVISION for each release so that
installed library files don't overwrite existing files. If APIs
have been added, removed, or interface structures have changed,
then more care is required.
8. Add an entry to Changelog similar to:
* libtiff 4.0.0 released.
9. In the source tree do
./autogen.sh
This step may be skipped if you have already been using a
maintainer build with current autoconf, automake, and libtool
packages. It is only needed when updating tool versions.
10. It is recommended (but not required) to build outside of the source
tree so that the source tree is kept in a pristine state. This
also allows sharing the source directory on several networked
systems. For example:
mkdir libtiff-build
cd libtiff-build
/path/to/libtiff/configure --enable-maintainer-mode
otherwise do
./configure --enable-maintainer-mode
11. In the build tree do
make release
This will update "RELEASE-DATE", "VERSION" in the source tree,
and libtiff/tiffvers.h in the build tree.
12. In the source tree, verify that the version info in RELEASE-DATE,
VERSION is right.
In the build tree, verify that the version info in
libtiff/tiffvers.h is right.
13. In the build tree do
make
make distcheck
If 'make distcheck' fails, then correct any issues until it
succeeds.
Two files with names tiff-version.tar.gz and tiff-version.zip will
be created in the top level build directory.
14. In the source tree do
'git status', 'git add .', 'git commit' and 'git push'
15. In the source tree, create a signed tag
git tag -s v4.0.0 -m "Create tag for v4.0.0"
(or the appropriate name for the release)
and push it to "origin" (if "origin" points to the official repository)
git push origin v4.0.0
16. Sign the release files in the build tree using your private key
export GPG_TTY=$(tty)
for file in tiff-*.tar.gz tiff-*.tar.xz tiff-*.zip ; do \
gpg2 --output ${file}.sig --detach-sig $file ; \
done
for file in tiff-*.tar.gz tiff-*.tar.xz tiff-*.zip ; do \
gpg2 --verify ${file}.sig $file ; \
done
17. Copy release packages from the build tree to the
ftp.remotesensing.org ftp site.
scp tiff-*.tar.gz tiff-*.tar.gz.sig tiff-*.tar.xz tiff-*.tar.xz.sig tiff-*.zip tiff-*.zip.sig \
bfriesen@upload.osgeo.org:/osgeo/download/libtiff
18. Create a gitlab release at https://gitlab.com/libtiff/libtiff/-/releases
19. Announce to list: tiff@lists.osgeo.org
-19
View File
@@ -1,19 +0,0 @@
LibTIFF Security Issue Handling
===============================
Libtiff can be a significant security risk as many tools use it to read
TIFF files which can come from hostile sources. Thus buffer overflows
and other security holes in libtiff put many users at risk. To that end
we try to deal with security problems fairly quickly and to provide advance
notice to various interested parties to role out security fixes before they
go out in a standard release.
This document is new and will presumably evolve.
1) The mailing list distros@vs.openwall.org can be used to notify folks
at various linux OS distributions as well as the BSD folks about problems
in libtiff. Make sure to prefix subject with [vs]. More info at:
http://oss-security.openwall.org/wiki/mailing-lists/distros
... to be continued ...
-94
View File
@@ -1,94 +0,0 @@
# Tag Image File Format (TIFF) Software
#
# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
#
# Permission to use, copy, modify, distribute, and sell this software and
# its documentation for any purpose is hereby granted without fee, provided
# that (i) the above copyright notices and this permission notice appear in
# all copies of the software and related documentation, and (ii) the names of
# Sam Leffler and Silicon Graphics may not be used in any advertising or
# publicity relating to the software without the specific, prior written
# permission of Sam Leffler and Silicon Graphics.
#
# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
#
# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
# OF THIS SOFTWARE.
# Process this file with automake to produce Makefile.in.
docdir = $(LIBTIFF_DOCDIR)
AUTOMAKE_OPTIONS = 1.11 dist-zip foreign
ACLOCAL_AMFLAGS = -I m4
docfiles = \
ChangeLog \
LICENSE.md \
README.md \
RELEASE-DATE \
TODO \
VERSION
EXTRA_DIST = \
placeholder.h \
cmake \
CMakeLists.txt \
HOWTO-RELEASE \
autogen.sh \
libtiff-4.pc.in
if TIFF_DOCS
dist_doc_DATA = $(docfiles)
endif
distcheck-hook:
if [ -x "$(CMAKE)" ]; then \
mkdir $(distdir)/_build/cmake \
&& cd $(distdir)/_build/cmake \
&& cmake -Dsphinx=OFF ../.. \
&& $(MAKE) \
&& ctest -V \
&& $(MAKE) DESTDIR=../../_inst/cmake install ; \
fi
rm -rf $(distdir)/_build/cmake
rm -rf $(distdir)/_inst/cmake
SUBDIRS = port libtiff tools build contrib test doc
NEW_LIBTIFF_RELEASE_DATE=$(shell date +"%Y%m%d")
release:
@(echo --- Setting release date to $(NEW_LIBTIFF_RELEASE_DATE) and release version to $(LIBTIFF_VERSION) ---)
(rm -f $(top_srcdir)/RELEASE-DATE && echo $(NEW_LIBTIFF_RELEASE_DATE) > $(top_srcdir)/RELEASE-DATE)
(rm -f $(top_srcdir)/VERSION && echo $(LIBTIFF_VERSION) > $(top_srcdir)/VERSION)
(rm -f $(top_builddir)/libtiff/tiffvers.h && sed 's,LIBTIFF_VERSION,$(LIBTIFF_VERSION),;s,LIBTIFF_RELEASE_DATE,$(NEW_LIBTIFF_RELEASE_DATE),;s,LIBTIFF_MAJOR_VERSION,$(LIBTIFF_MAJOR_VERSION),;s,LIBTIFF_MINOR_VERSION,$(LIBTIFF_MINOR_VERSION),;s,LIBTIFF_MICRO_VERSION,$(LIBTIFF_MICRO_VERSION),' $(top_srcdir)/libtiff/tiffvers.h.in > $(top_builddir)/libtiff/tiffvers.h && sed -i 's,@,,g' $(top_builddir)/libtiff/tiffvers.h)
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libtiff-4.pc
# Special rules to assist with Coverity submissions.
PACKAGE_CHANGE_DATE=`awk '/^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]/ { print substr($$1,1,4) substr($$1,6,2) substr($$1,9,2); exit; }' $(top_srcdir)/ChangeLog`
COVERITY_EMAIL=bfriesen@simple.dallas.tx.us
COVERITY_TARBALL=libtiff.xz
COVERITY_VERSION=devel-${PACKAGE_CHANGE_DATE}
COVERITY_DESCRIPTION='libtiff development'
coverity:
$(MAKE) clean
cov-build --dir cov-int $(MAKE)
tar caf $(COVERITY_TARBALL) cov-int
curl --limit-rate 50K \
--form token=`cat $$HOME/.coverity_key_tiff` \
--form email=$(COVERITY_EMAIL) \
--form file=@$(COVERITY_TARBALL) \
--form version=$(COVERITY_VERSION) \
--form description=$(COVERITY_DESCRIPTION) \
https://scan.coverity.com/builds?project=tiff
$(RM) $(COVERITY_TARBALL)
+454
View File
@@ -0,0 +1,454 @@
#! smake
# $Header: /usr/people/sam/tiff/RCS/Makefile.in,v 1.57 1996/06/10 22:24:41 sam Exp $
#
# @WARNING@
#
# Tag Image File Format Library
#
# Copyright (c) 1988-1996 Sam Leffler
# Copyright (c) 1991-1996 Silicon Graphics, Inc.
#
# Permission to use, copy, modify, distribute, and sell this software and
# its documentation for any purpose is hereby granted without fee, provided
# that (i) the above copyright notices and this permission notice appear in
# all copies of the software and related documentation, and (ii) the names of
# Sam Leffler and Silicon Graphics may not be used in any advertising or
# publicity relating to the software without the specific, prior written
# permission of Sam Leffler and Silicon Graphics.
#
# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
#
# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
# OF THIS SOFTWARE.
#
SRCDIR = @SRCDIR@
#
# VERSION: @VERSION@
# DATE: @DATE@
# TARGET: @TARGET@
# CCOMPILER: @CCOMPILER@
#
@SETMAKE@
SHELL = @SCRIPT_SH@
NULL =
ECHO = echo
GENDIST = ${TOOLROOT}/usr/sbin/gendist
INSTALL = @INSTALL@
all default:
@if [ "@PORT@" = yes ]; then \
${ECHO} "= "port; cd port; ${MAKE}; \
else \
true; \
fi
@${ECHO} "= "libtiff; cd libtiff; ${MAKE}
@${ECHO} "= "tools; cd tools; ${MAKE}
@${ECHO} "= "man; cd man; ${MAKE}
install:
@${ECHO} "= "libtiff; cd libtiff; ${MAKE} install
@${ECHO} "= "tools; cd tools; ${MAKE} install
@${ECHO} "= "man; cd man; ${MAKE} install
@if [ "@HTML@" = yes ]; then \
${ECHO} "= "html; cd html; ${MAKE} install; \
else \
true; \
fi
clean:
@if [ "@PORT@" = yes ]; then \
${ECHO} "= "port; cd port; ${MAKE} clean; \
else \
true; \
fi
@${ECHO} "= "libtiff; cd libtiff; ${MAKE} clean
@${ECHO} "= "tools; cd tools; ${MAKE} clean
@${ECHO} "= "man; cd man; ${MAKE} clean
# -cd contrib/dbs; ${MAKE} clean
# -cd contrib/dbs/xtiff; ${MAKE} clean
clobber distclean: clean
rm -f Makefile libtiff/port.h config.log
rm -f libtiff/Makefile
rm -f tools/Makefile
rm -f man/Makefile
rm -f port/Makefile port/install.sh
rm -f html/Makefile
#
# The folllowing rule creates a binary distribution for IRIX.
#
installLink::
if [ @DIR_LIB@ != /usr/lib ]; then \
${INSTALL} -idb tiff.sw.tools -F /usr/lib \
-lns @DIR_LIB@/libtiff.@DSOSUF@ -O libtiff.@DSOSUF@; \
else \
true; \
fi
product::
test -d dist || mkdir dist
rm -f dist/rawidb
SRC=`pwd` RAWIDB=`pwd`/dist/rawidb ${MAKE} install installLink
rm -f dist/idb
sort -u +4 dist/rawidb > dist/idb
${GENDIST} -v -dist dist -idb dist/idb \
-sbase `pwd` -spec ${SRCDIR}/dist/tiff.spec
#
# These rules are used to create the source distribution images
#
HOST = sgi
COMPRESS= gzip
ZIPSUF = gz
TIFFFILES=\
configure \
config.guess \
config.sub \
config.site \
Makefile.in \
README \
VERSION \
COPYRIGHT \
TODO \
dist/tiff.spec \
dist/newalpha \
dist/newversion \
libtiff/Makefile.in \
libtiff/Makefile.lcc \
libtiff/t4.h \
libtiff/tiff.h \
libtiff/tiffcomp.h \
libtiff/tiffconf.h \
libtiff/tiffio.h \
libtiff/tiffiop.h \
libtiff/mkg3states.c \
libtiff/mkspans.c \
libtiff/mkversion.c \
libtiff/tif_acorn.c \
libtiff/tif_apple.c \
libtiff/tif_atari.c \
libtiff/tif_aux.c \
libtiff/tif_close.c \
libtiff/tif_codec.c \
libtiff/tif_compress.c \
libtiff/tif_dir.h \
libtiff/tif_dir.c \
libtiff/tif_dirinfo.c \
libtiff/tif_dirread.c \
libtiff/tif_dirwrite.c \
libtiff/tif_dumpmode.c \
libtiff/tif_error.c \
libtiff/tif_fax3.c \
libtiff/tif_fax3.h \
libtiff/tif_flush.c \
libtiff/tif_getimage.c \
libtiff/tif_jpeg.c \
libtiff/tif_lzw.c \
libtiff/tif_msdos.c \
libtiff/tif_next.c \
libtiff/tif_open.c \
libtiff/tif_packbits.c \
libtiff/tif_pixarlog.c \
libtiff/tif_predict.h \
libtiff/tif_predict.c \
libtiff/tif_print.c \
libtiff/tif_read.c \
libtiff/tif_strip.c \
libtiff/tif_swab.c \
libtiff/tif_thunder.c \
libtiff/tif_tile.c \
libtiff/tif_unix.c \
libtiff/tif_version.c \
libtiff/tif_vms.c \
libtiff/tif_warning.c \
libtiff/tif_win3.c \
libtiff/tif_win32.c \
libtiff/tif_write.c \
libtiff/tif_zip.c \
port/Makefile.in \
port/getopt.c \
port/install.sh.in \
port/irix/so_locations \
port/strcasecmp.c \
port/strtoul.c \
tools/Makefile.in \
tools/Makefile.lcc \
tools/fax2tiff.c \
tools/fax2ps.c \
tools/gif2tiff.c \
tools/pal2rgb.c \
tools/ppm2tiff.c \
tools/ras2tiff.c \
tools/rasterfile.h \
tools/rgb2ycbcr.c \
tools/sgi2tiff.c \
tools/sgigt.c \
tools/sgisv.c \
tools/thumbnail.c \
tools/tiff2bw.c \
tools/tiff2ps.c \
tools/tiffcmp.c \
tools/tiffcp.c \
tools/tiffdither.c \
tools/tiffdump.c \
tools/tiffinfo.c \
tools/tiffmedian.c \
tools/tiffsplit.c \
tools/ycbcr.c \
man/Makefile.in \
man/fax2tiff.1 \
man/fax2ps.1 \
man/gif2tiff.1 \
man/pal2rgb.1 \
man/ppm2tiff.1 \
man/ras2tiff.1 \
man/rgb2ycbcr.1 \
man/sgi2tiff.1 \
man/thumbnail.1 \
man/tiff2bw.1 \
man/tiff2ps.1 \
man/tiffcmp.1 \
man/tiffcp.1 \
man/tiffdither.1 \
man/tiffdump.1 \
man/tiffgt.1 \
man/tiffinfo.1 \
man/tiffmedian.1 \
man/tiffsplit.1 \
man/tiffsv.1 \
man/TIFFClose.3t \
man/TIFFError.3t \
man/TIFFFlush.3t \
man/TIFFGetField.3t \
man/TIFFOpen.3t \
man/TIFFPrintDirectory.3t \
man/TIFFReadDirectory.3t \
man/TIFFReadEncodedStrip.3t \
man/TIFFReadEncodedTile.3t \
man/TIFFReadRGBAImage.3t \
man/TIFFReadRawStrip.3t \
man/TIFFReadRawTile.3t \
man/TIFFReadScanline.3t \
man/TIFFReadTile.3t \
man/TIFFRGBAImage.3t \
man/TIFFSetDirectory.3t \
man/TIFFSetField.3t \
man/TIFFWarning.3t \
man/TIFFWriteDirectory.3t \
man/TIFFWriteEncodedStrip.3t \
man/TIFFWriteEncodedTile.3t \
man/TIFFWriteRawStrip.3t \
man/TIFFWriteRawTile.3t \
man/TIFFWriteScanline.3t \
man/libtiff.3t \
man/TIFFbuffer.3t \
man/TIFFcodec.3t \
man/TIFFmemory.3t \
man/TIFFquery.3t \
man/TIFFsize.3t \
man/TIFFstrip.3t \
man/TIFFswab.3t \
man/TIFFtile.3t \
html/Makefile.in \
html/bugs.html \
html/build.html \
html/contrib.html \
html/document.html \
html/images.html \
html/index.html \
html/internals.html \
html/intro.html \
html/libtiff.html \
html/misc.html \
html/support.html \
html/tools.html \
html/v3.4beta034.html \
html/v3.4beta033.html \
html/v3.4beta032.html \
html/v3.4beta031.html \
html/v3.4beta029.html \
html/v3.4beta028.html \
html/v3.4beta024.html \
html/v3.4beta018.html \
html/v3.4beta016.html \
html/v3.4beta007.html \
${NULL}
OTHERFILES=\
html/images/back.gif \
html/images/bali.jpg \
html/images/cat.gif \
html/images/cover.jpg \
html/images/cramps.gif \
html/images/dave.gif \
html/images/info.gif \
html/images/jello.jpg \
html/images/jim.gif \
html/images/note.gif \
html/images/oxford.gif \
html/images/quad.jpg \
html/images/ring.gif \
html/images/smallliz.jpg \
html/images/strike.gif \
html/images/warning.gif \
${NULL}
CONTRIBFILES=\
contrib/dbs/README \
contrib/dbs/Imakefile \
contrib/dbs/tiff-bi.c \
contrib/dbs/tiff-grayscale.c \
contrib/dbs/tiff-palette.c \
contrib/dbs/tiff-rgb.c \
contrib/dbs/xtiff/README \
contrib/dbs/xtiff/Imakefile \
contrib/dbs/xtiff/patchlevel.h \
contrib/dbs/xtiff/xtiff.c \
contrib/dbs/xtiff/xtifficon.h \
contrib/ras/ras2tif.c \
contrib/ras/tif2ras.c \
contrib/vms/libtiff/makevms.com \
contrib/vms/libtiff/tiff.opt \
contrib/vms/libtiff/tiffshraxp.opt \
contrib/vms/libtiff/tiffshrvax.opt \
contrib/vms/libtiff/tiffvec.mar \
contrib/vms/tools/makevms.com \
contrib/tags \
contrib/mac-mpw \
contrib/acorn \
contrib/win32 \
contrib/win95 \
contrib/winnt \
contrib/mac-cw \
contrib/dosdjgpp \
${NULL}
DISTFILES=\
${TIFFFILES} \
dist/tiff.alpha \
dist/tiff.version \
${OTHERFILES} \
${CONTRIBFILES} \
${NULL}
CONFIG=\
-with-CC=cc \
-with-GCOPTS=" " \
-with-JPEG=yes \
-with-DIR_JPEG=../src/jpeg-5a \
-with-ZIP=yes \
-with-DIR_LIBGZ=../src/zlib \
${NULL}
rcsclean:
rcsclean ${TIFFFILES} && co ${TIFFFILES}
alpha:
(cd ${SRCDIR}/dist; sh newversion)
-${MAKE} clean
${MAKE} alpha.stamp
${SRCDIR}/configure ${CONFIG}
${MAKE} product
${MAKE} alpha.tar
# stamp relevant files according to current alpha
alpha.stamp:
VERSION="Alpha@DIST_ALPHA@"; \
NOW=`date`; \
for i in ${TIFFFILES}; do \
REV=`rlog -h -d"$$NOW" ${SRCDIR}/$$i|fgrep 'head:'|awk '{print $$2}'`;\
rcs "-N$$VERSION:$$REV" "-sExp:$$REV" ${SRCDIR}/$$i && co -sExp ${SRCDIR}/$$i; \
done
purge-old-alphas:
VERSIONS=`awk 'BEGIN { \
for (i=1; i<=@DIST_ALPHA@; i++) printf " -nAlpha%03d",i;\
exit \
}'`; \
for i in ${TIFFFILES}; do \
echo rcs $$VERSIONS ${SRCDIR}/$$i; \
rcs $$VERSIONS ${SRCDIR}/$$i && co ${SRCDIR}/$$i; \
done
alphadiff:
-@for i in ${TIFFFILES}; do \
rcsdiff -r${ALPHA} ${SRCDIR}/$$i; \
done
# create alpha distribution archive
alpha.tar:
VERSION="@VERSION@"; \
rm -f tiff-$$VERSION $$VERSION $$VERSION-tar; \
ln -s ${SRCDIR} tiff-$$VERSION; \
(for i in ${DISTFILES}; do \
echo $$i; \
done) | sed "s;.*;tiff-$$VERSION/&;" >$$VERSION; \
tar cvf $$VERSION-tar `cat $$VERSION`; \
rm -f tiff-$$VERSION-tar.${ZIPSUF}; \
cat $$VERSION-tar | ${COMPRESS} >tiff-$$VERSION-tar.${ZIPSUF}; \
rm -f tiff-$$VERSION $$VERSION $$VERSION-tar;
release:
(cd ${SRCDIR}/dist; sh newversion)
-${MAKE} clean
${MAKE} release.stamp
${SRCDIR}/configure ${CONFIG}
${MAKE} product
${MAKE} release.tar
release.stamp:
NOW=`date`; \
for i in ${TIFFFILES}; do \
REV=`rlog -h -d"$$NOW" ${SRCDIR}/$$i|fgrep 'head:'|awk '{print $$2}'`;\
rcs "-NRelease@DIST_MAJOR@_@DIST_MINOR@_@DIST_TYPE@:$$REV" "-sRel:$$REV" ${SRCDIR}/$$i && co -sRel ${SRCDIR}/$$i; \
done
# create release distribution archive
release.tar:
VERSION="@VERSION@"; \
rm -f tiff-$$VERSION $$VERSION $$VERSION-tar; \
ln -s ${SRCDIR} tiff-$$VERSION; \
(for i in ${DISTFILES}; do \
echo $$i; \
done) | sed "s;.*;tiff-$$VERSION/&;" >$$VERSION; \
tar cvf $$VERSION-tar `cat $$VERSION`; \
rm -f tiff-$$VERSION-tar.${ZIPSUF}; \
cat $$VERSION-tar | ${COMPRESS} >tiff-$$VERSION-tar.${ZIPSUF}; \
rm -f tiff-$$VERSION $$VERSION $$VERSION-tar;
#
# Create a package of the test images.
#
PICS=\
pics/README \
pics/cramps.tif \
pics/cramps-tile.tif \
pics/fax2d.tif \
pics/g3test.tif \
pics/jello.tif \
pics/jim___cg.tif \
pics/jim___dg.tif \
pics/jim___gg.tif \
pics/jim___ah.tif \
pics/strike.tif \
pics/oxford.tif \
pics/quad-lzw.tif \
pics/quad-tile.tif \
pics/text.tif \
pics/ycbcr-cat.tif \
pics/smallliz.tif \
pics/zackthecat.tif \
pics/fax2d.g3 \
pics/g3test.g3 \
${NULL}
pics.tar:
tar cvf - ${PICS} | ${COMPRESS} > tiffpics.tar.${ZIPSUF}
+16 -25
View File
@@ -1,15 +1,17 @@
$Header: /usr/people/sam/tiff/RCS/README,v 1.27 1996/01/10 19:31:42 sam Exp $
TIFF Software Distribution
--------------------------
This file is just a placeholder; the entire documentation is now located
as reStructuredText in the doc directory. To view the documentation
as HTML, visit https://libtiff.gitlab.io/libtiff/ or
http://www.simplesystems.org/libtiff/ or within the release package
in the doc/html-prebuilt directory. The manual pages are
located at doc/man-prebuilt.
This file is just a placeholder; all the documentation is now in
HTML in the html directory. To view the documentation point your
favorite WWW viewer at html/index.html; e.g.
The release package can be downloaded at
netscape html/index.html
http://download.osgeo.org/libtiff/
If you don't have an HTML viewer then you can read the HTML source
or fetch a PostScript version of this documentation from the directory
ftp://ftp.sgi.com/graphics/tiff/doc
If you can't hack either of these options then basically what you
want to do is:
@@ -19,26 +21,15 @@ want to do is:
% su
# make install
More information, email contacts, and mailing list information can be
found online at http://www.simplesystems.org/libtiff/
If that doesn't do what you want, or something isn't clear then
sorry, but you're SOL.
Source code repository
----------------------
Sam Leffler (sam@engr.sgi.com)
[GitLab](https://gitlab.com/libtiff/libtiff)
Bug database
------------
[GitLab issues](https://gitlab.com/libtiff/libtiff/issues)
Previously, the project used
[Bugzilla](http://bugzilla.maptools.org/buglist.cgi?product=libtiff). This
is no longer in use, and all remaining issues have been migrated to GitLab.
Use and Copyright
-----------------
Silicon Graphics has seen fit to allow us to give this work away. It
Silicon Graphics has seen fit to allow me to give this work away. It
is free. There is no support or guarantee of any sort as to its
operations, correctness, or whatever. If you do anything useful with
all or parts of it you need to honor the copyright notices. I would
@@ -46,8 +37,8 @@ also be interested in knowing about it and, hopefully, be acknowledged.
The legal way of saying that is:
Copyright (c) 1988-1997 Sam Leffler
Copyright (c) 1991-1997 Silicon Graphics, Inc.
Copyright (c) 1988-1996 Sam Leffler
Copyright (c) 1991-1996 Silicon Graphics, Inc.
Permission to use, copy, modify, distribute, and sell this software and
its documentation for any purpose is hereby granted without fee, provided
-1
View File
@@ -1 +0,0 @@
20240911
+2 -5
View File
@@ -1,10 +1,7 @@
o gif2tiff segaulting on selected images
# $Header: /usr/people/sam/tiff/RCS/TODO,v 1.4 1996/02/09 22:09:00 sam Exp $
o tiffcmp read data by strip/tile instead of scanline
o YCbCr sampling support
o extracate colorspace conversion support
o look at isolating all codecs from TIFF library
o JPEG colormode order dependency problem
o Write documentation on how do extend tags, and how the custom field
stuff all works.
+1 -1
View File
@@ -1 +1 @@
4.7.0
3.4beta
-121
View File
@@ -1,121 +0,0 @@
<!-- Creator : groff version 1.18.1 -->
<!-- CreationDate: Sun Mar 6 13:59:56 2005 -->
<html>
<head>
<meta name="generator" content="groff -Thtml, see www.gnu.org">
<meta name="Content-Style" content="text/css">
<title>BMP2TIFF</title>
</head>
<body>
<h1 align=center>BMP2TIFF</h1>
<a href="#NAME">NAME</a><br>
<a href="#SYNOPSIS">SYNOPSIS</a><br>
<a href="#DESCRIPTION">DESCRIPTION</a><br>
<a href="#OPTIONS">OPTIONS</a><br>
<a href="#SEE ALSO">SEE ALSO</a><br>
<hr>
<a name="NAME"></a>
<h2>NAME</h2>
<!-- INDENTATION -->
<table width="100%" border=0 rules="none" frame="void"
cols="2" cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="8%"></td>
<td width="91%">
<p>bmp2tiff &minus; create a <small>TIFF</small> file from a
Microsoft Windows Device Independent Bitmap image file</p>
</td>
</table>
<a name="SYNOPSIS"></a>
<h2>SYNOPSIS</h2>
<!-- INDENTATION -->
<table width="100%" border=0 rules="none" frame="void"
cols="2" cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="8%"></td>
<td width="91%">
<p><b>bmp2tiff</b> [ <i>options</i> ] <i>input.bmp
output.tiff</i></p>
</td>
</table>
<a name="DESCRIPTION"></a>
<h2>DESCRIPTION</h2>
<!-- INDENTATION -->
<table width="100%" border=0 rules="none" frame="void"
cols="2" cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="8%"></td>
<td width="91%">
<p><i>bmp2tiff</i> converts a Microsoft Windows Device
Independent Bitmap image file to <small>TIFF.</small> By
default, the <small>TIFF</small> image is created with data
samples packed (<i>PlanarConfiguration</i>=1), compressed
with the PackBits algorithm
(<i>Compression</i>=<i>32773),</i> and with each strip no
more than 8 kilobytes. These characteristics can overridden,
or explicitly specified with the options described
below.</p>
</td>
</table>
<a name="OPTIONS"></a>
<h2>OPTIONS</h2>
<!-- TABS -->
<table width="100%" border=0 rules="none" frame="void"
cols="5" cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="11%"></td>
<td width="2%">
<p><b>&minus;c</b></p>
</td>
<td width="5%"></td>
<td width="80%">
<p>Specify a compression scheme to use when writing image
data: <b>&minus;c none</b> for no compression, <b>-c
packbits</b> for the PackBits compression algorithm (the
default), <b>-c jpeg</b> for the baseline JPEG compression
algorithm, <b>-c zip</b> for the Deflate compression
algorithm, and <b>&minus;c lzw</b> for Lempel-Ziv &amp;
Welch.</p>
</td>
<td width="0%">
</td>
</table>
<!-- INDENTATION -->
<table width="100%" border=0 rules="none" frame="void"
cols="2" cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="8%"></td>
<td width="91%">
<p><b>&minus;r &lt;number&gt;</b></p></td>
</table>
<!-- INDENTATION -->
<table width="100%" border=0 rules="none" frame="void"
cols="2" cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="19%"></td>
<td width="80%">
<p>Write data with a specified number of rows per strip; by
default the number of rows/strip is selected so that each
strip is approximately 8 kilobytes.</p>
</td>
</table>
<a name="SEE ALSO"></a>
<h2>SEE ALSO</h2>
<!-- INDENTATION -->
<table width="100%" border=0 rules="none" frame="void"
cols="2" cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="8%"></td>
<td width="91%">
<p><i>gif2tiff</i>(1), <i>pal2rgb</i>(1),
<i>ppm2tiff</i>(1), <i>raw2tiff</i>(1), <i>ras2tiff</i>(1),
<i>sgi2tiff</i>(1), <i>libtiff</i>(3TIFF)</p>
</td>
</table>
<hr>
</body>
</html>
-141
View File
@@ -1,141 +0,0 @@
<!-- Creator : groff version 1.18.1 -->
<!-- CreationDate: Sat Feb 24 18:37:19 2007 -->
<html>
<head>
<meta name="generator" content="groff -Thtml, see www.gnu.org">
<meta name="Content-Style" content="text/css">
<title>GIF2TIFF</title>
</head>
<body>
<h1 align=center>GIF2TIFF</h1>
<a href="#NAME">NAME</a><br>
<a href="#SYNOPSIS">SYNOPSIS</a><br>
<a href="#DESCRIPTION">DESCRIPTION</a><br>
<a href="#OPTIONS">OPTIONS</a><br>
<a href="#NOTES">NOTES</a><br>
<a href="#BUGS">BUGS</a><br>
<a href="#SEE ALSO">SEE ALSO</a><br>
<hr>
<a name="NAME"></a>
<h2>NAME</h2>
<!-- INDENTATION -->
<table width="100%" border=0 rules="none" frame="void"
cols="2" cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="8%"></td>
<td width="91%">
<p>gif2tiff &minus; create a <small>TIFF</small> file from a
GIF87 format image file</p>
</td>
</table>
<a name="SYNOPSIS"></a>
<h2>SYNOPSIS</h2>
<!-- INDENTATION -->
<table width="100%" border=0 rules="none" frame="void"
cols="2" cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="8%"></td>
<td width="91%">
<p><b>gif2tiff</b> [ <i>options</i> ] <i>input.gif
output.tif</i></p>
</td>
</table>
<a name="DESCRIPTION"></a>
<h2>DESCRIPTION</h2>
<!-- INDENTATION -->
<table width="100%" border=0 rules="none" frame="void"
cols="2" cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="8%"></td>
<td width="91%">
<p><i>Gif2tiff</i> converts a file in the GIF87 format to
<small>TIFF.</small> The <small>TIFF</small> image is
created as a palette image, with samples compressed with the
Lempel-Ziv &amp; Welch algorithm (<i>Compression</i>=5).
These characteristics can overridden, or explicitly
specified with the options described below.</p>
</td>
</table>
<a name="OPTIONS"></a>
<h2>OPTIONS</h2>
<!-- TABS -->
<table width="100%" border=0 rules="none" frame="void"
cols="5" cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="10%"></td>
<td width="3%">
<p><b>&minus;c</b></p>
</td>
<td width="5%"></td>
<td width="80%">
<p>Specify a compression scheme to use when writing image
data: <b>&minus;c none</b> for no compression, <b>&minus;c
packbits</b> for the PackBits compression algorithm,
<b>&minus;c zip</b> for the Deflate compression algorithm,
and <b>&minus;c lzw</b> for Lempel-Ziv &amp; Welch (the
default).</p>
</td>
<td width="0%">
</td>
<tr valign="top" align="left">
<td width="10%"></td>
<td width="3%">
<p><b>&minus;r</b></p>
</td>
<td width="5%"></td>
<td width="80%">
<p>Write data with a specified number of rows per strip; by
default the number of rows/strip is selected so that each
strip is approximately 8 kilobytes.</p>
</td>
<td width="0%">
</td>
</table>
<a name="NOTES"></a>
<h2>NOTES</h2>
<!-- INDENTATION -->
<table width="100%" border=0 rules="none" frame="void"
cols="2" cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="8%"></td>
<td width="91%">
<p>The program is based on Paul Haeberli&rsquo;s
<i>fromgif</i> program which, in turn, is based on Marcel
J.E. Mol&rsquo;s GIF reader.</p>
</td>
</table>
<a name="BUGS"></a>
<h2>BUGS</h2>
<!-- INDENTATION -->
<table width="100%" border=0 rules="none" frame="void"
cols="2" cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="8%"></td>
<td width="91%">
<p>Should have more options to control output format.</p>
</td>
</table>
<a name="SEE ALSO"></a>
<h2>SEE ALSO</h2>
<!-- INDENTATION -->
<table width="100%" border=0 rules="none" frame="void"
cols="2" cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="8%"></td>
<td width="91%">
<p><b>pal2rgb</b>(1), <b>tiffinfo</b>(1), <b>tiffcp</b>(1),
<b>tiffmedian</b>(1), <b>libtiff</b>(3)</p>
<!-- INDENTATION -->
<p>Libtiff library home page:
<b>http://www.remotesensing.org/libtiff/</b></p>
</td>
</table>
<hr>
</body>
</html>
-139
View File
@@ -1,139 +0,0 @@
<!-- Creator : groff version 1.18.1 -->
<!-- CreationDate: Sat Feb 24 18:37:19 2007 -->
<html>
<head>
<meta name="generator" content="groff -Thtml, see www.gnu.org">
<meta name="Content-Style" content="text/css">
<title>RAS2TIFF</title>
</head>
<body>
<h1 align=center>RAS2TIFF</h1>
<a href="#NAME">NAME</a><br>
<a href="#SYNOPSIS">SYNOPSIS</a><br>
<a href="#DESCRIPTION">DESCRIPTION</a><br>
<a href="#OPTIONS">OPTIONS</a><br>
<a href="#BUGS">BUGS</a><br>
<a href="#SEE ALSO">SEE ALSO</a><br>
<hr>
<a name="NAME"></a>
<h2>NAME</h2>
<!-- INDENTATION -->
<table width="100%" border=0 rules="none" frame="void"
cols="2" cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="8%"></td>
<td width="91%">
<p>ras2tiff &minus; create a <small>TIFF</small> file from a
Sun rasterfile</p>
</td>
</table>
<a name="SYNOPSIS"></a>
<h2>SYNOPSIS</h2>
<!-- INDENTATION -->
<table width="100%" border=0 rules="none" frame="void"
cols="2" cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="8%"></td>
<td width="91%">
<p><b>ras2tiff</b> [ <i>options</i> ] <i>input.ras
output.tif</i></p>
</td>
</table>
<a name="DESCRIPTION"></a>
<h2>DESCRIPTION</h2>
<!-- INDENTATION -->
<table width="100%" border=0 rules="none" frame="void"
cols="2" cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="8%"></td>
<td width="91%">
<p><i>ras2tiff</i> converts a file in the Sun rasterfile
format to <small>TIFF.</small> By default, the
<small>TIFF</small> image is created with data samples
packed (<i>PlanarConfiguration</i>=1), compressed with the
Lempel-Ziv &amp; Welch algorithm (<i>Compression</i>=5), and
with each strip no more than 8 kilobytes. These
characteristics can overridden, or explicitly specified with
the options described below.</p>
<!-- INDENTATION -->
<p>Any colormap information in the rasterfile is carried
over to the <small>TIFF</small> file by including a
<i>Colormap</i> tag in the output file. If the rasterfile
has a colormap, the <i>PhotometricInterpretation</i> tag is
set to 3 (palette); otherwise it is set to 2 (RGB) if the
depth is 24 or 1 (min-is-black) if the depth is not 24.</p>
</td>
</table>
<a name="OPTIONS"></a>
<h2>OPTIONS</h2>
<!-- TABS -->
<table width="100%" border=0 rules="none" frame="void"
cols="5" cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="10%"></td>
<td width="2%">
<p><b>&minus;c</b></p>
</td>
<td width="6%"></td>
<td width="80%">
<p>Specify a compression scheme to use when writing image
data: <b>&minus;c none</b> for no compression, <b>&minus;c
packbits</b> for the PackBits compression algorithm,
<b>&minus;c jpeg</b> for the baseline JPEG compression
algorithm, <b>&minus;c zip</b> for the Deflate compression
algorithm, and <b>&minus;c lzw</b> for Lempel-Ziv &amp;
Welch (the default).</p>
</td>
<td width="0%">
</td>
<tr valign="top" align="left">
<td width="10%"></td>
<td width="2%">
<p><b>&minus;r</b></p>
</td>
<td width="6%"></td>
<td width="80%">
<p>Write data with a specified number of rows per strip; by
default the number of rows/strip is selected so that each
strip is approximately 8 kilobytes.</p>
</td>
<td width="0%">
</td>
</table>
<a name="BUGS"></a>
<h2>BUGS</h2>
<!-- INDENTATION -->
<table width="100%" border=0 rules="none" frame="void"
cols="2" cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="8%"></td>
<td width="91%">
<p>Does not handle all possible rasterfiles. In particular,
<i>ras2tiff</i> does not handle run-length encoded
images.</p>
</td>
</table>
<a name="SEE ALSO"></a>
<h2>SEE ALSO</h2>
<!-- INDENTATION -->
<table width="100%" border=0 rules="none" frame="void"
cols="2" cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="8%"></td>
<td width="91%">
<p><b>pal2rgb</b>(1), <b>tiffinfo</b>(1), <b>tiffcp</b>(1),
<b>tiffmedian</b>(1), <b>libtiff</b>(3)</p>
<!-- INDENTATION -->
<p>Libtiff library home page:
<b>http://www.remotesensing.org/libtiff/</b></p>
</td>
</table>
<hr>
</body>
</html>
-147
View File
@@ -1,147 +0,0 @@
<!-- Creator : groff version 1.18.1 -->
<!-- CreationDate: Sat Feb 24 18:37:19 2007 -->
<html>
<head>
<meta name="generator" content="groff -Thtml, see www.gnu.org">
<meta name="Content-Style" content="text/css">
<title>SGI2TIFF</title>
</head>
<body>
<h1 align=center>SGI2TIFF</h1>
<a href="#NAME">NAME</a><br>
<a href="#SYNOPSIS">SYNOPSIS</a><br>
<a href="#DESCRIPTION">DESCRIPTION</a><br>
<a href="#OPTIONS">OPTIONS</a><br>
<a href="#BUGS">BUGS</a><br>
<a href="#SEE ALSO">SEE ALSO</a><br>
<hr>
<a name="NAME"></a>
<h2>NAME</h2>
<!-- INDENTATION -->
<table width="100%" border=0 rules="none" frame="void"
cols="2" cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="8%"></td>
<td width="91%">
<p>sgi2tiff &minus; create a <small>TIFF</small> file from
an <small>SGI</small> image file</p>
</td>
</table>
<a name="SYNOPSIS"></a>
<h2>SYNOPSIS</h2>
<!-- INDENTATION -->
<table width="100%" border=0 rules="none" frame="void"
cols="2" cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="8%"></td>
<td width="91%">
<p><b>sgi2tiff</b> [ <i>options</i> ] <i>input.rgb
output.tif</i></p>
</td>
</table>
<a name="DESCRIPTION"></a>
<h2>DESCRIPTION</h2>
<!-- INDENTATION -->
<table width="100%" border=0 rules="none" frame="void"
cols="2" cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="8%"></td>
<td width="91%">
<p><i>sgi2tiff</i> converts a file in the <small>SGI</small>
image format to <small>TIFF.</small> By default, the
<small>TIFF</small> image is created with data samples
packed (<i>PlanarConfiguration</i>=1), compressed with the
Lempel-Ziv &amp; Welch algorithm (<i>Compression</i>=5), and
with each strip no more than 8 kilobytes. These
characteristics can overridden, or explicitly specified with
the options described below.</p>
</td>
</table>
<a name="OPTIONS"></a>
<h2>OPTIONS</h2>
<!-- TABS -->
<table width="100%" border=0 rules="none" frame="void"
cols="5" cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="10%"></td>
<td width="3%">
<p><b>&minus;c</b></p>
</td>
<td width="5%"></td>
<td width="80%">
<p>Specify a compression scheme to use when writing image
data: <b>&minus;c none</b> for no compression, <b>&minus;c
packbits</b> for the PackBits compression algorithm),
<b>&minus;c jpeg</b> for the baseline JPEG compression
algorithm, <b>&minus;c zip</b> for the Deflate compression
algorithm, and <b>&minus;c lzw</b> for Lempel-Ziv &amp;
Welch (the default).</p>
</td>
<td width="0%">
</td>
<tr valign="top" align="left">
<td width="10%"></td>
<td width="3%">
<p><b>&minus;p</b></p>
</td>
<td width="5%"></td>
<td width="80%">
<p>Explicitly select the planar configuration used in
organizing data samples in the output image: <b>&minus;p
contig</b> for samples packed contiguously, and <b>&minus;p
separate</b> for samples stored separately. By default
samples are packed.</p>
</td>
<td width="0%">
</td>
<tr valign="top" align="left">
<td width="10%"></td>
<td width="3%">
<p><b>&minus;r</b></p>
</td>
<td width="5%"></td>
<td width="80%">
<p>Write data with a specified number of rows per strip; by
default the number of rows/strip is selected so that each
strip is approximately 8 kilobytes.</p>
</td>
<td width="0%">
</td>
</table>
<a name="BUGS"></a>
<h2>BUGS</h2>
<!-- INDENTATION -->
<table width="100%" border=0 rules="none" frame="void"
cols="2" cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="8%"></td>
<td width="91%">
<p>Does not record colormap information.</p>
</td>
</table>
<a name="SEE ALSO"></a>
<h2>SEE ALSO</h2>
<!-- INDENTATION -->
<table width="100%" border=0 rules="none" frame="void"
cols="2" cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="8%"></td>
<td width="91%">
<p><b>tiffinfo</b>(1), <b>tiffcp</b>(1),
<b>tiffmedian</b>(1), <b>libtiff</b>(3)</p>
<!-- INDENTATION -->
<p>Libtiff library home page:
<b>http://www.remotesensing.org/libtiff/</b></p>
</td>
</table>
<hr>
</body>
</html>
-207
View File
@@ -1,207 +0,0 @@
<!-- Creator : groff version 1.18.1 -->
<!-- CreationDate: Sat Feb 24 18:37:20 2007 -->
<html>
<head>
<meta name="generator" content="groff -Thtml, see www.gnu.org">
<meta name="Content-Style" content="text/css">
<title>TIFFSV</title>
</head>
<body>
<h1 align=center>TIFFSV</h1>
<a href="#NAME">NAME</a><br>
<a href="#SYNOPSIS">SYNOPSIS</a><br>
<a href="#DESCRIPTION">DESCRIPTION</a><br>
<a href="#OPTIONS">OPTIONS</a><br>
<a href="#NOTE">NOTE</a><br>
<a href="#BUGS">BUGS</a><br>
<a href="#SEE ALSO">SEE ALSO</a><br>
<hr>
<a name="NAME"></a>
<h2>NAME</h2>
<!-- INDENTATION -->
<table width="100%" border=0 rules="none" frame="void"
cols="2" cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="8%"></td>
<td width="91%">
<p>tiffsv &minus; save an image from the framebuffer in a
<small>TIFF</small> file (Silicon Graphics version)</p>
</td>
</table>
<a name="SYNOPSIS"></a>
<h2>SYNOPSIS</h2>
<!-- INDENTATION -->
<table width="100%" border=0 rules="none" frame="void"
cols="2" cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="8%"></td>
<td width="91%">
<p><b>tiffsv</b> [ <i>options</i> ] <i>output.tif</i> [
<i>x1 x2 y1 y2</i> ]</p>
</td>
</table>
<a name="DESCRIPTION"></a>
<h2>DESCRIPTION</h2>
<!-- INDENTATION -->
<table width="100%" border=0 rules="none" frame="void"
cols="2" cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="8%"></td>
<td width="91%">
<p><i>tiffsv</i> saves all or part of the framebuffer in a
file using the Tag Image File Format, Revision 6.0. By
default, the image is saved with data samples packed
(<i>PlanarConfiguration</i>=1), compressed with the
Lempel-Ziv &amp; Welch algorithm (<i>Compression</i>=5), and
with each strip no more than 8 kilobytes. These
characteristics can be overridden, or explicitly specified
with the options described below.</p>
</td>
</table>
<a name="OPTIONS"></a>
<h2>OPTIONS</h2>
<!-- TABS -->
<table width="100%" border=0 rules="none" frame="void"
cols="5" cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="10%"></td>
<td width="3%">
<p><b>&minus;b</b></p>
</td>
<td width="5%"></td>
<td width="80%">
<p>Save the image as a greyscale image as if it were
processed by <i>tiff2bw</i>(1). This option is included for
compatibility with the standard <i>scrsave</i>(6D)
program.</p>
</td>
<td width="0%">
</td>
<tr valign="top" align="left">
<td width="10%"></td>
<td width="3%">
<p><b>&minus;c</b></p>
</td>
<td width="5%"></td>
<td width="80%">
<p>Specify the compression to use for data written to the
output file: <b>none</b> for no compression, <b>packbits</b>
for PackBits compression, <b>jpeg</b> for baseline JPEG
compression, <b>zip</b> for Deflate compression, and
<b>lzw</b> for Lempel-Ziv &amp; Welch compression
(default).</p>
</td>
<td width="0%">
</td>
</table>
<!-- INDENTATION -->
<table width="100%" border=0 rules="none" frame="void"
cols="2" cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="17%"></td>
<td width="82%">
<p><small>LZW</small> compression can be specified together
with a <i>predictor</i> value. A predictor value of 2 causes
each scanline of the output image to undergo horizontal
differencing before it is encoded; a value of 1 forces each
scanline to be encoded without differencing. LZW-specific
options are specified by appending a
&lsquo;&lsquo;:&rsquo;&rsquo;-separated list to the
&lsquo;&lsquo;lzw&rsquo;&rsquo; option; e.g. <b>&minus;c
lzw:2</b> for <small>LZW</small> compression with horizontal
differencing.</p>
</td>
</table>
<!-- TABS -->
<table width="100%" border=0 rules="none" frame="void"
cols="5" cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="10%"></td>
<td width="3%">
<p><b>&minus;p</b></p>
</td>
<td width="5%"></td>
<td width="80%">
<p>Specify the planar configuration to use in writing image
data. By default, <i>tiffsv</i> will create a new file with
the data samples packed contiguously. Specifying <b>&minus;p
contig</b> will force data to be written with multi-sample
data packed together, while <b>&minus;p separate</b> will
force samples to be written in separate planes.</p>
</td>
<td width="0%">
</td>
<tr valign="top" align="left">
<td width="10%"></td>
<td width="3%">
<p><b>&minus;r</b></p>
</td>
<td width="5%"></td>
<td width="80%">
<p>Specify the number of rows (scanlines) in each strip of
data written to the output file. By default, <i>tiffsv</i>
attempts to set the rows/strip that no more than 8 kilobytes
of data appear in a strip.</p>
</td>
<td width="0%">
</td>
</table>
<a name="NOTE"></a>
<h2>NOTE</h2>
<!-- INDENTATION -->
<table width="100%" border=0 rules="none" frame="void"
cols="2" cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="8%"></td>
<td width="91%">
<p>Except for the use of <small>TIFF,</small> this program
is equivalent to the standard <i>scrsave</i> program. This
means, for example, that you can use it in conjunction with
the standard <i>icut</i> program simply by creating a link
called <i>scrsave</i>, or by creating a shell script called
<i>scrsave</i> that invokes <i>tiffgt</i> with the
appropriate options.</p>
</td>
</table>
<a name="BUGS"></a>
<h2>BUGS</h2>
<!-- INDENTATION -->
<table width="100%" border=0 rules="none" frame="void"
cols="2" cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="8%"></td>
<td width="91%">
<p>If data are saved compressed and in separate planes, then
the rows in each strip is silently set to one to avoid
limitations in the <b>libtiff</b>(3TIFF) library.</p>
</td>
</table>
<a name="SEE ALSO"></a>
<h2>SEE ALSO</h2>
<!-- INDENTATION -->
<table width="100%" border=0 rules="none" frame="void"
cols="2" cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="8%"></td>
<td width="91%">
<p><b>scrsave</b>(6D) <b>pal2rgb</b>(1), <b>tiffdump</b>(1),
<b>tiffgt</b>(1), <b>tiffinfo</b>(1), <b>tiffcp</b>(1),
<b>tiffmedian</b>(1), <b>libtiff</b>(3TIFF)</p>
<!-- INDENTATION -->
<p>Libtiff library home page:
<b>http://www.remotesensing.org/libtiff/</b></p>
</td>
</table>
<hr>
</body>
</html>
File diff suppressed because it is too large Load Diff
-632
View File
@@ -1,632 +0,0 @@
/*
* Copyright (c) 1990-1997 Sam Leffler
* Copyright (c) 1991-1997 Silicon Graphics, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and
* its documentation for any purpose is hereby granted without fee, provided
* that (i) the above copyright notices and this permission notice appear in
* all copies of the software and related documentation, and (ii) the names of
* Sam Leffler and Silicon Graphics may not be used in any advertising or
* publicity relating to the software without the specific, prior written
* permission of Sam Leffler and Silicon Graphics.
*
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
*
* IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*/
/*
* convert a GIF file into a TIFF file.
* based on Paul Haeberli's fromgif program which in turn is
* based on a GIF file reader by Marcel J.E. Mol March 23 1989
*
* if input is 320 by 200 pixel aspect is probably 1.2
* if input is 640 350 pixel aspect is probably 1.37
*
*/
#include "tif_config.h"
#include <errno.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef NEED_LIBPORT
#include "libport.h"
#endif
#include "tiffio.h"
#define GIFGAMMA (1.5) /* smaller makes output img brighter */
#define IMAX 0xffff /* max intensity value */
#define EXTRAFUDGE 128 /* some people write BAD .gif files */
#define streq(a, b) (strcmp(a, b) == 0)
#define strneq(a, b, n) (strncmp(a, b, n) == 0)
unsigned short gamtab[256];
void makegamtab(float gam)
{
int i;
for (i = 0; i < 256; i++)
gamtab[i] = (unsigned short)(IMAX * pow(i / 255.0, gam) + 0.5);
}
char *stuff[] = {
"usage: gif2tiff [options] input.gif output.tif",
"where options are:",
" -r # make each strip have no more than # rows",
"",
" -c lzw[:opts] compress output with Lempel-Ziv & Welch encoding",
" -c zip[:opts] compress output with deflate encoding",
" -c packbits compress output with packbits encoding",
" -c none use no compression algorithm on output",
"",
"LZW and deflate options:",
" # set predictor value",
"For example, -c lzw:2 to get LZW-encoded data with horizontal "
"differencing",
NULL};
static void usage(void)
{
char buf[BUFSIZ];
int i;
setbuf(stderr, buf);
fprintf(stderr, "%s\n\n", TIFFGetVersion());
for (i = 0; stuff[i] != NULL; i++)
fprintf(stderr, "%s\n", stuff[i]);
exit(-1);
}
#define COLSIZE 256
unsigned char *stackp;
unsigned int prefix[4096];
unsigned char suffix[4096];
unsigned char stack[4096];
int datasize, codesize, codemask; /* Decoder working variables */
int clear, eoi; /* Special code values */
int avail, oldcode;
FILE *infile;
int global; /* Is there a global color map? */
int globalbits; /* Number of bits of global colors */
unsigned char globalmap[COLSIZE][3]; /* RGB values for global color map */
unsigned char *raster; /* Decoded image data */
unsigned long width, height;
unsigned short red[COLSIZE];
unsigned short green[COLSIZE];
unsigned short blue[COLSIZE];
char *filename, *imagename;
static uint16_t compression = COMPRESSION_PACKBITS;
static uint16_t predictor = 0;
static uint32_t rowsperstrip = (uint32_t)-1;
static int processCompressOptions(char *);
int convert(void);
int checksignature(void);
int readscreen(void);
int readgifimage(char *);
int readextension(void);
int readraster(void);
int process(int, unsigned char **);
void initcolors(unsigned char[COLSIZE][3], int);
void rasterize(int, char *);
int main(int argc, char *argv[])
{
#if !HAVE_DECL_OPTARG
extern int optind;
extern char *optarg;
#endif
int c, status;
while ((c = getopt(argc, argv, "c:r:")) != -1)
switch (c)
{
case 'c': /* compression scheme */
if (!processCompressOptions(optarg))
usage();
break;
case 'r': /* rows/strip */
rowsperstrip = atoi(optarg);
break;
case '?':
usage();
/*NOTREACHED*/
}
if (argc - optind != 2)
usage();
makegamtab(GIFGAMMA);
filename = argv[optind];
imagename = argv[optind + 1];
if ((infile = fopen(imagename, "rb")) != NULL)
{
int c;
fclose(infile);
printf("overwrite %s? ", imagename);
fflush(stdout);
c = getc(stdin);
if (c != 'y' && c != 'Y')
return (1);
}
if ((infile = fopen(filename, "rb")) == NULL)
{
perror(filename);
return (1);
}
status = convert();
fclose(infile);
return (status);
}
static int processCompressOptions(char *opt)
{
if (streq(opt, "none"))
compression = COMPRESSION_NONE;
else if (streq(opt, "packbits"))
compression = COMPRESSION_PACKBITS;
else if (strneq(opt, "lzw", 3))
{
char *cp = strchr(opt, ':');
if (cp)
predictor = atoi(cp + 1);
compression = COMPRESSION_LZW;
}
else if (strneq(opt, "zip", 3))
{
char *cp = strchr(opt, ':');
if (cp)
predictor = atoi(cp + 1);
compression = COMPRESSION_ADOBE_DEFLATE;
}
else
return (0);
return (1);
}
int convert(void)
{
int ch;
char *mode = "w";
if (!checksignature())
return (-1);
if (!readscreen())
return (-1);
while ((ch = getc(infile)) != ';' && ch != EOF)
{
switch (ch)
{
case '\0':
break; /* this kludge for non-standard files */
case ',':
if (!readgifimage(mode))
return (-1);
mode = "a"; /* subsequent images append */
break;
case '!':
if (!readextension())
return (-1);
break;
default:
fprintf(stderr, "illegal GIF block type\n");
return (-1);
}
}
return (0);
}
int checksignature(void)
{
char buf[6];
if (fread(buf, 1, 6, infile) != 6)
{
fprintf(stderr, "short read from file %s (%s)\n", filename,
strerror(errno));
return 0;
}
if (strncmp(buf, "GIF", 3))
{
fprintf(stderr, "file is not a GIF file\n");
return 0;
}
if (strncmp(&buf[3], "87a", 3))
{
fprintf(stderr, "unknown GIF version number\n");
return 0;
}
return 1;
}
/*
* readscreen -
* Get information which is global to all the images stored
* in the file
*/
int readscreen(void)
{
unsigned char buf[7];
if (fread(buf, 1, 7, infile) != 7)
{
fprintf(stderr, "short read from file %s (%s)\n", filename,
strerror(errno));
return 0;
}
global = buf[4] & 0x80;
if (global)
{
globalbits = (buf[4] & 0x07) + 1;
if (fread(globalmap, 3, ((size_t)1) << globalbits, infile) !=
((size_t)1) << globalbits)
{
fprintf(stderr, "short read from file %s (%s)\n", filename,
strerror(errno));
return 0;
}
}
return 1;
}
int readgifimage(char *mode)
{
unsigned char buf[9];
int local, interleaved;
unsigned char localmap[256][3];
int localbits;
int status;
size_t raster_size;
if (fread(buf, 1, 9, infile) != 9)
{
fprintf(stderr, "short read from file %s (%s)\n", filename,
strerror(errno));
return (0);
}
width = (buf[4] + (buf[5] << 8)) & 0xffff; /* 16 bit */
height = (buf[6] + (buf[7] << 8)) & 0xffff; /* 16 bit */
local = buf[8] & 0x80;
interleaved = buf[8] & 0x40;
if (width == 0UL || height == 0UL || (width > 2000000000UL / height))
{
fprintf(stderr, "Invalid value of width or height\n");
return (0);
}
if (local == 0 && global == 0)
{
fprintf(stderr, "no colormap present for image\n");
return (0);
}
raster_size = width * height;
if ((raster_size / width) == height)
{
raster_size += EXTRAFUDGE; /* Add elbow room */
}
else
{
raster_size = 0;
}
if ((raster = (unsigned char *)_TIFFmalloc(raster_size)) == NULL)
{
fprintf(stderr, "not enough memory for image\n");
return (0);
}
if (local)
{
localbits = (buf[8] & 0x7) + 1;
fprintf(stderr, " local colors: %d\n", 1 << localbits);
if (fread(localmap, 3, ((size_t)1) << localbits, infile) !=
((size_t)1) << localbits)
{
fprintf(stderr, "short read from file %s (%s)\n", filename,
strerror(errno));
return (0);
}
initcolors(localmap, 1 << localbits);
}
else if (global)
{
initcolors(globalmap, 1 << globalbits);
}
if ((status = readraster()))
rasterize(interleaved, mode);
_TIFFfree(raster);
return status;
}
/*
* readextension -
* Read a GIF extension block (and do nothing with it).
*
*/
int readextension(void)
{
int count;
char buf[255];
int status = 1;
(void)getc(infile);
while ((count = getc(infile)) && count <= 255)
if (fread(buf, 1, count, infile) != (size_t)count)
{
fprintf(stderr, "short read from file %s (%s)\n", filename,
strerror(errno));
status = 0;
break;
}
return status;
}
/*
* readraster -
* Decode a raster image
*
*/
int readraster(void)
{
unsigned char *fill = raster;
unsigned char buf[255];
register int bits = 0;
register unsigned long datum = 0;
register unsigned char *ch;
register int count, code;
int status = 1;
datasize = getc(infile);
if (datasize > 12)
return 0;
clear = 1 << datasize;
eoi = clear + 1;
avail = clear + 2;
oldcode = -1;
codesize = datasize + 1;
codemask = (1 << codesize) - 1;
for (code = 0; code < clear; code++)
{
prefix[code] = 0;
suffix[code] = code;
}
stackp = stack;
for (count = getc(infile); count > 0 && count <= 255; count = getc(infile))
{
if (fread(buf, 1, count, infile) != (size_t)count)
{
fprintf(stderr, "short read from file %s (%s)\n", filename,
strerror(errno));
return 0;
}
for (ch = buf; count-- > 0; ch++)
{
datum += (unsigned long)*ch << bits;
bits += 8;
while (bits >= codesize)
{
code = datum & codemask;
datum >>= codesize;
bits -= codesize;
if (code == eoi)
{ /* This kludge put in */
goto exitloop; /* because some GIF files*/
} /* aren't standard */
if (!process(code, &fill))
{
status = 0;
goto exitloop;
}
}
}
if (fill >= raster + width * height)
{
fprintf(stderr, "raster full before eoi code\n");
break;
}
}
exitloop:
if (fill != raster + width * height)
{
fprintf(stderr, "warning: wrong rastersize: %ld bytes\n",
(long)(fill - raster));
fprintf(stderr, " instead of %ld bytes\n",
(long)width * height);
}
return status;
}
/*
* process -
* Process a compression code. "clear" resets the code table.
* Otherwise make a new code table entry, and output the bytes
* associated with the code.
*/
int process(register int code, unsigned char **fill)
{
int incode;
static unsigned char firstchar;
if (code == clear)
{
codesize = datasize + 1;
codemask = (1 << codesize) - 1;
avail = clear + 2;
oldcode = -1;
return 1;
}
if (oldcode == -1)
{
if (code >= clear)
{
fprintf(stderr, "bad input: code=%d is larger than clear=%d\n",
code, clear);
return 0;
}
if (*fill >= raster + width * height)
{
fprintf(stderr, "raster full before eoi code\n");
return 0;
}
*(*fill)++ = suffix[code];
firstchar = oldcode = code;
return 1;
}
if (code > avail)
{
fprintf(stderr, "code %d too large for %d\n", code, avail);
return 0;
}
incode = code;
if (code == avail)
{ /* the first code is always < avail */
*stackp++ = firstchar;
code = oldcode;
}
while (code > clear)
{
*stackp++ = suffix[code];
code = prefix[code];
}
*stackp++ = firstchar = suffix[code];
prefix[avail] = oldcode;
suffix[avail] = firstchar;
avail++;
if (((avail & codemask) == 0) && (avail < 4096))
{
codesize++;
codemask += avail;
}
oldcode = incode;
do
{
if (*fill >= raster + width * height)
{
fprintf(stderr, "raster full before eoi code\n");
return 0;
}
*(*fill)++ = *--stackp;
} while (stackp > stack);
return 1;
}
/*
* initcolors -
* Convert a color map (local or global) to arrays with R, G and B
* values.
*
*/
void initcolors(unsigned char colormap[COLSIZE][3], int ncolors)
{
register int i;
for (i = 0; i < ncolors; i++)
{
red[i] = gamtab[colormap[i][0]];
green[i] = gamtab[colormap[i][1]];
blue[i] = gamtab[colormap[i][2]];
}
}
void rasterize(int interleaved, char *mode)
{
register unsigned long row;
unsigned char *newras;
unsigned char *ras;
TIFF *tif;
tstrip_t strip;
tsize_t stripsize;
if ((newras = (unsigned char *)_TIFFmalloc(width * height + EXTRAFUDGE)) ==
NULL)
{
fprintf(stderr, "not enough memory for image\n");
return;
}
#define DRAWSEGMENT(offset, step) \
{ \
for (row = offset; row < height; row += step) \
{ \
_TIFFmemcpy(newras + row * width, ras, width); \
ras += width; \
} \
}
ras = raster;
if (interleaved)
{
DRAWSEGMENT(0, 8);
DRAWSEGMENT(4, 8);
DRAWSEGMENT(2, 4);
DRAWSEGMENT(1, 2);
}
else
DRAWSEGMENT(0, 1);
#undef DRAWSEGMENT
tif = TIFFOpen(imagename, mode);
if (!tif)
{
TIFFError(imagename, "Can not open output image");
exit(-1);
}
TIFFSetField(tif, TIFFTAG_IMAGEWIDTH, (uint32_t)width);
TIFFSetField(tif, TIFFTAG_IMAGELENGTH, (uint32_t)height);
TIFFSetField(tif, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_PALETTE);
TIFFSetField(tif, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
TIFFSetField(tif, TIFFTAG_SAMPLESPERPIXEL, 1);
TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, 8);
TIFFSetField(tif, TIFFTAG_ROWSPERSTRIP,
rowsperstrip = TIFFDefaultStripSize(tif, rowsperstrip));
TIFFSetField(tif, TIFFTAG_COMPRESSION, compression);
switch (compression)
{
case COMPRESSION_LZW:
case COMPRESSION_ADOBE_DEFLATE:
case COMPRESSION_DEFLATE:
if (predictor != 0)
TIFFSetField(tif, TIFFTAG_PREDICTOR, predictor);
break;
}
TIFFSetField(tif, TIFFTAG_COLORMAP, red, green, blue);
TIFFSetField(tif, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT);
strip = 0;
stripsize = TIFFStripSize(tif);
for (row = 0; row < height; row += rowsperstrip)
{
if (rowsperstrip > height - row)
{
rowsperstrip = height - row;
stripsize = TIFFVStripSize(tif, rowsperstrip);
}
if (TIFFWriteEncodedStrip(tif, strip, newras + row * width, stripsize) <
0)
break;
strip++;
}
TIFFClose(tif);
_TIFFfree(newras);
}
-367
View File
@@ -1,367 +0,0 @@
/*
* Copyright (c) 1988-1997 Sam Leffler
* Copyright (c) 1991-1997 Silicon Graphics, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and
* its documentation for any purpose is hereby granted without fee, provided
* that (i) the above copyright notices and this permission notice appear in
* all copies of the software and related documentation, and (ii) the names of
* Sam Leffler and Silicon Graphics may not be used in any advertising or
* publicity relating to the software without the specific, prior written
* permission of Sam Leffler and Silicon Graphics.
*
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
*
* IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*/
#include "tif_config.h"
#include <ctype.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef NEED_LIBPORT
#include "libport.h"
#endif
#include "rasterfile.h"
#include "tiffio.h"
#ifndef howmany
#define howmany(x, y) (((x) + ((y)-1)) / (y))
#endif
#define streq(a, b) (strcmp(a, b) == 0)
#define strneq(a, b, n) (strncmp(a, b, n) == 0)
static uint16_t compression = (uint16_t)-1;
static int jpegcolormode = JPEGCOLORMODE_RGB;
static int quality = 75; /* JPEG quality */
static uint16_t predictor = 0;
static void usage(void);
static int processCompressOptions(char *);
int main(int argc, char *argv[])
{
unsigned char *buf;
long row;
tsize_t linebytes, scanline;
TIFF *out;
FILE *in;
struct rasterfile h;
uint16_t photometric;
uint16_t config = PLANARCONFIG_CONTIG;
uint32_t rowsperstrip = (uint32_t)-1;
int c;
#if !HAVE_DECL_OPTARG
extern int optind;
extern char *optarg;
#endif
while ((c = getopt(argc, argv, "c:r:h")) != -1)
switch (c)
{
case 'c': /* compression scheme */
if (!processCompressOptions(optarg))
usage();
break;
case 'r': /* rows/strip */
rowsperstrip = atoi(optarg);
break;
case 'h':
usage();
/*NOTREACHED*/
}
if (argc - optind != 2)
usage();
in = fopen(argv[optind], "rb");
if (in == NULL)
{
fprintf(stderr, "%s: Can not open.\n", argv[optind]);
return (-1);
}
if (fread(&h, sizeof(h), 1, in) != 1)
{
fprintf(stderr, "%s: Can not read header.\n", argv[optind]);
fclose(in);
return (-2);
}
if (strcmp(h.ras_magic, RAS_MAGIC) == 0)
{
#ifndef WORDS_BIGENDIAN
TIFFSwabLong((uint32_t *)&h.ras_width);
TIFFSwabLong((uint32_t *)&h.ras_height);
TIFFSwabLong((uint32_t *)&h.ras_depth);
TIFFSwabLong((uint32_t *)&h.ras_length);
TIFFSwabLong((uint32_t *)&h.ras_type);
TIFFSwabLong((uint32_t *)&h.ras_maptype);
TIFFSwabLong((uint32_t *)&h.ras_maplength);
#endif
}
else if (strcmp(h.ras_magic, RAS_MAGIC_INV) == 0)
{
#ifdef WORDS_BIGENDIAN
TIFFSwabLong((uint32_t *)&h.ras_width);
TIFFSwabLong((uint32_t *)&h.ras_height);
TIFFSwabLong((uint32_t *)&h.ras_depth);
TIFFSwabLong((uint32_t *)&h.ras_length);
TIFFSwabLong((uint32_t *)&h.ras_type);
TIFFSwabLong((uint32_t *)&h.ras_maptype);
TIFFSwabLong((uint32_t *)&h.ras_maplength);
#endif
}
else
{
fprintf(stderr, "%s: Not a rasterfile.\n", argv[optind]);
fclose(in);
return (-3);
}
if ((h.ras_width <= 0) || (h.ras_width >= INT_MAX) || (h.ras_height <= 0) ||
(h.ras_height >= INT_MAX) || (h.ras_depth <= 0) ||
(h.ras_depth >= INT_MAX) || (h.ras_length <= 0) ||
(h.ras_length >= INT_MAX) || (h.ras_type <= 0) ||
(h.ras_maptype <= 0) || (h.ras_maplength <= 0) ||
(h.ras_maplength >= INT_MAX))
{
fprintf(stderr, "%s: Improper image header.\n", argv[optind]);
fclose(in);
return (-2);
}
if ((h.ras_depth != 1) && (h.ras_depth != 8) && (h.ras_depth != 24))
{
fprintf(stderr, "%s: Improper image depth (%d).\n", argv[optind],
h.ras_depth);
fclose(in);
return (-2);
}
out = TIFFOpen(argv[optind + 1], "w");
if (out == NULL)
{
fclose(in);
return (-4);
}
TIFFSetField(out, TIFFTAG_IMAGEWIDTH, (uint32_t)h.ras_width);
TIFFSetField(out, TIFFTAG_IMAGELENGTH, (uint32_t)h.ras_height);
TIFFSetField(out, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT);
TIFFSetField(out, TIFFTAG_SAMPLESPERPIXEL, h.ras_depth > 8 ? 3 : 1);
TIFFSetField(out, TIFFTAG_BITSPERSAMPLE, h.ras_depth > 1 ? 8 : 1);
TIFFSetField(out, TIFFTAG_PLANARCONFIG, config);
if (h.ras_maptype != RMT_NONE)
{
uint16_t *red;
register uint16_t *map;
register int i, j;
int mapsize;
buf = (unsigned char *)_TIFFmalloc(h.ras_maplength);
if (buf == NULL)
{
fprintf(stderr, "No space to read in colormap.\n");
fclose(in);
(void)TIFFClose(out);
return (-5);
}
if (fread(buf, h.ras_maplength, 1, in) != 1)
{
fprintf(stderr, "%s: Read error on colormap.\n", argv[optind]);
fclose(in);
(void)TIFFClose(out);
return (-6);
}
mapsize = 1 << h.ras_depth;
if (h.ras_maplength > mapsize * 3)
{
fprintf(stderr, "%s: Huh, %d colormap entries, should be %d?\n",
argv[optind], h.ras_maplength, mapsize * 3);
fclose(in);
(void)TIFFClose(out);
return (-7);
}
red = (uint16_t *)_TIFFmalloc(mapsize * 3 * sizeof(uint16_t));
if (red == NULL)
{
fprintf(stderr, "No space for colormap.\n");
fclose(in);
(void)TIFFClose(out);
return (-8);
}
map = red;
for (j = 0; j < 3; j++)
{
#define SCALE(x) (((x) * ((1L << 16) - 1)) / 255)
for (i = h.ras_maplength / 3; i-- > 0;)
*map++ = SCALE(*buf++);
if ((i = h.ras_maplength / 3) < mapsize)
{
i = mapsize - i;
_TIFFmemset(map, 0, i * sizeof(uint16_t));
map += i;
}
}
TIFFSetField(out, TIFFTAG_COLORMAP, red, red + mapsize,
red + 2 * mapsize);
photometric = PHOTOMETRIC_PALETTE;
if (compression == (uint16_t)-1)
compression = COMPRESSION_PACKBITS;
TIFFSetField(out, TIFFTAG_COMPRESSION, compression);
}
else
{
/* XXX this is bogus... */
photometric =
h.ras_depth == 24 ? PHOTOMETRIC_RGB : PHOTOMETRIC_MINISBLACK;
if (compression == (uint16_t)-1)
compression = COMPRESSION_LZW;
TIFFSetField(out, TIFFTAG_COMPRESSION, compression);
}
switch (compression)
{
case COMPRESSION_JPEG:
if (photometric == PHOTOMETRIC_RGB &&
jpegcolormode == JPEGCOLORMODE_RGB)
photometric = PHOTOMETRIC_YCBCR;
TIFFSetField(out, TIFFTAG_JPEGQUALITY, quality);
TIFFSetField(out, TIFFTAG_JPEGCOLORMODE, jpegcolormode);
break;
case COMPRESSION_LZW:
case COMPRESSION_ADOBE_DEFLATE:
case COMPRESSION_DEFLATE:
if (predictor != 0)
TIFFSetField(out, TIFFTAG_PREDICTOR, predictor);
break;
}
TIFFSetField(out, TIFFTAG_PHOTOMETRIC, photometric);
linebytes = ((h.ras_depth * h.ras_width + 15) >> 3) & ~1;
scanline = TIFFScanlineSize(out);
if (scanline > linebytes)
{
buf = (unsigned char *)_TIFFmalloc(scanline);
_TIFFmemset(buf + linebytes, 0, scanline - linebytes);
}
else
buf = (unsigned char *)_TIFFmalloc(linebytes);
TIFFSetField(out, TIFFTAG_ROWSPERSTRIP,
TIFFDefaultStripSize(out, rowsperstrip));
for (row = 0; row < h.ras_height; row++)
{
if (fread(buf, linebytes, 1, in) != 1)
{
fprintf(stderr, "%s: scanline %ld: Read error.\n", argv[optind],
row);
break;
}
if (h.ras_type == RT_STANDARD && h.ras_depth == 24)
{
tsize_t cc = h.ras_width;
unsigned char *cp = buf;
#define SWAP(a, b) \
{ \
unsigned char t = (a); \
(a) = (b); \
(b) = t; \
}
do
{
SWAP(cp[0], cp[2]);
cp += 3;
} while (--cc);
}
if (TIFFWriteScanline(out, buf, row, 0) < 0)
break;
}
(void)TIFFClose(out);
fclose(in);
return (0);
}
static int processCompressOptions(char *opt)
{
if (streq(opt, "none"))
compression = COMPRESSION_NONE;
else if (streq(opt, "packbits"))
compression = COMPRESSION_PACKBITS;
else if (strneq(opt, "jpeg", 4))
{
char *cp = strchr(opt, ':');
compression = COMPRESSION_JPEG;
while (cp)
{
if (isdigit((int)cp[1]))
quality = atoi(cp + 1);
else if (cp[1] == 'r')
jpegcolormode = JPEGCOLORMODE_RAW;
else
usage();
cp = strchr(cp + 1, ':');
}
}
else if (strneq(opt, "lzw", 3))
{
char *cp = strchr(opt, ':');
if (cp)
predictor = atoi(cp + 1);
compression = COMPRESSION_LZW;
}
else if (strneq(opt, "zip", 3))
{
char *cp = strchr(opt, ':');
if (cp)
predictor = atoi(cp + 1);
compression = COMPRESSION_ADOBE_DEFLATE;
}
else
return (0);
return (1);
}
char *stuff[] = {
"usage: ras2tiff [options] input.ras output.tif",
"where options are:",
" -r # make each strip have no more than # rows",
"",
" -c lzw[:opts] compress output with Lempel-Ziv & Welch encoding",
" -c zip[:opts] compress output with deflate encoding",
" -c jpeg[:opts] compress output with JPEG encoding",
" -c packbits compress output with packbits encoding",
" -c none use no compression algorithm on output",
"",
"JPEG options:",
" # set compression quality level (0-100, default 75)",
" r output color image as RGB rather than YCbCr",
"For example, -c jpeg:r:50 to get JPEG-encoded RGB data with 50% comp. "
"quality",
"",
"LZW and deflate options:",
" # set predictor value",
"For example, -c lzw:2 to get LZW-encoded data with horizontal "
"differencing",
" -h this help message",
NULL};
static void usage(void)
{
char buf[BUFSIZ];
int i;
setbuf(stderr, buf);
fprintf(stderr, "%s\n\n", TIFFGetVersion());
for (i = 0; stuff[i] != NULL; i++)
fprintf(stderr, "%s\n", stuff[i]);
exit(-1);
}
-43
View File
@@ -1,43 +0,0 @@
#include "tiff.h"
/*
* Description of header for files containing raster images
*/
struct rasterfile
{
char ras_magic[4]; /* magic number */
int32_t ras_width; /* width (pixels) of image */
int32_t ras_height; /* height (pixels) of image */
int32_t ras_depth; /* depth (1, 8, or 24 bits) of pixel */
int32_t ras_length; /* length (bytes) of image */
int32_t ras_type; /* type of file; see RT_* below */
int32_t ras_maptype; /* type of colormap; see RMT_* below */
int32_t ras_maplength; /* length (bytes) of following map */
/* color map follows for ras_maplength bytes, followed by image */
};
#define RAS_MAGIC "\x59\xa6\x6a\x95"
#define RAS_MAGIC_INV "\x95\x6a\xa6\x59"
/* Sun supported ras_type's */
#define RT_OLD 0 /* Raw pixrect image in 68000 byte order */
#define RT_STANDARD 1 /* Raw pixrect image in 68000 byte order */
#define RT_BYTE_ENCODED 2 /* Run-length compression of bytes */
#define RT_EXPERIMENTAL 0xffff /* Reserved for testing */
/* Sun registered ras_maptype's */
#define RMT_RAW 2
/* Sun supported ras_maptype's */
#define RMT_NONE 0 /* ras_maplength is expected to be 0 */
#define RMT_EQUAL_RGB 1 /* red[ras_maplength/3],green[],blue[] */
/*
* NOTES:
* Each line of the image is rounded out to a multiple of 16 bits.
* This corresponds to the rounding convention used by the memory pixrect
* package (/usr/include/pixrect/memvar.h) of the SunWindows system.
* The ras_encoding field (always set to 0 by Sun's supported software)
* was renamed to ras_length in release 2.0. As a result, rasterfiles
* of type 0 generated by the old software claim to have 0 length; for
* compatibility, code reading rasterfiles must be prepared to compute the
* true length from the width, height, and depth fields.
*/
-346
View File
@@ -1,346 +0,0 @@
/*
* Copyright (c) 1991-1997 Sam Leffler
* Copyright (c) 1991-1997 Silicon Graphics, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and
* its documentation for any purpose is hereby granted without fee, provided
* that (i) the above copyright notices and this permission notice appear in
* all copies of the software and related documentation, and (ii) the names of
* Sam Leffler and Silicon Graphics may not be used in any advertising or
* publicity relating to the software without the specific, prior written
* permission of Sam Leffler and Silicon Graphics.
*
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
*
* IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*/
#include <ctype.h>
#include <gl/image.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "tiffio.h"
#define streq(a, b) (strcmp(a, b) == 0)
#define strneq(a, b, n) (strncmp(a, b, n) == 0)
static short config = PLANARCONFIG_CONTIG;
static uint16_t compression = COMPRESSION_PACKBITS;
static uint16_t predictor = 0;
static uint16_t fillorder = 0;
static uint32_t rowsperstrip = (uint32_t)-1;
static int jpegcolormode = JPEGCOLORMODE_RGB;
static int quality = 75; /* JPEG quality */
static uint16_t photometric;
static void usage(void);
static int cpContig(IMAGE *, TIFF *);
static int cpSeparate(IMAGE *, TIFF *);
static int processCompressOptions(char *);
/* XXX image library has no prototypes */
extern IMAGE *iopen(const char *, const char *);
extern void iclose(IMAGE *);
extern void getrow(IMAGE *, short *, int, int);
int main(int argc, char *argv[])
{
IMAGE *in;
TIFF *out;
int c;
#if !HAVE_DECL_OPTARG
extern int optind;
extern char *optarg;
#endif
while ((c = getopt(argc, argv, "c:p:r:")) != -1)
switch (c)
{
case 'c': /* compression scheme */
if (!processCompressOptions(optarg))
usage();
break;
case 'f': /* fill order */
if (streq(optarg, "lsb2msb"))
fillorder = FILLORDER_LSB2MSB;
else if (streq(optarg, "msb2lsb"))
fillorder = FILLORDER_MSB2LSB;
else
usage();
break;
case 'p': /* planar configuration */
if (streq(optarg, "separate"))
config = PLANARCONFIG_SEPARATE;
else if (streq(optarg, "contig"))
config = PLANARCONFIG_CONTIG;
else
usage();
break;
case 'r': /* rows/strip */
rowsperstrip = atoi(optarg);
break;
case '?':
usage();
/*NOTREACHED*/
}
if (argc - optind != 2)
usage();
in = iopen(argv[optind], "r");
if (in == NULL)
return (-1);
out = TIFFOpen(argv[optind + 1], "w");
if (out == NULL)
return (-2);
TIFFSetField(out, TIFFTAG_IMAGEWIDTH, (uint32_t)in->xsize);
TIFFSetField(out, TIFFTAG_IMAGELENGTH, (uint32_t)in->ysize);
TIFFSetField(out, TIFFTAG_BITSPERSAMPLE, 8);
TIFFSetField(out, TIFFTAG_COMPRESSION, compression);
if (in->zsize == 1)
photometric = PHOTOMETRIC_MINISBLACK;
else
photometric = PHOTOMETRIC_RGB;
switch (compression)
{
case COMPRESSION_JPEG:
if (photometric == PHOTOMETRIC_RGB &&
jpegcolormode == JPEGCOLORMODE_RGB)
photometric = PHOTOMETRIC_YCBCR;
TIFFSetField(out, TIFFTAG_JPEGQUALITY, quality);
TIFFSetField(out, TIFFTAG_JPEGCOLORMODE, jpegcolormode);
break;
case COMPRESSION_LZW:
case COMPRESSION_ADOBE_DEFLATE:
case COMPRESSION_DEFLATE:
if (predictor != 0)
TIFFSetField(out, TIFFTAG_PREDICTOR, predictor);
break;
}
TIFFSetField(out, TIFFTAG_PHOTOMETRIC, photometric);
if (fillorder != 0)
TIFFSetField(out, TIFFTAG_FILLORDER, fillorder);
TIFFSetField(out, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT);
TIFFSetField(out, TIFFTAG_SAMPLESPERPIXEL, in->zsize);
if (in->zsize > 3)
{
uint16_t v[1];
v[0] = EXTRASAMPLE_UNASSALPHA;
TIFFSetField(out, TIFFTAG_EXTRASAMPLES, 1, v);
}
TIFFSetField(out, TIFFTAG_MINSAMPLEVALUE, (uint16_t)in->min);
TIFFSetField(out, TIFFTAG_MAXSAMPLEVALUE, (uint16_t)in->max);
TIFFSetField(out, TIFFTAG_PLANARCONFIG, config);
if (config != PLANARCONFIG_SEPARATE)
TIFFSetField(out, TIFFTAG_ROWSPERSTRIP,
TIFFDefaultStripSize(out, rowsperstrip));
else /* force 1 row/strip for library limitation */
TIFFSetField(out, TIFFTAG_ROWSPERSTRIP, 1L);
if (in->name[0] != '\0')
TIFFSetField(out, TIFFTAG_IMAGEDESCRIPTION, in->name);
if (config == PLANARCONFIG_CONTIG)
cpContig(in, out);
else
cpSeparate(in, out);
(void)iclose(in);
(void)TIFFClose(out);
return (0);
}
static int processCompressOptions(char *opt)
{
if (streq(opt, "none"))
compression = COMPRESSION_NONE;
else if (streq(opt, "packbits"))
compression = COMPRESSION_PACKBITS;
else if (strneq(opt, "jpeg", 4))
{
char *cp = strchr(opt, ':');
defcompression = COMPRESSION_JPEG;
while (cp)
{
if (isdigit((int)cp[1]))
quality = atoi(cp + 1);
else if (cp[1] == 'r')
jpegcolormode = JPEGCOLORMODE_RAW;
else
usage();
cp = strchr(cp + 1, ':');
}
}
else if (strneq(opt, "lzw", 3))
{
char *cp = strchr(opt, ':');
if (cp)
predictor = atoi(cp + 1);
compression = COMPRESSION_LZW;
}
else if (strneq(opt, "zip", 3))
{
char *cp = strchr(opt, ':');
if (cp)
predictor = atoi(cp + 1);
compression = COMPRESSION_ADOBE_DEFLATE;
}
else
return (0);
return (1);
}
static int cpContig(IMAGE *in, TIFF *out)
{
tdata_t buf = _TIFFmalloc(TIFFScanlineSize(out));
short *r = NULL;
int x, y;
if (in->zsize == 3)
{
short *g, *b;
r = (short *)_TIFFmalloc(3 * in->xsize * sizeof(short));
g = r + in->xsize;
b = g + in->xsize;
for (y = in->ysize - 1; y >= 0; y--)
{
uint8_t *pp = (uint8_t *)buf;
getrow(in, r, y, 0);
getrow(in, g, y, 1);
getrow(in, b, y, 2);
for (x = 0; x < in->xsize; x++)
{
pp[0] = r[x];
pp[1] = g[x];
pp[2] = b[x];
pp += 3;
}
if (TIFFWriteScanline(out, buf, in->ysize - y - 1, 0) < 0)
goto bad;
}
}
else if (in->zsize == 4)
{
short *g, *b, *a;
r = (short *)_TIFFmalloc(4 * in->xsize * sizeof(short));
g = r + in->xsize;
b = g + in->xsize;
a = b + in->xsize;
for (y = in->ysize - 1; y >= 0; y--)
{
uint8_t *pp = (uint8_t *)buf;
getrow(in, r, y, 0);
getrow(in, g, y, 1);
getrow(in, b, y, 2);
getrow(in, a, y, 3);
for (x = 0; x < in->xsize; x++)
{
pp[0] = r[x];
pp[1] = g[x];
pp[2] = b[x];
pp[3] = a[x];
pp += 4;
}
if (TIFFWriteScanline(out, buf, in->ysize - y - 1, 0) < 0)
goto bad;
}
}
else
{
uint8_t *pp = (uint8_t *)buf;
r = (short *)_TIFFmalloc(in->xsize * sizeof(short));
for (y = in->ysize - 1; y >= 0; y--)
{
getrow(in, r, y, 0);
for (x = in->xsize - 1; x >= 0; x--)
pp[x] = r[x];
if (TIFFWriteScanline(out, buf, in->ysize - y - 1, 0) < 0)
goto bad;
}
}
if (r)
_TIFFfree(r);
_TIFFfree(buf);
return (1);
bad:
if (r)
_TIFFfree(r);
_TIFFfree(buf);
return (0);
}
static int cpSeparate(IMAGE *in, TIFF *out)
{
tdata_t buf = _TIFFmalloc(TIFFScanlineSize(out));
short *r = (short *)_TIFFmalloc(in->xsize * sizeof(short));
uint8_t *pp = (uint8_t *)buf;
int x, y, z;
for (z = 0; z < in->zsize; z++)
{
for (y = in->ysize - 1; y >= 0; y--)
{
getrow(in, r, y, z);
for (x = 0; x < in->xsize; x++)
pp[x] = r[x];
if (TIFFWriteScanline(out, buf, in->ysize - y - 1, z) < 0)
goto bad;
}
}
_TIFFfree(r);
_TIFFfree(buf);
return (1);
bad:
_TIFFfree(r);
_TIFFfree(buf);
return (0);
}
char *stuff[] = {
"usage: sgi2tiff [options] input.rgb output.tif",
"where options are:",
" -r # make each strip have no more than # rows",
"",
" -p contig pack samples contiguously (e.g. RGBRGB...)",
" -p separate store samples separately (e.g. RRR...GGG...BBB...)",
"",
" -f lsb2msb force lsb-to-msb FillOrder for output",
" -f msb2lsb force msb-to-lsb FillOrder for output",
"",
" -c lzw[:opts] compress output with Lempel-Ziv & Welch encoding",
" -c zip[:opts] compress output with deflate encoding",
" -c jpeg[:opts]compress output with JPEG encoding",
" -c packbits compress output with packbits encoding",
" -c none use no compression algorithm on output",
"",
"JPEG options:",
" # set compression quality level (0-100, default 75)",
" r output color image as RGB rather than YCbCr",
"",
"LZW and deflate options:",
" # set predictor value",
"For example, -c lzw:2 to get LZW-encoded data with horizontal "
"differencing",
NULL};
static void usage(void)
{
char buf[BUFSIZ];
int i;
setbuf(stderr, buf);
for (i = 0; stuff[i] != NULL; i++)
fprintf(stderr, "%s\n", stuff[i]);
exit(-1);
}
-322
View File
@@ -1,322 +0,0 @@
/*
* Copyright (c) 1990-1997 Sam Leffler
* Copyright (c) 1991-1997 Silicon Graphics, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and
* its documentation for any purpose is hereby granted without fee, provided
* that (i) the above copyright notices and this permission notice appear in
* all copies of the software and related documentation, and (ii) the names of
* Sam Leffler and Silicon Graphics may not be used in any advertising or
* publicity relating to the software without the specific, prior written
* permission of Sam Leffler and Silicon Graphics.
*
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
*
* IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <gl.h>
#include "tiffio.h"
typedef unsigned char unsigned char;
typedef unsigned long uint32_t;
#define streq(a, b) (strcmp(a, b) == 0)
#define strneq(a, b, n) (strncmp(a, b, n) == 0)
uint32_t rowsperstrip = (uint32_t)-1;
uint16_t compression = COMPRESSION_PACKBITS;
uint16_t config = PLANARCONFIG_CONTIG;
uint16_t predictor = 0;
int xmaxscreen;
int ymaxscreen;
uint16_t photometric = PHOTOMETRIC_RGB;
int jpegcolormode = JPEGCOLORMODE_RGB;
int quality = 75; /* JPEG quality */
static void usage(void);
static void tiffsv(char *, int, int, int, int);
int main(int argc, char *argv[])
{
int c;
#if !HAVE_DECL_OPTARG
extern int optind;
extern char *optarg;
#endif
while ((c = getopt(argc, argv, "c:p:r:")) != -1)
switch (c)
{
case 'b': /* save as b&w */
photometric = PHOTOMETRIC_MINISBLACK;
break;
case 'c': /* compression scheme */
if (streq(optarg, "none"))
compression = COMPRESSION_NONE;
else if (streq(optarg, "packbits"))
compression = COMPRESSION_PACKBITS;
else if (strneq(optarg, "jpeg", 4))
{
char *cp = strchr(optarg, ':');
if (cp && isdigit(cp[1]))
quality = atoi(cp + 1);
if (cp && strchr(cp, 'r'))
jpegcolormode = JPEGCOLORMODE_RAW;
compression = COMPRESSION_JPEG;
}
else if (strneq(optarg, "lzw", 3))
{
char *cp = strchr(optarg, ':');
if (cp)
predictor = atoi(cp + 1);
compression = COMPRESSION_LZW;
}
else
usage();
break;
case 'p': /* planar configuration */
if (streq(optarg, "separate"))
config = PLANARCONFIG_SEPARATE;
else if (streq(optarg, "contig"))
config = PLANARCONFIG_CONTIG;
else
usage();
break;
case 'r': /* rows/strip */
rowsperstrip = atoi(optarg);
break;
case '?':
usage();
/*NOTREACHED*/
}
if (argc - optind != 1 && argc - optind != 5)
usage();
xmaxscreen = getgdesc(GD_XPMAX) - 1;
ymaxscreen = getgdesc(GD_YPMAX) - 1;
foreground();
noport();
winopen("tiffsv");
if (argc - optind == 5)
tiffsv(argv[optind], atoi(argv[optind + 1]), atoi(argv[optind + 2]),
atoi(argv[optind + 3]), atoi(argv[optind + 4]));
else
tiffsv(argv[optind], 0, xmaxscreen, 0, ymaxscreen);
return (0);
}
char *stuff[] = {
"usage: tiffsv [options] outimage.tif [x1 x2 y1 y2] [-b]",
"where options are:",
" -p contig pack samples contiguously (e.g. RGBRGB...)",
" -p separate store samples separately (e.g. RRR...GGG...BBB...)",
"",
" -r # make each strip have no more than # rows",
"",
" -c lzw[:opts] compress output with Lempel-Ziv & Welch encoding",
" -c jpeg[:opts]compress output with JPEG encoding",
" -c packbits compress output with packbits encoding",
" -c none use no compression algorithm on output",
"",
"JPEG options:",
" # set compression quality level (0-100, default 75)",
" r output color image as RGB rather than YCbCr",
"",
"LZW options:",
" # set predictor value for Lempel-Ziv & Welch encoding",
"For example, -c lzw:2 to get LZW-encoded data with horizontal "
"differencing",
NULL};
static void usage(void)
{
char buf[BUFSIZ];
int i;
setbuf(stderr, buf);
for (i = 0; stuff[i] != NULL; i++)
fprintf(stderr, "%s\n", stuff[i]);
exit(-1);
}
static void svRGBSeparate(TIFF *tif, uint32_t *ss, int xsize, int ysize)
{
tsize_t stripsize = TIFFStripSize(tif);
unsigned char *rbuf = (unsigned char *)_TIFFmalloc(3 * stripsize);
unsigned char *gbuf = rbuf + stripsize;
unsigned char *bbuf = gbuf + stripsize;
register int y;
for (y = 0; y <= ysize; y += rowsperstrip)
{
unsigned char *rp, *gp, *bp;
register int x;
register uint32_t n;
n = rowsperstrip;
if (n > ysize - y + 1)
n = ysize - y + 1;
rp = rbuf;
gp = gbuf;
bp = bbuf;
do
{
for (x = 0; x <= xsize; x++)
{
uint32_t v = ss[x];
rp[x] = v;
gp[x] = v >> 8;
bp[x] = v >> 16;
}
rp += xsize + 1, gp += xsize + 1, bp += xsize + 1;
ss += xsize + 1;
} while (--n);
if (TIFFWriteEncodedStrip(tif, TIFFComputeStrip(tif, y, 0), rbuf,
stripsize) < 0)
break;
if (TIFFWriteEncodedStrip(tif, TIFFComputeStrip(tif, y, 1), gbuf,
stripsize) < 0)
break;
if (TIFFWriteEncodedStrip(tif, TIFFComputeStrip(tif, y, 2), bbuf,
stripsize) < 0)
break;
}
_TIFFfree(rbuf);
}
static void svRGBContig(TIFF *tif, uint32_t *ss, int xsize, int ysize)
{
register int x, y;
tsize_t stripsize = TIFFStripSize(tif);
unsigned char *strip = (unsigned char *)_TIFFmalloc(stripsize);
for (y = 0; y <= ysize; y += rowsperstrip)
{
register unsigned char *pp = strip;
register uint32_t n;
n = rowsperstrip;
if (n > ysize - y + 1)
n = ysize - y + 1;
do
{
for (x = 0; x <= xsize; x++)
{
uint32_t v = ss[x];
pp[0] = v;
pp[1] = v >> 8;
pp[2] = v >> 16;
pp += 3;
}
ss += xsize + 1;
} while (--n);
if (TIFFWriteEncodedStrip(tif, TIFFComputeStrip(tif, y, 0), strip,
stripsize) < 0)
break;
}
_TIFFfree(strip);
}
#undef RED
#undef GREEN
#undef BLUE
#define CVT(x) (((x)*255) / 100)
#define RED CVT(28) /* 28% */
#define GREEN CVT(59) /* 59% */
#define BLUE CVT(11) /* 11% */
static void svGrey(TIFF *tif, uint32_t *ss, int xsize, int ysize)
{
register int x, y;
unsigned char *buf = (unsigned char *)_TIFFmalloc(TIFFScanlineSize(tif));
for (y = 0; y <= ysize; y++)
{
for (x = 0; x <= xsize; x++)
{
unsigned char *cp = (unsigned char *)&ss[x];
buf[x] = (RED * cp[3] + GREEN * cp[2] + BLUE * cp[1]) >> 8;
}
if (TIFFWriteScanline(tif, buf, (uint32_t)y, 0) < 0)
break;
ss += xsize + 1;
}
_TIFFfree(buf);
}
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define ABS(x) ((x) < 0 ? -(x) : (x))
static void tiffsv(char *name, int x1, int x2, int y1, int y2)
{
TIFF *tif;
int xsize, ysize;
int xorg, yorg;
uint32_t *scrbuf;
xorg = MIN(x1, x2);
yorg = MIN(y1, y2);
if (xorg < 0)
xorg = 0;
if (yorg < 0)
yorg = 0;
xsize = ABS(x2 - x1);
ysize = ABS(y2 - y1);
if (xorg + xsize > xmaxscreen)
xsize = xmaxscreen - xorg;
if (yorg + ysize > ymaxscreen)
ysize = ymaxscreen - yorg;
tif = TIFFOpen(name, "w");
TIFFSetField(tif, TIFFTAG_IMAGEWIDTH, (uint32_t)(xsize + 1));
TIFFSetField(tif, TIFFTAG_IMAGELENGTH, (uint32_t)(ysize + 1));
TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, 8);
TIFFSetField(tif, TIFFTAG_SAMPLESPERPIXEL,
photometric == PHOTOMETRIC_RGB ? 3 : 1);
TIFFSetField(tif, TIFFTAG_PLANARCONFIG, config);
TIFFSetField(tif, TIFFTAG_COMPRESSION, compression);
switch (compression)
{
case COMPRESSION_JPEG:
if (photometric == PHOTOMETRIC_RGB &&
jpegcolormode == JPEGCOLORMODE_RGB)
photometric = PHOTOMETRIC_YCBCR;
TIFFSetField(tif, TIFFTAG_JPEGQUALITY, quality);
TIFFSetField(tif, TIFFTAG_JPEGCOLORMODE, jpegcolormode);
break;
case COMPRESSION_LZW:
if (predictor != 0)
TIFFSetField(tif, TIFFTAG_PREDICTOR, predictor);
break;
}
TIFFSetField(tif, TIFFTAG_PHOTOMETRIC, photometric);
TIFFSetField(tif, TIFFTAG_ORIENTATION, ORIENTATION_BOTLEFT);
rowsperstrip = TIFFDefaultStripSize(tif, rowsperstrip);
TIFFSetField(tif, TIFFTAG_ROWSPERSTRIP, rowsperstrip);
scrbuf =
(uint32_t *)_TIFFmalloc((xsize + 1) * (ysize + 1) * sizeof(uint32_t));
readdisplay(xorg, yorg, xorg + xsize, yorg + ysize, scrbuf, RD_FREEZE);
if (photometric == PHOTOMETRIC_RGB)
{
if (config == PLANARCONFIG_SEPARATE)
svRGBSeparate(tif, scrbuf, xsize, ysize);
else
svRGBContig(tif, scrbuf, xsize, ysize);
}
else
svGrey(tif, scrbuf, xsize, ysize);
(void)TIFFClose(tif);
_TIFFfree((char *)scrbuf);
}
-148
View File
@@ -1,148 +0,0 @@
float ycbcrCoeffs[3] = {.299, .587, .114};
/* default coding range is CCIR Rec 601-1 with no headroom/footroom */
unsigned long refBlackWhite[6] = {0, 255, 128, 255, 128, 255};
#define LumaRed ycbcrCoeffs[0]
#define LumaGreen ycbcrCoeffs[1]
#define LumaBlue ycbcrCoeffs[2]
long eRtotal = 0;
long eGtotal = 0;
long eBtotal = 0;
long preveRtotal = 0;
long preveGtotal = 0;
long preveBtotal = 0;
unsigned long AbseRtotal = 0;
unsigned long AbseGtotal = 0;
unsigned long AbseBtotal = 0;
unsigned long eCodes = 0;
unsigned long preveCodes = 0;
unsigned long eBits = 0;
unsigned long preveBits = 0;
static void setupLumaTables();
static int abs(int v) { return (v < 0 ? -v : v); }
static double pct(int v, double range) { return (v * 100. / range); }
static void check(int R, int G, int B);
float D1, D2;
float D3, D4;
float D5, D6;
int main(int argc, char **argv)
{
int R, G, B;
if (argc > 1)
{
refBlackWhite[0] = 16;
refBlackWhite[1] = 235;
refBlackWhite[2] = 128;
refBlackWhite[3] = 240;
refBlackWhite[4] = 128;
refBlackWhite[5] = 240;
}
D3 = 2 - 2 * LumaRed;
D4 = 2 - 2 * LumaBlue;
D1 = 1. / D3;
D2 = 1. / D4;
D5 = D3 * LumaRed / LumaGreen;
D6 = D4 * LumaBlue / LumaGreen;
setupLumaTables();
for (R = 0; R < 256; R++)
{
for (G = 0; G < 256; G++)
for (B = 0; B < 256; B++)
check(R, G, B);
printf("[%3u] c %u/%u b %u/%u (R %u/%d/%u G %u/%d/%u B %u/%d/%u)\n", R,
eCodes - preveCodes, eCodes, eBits - preveBits, eBits,
abs(AbseRtotal - preveRtotal), eRtotal, AbseRtotal,
abs(AbseGtotal - preveGtotal), eGtotal, AbseGtotal,
abs(AbseBtotal - preveBtotal), eBtotal, AbseBtotal);
preveRtotal = AbseRtotal;
preveGtotal = AbseGtotal;
preveBtotal = AbseBtotal;
preveCodes = eCodes;
preveBits = eBits;
}
printf("%u total codes\n", 256 * 256 * 256);
printf("total error: %u codes %u bits (R %d/%u G %d/%u B %d/%u)\n", eCodes,
eBits, eRtotal, AbseRtotal, eGtotal, AbseGtotal, eBtotal,
AbseBtotal);
return (0);
}
float *lumaRed;
float *lumaGreen;
float *lumaBlue;
static float *setupLuma(float c)
{
float *v = (float *)_TIFFmalloc(256 * sizeof(float));
int i;
for (i = 0; i < 256; i++)
v[i] = c * i;
return (v);
}
static void setupLumaTables(void)
{
lumaRed = setupLuma(LumaRed);
lumaGreen = setupLuma(LumaGreen);
lumaBlue = setupLuma(LumaBlue);
}
static unsigned V2Code(float f, unsigned long RB, unsigned long RW, int CR)
{
unsigned int c = (unsigned int)((((f) * (RW - RB) / CR) + RB) + .5);
return (c > 255 ? 255 : c);
}
#define Code2V(c, RB, RW, CR) ((((c) - (int)RB) * (float)CR) / (float)(RW - RB))
#define CLAMP(f, min, max) \
(int)((f) + .5 < (min) ? (min) : (f) + .5 > (max) ? (max) : (f) + .5)
static void check(int R, int G, int B)
{
float Y, Cb, Cr;
int iY, iCb, iCr;
float rY, rCb, rCr;
float rR, rG, rB;
int eR, eG, eB;
Y = lumaRed[R] + lumaGreen[G] + lumaBlue[B];
Cb = (B - Y) * D2;
Cr = (R - Y) * D1;
iY = V2Code(Y, refBlackWhite[0], refBlackWhite[1], 255);
iCb = V2Code(Cb, refBlackWhite[2], refBlackWhite[3], 127);
iCr = V2Code(Cr, refBlackWhite[4], refBlackWhite[5], 127);
rCb = Code2V(iCb, refBlackWhite[2], refBlackWhite[3], 127);
rCr = Code2V(iCr, refBlackWhite[4], refBlackWhite[5], 127);
rY = Code2V(iY, refBlackWhite[0], refBlackWhite[1], 255);
rR = rY + rCr * D3;
rB = rY + rCb * D4;
rG = rY - rCb * D6 - rCr * D5;
eR = R - CLAMP(rR, 0, 255);
eG = G - CLAMP(rG, 0, 255);
eB = B - CLAMP(rB, 0, 255);
if (abs(eR) > 1 || abs(eG) > 1 || abs(eB) > 1)
{
printf("R %u G %u B %u", R, G, B);
printf(" Y %g Cb %g Cr %g", Y, Cb, Cr);
printf(" iY %u iCb %u iCr %u", iY, iCb, iCr);
printf("\n -> Y %g Cb %g Cr %g", rY, rCb, rCr);
printf(" R %g (%u) G %g (%u) B %g (%u) E=[%d %d %d])\n", rR,
CLAMP(rR, 0, 255), rG, CLAMP(rG, 0, 255), rB, CLAMP(rB, 0, 255),
eR, eG, eB);
}
eRtotal += eR;
eGtotal += eG;
eBtotal += eB;
AbseRtotal += abs(eR);
AbseGtotal += abs(eG);
AbseBtotal += abs(eB);
if (eR | eG | eB)
eCodes++;
eBits += abs(eR) + abs(eG) + abs(eB);
}
-31
View File
@@ -1,31 +0,0 @@
#!/bin/sh
retval=0
set -x
case `uname` in
Darwin*)
glibtoolize --force --copy || retval=$?
;;
*)
libtoolize --force --copy || retval=$?
;;
esac
aclocal -I ./m4 || retval=$?
autoheader || retval=$?
automake --foreign --add-missing --copy || retval=$?
autoconf || retval=$?
# Get latest config.guess and config.sub from upstream master since
# these are often out of date.
for file in config.guess config.sub
do
echo "$0: getting $file..."
wget -q --timeout=5 -O config/$file.tmp \
"https://git.savannah.gnu.org/cgit/config.git/plain/${file}" \
&& mv -f config/$file.tmp config/$file \
&& chmod a+x config/$file || retval=$?
rm -f config/$file.tmp
done
exit $retval
-23
View File
@@ -1,23 +0,0 @@
# CMake build for libtiff
#
# Copyright © 2015 Open Microscopy Environment / University of Dundee
# Written by Roger Leigh <rleigh@codelibre.net>
#
# Permission to use, copy, modify, distribute, and sell this software and
# its documentation for any purpose is hereby granted without fee, provided
# that (i) the above copyright notices and this permission notice appear in
# all copies of the software and related documentation, and (ii) the names of
# Sam Leffler and Silicon Graphics may not be used in any advertising or
# publicity relating to the software without the specific, prior written
# permission of Sam Leffler and Silicon Graphics.
#
# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
#
# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
# OF THIS SOFTWARE.
-3
View File
@@ -1,3 +0,0 @@
This directory contains scripts and tools needed to build libtiff library
and its utilities in various environments.
-124
View File
@@ -1,124 +0,0 @@
#!/bin/sh
# This script is used for testing the build, primarily for use
# with GitLab CI, but may be used by hand as well.
set -e
set -x
# Test autoconf build
autoconf_build()
{
autoreconf -ivf
mkdir autoconf-build
cd autoconf-build
echo "Running ../configure --prefix=$(pwd)/../autoconf-install) ${opts}"
CFLAGS="-Wall -Wextra -Werror" ../configure --prefix=$(pwd)/../autoconf-install ${opts}
make
make install
make check
make distcheck
mkdir ../distribution
cp tiff-*.tar.* tiff*.zip ../distribution
}
# Test autoconf build (minimal; no distcheck)
autoconf_build_minimal()
{
autoreconf -ivf
mkdir autoconf-build
cd autoconf-build
echo "Running ../configure --prefix=$(pwd)/../autoconf-install) ${opts}"
CFLAGS="-Wall -Wextra -Werror" ../configure --prefix=$(pwd)/../autoconf-install ${opts}
make
make install
make check
}
# Test cmake build
cmake_build()
{
PATH="$(pwd)/tools/bin:$PATH"
if [ "$(uname -s)" = "Darwin" ]; then
PATH="$(pwd)/tools/CMake.app/Contents/bin:$PATH"
fi
mkdir cmake-build
cd cmake-build
opts="-Dfatal-warnings=ON"
para3=`echo "$3" | sed 's/./\L&/g'`
if [ "$para3" = "static" ]; then
opts2="-DBUILD_SHARED_LIBS:BOOL=OFF"
else
opts2=""
fi
echo "Running cmake -G "$1" -DCMAKE_UNITY_BUILD=ON -DCMAKE_BUILD_TYPE="$2" -DCMAKE_INSTALL_PREFIX=../cmake-install ${opts} ${opts2} .."
cmake -G "$1" -DCMAKE_UNITY_BUILD=ON -DCMAKE_BUILD_TYPE="$2" -DCMAKE_INSTALL_PREFIX=../cmake-install -DCMAKE_C_FLAGS="-Wall -Wextra -Werror" ${opts} ${opts2} ..
$COVERITY_BUILD cmake --build .
cmake --build . --target install
ctest -V
cd ..
if [ "$para3" = "static" ]; then
echo No test project build for STATIC CI/CD build - skipped -.
else
# Build test project using find_package(Tiff CONFIG)
mkdir cmake-test-build
cd cmake-test-build
cmake -G "$1" -DCMAKE_BUILD_TYPE="$2" "-DTiff_DIR=$PWD/../cmake-install/lib/cmake/tiff" -S ../build/test_cmake -B .
cmake --build .
cd ..
mkdir cmake-test-no-target-build
cd cmake-test-no-target-build
cmake -G "$1" -DCMAKE_BUILD_TYPE="$2" "-DTiff_DIR=$PWD/../cmake-install/lib/cmake/tiff" -S ../build/test_cmake_no_target -B .
cmake --build .
# Return to cmake-build for coverity_build()
cd ../cmake-build
fi
}
# Static-analysis with coverity
coverity_build()
{
curl -o /tmp/cov-analysis-linux64.tgz \
https://scan.coverity.com/download/linux64 \
--form project=$COVERITY_SCAN_PROJECT_NAME \
--form token=$COVERITY_SCAN_TOKEN
tar xfz /tmp/cov-analysis-linux64.tgz
COVERITY_BUILD="$(pwd)/cov-analysis-linux64-*/bin/cov-build --dir cov-int" cmake_build "$@"
tar cfz cov-int.tar.gz cov-int
curl https://scan.coverity.com/builds?project=$COVERITY_SCAN_PROJECT_NAME \
--form token=$COVERITY_SCAN_TOKEN \
--form email=$GITLAB_USER_EMAIL \
--form file=@cov-int.tar.gz \
--form version="`git describe --tags`" \
--form description="`git describe --tags` / $CI_COMMIT_TITLE / $CI_COMMIT_REF_NAME:$CI_PIPELINE_ID"
}
build=$1
shift
case $build in
autoconf)
echo "Testing Autoconf build"
autoconf_build "$@"
;;
autoconf-minimal)
echo "Testing Autoconf build (minimal)"
autoconf_build_minimal "$@"
;;
cmake)
echo "Testing CMake build"
cmake_build "$@"
;;
coverity)
echo "Static analysis with Coverity"
coverity_build "$@"
;;
*)
echo "Invalid argument: \"$arg\"" >&2
exit 1
;;
esac
exit 0
-7
View File
@@ -1,7 +0,0 @@
cmake_minimum_required(VERSION 3.9.0)
project(test)
find_package(Tiff CONFIG REQUIRED)
add_executable(test test.c)
target_link_libraries(test PRIVATE TIFF::tiff)
-7
View File
@@ -1,7 +0,0 @@
#include "tiffio.h"
int main()
{
TIFFGetVersion();
return 0;
}
@@ -1,8 +0,0 @@
cmake_minimum_required(VERSION 3.9.0)
project(test)
find_package(Tiff CONFIG REQUIRED)
add_executable(test test.c)
target_include_directories(test PRIVATE ${TIFF_INCLUDE_DIR})
target_link_libraries(test PRIVATE ${TIFF_LIBRARIES})
-7
View File
@@ -1,7 +0,0 @@
#include "tiffio.h"
int main()
{
TIFFGetVersion();
return 0;
}
-32
View File
@@ -1,32 +0,0 @@
# Autotools compatibility
#
# Copyright © 2015 Open Microscopy Environment / University of Dundee
# Copyright © 2021 Roger Leigh <rleigh@codelibre.net>
# Written by Roger Leigh <rleigh@codelibre.net>
#
# Permission to use, copy, modify, distribute, and sell this software and
# its documentation for any purpose is hereby granted without fee, provided
# that (i) the above copyright notices and this permission notice appear in
# all copies of the software and related documentation, and (ii) the names of
# Sam Leffler and Silicon Graphics may not be used in any advertising or
# publicity relating to the software without the specific, prior written
# permission of Sam Leffler and Silicon Graphics.
#
# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
#
# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
# OF THIS SOFTWARE.
# For autotools header compatibility
set(PACKAGE_NAME "LibTIFF Software")
set(PACKAGE_TARNAME "${PROJECT_NAME}")
set(PACKAGE_VERSION "${PROJECT_VERSION}${LIBTIFF_ALPHA_VERSION}")
set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
set(PACKAGE_BUGREPORT "tiff@lists.osgeo.org")
-56
View File
@@ -1,56 +0,0 @@
# Read version information from configure.ac.
#
# Copyright © 2015 Open Microscopy Environment / University of Dundee
# Copyright © 2021 Roger Leigh <rleigh@codelibre.net>
# Written by Roger Leigh <rleigh@codelibre.net>
#
# Permission to use, copy, modify, distribute, and sell this software and
# its documentation for any purpose is hereby granted without fee, provided
# that (i) the above copyright notices and this permission notice appear in
# all copies of the software and related documentation, and (ii) the names of
# Sam Leffler and Silicon Graphics may not be used in any advertising or
# publicity relating to the software without the specific, prior written
# permission of Sam Leffler and Silicon Graphics.
#
# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
#
# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
# OF THIS SOFTWARE.
# Get version from configure.ac
FILE(STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/configure.ac" configure REGEX "^LIBTIFF_.*=")
foreach(line ${configure})
foreach(var LIBTIFF_MAJOR_VERSION LIBTIFF_MINOR_VERSION LIBTIFF_MICRO_VERSION LIBTIFF_ALPHA_VERSION
LIBTIFF_CURRENT LIBTIFF_REVISION LIBTIFF_AGE)
if(NOT ${var} AND line MATCHES "^${var}=(.*)")
set(${var} "${CMAKE_MATCH_1}")
break()
endif()
endforeach()
endforeach()
# Package version
set(LIBTIFF_VERSION "${LIBTIFF_MAJOR_VERSION}.${LIBTIFF_MINOR_VERSION}.${LIBTIFF_MICRO_VERSION}")
set(LIBTIFF_VERSION_FULL "${LIBTIFF_VERSION}${LIBTIFF_ALPHA_VERSION}")
# Get release version from file VERSION
FILE(STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/VERSION" LIBTIFF_RELEASE_VERSION)
# Package date - get it from file RELEASE-DATE
FILE(STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/RELEASE-DATE" LIBTIFF_RELEASE_DATE)
# Convert the libtool version variables to proper major and minor versions
math(EXPR SO_MAJOR "${LIBTIFF_CURRENT} - ${LIBTIFF_AGE}")
set(SO_MINOR "${LIBTIFF_AGE}")
set(SO_REVISION "${LIBTIFF_REVISION}")
# Library version (unlike libtool's baroque scheme, WYSIWYG here)
set(SO_COMPATVERSION "${SO_MAJOR}")
set(SO_VERSION "${SO_MAJOR}.${SO_MINOR}.${SO_REVISION}")
-32
View File
@@ -1,32 +0,0 @@
# C++ library option
#
# Copyright © 2015 Open Microscopy Environment / University of Dundee
# Copyright © 2021 Roger Leigh <rleigh@codelibre.net>
# Written by Roger Leigh <rleigh@codelibre.net>
#
# Permission to use, copy, modify, distribute, and sell this software and
# its documentation for any purpose is hereby granted without fee, provided
# that (i) the above copyright notices and this permission notice appear in
# all copies of the software and related documentation, and (ii) the names of
# Sam Leffler and Silicon Graphics may not be used in any advertising or
# publicity relating to the software without the specific, prior written
# permission of Sam Leffler and Silicon Graphics.
#
# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
#
# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
# OF THIS SOFTWARE.
# C++ support
option(cxx "Enable C++ stream API building (requires C++ compiler)" ON)
set(CXX_SUPPORT FALSE)
if (cxx)
enable_language(CXX)
set(CXX_SUPPORT TRUE)
endif()
-124
View File
@@ -1,124 +0,0 @@
# Compiler feature checks
#
# Copyright © 2015 Open Microscopy Environment / University of Dundee
# Copyright © 2021 Roger Leigh <rleigh@codelibre.net>
# Written by Roger Leigh <rleigh@codelibre.net>
#
# Permission to use, copy, modify, distribute, and sell this software and
# its documentation for any purpose is hereby granted without fee, provided
# that (i) the above copyright notices and this permission notice appear in
# all copies of the software and related documentation, and (ii) the names of
# Sam Leffler and Silicon Graphics may not be used in any advertising or
# publicity relating to the software without the specific, prior written
# permission of Sam Leffler and Silicon Graphics.
#
# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
#
# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
# OF THIS SOFTWARE.
include(CheckCCompilerFlag)
# These are annoyingly verbose, produce false positives or don't work
# nicely with all supported compiler versions, so are disabled unless
# explicitly enabled.
option(extra-warnings "Enable extra compiler warnings" OFF)
# This will cause the compiler to fail when an error occurs.
option(fatal-warnings "Compiler warnings are errors" OFF)
# Check if the compiler supports each of the following additional
# flags, and enable them if supported. This greatly improves the
# quality of the build by checking for a number of common problems,
# some of which are quite serious.
if(CMAKE_C_COMPILER_ID STREQUAL "GNU" OR
CMAKE_C_COMPILER_ID MATCHES "Clang")
set(test_flags
-Wall
-Winline
-Wformat-security
-Wpointer-arith
-Wdisabled-optimization
-Wno-unknown-pragmas
-fstrict-aliasing)
if(extra-warnings)
list(APPEND test_flags
-pedantic
-Wextra
-Wformat
-Wformat-overflow
-Wformat-nonliteral
-Wformat-signedness
-Wformat-truncation
-Wdeclaration-after-statement
-Wconversion
-Wsign-conversion
-Wnull-dereference
-Wdouble-promotion
-Wmisleading-indentation
-Wmissing-include-dirs
-Wswitch-default
-Wswitch-enum
-Wunused-local-typedefs
-Wunused-parameter
-Wuninitialized
-Warith-conversion
-Wbool-operation
-Wduplicated-branches
-Wduplicated-cond
-Wshadow
-Wunused-macros
-Wc99-c11-compat
-Wcast-qual
-Wcast-align
-Wwrite-strings
-Wdangling-else
-Wsizeof-array-div
-Wsizeof-pointer-div
-Wsizeof-pointer-memaccess
-Wlogical-op
-Wlogical-not-parentheses
-Wstrict-prototypes
-Wmissing-declarations
-Wredundant-decls
-Wno-int-to-pointer-cast
-Wfloat-equal
-Wfloat-conversion
-Wmissing-prototypes
-Wunreachable-code)
endif()
if(fatal-warnings)
list(APPEND test_flags
-Werror)
endif()
elseif(CMAKE_C_COMPILER_ID STREQUAL "MSVC")
set(test_flags)
if(extra-warnings)
list(APPEND test_flags
/W4)
else()
list(APPEND test_flags
/W3)
endif()
if (fatal-warnings)
list(APPEND test_flags
/WX)
endif()
endif()
foreach(flag ${test_flags})
string(REGEX REPLACE "[^A-Za-z0-9]" "_" flag_var "${flag}")
set(test_c_flag "C_FLAG${flag_var}")
CHECK_C_COMPILER_FLAG(${flag} "${test_c_flag}")
if (${test_c_flag})
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${flag}")
endif (${test_c_flag})
endforeach(flag ${test_flags})
-45
View File
@@ -1,45 +0,0 @@
# Checks for deflate codec support
#
# Copyright © 2015 Open Microscopy Environment / University of Dundee
# Copyright © 2021 Roger Leigh <rleigh@codelibre.net>
# Written by Roger Leigh <rleigh@codelibre.net>
#
# Permission to use, copy, modify, distribute, and sell this software and
# its documentation for any purpose is hereby granted without fee, provided
# that (i) the above copyright notices and this permission notice appear in
# all copies of the software and related documentation, and (ii) the names of
# Sam Leffler and Silicon Graphics may not be used in any advertising or
# publicity relating to the software without the specific, prior written
# permission of Sam Leffler and Silicon Graphics.
#
# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
#
# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
# OF THIS SOFTWARE.
# ZLIB
set(ZLIB_SUPPORT FALSE)
find_package(ZLIB)
option(zlib "use zlib (required for Deflate compression)" ${ZLIB_FOUND})
if(zlib AND ZLIB_FOUND)
set(ZLIB_SUPPORT TRUE)
endif()
set(ZIP_SUPPORT ${ZLIB_SUPPORT})
# libdeflate
set(LIBDEFLATE_SUPPORT FALSE)
find_package(Deflate)
option(libdeflate "use libdeflate (optional for faster Deflate support, still requires zlib)" ${Deflate_FOUND})
if (libdeflate AND Deflate_FOUND AND ZIP_SUPPORT)
set(LIBDEFLATE_SUPPORT TRUE)
endif()
if(Deflate_FOUND AND NOT ZIP_SUPPORT)
message(WARNING "libdeflate available but zlib is not. libdeflate cannot be used")
endif()
-72
View File
@@ -1,72 +0,0 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindCMath
--------
Find the native CMath includes and library.
IMPORTED Targets
^^^^^^^^^^^^^^^^
This module defines :prop_tgt:`IMPORTED` target ``CMath::CMath``, if
CMath has been found.
Result Variables
^^^^^^^^^^^^^^^^
This module defines the following variables:
::
CMath_INCLUDE_DIRS - Where to find math.h
CMath_LIBRARIES - List of libraries when using CMath.
CMath_FOUND - True if CMath found.
#]=======================================================================]
include(CheckSymbolExists)
include(CheckLibraryExists)
check_symbol_exists(pow "math.h" CMath_HAVE_LIBC_POW)
find_library(CMath_LIBRARY NAMES m)
if(NOT CMath_HAVE_LIBC_POW)
set(CMAKE_REQUIRED_LIBRARIES_SAVE ${CMAKE_REQUIRED_LIBRARIES})
set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${CMath_LIBRARY})
check_symbol_exists(pow "math.h" CMath_HAVE_LIBM_POW)
set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES_SAVE})
endif()
set(CMath_pow FALSE)
if(CMath_HAVE_LIBC_POW OR CMath_HAVE_LIBM_POW)
set(CMath_pow TRUE)
endif()
set(CMath_INCLUDE_DIRS)
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(CMath REQUIRED_VARS CMath_pow)
if(CMath_FOUND)
if(NOT CMath_INCLUDE_DIRS)
set(CMath_INCLUDE_DIRS)
endif()
if(NOT CMath_LIBRARIES)
if (CMath_LIBRARY)
set(CMath_LIBRARIES ${CMath_LIBRARY})
endif()
endif()
if(NOT TARGET CMath::CMath)
if(CMath_LIBRARIES)
add_library(CMath::CMath UNKNOWN IMPORTED)
set_target_properties(CMath::CMath PROPERTIES
IMPORTED_LOCATION "${CMath_LIBRARY}")
else()
add_library(CMath::CMath INTERFACE IMPORTED)
endif()
endif()
endif()
-115
View File
@@ -1,115 +0,0 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindDeflate
--------
Find the native Deflate includes and library.
IMPORTED Targets
^^^^^^^^^^^^^^^^
This module defines :prop_tgt:`IMPORTED` target ``Deflate::Deflate``, if
Deflate has been found.
Result Variables
^^^^^^^^^^^^^^^^
This module defines the following variables:
::
Deflate_INCLUDE_DIRS - where to find deflate.h, etc.
Deflate_LIBRARIES - List of libraries when using deflate.
Deflate_FOUND - True if deflate found.
::
Deflate_VERSION_STRING - The version of deflate found (x.y.z)
Deflate_VERSION_MAJOR - The major version of deflate
Deflate_VERSION_MINOR - The minor version of deflate
Debug and Release variants are found separately.
#]=======================================================================]
# Standard names to search for
set(Deflate_NAMES deflate deflatestatic)
set(Deflate_NAMES_DEBUG deflated deflatestaticd)
find_path(Deflate_INCLUDE_DIR
NAMES libdeflate.h
PATH_SUFFIXES include)
set(Deflate_OLD_FIND_LIBRARY_PREFIXES "${CMAKE_FIND_LIBRARY_PREFIXES}")
# Library has a "lib" prefix even on Windows.
set(CMAKE_FIND_LIBRARY_PREFIXES "lib" "")
# Allow Deflate_LIBRARY to be set manually, as the location of the deflate library
if(NOT Deflate_LIBRARY)
find_library(Deflate_LIBRARY_RELEASE
NAMES ${Deflate_NAMES}
PATH_SUFFIXES lib)
find_library(Deflate_LIBRARY_DEBUG
NAMES ${Deflate_NAMES_DEBUG}
PATH_SUFFIXES lib)
include(SelectLibraryConfigurations)
select_library_configurations(Deflate)
endif()
set(CMAKE_FIND_LIBRARY_PREFIXES "${Deflate_OLD_FIND_LIBRARY_PREFIXES}")
unset(Deflate_NAMES)
unset(Deflate_NAMES_DEBUG)
unset(Deflate_OLD_FIND_LIBRARY_PREFIXES)
mark_as_advanced(Deflate_INCLUDE_DIR)
if(Deflate_INCLUDE_DIR AND EXISTS "${Deflate_INCLUDE_DIR}/libdeflate.h")
file(STRINGS "${Deflate_INCLUDE_DIR}/libdeflate.h" Deflate_H REGEX "^#define[\t ]+LIBDEFLATE_VERSION_STRING[\t ]+.*")
string(REGEX REPLACE "^.*LIBDEFLATE_VERSION_STRING[\t ]+\"([0-9]+).*$" "\\1" Deflate_MAJOR_VERSION "${Deflate_H}")
string(REGEX REPLACE "^.*LIBDEFLATE_VERSION_STRING[\t ]\"[0-9]+\\.([0-9]+).*$" "\\1" Deflate_MINOR_VERSION "${Deflate_H}")
set(Deflate_VERSION_STRING "${Deflate_MAJOR_VERSION}.${Deflate_MINOR_VERSION}")
set(Deflate_VERSION_MAJOR "${Deflate_MAJOR_VERSION}")
set(Deflate_VERSION_MINOR "${Deflate_MINOR_VERSION}")
endif()
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Deflate
REQUIRED_VARS Deflate_LIBRARY Deflate_INCLUDE_DIR
VERSION_VAR Deflate_VERSION_STRING)
if(Deflate_FOUND)
set(Deflate_INCLUDE_DIRS ${Deflate_INCLUDE_DIR})
if(NOT Deflate_LIBRARIES)
set(Deflate_LIBRARIES ${Deflate_LIBRARY})
endif()
if(NOT TARGET Deflate::Deflate)
add_library(Deflate::Deflate UNKNOWN IMPORTED)
set_target_properties(Deflate::Deflate PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${Deflate_INCLUDE_DIRS}")
if(Deflate_LIBRARY_RELEASE)
set_property(TARGET Deflate::Deflate APPEND PROPERTY
IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(Deflate::Deflate PROPERTIES
IMPORTED_LOCATION_RELEASE "${Deflate_LIBRARY_RELEASE}")
endif()
if(Deflate_LIBRARY_DEBUG)
set_property(TARGET Deflate::Deflate APPEND PROPERTY
IMPORTED_CONFIGURATIONS DEBUG)
set_target_properties(Deflate::Deflate PROPERTIES
IMPORTED_LOCATION_DEBUG "${Deflate_LIBRARY_DEBUG}")
endif()
if(NOT Deflate_LIBRARY_RELEASE AND NOT Deflate_LIBRARY_DEBUG)
set_target_properties(Deflate::Deflate PROPERTIES
IMPORTED_LOCATION "${Deflate_LIBRARY}")
endif()
endif()
endif()
-116
View File
@@ -1,116 +0,0 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindJBIG
--------
Find the native JBIG includes and library.
IMPORTED Targets
^^^^^^^^^^^^^^^^
This module defines :prop_tgt:`IMPORTED` target ``JBIG::JBIG``, if
JBIG has been found.
Result Variables
^^^^^^^^^^^^^^^^
This module defines the following variables:
::
JBIG_INCLUDE_DIRS - where to find jbig.h, etc.
JBIG_LIBRARIES - List of libraries when using jbig.
JBIG_FOUND - True if jbig found.
::
JBIG_VERSION_STRING - The version of jbig found (x.y.z)
JBIG_VERSION_MAJOR - The major version of jbig
JBIG_VERSION_MINOR - The minor version of jbig
Debug and Release variants are found separately.
#]=======================================================================]
# Standard names to search for
set(JBIG_NAMES jbig)
set(JBIG_NAMES_DEBUG jbigd)
find_path(JBIG_INCLUDE_DIR
NAMES jbig.h
PATH_SUFFIXES include)
set(JBIG_OLD_FIND_LIBRARY_PREFIXES "${CMAKE_FIND_LIBRARY_PREFIXES}")
# Library has a "lib" prefix even on Windows.
set(CMAKE_FIND_LIBRARY_PREFIXES "lib" "")
# Allow JBIG_LIBRARY to be set manually, as the location of the jbig library
if(NOT JBIG_LIBRARY)
find_library(JBIG_LIBRARY_RELEASE
NAMES ${JBIG_NAMES}
PATH_SUFFIXES lib)
find_library(JBIG_LIBRARY_DEBUG
NAMES ${JBIG_NAMES_DEBUG}
PATH_SUFFIXES lib)
include(SelectLibraryConfigurations)
select_library_configurations(JBIG)
endif()
set(CMAKE_FIND_LIBRARY_PREFIXES "${JBIG_OLD_FIND_LIBRARY_PREFIXES}")
unset(JBIG_NAMES)
unset(JBIG_NAMES_DEBUG)
unset(JBIG_OLD_FIND_LIBRARY_PREFIXES)
mark_as_advanced(JBIG_INCLUDE_DIR)
if(JBIG_INCLUDE_DIR AND EXISTS "${JBIG_INCLUDE_DIR}/jbig.h")
file(STRINGS "${JBIG_INCLUDE_DIR}/jbig.h" JBIG_H REGEX "^#define JBG_VERSION *\"[^\"]*\"$")
string(REGEX REPLACE "^.*JBG_VERSION *\"([0-9]+).*$" "\\1" JBIG_MAJOR_VERSION "${JBIG_H}")
string(REGEX REPLACE "^.*JBG_VERSION *\"[0-9]+\\.([0-9]+).*$" "\\1" JBIG_MINOR_VERSION "${JBIG_H}")
set(JBIG_VERSION_STRING "${JBIG_MAJOR_VERSION}.${JBIG_MINOR_VERSION}")
set(JBIG_MAJOR_VERSION "${JBIG_VERSION_MAJOR}")
set(JBIG_MINOR_VERSION "${JBIG_VERSION_MINOR}")
endif()
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(JBIG
REQUIRED_VARS JBIG_LIBRARY JBIG_INCLUDE_DIR
VERSION_VAR JBIG_VERSION_STRING)
if(JBIG_FOUND)
set(JBIG_INCLUDE_DIRS ${JBIG_INCLUDE_DIR})
if(NOT JBIG_LIBRARIES)
set(JBIG_LIBRARIES ${JBIG_LIBRARY})
endif()
if(NOT TARGET JBIG::JBIG)
add_library(JBIG::JBIG UNKNOWN IMPORTED)
set_target_properties(JBIG::JBIG PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${JBIG_INCLUDE_DIRS}")
if(JBIG_LIBRARY_RELEASE)
set_property(TARGET JBIG::JBIG APPEND PROPERTY
IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(JBIG::JBIG PROPERTIES
IMPORTED_LOCATION_RELEASE "${JBIG_LIBRARY_RELEASE}")
endif()
if(JBIG_LIBRARY_DEBUG)
set_property(TARGET JBIG::JBIG APPEND PROPERTY
IMPORTED_CONFIGURATIONS DEBUG)
set_target_properties(JBIG::JBIG PROPERTIES
IMPORTED_LOCATION_DEBUG "${JBIG_LIBRARY_DEBUG}")
endif()
if(NOT JBIG_LIBRARY_RELEASE AND NOT JBIG_LIBRARY_DEBUG)
set_target_properties(JBIG::JBIG PROPERTIES
IMPORTED_LOCATION "${JBIG_LIBRARY}")
endif()
endif()
endif()
-142
View File
@@ -1,142 +0,0 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindJPEG
--------
Find the Joint Photographic Experts Group (JPEG) library (``libjpeg``)
Imported targets
^^^^^^^^^^^^^^^^
.. versionadded:: 3.12
This module defines the following :prop_tgt:`IMPORTED` targets:
``JPEG::JPEG``
The JPEG library, if found.
Result variables
^^^^^^^^^^^^^^^^
This module will set the following variables in your project:
``JPEG_FOUND``
If false, do not try to use JPEG.
``JPEG_INCLUDE_DIRS``
where to find jpeglib.h, etc.
``JPEG_LIBRARIES``
the libraries needed to use JPEG.
``JPEG_VERSION``
.. versionadded:: 3.12
the version of the JPEG library found
Cache variables
^^^^^^^^^^^^^^^
The following cache variables may also be set:
``JPEG_INCLUDE_DIRS``
where to find jpeglib.h, etc.
``JPEG_LIBRARY_RELEASE``
where to find the JPEG library (optimized).
``JPEG_LIBRARY_DEBUG``
where to find the JPEG library (debug).
.. versionadded:: 3.12
Debug and Release variand are found separately.
Obsolete variables
^^^^^^^^^^^^^^^^^^
``JPEG_INCLUDE_DIR``
where to find jpeglib.h, etc. (same as JPEG_INCLUDE_DIRS)
``JPEG_LIBRARY``
where to find the JPEG library.
#]=======================================================================]
find_path(JPEG_INCLUDE_DIR jpeglib.h)
set(jpeg_names ${JPEG_NAMES} jpeg jpeg-static libjpeg libjpeg-static turbojpeg turbojpeg-static)
foreach(name ${jpeg_names})
list(APPEND jpeg_names_debug "${name}d")
endforeach()
if(NOT JPEG_LIBRARY)
find_library(JPEG_LIBRARY_RELEASE NAMES ${jpeg_names} NAMES_PER_DIR)
find_library(JPEG_LIBRARY_DEBUG NAMES ${jpeg_names_debug} NAMES_PER_DIR)
include(SelectLibraryConfigurations)
select_library_configurations(JPEG)
mark_as_advanced(JPEG_LIBRARY_RELEASE JPEG_LIBRARY_DEBUG)
endif()
unset(jpeg_names)
unset(jpeg_names_debug)
if(JPEG_INCLUDE_DIR)
file(GLOB _JPEG_CONFIG_HEADERS_FEDORA "${JPEG_INCLUDE_DIR}/jconfig*.h")
file(GLOB _JPEG_CONFIG_HEADERS_DEBIAN "${JPEG_INCLUDE_DIR}/*/jconfig.h")
set(_JPEG_CONFIG_HEADERS
"${JPEG_INCLUDE_DIR}/jpeglib.h"
${_JPEG_CONFIG_HEADERS_FEDORA}
${_JPEG_CONFIG_HEADERS_DEBIAN})
foreach (_JPEG_CONFIG_HEADER IN LISTS _JPEG_CONFIG_HEADERS)
if (NOT EXISTS "${_JPEG_CONFIG_HEADER}")
continue ()
endif ()
file(STRINGS "${_JPEG_CONFIG_HEADER}"
jpeg_lib_version REGEX "^#define[\t ]+JPEG_LIB_VERSION[\t ]+.*")
if (NOT jpeg_lib_version)
continue ()
endif ()
string(REGEX REPLACE "^#define[\t ]+JPEG_LIB_VERSION[\t ]+([0-9]+).*"
"\\1" JPEG_VERSION "${jpeg_lib_version}")
break ()
endforeach ()
unset(jpeg_lib_version)
unset(_JPEG_CONFIG_HEADER)
unset(_JPEG_CONFIG_HEADERS)
unset(_JPEG_CONFIG_HEADERS_FEDORA)
unset(_JPEG_CONFIG_HEADERS_DEBIAN)
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(JPEG
REQUIRED_VARS JPEG_LIBRARY JPEG_INCLUDE_DIR
VERSION_VAR JPEG_VERSION)
if(JPEG_FOUND)
set(JPEG_LIBRARIES ${JPEG_LIBRARY})
set(JPEG_INCLUDE_DIRS "${JPEG_INCLUDE_DIR}")
if(NOT TARGET JPEG::JPEG)
add_library(JPEG::JPEG UNKNOWN IMPORTED)
if(JPEG_INCLUDE_DIRS)
set_target_properties(JPEG::JPEG PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${JPEG_INCLUDE_DIRS}")
endif()
if(EXISTS "${JPEG_LIBRARY}")
set_target_properties(JPEG::JPEG PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
IMPORTED_LOCATION "${JPEG_LIBRARY}")
endif()
if(EXISTS "${JPEG_LIBRARY_RELEASE}")
set_property(TARGET JPEG::JPEG APPEND PROPERTY
IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(JPEG::JPEG PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "C"
IMPORTED_LOCATION_RELEASE "${JPEG_LIBRARY_RELEASE}")
endif()
if(EXISTS "${JPEG_LIBRARY_DEBUG}")
set_property(TARGET JPEG::JPEG APPEND PROPERTY
IMPORTED_CONFIGURATIONS DEBUG)
set_target_properties(JPEG::JPEG PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "C"
IMPORTED_LOCATION_DEBUG "${JPEG_LIBRARY_DEBUG}")
endif()
endif()
endif()
mark_as_advanced(JPEG_LIBRARY JPEG_INCLUDE_DIR)
-100
View File
@@ -1,100 +0,0 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindLerc
--------
Find the native Lerc includes and library.
IMPORTED Targets
^^^^^^^^^^^^^^^^
This module defines :prop_tgt:`IMPORTED` target ``LERC::LERC``, if
LERC has been found.
Result Variables
^^^^^^^^^^^^^^^^
This module defines the following variables:
::
LERC_INCLUDE_DIRS - where to find Lerc_c_api.h, etc.
LERC_LIBRARIES - List of libraries when using LERC.
LERC_FOUND - True if LERC found.
LERC_VERSION_STRING - version number as a string (ex: "4.0.1")
#]=======================================================================]
# Standard names to search for
set(LERC_NAMES LercLib Lerc)
find_path(LERC_INCLUDE_DIR
NAMES Lerc_c_api.h
PATH_SUFFIXES include)
# Allow LERC_LIBRARY to be set manually, as the location of the deflate library
if(NOT LERC_LIBRARY)
find_library(LERC_LIBRARY_RELEASE
NAMES ${LERC_NAMES}
PATH_SUFFIXES lib)
include(SelectLibraryConfigurations)
select_library_configurations(LERC)
endif()
unset(LERC_NAMES)
mark_as_advanced(LERC_INCLUDE_DIR)
if(LERC_INCLUDE_DIR AND EXISTS "${LERC_INCLUDE_DIR}/Lerc_c_api.h")
file(STRINGS "${LERC_INCLUDE_DIR}/Lerc_c_api.h" LERC_H REGEX "^#define[\t ]+LERC_VERSION_[A-Z]+[\t ]+[0-9]+")
string(REGEX REPLACE "^.*#define[\t ]+LERC_VERSION_MAJOR[\t ]+([0-9]+).*$" "\\1" LERC_VERSION_MAJOR "${LERC_H}")
string(REGEX REPLACE "^.*#define[\t ]+LERC_VERSION_MINOR[\t ]+([0-9]+).*$" "\\1" LERC_VERSION_MINOR "${LERC_H}")
string(REGEX REPLACE "^.*#define[\t ]+LERC_VERSION_PATCH[\t ]+([0-9]+).*$" "\\1" LERC_VERSION_PATCH "${LERC_H}")
set(LERC_VERSION_STRING "${LERC_VERSION_MAJOR}.${LERC_VERSION_MINOR}.${LERC_VERSION_PATCH}")
unset(LERC_H)
unset(LERC_VERSION_MAJOR)
unset(LERC_VERSION_MINOR)
unset(LERC_VERSION_PATCH)
endif()
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LERC
REQUIRED_VARS LERC_LIBRARY LERC_INCLUDE_DIR
VERSION_VAR LERC_VERSION_STRING)
if(LERC_FOUND)
set(LERC_INCLUDE_DIRS ${LERC_INCLUDE_DIR})
if(NOT LERC_LIBRARIES)
set(LERC_LIBRARIES ${LERC_LIBRARY})
endif()
if(NOT TARGET LERC::LERC)
add_library(LERC::LERC UNKNOWN IMPORTED)
set_target_properties(LERC::LERC PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${LERC_INCLUDE_DIRS}")
if(LERC_LIBRARY_RELEASE)
set_property(TARGET LERC::LERC APPEND PROPERTY
IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(LERC::LERC PROPERTIES
IMPORTED_LOCATION_RELEASE "${LERC_LIBRARY_RELEASE}")
endif()
if(LERC_LIBRARY_DEBUG)
set_property(TARGET LERC::LERC APPEND PROPERTY
IMPORTED_CONFIGURATIONS DEBUG)
set_target_properties(LERC::LERC PROPERTIES
IMPORTED_LOCATION_DEBUG "${LERC_LIBRARY_DEBUG}")
endif()
if(NOT LERC_LIBRARY_RELEASE AND NOT LERC_LIBRARY_DEBUG)
set_target_properties(LERC::LERC PROPERTIES
IMPORTED_LOCATION "${LERC_LIBRARY}")
endif()
endif()
endif()
-91
View File
@@ -1,91 +0,0 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindWebP
--------
Find the native WebP includes and library.
IMPORTED Targets
^^^^^^^^^^^^^^^^
This module defines :prop_tgt:`IMPORTED` target ``WebP::webp``, if
WebP has been found.
Result Variables
^^^^^^^^^^^^^^^^
This module defines the following variables:
::
WebP_INCLUDE_DIRS - where to find webp/*.h, etc.
WebP_LIBRARIES - List of libraries when using webp.
WebP_FOUND - True if webp found.
Debug and Release variants are found separately.
#]=======================================================================]
# Standard names to search for
set(WebP_NAMES webp)
set(WebP_NAMES_DEBUG webpd)
find_path(WebP_INCLUDE_DIR
NAMES webp/decode.h
PATH_SUFFIXES include)
# Allow WebP_LIBRARY to be set manually, as the location of the webp library
if(NOT WebP_LIBRARY)
find_library(WebP_LIBRARY_RELEASE
NAMES ${WebP_NAMES}
PATH_SUFFIXES lib)
find_library(WebP_LIBRARY_DEBUG
NAMES ${WebP_NAMES_DEBUG}
PATH_SUFFIXES lib)
include(SelectLibraryConfigurations)
select_library_configurations(WebP)
endif()
unset(WebP_NAMES)
unset(WebP_NAMES_DEBUG)
mark_as_advanced(WebP_INCLUDE_DIR)
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(WebP
REQUIRED_VARS WebP_LIBRARY WebP_INCLUDE_DIR)
if(WebP_FOUND)
set(WebP_INCLUDE_DIRS ${WebP_INCLUDE_DIR})
if(NOT WebP_LIBRARIES)
set(WebP_LIBRARIES ${WebP_LIBRARY})
endif()
if(NOT TARGET WebP::webp)
add_library(WebP::webp UNKNOWN IMPORTED)
set_target_properties(WebP::webp PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${WebP_INCLUDE_DIRS}")
if(WebP_LIBRARY_RELEASE)
set_property(TARGET WebP::webp APPEND PROPERTY
IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(WebP::webp PROPERTIES
IMPORTED_LOCATION_RELEASE "${WebP_LIBRARY_RELEASE}")
endif()
if(WebP_LIBRARY_DEBUG)
set_property(TARGET WebP::webp APPEND PROPERTY
IMPORTED_CONFIGURATIONS DEBUG)
set_target_properties(WebP::webp PROPERTIES
IMPORTED_LOCATION_DEBUG "${WebP_LIBRARY_DEBUG}")
endif()
if(NOT WebP_LIBRARY_RELEASE AND NOT WebP_LIBRARY_DEBUG)
set_target_properties(WebP::webp PROPERTIES
IMPORTED_LOCATION "${WebP_LIBRARY}")
endif()
endif()
endif()
-107
View File
@@ -1,107 +0,0 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindZSTD
--------
Find the native ZSTD includes and library.
IMPORTED Targets
^^^^^^^^^^^^^^^^
This module defines :prop_tgt:`IMPORTED` target ``ZSTD::ZSTD``, if
ZSTD has been found.
Result Variables
^^^^^^^^^^^^^^^^
This module defines the following variables:
::
ZSTD_INCLUDE_DIRS - where to find zstd.h, etc.
ZSTD_LIBRARIES - List of libraries when using zstd.
ZSTD_FOUND - True if zstd found.
::
ZSTD_VERSION_STRING - The version of zstd found (x.y.z)
ZSTD_VERSION_MAJOR - The major version of zstd
ZSTD_VERSION_MINOR - The minor version of zstd
Debug and Release variants are found separately.
#]=======================================================================]
# Standard names to search for
set(ZSTD_NAMES zstd zstd_static)
set(ZSTD_NAMES_DEBUG zstdd zstd_staticd)
find_path(ZSTD_INCLUDE_DIR
NAMES zstd.h
PATH_SUFFIXES include)
# Allow ZSTD_LIBRARY to be set manually, as the location of the zstd library
if(NOT ZSTD_LIBRARY)
find_library(ZSTD_LIBRARY_RELEASE
NAMES ${ZSTD_NAMES}
PATH_SUFFIXES lib)
find_library(ZSTD_LIBRARY_DEBUG
NAMES ${ZSTD_NAMES_DEBUG}
PATH_SUFFIXES lib)
include(SelectLibraryConfigurations)
select_library_configurations(ZSTD)
endif()
unset(ZSTD_NAMES)
unset(ZSTD_NAMES_DEBUG)
mark_as_advanced(ZSTD_INCLUDE_DIR)
if(ZSTD_INCLUDE_DIR AND EXISTS "${ZSTD_INCLUDE_DIR}/zstd.h")
file(STRINGS "${ZSTD_INCLUDE_DIR}/zstd.h" ZSTD_H REGEX "^#define ZSTD_VERSION_.*$")
string(REGEX REPLACE "^.*ZSTD_VERSION_MAJOR *([0-9]+).*$" "\\1" ZSTD_MAJOR_VERSION "${ZSTD_H}")
string(REGEX REPLACE "^.*ZSTD_VERSION_MINOR *([0-9]+).*$" "\\1" ZSTD_MINOR_VERSION "${ZSTD_H}")
string(REGEX REPLACE "^.*ZSTD_VERSION_RELEASE *([0-9]+).*$" "\\1" ZSTD_PATCH_VERSION "${ZSTD_H}")
set(ZSTD_VERSION_STRING "${ZSTD_MAJOR_VERSION}.${ZSTD_MINOR_VERSION}.${ZSTD_PATCH_VERSION}")
endif()
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(ZSTD
REQUIRED_VARS ZSTD_LIBRARY ZSTD_INCLUDE_DIR
VERSION_VAR ZSTD_VERSION_STRING)
if(ZSTD_FOUND)
set(ZSTD_INCLUDE_DIRS ${ZSTD_INCLUDE_DIR})
if(NOT ZSTD_LIBRARIES)
set(ZSTD_LIBRARIES ${ZSTD_LIBRARY})
endif()
if(NOT TARGET ZSTD::ZSTD)
add_library(ZSTD::ZSTD UNKNOWN IMPORTED)
set_target_properties(ZSTD::ZSTD PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${ZSTD_INCLUDE_DIRS}")
if(ZSTD_LIBRARY_RELEASE)
set_property(TARGET ZSTD::ZSTD APPEND PROPERTY
IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(ZSTD::ZSTD PROPERTIES
IMPORTED_LOCATION_RELEASE "${ZSTD_LIBRARY_RELEASE}")
endif()
if(ZSTD_LIBRARY_DEBUG)
set_property(TARGET ZSTD::ZSTD APPEND PROPERTY
IMPORTED_CONFIGURATIONS DEBUG)
set_target_properties(ZSTD::ZSTD PROPERTIES
IMPORTED_LOCATION_DEBUG "${ZSTD_LIBRARY_DEBUG}")
endif()
if(NOT ZSTD_LIBRARY_RELEASE AND NOT ZSTD_LIBRARY_DEBUG)
set_target_properties(ZSTD::ZSTD PROPERTIES
IMPORTED_LOCATION "${ZSTD_LIBRARY}")
endif()
endif()
endif()
-126
View File
@@ -1,126 +0,0 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
Findliblzma
-----------
Find LZMA compression algorithm headers and library.
Imported Targets
^^^^^^^^^^^^^^^^
.. versionadded:: 3.14
This module defines :prop_tgt:`IMPORTED` target ``liblzma::liblzma``, if
liblzma has been found.
Result variables
^^^^^^^^^^^^^^^^
This module will set the following variables in your project:
``liblzma_FOUND``
True if liblzma headers and library were found.
``LIBLZMA_INCLUDE_DIRS``
Directory where liblzma headers are located.
``LIBLZMA_LIBRARIES``
Lzma libraries to link against.
``LIBLZMA_HAS_AUTO_DECODER``
True if lzma_auto_decoder() is found (required).
``LIBLZMA_HAS_EASY_ENCODER``
True if lzma_easy_encoder() is found (required).
``LIBLZMA_HAS_LZMA_PRESET``
True if lzma_lzma_preset() is found (required).
``LIBLZMA_VERSION_MAJOR``
The major version of lzma
``LIBLZMA_VERSION_MINOR``
The minor version of lzma
``LIBLZMA_VERSION_PATCH``
The patch version of lzma
``LIBLZMA_VERSION_STRING``
version number as a string (ex: "5.0.3")
#]=======================================================================]
find_path(LIBLZMA_INCLUDE_DIR lzma.h )
if(NOT LIBLZMA_LIBRARY)
find_library(LIBLZMA_LIBRARY_RELEASE NAMES lzma liblzma NAMES_PER_DIR PATH_SUFFIXES lib)
find_library(LIBLZMA_LIBRARY_DEBUG NAMES lzmad liblzmad NAMES_PER_DIR PATH_SUFFIXES lib)
include(SelectLibraryConfigurations)
select_library_configurations(LIBLZMA)
else()
file(TO_CMAKE_PATH "${LIBLZMA_LIBRARY}" LIBLZMA_LIBRARY)
endif()
if(LIBLZMA_INCLUDE_DIR AND EXISTS "${LIBLZMA_INCLUDE_DIR}/lzma/version.h")
file(STRINGS "${LIBLZMA_INCLUDE_DIR}/lzma/version.h" LIBLZMA_HEADER_CONTENTS REGEX "#define LZMA_VERSION_[A-Z]+ [0-9]+")
string(REGEX REPLACE ".*#define LZMA_VERSION_MAJOR ([0-9]+).*" "\\1" LIBLZMA_VERSION_MAJOR "${LIBLZMA_HEADER_CONTENTS}")
string(REGEX REPLACE ".*#define LZMA_VERSION_MINOR ([0-9]+).*" "\\1" LIBLZMA_VERSION_MINOR "${LIBLZMA_HEADER_CONTENTS}")
string(REGEX REPLACE ".*#define LZMA_VERSION_PATCH ([0-9]+).*" "\\1" LIBLZMA_VERSION_PATCH "${LIBLZMA_HEADER_CONTENTS}")
set(LIBLZMA_VERSION_STRING "${LIBLZMA_VERSION_MAJOR}.${LIBLZMA_VERSION_MINOR}.${LIBLZMA_VERSION_PATCH}")
unset(LIBLZMA_HEADER_CONTENTS)
endif()
# We're using new code known now as XZ, even library still been called LZMA
# it can be found in http://tukaani.org/xz/
# Avoid using old codebase
if (LIBLZMA_LIBRARY)
include(CheckLibraryExists)
set(CMAKE_REQUIRED_QUIET_SAVE ${CMAKE_REQUIRED_QUIET})
set(CMAKE_REQUIRED_QUIET ${liblzma_FIND_QUIETLY})
if(NOT LIBLZMA_LIBRARY_RELEASE AND NOT LIBLZMA_LIBRARY_DEBUG)
set(LIBLZMA_LIBRARY_check ${LIBLZMA_LIBRARY})
elseif(LIBLZMA_LIBRARY_RELEASE)
set(LIBLZMA_LIBRARY_check ${LIBLZMA_LIBRARY_RELEASE})
elseif(LIBLZMA_LIBRARY_DEBUG)
set(LIBLZMA_LIBRARY_check ${LIBLZMA_LIBRARY_DEBUG})
endif()
CHECK_LIBRARY_EXISTS(${LIBLZMA_LIBRARY_check} lzma_auto_decoder "" LIBLZMA_HAS_AUTO_DECODER)
CHECK_LIBRARY_EXISTS(${LIBLZMA_LIBRARY_check} lzma_easy_encoder "" LIBLZMA_HAS_EASY_ENCODER)
CHECK_LIBRARY_EXISTS(${LIBLZMA_LIBRARY_check} lzma_lzma_preset "" LIBLZMA_HAS_LZMA_PRESET)
unset(LIBLZMA_LIBRARY_check)
set(CMAKE_REQUIRED_QUIET ${CMAKE_REQUIRED_QUIET_SAVE})
endif ()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(liblzma REQUIRED_VARS LIBLZMA_LIBRARY
LIBLZMA_INCLUDE_DIR
LIBLZMA_HAS_AUTO_DECODER
LIBLZMA_HAS_EASY_ENCODER
LIBLZMA_HAS_LZMA_PRESET
VERSION_VAR LIBLZMA_VERSION_STRING
)
mark_as_advanced( LIBLZMA_INCLUDE_DIR LIBLZMA_LIBRARY )
if (liblzma_FOUND)
set(LIBLZMA_LIBRARIES ${LIBLZMA_LIBRARY})
set(LIBLZMA_INCLUDE_DIRS ${LIBLZMA_INCLUDE_DIR})
if(NOT TARGET liblzma::liblzma)
add_library(liblzma::liblzma UNKNOWN IMPORTED)
set_target_properties(liblzma::liblzma PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${LIBLZMA_INCLUDE_DIR}
IMPORTED_LINK_INTERFACE_LANGUAGES C)
if(LIBLZMA_LIBRARY_RELEASE)
set_property(TARGET liblzma::liblzma APPEND PROPERTY
IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(liblzma::liblzma PROPERTIES
IMPORTED_LOCATION_RELEASE "${LIBLZMA_LIBRARY_RELEASE}")
endif()
if(LIBLZMA_LIBRARY_DEBUG)
set_property(TARGET liblzma::liblzma APPEND PROPERTY
IMPORTED_CONFIGURATIONS DEBUG)
set_target_properties(liblzma::liblzma PROPERTIES
IMPORTED_LOCATION_DEBUG "${LIBLZMA_LIBRARY_DEBUG}")
endif()
if(NOT LIBLZMA_LIBRARY_RELEASE AND NOT LIBLZMA_LIBRARY_DEBUG)
set_target_properties(liblzma::liblzma PROPERTIES
IMPORTED_LOCATION "${LIBLZMA_LIBRARY}")
endif()
endif()
endif ()
-36
View File
@@ -1,36 +0,0 @@
# Checks for headers
#
# Copyright © 2015 Open Microscopy Environment / University of Dundee
# Copyright © 2021 Roger Leigh <rleigh@codelibre.net>
# Written by Roger Leigh <rleigh@codelibre.net>
#
# Permission to use, copy, modify, distribute, and sell this software and
# its documentation for any purpose is hereby granted without fee, provided
# that (i) the above copyright notices and this permission notice appear in
# all copies of the software and related documentation, and (ii) the names of
# Sam Leffler and Silicon Graphics may not be used in any advertising or
# publicity relating to the software without the specific, prior written
# permission of Sam Leffler and Silicon Graphics.
#
# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
#
# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
# OF THIS SOFTWARE.
include(CheckIncludeFile)
check_include_file(assert.h HAVE_ASSERT_H)
check_include_file(fcntl.h HAVE_FCNTL_H)
check_include_file(io.h HAVE_IO_H)
check_include_file(strings.h HAVE_STRINGS_H)
check_include_file(sys/time.h HAVE_SYS_TIME_H)
check_include_file(sys/types.h HAVE_SYS_TYPES_H)
check_include_file(unistd.h HAVE_UNISTD_H)
-46
View File
@@ -1,46 +0,0 @@
# Options to enable and disable internal codecs
#
# Copyright © 2015 Open Microscopy Environment / University of Dundee
# Copyright © 2021 Roger Leigh <rleigh@codelibre.net>
# Written by Roger Leigh <rleigh@codelibre.net>
#
# Permission to use, copy, modify, distribute, and sell this software and
# its documentation for any purpose is hereby granted without fee, provided
# that (i) the above copyright notices and this permission notice appear in
# all copies of the software and related documentation, and (ii) the names of
# Sam Leffler and Silicon Graphics may not be used in any advertising or
# publicity relating to the software without the specific, prior written
# permission of Sam Leffler and Silicon Graphics.
#
# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
#
# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
# OF THIS SOFTWARE.
option(ccitt "support for CCITT Group 3 & 4 algorithms" ON)
set(CCITT_SUPPORT ${ccitt})
option(packbits "support for Macintosh PackBits algorithm" ON)
set(PACKBITS_SUPPORT ${packbits})
option(lzw "support for LZW algorithm" ON)
set(LZW_SUPPORT ${lzw})
option(thunder "support for ThunderScan 4-bit RLE algorithm" ON)
set(THUNDER_SUPPORT ${thunder})
option(next "support for NeXT 2-bit RLE algorithm" ON)
set(NEXT_SUPPORT ${next})
option(logluv "support for LogLuv high dynamic range algorithm" ON)
set(LOGLUV_SUPPORT ${logluv})
option(mdi "support for Microsoft Document Imaging" ON)
set(MDI_SUPPORT ${mdi})
-47
View File
@@ -1,47 +0,0 @@
# Checks for JBIG codec support
#
# Copyright © 2015 Open Microscopy Environment / University of Dundee
# Copyright © 2021 Roger Leigh <rleigh@codelibre.net>
# Written by Roger Leigh <rleigh@codelibre.net>
#
# Permission to use, copy, modify, distribute, and sell this software and
# its documentation for any purpose is hereby granted without fee, provided
# that (i) the above copyright notices and this permission notice appear in
# all copies of the software and related documentation, and (ii) the names of
# Sam Leffler and Silicon Graphics may not be used in any advertising or
# publicity relating to the software without the specific, prior written
# permission of Sam Leffler and Silicon Graphics.
#
# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
#
# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
# OF THIS SOFTWARE.
# JBIG-KIT
set(JBIG_SUPPORT FALSE)
find_package(JBIG)
if(JBIG_FOUND)
set(CMAKE_REQUIRED_INCLUDES_SAVE ${CMAKE_REQUIRED_INCLUDES})
set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${JBIG_INCLUDE_DIRS})
set(CMAKE_REQUIRED_LIBRARIES_SAVE ${CMAKE_REQUIRED_LIBRARIES})
set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${JBIG_LIBRARIES})
check_symbol_exists(jbg_newlen "jbig.h" HAVE_JBG_NEWLEN)
set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES_SAVE})
set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES_SAVE})
endif()
option(jbig "use ISO JBIG compression (requires JBIT-KIT library)" ${JBIG_FOUND})
if (jbig AND JBIG_FOUND)
set(JBIG_SUPPORT TRUE)
endif()
-84
View File
@@ -1,84 +0,0 @@
# Checks for JPEG codec support
#
# Copyright © 2015 Open Microscopy Environment / University of Dundee
# Copyright © 2021 Roger Leigh <rleigh@codelibre.net>
# Written by Roger Leigh <rleigh@codelibre.net>
#
# Permission to use, copy, modify, distribute, and sell this software and
# its documentation for any purpose is hereby granted without fee, provided
# that (i) the above copyright notices and this permission notice appear in
# all copies of the software and related documentation, and (ii) the names of
# Sam Leffler and Silicon Graphics may not be used in any advertising or
# publicity relating to the software without the specific, prior written
# permission of Sam Leffler and Silicon Graphics.
#
# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
#
# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
# OF THIS SOFTWARE.
# JPEG
set(JPEG_SUPPORT FALSE)
find_package(JPEG)
option(jpeg "use libjpeg (required for JPEG compression)" ${JPEG_FOUND})
if (jpeg AND JPEG_FOUND)
set(JPEG_SUPPORT TRUE)
endif()
# Old-jpeg
set(OJPEG_SUPPORT FALSE)
option(old-jpeg "support for Old JPEG compression (read-only)" ${JPEG_SUPPORT})
if (old-jpeg AND JPEG_SUPPORT)
set(OJPEG_SUPPORT TRUE)
endif()
if (JPEG_SUPPORT)
# Check for jpeg12_read_scanlines() which has been added in libjpeg-turbo 2.2
# for dual 8/12 bit mode.
include(CheckCSourceCompiles)
include(CMakePushCheckState)
cmake_push_check_state(RESET)
set(CMAKE_REQUIRED_INCLUDES "${JPEG_INCLUDE_DIRS}")
set(CMAKE_REQUIRED_LIBRARIES "${JPEG_LIBRARIES}")
check_c_source_compiles(
"
#include <stddef.h>
#include <stdio.h>
#include \"jpeglib.h\"
int main()
{
jpeg_read_scanlines(0,0,0);
jpeg12_read_scanlines(0,0,0);
return 0;
}
"
HAVE_JPEGTURBO_DUAL_MODE_8_12)
cmake_pop_check_state()
endif()
if (NOT HAVE_JPEGTURBO_DUAL_MODE_8_12)
# 12-bit jpeg mode in a dedicated libjpeg12 library
set(JPEG12_INCLUDE_DIR JPEG12_INCLUDE_DIR-NOTFOUND CACHE PATH "Include directory for 12-bit libjpeg")
set(JPEG12_LIBRARY JPEG12_LIBRARY-NOTFOUND CACHE FILEPATH "12-bit libjpeg library")
set(JPEG_DUAL_MODE_8_12 FALSE)
if (JPEG12_INCLUDE_DIR AND JPEG12_LIBRARY)
set(JPEG12_LIBRARIES ${JPEG12_LIBRARY})
set(JPEG12_FOUND TRUE)
else()
set(JPEG12_FOUND FALSE)
endif()
option(jpeg12 "enable libjpeg 8/12-bit dual mode (requires separate 12-bit libjpeg build)" ${JPEG12_FOUND})
if (jpeg12 AND JPEG12_FOUND)
set(JPEG_DUAL_MODE_8_12 TRUE)
set(LIBJPEG_12_PATH "${JPEG12_INCLUDE_DIR}/jpeglib.h")
endif()
endif()
-32
View File
@@ -1,32 +0,0 @@
# Checks for LERC codec support
#
# Copyright © 2021 Antonio Valentino <antonio.valentino@tiscali.it>
# Written by Antonio Valentino <antonio.valentino@tiscali.it>
#
# Permission to use, copy, modify, distribute, and sell this software and
# its documentation for any purpose is hereby granted without fee, provided
# that (i) the above copyright notices and this permission notice appear in
# all copies of the software and related documentation, and (ii) the names of
# Sam Leffler and Silicon Graphics may not be used in any advertising or
# publicity relating to the software without the specific, prior written
# permission of Sam Leffler and Silicon Graphics.
#
# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
#
# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
# OF THIS SOFTWARE.
# libLerc
set(LERC_SUPPORT FALSE)
find_package(LERC)
option(lerc "use libLerc (required for LERC compression)" ${LERC_FOUND})
if (lerc AND LERC_FOUND AND ZIP_SUPPORT)
set(LERC_SUPPORT TRUE)
endif()
-34
View File
@@ -1,34 +0,0 @@
# Checks for LZMA codec support
#
# Copyright © 2015 Open Microscopy Environment / University of Dundee
# Copyright © 2021 Roger Leigh <rleigh@codelibre.net>
# Written by Roger Leigh <rleigh@codelibre.net>
#
# Permission to use, copy, modify, distribute, and sell this software and
# its documentation for any purpose is hereby granted without fee, provided
# that (i) the above copyright notices and this permission notice appear in
# all copies of the software and related documentation, and (ii) the names of
# Sam Leffler and Silicon Graphics may not be used in any advertising or
# publicity relating to the software without the specific, prior written
# permission of Sam Leffler and Silicon Graphics.
#
# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
#
# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
# OF THIS SOFTWARE.
# liblzma2
set(LZMA_SUPPORT FALSE)
find_package(liblzma)
option(lzma "use liblzma (required for LZMA2 compression)" ${LIBLZMA_FOUND})
if (lzma AND LIBLZMA_FOUND)
set(LZMA_SUPPORT TRUE)
endif()
-32
View File
@@ -1,32 +0,0 @@
# Large file support
#
# Copyright © 2015 Open Microscopy Environment / University of Dundee
# Copyright © 2021 Roger Leigh <rleigh@codelibre.net>
# Written by Roger Leigh <rleigh@codelibre.net>
#
# Permission to use, copy, modify, distribute, and sell this software and
# its documentation for any purpose is hereby granted without fee, provided
# that (i) the above copyright notices and this permission notice appear in
# all copies of the software and related documentation, and (ii) the names of
# Sam Leffler and Silicon Graphics may not be used in any advertising or
# publicity relating to the software without the specific, prior written
# permission of Sam Leffler and Silicon Graphics.
#
# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
#
# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
# OF THIS SOFTWARE.
if (UNIX OR MINGW)
# This might not catch every possibility catered for by
# Autoconf AC_SYS_LARGEFILE.
add_definitions(-D_FILE_OFFSET_BITS=64)
set(FILE_OFFSET_BITS 64)
endif()
-62
View File
@@ -1,62 +0,0 @@
# C library features
#
# Copyright © 2015 Open Microscopy Environment / University of Dundee
# Copyright © 2021 Roger Leigh <rleigh@codelibre.net>
# Written by Roger Leigh <rleigh@codelibre.net>
#
# Permission to use, copy, modify, distribute, and sell this software and
# its documentation for any purpose is hereby granted without fee, provided
# that (i) the above copyright notices and this permission notice appear in
# all copies of the software and related documentation, and (ii) the names of
# Sam Leffler and Silicon Graphics may not be used in any advertising or
# publicity relating to the software without the specific, prior written
# permission of Sam Leffler and Silicon Graphics.
#
# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
#
# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
# OF THIS SOFTWARE.
# Strip chopping
option(strip-chopping "strip chopping (whether or not to convert single-strip uncompressed images to mutiple strips of specified size to reduce memory usage)" ON)
set(TIFF_DEFAULT_STRIP_SIZE 8192 CACHE STRING "default size of the strip in bytes (when strip chopping is enabled)")
set(STRIPCHOP_DEFAULT)
if(strip-chopping)
set(STRIPCHOP_DEFAULT TRUE)
if(TIFF_DEFAULT_STRIP_SIZE)
set(STRIP_SIZE_DEFAULT "${TIFF_DEFAULT_STRIP_SIZE}")
endif()
endif()
set(TIFF_MAX_DIR_COUNT 1048576 CACHE STRING "Maximum number of TIFF directories that libtiff can browse through")
# Defer loading of strip/tile offsets
option(defer-strile-load "enable deferred strip/tile offset/size loading (also available at runtime with the 'D' flag of TIFFOpen())" OFF)
set(DEFER_STRILE_LOAD ${defer-strile-load})
# CHUNKY_STRIP_READ_SUPPORT
option(chunky-strip-read "enable reading large strips in chunks for TIFFReadScanline() (experimental)" OFF)
set(CHUNKY_STRIP_READ_SUPPORT ${chunky-strip-read})
# SUBIFD support
set(SUBIFD_SUPPORT 1)
# Default handling of ASSOCALPHA support.
option(extrasample-as-alpha "the RGBA interface will treat a fourth sample with no EXTRASAMPLE_ value as being ASSOCALPHA. Many packages produce RGBA files but don't mark the alpha properly" ON)
if(extrasample-as-alpha)
set(DEFAULT_EXTRASAMPLE_AS_ALPHA 1)
endif()
# Default handling of YCbCr subsampling support.
# See Bug 168 in Bugzilla, and JPEGFixupTestSubsampling() for details.
option(check-ycbcr-subsampling "enable picking up YCbCr subsampling info from the JPEG data stream to support files lacking the tag" ON)
if (check-ycbcr-subsampling)
set(CHECK_JPEG_YCBCR_SUBSAMPLING 1)
endif()
-50
View File
@@ -1,50 +0,0 @@
# Check linker capabilities
#
# Copyright © 2015 Open Microscopy Environment / University of Dundee
# Copyright © 2021 Roger Leigh <rleigh@codelibre.net>
# Written by Roger Leigh <rleigh@codelibre.net>
#
# Permission to use, copy, modify, distribute, and sell this software and
# its documentation for any purpose is hereby granted without fee, provided
# that (i) the above copyright notices and this permission notice appear in
# all copies of the software and related documentation, and (ii) the names of
# Sam Leffler and Silicon Graphics may not be used in any advertising or
# publicity relating to the software without the specific, prior written
# permission of Sam Leffler and Silicon Graphics.
#
# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
#
# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
# OF THIS SOFTWARE.
include(CheckCSourceCompiles)
option(ld-version-script "Enable linker version script" ON)
# Check if LD supports linker scripts.
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/conftest.map" "VERS_1 {
global: sym;
};
VERS_2 {
global: sym;
} VERS_1;
")
set(CMAKE_REQUIRED_FLAGS_SAVE ${CMAKE_REQUIRED_FLAGS})
set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS} "-Wl,--version-script=${CMAKE_CURRENT_BINARY_DIR}/conftest.map")
check_c_source_compiles("int main(void){return 0;}" HAVE_LD_VERSION_SCRIPT)
set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS_SAVE})
file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/conftest.map")
if (ld-version-script AND HAVE_LD_VERSION_SCRIPT)
set(HAVE_LD_VERSION_SCRIPT TRUE)
else()
set(HAVE_LD_VERSION_SCRIPT FALSE)
endif()
-50
View File
@@ -1,50 +0,0 @@
# Checks for OpenGL and GLUT support
#
# Copyright © 2015 Open Microscopy Environment / University of Dundee
# Copyright © 2021 Roger Leigh <rleigh@codelibre.net>
# Written by Roger Leigh <rleigh@codelibre.net>
#
# Permission to use, copy, modify, distribute, and sell this software and
# its documentation for any purpose is hereby granted without fee, provided
# that (i) the above copyright notices and this permission notice appear in
# all copies of the software and related documentation, and (ii) the names of
# Sam Leffler and Silicon Graphics may not be used in any advertising or
# publicity relating to the software without the specific, prior written
# permission of Sam Leffler and Silicon Graphics.
#
# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
#
# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
# OF THIS SOFTWARE.
# OpenGL and GLUT
set(OpenGL_GL_PREFERENCE LEGACY)
find_package(OpenGL COMPONENTS OpenGL)
find_package(GLUT)
set(OPENGL_SUPPORT FALSE)
set(HAVE_OPENGL FALSE)
if(OPENGL_FOUND AND OPENGL_GLU_FOUND AND GLUT_FOUND)
set(HAVE_OPENGL TRUE)
endif()
# Purely to satisfy the generated headers:
check_include_file(GL/gl.h HAVE_GL_GL_H)
check_include_file(GL/glu.h HAVE_GL_GLU_H)
check_include_file(GL/glut.h HAVE_GL_GLUT_H)
check_include_file(GLUT/glut.h HAVE_GLUT_GLUT_H)
check_include_file(OpenGL/gl.h HAVE_OPENGL_GL_H)
check_include_file(OpenGL/glu.h HAVE_OPENGL_GLU_H)
option(tiff-opengl "use OpenGL (required for tiffgt viewer)" ${HAVE_OPENGL})
if (tiff-opengl AND HAVE_OPENGL)
set(OPENGL_SUPPORT TRUE)
endif()
-33
View File
@@ -1,33 +0,0 @@
# Checks for PixarLog codec support
#
# Copyright © 2015 Open Microscopy Environment / University of Dundee
# Copyright © 2021 Roger Leigh <rleigh@codelibre.net>
# Written by Roger Leigh <rleigh@codelibre.net>
#
# Permission to use, copy, modify, distribute, and sell this software and
# its documentation for any purpose is hereby granted without fee, provided
# that (i) the above copyright notices and this permission notice appear in
# all copies of the software and related documentation, and (ii) the names of
# Sam Leffler and Silicon Graphics may not be used in any advertising or
# publicity relating to the software without the specific, prior written
# permission of Sam Leffler and Silicon Graphics.
#
# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
#
# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
# OF THIS SOFTWARE.
# Option for Pixar log-format algorithm
# Pixar log format
set(PIXARLOG_SUPPORT FALSE)
option(pixarlog "support for Pixar log-format algorithm (requires Zlib)" ${ZLIB_SUPPORT})
if(pixarlog AND ZLIB_SUPPORT)
set(PIXARLOG_SUPPORT TRUE)
endif()
-69
View File
@@ -1,69 +0,0 @@
# pkg-config support
#
# Copyright © 2015 Open Microscopy Environment / University of Dundee
# Copyright © 2021 Roger Leigh <rleigh@codelibre.net>
# Written by Roger Leigh <rleigh@codelibre.net>
#
# Permission to use, copy, modify, distribute, and sell this software and
# its documentation for any purpose is hereby granted without fee, provided
# that (i) the above copyright notices and this permission notice appear in
# all copies of the software and related documentation, and (ii) the names of
# Sam Leffler and Silicon Graphics may not be used in any advertising or
# publicity relating to the software without the specific, prior written
# permission of Sam Leffler and Silicon Graphics.
#
# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
#
# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
# OF THIS SOFTWARE.
# Post-process lib files into linker flags
function(set_libs_private out_var)
set(tiff_libs_private "")
foreach(lib IN LISTS ARGN)
get_filename_component(name "${lib}" NAME)
foreach(prefix IN LISTS CMAKE_FIND_LIBRARY_PREFIXES)
if(NOT("${prefix}" STREQUAL "") AND name MATCHES "^${prefix}")
string(REGEX REPLACE "^${prefix}" "" name "${name}")
break()
endif()
endforeach()
foreach(suffix IN LISTS CMAKE_FIND_LIBRARY_SUFFIXES)
if(NOT("${suffix}" STREQUAL "") AND name MATCHES "${suffix}$")
string(REGEX REPLACE "${suffix}$" "" name "${name}")
break()
endif()
endforeach()
string(APPEND tiff_libs_private " -l${name}")
endforeach()
set(${out_var} "${tiff_libs_private}" PARENT_SCOPE)
endfunction()
# Generate pkg-config file
set(prefix "${CMAKE_INSTALL_PREFIX}")
set(exec_prefix "\${prefix}")
if(IS_ABSOLUTE "${CMAKE_INSTALL_LIBDIR}")
set(libdir "${CMAKE_INSTALL_LIBDIR}")
else()
set(libdir "\${exec_prefix}/${CMAKE_INSTALL_LIBDIR}")
endif()
if(IS_ABSOLUTE "${CMAKE_INSTALL_INCLUDEDIR}")
set(includedir "${CMAKE_INSTALL_INCLUDEDIR}")
else()
set(includedir "\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}")
endif()
set_libs_private(tiff_libs_private ${tiff_libs_private_list})
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libtiff-4.pc.in
${CMAKE_CURRENT_BINARY_DIR}/libtiff-4.pc @ONLY)
# Install pkg-config file
if (tiff-install)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libtiff-4.pc
DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
endif()
-36
View File
@@ -1,36 +0,0 @@
# Processor capability checks
#
# Copyright © 2015 Open Microscopy Environment / University of Dundee
# Copyright © 2021 Roger Leigh <rleigh@codelibre.net>
# Written by Roger Leigh <rleigh@codelibre.net>
#
# Permission to use, copy, modify, distribute, and sell this software and
# its documentation for any purpose is hereby granted without fee, provided
# that (i) the above copyright notices and this permission notice appear in
# all copies of the software and related documentation, and (ii) the names of
# Sam Leffler and Silicon Graphics may not be used in any advertising or
# publicity relating to the software without the specific, prior written
# permission of Sam Leffler and Silicon Graphics.
#
# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
#
# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
# OF THIS SOFTWARE.
include(TestBigEndian)
# CPU endianness
test_big_endian(HOST_BIG_ENDIAN)
if(HOST_BIG_ENDIAN)
add_definitions(-DWORDS_BIGENDIAN)
endif()
# IEEE floating point
set(HAVE_IEEEFP 1)
-47
View File
@@ -1,47 +0,0 @@
# Release support
#
# Copyright © 2021 Roger Leigh <rleigh@codelibre.net>
# Written by Roger Leigh <rleigh@codelibre.net>
#
# Permission to use, copy, modify, distribute, and sell this software and
# its documentation for any purpose is hereby granted without fee, provided
# that (i) the above copyright notices and this permission notice appear in
# all copies of the software and related documentation, and (ii) the names of
# Sam Leffler and Silicon Graphics may not be used in any advertising or
# publicity relating to the software without the specific, prior written
# permission of Sam Leffler and Silicon Graphics.
#
# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
#
# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
# OF THIS SOFTWARE.
# Add target tiff_release to update the version information in the root files
# VERSION and RELEASE-DATE.
add_custom_target(tiff_release
COMMAND ${CMAKE_COMMAND}
"-DSOURCE_DIR:PATH=${PROJECT_SOURCE_DIR}"
"-DLIBTIFF_VERSION=${PROJECT_VERSION}"
"-DLIBTIFF_BASIC_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}"
"-DLIBTIFF_BASIC_BINARY_DIR=${CMAKE_CURRENT_BINARY_DIR}"
-P "${CMAKE_CURRENT_LIST_DIR}/ReleaseScript.cmake"
COMMENT "Releasing ${PROJECT_NAME} ${PROJECT_VERSION} ...")
# Version information is taken from configure.ac
# Note: Single command "cmake --build . --target tiff_release"
# does not work correctly, because version information is taken from CMakeCache.txt,
# which is not updated by cmake --build.
# Therefore, force CMake re-configure if configure.ac has changed.
# By the way, release-date and VERSION will not change but only when --targt tiff_release is called.
set_property(
DIRECTORY
APPEND
PROPERTY CMAKE_CONFIGURE_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/configure.ac
)
-42
View File
@@ -1,42 +0,0 @@
# Release support
#
# Copyright © 2021 Roger Leigh <rleigh@codelibre.net>
# Written by Roger Leigh <rleigh@codelibre.net>
#
# Permission to use, copy, modify, distribute, and sell this software and
# its documentation for any purpose is hereby granted without fee, provided
# that (i) the above copyright notices and this permission notice appear in
# all copies of the software and related documentation, and (ii) the names of
# Sam Leffler and Silicon Graphics may not be used in any advertising or
# publicity relating to the software without the specific, prior written
# permission of Sam Leffler and Silicon Graphics.
#
# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
#
# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
# OF THIS SOFTWARE.
# Update release date to current date
string(TIMESTAMP LIBTIFF_RELEASE_DATE "%Y%m%d")
# Update version information in all relevant files
message(STATUS "Setting release version to ${LIBTIFF_VERSION}")
message(STATUS "Setting release date to ${LIBTIFF_RELEASE_DATE}")
# Only needed here, for manual build of target tiff_release
# because otherwise tiffvers.h is generated when building all targets.
configure_file(${LIBTIFF_BASIC_SOURCE_DIR}/libtiff/tiffvers.h.cmake.in
${LIBTIFF_BASIC_BINARY_DIR}/libtiff/tiffvers.h
@ONLY)
# Write version information and release date to root files.
FILE(WRITE ${LIBTIFF_BASIC_SOURCE_DIR}/VERSION "${LIBTIFF_VERSION}" \n)
FILE(WRITE ${LIBTIFF_BASIC_SOURCE_DIR}/RELEASE-DATE "${LIBTIFF_RELEASE_DATE}" \n)
message(STATUS "Files tiffvers.h, VERSION and RELEASE-DATE updated.")
-93
View File
@@ -1,93 +0,0 @@
# #%L
# OME Files C++ libraries (cmake build infrastructure)
# %%
# Copyright © 2015 Open Microscopy Environment:
# - Massachusetts Institute of Technology
# - National Institutes of Health
# - University of Dundee
# - Board of Regents of the University of Wisconsin-Madison
# - Glencoe Software, Inc.
# %%
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
# The views and conclusions contained in the software and documentation are
# those of the authors and should not be interpreted as representing official
# policies, either expressed or implied, of any organization.
# #L%
find_package(Python3 COMPONENTS Interpreter)
# Sphinx documentation generator
find_program(SPHINX_BUILD sphinx-build)
if (SPHINX_BUILD)
message(STATUS "Looking for sphinx-build - ${SPHINX_BUILD}")
else()
message(STATUS "Looking for sphinx-build - not found")
endif()
set(SPHINX_DEFAULT OFF)
if(SPHINX_BUILD)
set(SPHINX_DEFAULT ON)
endif()
option(sphinx "Enable sphinx manual page and HTML documentation" ${SPHINX_DEFAULT})
option(sphinx-linkcheck "Check sphinx documentation links by default" OFF)
set(BUILD_SPHINX ${sphinx})
set(SPHINX_LIST_DIR ${CMAKE_CURRENT_LIST_DIR})
function(sphinx_manpages srcdir builddir manvar)
execute_process(COMMAND "${Python3_EXECUTABLE}" -B ${SPHINX_LIST_DIR}/list-manpages.py
"${srcdir}" "${builddir}"
RESULT_VARIABLE sphinx_man_fail
OUTPUT_VARIABLE MAN_PAGES)
if (sphinx_man_fail)
message(WARNING "Failed to get generated sphinx manual pages from ${confdir}")
endif()
string(REPLACE "\n" ";" MAN_PAGES "${MAN_PAGES}")
set(${manvar} "${MAN_PAGES}" PARENT_SCOPE)
message(STATUS "Sphinx manual pages: ${MAN_PAGES}")
endfunction(sphinx_manpages)
function(sphinx_manpage_dependencies srcdir depvar)
execute_process(COMMAND "${Python3_EXECUTABLE}" -B ${SPHINX_LIST_DIR}/list-manpage-dependencies.py
"${srcdir}"
RESULT_VARIABLE sphinx_dep_fail
OUTPUT_VARIABLE SPHINX_MAN_DEPENDENCIES)
if (sphinx_dep_fail)
message(WARNING "Failed to get Sphinx dependencies from ${confdir}")
endif()
string(REPLACE "\n" ";" SPHINX_MAN_DEPENDENCIES "${SPHINX_MAN_DEPENDENCIES}")
set(${depvar} "${SPHINX_MAN_DEPENDENCIES}" PARENT_SCOPE)
endfunction(sphinx_manpage_dependencies)
function(sphinx_dependencies srcdir depvar)
file(GLOB_RECURSE CRUDE_SPHINX_DEPENDENCIES "${srcdir}/*.rst")
foreach(file ${CRUDE_SPHINX_DEPENDENCIES})
string(FIND "${file}" "_build" FILE_MATCH)
if(FILE_MATCH EQUAL -1)
list(APPEND SPHINX_DEPENDENCIES "${file}")
endif()
endforeach()
set(${depvar} "${SPHINX_DEPENDENCIES}" PARENT_SCOPE)
endfunction(sphinx_dependencies)
-87
View File
@@ -1,87 +0,0 @@
# Check "local" sphinx links, using files in the build tree and in the
# install tree (other components)
message(STATUS "Checking internal links")
set(failed OFF)
file(STRINGS "${OUTPUT}" output)
file(REMOVE "${OUTPUT}.new")
foreach(line IN LISTS output)
# Parse the filename, link type, link and anchor from each line
string(REGEX MATCH "^.*: \\[.*\\] .*" line_match "${line}")
string(REGEX MATCH "^.*: \\[.*\\] .*#.*" anchor_match "${line}")
if(line_match)
string(REGEX REPLACE "^(.*): \\[(.*)\\] (.*)" "\\1" filename "${line}")
string(REGEX REPLACE "^(.*): \\[(.*)\\] (.*)" "\\2" type "${line}")
if(anchor_match)
string(REGEX REPLACE "^(.*): \\[(.*)\\] (.*)#(.*)" "\\3" link "${line}")
string(REGEX REPLACE "^(.*): \\[(.*)\\] (.*)#(.*)" "\\4" link "${anchor}")
else()
string(REGEX REPLACE "^(.*): \\[(.*)\\] (.*)" "\\3" link "${line}")
unset(anchor)
endif()
# Only check local links
if(type STREQUAL "local")
# Compute path relative to our install path
file(RELATIVE_PATH relpath "/" "/${SPHINX_INSTALL_PATH}/${link}")
# Check sphinx link in the install tree
unset(linkfile)
if(EXISTS "${EXTERNAL_REFERENCE}/${relpath}")
set(linkfile "${EXTERNAL_REFERENCE}/${relpath}")
endif()
# Check sphinx link in the build tree
if(EXISTS "${INTERNAL_REFERENCE}/${link}")
set(linkfile "${INTERNAL_REFERENCE}/${link}")
endif()
# Check doxygen link in the install tree
if(EXISTS "${DOXYGEN_REFERENCE}/${link}")
set(linkfile "${DOXYGEN_REFERENCE}/${link}")
endif()
# Check doxygen link in the build tree
if(DOXYGEN_REFERENCE AND DOXYGEN_INSTALL_PATH)
string(REGEX REPLACE "^${DOXYGEN_INSTALL_PATH}/(.*)" "\\1" doxygen_path "${relpath}")
if(EXISTS "${DOXYGEN_REFERENCE}/${doxygen_path}")
set(linkfile "${DOXYGEN_REFERENCE}/${doxygen_path}")
endif()
endif()
# Check link and any anchor. If the link does not exist, or the
# anchor does not exist, set the link type to broken when
# rewriting the output file with our test results.
if(linkfile)
if(anchor)
file(STRINGS "${linkfile}" anchor_matches REGEX "<a +class=\"anchor\" +id=\"${anchor}\"")
if(anchor_matches)
file(APPEND "${OUTPUT}.new" "${filename}: [${type}] ${link}#${anchor}\n")
else()
set(failed ON)
file(APPEND "${OUTPUT}.new" "${filename}: [broken] ${link}#${anchor}\n")
message(STATUS "Broken link: ${filename}: ${link}#${anchor}")
endif()
else()
file(APPEND "${OUTPUT}.new" "${filename}: [${type}] ${link}\n")
endif()
else()
set(failed ON)
file(APPEND "${OUTPUT}.new" "${filename}: [broken] ${link}\n")
message(STATUS "Broken link: ${filename}: ${link}")
endif()
else()
if(type STREQUAL "broken")
set(failed ON)
message(STATUS "Broken link: ${filename}: ${link}")
endif()
file(APPEND "${OUTPUT}.new" "${filename}: [${type}] ${link}\n")
endif()
else()
file(APPEND "${OUTPUT}.new" "${line}\n")
endif()
endforeach()
file(RENAME "${OUTPUT}.new" "${OUTPUT}")
if(failed)
message(FATAL_ERROR "Broken links detected")
endif()
-43
View File
@@ -1,43 +0,0 @@
# Checks for symbols
#
# Copyright © 2015 Open Microscopy Environment / University of Dundee
# Copyright © 2021 Roger Leigh <rleigh@codelibre.net>
# Written by Roger Leigh <rleigh@codelibre.net>
#
# Permission to use, copy, modify, distribute, and sell this software and
# its documentation for any purpose is hereby granted without fee, provided
# that (i) the above copyright notices and this permission notice appear in
# all copies of the software and related documentation, and (ii) the names of
# Sam Leffler and Silicon Graphics may not be used in any advertising or
# publicity relating to the software without the specific, prior written
# permission of Sam Leffler and Silicon Graphics.
#
# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
#
# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
# OF THIS SOFTWARE.
include(CheckSymbolExists)
# Check for getopt
check_symbol_exists(getopt "unistd.h;stdio.h" HAVE_GETOPT)
check_symbol_exists(optarg "getopt.h" HAVE_DECL_OPTARG)
if (HAVE_DECL_OPTARG)
set(HAVE_DECL_OPTARG 1)
else()
set(HAVE_DECL_OPTARG 0)
endif()
# Check for mmap
check_symbol_exists(mmap "sys/mman.h" HAVE_MMAP)
# Check for setmode
check_symbol_exists(setmode "unistd.h" HAVE_SETMODE)
-27
View File
@@ -1,27 +0,0 @@
if(NOT "@BUILD_SHARED_LIBS@")
# TODO: import dependencies
endif()
function(set_variable_from_rel_or_absolute_path var root rel_or_abs_path)
if(IS_ABSOLUTE "${rel_or_abs_path}")
set(${var} "${rel_or_abs_path}" PARENT_SCOPE)
else()
set(${var} "${root}/${rel_or_abs_path}" PARENT_SCOPE)
endif()
endfunction()
# Tell the user project where to find our headers and libraries
get_filename_component(_DIR "${CMAKE_CURRENT_LIST_DIR}/../../.." ABSOLUTE)
get_filename_component(_ROOT "${_DIR}/@PROJECT_ROOT_DIR@" ABSOLUTE)
# Use _ROOT as prefix here for the possibility of relocation after installation.
set_variable_from_rel_or_absolute_path("TIFF_INCLUDE_DIR" "${_ROOT}" "@CMAKE_INSTALL_INCLUDEDIR@")
set(TIFF_INCLUDE_DIRS ${TIFF_INCLUDE_DIR})
set(TIFF_LIBRARIES TIFF::tiff)
if(NOT TARGET TIFF::tiff)
include("${CMAKE_CURRENT_LIST_DIR}/TiffTargets.cmake")
endif()
unset (_ROOT)
unset (_DIR)
-54
View File
@@ -1,54 +0,0 @@
# Check type sizes
#
# Copyright © 2015 Open Microscopy Environment / University of Dundee
# Copyright © 2021 Roger Leigh <rleigh@codelibre.net>
# Written by Roger Leigh <rleigh@codelibre.net>
#
# Permission to use, copy, modify, distribute, and sell this software and
# its documentation for any purpose is hereby granted without fee, provided
# that (i) the above copyright notices and this permission notice appear in
# all copies of the software and related documentation, and (ii) the names of
# Sam Leffler and Silicon Graphics may not be used in any advertising or
# publicity relating to the software without the specific, prior written
# permission of Sam Leffler and Silicon Graphics.
#
# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
#
# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
# OF THIS SOFTWARE.
include("CheckTypeSize")
set(CMAKE_EXTRA_INCLUDE_FILES_SAVE ${CMAKE_EXTRA_INCLUDE_FILES})
set(CMAKE_EXTRA_INCLUDE_FILES ${CMAKE_EXTRA_INCLUDE_FILES} "stddef.h")
check_type_size("size_t" SIZEOF_SIZE_T)
set(CMAKE_EXTRA_INCLUDE_FILES ${CMAKE_EXTRA_INCLUDE_FILES_SAVE})
# C99 fixed-size integer types
set(TIFF_INT8_T "int8_t")
set(TIFF_UINT8_T "uint8_t")
set(TIFF_INT16_T "int16_t")
set(TIFF_UINT16_T "uint16_t")
set(TIFF_INT32_T "int32_t")
set(TIFF_UINT32_T "uint32_t")
set(TIFF_INT64_T "int64_t")
set(TIFF_UINT64_T "uint64_t")
# size_t and TIFF signed size-type
if(SIZEOF_SIZE_T EQUAL 4)
set(TIFF_SSIZE_T "int32_t")
elseif(SIZEOF_SIZE_T EQUAL 8)
set(TIFF_SSIZE_T "int64_t")
else()
message(FATAL_ERROR "Unsupported size_t size ${SIZEOF_SIZE_T}; please add support")
endif()
-35
View File
@@ -1,35 +0,0 @@
# Checks for WebP codec support
#
# Copyright © 2015 Open Microscopy Environment / University of Dundee
# Copyright © 2021 Roger Leigh <rleigh@codelibre.net>
# Written by Roger Leigh <rleigh@codelibre.net>
#
# Permission to use, copy, modify, distribute, and sell this software and
# its documentation for any purpose is hereby granted without fee, provided
# that (i) the above copyright notices and this permission notice appear in
# all copies of the software and related documentation, and (ii) the names of
# Sam Leffler and Silicon Graphics may not be used in any advertising or
# publicity relating to the software without the specific, prior written
# permission of Sam Leffler and Silicon Graphics.
#
# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
#
# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
# OF THIS SOFTWARE.
# libwebp
set(WEBP_SUPPORT FALSE)
find_package(WebP)
option(webp "use libwebp (required for WEBP compression)" ${WebP_FOUND})
if (webp AND WebP_FOUND)
set(WEBP_SUPPORT TRUE)
endif()
-47
View File
@@ -1,47 +0,0 @@
# Windows support
#
# Copyright © 2015 Open Microscopy Environment / University of Dundee
# Copyright © 2021 Roger Leigh <rleigh@codelibre.net>
# Written by Roger Leigh <rleigh@codelibre.net>
#
# Permission to use, copy, modify, distribute, and sell this software and
# its documentation for any purpose is hereby granted without fee, provided
# that (i) the above copyright notices and this permission notice appear in
# all copies of the software and related documentation, and (ii) the names of
# Sam Leffler and Silicon Graphics may not be used in any advertising or
# publicity relating to the software without the specific, prior written
# permission of Sam Leffler and Silicon Graphics.
#
# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
#
# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
# OF THIS SOFTWARE.
if(MSVC)
# Debug postfix
set(CMAKE_DEBUG_POSTFIX "d")
# disable deprecation warnings
add_definitions(-D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE)
# suppress deprecation warning for MSVC POSIX names
add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS)
# Don't warn about use of deprecated functions
add_compile_options(/wd4996)
endif()
# Win32 file I/O
set(win32_io_default OFF)
if(WIN32)
set(win32_io_default ON)
endif()
option(win32-io "Use Win32 I/O" ${win32_io_default})
set(USE_WIN32_FILEIO ${win32-io})
-64
View File
@@ -1,64 +0,0 @@
# Checks for LZMA codec support
#
# Copyright © 2015 Open Microscopy Environment / University of Dundee
# Copyright © 2021 Roger Leigh <rleigh@codelibre.net>
# Written by Roger Leigh <rleigh@codelibre.net>
#
# Permission to use, copy, modify, distribute, and sell this software and
# its documentation for any purpose is hereby granted without fee, provided
# that (i) the above copyright notices and this permission notice appear in
# all copies of the software and related documentation, and (ii) the names of
# Sam Leffler and Silicon Graphics may not be used in any advertising or
# publicity relating to the software without the specific, prior written
# permission of Sam Leffler and Silicon Graphics.
#
# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
#
# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
# OF THIS SOFTWARE.
# libzstd
set(ZSTD_SUPPORT FALSE)
set(ZSTD_USABLE FALSE)
find_package(ZSTD)
if(ZSTD_FOUND)
if(TARGET zstd::libzstd_shared)
add_library(ZSTD::ZSTD ALIAS zstd::libzstd_shared)
set(ZSTD_HAVE_DECOMPRESS_STREAM ON)
elseif(TARGET zstd::libzstd_static)
add_library(ZSTD::ZSTD ALIAS zstd::libzstd_static)
set(ZSTD_HAVE_DECOMPRESS_STREAM ON)
endif()
if(NOT DEFINED ZSTD_HAVE_DECOMPRESS_STREAM)
set(CMAKE_REQUIRED_INCLUDES_SAVE ${CMAKE_REQUIRED_INCLUDES})
set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${ZSTD_INCLUDE_DIRS})
set(CMAKE_REQUIRED_LIBRARIES_SAVE ${CMAKE_REQUIRED_LIBRARIES})
set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${ZSTD_LIBRARIES})
check_symbol_exists(ZSTD_decompressStream "zstd.h" ZSTD_HAVE_DECOMPRESS_STREAM)
set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES_SAVE})
set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES_SAVE})
endif()
set(ZSTD_RECENT_ENOUGH ${ZSTD_HAVE_DECOMPRESS_STREAM})
if (ZSTD_RECENT_ENOUGH)
set(ZSTD_USABLE TRUE)
else()
message(WARNING "Found ZSTD library, but not recent enough. Use zstd >= 1.0")
endif()
endif()
option(zstd "use libzstd (required for ZSTD compression)" ${ZSTD_USABLE})
if (zstd AND ZSTD_USABLE)
set(ZSTD_SUPPORT TRUE)
endif()
-28
View File
@@ -1,28 +0,0 @@
#!/usr/bin/env python
# Find manual page dependencies
# argv1 = doc dir containing conf.py
import importlib.util
import os.path
import pathlib
import sys
if __name__ == "__main__":
if len(sys.argv) != 2:
sys.exit("Usage: %s sphinx-srcdir" % (sys.argv[0]))
conf_dir = os.path.abspath(sys.argv[1])
conf_path = os.path.join(conf_dir, 'conf.py')
spec = importlib.util.spec_from_file_location('conf', conf_path)
conf = importlib.util.module_from_spec(spec)
spec.loader.exec_module(conf)
if hasattr(conf, 'man_pages'):
for man in conf.man_pages:
man_path = os.path.join(sys.argv[1], "{}{}".format(man[0], '.rst'))
man_path_posix = pathlib.PureWindowsPath(man_path).as_posix()
print(man_path_posix)
print(pathlib.PureWindowsPath(conf_path).as_posix())
-31
View File
@@ -1,31 +0,0 @@
#!/usr/bin/env python
# Find manual pages to be generated
# argv1 = doc dir containing conf.py
# argv2 = manpage directory to contain generated manpages
import importlib.util
import os.path
import pathlib
import sys
if __name__ == "__main__":
if len(sys.argv) != 3:
print("Usage: {} sphinx-srcdir sphinx-builddir".format(sys.argv[0]), file=sys.stderr)
sys.exit(2)
conf_dir = os.path.abspath(sys.argv[1])
conf_path = os.path.join(conf_dir, 'conf.py')
spec = importlib.util.spec_from_file_location('conf', conf_path)
conf = importlib.util.module_from_spec(spec)
spec.loader.exec_module(conf)
if hasattr(conf, 'man_pages'):
for man in conf.man_pages:
man_path = os.path.join(sys.argv[2], "%s.%s" % (man[1], man[4]))
man_path_posix = pathlib.PureWindowsPath(man_path).as_posix()
print(man_path_posix)
else:
print("No man_pages array in {}".format(conf_path), file=sys.stderr)
sys.exit(3)
Vendored Executable
+473
View File
@@ -0,0 +1,473 @@
#!/bin/sh
# Attempt to guess a canonical system name.
# Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc.
#
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# Written by Per Bothner <bothner@cygnus.com>.
# The master version of this file is at the FSF in /home/gd/gnu/lib.
#
# This script attempts to guess a canonical system name similar to
# config.sub. If it succeeds, it prints the system name on stdout, and
# exits with 0. Otherwise, it exits with 1.
#
# The plan is that this can be called by configure scripts if you
# don't specify an explicit system type (host/target name).
#
# Only a few systems have been added to this list; please add others
# (but try to keep the structure clean).
#
# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
# (ghazi@noc.rutgers.edu 8/24/94.)
if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
PATH=$PATH:/.attbin ; export PATH
fi
UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
trap 'rm -f dummy.c dummy.o dummy; exit 1' 1 2 15
# Note: order is significant - the case branches are not exclusive.
case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
alpha:OSF1:V*:*)
# After 1.2, OSF1 uses "V1.3" for uname -r.
echo alpha-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^V//'`
exit 0 ;;
alpha:OSF1:*:*)
# 1.2 uses "1.2" for uname -r.
echo alpha-dec-osf${UNAME_RELEASE}
exit 0 ;;
arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
echo arm-acorn-riscix${UNAME_RELEASE}
exit 0;;
Pyramid*:OSx*:*:*)
if test "`(/bin/universe) 2>/dev/null`" = att ; then
echo pyramid-pyramid-sysv3
else
echo pyramid-pyramid-bsd
fi
exit 0 ;;
sun4*:SunOS:5.*:*)
echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit 0 ;;
sun4*:SunOS:6*:*)
# According to config.sub, this is the proper way to canonicalize
# SunOS6. Hard to guess exactly what SunOS6 will be like, but
# it's likely to be more like Solaris than SunOS4.
echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit 0 ;;
sun4*:SunOS:*:*)
# Japanese Language versions have a version number like `4.1.3-JL'.
echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
exit 0 ;;
sun3*:SunOS:*:*)
echo m68k-sun-sunos${UNAME_RELEASE}
exit 0 ;;
RISC*:ULTRIX:*:*)
echo mips-dec-ultrix${UNAME_RELEASE}
exit 0 ;;
VAX*:ULTRIX*:*:*)
echo vax-dec-ultrix${UNAME_RELEASE}
exit 0 ;;
mips:*:5*:RISCos)
echo mips-mips-riscos${UNAME_RELEASE}
exit 0 ;;
m88k:CX/UX:7*:*)
echo m88k-harris-cxux7
exit 0 ;;
m88k:*:4*:R4*)
echo m88k-motorola-sysv4
exit 0 ;;
m88k:*:3*:R3*)
echo m88k-motorola-sysv3
exit 0 ;;
AViiON:dgux:*:*)
if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx \
-o ${TARGET_BINARY_INTERFACE}x = x ] ; then
echo m88k-dg-dgux${UNAME_RELEASE}
else
echo m88k-dg-dguxbcs${UNAME_RELEASE}
fi
exit 0 ;;
M88*:DolphinOS:*:*) # DolphinOS (SVR3)
echo m88k-dolphin-sysv3
exit 0 ;;
M88*:*:R3*:*)
# Delta 88k system running SVR3
echo m88k-motorola-sysv3
exit 0 ;;
XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
echo m88k-tektronix-sysv3
exit 0 ;;
Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
echo m68k-tektronix-bsd
exit 0 ;;
*:IRIX*:*:*)
echo mips-sgi-irix${UNAME_RELEASE}
exit 0 ;;
i[34]86:AIX:*:*)
echo i386-ibm-aix
exit 0 ;;
*:AIX:2:3)
if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
sed 's/^ //' << EOF >dummy.c
#include <sys/systemcfg.h>
main()
{
if (!__power_pc())
exit(1);
puts("powerpc-ibm-aix3.2.5");
exit(0);
}
EOF
${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0
rm -f dummy.c dummy
echo rs6000-ibm-aix3.2.5
elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
echo rs6000-ibm-aix3.2.4
else
echo rs6000-ibm-aix3.2
fi
exit 0 ;;
*:AIX:*:4)
if /usr/sbin/lsattr -EHl proc0 | grep POWER >/dev/null 2>&1; then
IBM_ARCH=rs6000
else
IBM_ARCH=powerpc
fi
if grep bos410 /usr/include/stdio.h >/dev/null 2>&1; then
IBM_REV=4.1
elif grep bos411 /usr/include/stdio.h >/dev/null 2>&1; then
IBM_REV=4.1.1
else
IBM_REV=4.${UNAME_RELEASE}
fi
echo ${IBM_ARCH}-ibm-aix${IBM_REV}
exit 0 ;;
*:AIX:*:*)
echo rs6000-ibm-aix
exit 0 ;;
*:BOSX:*:*)
echo rs6000-bull-bosx
exit 0 ;;
DPX/2?00:B.O.S.:*:*)
echo m68k-bull-sysv3
exit 0 ;;
9000/[34]??:4.3bsd:1.*:*)
echo m68k-hp-bsd
exit 0 ;;
hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
echo m68k-hp-bsd4.4
exit 0 ;;
9000/[3478]??:HP-UX:*:*)
case "${UNAME_MACHINE}" in
9000/31? ) HP_ARCH=m68000 ;;
9000/[34]?? ) HP_ARCH=m68k ;;
9000/7?? | 9000/8?7 ) HP_ARCH=hppa1.1 ;;
9000/8?? ) HP_ARCH=hppa1.0 ;;
esac
HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
echo ${HP_ARCH}-hp-hpux${HPUX_REV}
exit 0 ;;
3050*:HI-UX:*:*)
sed 's/^ //' << EOF >dummy.c
#include <unistd.h>
int
main ()
{
long cpu = sysconf (_SC_CPU_VERSION);
/* The order matters, because CPU_IS_HP_MC68K erroneously returns
true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct
results, however. */
if (CPU_IS_PA_RISC (cpu))
{
switch (cpu)
{
case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
default: puts ("hppa-hitachi-hiuxwe2"); break;
}
}
else if (CPU_IS_HP_MC68K (cpu))
puts ("m68k-hitachi-hiuxwe2");
else puts ("unknown-hitachi-hiuxwe2");
exit (0);
}
EOF
${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0
rm -f dummy.c dummy
echo unknown-hitachi-hiuxwe2
exit 0 ;;
9000/7??:4.3bsd:*:* | 9000/8?7:4.3bsd:*:* )
echo hppa1.1-hp-bsd
exit 0 ;;
9000/8??:4.3bsd:*:*)
echo hppa1.0-hp-bsd
exit 0 ;;
hp7??:OSF1:*:* | hp8?7:OSF1:*:* )
echo hppa1.1-hp-osf
exit 0 ;;
hp8??:OSF1:*:*)
echo hppa1.0-hp-osf
exit 0 ;;
C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
echo c1-convex-bsd
exit 0 ;;
C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
if getsysinfo -f scalar_acc
then echo c32-convex-bsd
else echo c2-convex-bsd
fi
exit 0 ;;
C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
echo c34-convex-bsd
exit 0 ;;
C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
echo c38-convex-bsd
exit 0 ;;
C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
echo c4-convex-bsd
exit 0 ;;
CRAY*X-MP:UNICOS:*:*)
echo xmp-cray-unicos
exit 0 ;;
CRAY*Y-MP:UNICOS:*:*)
echo ymp-cray-unicos
exit 0 ;;
CRAY-2:UNICOS:*:*)
echo cray2-cray-unicos
exit 0 ;;
hp3[0-9][05]:NetBSD:*:*)
echo m68k-hp-netbsd${UNAME_RELEASE}
exit 0 ;;
i[34]86:BSD/386:*:*)
echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
exit 0 ;;
*:BSD/OS:*:*)
echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
exit 0 ;;
*:FreeBSD:*:*)
echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
exit 0 ;;
*:NetBSD:*:*)
echo ${UNAME_MACHINE}-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
exit 0 ;;
*:GNU:*:*)
echo `echo ${UNAME_MACHINE}|sed -e 's,/.*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
exit 0 ;;
*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux
exit 0 ;;
# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. earlier versions
# are messed up and put the nodename in both sysname and nodename.
i[34]86:DYNIX/ptx:4*:*)
echo i386-sequent-sysv4
exit 0 ;;
i[34]86:*:4.*:* | i[34]86:SYSTEM_V:4.*:*)
if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
echo ${UNAME_MACHINE}-univel-sysv${UNAME_RELEASE}
else
echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}
fi
exit 0 ;;
i[34]86:*:3.2:*)
if test -d /etc/conf/cf.d -a -f /usr/options/cb.name; then
UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
echo ${UNAME_MACHINE}-unknown-isc$UNAME_REL
elif /bin/uname -X 2>/dev/null >/dev/null ; then
UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')`
(/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486
echo ${UNAME_MACHINE}-unknown-sco$UNAME_REL
else
echo ${UNAME_MACHINE}-unknown-sysv32
fi
exit 0 ;;
Intel:Mach:3*:*)
echo i386-unknown-mach3
exit 0 ;;
i860:*:4.*:*) # i860-SVR4
if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
else # Add other i860-SVR4 vendors below as they are discovered.
echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4
fi
exit 0 ;;
mini*:CTIX:SYS*5:*)
# "miniframe"
echo m68010-convergent-sysv
exit 0 ;;
M680[234]0:*:R3V[567]*:*)
test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
3[34]??:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0)
uname -p 2>/dev/null | grep 86 >/dev/null \
&& echo i486-ncr-sysv4.3 && exit 0 ;;
3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
uname -p 2>/dev/null | grep 86 >/dev/null \
&& echo i486-ncr-sysv4 && exit 0 ;;
m680[234]0:LynxOS:2.2*:*)
echo m68k-lynx-lynxos${UNAME_RELEASE}
exit 0 ;;
mc68030:UNIX_System_V:4.*:*)
echo m68k-atari-sysv4
exit 0 ;;
i[34]86:LynxOS:2.2*:*)
echo i386-lynx-lynxos${UNAME_RELEASE}
exit 0 ;;
TSUNAMI:LynxOS:2.2*:*)
echo sparc-lynx-lynxos${UNAME_RELEASE}
exit 0 ;;
rs6000:LynxOS:2.2*:*)
echo rs6000-lynx-lynxos${UNAME_RELEASE}
exit 0 ;;
RM*:SINIX-*:*:*)
echo mips-sni-sysv4
exit 0 ;;
*:SINIX-*:*:*)
if uname -p 2>/dev/null >/dev/null ; then
UNAME_MACHINE=`(uname -p) 2>/dev/null`
echo ${UNAME_MACHINE}-sni-sysv4
else
echo ns32k-sni-sysv
fi
exit 0 ;;
esac
#echo '(No uname command or uname output not recognized.)' 1>&2
#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
cat >dummy.c <<EOF
main ()
{
#if defined (sony)
#if defined (MIPSEB)
/* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed,
I don't know.... */
printf ("mips-sony-bsd\n"); exit (0);
#else
printf ("m68k-sony-newsos\n"); exit (0);
#endif
#endif
#if defined (__arm) && defined (__acorn) && defined (__unix)
printf ("arm-acorn-riscix"); exit (0);
#endif
#if defined (hp300) && !defined (hpux)
printf ("m68k-hp-bsd\n"); exit (0);
#endif
#if defined (NeXT)
#if !defined (__ARCHITECTURE__)
#define __ARCHITECTURE__ "m68k"
#endif
int version;
version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
printf ("%s-next-nextstep%s\n", __ARCHITECTURE__, version==2 ? "2" : "3");
exit (0);
#endif
#if defined (MULTIMAX) || defined (n16)
#if defined (UMAXV)
printf ("ns32k-encore-sysv\n"); exit (0);
#else
#if defined (CMU)
printf ("ns32k-encore-mach\n"); exit (0);
#else
printf ("ns32k-encore-bsd\n"); exit (0);
#endif
#endif
#endif
#if defined (__386BSD__)
printf ("i386-unknown-bsd\n"); exit (0);
#endif
#if defined (sequent)
#if defined (i386)
printf ("i386-sequent-dynix\n"); exit (0);
#endif
#if defined (ns32000)
printf ("ns32k-sequent-dynix\n"); exit (0);
#endif
#endif
#if defined (_SEQUENT_)
printf ("i386-sequent-ptx\n"); exit (0);
#endif
#if defined (vax)
#if !defined (ultrix)
printf ("vax-dec-bsd\n"); exit (0);
#else
printf ("vax-dec-ultrix\n"); exit (0);
#endif
#endif
#if defined (alliant) && defined (i860)
printf ("i860-alliant-bsd\n"); exit (0);
#endif
exit (1);
}
EOF
${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy && rm dummy.c dummy && exit 0
rm -f dummy.c dummy
# Apollos put the system type in the environment.
test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; }
# Convex versions that predate uname can use getsysinfo(1)
if [ -x /usr/convex/getsysinfo ]
then
case `getsysinfo -f cpu_type` in
c1*)
echo c1-convex-bsd
exit 0 ;;
c2*)
if getsysinfo -f scalar_acc
then echo c32-convex-bsd
else echo c2-convex-bsd
fi
exit 0 ;;
c34*)
echo c34-convex-bsd
exit 0 ;;
c38*)
echo c38-convex-bsd
exit 0 ;;
c4*)
echo c4-convex-bsd
exit 0 ;;
esac
fi
#echo '(Unable to guess system type)' 1>&2
exit 1
+160
View File
@@ -0,0 +1,160 @@
# $Header: /usr/people/sam/tiff/RCS/config.site,v 1.13 1996/06/05 21:24:33 sam Exp $
#
# TIFF Software
#
# Copyright (c) 1990-1996 Sam Leffler
# Copyright (c) 1991-1996 Silicon Graphics, Inc.
#
# Permission to use, copy, modify, distribute, and sell this software and
# its documentation for any purpose is hereby granted without fee, provided
# that (i) the above copyright notices and this permission notice appear in
# all copies of the software and related documentation, and (ii) the names of
# Sam Leffler and Silicon Graphics may not be used in any advertising or
# publicity relating to the software without the specific, prior written
# permission of Sam Leffler and Silicon Graphics.
#
# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
#
# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
# OF THIS SOFTWARE.
#
#
# This file holds site-specific configuration parameters.
#
# Nothing is defined in here by default, the definitions
# commented out below serve as documentation for what you
# can set in this file or a config.local file.
#
# Note that you do not need to set anything here unless you
# want to override the auto-configuration behaviour and/or
# interactive prompting done by the configure script.
#
#
# Package controls.
#
#DSO="auto" # auto|IRIX|IRIX52 enable DSO support for system
#JPEG="no" # yes|no configure JPEG support (see below)
#ZIP="no" # yes|no configure Deflate support (see below)
#LIBGL="auto" # yes|no|auto configure IRIS GL-based tools
#LIBIMAGE="auto" # yes|no|auto configure SGI RGB image tools
#HTML="no" # yes|no install HTML documentation
#
# Directory parameters.
#
#DIR_BIN="/usr/local/bin" # directory for tools
#DIR_LIB="/usr/local/lib" # directory for libraries
#DIR_INC="/usr/local/include" # directory for include files
#DIR_MAN="/usr/local/man" # directory for manual pages
#DIR_HTML="/var/httpd/htdocs/tiff" # directory for HTML documentation
#
# Configuring supporting libraries.
#
# The TIFF software makes use of two ancillary packages: the IJG
# distribution to support the JPEG codec and the zlib distribution
# to support the Deflate codec. To setup use of these packages you
# need to specify where each package's include files are located and
# where the pre-built library (static archive or DSO) is located.
# These may be different or the same (as when the package is compiled
# and referenced directly from the place where the software was
# loaded and compiled).
#
# DIRS_LIBINC is a space-separated list of directories to use for
# locating include files in these packages. Note that it should not
# include -I options as might be passed to the C preprocessor; these
# are automatically added by the configure script when the Makefiles
# are generated.
#
# DIR_<package>LIB is the pathname of the directory where <package>'s
# pre-built library may be found; this is used when building a TIFF
# DSO (on systems where support is present) and when building the
# programs in the tools directory. By default the configure script
# will load the associated library using
#
# -L${DIR_<package>LIB} -l<package>
#
# e.g. -L${DIR_JPEGLIB} -ljpeg. If this is wrong for your system
# (e.g. your compiler/loader does not support the -L option), then
# the LIB<package> parameter can be set explicitly to specify the
# library to use.
#
#
# JPEG-specific parameters; used when JPEG support is enabled (see above).
#
# JPEG support requires release 5 or later of the IJG code,
# which you can find on the Internet at ftp.uu.net:/graphics/jpeg/.
#
#DIRS_LIBINC="$DIRS_LIBINC ../src/jpeg-5a" # directory for jpeg include files
#DIR_JPEGLIB=../src/jpeg-5a # directory for libjpeg
#
# Deflate-specific parameters; used when Deflate support is enabled (see above).
#
# NB: Deflate support requires version 0.92 or later of the zlib
# library written by Jean-loup Gailly and Mark Adler. Starting
# with about 0.95 the library is called libz.a (previously it was
# libgz.a). The library was last found at
#
# ftp://ftp.uu.net/graphics/png/code/zlib-0.93.tar.gz
#
# Look for it also at ftp://ftp.uu.net/pub/archiving/zip/zlib.
#
#DIRS_LIBINC="$DIRS_LIBINC ../zlib" # directory for zlib include files
#DIR_GZLIB="../zlib" # directory for libz
#
# Miscellaneous parameters.
#
#FILLORDER="MS2LSB" # bit order of cpu (MSB2LSB/LSB2MSB)
#MANSCHEME="sysv-source-cat-strip" # manual page installation scheme
#
# Parameters used when building the software.
#
# Note that configure has several ENVOPTS built into it that are
# set according to the target. This is done to help naive folks.
#
# Beware of changing the INSTALL definition; you *must* have an
# install script that emulates the Silicon Graphics install program!
#
#AR="/bin/ar" # pathname of suitable ar program
#AROPTS="rc" # options to ar for creating archive
#CC="gcc" # name/pathname of C compiler
#ENVOPTS="-Aa" # options for getting ANSI C
#GCOPTS="-g" # options to pass C compiler
#LIBPORT='${PORT}/libport.a' # library with emulation code
#MACHDEPLIBS="" # extra libraries for linking
#PORTFUNCS="" # non-standard functions to emulate
#RANLIB=":" # pathname of suitable ranlib program
#DSOSUF="so" # DSO filename suffix
#LIBCOPTS="-K PIC" # compiler options for building library
#
# Makefile construction parameters.
#
# These should not normally be set; configure will
# deduce the appropriate syntax to use for includes.
#
#SETMAKE='MAKE = ${MAKE}' # define if make does not setup $MAKE
#
# General system stuff used by the distribution.
#
#CHMOD="/etc/chmod" # pathname of suitable chmod program
#INSTALL='${SHELL} ${PORT}/install.sh' # SGI install program/emulator
#LN="/bin/ln" # pathname of suitable ln program
#LN_S="-s" # option to ${LN} to create symlink
#MV_F="-f" # option to ${MV} to force operation
#SED="/bin/sed" # pathname of suitable sed program
#SCRIPT_SH="/bin/sh" # pathname of suitable shell
#STRIP="/bin/strip" # strip program used by install.sh
Vendored Executable
+793
View File
@@ -0,0 +1,793 @@
#!/bin/sh
# Configuration validation subroutine script, version 1.1.
# Copyright (C) 1991, 1992, 1993, 1994 Free Software Foundation, Inc.
# This file is (in principle) common to ALL GNU software.
# The presence of a machine in this file suggests that SOME GNU software
# can handle that machine. It does not imply ALL GNU software can.
#
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# Configuration subroutine to validate and canonicalize a configuration type.
# Supply the specified configuration type as an argument.
# If it is invalid, we print an error message on stderr and exit with code 1.
# Otherwise, we print the canonical config type on stdout and succeed.
# This file is supposed to be the same for all GNU packages
# and recognize all the CPU types, system types and aliases
# that are meaningful with *any* GNU software.
# Each package is responsible for reporting which valid configurations
# it does not support. The user should be able to distinguish
# a failure to support a valid configuration from a meaningless
# configuration.
# The goal of this file is to map all the various variations of a given
# machine specification into a single specification in the form:
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
# It is wrong to echo any other type of specification.
# First pass through any local machine types.
case $1 in
*local*)
echo $1
exit 0
;;
*)
;;
esac
# Separate what the user gave into CPU-COMPANY and OS (if any).
basic_machine=`echo $1 | sed 's/-[^-]*$//'`
if [ $basic_machine != $1 ]
then os=`echo $1 | sed 's/.*-/-/'`
else os=; fi
### Let's recognize common machines as not being operating systems so
### that things like config.sub decstation-3100 work. We also
### recognize some manufacturers as not being operating systems, so we
### can provide default operating systems below.
case $os in
-sun*os*)
# Prevent following clause from handling this invalid input.
;;
-dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
-att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
-unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp )
os=
basic_machine=$1
;;
-hiux*)
os=-hiuxwe2
;;
-sco4)
os=-sco3.2v4
basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'`
;;
-sco3.2.[4-9]*)
os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'`
;;
-sco3.2v[4-9]*)
# Don't forget version if it is 3.2v4 or newer.
basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'`
;;
-sco*)
os=-sco3.2v2
basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'`
;;
-isc)
os=-isc2.2
basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'`
;;
-clix*)
basic_machine=clipper-intergraph
;;
-isc*)
basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'`
;;
-lynx)
os=-lynxos
;;
-ptx*)
basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
;;
-windowsnt*)
os=`echo $os | sed -e 's/windowsnt/winnt/'`
;;
esac
# Decode aliases for certain CPU-COMPANY combinations.
case $basic_machine in
# Recognize the basic CPU types without company name.
# Some are omitted here because they have special meanings below.
tahoe | i[345]86 | i860 | m68k | m68000 | m88k | ns32k | arm | pyramid \
| tron | a29k | 580 | i960 | h8300 | hppa1.0 | hppa1.1 \
| alpha | we32k | ns16k | clipper | sparclite | i370 | sh \
| powerpc | sparc64 | 1750a | dsp16xx | mips64 | mipsel \
| pdp11 | mips64el | mips64orion | mips64orionel )
basic_machine=$basic_machine-unknown
;;
# Object if more than one company name word.
*-*-*)
echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
exit 1
;;
# Recognize the basic CPU types with company name.
vax-* | tahoe-* | i[345]86-* | i860-* | m68k-* | m68000-* | m88k-* \
| sparc-* | ns32k-* | fx80-* | arm-* | c[123]* \
| mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \
| none-* | 580-* | cray2-* | h8300-* | i960-* | xmp-* | ymp-* \
| hppa1.0-* | hppa1.1-* | alpha-* | we32k-* | cydra-* | ns16k-* \
| pn-* | np1-* | xps100-* | clipper-* | orion-* | sparclite-* \
| pdp11-* | sh-* | powerpc-* | sparc64-* | mips64-* | mipsel-* \
| mips64el-* | mips64orion-* | mips64orionel-* )
;;
# Recognize the various machine names and aliases which stand
# for a CPU type and a company and sometimes even an OS.
3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
basic_machine=m68000-att
;;
3b*)
basic_machine=we32k-att
;;
alliant | fx80)
basic_machine=fx80-alliant
;;
altos | altos3068)
basic_machine=m68k-altos
;;
am29k)
basic_machine=a29k-none
os=-bsd
;;
amdahl)
basic_machine=580-amdahl
os=-sysv
;;
amiga | amiga-*)
basic_machine=m68k-cbm
;;
amigados)
basic_machine=m68k-cbm
os=-amigados
;;
amigaunix | amix)
basic_machine=m68k-cbm
os=-sysv4
;;
apollo68)
basic_machine=m68k-apollo
os=-sysv
;;
balance)
basic_machine=ns32k-sequent
os=-dynix
;;
convex-c1)
basic_machine=c1-convex
os=-bsd
;;
convex-c2)
basic_machine=c2-convex
os=-bsd
;;
convex-c32)
basic_machine=c32-convex
os=-bsd
;;
convex-c34)
basic_machine=c34-convex
os=-bsd
;;
convex-c38)
basic_machine=c38-convex
os=-bsd
;;
cray | ymp)
basic_machine=ymp-cray
os=-unicos
;;
cray2)
basic_machine=cray2-cray
os=-unicos
;;
crds | unos)
basic_machine=m68k-crds
;;
da30 | da30-*)
basic_machine=m68k-da30
;;
decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
basic_machine=mips-dec
;;
delta | 3300 | motorola-3300 | motorola-delta \
| 3300-motorola | delta-motorola)
basic_machine=m68k-motorola
;;
delta88)
basic_machine=m88k-motorola
os=-sysv3
;;
dpx20 | dpx20-*)
basic_machine=rs6000-bull
os=-bosx
;;
dpx2* | dpx2*-bull)
basic_machine=m68k-bull
os=-sysv3
;;
ebmon29k)
basic_machine=a29k-amd
os=-ebmon
;;
elxsi)
basic_machine=elxsi-elxsi
os=-bsd
;;
encore | umax | mmax)
basic_machine=ns32k-encore
;;
fx2800)
basic_machine=i860-alliant
;;
genix)
basic_machine=ns32k-ns
;;
gmicro)
basic_machine=tron-gmicro
os=-sysv
;;
h3050r* | hiux*)
basic_machine=hppa1.1-hitachi
os=-hiuxwe2
;;
h8300hms)
basic_machine=h8300-hitachi
os=-hms
;;
harris)
basic_machine=m88k-harris
os=-sysv3
;;
hp300-*)
basic_machine=m68k-hp
;;
hp300bsd)
basic_machine=m68k-hp
os=-bsd
;;
hp300hpux)
basic_machine=m68k-hp
os=-hpux
;;
hp9k2[0-9][0-9] | hp9k31[0-9])
basic_machine=m68000-hp
;;
hp9k3[2-9][0-9])
basic_machine=m68k-hp
;;
hp9k7[0-9][0-9] | hp7[0-9][0-9] | hp9k8[0-9]7 | hp8[0-9]7)
basic_machine=hppa1.1-hp
;;
hp9k8[0-9][0-9] | hp8[0-9][0-9])
basic_machine=hppa1.0-hp
;;
i370-ibm* | ibm*)
basic_machine=i370-ibm
os=-mvs
;;
# I'm not sure what "Sysv32" means. Should this be sysv3.2?
i[345]86v32)
basic_machine=`echo $1 | sed -e 's/86.*/86-unknown/'`
os=-sysv32
;;
i[345]86v4*)
basic_machine=`echo $1 | sed -e 's/86.*/86-unknown/'`
os=-sysv4
;;
i[345]86v)
basic_machine=`echo $1 | sed -e 's/86.*/86-unknown/'`
os=-sysv
;;
i[345]86sol2)
basic_machine=`echo $1 | sed -e 's/86.*/86-unknown/'`
os=-solaris2
;;
iris | iris4d)
basic_machine=mips-sgi
case $os in
-irix*)
;;
*)
os=-irix4
;;
esac
;;
isi68 | isi)
basic_machine=m68k-isi
os=-sysv
;;
m88k-omron*)
basic_machine=m88k-omron
;;
magnum | m3230)
basic_machine=mips-mips
os=-sysv
;;
merlin)
basic_machine=ns32k-utek
os=-sysv
;;
miniframe)
basic_machine=m68000-convergent
;;
mips3*-*)
basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
;;
mips3*)
basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
;;
ncr3000)
basic_machine=i486-ncr
os=-sysv4
;;
news | news700 | news800 | news900)
basic_machine=m68k-sony
os=-newsos
;;
news1000)
basic_machine=m68030-sony
os=-newsos
;;
news-3600 | risc-news)
basic_machine=mips-sony
os=-newsos
;;
next | m*-next )
basic_machine=m68k-next
case $os in
-nextstep* )
;;
-ns2*)
os=-nextstep2
;;
*)
os=-nextstep3
;;
esac
;;
nh3000)
basic_machine=m68k-harris
os=-cxux
;;
nh[45]000)
basic_machine=m88k-harris
os=-cxux
;;
nindy960)
basic_machine=i960-intel
os=-nindy
;;
np1)
basic_machine=np1-gould
;;
pa-hitachi)
basic_machine=hppa1.1-hitachi
os=-hiuxwe2
;;
paragon)
basic_machine=i860-intel
os=-osf
;;
pbd)
basic_machine=sparc-tti
;;
pbb)
basic_machine=m68k-tti
;;
pc532 | pc532-*)
basic_machine=ns32k-pc532
;;
pentium-*)
# We will change tis to say i586 once there has been
# time for various packages to start to recognize that.
basic_machine=i486-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
pn)
basic_machine=pn-gould
;;
ps2)
basic_machine=i386-ibm
;;
rtpc | rtpc-*)
basic_machine=romp-ibm
;;
sequent)
basic_machine=i386-sequent
;;
sh)
basic_machine=sh-hitachi
os=-hms
;;
sps7)
basic_machine=m68k-bull
os=-sysv2
;;
spur)
basic_machine=spur-unknown
;;
sun2)
basic_machine=m68000-sun
;;
sun2os3)
basic_machine=m68000-sun
os=-sunos3
;;
sun2os4)
basic_machine=m68000-sun
os=-sunos4
;;
sun3os3)
basic_machine=m68k-sun
os=-sunos3
;;
sun3os4)
basic_machine=m68k-sun
os=-sunos4
;;
sun4os3)
basic_machine=sparc-sun
os=-sunos3
;;
sun4os4)
basic_machine=sparc-sun
os=-sunos4
;;
sun3 | sun3-*)
basic_machine=m68k-sun
;;
sun4)
basic_machine=sparc-sun
;;
sun386 | sun386i | roadrunner)
basic_machine=i386-sun
;;
symmetry)
basic_machine=i386-sequent
os=-dynix
;;
tower | tower-32)
basic_machine=m68k-ncr
;;
ultra3)
basic_machine=a29k-nyu
os=-sym1
;;
vaxv)
basic_machine=vax-dec
os=-sysv
;;
vms)
basic_machine=vax-dec
os=-vms
;;
vxworks960)
basic_machine=i960-wrs
os=-vxworks
;;
vxworks68)
basic_machine=m68k-wrs
os=-vxworks
;;
xmp)
basic_machine=xmp-cray
os=-unicos
;;
xps | xps100)
basic_machine=xps100-honeywell
;;
none)
basic_machine=none-none
os=-none
;;
# Here we handle the default manufacturer of certain CPU types. It is in
# some cases the only manufacturer, in others, it is the most popular.
mips)
basic_machine=mips-mips
;;
romp)
basic_machine=romp-ibm
;;
rs6000)
basic_machine=rs6000-ibm
;;
vax)
basic_machine=vax-dec
;;
pdp11)
basic_machine=pdp11-dec
;;
we32k)
basic_machine=we32k-att
;;
sparc)
basic_machine=sparc-sun
;;
cydra)
basic_machine=cydra-cydrome
;;
orion)
basic_machine=orion-highlevel
;;
orion105)
basic_machine=clipper-highlevel
;;
*)
echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
exit 1
;;
esac
# Here we canonicalize certain aliases for manufacturers.
case $basic_machine in
*-digital*)
basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
;;
*-commodore*)
basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
;;
*)
;;
esac
# Decode manufacturer-specific aliases for certain operating systems.
if [ x"$os" != x"" ]
then
case $os in
# -solaris* is a basic system type, with this one exception.
-solaris1 | -solaris1.*)
os=`echo $os | sed -e 's|solaris1|sunos4|'`
;;
-solaris)
os=-solaris2
;;
-gnu/linux*)
os=`echo $os | sed -e 's|gnu/linux|linux|'`
;;
# First accept the basic system types.
# The portable systems comes first.
# Each alternative must end in a *, to match a version number.
# -sysv* is not here because it comes later, after sysvr4.
-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
| -vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[345]* \
| -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
| -amigados* | -msdos* | -newsos* | -unicos* | -aos* \
| -nindy* | -vxworks* | -ebmon* | -hms* | -mvs* | -clix* \
| -riscos* | -linux* | -uniplus* | -iris* | -rtu* | -xenix* \
| -hiux* | -386bsd* | -netbsd* | -freebsd* | -riscix* \
| -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* \
| -ptx* | -coff* | -winnt*)
;;
-sunos5*)
os=`echo $os | sed -e 's|sunos5|solaris2|'`
;;
-sunos6*)
os=`echo $os | sed -e 's|sunos6|solaris3|'`
;;
-osfrose*)
os=-osfrose
;;
-osf*)
os=-osf
;;
-utek*)
os=-bsd
;;
-dynix*)
os=-bsd
;;
-acis*)
os=-aos
;;
-ctix* | -uts*)
os=-sysv
;;
-triton*)
os=-sysv3
;;
-oss*)
os=-sysv3
;;
-svr4)
os=-sysv4
;;
-svr3)
os=-sysv3
;;
-sysvr4)
os=-sysv4
;;
# This must come after -sysvr4.
-sysv*)
;;
-xenix)
os=-xenix
;;
-none)
;;
*)
# Get rid of the `-' at the beginning of $os.
os=`echo $os | sed 's/[^-]*-//'`
echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
exit 1
;;
esac
else
# Here we handle the default operating systems that come with various machines.
# The value should be what the vendor currently ships out the door with their
# machine or put another way, the most popular os provided with the machine.
# Note that if you're going to try to match "-MANUFACTURER" here (say,
# "-sun"), then you have to tell the case statement up towards the top
# that MANUFACTURER isn't an operating system. Otherwise, code above
# will signal an error saying that MANUFACTURER isn't an operating
# system, and we'll never get to this point.
case $basic_machine in
*-acorn)
os=-riscix1.2
;;
pdp11-*)
os=-none
;;
*-dec | vax-*)
os=-ultrix4.2
;;
i386-sun)
os=-sunos4.0.2
;;
m68000-sun)
os=-sunos3
# This also exists in the configure program, but was not the
# default.
# os=-sunos4
;;
*-tti) # must be before sparc entry or we get the wrong os.
os=-sysv3
;;
sparc-* | *-sun)
os=-sunos4.1.1
;;
*-ibm)
os=-aix
;;
*-hp)
os=-hpux
;;
*-hitachi)
os=-hiux
;;
i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
os=-sysv
;;
*-cbm)
os=-amigados
;;
*-dg)
os=-dgux
;;
*-dolphin)
os=-sysv3
;;
m68k-ccur)
os=-rtu
;;
m88k-omron*)
os=-luna
;;
*-sequent)
os=-ptx
;;
*-crds)
os=-unos
;;
*-ns)
os=-genix
;;
i370-*)
os=-mvs
;;
*-next)
os=-nextstep3
;;
*-gould)
os=-sysv
;;
*-highlevel)
os=-bsd
;;
*-encore)
os=-bsd
;;
*-sgi)
os=-irix
;;
*-masscomp)
os=-rtu
;;
*)
os=-none
;;
esac
fi
# Here we handle the case where we know the os, and the CPU type, but not the
# manufacturer. We pick the logical manufacturer.
vendor=unknown
case $basic_machine in
*-unknown)
case $os in
-riscix*)
vendor=acorn
;;
-sunos*)
vendor=sun
;;
-lynxos*)
vendor=lynx
;;
-aix*)
vendor=ibm
;;
-hpux*)
vendor=hp
;;
-hiux*)
vendor=hitachi
;;
-unos*)
vendor=crds
;;
-dgux*)
vendor=dg
;;
-luna*)
vendor=omron
;;
-genix*)
vendor=ns
;;
-mvs*)
vendor=ibm
;;
-ptx*)
vendor=sequent
;;
esac
basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
;;
esac
echo $basic_machine$os
Vendored Executable
+1822
View File
File diff suppressed because it is too large Load Diff
-1280
View File
File diff suppressed because it is too large Load Diff
-27
View File
@@ -1,27 +0,0 @@
# CMake build for libtiff
#
# Copyright © 2015 Open Microscopy Environment / University of Dundee
# Written by Roger Leigh <rleigh@codelibre.net>
#
# Permission to use, copy, modify, distribute, and sell this software and
# its documentation for any purpose is hereby granted without fee, provided
# that (i) the above copyright notices and this permission notice appear in
# all copies of the software and related documentation, and (ii) the names of
# Sam Leffler and Silicon Graphics may not be used in any advertising or
# publicity relating to the software without the specific, prior written
# permission of Sam Leffler and Silicon Graphics.
#
# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
#
# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
# OF THIS SOFTWARE.
add_subdirectory(addtiffo)
add_subdirectory(dbs)
add_subdirectory(iptcutil)
-31
View File
@@ -1,31 +0,0 @@
# Tag Image File Format (TIFF) Software
#
# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
#
# Permission to use, copy, modify, distribute, and sell this software and
# its documentation for any purpose is hereby granted without fee, provided
# that (i) the above copyright notices and this permission notice appear in
# all copies of the software and related documentation, and (ii) the names of
# Sam Leffler and Silicon Graphics may not be used in any advertising or
# publicity relating to the software without the specific, prior written
# permission of Sam Leffler and Silicon Graphics.
#
# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
#
# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
# OF THIS SOFTWARE.
# Process this file with automake to produce Makefile.in.
EXTRA_DIST = \
CMakeLists.txt \
README
SUBDIRS = addtiffo dbs iptcutil mfs pds ras stream tags win_dib
-2
View File
@@ -1,2 +0,0 @@
This directory contains various contributions from libtiff users.
+165
View File
@@ -0,0 +1,165 @@
# Project: LibTIFF
# Toolflags:
CCflags = -c -zo -ffah -depend !Depend -IC:
C++flags = -c -depend !Depend -IC: -throwback
Linkflags = -aif -c++ -o $@
DrLinkflags = -nounused -aif -c++ -o $@
ObjAsmflags = -throwback -NoCache -depend !Depend
CMHGflags =
LibFileflags = -c -o $@
Squeezeflags = -o $@
# Final targets:
@.o.LIBTIFF: \
@.o.tif_acorn \
@.o.tif_aux \
@.o.tif_close \
@.o.tif_codec \
@.o.tif_compress \
@.o.tif_dir \
@.o.tif_dirinfo \
@.o.tif_dirread \
@.o.tif_dirwrite \
@.o.tif_dumpmode \
@.o.tif_error \
@.o.tif_fax3 \
@.o.tif_flush \
@.o.tif_getimage \
@.o.tif_jpeg \
@.o.tif_lzw \
@.o.tif_next \
@.o.tif_open \
@.o.tif_packbits \
@.o.tif_predict \
@.o.tif_print \
@.o.tif_read \
@.o.tif_strip \
@.o.tif_swab \
@.o.tif_thunder \
@.o.tif_tile \
@.o.tif_version \
@.o.tif_warning \
@.o.tif_write \
@.o.tif_zip \
@.o.tif_fax3sm \
@.h.version
LibFile $(LibFileflags) \
@.o.tif_acorn \
@.o.tif_aux \
@.o.tif_close \
@.o.tif_codec \
@.o.tif_compress \
@.o.tif_dir \
@.o.tif_dirinfo \
@.o.tif_dirread \
@.o.tif_dirwrite \
@.o.tif_dumpmode \
@.o.tif_error \
@.o.tif_fax3 \
@.o.tif_flush \
@.o.tif_getimage \
@.o.tif_jpeg \
@.o.tif_lzw \
@.o.tif_next \
@.o.tif_open \
@.o.tif_packbits \
@.o.tif_predict \
@.o.tif_print \
@.o.tif_read \
@.o.tif_strip \
@.o.tif_swab \
@.o.tif_thunder \
@.o.tif_tile \
@.o.tif_version \
@.o.tif_warning \
@.o.tif_write \
@.o.tif_zip \
@.o.tif_fax3sm
# User-editable dependencies:
@.mkversion: @.o.mkversion C:o.Stubs
Link $(linkflags) @.o.mkversion C:o.Stubs
@.h.version: @.VERSION @.mkversion
<Prefix$Dir>.mkversion -v @.VERSION -a @.tiff/alpha @.h.version
@.mkg3states: @.o.mkg3states @.o.getopt C:o.Stubs
link $(linkflags) @.o.mkg3states C:o.Stubs @.o.getopt
@.c.tif_fax3sm: @.mkg3states
<Prefix$Dir>.mkg3states -c const @.c.tif_fax3sm
# Static dependencies:
@.o.tif_acorn: @.c.tif_acorn
cc $(ccflags) -o @.o.tif_acorn @.c.tif_acorn
@.o.tif_aux: @.c.tif_aux
cc $(ccflags) -o @.o.tif_aux @.c.tif_aux
@.o.tif_close: @.c.tif_close
cc $(ccflags) -o @.o.tif_close @.c.tif_close
@.o.tif_codec: @.c.tif_codec
cc $(ccflags) -o @.o.tif_codec @.c.tif_codec
@.o.tif_compress: @.c.tif_compress
cc $(ccflags) -o @.o.tif_compress @.c.tif_compress
@.o.tif_dir: @.c.tif_dir
cc $(ccflags) -o @.o.tif_dir @.c.tif_dir
@.o.tif_dirinfo: @.c.tif_dirinfo
cc $(ccflags) -o @.o.tif_dirinfo @.c.tif_dirinfo
@.o.tif_dirread: @.c.tif_dirread
cc $(ccflags) -o @.o.tif_dirread @.c.tif_dirread
@.o.tif_dirwrite: @.c.tif_dirwrite
cc $(ccflags) -o @.o.tif_dirwrite @.c.tif_dirwrite
@.o.tif_dumpmode: @.c.tif_dumpmode
cc $(ccflags) -o @.o.tif_dumpmode @.c.tif_dumpmode
@.o.tif_error: @.c.tif_error
cc $(ccflags) -o @.o.tif_error @.c.tif_error
@.o.tif_fax3: @.c.tif_fax3
cc $(ccflags) -o @.o.tif_fax3 @.c.tif_fax3
@.o.tif_flush: @.c.tif_flush
cc $(ccflags) -o @.o.tif_flush @.c.tif_flush
@.o.tif_getimage: @.c.tif_getimage
cc $(ccflags) -o @.o.tif_getimage @.c.tif_getimage
@.o.tif_jpeg: @.c.tif_jpeg
cc $(ccflags) -o @.o.tif_jpeg @.c.tif_jpeg
@.o.tif_lzw: @.c.tif_lzw
cc $(ccflags) -o @.o.tif_lzw @.c.tif_lzw
@.o.tif_next: @.c.tif_next
cc $(ccflags) -o @.o.tif_next @.c.tif_next
@.o.tif_open: @.c.tif_open
cc $(ccflags) -o @.o.tif_open @.c.tif_open
@.o.tif_packbits: @.c.tif_packbits
cc $(ccflags) -o @.o.tif_packbits @.c.tif_packbits
@.o.tif_predict: @.c.tif_predict
cc $(ccflags) -o @.o.tif_predict @.c.tif_predict
@.o.tif_print: @.c.tif_print
cc $(ccflags) -o @.o.tif_print @.c.tif_print
@.o.tif_read: @.c.tif_read
cc $(ccflags) -o @.o.tif_read @.c.tif_read
@.o.tif_strip: @.c.tif_strip
cc $(ccflags) -o @.o.tif_strip @.c.tif_strip
@.o.tif_swab: @.c.tif_swab
cc $(ccflags) -o @.o.tif_swab @.c.tif_swab
@.o.tif_thunder: @.c.tif_thunder
cc $(ccflags) -o @.o.tif_thunder @.c.tif_thunder
@.o.tif_tile: @.c.tif_tile
cc $(ccflags) -o @.o.tif_tile @.c.tif_tile
@.o.tif_version: @.c.tif_version
cc $(ccflags) -o @.o.tif_version @.c.tif_version
@.o.tif_warning: @.c.tif_warning
cc $(ccflags) -o @.o.tif_warning @.c.tif_warning
@.o.tif_write: @.c.tif_write
cc $(ccflags) -o @.o.tif_write @.c.tif_write
@.o.tif_zip: @.c.tif_zip
cc $(ccflags) -o @.o.tif_zip @.c.tif_zip
@.o.mkg3states: @.c.mkg3states
cc $(ccflags) -o @.o.mkg3states @.c.mkg3states
@.o.getopt: @.c.getopt
cc $(ccflags) -o @.o.getopt @.c.getopt
@.o.mkspans: @.c.mkspans
cc $(ccflags) -o @.o.mkspans @.c.mkspans
@.o.tif_fax3sm: @.c.tif_fax3sm
cc $(ccflags) -o @.o.tif_fax3sm @.c.tif_fax3sm
@.o.mkversion: @.c.mkversion
cc $(ccflags) -o @.o.mkversion @.c.mkversion
# Dynamic dependencies:
+79
View File
@@ -0,0 +1,79 @@
Building the Software on an Acorn RISC OS system
The directory contrib/acorn contains support for compiling the library under
Acorn C/C++ under Acorn's RISC OS 3.10 or above. Subsequent pathnames will
use the Acorn format: The full-stop or period character is a pathname
delimeter, and the slash character is not interpreted; the reverse position
from Unix. Thus "libtiff/tif_acorn.c" becomes "libtiff.tif_acorn/c".
This support was contributed by Peter Greenham.
(peterg@angmulti.demon.co.uk).
Installing LibTIFF:
LIBTIFF uses several files which have names longer than the normal RISC OS
maximum of ten characters. This complicates matters. Maybe one day Acorn will
address the problem and implement long filenames properly. Until then this
gets messy, especially as I'm trying to do this with obeyfiles and not have
to include binaries in this distribution.
First of all, ensure you have Truncate configured on (type *Configure
Truncate On) Although it is, of course, preferable to have long filenames,
LIBTIFF can be installed with short filenames, and it will compile and link
without problems. However, getting it there is more problematic.
contrib.acorn.install is an installation obeyfile which will create a normal
Acorn-style library from the source (ie: with c, h and o folders etc.), but
needs the distribution library to have been unpacked into a location which is
capable of supporting long filenames, even if only temporarily.
My recommendation, until Acorn address this problem properly, is to use Jason
Tribbeck's LongFilenames , or any other working system that gives you long
filenames, like a nearby NFS server for instance.
If you are using Longfilenames, even if only temporarily to install LIBTIFF,
unpack the TAR into a RAMDisc which has been longfilenamed (ie: *addlongfs
ram) and then install from there to the hard disk. Unfortunately
Longfilenames seems a bit unhappy about copying a bunch of long-named files
across the same filing system, but is happy going between systems. You'll
need to create a ramdisk of about 2Mb.
Now you can run the installation script I've supplied (in contrib.acorn),
which will automate the process of installing LIBTIFF as an Acorn-style
library. The syntax is as follows:
install <source_dir> <dest_dir>
Install will then create <dest_dir> and put the library in there. For
example, having used LongFilenames on the RAMDisk and unpacked the library
into there, you can then type:
Obey RAM::RamDisc0.$.contrib.acorn.install RAM::RamDisc0.$ ADFS::4.$.LIBTIFF
It doesn't matter if the destination location can cope with long filenames or
not. The filenames will be truncated if necessary (*Configure Truncate On if
you get errors) and all will be well.
Compiling LibTIFF:
Once the LibTIFF folder has been created and the files put inside, making the
library should be just a matter of running 'SetVars' to set the appropriate
system variables, then running 'Makefile'.
OSLib
OSLib is a comprehensive API for RISC OS machines, written by Jonathan
Coxhead of Acorn Computers (although OSLib is not an official Acorn product).
Using the OSLib SWI veneers produces code which is more compact and more
efficient than code written using _kernel_swi or _swi. The Acorn port of
LibTIFF can take advantage of this if present. Edit the Makefile and go to
the Static dependencies section. The first entry is:
# Static dependencies:
@.o.tif_acorn: @.c.tif_acorn
cc $(ccflags) -o @.o.tif_acorn @.c.tif_acorn
Change the cc line to:
cc $(ccflags) -DINCLUDE_OSLIB -o @.o.tif_acorn @.c.tif_acorn
Remember, however, that OSLib is only recommended for efficiency's sake. It
is not required.
+3
View File
@@ -0,0 +1,3 @@
Set LibTIFF$Dir <Obey$Dir>
Set LibTIFF$Path <LibTIFF$Dir>.
Set C$Path <C$Path>,LibTIFF:
+5
View File
@@ -0,0 +1,5 @@
IfThere LibTIFF:o.* THEN Wipe LibTIFF:o.* ~CFR~V
IfThere LibTIFF:c.tif_fax3sm THEN Delete LibTIFF:c.tif_fax3sm
IfThere LibTIFF:mkg3states THEN Delete LibTIFF:mkg3states
IfThere LibTIFF:h.version THEN Delete LibTIFF:h.version
IfThere LibTIFF:mkversion THEN Delete LibTIFF:mkversion
+175
View File
@@ -0,0 +1,175 @@
RISC OS Conversion log
======================
mkversion.c
~~~~~~~~~~~
The RISC OS command-line does not allow the direct creation of the version.h
file in the proper manner. To remedy this in such a way that the version
header is made at compiletime, I wrote this small program. It is fully
portable, so should work quite happily for any other platform that might need
it.
msg3states.c
~~~~~~~~~~~~
Needed getopt.c from the port folder, then compiled and worked fine.
tiff.h
~~~~~~
====1====
The symbol _MIPS_SZLONG, if not defined, causes a compiler error. Fixed by
ensuring it does exist. This looks to me like this wouldn't be an
Acorn-specific problem. The new code fragment is as follows:
#ifndef _MIPS_SZLONG
#define _MIPS_SZLONG 32
#endif
#if defined(__alpha) || _MIPS_SZLONG == 64
tiffcomp.h
~~~~~~~~~~
====1====
#if !defined(__MWERKS__) && !defined(THINK_C)
#include <sys/types.h>
#endif
Acorn also doesn't have this header so:
#if !defined(__MWERKS__) && !defined(THINK_C) && !defined(__acorn)
#include <sys/types.h>
#endif
====2====
#ifdef VMS
#include <file.h>
#include <unixio.h>
#else
#include <fcntl.h>
#endif
This seems to indicate that fcntl.h is included on all systems except
VMS. Odd, because I've never heard of it before. Sure it's in the ANSI
definition? Anyway, following change:
#ifdef VMS
#include <file.h>
#include <unixio.h>
#else
#ifndef __acorn
#include <fcntl.h>
#endif
#endif
This will probably change when I find out what it wants from fcntl.h!
====3====
#if defined(__MWERKS__) || defined(THINK_C) || defined(applec)
#include <stdlib.h>
#define BSDTYPES
#endif
Added RISC OS to above thus:
#if defined(__MWERKS__) || defined(THINK_C) || defined(applec) || defined(__acorn)
#include <stdlib.h>
#define BSDTYPES
#endif
====4====
/*
* The library uses the ANSI C/POSIX SEEK_*
* definitions that should be defined in unistd.h
* (except on VMS where they are in stdio.h and
* there is no unistd.h).
*/
#ifndef SEEK_SET
#if !defined(VMS) && !defined (applec) && !defined(THINK_C) && !defined(__MWERKS__)
#include <unistd.h>
#endif
RISC OS is like VMS and Mac in this regard. So changed to:
/*
* The library uses the ANSI C/POSIX SEEK_*
* definitions that should be defined in unistd.h
* (except on VMS or the Mac or RISC OS, where they are in stdio.h and
* there is no unistd.h).
*/
#ifndef SEEK_SET
#if !defined(VMS) && !defined (applec) && !defined(THINK_C) && !defined(__MWERKS__) && !defined(__acorn)
#include <unistd.h>
#endif
#endif
====5====
NB: HAVE_IEEEFP is defined in tiffconf.h, not tiffcomp.h as mentioned
in libtiff.README. (Note written on original port from 3.4beta004)
Acorn C/C++ claims to accord with IEEE 754, so no change (yet) to
tiffconf.h.
====6====
Unsure about whether this compiler supports inline functions. Will
leave it on for the time being and see if it works! (Likely if
everything else does.)
... Seems to be OK ...
====7====
Added to the end:
/*
* osfcn.h is part of C++Lib on Acorn C/C++, and as such can't be used
* on C alone. For that reason, the relevant functions have been
* implemented by myself in tif_acorn.c, and the elements from the header
* included here.
*/
#ifdef __acorn
#ifdef __cplusplus
#include <osfcn.h>
#else
#include "kernel.h"
#define O_RDONLY 0
#define O_WRONLY 1
#define O_RDWR 2
#define O_APPEND 8
#define O_CREAT 0x200
#define O_TRUNC 0x400
typedef long off_t;
extern int open(const char *name, int flags, int mode);
extern int close(int fd);
extern int write(int fd, const char *buf, int nbytes);
extern int read(int fd, char *buf, int nbytes);
extern off_t lseek(int fd, off_t offset, int whence);
#endif
#endif
===============================================================================
tif_acorn.c
~~~~~~~~~~~
Created file tif_acorn.c, copied initially from tif_unix.c
Documented internally where necessary.
Note that I have implemented the low-level file-handling functions normally
found in osfcn.h in here, and put the header info at the bottom of
tiffcomp.h. This is further documented from a RISC OS perspective inside the
file.
===============================================================================
+128
View File
@@ -0,0 +1,128 @@
If "%0" = "" Then Error Syntax: install |<source_dir> |<dest_dir>
If "%1" = "" Then Error Syntax: install |<source_dir> |<dest_dir>
Set LibTiffInstall$Dir %0
Set LibTiff$Dir %1
Set Alias$CPY Copy <LibTiffInstall$Dir>.%%0 <LibTiff$Dir>.%%1 ~C~DF~NRV
CDir <LibTiff$Dir>
CDir <LibTiff$Dir>.c
CDir <LibTiff$Dir>.h
CDir <LibTiff$Dir>.o
CPY COPYRIGHT COPYRIGHT
CPY README README
CPY VERSION VERSION
CPY dist.tiff/alpha tiff/alpha
CPY contrib.acorn.SetVars SetVars
CPY contrib.acorn.Makefile Makefile
CPY contrib.acorn.cleanlib cleanlib
CPY port.getopt/c c.getopt
CPY libtiff.mkg3states/c c.mkg3states
CPY libtiff.mkspans/c c.mkspans
CPY libtiff.mkversion/c c.mkversion
CPY libtiff.tif_acorn/c c.tif_acorn
CPY libtiff.tif_aux/c c.tif_aux
CPY libtiff.tif_close/c c.tif_close
CPY libtiff.tif_codec/c c.tif_codec
CPY libtiff.tif_compress/c c.tif_compre
CPY libtiff.tif_dir/c c.tif_dir
CPY libtiff.tif_dirinfo/c c.tif_dirinf
CPY libtiff.tif_dirread/c c.tif_dirrea
CPY libtiff.tif_dirwrite/c c.tif_dirwri
CPY libtiff.tif_dumpmode/c c.tif_dumpmo
CPY libtiff.tif_error/c c.tif_error
CPY libtiff.tif_fax3/c c.tif_fax3
CPY libtiff.tif_flush/c c.tif_flush
CPY libtiff.tif_getimage/c c.tif_getima
CPY libtiff.tif_jpeg/c c.tif_jpeg
CPY libtiff.tif_lzw/c c.tif_lzw
CPY libtiff.tif_next/c c.tif_next
CPY libtiff.tif_open/c c.tif_open
CPY libtiff.tif_packbits/c c.tif_packbi
CPY libtiff.tif_predict/c c.tif_predic
CPY libtiff.tif_print/c c.tif_print
CPY libtiff.tif_read/c c.tif_read
CPY libtiff.tif_strip/c c.tif_strip
CPY libtiff.tif_swab/c c.tif_swab
CPY libtiff.tif_thunder/c c.tif_thunde
CPY libtiff.tif_tile/c c.tif_tile
CPY libtiff.tif_version/c c.tif_versio
CPY libtiff.tif_warning/c c.tif_warnin
CPY libtiff.tif_write/c c.tif_write
CPY libtiff.tif_zip/c c.tif_zip
CPY libtiff.t4/h h.t4
CPY libtiff.tiff/h h.tiff
CPY libtiff.tiffcomp/h h.tiffcomp
CPY libtiff.tiffconf/h h.tiffconf
CPY libtiff.tiffio/h h.tiffio
CPY libtiff.tiffiop/h h.tiffiop
CPY libtiff.tif_dir/h h.tif_dir
CPY libtiff.tif_fax3/h h.tif_fax3
CPY libtiff.tif_predict/h h.tif_predic
SetType <LibTiff$Dir>.COPYRIGHT Text
SetType <LibTiff$Dir>.README Text
SetType <LibTiff$Dir>.VERSION Text
SetType <LibTiff$Dir>.tiff/alpha Text
SetType <LibTiff$Dir>.SetVars Obey
SetType <LibTiff$Dir>.Makefile fe1
SetType <LibTiff$Dir>.cleanlib Obey
SetType <LibTiff$Dir>.c.getopt Text
SetType <LibTiff$Dir>.c.mkg3states Text
SetType <LibTiff$Dir>.c.mkspans Text
SetType <LibTiff$Dir>.c.mkversion Text
SetType <LibTiff$Dir>.c.tif_acorn Text
SetType <LibTiff$Dir>.c.tif_aux Text
SetType <LibTiff$Dir>.c.tif_close Text
SetType <LibTiff$Dir>.c.tif_codec Text
SetType <LibTiff$Dir>.c.tif_compre Text
SetType <LibTiff$Dir>.c.tif_dir Text
SetType <LibTiff$Dir>.c.tif_dirinf Text
SetType <LibTiff$Dir>.c.tif_dirrea Text
SetType <LibTiff$Dir>.c.tif_dirwri Text
SetType <LibTiff$Dir>.c.tif_dumpmo Text
SetType <LibTiff$Dir>.c.tif_error Text
SetType <LibTiff$Dir>.c.tif_fax3 Text
SetType <LibTiff$Dir>.c.tif_flush Text
SetType <LibTiff$Dir>.c.tif_getima Text
SetType <LibTiff$Dir>.c.tif_jpeg Text
SetType <LibTiff$Dir>.c.tif_lzw Text
SetType <LibTiff$Dir>.c.tif_next Text
SetType <LibTiff$Dir>.c.tif_open Text
SetType <LibTiff$Dir>.c.tif_packbi Text
SetType <LibTiff$Dir>.c.tif_predic Text
SetType <LibTiff$Dir>.c.tif_print Text
SetType <LibTiff$Dir>.c.tif_read Text
SetType <LibTiff$Dir>.c.tif_strip Text
SetType <LibTiff$Dir>.c.tif_swab Text
SetType <LibTiff$Dir>.c.tif_thunde Text
SetType <LibTiff$Dir>.c.tif_tile Text
SetType <LibTiff$Dir>.c.tif_versio Text
SetType <LibTiff$Dir>.c.tif_warnin Text
SetType <LibTiff$Dir>.c.tif_write Text
SetType <LibTiff$Dir>.c.tif_zip Text
SetType <LibTiff$Dir>.h.t4 Text
SetType <LibTiff$Dir>.h.tiff Text
SetType <LibTiff$Dir>.h.tiffcomp Text
SetType <LibTiff$Dir>.h.tiffconf Text
SetType <LibTiff$Dir>.h.tiffio Text
SetType <LibTiff$Dir>.h.tiffiop Text
SetType <LibTiff$Dir>.h.tif_dir Text
SetType <LibTiff$Dir>.h.tif_fax3 Text
SetType <LibTiff$Dir>.h.tif_predic Text
Unset Alias$CPY
Unset LibTiffInstall$Dir
| Now attempt to restore longfilename status. If it causes an error, OK.
Set Alias$RN Rename <LibTiff$Dir>.%%0 <LibTiff$Dir>.%%1
Unset LibTiff$Dir
RN c.tif_compre c.tif_compress
RN c.tif_dirinf c.tif_dirinfo
RN c.tif_dirrea c.tif_dirread
RN c.tif_dirwri c.tif_dirwrite
RN c.tif_dumpmo c.tif_dumpmode
RN c.tif_getima c.tif_getimage
RN c.tif_packbi c.tif_packbits
RN c.tif_predic c.tif_predict
RN c.tif_thunde c.tif_thunder
RN c.tif_versio c.tif_version
RN c.tif_warnin c.tif_warning
RN h.tif_predic h.tif_predict
Unset Alias$RN
Echo All done!
-32
View File
@@ -1,32 +0,0 @@
# CMake build for libtiff
#
# Copyright © 2015 Open Microscopy Environment / University of Dundee
# Written by Roger Leigh <rleigh@codelibre.net>
#
# Permission to use, copy, modify, distribute, and sell this software and
# its documentation for any purpose is hereby granted without fee, provided
# that (i) the above copyright notices and this permission notice appear in
# all copies of the software and related documentation, and (ii) the names of
# Sam Leffler and Silicon Graphics may not be used in any advertising or
# publicity relating to the software without the specific, prior written
# permission of Sam Leffler and Silicon Graphics.
#
# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
#
# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
# OF THIS SOFTWARE.
add_executable(addtiffo addtiffo.c tif_overview.c tif_ovrcache.c tif_ovrcache.h)
target_link_libraries(addtiffo tiff tiff_port)
if(WEBP_SUPPORT AND EMSCRIPTEN)
# Emscripten is pretty finnicky about linker flags.
# It needs --shared-memory if and only if atomics or bulk-memory is used.
target_link_options(addtiffo PUBLIC "-Wl,--shared-memory")
endif()
-40
View File
@@ -1,40 +0,0 @@
# Tag Image File Format (TIFF) Software
#
# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
#
# Permission to use, copy, modify, distribute, and sell this software and
# its documentation for any purpose is hereby granted without fee, provided
# that (i) the above copyright notices and this permission notice appear in
# all copies of the software and related documentation, and (ii) the names of
# Sam Leffler and Silicon Graphics may not be used in any advertising or
# publicity relating to the software without the specific, prior written
# permission of Sam Leffler and Silicon Graphics.
#
# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
#
# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
# OF THIS SOFTWARE.
# Process this file with automake to produce Makefile.in.
LIBTIFF = $(top_builddir)/libtiff/libtiff.la
EXTRA_DIST = \
CMakeLists.txt \
README
if TIFF_CONTRIB
noinst_PROGRAMS = addtiffo
endif
addtiffo_SOURCES = addtiffo.c tif_overview.c tif_ovrcache.c tif_ovrcache.h
addtiffo_LDADD = $(LIBTIFF)
AM_CPPFLAGS = -I$(top_srcdir)/libtiff
-142
View File
@@ -1,142 +0,0 @@
addtiffo 1.0
============
The addtiffo utility is used to add overview pyramids to an existing
TIFF or GeoTIFF file. Some applications can take advantage of these
overviews to accelerate overview display performance of large rasters.
This release of addtiffo is primarily intended for compatibility testing
with applications, and to see if there is interest in a cleaner release
of the capability ... perhaps incorporation into the libtiff tools
distribution.
Please feel free to contact me with questions, or problems.
warmerda@home.com
http://home.gdal.org/~warmerda/
Usage
-----
Usage: addtiffo [-r {average/nearest} [-subifd]
tiff_filename [resolution_reductions]
Example:
% addtiffo abc.tif 2 4 8 16
The numeric arguments are the list of reduction factors to
generate. In this example a 1/2, 1/4 1/8 and 1/16
Limitations
-----------
See tif_overview.cpp for up to date details.
o Currently only images with bits_per_sample of a multiple of eight
will work.
o The code will attempt to use the same kind of compression,
photometric interpretation, and organization as the source image, but
it doesn't copy geotiff tags to the reduced resolution images.
o Reduced resolution overviews for multi-sample files will currently
always be generated as PLANARCONFIG_SEPARATE. This could be fixed
reasonable easily if needed to improve compatibility with other
packages. Many don't properly support PLANARCONFIG_SEPARATE.
o Overviews are always written as appended IFDs, rather than using the
``tree of tree's'' approach using the SUBIFD tag. I wanted to implement
both, but it isn't currently easy to add a SUBIFD tag to an existing
main tiff IFD with libtiff. I hope to try this again later.
TIFF File Tags
--------------
The results of running addtiffo on a 1024x1024 tiled greyscale file
with the arguments ``2 4 8 16'' is to add four additional TIFF directories
appended on the file with the SUBFILETYPE flag to 0x1 indicating the extra
items are reduced resolution images.
The tiffinfo output of such a file might look like this:
TIFF Directory at offset 0x118008
Image Width: 1024 Image Length: 1024
Tile Width: 256 Tile Length: 112
Bits/Sample: 8
Compression Scheme: none
Photometric Interpretation: min-is-black
Samples/Pixel: 1
Planar Configuration: single image plane
TIFF Directory at offset 0x15e1d2
Subfile Type: reduced-resolution image (1 = 0x1)
Image Width: 512 Image Length: 512
Tile Width: 256 Tile Length: 112
Bits/Sample: 8
Compression Scheme: none
Photometric Interpretation: min-is-black
Samples/Pixel: 1
Planar Configuration: separate image planes
TIFF Directory at offset 0x1732b8
Subfile Type: reduced-resolution image (1 = 0x1)
Image Width: 256 Image Length: 256
Tile Width: 256 Tile Length: 112
Bits/Sample: 8
Compression Scheme: none
Photometric Interpretation: min-is-black
Samples/Pixel: 1
Planar Configuration: separate image planes
TIFF Directory at offset 0x17a366
Subfile Type: reduced-resolution image (1 = 0x1)
Image Width: 128 Image Length: 128
Tile Width: 128 Tile Length: 112
Bits/Sample: 8
Compression Scheme: none
Photometric Interpretation: min-is-black
Samples/Pixel: 1
Planar Configuration: separate image planes
TIFF Directory at offset 0x17b40c
Subfile Type: reduced-resolution image (1 = 0x1)
Image Width: 64 Image Length: 64
Tile Width: 64 Tile Length: 64
Bits/Sample: 8
Compression Scheme: none
Photometric Interpretation: min-is-black
Samples/Pixel: 1
Planar Configuration: separate image planes
Building
--------
You will need a C compiler. You will need to have libtiff already
built and installed. The provided Makefile should work on most Unix systems.
A similar file will be needed for Windows, but is not provided.
The CFLAGS and LIBS macros in the Makefile will have to be updated to
point to the correct location of the libtiff include files, and library.
Credits
-------
o Intergraph Corporation for partially funding the work.
o Global Geomatics for partially funding reorganization of the overview
building ability as a separate utility.
o Orrin Long, and Ed Grissom of Intergraph for explaining what needed to
be done.
o Max Martinez of Erdas for his discussion of external overviews.
o Atlantis Scientific who supported adding averaging, and some other
generalizations.
o Frank Warmerdam for writing the bulk of the code.
o Sam Leffler since this only exists because of his libtiff.
-174
View File
@@ -1,174 +0,0 @@
/******************************************************************************
* Project: GeoTIFF Overview Builder
* Purpose: Mainline for building overviews in a TIFF file.
* Author: Frank Warmerdam, warmerdam@pobox.com
*
******************************************************************************
* Copyright (c) 1999, Frank Warmerdam
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
******************************************************************************
*
* $Log: addtiffo.c,v $
* Revision 1.8 2015-05-30 20:30:27 bfriesen
* * contrib/addtiffo/addtiffo.c (main): Possibly address Coverity
* 1024226 "Untrusted value as argument".
*
* Revision 1.7 2010-06-08 18:55:15 bfriesen
* * contrib: Add an emacs formatting mode footer to all source files
* so that emacs can be effectively used.
*
* Revision 1.6 2005/12/16 05:59:55 fwarmerdam
* Major upgrade to support YCbCr subsampled jpeg images
*
* Revision 1.4 2004/09/21 13:31:23 dron
* Add missed include string.h.
*
* Revision 1.3 2000/04/18 22:48:31 warmerda
* Added support for averaging resampling
*
* Revision 1.2 2000/01/28 15:36:38 warmerda
* pass TIFF handle instead of filename to overview builder
*
* Revision 1.1 1999/08/17 01:47:59 warmerda
* New
*
* Revision 1.1 1999/03/12 17:46:32 warmerda
* New
*
* Revision 1.2 1999/02/11 22:27:12 warmerda
* Added multi-sample support
*
* Revision 1.1 1999/02/11 18:12:30 warmerda
* New
*/
#include "tiffio.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
void TIFFBuildOverviews(TIFF *, int, int *, int, const char *,
int (*)(double, void *), void *);
/************************************************************************/
/* main() */
/************************************************************************/
int main(int argc, char **argv)
{
int anOverviews[100]; /* TODO: un-hardwire array length, flexible allocate
*/
int nOverviewCount = 0;
int bUseSubIFD = 0;
TIFF *hTIFF;
const char *pszResampling = "nearest";
/* -------------------------------------------------------------------- */
/* Usage: */
/* -------------------------------------------------------------------- */
if (argc < 2)
{
printf("Usage: addtiffo [-r {nearest,average,mode}]\n"
" tiff_filename [resolution_reductions]\n"
"\n"
"Example:\n"
" %% addtiffo abc.tif 2 4 8 16\n");
return (1);
}
while (argv[1][0] == '-')
{
if (strcmp(argv[1], "-subifd") == 0)
{
bUseSubIFD = 1;
argv++;
argc--;
}
else if (strcmp(argv[1], "-r") == 0)
{
argv += 2;
argc -= 2;
pszResampling = *argv;
}
else
{
fprintf(stderr, "Incorrect parameters\n");
return (1);
}
}
/* TODO: resampling mode parameter needs to be encoded in an integer from
* this point on */
/* -------------------------------------------------------------------- */
/* Collect the user requested reduction factors. */
/* -------------------------------------------------------------------- */
while (nOverviewCount < argc - 2 && nOverviewCount < 100)
{
anOverviews[nOverviewCount] = atoi(argv[nOverviewCount + 2]);
if ((anOverviews[nOverviewCount] <= 0) ||
((anOverviews[nOverviewCount] > 1024)))
{
fprintf(stderr, "Incorrect parameters\n");
return (1);
}
nOverviewCount++;
}
/* -------------------------------------------------------------------- */
/* Default to four overview levels. It would be nicer if it */
/* defaulted based on the size of the source image. */
/* -------------------------------------------------------------------- */
/* TODO: make it default based on the size of the source image */
if (nOverviewCount == 0)
{
nOverviewCount = 4;
anOverviews[0] = 2;
anOverviews[1] = 4;
anOverviews[2] = 8;
anOverviews[3] = 16;
}
/* -------------------------------------------------------------------- */
/* Build the overview. */
/* -------------------------------------------------------------------- */
hTIFF = TIFFOpen(argv[1], "r+");
if (hTIFF == NULL)
{
fprintf(stderr, "TIFFOpen(%s) failed.\n", argv[1]);
return (1);
}
TIFFBuildOverviews(hTIFF, nOverviewCount, anOverviews, bUseSubIFD,
pszResampling, NULL, NULL);
TIFFClose(hTIFF);
/* -------------------------------------------------------------------- */
/* Optionally test for memory leaks. */
/* -------------------------------------------------------------------- */
#ifdef DBMALLOC
malloc_dump(1);
#endif
return (0);
}
-931
View File
@@ -1,931 +0,0 @@
/******************************************************************************
* tif_overview.c,v 1.9 2005/05/25 09:03:16 dron Exp
*
* Project: TIFF Overview Builder
* Purpose: Library function for building overviews in a TIFF file.
* Author: Frank Warmerdam, warmerdam@pobox.com
*
* Notes:
* o Currently only images with bits_per_sample of a multiple of eight
* will work.
*
* o The downsampler currently just takes the top left pixel from the
* source rectangle. Eventually sampling options of averaging, mode, and
* ``center pixel'' should be offered.
*
* o The code will attempt to use the same kind of compression,
* photometric interpretation, and organization as the source image, but
* it doesn't copy geotiff tags to the reduced resolution images.
*
* o Reduced resolution overviews for multi-sample files will currently
* always be generated as PLANARCONFIG_SEPARATE. This could be fixed
* reasonable easily if needed to improve compatibility with other
* packages. Many don't properly support PLANARCONFIG_SEPARATE.
*
******************************************************************************
* Copyright (c) 1999, Frank Warmerdam
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
******************************************************************************
*/
/* TODO: update notes in header above */
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "tif_ovrcache.h"
#include "tiffio.h"
#ifndef FALSE
#define FALSE 0
#define TRUE 1
#endif
#ifndef MAX
#define MIN(a, b) ((a < b) ? a : b)
#define MAX(a, b) ((a > b) ? a : b)
#endif
#define TIFF_DIR_MAX 65534
void TIFFBuildOverviews(TIFF *, int, int *, int, const char *,
int (*)(double, void *), void *);
/************************************************************************/
/* TIFF_WriteOverview() */
/* */
/* Create a new directory, without any image data for an overview. */
/* Returns offset of newly created overview directory, but the */
/* current directory is reset to be the one in used when this */
/* function is called. */
/************************************************************************/
uint32_t TIFF_WriteOverview(TIFF *hTIFF, uint32_t nXSize, uint32_t nYSize,
int nBitsPerPixel, int nPlanarConfig, int nSamples,
int nBlockXSize, int nBlockYSize, int bTiled,
int nCompressFlag, int nPhotometric,
int nSampleFormat, unsigned short *panRed,
unsigned short *panGreen, unsigned short *panBlue,
int bUseSubIFDs, int nHorSubsampling,
int nVerSubsampling)
{
toff_t nBaseDirOffset;
toff_t nOffset;
tdir_t iNumDir;
(void)bUseSubIFDs;
nBaseDirOffset = TIFFCurrentDirOffset(hTIFF);
TIFFCreateDirectory(hTIFF);
/* -------------------------------------------------------------------- */
/* Setup TIFF fields. */
/* -------------------------------------------------------------------- */
TIFFSetField(hTIFF, TIFFTAG_IMAGEWIDTH, nXSize);
TIFFSetField(hTIFF, TIFFTAG_IMAGELENGTH, nYSize);
if (nSamples == 1)
TIFFSetField(hTIFF, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
else
TIFFSetField(hTIFF, TIFFTAG_PLANARCONFIG, nPlanarConfig);
TIFFSetField(hTIFF, TIFFTAG_BITSPERSAMPLE, nBitsPerPixel);
TIFFSetField(hTIFF, TIFFTAG_SAMPLESPERPIXEL, nSamples);
TIFFSetField(hTIFF, TIFFTAG_COMPRESSION, nCompressFlag);
TIFFSetField(hTIFF, TIFFTAG_PHOTOMETRIC, nPhotometric);
TIFFSetField(hTIFF, TIFFTAG_SAMPLEFORMAT, nSampleFormat);
if (bTiled)
{
TIFFSetField(hTIFF, TIFFTAG_TILEWIDTH, nBlockXSize);
TIFFSetField(hTIFF, TIFFTAG_TILELENGTH, nBlockYSize);
}
else
TIFFSetField(hTIFF, TIFFTAG_ROWSPERSTRIP, nBlockYSize);
TIFFSetField(hTIFF, TIFFTAG_SUBFILETYPE, FILETYPE_REDUCEDIMAGE);
if (nPhotometric == PHOTOMETRIC_YCBCR || nPhotometric == PHOTOMETRIC_ITULAB)
{
TIFFSetField(hTIFF, TIFFTAG_YCBCRSUBSAMPLING, nHorSubsampling,
nVerSubsampling);
/* TODO: also write YCbCrPositioning and YCbCrCoefficients tag identical
* to source IFD */
}
/* TODO: add command-line parameter for selecting jpeg compression quality
* that gets ignored when compression isn't jpeg */
/* -------------------------------------------------------------------- */
/* Write color table if one is present. */
/* -------------------------------------------------------------------- */
if (panRed != NULL)
{
TIFFSetField(hTIFF, TIFFTAG_COLORMAP, panRed, panGreen, panBlue);
}
/* -------------------------------------------------------------------- */
/* Write directory, and return byte offset. */
/* -------------------------------------------------------------------- */
if (TIFFWriteCheck(hTIFF, bTiled, "TIFFBuildOverviews") == 0)
return 0;
if (!TIFFWriteDirectory(hTIFF))
return 0;
iNumDir = TIFFNumberOfDirectories(hTIFF);
if (iNumDir > TIFF_DIR_MAX)
{
TIFFErrorExt(TIFFClientdata(hTIFF), "TIFF_WriteOverview",
"File `%s' has too many directories.\n",
TIFFFileName(hTIFF));
exit(-1);
}
TIFFSetDirectory(hTIFF, (tdir_t)(iNumDir - 1));
nOffset = TIFFCurrentDirOffset(hTIFF);
TIFFSetSubDirectory(hTIFF, nBaseDirOffset);
return nOffset;
}
/************************************************************************/
/* TIFF_GetSourceSamples() */
/************************************************************************/
static void TIFF_GetSourceSamples(double *padfSamples, unsigned char *pabySrc,
int nPixelBytes, int nSampleFormat,
uint32_t nXSize, uint32_t nYSize,
int nPixelOffset, int nLineOffset)
{
uint32_t iXOff, iYOff;
int iSample;
iSample = 0;
for (iYOff = 0; iYOff < nYSize; iYOff++)
{
for (iXOff = 0; iXOff < nXSize; iXOff++)
{
unsigned char *pabyData;
pabyData = pabySrc + iYOff * nLineOffset + iXOff * nPixelOffset;
if (nSampleFormat == SAMPLEFORMAT_UINT && nPixelBytes == 1)
{
padfSamples[iSample++] = *pabyData;
}
else if (nSampleFormat == SAMPLEFORMAT_UINT && nPixelBytes == 2)
{
padfSamples[iSample++] = ((uint16_t *)pabyData)[0];
}
else if (nSampleFormat == SAMPLEFORMAT_UINT && nPixelBytes == 4)
{
padfSamples[iSample++] = ((uint32_t *)pabyData)[0];
}
else if (nSampleFormat == SAMPLEFORMAT_INT && nPixelBytes == 2)
{
padfSamples[iSample++] = ((int16_t *)pabyData)[0];
}
else if (nSampleFormat == SAMPLEFORMAT_INT && nPixelBytes == 32)
{
padfSamples[iSample++] = ((int32_t *)pabyData)[0];
}
else if (nSampleFormat == SAMPLEFORMAT_IEEEFP && nPixelBytes == 4)
{
padfSamples[iSample++] = ((float *)pabyData)[0];
}
else if (nSampleFormat == SAMPLEFORMAT_IEEEFP && nPixelBytes == 8)
{
padfSamples[iSample++] = ((double *)pabyData)[0];
}
}
}
}
/************************************************************************/
/* TIFF_SetSample() */
/************************************************************************/
static void TIFF_SetSample(unsigned char *pabyData, int nPixelBytes,
int nSampleFormat, double dfValue)
{
if (nSampleFormat == SAMPLEFORMAT_UINT && nPixelBytes == 1)
{
*pabyData = (unsigned char)MAX(0, MIN(255, dfValue));
}
else if (nSampleFormat == SAMPLEFORMAT_UINT && nPixelBytes == 2)
{
*((uint16_t *)pabyData) = (uint16_t)MAX(0, MIN(65535, dfValue));
}
else if (nSampleFormat == SAMPLEFORMAT_UINT && nPixelBytes == 4)
{
*((uint32_t *)pabyData) = (uint32_t)dfValue;
}
else if (nSampleFormat == SAMPLEFORMAT_INT && nPixelBytes == 2)
{
*((int16_t *)pabyData) = (int16_t)MAX(-32768, MIN(32767, dfValue));
}
else if (nSampleFormat == SAMPLEFORMAT_INT && nPixelBytes == 32)
{
*((int32_t *)pabyData) = (int32_t)dfValue;
}
else if (nSampleFormat == SAMPLEFORMAT_IEEEFP && nPixelBytes == 4)
{
*((float *)pabyData) = (float)dfValue;
}
else if (nSampleFormat == SAMPLEFORMAT_IEEEFP && nPixelBytes == 8)
{
*((double *)pabyData) = dfValue;
}
}
/************************************************************************/
/* TIFF_DownSample() */
/* */
/* Down sample a tile of full res data into a window of a tile */
/* of downsampled data. */
/************************************************************************/
static void TIFF_DownSample(unsigned char *pabySrcTile, uint32_t nBlockXSize,
uint32_t nBlockYSize, int nPixelSkewBits,
int nBitsPerPixel, unsigned char *pabyOTile,
uint32_t nOBlockXSize, uint32_t nOBlockYSize,
uint32_t nTXOff, uint32_t nTYOff, int nOMult,
int nSampleFormat, const char *pszResampling)
{
uint32_t i, j;
int k, nPixelBytes = (nBitsPerPixel) / 8;
int nPixelGroupBytes = (nBitsPerPixel + nPixelSkewBits) / 8;
unsigned char *pabySrc, *pabyDst;
double *padfSamples;
size_t tpadfSamples_size, padfSamples_size;
assert(nBitsPerPixel >= 8);
/* sizeof(double) * nOMult * nOMult */
tpadfSamples_size = nOMult * nOMult;
if ((nOMult != 0) && (tpadfSamples_size / nOMult == (size_t)nOMult))
{
padfSamples_size = tpadfSamples_size;
tpadfSamples_size = padfSamples_size * sizeof(double);
if ((tpadfSamples_size / padfSamples_size) == sizeof(double))
padfSamples_size = tpadfSamples_size;
else
padfSamples_size = 0;
}
else
{
padfSamples_size = 0;
}
if (padfSamples_size == 0)
{
/* TODO: This is an error condition */
return;
}
padfSamples = (double *)malloc(padfSamples_size);
/* ==================================================================== */
/* Loop over scanline chunks to process, establishing where the */
/* data is going. */
/* ==================================================================== */
for (j = 0; j * nOMult < nBlockYSize; j++)
{
if (j + nTYOff >= nOBlockYSize)
break;
pabyDst = pabyOTile + ((j + nTYOff) * nOBlockXSize + nTXOff) *
nPixelBytes * nPixelGroupBytes;
/* --------------------------------------------------------------------
*/
/* Handler nearest resampling ... we don't even care about the */
/* data type, we just do a bytewise copy. */
/* --------------------------------------------------------------------
*/
if (strncmp(pszResampling, "nearest", 4) == 0 ||
strncmp(pszResampling, "NEAR", 4) == 0)
{
pabySrc = pabySrcTile + j * nOMult * nBlockXSize * nPixelGroupBytes;
for (i = 0; i * nOMult < nBlockXSize; i++)
{
if (i + nTXOff >= nOBlockXSize)
break;
/*
* For now use simple subsampling, from the top left corner
* of the source block of pixels.
*/
for (k = 0; k < nPixelBytes; k++)
pabyDst[k] = pabySrc[k];
pabyDst += nPixelBytes * nPixelGroupBytes;
pabySrc += nOMult * nPixelGroupBytes;
}
}
/* --------------------------------------------------------------------
*/
/* Handle the case of averaging. For this we also have to */
/* handle each sample format we are concerned with. */
/* --------------------------------------------------------------------
*/
else if (strncmp(pszResampling, "averag", 6) == 0 ||
strncmp(pszResampling, "AVERAG", 6) == 0)
{
pabySrc = pabySrcTile + j * nOMult * nBlockXSize * nPixelGroupBytes;
for (i = 0; i * nOMult < nBlockXSize; i++)
{
double dfTotal;
uint32_t nXSize, nYSize, iSample;
if (i + nTXOff >= nOBlockXSize)
break;
nXSize = MIN((uint32_t)nOMult, nBlockXSize - i);
nYSize = MIN((uint32_t)nOMult, nBlockYSize - j);
TIFF_GetSourceSamples(
padfSamples, pabySrc, nPixelBytes, nSampleFormat, nXSize,
nYSize, nPixelGroupBytes, nPixelGroupBytes * nBlockXSize);
dfTotal = 0;
for (iSample = 0; iSample < nXSize * nYSize; iSample++)
{
dfTotal += padfSamples[iSample];
}
TIFF_SetSample(pabyDst, nPixelBytes, nSampleFormat,
dfTotal / (nXSize * nYSize));
pabySrc += nOMult * nPixelGroupBytes;
pabyDst += nPixelBytes;
}
}
}
free(padfSamples);
}
/************************************************************************/
/* TIFF_DownSample_Subsampled() */
/************************************************************************/
static void TIFF_DownSample_Subsampled(
unsigned char *pabySrcTile, int nSample, uint32_t nBlockXSize,
uint32_t nBlockYSize, unsigned char *pabyOTile, uint32_t nOBlockXSize,
uint32_t nOBlockYSize, uint32_t nTXOff, uint32_t nTYOff, int nOMult,
const char *pszResampling, int nHorSubsampling, int nVerSubsampling)
{
/* TODO: test with variety of subsampling values, and incovinient tile/strip
* sizes */
int nSampleBlockSize;
int nSourceSampleRowSize;
int nDestSampleRowSize;
uint32_t nSourceX, nSourceY;
uint32_t nSourceXSec, nSourceYSec;
uint32_t nSourceXSecEnd, nSourceYSecEnd;
uint32_t nDestX, nDestY;
int nSampleOffsetInSampleBlock;
unsigned int nCummulator;
unsigned int nCummulatorCount;
nSampleBlockSize = nHorSubsampling * nVerSubsampling + 2;
nSourceSampleRowSize =
((nBlockXSize + nHorSubsampling - 1) / nHorSubsampling) *
nSampleBlockSize;
nDestSampleRowSize =
((nOBlockXSize + nHorSubsampling - 1) / nHorSubsampling) *
nSampleBlockSize;
if (strncmp(pszResampling, "nearest", 4) == 0 ||
strncmp(pszResampling, "NEAR", 4) == 0)
{
if (nSample == 0)
{
for (nSourceY = 0, nDestY = nTYOff; nSourceY < nBlockYSize;
nSourceY += nOMult, nDestY++)
{
if (nDestY >= nOBlockYSize)
break;
for (nSourceX = 0, nDestX = nTXOff; nSourceX < nBlockXSize;
nSourceX += nOMult, nDestX++)
{
if (nDestX >= nOBlockXSize)
break;
*(pabyOTile +
(nDestY / nVerSubsampling) * nDestSampleRowSize +
(nDestY % nVerSubsampling) * nHorSubsampling +
(nDestX / nHorSubsampling) * nSampleBlockSize +
(nDestX % nHorSubsampling)) =
*(pabySrcTile +
(nSourceY / nVerSubsampling) * nSourceSampleRowSize +
(nSourceY % nVerSubsampling) * nHorSubsampling +
(nSourceX / nHorSubsampling) * nSampleBlockSize +
(nSourceX % nHorSubsampling));
}
}
}
else
{
nSampleOffsetInSampleBlock =
nHorSubsampling * nVerSubsampling + nSample - 1;
for (nSourceY = 0, nDestY = (nTYOff / nVerSubsampling);
nSourceY < (nBlockYSize / nVerSubsampling);
nSourceY += nOMult, nDestY++)
{
if (nDestY * nVerSubsampling >= nOBlockYSize)
break;
for (nSourceX = 0, nDestX = (nTXOff / nHorSubsampling);
nSourceX < (nBlockXSize / nHorSubsampling);
nSourceX += nOMult, nDestX++)
{
if (nDestX * nHorSubsampling >= nOBlockXSize)
break;
*(pabyOTile + nDestY * nDestSampleRowSize +
nDestX * nSampleBlockSize + nSampleOffsetInSampleBlock) =
*(pabySrcTile + nSourceY * nSourceSampleRowSize +
nSourceX * nSampleBlockSize +
nSampleOffsetInSampleBlock);
}
}
}
}
else if (strncmp(pszResampling, "averag", 6) == 0 ||
strncmp(pszResampling, "AVERAG", 6) == 0)
{
if (nSample == 0)
{
for (nSourceY = 0, nDestY = nTYOff; nSourceY < nBlockYSize;
nSourceY += nOMult, nDestY++)
{
if (nDestY >= nOBlockYSize)
break;
for (nSourceX = 0, nDestX = nTXOff; nSourceX < nBlockXSize;
nSourceX += nOMult, nDestX++)
{
if (nDestX >= nOBlockXSize)
break;
nSourceXSecEnd = nSourceX + nOMult;
if (nSourceXSecEnd > nBlockXSize)
nSourceXSecEnd = nBlockXSize;
nSourceYSecEnd = nSourceY + nOMult;
if (nSourceYSecEnd > nBlockYSize)
nSourceYSecEnd = nBlockYSize;
nCummulator = 0;
for (nSourceYSec = nSourceY; nSourceYSec < nSourceYSecEnd;
nSourceYSec++)
{
for (nSourceXSec = nSourceX;
nSourceXSec < nSourceXSecEnd; nSourceXSec++)
{
nCummulator += *(pabySrcTile +
(nSourceYSec / nVerSubsampling) *
nSourceSampleRowSize +
(nSourceYSec % nVerSubsampling) *
nHorSubsampling +
(nSourceXSec / nHorSubsampling) *
nSampleBlockSize +
(nSourceXSec % nHorSubsampling));
}
}
nCummulatorCount = (nSourceXSecEnd - nSourceX) *
(nSourceYSecEnd - nSourceY);
*(pabyOTile +
(nDestY / nVerSubsampling) * nDestSampleRowSize +
(nDestY % nVerSubsampling) * nHorSubsampling +
(nDestX / nHorSubsampling) * nSampleBlockSize +
(nDestX % nHorSubsampling)) =
((nCummulator + (nCummulatorCount >> 1)) /
nCummulatorCount);
}
}
}
else
{
nSampleOffsetInSampleBlock =
nHorSubsampling * nVerSubsampling + nSample - 1;
for (nSourceY = 0, nDestY = (nTYOff / nVerSubsampling);
nSourceY < (nBlockYSize / nVerSubsampling);
nSourceY += nOMult, nDestY++)
{
if (nDestY * nVerSubsampling >= nOBlockYSize)
break;
for (nSourceX = 0, nDestX = (nTXOff / nHorSubsampling);
nSourceX < (nBlockXSize / nHorSubsampling);
nSourceX += nOMult, nDestX++)
{
if (nDestX * nHorSubsampling >= nOBlockXSize)
break;
nSourceXSecEnd = nSourceX + nOMult;
if (nSourceXSecEnd > (nBlockXSize / nHorSubsampling))
nSourceXSecEnd = (nBlockXSize / nHorSubsampling);
nSourceYSecEnd = nSourceY + nOMult;
if (nSourceYSecEnd > (nBlockYSize / nVerSubsampling))
nSourceYSecEnd = (nBlockYSize / nVerSubsampling);
nCummulator = 0;
for (nSourceYSec = nSourceY; nSourceYSec < nSourceYSecEnd;
nSourceYSec++)
{
for (nSourceXSec = nSourceX;
nSourceXSec < nSourceXSecEnd; nSourceXSec++)
{
nCummulator +=
*(pabySrcTile +
nSourceYSec * nSourceSampleRowSize +
nSourceXSec * nSampleBlockSize +
nSampleOffsetInSampleBlock);
}
}
nCummulatorCount = (nSourceXSecEnd - nSourceX) *
(nSourceYSecEnd - nSourceY);
*(pabyOTile + nDestY * nDestSampleRowSize +
nDestX * nSampleBlockSize + nSampleOffsetInSampleBlock) =
((nCummulator + (nCummulatorCount >> 1)) /
nCummulatorCount);
}
}
}
}
}
/************************************************************************/
/* TIFF_ProcessFullResBlock() */
/* */
/* Process one block of full res data, downsampling into each */
/* of the overviews. */
/************************************************************************/
void TIFF_ProcessFullResBlock(TIFF *hTIFF, int nPlanarConfig, int bSubsampled,
int nHorSubsampling, int nVerSubsampling,
int nOverviews, int *panOvList, int nBitsPerPixel,
int nSamples, TIFFOvrCache **papoRawBIs,
uint32_t nSXOff, uint32_t nSYOff,
unsigned char *pabySrcTile, uint32_t nBlockXSize,
uint32_t nBlockYSize, int nSampleFormat,
const char *pszResampling)
{
int iOverview, iSample;
for (iSample = 0; iSample < nSamples; iSample++)
{
/*
* We have to read a tile/strip for each sample for
* PLANARCONFIG_SEPARATE. Otherwise, we just read all the samples
* at once when handling the first sample.
*/
if (nPlanarConfig == PLANARCONFIG_SEPARATE || iSample == 0)
{
if (TIFFIsTiled(hTIFF))
{
TIFFReadEncodedTile(hTIFF,
TIFFComputeTile(hTIFF, nSXOff, nSYOff, 0,
(tsample_t)iSample),
pabySrcTile, TIFFTileSize(hTIFF));
}
else
{
TIFFReadEncodedStrip(
hTIFF, TIFFComputeStrip(hTIFF, nSYOff, (tsample_t)iSample),
pabySrcTile, TIFFStripSize(hTIFF));
}
}
/*
* Loop over destination overview layers
*/
for (iOverview = 0; iOverview < nOverviews; iOverview++)
{
TIFFOvrCache *poRBI = papoRawBIs[iOverview];
unsigned char *pabyOTile;
uint32_t nTXOff, nTYOff, nOXOff, nOYOff, nOMult;
uint32_t nOBlockXSize = poRBI->nBlockXSize;
uint32_t nOBlockYSize = poRBI->nBlockYSize;
int nSkewBits, nSampleByteOffset;
/*
* Fetch the destination overview tile
*/
nOMult = panOvList[iOverview];
nOXOff = (nSXOff / nOMult) / nOBlockXSize;
nOYOff = (nSYOff / nOMult) / nOBlockYSize;
if (bSubsampled)
{
pabyOTile = TIFFGetOvrBlock_Subsampled(poRBI, nOXOff, nOYOff);
/*
* Establish the offset into this tile at which we should
* start placing data.
*/
nTXOff = (nSXOff - nOXOff * nOMult * nOBlockXSize) / nOMult;
nTYOff = (nSYOff - nOYOff * nOMult * nOBlockYSize) / nOMult;
#ifdef DBMALLOC
malloc_chain_check(1);
#endif
TIFF_DownSample_Subsampled(
pabySrcTile, iSample, nBlockXSize, nBlockYSize, pabyOTile,
poRBI->nBlockXSize, poRBI->nBlockYSize, nTXOff, nTYOff,
nOMult, pszResampling, nHorSubsampling, nVerSubsampling);
#ifdef DBMALLOC
malloc_chain_check(1);
#endif
}
else
{
pabyOTile = TIFFGetOvrBlock(poRBI, nOXOff, nOYOff, iSample);
/*
* Establish the offset into this tile at which we should
* start placing data.
*/
nTXOff = (nSXOff - nOXOff * nOMult * nOBlockXSize) / nOMult;
nTYOff = (nSYOff - nOYOff * nOMult * nOBlockYSize) / nOMult;
/*
* Figure out the skew (extra space between ``our samples'') and
* the byte offset to the first sample.
*/
assert((nBitsPerPixel % 8) == 0);
if (nPlanarConfig == PLANARCONFIG_SEPARATE)
{
nSkewBits = 0;
nSampleByteOffset = 0;
}
else
{
nSkewBits = nBitsPerPixel * (nSamples - 1);
nSampleByteOffset = (nBitsPerPixel / 8) * iSample;
}
/*
* Perform the downsampling.
*/
#ifdef DBMALLOC
malloc_chain_check(1);
#endif
TIFF_DownSample(pabySrcTile + nSampleByteOffset, nBlockXSize,
nBlockYSize, nSkewBits, nBitsPerPixel,
pabyOTile, poRBI->nBlockXSize,
poRBI->nBlockYSize, nTXOff, nTYOff, nOMult,
nSampleFormat, pszResampling);
#ifdef DBMALLOC
malloc_chain_check(1);
#endif
}
}
}
}
/************************************************************************/
/* TIFF_BuildOverviews() */
/* */
/* Build the requested list of overviews. Overviews are */
/* maintained in a bunch of temporary files and then these are */
/* written back to the TIFF file. Only one pass through the */
/* source TIFF file is made for any number of output */
/* overviews. */
/************************************************************************/
void TIFFBuildOverviews(TIFF *hTIFF, int nOverviews, int *panOvList,
int bUseSubIFDs, const char *pszResampleMethod,
int (*pfnProgress)(double, void *), void *pProgressData)
{
TIFFOvrCache **papoRawBIs;
uint32_t nXSize, nYSize, nBlockXSize, nBlockYSize;
uint16_t nBitsPerPixel, nPhotometric, nCompressFlag, nSamples,
nPlanarConfig, nSampleFormat;
int bSubsampled;
uint16_t nHorSubsampling, nVerSubsampling;
int bTiled, nSXOff, nSYOff, i;
unsigned char *pabySrcTile;
uint16_t *panRedMap, *panGreenMap, *panBlueMap;
TIFFErrorHandler pfnWarning;
(void)pfnProgress;
(void)pProgressData;
/* -------------------------------------------------------------------- */
/* Get the base raster size. */
/* -------------------------------------------------------------------- */
TIFFGetField(hTIFF, TIFFTAG_IMAGEWIDTH, &nXSize);
TIFFGetField(hTIFF, TIFFTAG_IMAGELENGTH, &nYSize);
TIFFGetField(hTIFF, TIFFTAG_BITSPERSAMPLE, &nBitsPerPixel);
/* TODO: nBitsPerPixel seems misnomer and may need renaming to
* nBitsPerSample */
TIFFGetField(hTIFF, TIFFTAG_SAMPLESPERPIXEL, &nSamples);
TIFFGetFieldDefaulted(hTIFF, TIFFTAG_PLANARCONFIG, &nPlanarConfig);
TIFFGetFieldDefaulted(hTIFF, TIFFTAG_PHOTOMETRIC, &nPhotometric);
TIFFGetFieldDefaulted(hTIFF, TIFFTAG_COMPRESSION, &nCompressFlag);
TIFFGetFieldDefaulted(hTIFF, TIFFTAG_SAMPLEFORMAT, &nSampleFormat);
if (nPhotometric == PHOTOMETRIC_YCBCR || nPhotometric == PHOTOMETRIC_ITULAB)
{
if (nBitsPerPixel != 8 || nSamples != 3 ||
nPlanarConfig != PLANARCONFIG_CONTIG ||
nSampleFormat != SAMPLEFORMAT_UINT)
{
/* TODO: use of TIFFError is inconsistent with use of fprintf in
* addtiffo.c, sort out */
TIFFErrorExt(
TIFFClientdata(hTIFF), "TIFFBuildOverviews",
"File `%s' has an unsupported subsampling configuration.\n",
TIFFFileName(hTIFF));
/* If you need support for this particular flavor, please contact
* either Frank Warmerdam warmerdam@pobox.com Joris Van Damme
* info@awaresystems.be
*/
return;
}
bSubsampled = 1;
TIFFGetField(hTIFF, TIFFTAG_YCBCRSUBSAMPLING, &nHorSubsampling,
&nVerSubsampling);
/* TODO: find out if maybe TIFFGetFieldDefaulted is better choice for
* YCbCrSubsampling tag */
}
else
{
if (nBitsPerPixel < 8)
{
/* TODO: use of TIFFError is inconsistent with use of fprintf in
* addtiffo.c, sort out */
TIFFErrorExt(
TIFFClientdata(hTIFF), "TIFFBuildOverviews",
"File `%s' has samples of %d bits per sample. Sample\n"
"sizes of less than 8 bits per sample are not supported.\n",
TIFFFileName(hTIFF), nBitsPerPixel);
return;
}
bSubsampled = 0;
nHorSubsampling = 1;
nVerSubsampling = 1;
}
/* -------------------------------------------------------------------- */
/* Turn off warnings to avoid a lot of repeated warnings while */
/* rereading directories. */
/* -------------------------------------------------------------------- */
pfnWarning = TIFFSetWarningHandler(NULL);
/* -------------------------------------------------------------------- */
/* Get the base raster block size. */
/* -------------------------------------------------------------------- */
if (TIFFGetField(hTIFF, TIFFTAG_ROWSPERSTRIP, &(nBlockYSize)))
{
nBlockXSize = nXSize;
bTiled = FALSE;
}
else
{
TIFFGetField(hTIFF, TIFFTAG_TILEWIDTH, &nBlockXSize);
TIFFGetField(hTIFF, TIFFTAG_TILELENGTH, &nBlockYSize);
bTiled = TRUE;
}
/* -------------------------------------------------------------------- */
/* Capture the palette if there is one. */
/* -------------------------------------------------------------------- */
if (TIFFGetField(hTIFF, TIFFTAG_COLORMAP, &panRedMap, &panGreenMap,
&panBlueMap))
{
uint16_t *panRed2, *panGreen2, *panBlue2;
int nColorCount = 1 << nBitsPerPixel;
panRed2 = (uint16_t *)_TIFFmalloc(2 * nColorCount);
panGreen2 = (uint16_t *)_TIFFmalloc(2 * nColorCount);
panBlue2 = (uint16_t *)_TIFFmalloc(2 * nColorCount);
memcpy(panRed2, panRedMap, 2 * nColorCount);
memcpy(panGreen2, panGreenMap, 2 * nColorCount);
memcpy(panBlue2, panBlueMap, 2 * nColorCount);
panRedMap = panRed2;
panGreenMap = panGreen2;
panBlueMap = panBlue2;
}
else
{
panRedMap = panGreenMap = panBlueMap = NULL;
}
/* -------------------------------------------------------------------- */
/* Initialize overviews. */
/* -------------------------------------------------------------------- */
papoRawBIs = (TIFFOvrCache **)_TIFFmalloc(nOverviews * sizeof(void *));
for (i = 0; i < nOverviews; i++)
{
uint32_t nOXSize, nOYSize, nOBlockXSize, nOBlockYSize;
toff_t nDirOffset;
nOXSize = (nXSize + panOvList[i] - 1) / panOvList[i];
nOYSize = (nYSize + panOvList[i] - 1) / panOvList[i];
nOBlockXSize = MIN(nBlockXSize, nOXSize);
nOBlockYSize = MIN(nBlockYSize, nOYSize);
if (bTiled)
{
if ((nOBlockXSize % 16) != 0)
nOBlockXSize = nOBlockXSize + 16 - (nOBlockXSize % 16);
if ((nOBlockYSize % 16) != 0)
nOBlockYSize = nOBlockYSize + 16 - (nOBlockYSize % 16);
}
nDirOffset = TIFF_WriteOverview(
hTIFF, nOXSize, nOYSize, nBitsPerPixel, nPlanarConfig, nSamples,
nOBlockXSize, nOBlockYSize, bTiled, nCompressFlag, nPhotometric,
nSampleFormat, panRedMap, panGreenMap, panBlueMap, bUseSubIFDs,
nHorSubsampling, nVerSubsampling);
papoRawBIs[i] = TIFFCreateOvrCache(hTIFF, nDirOffset);
}
if (panRedMap != NULL)
{
_TIFFfree(panRedMap);
_TIFFfree(panGreenMap);
_TIFFfree(panBlueMap);
}
/* -------------------------------------------------------------------- */
/* Allocate a buffer to hold a source block. */
/* -------------------------------------------------------------------- */
if (bTiled)
pabySrcTile = (unsigned char *)_TIFFmalloc(TIFFTileSize(hTIFF));
else
pabySrcTile = (unsigned char *)_TIFFmalloc(TIFFStripSize(hTIFF));
/* -------------------------------------------------------------------- */
/* Loop over the source raster, applying data to the */
/* destination raster. */
/* -------------------------------------------------------------------- */
for (nSYOff = 0; nSYOff < (int)nYSize; nSYOff += nBlockYSize)
{
for (nSXOff = 0; nSXOff < (int)nXSize; nSXOff += nBlockXSize)
{
/*
* Read and resample into the various overview images.
*/
TIFF_ProcessFullResBlock(
hTIFF, nPlanarConfig, bSubsampled, nHorSubsampling,
nVerSubsampling, nOverviews, panOvList, nBitsPerPixel, nSamples,
papoRawBIs, nSXOff, nSYOff, pabySrcTile, nBlockXSize,
nBlockYSize, nSampleFormat, pszResampleMethod);
}
}
_TIFFfree(pabySrcTile);
/* -------------------------------------------------------------------- */
/* Cleanup the rawblockedimage files. */
/* -------------------------------------------------------------------- */
for (i = 0; i < nOverviews; i++)
{
TIFFDestroyOvrCache(papoRawBIs[i]);
}
if (papoRawBIs != NULL)
_TIFFfree(papoRawBIs);
TIFFSetWarningHandler(pfnWarning);
}
-353
View File
@@ -1,353 +0,0 @@
/******************************************************************************
* Project: TIFF Overview Builder
* Purpose: Library functions to maintain two rows of tiles or two strips
* of data for output overviews as an output cache.
* Author: Frank Warmerdam, warmerdam@pobox.com
*
******************************************************************************
* Copyright (c) 2000, Frank Warmerdam
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
******************************************************************************
*/
#include "tif_ovrcache.h"
#include "tiffiop.h"
#include <assert.h>
/************************************************************************/
/* TIFFCreateOvrCache() */
/* */
/* Create an overview cache to hold two rows of blocks from an */
/* existing TIFF directory. */
/************************************************************************/
TIFFOvrCache *TIFFCreateOvrCache(TIFF *hTIFF, toff_t nDirOffset)
{
TIFFOvrCache *psCache;
toff_t nBaseDirOffset;
int nRet;
psCache = (TIFFOvrCache *)_TIFFmalloc(sizeof(TIFFOvrCache));
psCache->nDirOffset = nDirOffset;
psCache->hTIFF = hTIFF;
/* -------------------------------------------------------------------- */
/* Get definition of this raster from the TIFF file itself. */
/* -------------------------------------------------------------------- */
nBaseDirOffset = TIFFCurrentDirOffset(psCache->hTIFF);
nRet = TIFFSetSubDirectory(hTIFF, nDirOffset);
(void)nRet;
assert(nRet == 1);
TIFFGetField(hTIFF, TIFFTAG_IMAGEWIDTH, &(psCache->nXSize));
TIFFGetField(hTIFF, TIFFTAG_IMAGELENGTH, &(psCache->nYSize));
TIFFGetField(hTIFF, TIFFTAG_BITSPERSAMPLE, &(psCache->nBitsPerPixel));
TIFFGetField(hTIFF, TIFFTAG_SAMPLESPERPIXEL, &(psCache->nSamples));
TIFFGetField(hTIFF, TIFFTAG_PLANARCONFIG, &(psCache->nPlanarConfig));
if (!TIFFIsTiled(hTIFF))
{
TIFFGetField(hTIFF, TIFFTAG_ROWSPERSTRIP, &(psCache->nBlockYSize));
psCache->nBlockXSize = psCache->nXSize;
psCache->nBytesPerBlock = TIFFStripSize(hTIFF);
psCache->bTiled = FALSE;
}
else
{
TIFFGetField(hTIFF, TIFFTAG_TILEWIDTH, &(psCache->nBlockXSize));
TIFFGetField(hTIFF, TIFFTAG_TILELENGTH, &(psCache->nBlockYSize));
psCache->nBytesPerBlock = TIFFTileSize(hTIFF);
psCache->bTiled = TRUE;
}
/* -------------------------------------------------------------------- */
/* Compute some values from this. */
/* -------------------------------------------------------------------- */
psCache->nBlocksPerRow =
(psCache->nXSize + psCache->nBlockXSize - 1) / psCache->nBlockXSize;
psCache->nBlocksPerColumn =
(psCache->nYSize + psCache->nBlockYSize - 1) / psCache->nBlockYSize;
if (psCache->nPlanarConfig == PLANARCONFIG_SEPARATE)
psCache->nBytesPerRow = psCache->nBytesPerBlock *
psCache->nBlocksPerRow * psCache->nSamples;
else
psCache->nBytesPerRow =
psCache->nBytesPerBlock * psCache->nBlocksPerRow;
/* -------------------------------------------------------------------- */
/* Allocate and initialize the data buffers. */
/* -------------------------------------------------------------------- */
psCache->pabyRow1Blocks =
(unsigned char *)_TIFFmalloc(psCache->nBytesPerRow);
psCache->pabyRow2Blocks =
(unsigned char *)_TIFFmalloc(psCache->nBytesPerRow);
if (psCache->pabyRow1Blocks == NULL || psCache->pabyRow2Blocks == NULL)
{
TIFFErrorExt(hTIFF->tif_clientdata, hTIFF->tif_name,
"Can't allocate memory for overview cache.");
/* TODO: use of TIFFError is inconsistent with use of fprintf in
* addtiffo.c, sort out */
if (psCache->pabyRow1Blocks)
_TIFFfree(psCache->pabyRow1Blocks);
if (psCache->pabyRow2Blocks)
_TIFFfree(psCache->pabyRow2Blocks);
_TIFFfree(psCache);
return NULL;
}
_TIFFmemset(psCache->pabyRow1Blocks, 0, psCache->nBytesPerRow);
_TIFFmemset(psCache->pabyRow2Blocks, 0, psCache->nBytesPerRow);
psCache->nBlockOffset = 0;
nRet = TIFFSetSubDirectory(psCache->hTIFF, nBaseDirOffset);
(void)nRet;
assert(nRet == 1);
return psCache;
}
/************************************************************************/
/* TIFFWriteOvrRow() */
/* */
/* Write one entire row of blocks (row 1) to the tiff file, and */
/* then rotate the block buffers, essentially moving things */
/* down by one block. */
/************************************************************************/
static void TIFFWriteOvrRow(TIFFOvrCache *psCache)
{
int nRet, iTileX, iTileY = psCache->nBlockOffset;
unsigned char *pabyData;
toff_t nBaseDirOffset;
uint32_t RowsInStrip;
/* -------------------------------------------------------------------- */
/* If the output cache is multi-byte per sample, and the file */
/* being written to is of a different byte order than the current */
/* platform, we will need to byte swap the data. */
/* -------------------------------------------------------------------- */
if (TIFFIsByteSwapped(psCache->hTIFF))
{
if (psCache->nBitsPerPixel == 16)
TIFFSwabArrayOfShort((uint16_t *)psCache->pabyRow1Blocks,
(psCache->nBytesPerBlock * psCache->nSamples) /
2);
else if (psCache->nBitsPerPixel == 32)
TIFFSwabArrayOfLong((uint32_t *)psCache->pabyRow1Blocks,
(psCache->nBytesPerBlock * psCache->nSamples) /
4);
else if (psCache->nBitsPerPixel == 64)
TIFFSwabArrayOfDouble(
(double *)psCache->pabyRow1Blocks,
(psCache->nBytesPerBlock * psCache->nSamples) / 8);
}
/* -------------------------------------------------------------------- */
/* Record original directory position, so we can restore it at */
/* end. */
/* -------------------------------------------------------------------- */
nBaseDirOffset = TIFFCurrentDirOffset(psCache->hTIFF);
nRet = TIFFSetSubDirectory(psCache->hTIFF, psCache->nDirOffset);
(void)nRet;
assert(nRet == 1);
/* -------------------------------------------------------------------- */
/* Write blocks to TIFF file. */
/* -------------------------------------------------------------------- */
for (iTileX = 0; iTileX < psCache->nBlocksPerRow; iTileX++)
{
int nTileID;
if (psCache->nPlanarConfig == PLANARCONFIG_SEPARATE)
{
int iSample;
for (iSample = 0; iSample < psCache->nSamples; iSample++)
{
pabyData = TIFFGetOvrBlock(psCache, iTileX, iTileY, iSample);
if (psCache->bTiled)
{
nTileID = TIFFComputeTile(
psCache->hTIFF, iTileX * psCache->nBlockXSize,
iTileY * psCache->nBlockYSize, 0, (tsample_t)iSample);
if (TIFFWriteEncodedTile(psCache->hTIFF, nTileID, pabyData,
TIFFTileSize(psCache->hTIFF)) < 0)
{
fprintf(stderr, "TIFFWriteEncodedTile() failed\n");
}
}
else
{
nTileID = TIFFComputeStrip(psCache->hTIFF,
iTileY * psCache->nBlockYSize,
(tsample_t)iSample);
RowsInStrip = psCache->nBlockYSize;
if ((iTileY + 1) * psCache->nBlockYSize > psCache->nYSize)
RowsInStrip =
psCache->nYSize - iTileY * psCache->nBlockYSize;
if (TIFFWriteEncodedStrip(
psCache->hTIFF, nTileID, pabyData,
TIFFVStripSize(psCache->hTIFF, RowsInStrip)) < 0)
{
fprintf(stderr, "TIFFWriteEncodedStrip() failed\n");
}
}
}
}
else
{
pabyData = TIFFGetOvrBlock(psCache, iTileX, iTileY, 0);
if (psCache->bTiled)
{
nTileID = TIFFComputeTile(psCache->hTIFF,
iTileX * psCache->nBlockXSize,
iTileY * psCache->nBlockYSize, 0, 0);
if (TIFFWriteEncodedTile(psCache->hTIFF, nTileID, pabyData,
TIFFTileSize(psCache->hTIFF)) < 0)
{
fprintf(stderr, "TIFFWriteEncodedTile() failed\n");
}
}
else
{
nTileID = TIFFComputeStrip(psCache->hTIFF,
iTileY * psCache->nBlockYSize, 0);
RowsInStrip = psCache->nBlockYSize;
if ((iTileY + 1) * psCache->nBlockYSize > psCache->nYSize)
RowsInStrip =
psCache->nYSize - iTileY * psCache->nBlockYSize;
if (TIFFWriteEncodedStrip(
psCache->hTIFF, nTileID, pabyData,
TIFFVStripSize(psCache->hTIFF, RowsInStrip)) < 0)
{
fprintf(stderr, "TIFFWriteEncodedStrip() failed\n");
}
}
}
}
/* -------------------------------------------------------------------- */
/* Rotate buffers. */
/* -------------------------------------------------------------------- */
pabyData = psCache->pabyRow1Blocks;
psCache->pabyRow1Blocks = psCache->pabyRow2Blocks;
psCache->pabyRow2Blocks = pabyData;
_TIFFmemset(pabyData, 0, psCache->nBytesPerRow);
psCache->nBlockOffset++;
/* -------------------------------------------------------------------- */
/* Restore access to original directory. */
/* -------------------------------------------------------------------- */
TIFFFlush(psCache->hTIFF);
/* TODO: add checks on error status return of TIFFFlush */
TIFFSetSubDirectory(psCache->hTIFF, nBaseDirOffset);
/* TODO: add checks on error status return of TIFFSetSubDirectory */
}
/************************************************************************/
/* TIFFGetOvrBlock() */
/************************************************************************/
/* TODO: make TIFF_Downsample handle iSample offset, so that we can
* do with a single TIFFGetOvrBlock and no longer need
* TIFFGetOvrBlock_Subsampled */
unsigned char *TIFFGetOvrBlock(TIFFOvrCache *psCache, int iTileX, int iTileY,
int iSample)
{
long nRowOffset;
if (iTileY > psCache->nBlockOffset + 1)
TIFFWriteOvrRow(psCache);
assert(iTileX >= 0 && iTileX < psCache->nBlocksPerRow);
assert(iTileY >= 0 && iTileY < psCache->nBlocksPerColumn);
assert(iTileY >= psCache->nBlockOffset &&
iTileY < psCache->nBlockOffset + 2);
assert(iSample >= 0 && iSample < psCache->nSamples);
if (psCache->nPlanarConfig == PLANARCONFIG_SEPARATE)
nRowOffset = ((((toff_t)iTileX * psCache->nSamples) + iSample) *
psCache->nBytesPerBlock);
else
nRowOffset = iTileX * psCache->nBytesPerBlock +
(psCache->nBitsPerPixel + 7) / 8 * iSample;
if (iTileY == psCache->nBlockOffset)
return psCache->pabyRow1Blocks + nRowOffset;
else
return psCache->pabyRow2Blocks + nRowOffset;
}
/************************************************************************/
/* TIFFGetOvrBlock_Subsampled() */
/************************************************************************/
unsigned char *TIFFGetOvrBlock_Subsampled(TIFFOvrCache *psCache, int iTileX,
int iTileY)
{
int nRowOffset;
if (iTileY > psCache->nBlockOffset + 1)
TIFFWriteOvrRow(psCache);
assert(iTileX >= 0 && iTileX < psCache->nBlocksPerRow);
assert(iTileY >= 0 && iTileY < psCache->nBlocksPerColumn);
assert(iTileY >= psCache->nBlockOffset &&
iTileY < psCache->nBlockOffset + 2);
assert(psCache->nPlanarConfig != PLANARCONFIG_SEPARATE);
nRowOffset = iTileX * psCache->nBytesPerBlock;
if (iTileY == psCache->nBlockOffset)
return psCache->pabyRow1Blocks + nRowOffset;
else
return psCache->pabyRow2Blocks + nRowOffset;
}
/************************************************************************/
/* TIFFDestroyOvrCache() */
/************************************************************************/
void TIFFDestroyOvrCache(TIFFOvrCache *psCache)
{
while (psCache->nBlockOffset < psCache->nBlocksPerColumn)
TIFFWriteOvrRow(psCache);
_TIFFfree(psCache->pabyRow1Blocks);
_TIFFfree(psCache->pabyRow2Blocks);
_TIFFfree(psCache);
}
-95
View File
@@ -1,95 +0,0 @@
/******************************************************************************
* tif_ovrcache.h,v 1.3 2005/05/25 09:03:16 dron Exp
*
* Project: TIFF Overview Builder
* Purpose: Library functions to maintain two rows of tiles or two strips
* of data for output overviews as an output cache.
* Author: Frank Warmerdam, warmerdam@pobox.com
*
* This code could potentially be used by other applications wanting to
* manage a once-through write cache.
*
******************************************************************************
* Copyright (c) 2000, Frank Warmerdam
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
******************************************************************************
*/
#ifndef TIF_OVRCACHE_H_INCLUDED
#define TIF_OVRCACHE_H_INCLUDED
#include "tiffio.h"
#if defined(__cplusplus)
extern "C"
{
#endif
typedef struct
{
uint32_t nXSize;
uint32_t nYSize;
uint16_t nBitsPerPixel;
uint16_t nSamples;
uint16_t nPlanarConfig;
uint32_t nBlockXSize;
uint32_t nBlockYSize;
toff_t nBytesPerBlock;
toff_t nBytesPerRow;
int nBlocksPerRow;
int nBlocksPerColumn;
int nBlockOffset; /* what block is the first in papabyBlocks? */
unsigned char *pabyRow1Blocks;
unsigned char *pabyRow2Blocks;
toff_t nDirOffset;
TIFF *hTIFF;
int bTiled;
} TIFFOvrCache;
TIFFOvrCache *TIFFCreateOvrCache(TIFF *hTIFF, toff_t nDirOffset);
unsigned char *TIFFGetOvrBlock(TIFFOvrCache *psCache, int iTileX,
int iTileY, int iSample);
unsigned char *TIFFGetOvrBlock_Subsampled(TIFFOvrCache *psCache, int iTileX,
int iTileY);
void TIFFDestroyOvrCache(TIFFOvrCache *);
void TIFFBuildOverviews(TIFF *, int, int *, int, const char *,
int (*)(double, void *), void *);
void TIFF_ProcessFullResBlock(TIFF *, int, int, int, int, int, int *, int,
int, TIFFOvrCache **, uint32_t, uint32_t,
unsigned char *, uint32_t, uint32_t, int,
const char *);
uint32_t TIFF_WriteOverview(TIFF *, uint32_t, uint32_t, int, int, int, int,
int, int, int, int, int, unsigned short *,
unsigned short *, unsigned short *, int, int,
int);
#if defined(__cplusplus)
}
#endif
#endif /* ndef TIF_OVRCACHE_H_INCLUDED */
-46
View File
@@ -1,46 +0,0 @@
# CMake build for libtiff
#
# Copyright © 2015 Open Microscopy Environment / University of Dundee
# Written by Roger Leigh <rleigh@codelibre.net>
#
# Permission to use, copy, modify, distribute, and sell this software and
# its documentation for any purpose is hereby granted without fee, provided
# that (i) the above copyright notices and this permission notice appear in
# all copies of the software and related documentation, and (ii) the names of
# Sam Leffler and Silicon Graphics may not be used in any advertising or
# publicity relating to the software without the specific, prior written
# permission of Sam Leffler and Silicon Graphics.
#
# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
#
# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
# OF THIS SOFTWARE.
add_executable(tiff-bi tiff-bi.c)
target_link_libraries(tiff-bi tiff tiff_port)
add_executable(tiff-grayscale tiff-grayscale.c)
target_link_libraries(tiff-grayscale tiff tiff_port CMath::CMath)
add_executable(tiff-palette tiff-palette.c)
target_link_libraries(tiff-palette tiff tiff_port)
add_executable(tiff-rgb tiff-rgb.c)
target_link_libraries(tiff-rgb tiff tiff_port CMath::CMath)
if(WEBP_SUPPORT AND EMSCRIPTEN)
# Emscripten is pretty finnicky about linker flags.
# It needs --shared-memory if and only if atomics or bulk-memory is used.
foreach(target tiff-bi
tiff-grayscale
tiff-palette
tiff-rgb)
target_link_options(${target} PUBLIC "-Wl,--shared-memory")
endforeach()
endif()
+12
View File
@@ -0,0 +1,12 @@
#
# Imakefile -- to generate a Makefile, do xmkmf
#
TIFF = ../../libtiff
EXTRA_LIBRARIES = $(TIFF)/libtiff.a
EXTRA_INCLUDES = -I$(TIFF)
AllTarget(bi gray pal rgb)
NormalProgramTarget(bi,tiff-bi.o,,,)
NormalProgramTarget(gray,tiff-grayscale.o,,,-lm)
NormalProgramTarget(pal,tiff-palette.o,,,)
NormalProgramTarget(rgb,tiff-rgb.o,,,-lm)

Some files were not shown because too many files have changed in this diff Show More