diff options
author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2015-11-06 05:38:49 +0100 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2015-11-06 05:38:49 +0100 |
commit | 9491825ddff7a294d1f49061bae7044e426aeb2e (patch) | |
tree | 06e651099f87140ec534ae47fb8ce1ac6ec7976d /tiff/contrib/addtiffo | |
parent | fa756339d4204bff7f2820067f58214d32780d17 (diff) |
Imported Upstream version 1.8.3
Diffstat (limited to 'tiff/contrib/addtiffo')
-rwxr-xr-x | tiff/contrib/addtiffo/Makefile.am | 36 | ||||
-rwxr-xr-x | tiff/contrib/addtiffo/Makefile.in | 647 | ||||
-rwxr-xr-x | tiff/contrib/addtiffo/Makefile.vc | 28 | ||||
-rwxr-xr-x | tiff/contrib/addtiffo/README | 142 | ||||
-rwxr-xr-x | tiff/contrib/addtiffo/addtiffo.c | 176 | ||||
-rwxr-xr-x | tiff/contrib/addtiffo/tif_overview.c | 899 | ||||
-rwxr-xr-x | tiff/contrib/addtiffo/tif_ovrcache.c | 341 | ||||
-rwxr-xr-x | tiff/contrib/addtiffo/tif_ovrcache.h | 103 |
8 files changed, 2372 insertions, 0 deletions
diff --git a/tiff/contrib/addtiffo/Makefile.am b/tiff/contrib/addtiffo/Makefile.am new file mode 100755 index 0000000..d634a15 --- /dev/null +++ b/tiff/contrib/addtiffo/Makefile.am @@ -0,0 +1,36 @@ +# 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 = README Makefile.vc + +noinst_PROGRAMS = addtiffo + +addtiffo_SOURCES = addtiffo.c tif_overview.c tif_ovrcache.c tif_ovrcache.h +addtiffo_LDADD = $(LIBTIFF) + +AM_CPPFLAGS = -I$(top_srcdir)/libtiff + diff --git a/tiff/contrib/addtiffo/Makefile.in b/tiff/contrib/addtiffo/Makefile.in new file mode 100755 index 0000000..2b384a5 --- /dev/null +++ b/tiff/contrib/addtiffo/Makefile.in @@ -0,0 +1,647 @@ +# Makefile.in generated by automake 1.15 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2014 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# 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. + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +noinst_PROGRAMS = addtiffo$(EXEEXT) +subdir = contrib/addtiffo +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/libtiff/tif_config.h \ + $(top_builddir)/libtiff/tiffconf.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +PROGRAMS = $(noinst_PROGRAMS) +am_addtiffo_OBJECTS = addtiffo.$(OBJEXT) tif_overview.$(OBJEXT) \ + tif_ovrcache.$(OBJEXT) +addtiffo_OBJECTS = $(am_addtiffo_OBJECTS) +addtiffo_DEPENDENCIES = $(LIBTIFF) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/libtiff +depcomp = $(SHELL) $(top_srcdir)/config/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(addtiffo_SOURCES) +DIST_SOURCES = $(addtiffo_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/config/depcomp \ + $(top_srcdir)/config/mkinstalldirs README +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GLUT_CFLAGS = @GLUT_CFLAGS@ +GLUT_LIBS = @GLUT_LIBS@ +GLU_CFLAGS = @GLU_CFLAGS@ +GLU_LIBS = @GLU_LIBS@ +GL_CFLAGS = @GL_CFLAGS@ +GL_LIBS = @GL_LIBS@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBDIR = @LIBDIR@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTIFF_ALPHA_VERSION = @LIBTIFF_ALPHA_VERSION@ +LIBTIFF_DOCDIR = @LIBTIFF_DOCDIR@ +LIBTIFF_MAJOR_VERSION = @LIBTIFF_MAJOR_VERSION@ +LIBTIFF_MICRO_VERSION = @LIBTIFF_MICRO_VERSION@ +LIBTIFF_MINOR_VERSION = @LIBTIFF_MINOR_VERSION@ +LIBTIFF_RELEASE_DATE = @LIBTIFF_RELEASE_DATE@ +LIBTIFF_VERSION = @LIBTIFF_VERSION@ +LIBTIFF_VERSION_INFO = @LIBTIFF_VERSION_INFO@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PTHREAD_CC = @PTHREAD_CC@ +PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ +PTHREAD_LIBS = @PTHREAD_LIBS@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +XMKMF = @XMKMF@ +X_CFLAGS = @X_CFLAGS@ +X_EXTRA_LIBS = @X_EXTRA_LIBS@ +X_LIBS = @X_LIBS@ +X_PRE_LIBS = @X_PRE_LIBS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +ax_pthread_config = @ax_pthread_config@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +tiff_libs_private = @tiff_libs_private@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +LIBTIFF = $(top_builddir)/libtiff/libtiff.la +EXTRA_DIST = README Makefile.vc +addtiffo_SOURCES = addtiffo.c tif_overview.c tif_ovrcache.c tif_ovrcache.h +addtiffo_LDADD = $(LIBTIFF) +AM_CPPFLAGS = -I$(top_srcdir)/libtiff +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign contrib/addtiffo/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign contrib/addtiffo/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-noinstPROGRAMS: + @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list + +addtiffo$(EXEEXT): $(addtiffo_OBJECTS) $(addtiffo_DEPENDENCIES) $(EXTRA_addtiffo_DEPENDENCIES) + @rm -f addtiffo$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(addtiffo_OBJECTS) $(addtiffo_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/addtiffo.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tif_overview.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tif_ovrcache.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(PROGRAMS) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-noinstPROGRAMS cscopelist-am ctags \ + ctags-am distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags tags-am uninstall uninstall-am + +.PRECIOUS: Makefile + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/tiff/contrib/addtiffo/Makefile.vc b/tiff/contrib/addtiffo/Makefile.vc new file mode 100755 index 0000000..2777dc2 --- /dev/null +++ b/tiff/contrib/addtiffo/Makefile.vc @@ -0,0 +1,28 @@ +# +# If libtiff.a is installed in /usr/lib or /usr/local/lib just point +# LIBTIFF_DIR there. It doesn't need a full libtiff tree. +# +!INCLUDE ..\..\nmake.opt + +LIBTIFF_DIR = ..\..\libtiff +# +INCL = -I..\..\libtiff +LIBS = $(LIBTIFF_DIR)\libtiff.lib + +addtiffo: addtiffo.obj tif_overview.obj tif_ovrcache.obj + $(CC) $(CFLAGS) addtiffo.obj tif_overview.obj tif_ovrcache.obj \ + $(LIBS) /Feaddtiffo.exe + + +addtiffo.obj: addtiffo.c + $(CC) -c $(CFLAGS) addtiffo.c + +tif_overview.obj: tif_overview.c + $(CC) -c $(CFLAGS) tif_overview.c + +tif_ovrcache.obj: tif_ovrcache.c + $(CC) -c $(CFLAGS) tif_ovrcache.c + +clean: + -del *.obj + -del addtiffo.exe diff --git a/tiff/contrib/addtiffo/README b/tiff/contrib/addtiffo/README new file mode 100755 index 0000000..a6ca45f --- /dev/null +++ b/tiff/contrib/addtiffo/README @@ -0,0 +1,142 @@ + 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. + diff --git a/tiff/contrib/addtiffo/addtiffo.c b/tiff/contrib/addtiffo/addtiffo.c new file mode 100755 index 0000000..d3920e2 --- /dev/null +++ b/tiff/contrib/addtiffo/addtiffo.c @@ -0,0 +1,176 @@ +/****************************************************************************** + * $Id: addtiffo.c,v 1.7 2010-06-08 18:55:15 bfriesen Exp $ + * + * 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.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 <stdio.h> +#include <stdlib.h> +#include <string.h> +#include "tiffio.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) + { + 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 ); +} +/* + * Local Variables: + * mode: c + * c-basic-offset: 8 + * fill-column: 78 + * End: + */ diff --git a/tiff/contrib/addtiffo/tif_overview.c b/tiff/contrib/addtiffo/tif_overview.c new file mode 100755 index 0000000..156c081 --- /dev/null +++ b/tiff/contrib/addtiffo/tif_overview.c @@ -0,0 +1,899 @@ +/****************************************************************************** + * 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 <stdio.h> +#include <assert.h> +#include <stdlib.h> +#include <string.h> + +#include "tiffio.h" +#include "tif_ovrcache.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 + +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 TIFF_WriteOverview( TIFF *hTIFF, uint32 nXSize, uint32 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; + + (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; + + TIFFWriteDirectory( hTIFF ); + TIFFSetDirectory( hTIFF, (tdir_t) (TIFFNumberOfDirectories(hTIFF)-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 nXSize, uint32 nYSize, + int nPixelOffset, int nLineOffset ) +{ + uint32 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 *) pabyData)[0]; + } + else if( nSampleFormat == SAMPLEFORMAT_UINT && nPixelBytes == 4 ) + { + padfSamples[iSample++] = ((uint32 *) pabyData)[0]; + } + else if( nSampleFormat == SAMPLEFORMAT_INT && nPixelBytes == 2 ) + { + padfSamples[iSample++] = ((int16 *) pabyData)[0]; + } + else if( nSampleFormat == SAMPLEFORMAT_INT && nPixelBytes == 32 ) + { + padfSamples[iSample++] = ((int32 *) 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 *)pabyData) = (uint16) MAX(0,MIN(65535,dfValue)); + } + else if( nSampleFormat == SAMPLEFORMAT_UINT && nPixelBytes == 4 ) + { + *((uint32 *)pabyData) = (uint32) dfValue; + } + else if( nSampleFormat == SAMPLEFORMAT_INT && nPixelBytes == 2 ) + { + *((int16 *)pabyData) = (int16) MAX(-32768,MIN(32767,dfValue)); + } + else if( nSampleFormat == SAMPLEFORMAT_INT && nPixelBytes == 32 ) + { + *((int32 *)pabyData) = (int32) 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 nBlockXSize, uint32 nBlockYSize, + int nPixelSkewBits, int nBitsPerPixel, + unsigned char * pabyOTile, + uint32 nOBlockXSize, uint32 nOBlockYSize, + uint32 nTXOff, uint32 nTYOff, int nOMult, + int nSampleFormat, const char * pszResampling ) + +{ + uint32 i, j; + int k, nPixelBytes = (nBitsPerPixel) / 8; + int nPixelGroupBytes = (nBitsPerPixel+nPixelSkewBits)/8; + unsigned char *pabySrc, *pabyDst; + double *padfSamples; + + assert( nBitsPerPixel >= 8 ); + + padfSamples = (double *) malloc(sizeof(double) * nOMult * nOMult); + +/* ==================================================================== */ +/* 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 nXSize, nYSize, iSample; + + if( i + nTXOff >= nOBlockXSize ) + break; + + nXSize = MIN((uint32)nOMult,nBlockXSize-i); + nYSize = MIN((uint32)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 nBlockXSize, uint32 nBlockYSize, + unsigned char * pabyOTile, + uint32 nOBlockXSize, uint32 nOBlockYSize, + uint32 nTXOff, uint32 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 nSourceX, nSourceY; + uint32 nSourceXSec, nSourceYSec; + uint32 nSourceXSecEnd, nSourceYSecEnd; + uint32 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 nSXOff, uint32 nSYOff, + unsigned char *pabySrcTile, + uint32 nBlockXSize, uint32 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 nTXOff, nTYOff, nOXOff, nOYOff, nOMult; + uint32 nOBlockXSize = poRBI->nBlockXSize; + uint32 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 nXSize, nYSize, nBlockXSize, nBlockYSize; + uint16 nBitsPerPixel, nPhotometric, nCompressFlag, nSamples, + nPlanarConfig, nSampleFormat; + int bSubsampled; + uint16 nHorSubsampling, nVerSubsampling; + int bTiled, nSXOff, nSYOff, i; + unsigned char *pabySrcTile; + uint16 *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 alot 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 pallette if there is one. */ +/* -------------------------------------------------------------------- */ + if( TIFFGetField( hTIFF, TIFFTAG_COLORMAP, + &panRedMap, &panGreenMap, &panBlueMap ) ) + { + uint16 *panRed2, *panGreen2, *panBlue2; + int nColorCount = 1 << nBitsPerPixel; + + panRed2 = (uint16 *) _TIFFmalloc(2*nColorCount); + panGreen2 = (uint16 *) _TIFFmalloc(2*nColorCount); + panBlue2 = (uint16 *) _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 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 ); +} + + +/* + * Local Variables: + * mode: c + * c-basic-offset: 8 + * fill-column: 78 + * End: + */ diff --git a/tiff/contrib/addtiffo/tif_ovrcache.c b/tiff/contrib/addtiffo/tif_ovrcache.c new file mode 100755 index 0000000..e19483b --- /dev/null +++ b/tiff/contrib/addtiffo/tif_ovrcache.c @@ -0,0 +1,341 @@ +/****************************************************************************** + * $Id: tif_ovrcache.c,v 1.9 2010-06-08 18:55:15 bfriesen 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 + * + ****************************************************************************** + * 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 "tiffiop.h" +#include "tif_ovrcache.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; + + 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 ); + TIFFSetSubDirectory( hTIFF, nDirOffset ); + + 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 */ + return NULL; + } + + _TIFFmemset( psCache->pabyRow1Blocks, 0, psCache->nBytesPerRow ); + _TIFFmemset( psCache->pabyRow2Blocks, 0, psCache->nBytesPerRow ); + + psCache->nBlockOffset = 0; + + TIFFSetSubDirectory( psCache->hTIFF, nBaseDirOffset ); + + 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 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 *) psCache->pabyRow1Blocks, + (psCache->nBytesPerBlock * psCache->nSamples) / 2 ); + + else if( psCache->nBitsPerPixel == 32 ) + TIFFSwabArrayOfLong( (uint32 *) 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 ); + 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 ); + TIFFWriteEncodedTile( psCache->hTIFF, nTileID, + pabyData, + TIFFTileSize(psCache->hTIFF) ); + } + 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; + TIFFWriteEncodedStrip( psCache->hTIFF, nTileID, + pabyData, + TIFFVStripSize(psCache->hTIFF,RowsInStrip) ); + } + } + + } + else + { + pabyData = TIFFGetOvrBlock( psCache, iTileX, iTileY, 0 ); + + if( psCache->bTiled ) + { + nTileID = TIFFComputeTile( psCache->hTIFF, + iTileX * psCache->nBlockXSize, + iTileY * psCache->nBlockYSize, + 0, 0 ); + TIFFWriteEncodedTile( psCache->hTIFF, nTileID, + pabyData, + TIFFTileSize(psCache->hTIFF) ); + } + 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; + TIFFWriteEncodedStrip( psCache->hTIFF, nTileID, + pabyData, + TIFFVStripSize(psCache->hTIFF,RowsInStrip) ); + } + } + } + /* TODO: add checks on error status return of TIFFWriteEncodedTile and TIFFWriteEncodedStrip */ + +/* -------------------------------------------------------------------- */ +/* 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 ) + +{ + 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( iSample >= 0 && iSample < psCache->nSamples ); + + if (psCache->nPlanarConfig == PLANARCONFIG_SEPARATE) + nRowOffset = ((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 ); +} +/* + * Local Variables: + * mode: c + * c-basic-offset: 8 + * fill-column: 78 + * End: + */ diff --git a/tiff/contrib/addtiffo/tif_ovrcache.h b/tiff/contrib/addtiffo/tif_ovrcache.h new file mode 100755 index 0000000..0ad1082 --- /dev/null +++ b/tiff/contrib/addtiffo/tif_ovrcache.h @@ -0,0 +1,103 @@ +/****************************************************************************** + * 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 nXSize; + uint32 nYSize; + + uint16 nBitsPerPixel; + uint16 nSamples; + uint16 nPlanarConfig; + uint32 nBlockXSize; + uint32 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, uint32, + unsigned char *, uint32, uint32, + int, const char * ); + +uint32 TIFF_WriteOverview( TIFF *, uint32, uint32, 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 */ + +/* + * Local Variables: + * mode: c + * c-basic-offset: 8 + * fill-column: 78 + * End: + */ |