From c205122210e4b59a8501753601b74e68acf37f00 Mon Sep 17 00:00:00 2001 From: Sam Leffler Date: Tue, 9 Apr 1996 17:37:14 +0100 Subject: v3.4beta032 release --- Makefile.in | 5 +- configure | 186 ++++--- contrib/acorn/Makefile | 165 ++++++ contrib/acorn/ReadMe | 0 contrib/acorn/cleanlib | 5 + contrib/acorn/convert | 0 contrib/acorn/install | 8 +- dist/tiff.alpha | 2 +- html/Makefile.in | 4 +- html/build.html | 12 +- html/index.html | 4 +- html/internals.html | 12 +- html/libtiff.html | 5 +- html/misc.html | 6 +- html/support.html | 3 +- html/v3.4beta032.html | 89 ++++ libtiff/Makefile.acorn | 112 ----- libtiff/Makefile.in | 6 +- libtiff/tif_codec.c | 6 +- libtiff/tif_dirread.c | 6 +- libtiff/tif_dirwrite.c | 25 +- libtiff/tif_pixarlog.c | 1300 ++++++++++++++++++++++++++++++++++++++++++++++++ libtiff/tif_vms.c | 25 +- libtiff/tiff.h | 11 +- libtiff/tiffconf.h | 3 +- libtiff/tiffiop.h | 5 +- tools/tiffdump.c | 8 +- 27 files changed, 1769 insertions(+), 244 deletions(-) create mode 100644 contrib/acorn/Makefile mode change 100755 => 100644 contrib/acorn/ReadMe create mode 100755 contrib/acorn/cleanlib mode change 100755 => 100644 contrib/acorn/convert create mode 100644 html/v3.4beta032.html delete mode 100755 libtiff/Makefile.acorn create mode 100644 libtiff/tif_pixarlog.c diff --git a/Makefile.in b/Makefile.in index 6e7e9a40..2c33274e 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1,5 +1,5 @@ #! smake -# $Header: /usr/people/sam/tiff/RCS/Makefile.in,v 1.45 1996/03/18 22:21:38 sam Exp $ +# $Header: /usr/people/sam/tiff/RCS/Makefile.in,v 1.48 1996/04/09 17:37:14 sam Exp $ # # @WARNING@ # @@ -113,7 +113,6 @@ TIFFFILES=\ libtiff/Makefile.in \ libtiff/Makefile.lcc \ libtiff/Makefile.msc \ - libtiff/Makefile.acorn \ libtiff/t4.h \ libtiff/tiff.h \ libtiff/tiffcomp.h \ @@ -147,6 +146,7 @@ TIFFFILES=\ 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 \ @@ -260,6 +260,7 @@ TIFFFILES=\ html/misc.html \ html/support.html \ html/tools.html \ + html/v3.4beta032.html \ html/v3.4beta031.html \ html/v3.4beta029.html \ html/v3.4beta028.html \ diff --git a/configure b/configure index 31e9bd1f..a5b18716 100755 --- a/configure +++ b/configure @@ -1,5 +1,5 @@ #!/bin/sh -# $Header: /usr/people/sam/tiff/RCS/configure,v 1.45 1996/03/19 18:26:58 sam Exp $ +# $Header: /usr/people/sam/tiff/RCS/configure,v 1.47 1996/04/09 16:41:22 sam Exp $ # # Tag Image File Format (TIFF) Software # @@ -33,31 +33,40 @@ # preparation for building TIFF source. # +POSIXLY_CORRECT=1; export POSIXLY_CORRECT # disable GNU extensions + +QUIET=no # suppress messages to tty +NONINTERACTIVE=no # control prompting of config params +SITE= # dir where config.site is located +TARGET= # target system identity +SRCDIR= # dir where source is located + # # Setup general configuration parameters. # -DIR_BIN=/usr/local/bin -DIR_LIB=/usr/local/lib -DIR_INC=/usr/local/include -DIRS_LIBINC= -DIR_JPEGLIB= -DIR_GZLIB= -DSO=auto +DIR_BIN=/usr/local/bin # destination for applications +DIR_LIB=/usr/local/lib # destination for library +DIR_INC=/usr/local/include # destination for include files +DIRS_LIBINC= # dirs to search for ancillary includes +DIR_JPEGLIB= # dir for IJG -ljpeg +DIR_GZLIB= # dir for zlib -lgz +DSO=auto # auto-enable DSO support LIBCOPTS= # library-specific C-compiler options -JPEG=no -ZIP=no -PORT=auto -LIBGL=auto -LIBIMAGE=auto -MACHDEPLIBS=-lm - +JPEG=no # configure JPEG support +ZIP=no # configure ZIP/Deflate support +PORT=auto # enable portability emulations +LIBGL=auto # auto-enable build of SGI -lgl apps +LIBIMAGE=auto # auto-enable build of SGI -limage apps +MACHDEPLIBS=-lm # machine-dependent libraries for apps +: ${CC=} # name of C compiler to use +: ${CCOMPILER=} # full pathname of C compiler +: ${ENVOPTS=} # CC opts for ANSI C compilation : ${MAKE=make} # make to use + # screws up the test of `-f -' : ${MAKEFLAGS=} # unset MAKEFLAGS RM="rm -f" -POSIXLY_CORRECT=1; export POSIXLY_CORRECT # disable GNU extensions - # # Error diagnostics that should go to the terminal are # done with this interface (or cat). @@ -94,11 +103,6 @@ Options: [defaults in brackets after descriptions] EOF } -QUIET=no -NONINTERACTIVE=no -SITE= -TARGET= -SRCDIR= # # Crack command line arguments. We purposely # use syntax and options that are compatible @@ -141,7 +145,7 @@ do -target|--target) ac_prev=TARGET;; -target=*|--target=*) TARGET="$ac_optarg" ;; -version|--version) - echo "This is TIFF configure $Revision: 1.45 $" + echo "This is TIFF configure $Revision: 1.47 $" exit 0 ;; -help|--help) usage; exit 0;; @@ -227,6 +231,8 @@ captureX() } date >&5 +echo Running "$0" with arguments: "$@" >&5 + cat 1>&5 <<'EOF' This file contains information that is captured from running the configure @@ -293,26 +299,30 @@ fi # # Emulate old-style settups... # -test -z "${DIR_JPEG:-}" || { +test -z "${DIR_JPEG-}" || { DIRS_LIBINC="${DIRS_LIBINC} ${DIR_JPEG}" - DIR_JPEGLIB=${DIR_JPEG} + DIR_JPEGLIB="${DIR_JPEG}" } -test -z "${DIR_LIBGZ:-}" || { +test -z "${DIR_LIBGZ-}" || { DIRS_LIBINC="${DIRS_LIBINC} ${DIR_LIBGZ}" - DIR_GZLIB=${DIR_LIBGZ} + DIR_GZLIB="${DIR_LIBGZ}" } identifyTarget() { random=`date | awk '{print $4}' | sed -e 's/.*://'` 2>/dev/null case "$random" in - 1*) Note "Wow, you've got a $1 system!";; - 2*) Note "Hmm, looks like a $1 system.";; - 3*) Note "Oh no, not another $1 system...";; - 4*) Note "Well I'll be, a $1 system.";; - 5*) Note "Fee, fie, foe, this smells like a $1 system.";; - *) Note "Gosh, aren't you lucky to have a $1 system!";; - esac + *0) Note "Wow, you've got a $1 system!";; + *1) Note "Hmm, looks like a $1 system.";; + *2) Note "Oh no, not another $1 system...";; + *3) Note "Well I'll be, a $1 system.";; + *4) Note "Fee, fie, foe, this smells like a $1 system.";; + *5) Note "Gosh, aren't you lucky to have a $1 system!";; + *6) Note "YOW!! Did something bad happen or am I on a $1 system?";; + *7) Note "Do they really still make $1 systems?!";; + *8) Note "I'm always happy to encounter another $1 system.";; + *9) Note "Here we are again, this time on a $1 system.";; +esac } # @@ -335,7 +345,7 @@ else Note "Warning, I don't seem to have the GNU config.sub script to canonicalize" Note "your target specification; this may cause problems later on..." fi -if [ -z "${FILLORDER:-}" ]; then +if [ -z "${FILLORDER-}" ]; then # # Host bit order within a word. # @@ -352,15 +362,16 @@ fi # findThing() { - t="$1"; app=$2; path=$3; - case $app in - /*) eval $t $app && { echo $app; return; };; + t="$1"; app="$2"; path="$3"; + case "$app" in + /*) eval "$t" "$app" && { echo "$app"; return; };; esac - IFS=: + (IFS=: for i in $path; do - eval $t $i/$app && { echo $i/$app; return 0; } + eval "$t" "$i/$app" && { echo "$i/$app"; return 0; } done return 1 + ) } # @@ -368,7 +379,7 @@ findThing() # findFile() { - findThing "test -f" $1 $2 + findThing "test -f" "$1" "$2" } # @@ -483,7 +494,7 @@ checkCompiler() # be combined with above checks so we only # select an ANSI C compiler. # - if [ -z "${ENVOPTS:-}" ]; then + if [ -z "${ENVOPTS-}" ]; then case $ISGCC-$TARGET in no-*-irix*) C_ANSI="-ansi";; no-*-hp*) C_ANSI="-Aa -D_HPUX_SOURCE -Dhpux";; @@ -497,8 +508,8 @@ checkCompiler() $RM dummy dummy.o capture $compiler -o dummy ${C_ANSI} dummy.c && { CC=$compiler; - test -z "${CCOMPILER:-}" && CCOMPILER=`findApp $compiler $PATH` - test -z "${ENVOPTS:-}" && ENVOPTS="${C_ANSI:-}" + test -z "${CCOMPILER-}" && CCOMPILER=`findApp $compiler $PATH` + test -z "${ENVOPTS-}" && ENVOPTS="${C_ANSI-}" return 0 } return 1 @@ -506,7 +517,7 @@ checkCompiler() CCtested= capture cat dummy.c -if [ -z "${CC:-}" ]; then +if [ -z "${CC-}" ]; then CCOMPILER= for i in gcc cc ncc dcc xlc c89 gcc2; do CCtested="$CCtested $i" @@ -550,7 +561,7 @@ this script. EOF boom fi -Note "Using $CCOMPILER for a C compiler (set CC to override)." +Note "Using $CCOMPILER for a C compiler (use -with-CC=compilername to override)." test "$ENVOPTS" && { Note "Using $ENVOPTS to get the appropriate compilation environment." @@ -571,7 +582,7 @@ CheckForGandO() return 0 } -if [ -z "${GCOPTS:-}" ]; then +if [ -z "${GCOPTS-}" ]; then if capture $CCOMPILER $ENVOPTS -g -c dummy.c; then Note "Looks like $CCOMPILER supports the -g option." # NB: cannot use captureX here 'cuz we lose stderr @@ -637,13 +648,13 @@ EOF fi fi -test -z "${AR:-}" && AR=`findApp ar $PATH` +test -z "${AR-}" && AR=`findApp ar $PATH` if [ -z "$AR" ]; then Note "*** Warning, could not locate a suitable ar command; using a default." AR=ar fi -test -z "${AROPTS:-}" && AROPTS=rc -test -z "${RANLIB:-}" && RANLIB=`findApp ranlib $PATH` +test -z "${AROPTS-}" && AROPTS=rc +test -z "${RANLIB-}" && RANLIB=`findApp ranlib $PATH` if [ -z "$RANLIB" ]; then Note "Warning, no ranlib, assuming it's not needed." RANLIB=":" @@ -990,7 +1001,7 @@ BuildPortDotH() echo 'typedef double dblparam_t;' Note "... using double for promoted floating point parameters" - if [ -z "${INLINE:-}" ]; then + if [ -z "${INLINE-}" ]; then if [ $ISGCC = yes ]; then echo '#ifdef __STRICT_ANSI__' echo '#define INLINE __inline__' @@ -1049,10 +1060,10 @@ if [ "$PORT" = auto ]; then for i in $FUNCS; do CheckForFunc $i || { Note "... emulate $i" - PORTFUNCS="${PORTFUNCS:-} $i.c" + PORTFUNCS="${PORTFUNCS-} $i.c" } done - if [ "${PORTFUNCS:-}" ]; then + if [ "${PORTFUNCS-}" ]; then LIBPORT='../port/libport.a' PORT=yes else @@ -1069,7 +1080,7 @@ Note "" Note "Checking for Dynamic Shared Object (DSO) support." if [ "$DSO" = auto ]; then DSOSUF_VERSION= - case $TARGET-$CC in + case $TARGET-$CC-$ISGCC in *-irix5.2*) if (findApp rld /lib:/usr/lib:$PATH) >/dev/null 2>&1; then DSOSUF=so @@ -1101,6 +1112,13 @@ if [ "$DSO" = auto ]; then # LIBPORT="-Wl,+b${DIR_LIB}" DSO=HPUX ;; + *-solaris*-yes) + DSOSUF=so + DSOLD='${LD}' + DSOOPTS='-G' + LIBCOPTS="-fpic" + DSO=SOLARIS + ;; *-solaris*) DSOSUF=so DSOLD='${LD}' @@ -1179,16 +1197,16 @@ Note "Selecting programs used during installation." # # Miscellaneous ``little'' programs. # -test -z "${CHMOD:-}" && CHMOD=`findAppDef chmod $PATH chmod` -test -z "${LN:-}" && LN=`findAppDef ln $PATH ln` -test -z "${SCRIPT_SH:-}" && SCRIPT_SH=`findAppDef sh $PATH sh` -test -z "${SED:-}" && SED=`findAppDef sed $PATH sed` -test -z "${STRIP:-}" && STRIP=`findAppDef strip $PATH strip` +test -z "${CHMOD-}" && CHMOD=`findAppDef chmod $PATH chmod` +test -z "${LN-}" && LN=`findAppDef ln $PATH ln` +test -z "${SCRIPT_SH-}" && SCRIPT_SH=`findAppDef sh $PATH sh` +test -z "${SED-}" && SED=`findAppDef sed $PATH sed` +test -z "${STRIP-}" && STRIP=`findAppDef strip $PATH strip` # # Check if mv -f is supported # -if [ -z "${MV_F:-}" ]; then +if [ -z "${MV_F-}" ]; then $RM t.c; echo "">t.c if mv -f t.c t.o; then Note "Looks like mv supports the -f option to force a move." @@ -1203,7 +1221,7 @@ fi # # Check if ln -s creates a symbolic link. # -if [ -z "${LN_S:-}" ]; then +if [ -z "${LN_S-}" ]; then $RM t.c; $LN -s foo t.c && LN_S=-s fi if [ -n "$LN_S" ]; then @@ -1216,7 +1234,7 @@ fi # # Pick install mechanism. # -if [ -z "${INSTALL:-}" ]; then +if [ -z "${INSTALL-}" ]; then case $TARGET in *-irix*) INSTALL=`findApp install /sbin:$PATH`;; *) INSTALL='${SHELL} ../port/install.sh';; @@ -1258,7 +1276,7 @@ bitchExecutable() # 4. Whether or not the FlexFAX ``F'' suffix must be # stripped for pages to be found (only for 4F pages). # -if [ -z "${DIR_MAN:-}" ]; then +if [ -z "${DIR_MAN-}" ]; then MANPATH=" $MANPATH /usr/local/man @@ -1272,7 +1290,7 @@ if [ -z "${DIR_MAN:-}" ]; then test -z "$DIR_MAN" && DIR_MAN=/usr/local/man fi Note "Looks like manual pages go in $DIR_MAN." -if [ -z "${MANSCHEME:-}" ]; then +if [ -z "${MANSCHEME-}" ]; then case $TARGET in *-bsdi*|*-netbsd*) MANSCHEME=bsd-nroff-gzip-0.gz;; *-freebsd*) MANSCHEME=bsd-source-cat;; @@ -1336,7 +1354,7 @@ fi promptForNonNullStringParameter() { x="" val="$1" desc="$2" - while [ -z "${x:-}" ]; do + while [ -z "$x" ]; do prompt "$desc [$val]?"; read x if [ "$x" ]; then # strip leading and trailing white space @@ -1351,7 +1369,7 @@ promptForNonNullStringParameter() promptForManPageScheme() { x="" - while [ -z "${x:-}" ]; do + while [ -z "$x" ]; do prompt "Manual page installation scheme [$MANSCHEME]?"; read x if [ "$x" ]; then # strip leading and trailing white space @@ -1461,10 +1479,11 @@ Either fix the pathname or disable the JPEG support. EOF } - test -d "${DIR_JPEGLIB}" || { - cat<.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 + .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: diff --git a/contrib/acorn/ReadMe b/contrib/acorn/ReadMe old mode 100755 new mode 100644 diff --git a/contrib/acorn/cleanlib b/contrib/acorn/cleanlib new file mode 100755 index 00000000..78a2d034 --- /dev/null +++ b/contrib/acorn/cleanlib @@ -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 diff --git a/contrib/acorn/convert b/contrib/acorn/convert old mode 100755 new mode 100644 diff --git a/contrib/acorn/install b/contrib/acorn/install index fd0f3919..fa49d1ba 100755 --- a/contrib/acorn/install +++ b/contrib/acorn/install @@ -2,7 +2,7 @@ If "%0" = "" Then Error Syntax: install | | If "%1" = "" Then Error Syntax: install | | Set LibTiffInstall$Dir %0 Set LibTiff$Dir %1 -Set Alias$CPY Copy .%%0 .%%1 ~C~DF~NQRV +Set Alias$CPY Copy .%%0 .%%1 ~C~DF~NRV CDir CDir .c CDir .h @@ -10,9 +10,11 @@ CDir .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.Makefile/acorn Makefile CPY libtiff.mkg3states/c c.mkg3states CPY libtiff.mkspans/c c.mkspans CPY libtiff.mkversion/c c.mkversion @@ -58,8 +60,10 @@ CPY libtiff.tif_predict/h h.tif_predic SetType .COPYRIGHT Text SetType .README Text SetType .VERSION Text +SetType .tiff/alpha Text SetType .SetVars Obey SetType .Makefile fe1 +SetType .cleanlib Obey SetType .c.getopt Text SetType .c.mkg3states Text SetType .c.mkspans Text diff --git a/dist/tiff.alpha b/dist/tiff.alpha index c04be6b3..dff34ff5 100644 --- a/dist/tiff.alpha +++ b/dist/tiff.alpha @@ -1 +1 @@ -define ALPHA 031 +define ALPHA 032 diff --git a/html/Makefile.in b/html/Makefile.in index 90d48c57..62120ae7 100644 --- a/html/Makefile.in +++ b/html/Makefile.in @@ -1,4 +1,4 @@ -# $Header: /usr/people/sam/tiff/html/RCS/Makefile.in,v 1.8 1996/02/09 21:28:38 sam Exp $ +# $Header: /usr/people/sam/tiff/html/RCS/Makefile.in,v 1.9 1996/04/09 17:37:07 sam Exp $ # # @WARNING@ # @@ -67,6 +67,8 @@ HTMLFILES=\ v3.4beta024.html \ v3.4beta028.html \ v3.4beta029.html \ + v3.4beta031.html \ + v3.4beta032.html \ ${NULL} IMAGES=\ images/back.gif \ diff --git a/html/build.html b/html/build.html index 6cefc72a..97bb1f49 100644 --- a/html/build.html +++ b/html/build.html @@ -652,7 +652,8 @@ by default bin is used. There is a Makefile for Microsoft C. There is OS support for MS-DOS and for Windows. -Someone needs to fill this in.... +Someone needs to fill this in, but no DOS-weenies seem to +give a damn so this section is blank for now .... @@ -956,10 +957,10 @@ All library-related files described below are located in the libtiff directory.

-The library requires two files that are generated by on-the-fly. +The library requires two files that are generated on-the-fly. The file tif_fax3sm.c has the state tables for the Group 3 and Group 4 decoders. -This file is normally generated by the mkg3states program +This file is generated by the mkg3states program on a UNIX system; for example,

    
    @@ -983,7 +984,7 @@ Consult the source code for this program if you have questions.
     The second file required to build the library, version.h,
     contains the version
     information returned by the TIFFGetVersion routine.
    -This file is built on most system using the
    +This file is built on most systems using the
     mkversion program and the contents of the
     VERSION and tiff.alpha files; for example,
     
    @@ -1079,6 +1080,7 @@ libtiff/tif_msdos.c		MSDOS-related OS support
     libtiff/tif_next.c		NeXT 2-bit scheme codec (decoding only)
     libtiff/tif_open.c		open and simply query code
     libtiff/tif_packbits.c		Packbits codec
    +libtiff/tif_pixarlog.c		Pixar codec
     libtiff/tif_predict.c		Predictor tag support
     libtiff/tif_print.c		directory printing support
     libtiff/tif_read.c		image data reading support
    @@ -1105,7 +1107,7 @@ libtiff/mkversion.c		program to generate libtiff/version.h.
     
     
    Sam Leffler / sam@engr.sgi.com. -Last updated: $Date: 1996/03/18 22:21:04 $ +Last updated: $Date: 1996/04/09 16:53:39 $
    diff --git a/html/index.html b/html/index.html index c35ddf6c..86168654 100644 --- a/html/index.html +++ b/html/index.html @@ -12,7 +12,7 @@ TIFF Software Latest Release: None
    -Latest Software: v3.4beta031
    +Latest Software: v3.4beta032
    Master FTP Site: ftp.sgi.com (192.48.153.1), directory graphics/tiff
    Home Page: http://www-mipl.jpl.nasa.gov/~ndr/tiff/
    @@ -81,7 +81,7 @@ the master FTP site listed above.
    Sam Leffler / sam@engr.sgi.com. -Last updated: $Date: 1996/03/18 22:21:19 $ +Last updated: $Date: 1996/04/09 17:37:07 $
    diff --git a/html/internals.html b/html/internals.html index 5c806c02..bfb9d7f2 100644 --- a/html/internals.html +++ b/html/internals.html @@ -104,7 +104,7 @@ the TIFF 6.0 colorimetry and YCbCr-related tags. Experimental support for the deflate algorithm is controlled by DEFLATE_SUPPORT. The deflate codec that comes with libtiff is designed -for use with version 0.92 or later of the freely available +for use with version 0.99 or later of the freely available libz library written by Jean-loup Gailly and Mark Adler. The data format used by this library is described in the files @@ -179,6 +179,11 @@ run-length encoding scheme from ThunderScan (compression 32809) experimental Deflate scheme (compression 32946) + +PIXARLOG_SUPPORT +Pixar's compression scheme for high-resolution color images (compression 32909) + + COLORIMETRY_SUPPORT support for the TIFF 6.0 colorimetry tags @@ -276,7 +281,8 @@ The following defines control general portability: HAVE_MMAP -Define this if there is support for memory mapping files. +Define this if there is mmap-style support for +mapping files into memory (used only to read data). @@ -633,7 +639,7 @@ the portability of your TIFF files.
    Sam Leffler / sam@engr.sgi.com. -Last updated: $Date: 1995/10/16 21:56:24 $ +Last updated: $Date: 1996/04/09 16:53:39 $
    diff --git a/html/libtiff.html b/html/libtiff.html index 3625dc0f..811a4d58 100644 --- a/html/libtiff.html +++ b/html/libtiff.html @@ -96,6 +96,9 @@ what you get from "cat dist/tiff.alpha". Within an application that uses libtiff the TIFFGetVersion routine will return a pointer to a string that contains software version information. +The library include file <tiffio.h> contains a C pre-processor +define TIFFLIB_VERSION that can be used to check library +version compatiblity at compile time.


    Library Datatypes

    @@ -735,7 +738,7 @@ main()
    Sam Leffler / sam@engr.sgi.com. -Last updated: $Date: 1995/10/16 21:46:15 $ +Last updated: $Date: 1996/04/09 16:53:39 $
    diff --git a/html/misc.html b/html/misc.html index d9fd7c1b..ff2c0468 100644 --- a/html/misc.html +++ b/html/misc.html @@ -69,8 +69,8 @@ all or parts of it you need to honor the copyright notices. I would also be interested in knowing about it and, hopefully, be acknowledged.

    -Copyright (c) 1988-1995 Sam Leffler
    -Copyright (c) 1991-1995 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
    @@ -97,7 +97,7 @@ OF THIS SOFTWARE.
     
     
    Sam Leffler / sam@engr.sgi.com. -Last updated: $Date: 1995/06/28 23:57:28 $ +Last updated: $Date: 1996/04/09 16:53:39 $
    diff --git a/html/support.html b/html/support.html index 6480ad7f..87210d81 100644 --- a/html/support.html +++ b/html/support.html @@ -178,6 +178,7 @@ that are, in some cases, of dubious value.
         Compression = 32766	NeXT 2-bit encoding
         Compression = 32809	ThunderScan 4-bit encoding
    +    Compression = 32909	Pixar companded 11-bit ZIP encoding
         Compression = 34999	PKZIP-style Deflate encoding (experimental)
     
    @@ -664,7 +665,7 @@ part of the TIFF 6.0 specification).
    Sam Leffler / sam@engr.sgi.com. -Last updated: $Date: 1995/06/30 23:28:32 $ +Last updated: $Date: 1996/04/09 16:53:39 $
    diff --git a/html/v3.4beta032.html b/html/v3.4beta032.html new file mode 100644 index 00000000..f19604c2 --- /dev/null +++ b/html/v3.4beta032.html @@ -0,0 +1,89 @@ + + + +Changes in TIFF v3.4beta032 + + + + + + +TIFF CHANGE INFORMATION + + + + +

    +This document describes the changes made to the software between the +previous and current versions (see above). +If you don't find something listed here, then it was not done in this +timeframe, or it was not considered important enough to be mentioned. +The following information is located here: +

    + +


    + +CHANGES IN THE SOFTWARE CONFIGURATION: + +
      +
    • various fixups and subtle improvements to configure + from Richard Mlynarik +
    + +


    + +CHANGES IN LIBTIFF: + +
      +
    • a new codec from Pixar designed for high-resolution color images; + note that this codec is not configured by default +
    • a bug fix for reading tags with a single FLOAT value +
    • change to the TIFFGetField calling convention: + a tag that has a single value of + type DOUBLE is now retrieved by passing a + ``double*'' instead of a + ``double**'' (this change makes the handling of tags with + DOUBLE values identical to the handling of tags with + FLOAT values) +
    • fix to VMS support for the handling of floating point values +
    + +


    + +CHANGES IN THE TOOLS: + +
      +
    • tiffdump now handles tags with FLOAT and DOUBLE + values +
    + +


    + +CHANGES IN THE CONTRIBUTED SOFTWARE: + +
      +
    • updates to the Acorn OS support from Peter Greenham +
    + + TIFF home page.
    + +
    + +
    +Sam Leffler / sam@engr.sgi.com +Last updated $Date: 1996/04/09 17:37:03 $. +
    + + + diff --git a/libtiff/Makefile.acorn b/libtiff/Makefile.acorn deleted file mode 100755 index 6c0d46b6..00000000 --- a/libtiff/Makefile.acorn +++ /dev/null @@ -1,112 +0,0 @@ -# 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 - .mkversion @.VERSION @.h.version -@.mkg3states: @.o.mkg3states @.o.getopt C:o.Stubs - link $(linkflags) @.o.mkg3states C:o.Stubs @.o.getopt -@.c.tif_fax3sm: @.mkg3states - .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: diff --git a/libtiff/Makefile.in b/libtiff/Makefile.in index f7d0c488..2ea2c325 100644 --- a/libtiff/Makefile.in +++ b/libtiff/Makefile.in @@ -1,4 +1,4 @@ -# $Header: /usr/people/sam/tiff/libtiff/RCS/Makefile.in,v 1.32 1996/03/14 00:54:03 sam Exp $ +# $Header: /usr/people/sam/tiff/libtiff/RCS/Makefile.in,v 1.33 1996/04/05 17:36:53 sam Exp $ # # Tag Image File Format Library # @@ -85,6 +85,7 @@ SRCS = \ tif_next.c \ tif_open.c \ tif_packbits.c \ + tif_pixarlog.c \ tif_predict.c \ tif_print.c \ tif_read.c \ @@ -118,6 +119,7 @@ OBJS = \ tif_next.o \ tif_open.o \ tif_packbits.o \ + tif_pixarlog.o \ tif_predict.o \ tif_print.o \ tif_read.o \ @@ -252,6 +254,8 @@ tif_open.o: ${SRCDIR}/tif_open.c ${CC} -c ${CFLAGS} ${SRCDIR}/tif_open.c tif_packbits.o: ${SRCDIR}/tif_packbits.c ${CC} -c ${CFLAGS} ${SRCDIR}/tif_packbits.c +tif_pixarlog.o: ${SRCDIR}/tif_pixarlog.c + ${CC} -c ${CFLAGS} ${SRCDIR}/tif_pixarlog.c tif_predict.o: ${SRCDIR}/tif_predict.c ${SRCDIR}/tif_predict.h ${CC} -c ${CFLAGS} ${SRCDIR}/tif_predict.c tif_print.o: ${SRCDIR}/tif_print.c diff --git a/libtiff/tif_codec.c b/libtiff/tif_codec.c index c5432638..a821de14 100644 --- a/libtiff/tif_codec.c +++ b/libtiff/tif_codec.c @@ -1,4 +1,4 @@ -/* $Header: /usr/people/sam/tiff/libtiff/RCS/tif_codec.c,v 1.8 1996/02/16 05:54:21 sam Exp $ */ +/* $Header: /usr/people/sam/tiff/libtiff/RCS/tif_codec.c,v 1.9 1996/04/05 17:36:53 sam Exp $ */ /* * Copyright (c) 1988-1996 Sam Leffler @@ -63,6 +63,9 @@ static int NotConfigured(TIFF*, int); #ifndef ZIP_SUPPORT #define TIFFInitZIP NotConfigured #endif +#ifndef PIXARLOG_SUPPORT +#define TIFFInitPixarLog NotConfigured +#endif /* * Compression schemes statically built into the library. @@ -85,6 +88,7 @@ TIFFCodec _TIFFBuiltinCODECS[] = { { "CCITT Group 4", COMPRESSION_CCITTFAX4, TIFFInitCCITTFax4 }, { "ISO JBIG", COMPRESSION_JBIG, TIFFInitJBIG }, { "Deflate", COMPRESSION_DEFLATE, TIFFInitZIP }, + { "PixarLog", COMPRESSION_PIXARLOG, TIFFInitPixarLog }, { NULL }, }; diff --git a/libtiff/tif_dirread.c b/libtiff/tif_dirread.c index 7df41f81..6fd3a66b 100644 --- a/libtiff/tif_dirread.c +++ b/libtiff/tif_dirread.c @@ -1,4 +1,4 @@ -/* $Header: /usr/people/sam/tiff/libtiff/RCS/tif_dirread.c,v 1.70 1996/01/10 19:32:59 sam Exp $ */ +/* $Header: /usr/people/sam/tiff/libtiff/RCS/tif_dirread.c,v 1.71 1996/03/29 16:35:17 sam Exp $ */ /* * Copyright (c) 1988-1996 Sam Leffler @@ -741,8 +741,8 @@ TIFFFetchRational(TIFF* tif, TIFFDirEntry* dir) static float TIFFFetchFloat(TIFF* tif, TIFFDirEntry* dir) { - float v = (float) - TIFFExtractData(tif, dir->tdir_type, dir->tdir_offset); + long l = TIFFExtractData(tif, dir->tdir_type, dir->tdir_offset); + float v = *(float*) &l; TIFFCvtIEEEFloatToNative(tif, 1, &v); return (v); } diff --git a/libtiff/tif_dirwrite.c b/libtiff/tif_dirwrite.c index a2bc7da3..964bce2d 100644 --- a/libtiff/tif_dirwrite.c +++ b/libtiff/tif_dirwrite.c @@ -1,4 +1,4 @@ -/* $Header: /usr/people/sam/tiff/libtiff/RCS/tif_dirwrite.c,v 1.54 1996/01/10 19:33:00 sam Exp $ */ +/* $Header: /usr/people/sam/tiff/libtiff/RCS/tif_dirwrite.c,v 1.55 1996/04/09 17:13:34 sam Exp $ */ /* * Copyright (c) 1988-1996 Sam Leffler @@ -445,15 +445,20 @@ TIFFWriteNormalTag(TIFF* tif, TIFFDirEntry* dir, const TIFFFieldInfo* fip) } break; case TIFF_DOUBLE: - { double* dp; - if (wc == (u_short) TIFF_VARIABLE) { - TIFFGetField(tif, fip->field_tag, &wc, &dp); - dir->tdir_count = wc; - } else - TIFFGetField(tif, fip->field_tag, &dp); - TIFFCvtNativeToIEEEDouble(tif, wc, dp); - if (!TIFFWriteData(tif, dir, (char*) dp)) - return (0); + if (wc > 1) { + double* dp; + if (wc == (u_short) TIFF_VARIABLE) { + TIFFGetField(tif, fip->field_tag, &wc, &dp); + dir->tdir_count = wc; + } else + TIFFGetField(tif, fip->field_tag, &dp); + if (!WRITEF(TIFFWriteDoubleArray, dp)) + return (0); + } else { + double dv; + TIFFGetField(tif, fip->field_tag, &dv); + if (!WRITEF(TIFFWriteDoubleArray, &dv)) + return (0); } break; case TIFF_ASCII: diff --git a/libtiff/tif_pixarlog.c b/libtiff/tif_pixarlog.c new file mode 100644 index 00000000..1c9dee0c --- /dev/null +++ b/libtiff/tif_pixarlog.c @@ -0,0 +1,1300 @@ +/* + * Copyright (c) 1996-1996 Sam Leffler + * Copyright (c) 1996 Pixar + * + * 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 + * Pixar, 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 Pixar, 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 PIXAR, 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 "tiffiop.h" +#ifdef PIXARLOG_SUPPORT + +/* + * TIFF Library. + * PixarLog Compression Support + * + * Contributed by Dan McCoy. + * + * PixarLog film support uses the TIFF library to store companded + * 11 bit values into a tiff file, which are compressed using the + * zip compressor. + * + * The codec can take as input and produce as output 32-bit IEEE float values + * as well as 16-bit or 8-bit unsigned integer values. + * + * On writing any of the above are converted into the internal + * 11-bit log format. In the case of 8 and 16 bit values, the + * input is assumed to be unsigned linear color values that represent + * the range 0-1. In the case of IEEE values, the 0-1 range is assumed to + * be the normal linear color range, in addition over 1 values are + * accepted up to a value of about 25.0 to encode "hot" hightlights and such. + * The encoding is lossless for 8-bit values, slightly lossy for the + * other bit depths. The actual color precision should be better + * than the human eye can perceive with extra room to allow for + * error introduced by further image computation. As with any quantized + * color format, it is possible to perform image calculations which + * expose the quantization error. This format should certainly be less + * susceptable to such errors than standard 8-bit encodings, but more + * susceptable than straight 16-bit or 32-bit encodings. + * + * On reading the internal format is converted to the desired output format. + * The program can request which format it desires by setting the internal + * pseudo tag TIFFTAG_PIXARLOGDATAFMT to one of these possible values: + * PIXARLOGDATAFMT_FLOAT = provide IEEE float values. + * PIXARLOGDATAFMT_16BIT = provide unsigned 16-bit integer values + * PIXARLOGDATAFMT_8BIT = provide unsigned 8-bit integer values + * + * alternately PIXARLOGDATAFMT_8BITABGR provides unsigned 8-bit integer + * values with the difference that if there are exactly three or four channels + * (rgb or rgba) it swaps the channel order (bgr or abgr). + * + * PIXARLOGDATAFMT_11BITLOG provides the internal encoding directly + * packed in 16-bit values. However no tools are supplied for interpreting + * these values. + * + * "hot" (over 1.0) areas written in floating point get clamped to + * 1.0 in the integer data types. + * + * When the file is closed after writing, the bit depth and sample format + * are set always to appear as if 8-bit data has been written into it. + * That way a naive program unaware of the particulars of the encoding + * gets the format it is most likely able to handle. + * + * The codec does it's own horizontal differencing step on the coded + * values so the libraries predictor stuff should be turned off. + * The codec also handle byte swapping the encoded values as necessary + * since the library does not have the information necessary + * to know the bit depth of the raw unencoded buffer. + * + */ + +#include "tif_predict.h" +#include "zlib.h" +#include "zutil.h" + +#include +#include +#include +#include + +/* Tables for converting to/from 11 bit coded values */ + +#define TSIZE 2048 /* decode table size (11-bit tokens) */ +#define TSIZEP1 2049 /* Plus one for slop */ +#define ONE 1250 /* token value of 1.0 exactly */ +#define RATIO 1.004 /* nominal ratio for log part */ + +#define CODE_MASK 0x7ff /* 11 bits. */ + +static float Fltsize; +static float LogK1, LogK2; + +#define REPEAT(n, op) { int i; i=n; do { i--; op; } while (i>0); } + +static void +horizontalAccumulateF(uint16 *wp, int n, int stride, float *op, + float *ToLinearF) +{ + register unsigned int cr, cg, cb, ca, mask; + register float t0, t1, t2, t3; + + if (n >= stride) { + mask = CODE_MASK; + if (stride == 3) { + t0 = ToLinearF[cr = wp[0]]; + t1 = ToLinearF[cg = wp[1]]; + t2 = ToLinearF[cb = wp[2]]; + op[0] = t0; + op[1] = t1; + op[2] = t2; + n -= 3; + while (n > 0) { + wp += 3; + op += 3; + n -= 3; + t0 = ToLinearF[(cr += wp[0]) & mask]; + t1 = ToLinearF[(cg += wp[1]) & mask]; + t2 = ToLinearF[(cb += wp[2]) & mask]; + op[0] = t0; + op[1] = t1; + op[2] = t2; + } + } else if (stride == 4) { + t0 = ToLinearF[cr = wp[0]]; + t1 = ToLinearF[cg = wp[1]]; + t2 = ToLinearF[cb = wp[2]]; + t3 = ToLinearF[ca = wp[3]]; + op[0] = t0; + op[1] = t1; + op[2] = t2; + op[3] = t3; + n -= 4; + while (n > 0) { + wp += 4; + op += 4; + n -= 4; + t0 = ToLinearF[(cr += wp[0]) & mask]; + t1 = ToLinearF[(cg += wp[1]) & mask]; + t2 = ToLinearF[(cb += wp[2]) & mask]; + t3 = ToLinearF[(ca += wp[3]) & mask]; + op[0] = t0; + op[1] = t1; + op[2] = t2; + op[3] = t3; + } + } else { + REPEAT(stride, *op = ToLinearF[*wp&mask]; wp++; op++) + n -= stride; + while (n > 0) { + REPEAT(stride, + wp[stride] += *wp; *op = ToLinearF[*wp&mask]; wp++; op++) + n -= stride; + } + } + } +} + +static void +horizontalAccumulate12(uint16 *wp, int n, int stride, int16 *op, + float *ToLinearF) +{ + register unsigned int cr, cg, cb, ca, mask; + register float t0, t1, t2, t3; + +#define SCALE12 2048.0 +#define CLAMP12(t) (((t) > 3071) ? 3071 : (uint16) (t)) + + if (n >= stride) { + mask = CODE_MASK; + if (stride == 3) { + t0 = ToLinearF[cr = wp[0]] * SCALE12; + t1 = ToLinearF[cg = wp[1]] * SCALE12; + t2 = ToLinearF[cb = wp[2]] * SCALE12; + op[0] = CLAMP12(t0); + op[1] = CLAMP12(t1); + op[2] = CLAMP12(t2); + n -= 3; + while (n > 0) { + wp += 3; + op += 3; + n -= 3; + t0 = ToLinearF[(cr += wp[0]) & mask] * SCALE12; + t1 = ToLinearF[(cg += wp[1]) & mask] * SCALE12; + t2 = ToLinearF[(cb += wp[2]) & mask] * SCALE12; + op[0] = CLAMP12(t0); + op[1] = CLAMP12(t1); + op[2] = CLAMP12(t2); + } + } else if (stride == 4) { + t0 = ToLinearF[cr = wp[0]] * SCALE12; + t1 = ToLinearF[cg = wp[1]] * SCALE12; + t2 = ToLinearF[cb = wp[2]] * SCALE12; + t3 = ToLinearF[ca = wp[3]] * SCALE12; + op[0] = CLAMP12(t0); + op[1] = CLAMP12(t1); + op[2] = CLAMP12(t2); + op[3] = CLAMP12(t3); + n -= 4; + while (n > 0) { + wp += 4; + op += 4; + n -= 4; + t0 = ToLinearF[(cr += wp[0]) & mask] * SCALE12; + t1 = ToLinearF[(cg += wp[1]) & mask] * SCALE12; + t2 = ToLinearF[(cb += wp[2]) & mask] * SCALE12; + t3 = ToLinearF[(ca += wp[3]) & mask] * SCALE12; + op[0] = CLAMP12(t0); + op[1] = CLAMP12(t1); + op[2] = CLAMP12(t2); + op[3] = CLAMP12(t3); + } + } else { + REPEAT(stride, t0 = ToLinearF[*wp&mask] * SCALE12; + *op = CLAMP12(t0); wp++; op++) + n -= stride; + while (n > 0) { + REPEAT(stride, + wp[stride] += *wp; t0 = ToLinearF[*wp&mask] * SCALE12; + *op = CLAMP12(t0); wp++; op++) + n -= stride; + } + } + } +} + +static void +horizontalAccumulate16(uint16 *wp, int n, int stride, uint16 *op, + uint16 *ToLinear16) +{ + register unsigned int cr, cg, cb, ca, mask; + + if (n >= stride) { + mask = CODE_MASK; + if (stride == 3) { + op[0] = ToLinear16[cr = wp[0]]; + op[1] = ToLinear16[cg = wp[1]]; + op[2] = ToLinear16[cb = wp[2]]; + n -= 3; + while (n > 0) { + wp += 3; + op += 3; + n -= 3; + op[0] = ToLinear16[(cr += wp[0]) & mask]; + op[1] = ToLinear16[(cg += wp[1]) & mask]; + op[2] = ToLinear16[(cb += wp[2]) & mask]; + } + } else if (stride == 4) { + op[0] = ToLinear16[cr = wp[0]]; + op[1] = ToLinear16[cg = wp[1]]; + op[2] = ToLinear16[cb = wp[2]]; + op[3] = ToLinear16[ca = wp[3]]; + n -= 4; + while (n > 0) { + wp += 4; + op += 4; + n -= 4; + op[0] = ToLinear16[(cr += wp[0]) & mask]; + op[1] = ToLinear16[(cg += wp[1]) & mask]; + op[2] = ToLinear16[(cb += wp[2]) & mask]; + op[3] = ToLinear16[(ca += wp[3]) & mask]; + } + } else { + REPEAT(stride, *op = ToLinear16[*wp&mask]; wp++; op++) + n -= stride; + while (n > 0) { + REPEAT(stride, + wp[stride] += *wp; *op = ToLinear16[*wp&mask]; wp++; op++) + n -= stride; + } + } + } +} + +/* + * Returns the log encoded 11-bit values with the horizontal + * differencing undone. + */ +static void +horizontalAccumulate11(uint16 *wp, int n, int stride, uint16 *op) +{ + register unsigned int cr, cg, cb, ca, mask; + + if (n >= stride) { + mask = CODE_MASK; + if (stride == 3) { + op[0] = cr = wp[0]; op[1] = cg = wp[1]; op[2] = cb = wp[2]; + n -= 3; + while (n > 0) { + wp += 3; + op += 3; + n -= 3; + op[0] = (cr += wp[0]) & mask; + op[1] = (cg += wp[1]) & mask; + op[2] = (cb += wp[2]) & mask; + } + } else if (stride == 4) { + op[0] = cr = wp[0]; op[1] = cg = wp[1]; + op[2] = cb = wp[2]; op[3] = ca = wp[3]; + n -= 4; + while (n > 0) { + wp += 4; + op += 4; + n -= 4; + op[0] = (cr += wp[0]) & mask; + op[1] = (cg += wp[1]) & mask; + op[2] = (cb += wp[2]) & mask; + op[3] = (ca += wp[3]) & mask; + } + } else { + REPEAT(stride, *op = *wp&mask; wp++; op++) + n -= stride; + while (n > 0) { + REPEAT(stride, + wp[stride] += *wp; *op = *wp&mask; wp++; op++) + n -= stride; + } + } + } +} + +static void +horizontalAccumulate8(uint16 *wp, int n, int stride, unsigned char *op, + unsigned char *ToLinear8) +{ + register unsigned int cr, cg, cb, ca, mask; + + if (n >= stride) { + mask = CODE_MASK; + if (stride == 3) { + op[0] = ToLinear8[cr = wp[0]]; + op[1] = ToLinear8[cg = wp[1]]; + op[2] = ToLinear8[cb = wp[2]]; + n -= 3; + while (n > 0) { + n -= 3; + wp += 3; + op += 3; + op[0] = ToLinear8[(cr += wp[0]) & mask]; + op[1] = ToLinear8[(cg += wp[1]) & mask]; + op[2] = ToLinear8[(cb += wp[2]) & mask]; + } + } else if (stride == 4) { + op[0] = ToLinear8[cr = wp[0]]; + op[1] = ToLinear8[cg = wp[1]]; + op[2] = ToLinear8[cb = wp[2]]; + op[3] = ToLinear8[ca = wp[3]]; + n -= 4; + while (n > 0) { + n -= 4; + wp += 4; + op += 4; + op[0] = ToLinear8[(cr += wp[0]) & mask]; + op[1] = ToLinear8[(cg += wp[1]) & mask]; + op[2] = ToLinear8[(cb += wp[2]) & mask]; + op[3] = ToLinear8[(ca += wp[3]) & mask]; + } + } else { + REPEAT(stride, *op = ToLinear8[*wp&mask]; wp++; op++) + n -= stride; + while (n > 0) { + REPEAT(stride, + wp[stride] += *wp; *op = ToLinear8[*wp&mask]; wp++; op++) + n -= stride; + } + } + } +} + + +static void +horizontalAccumulate8abgr(uint16 *wp, int n, int stride, unsigned char *op, + unsigned char *ToLinear8) +{ + register unsigned int cr, cg, cb, ca, mask; + register unsigned char t0, t1, t2, t3; + + if (n >= stride) { + mask = CODE_MASK; + if (stride == 3) { + op[0] = 0; + t1 = ToLinear8[cb = wp[2]]; + t2 = ToLinear8[cg = wp[1]]; + t3 = ToLinear8[cr = wp[0]]; + op[1] = t1; + op[2] = t2; + op[3] = t3; + n -= 3; + while (n > 0) { + n -= 3; + wp += 3; + op += 4; + op[0] = 0; + t1 = ToLinear8[(cb += wp[2]) & mask]; + t2 = ToLinear8[(cg += wp[1]) & mask]; + t3 = ToLinear8[(cr += wp[0]) & mask]; + op[1] = t1; + op[2] = t2; + op[3] = t3; + } + } else if (stride == 4) { + t0 = ToLinear8[ca = wp[3]]; + t1 = ToLinear8[cb = wp[2]]; + t2 = ToLinear8[cg = wp[1]]; + t3 = ToLinear8[cr = wp[0]]; + op[0] = t0; + op[1] = t1; + op[2] = t2; + op[3] = t3; + n -= 4; + while (n > 0) { + n -= 4; + wp += 4; + op += 4; + t0 = ToLinear8[(ca += wp[3]) & mask]; + t1 = ToLinear8[(cb += wp[2]) & mask]; + t2 = ToLinear8[(cg += wp[1]) & mask]; + t3 = ToLinear8[(cr += wp[0]) & mask]; + op[0] = t0; + op[1] = t1; + op[2] = t2; + op[3] = t3; + } + } else { + REPEAT(stride, *op = ToLinear8[*wp&mask]; wp++; op++) + n -= stride; + while (n > 0) { + REPEAT(stride, + wp[stride] += *wp; *op = ToLinear8[*wp&mask]; wp++; op++) + n -= stride; + } + } + } +} + +/* + * State block for each open TIFF + * file using PixarLog compression/decompression. + */ +typedef struct { + TIFFPredictorState predict; + z_stream stream; + uint16 *tbuf; + uint16 stride; + short user_datafmt; + short state; + int quality; +#define PLSTATE_INIT 1 + + TIFFVSetMethod vgetparent; /* super-class method */ + TIFFVSetMethod vsetparent; /* super-class method */ + + float *ToLinearF; + uint16 *ToLinear16; + unsigned char *ToLinear8; + uint16 *FromLT2; + uint16 *From14; /* Really for 16-bit data, but we shift down 2 */ + uint16 *From8; + +} PixarLogState; + +static int +PixarLogMakeTables(PixarLogState *sp) +{ + +/* + * We make several tables here to convert between various external + * representations (float, 16-bit, and 8-bit) and the internal + * 11-bit companded representation. The 11-bit representation has two + * distinct regions. A linear bottom end up through .018316 in steps + * of about .000073, and a region of constant ratio up to about 25. + * These floating point numbers are stored in the main table ToLinearF. + * All other tables are derived from this one. The tables (and the + * ratios) are continuous at the internal seam. + */ + + int nlin, lt2size; + int i, j; + double b, c, linstep, max; + double k, v, dv, r, lr2, r2; + float *ToLinearF; + uint16 *ToLinear16; + unsigned char *ToLinear8; + uint16 *FromLT2; + uint16 *From14; /* Really for 16-bit data, but we shift down 2 */ + uint16 *From8; + + c = log(RATIO); + nlin = 1./c; /* nlin must be an integer */ + c = 1./nlin; + b = exp(-c*ONE); /* multiplicative scale factor [b*exp(c*ONE) = 1] */ + linstep = b*c*exp(1.); + + LogK1 = 1./c; /* if (v >= 2) token = k1*log(v*k2) */ + LogK2 = 1./b; + lt2size = (2./linstep)+1; + FromLT2 = (uint16 *)_TIFFmalloc(lt2size*sizeof(uint16)); + From14 = (uint16 *)_TIFFmalloc(16384*sizeof(uint16)); + From8 = (uint16 *)_TIFFmalloc(256*sizeof(uint16)); + ToLinearF = (float *)_TIFFmalloc(TSIZEP1 * sizeof(float)); + ToLinear16 = (uint16 *)_TIFFmalloc(TSIZEP1 * sizeof(uint16)); + ToLinear8 = (unsigned char *)_TIFFmalloc(TSIZEP1 * sizeof(unsigned char)); + if (FromLT2 == NULL || From14 == NULL || From8 == NULL || + ToLinearF == NULL || ToLinear16 == NULL || ToLinear8 == NULL) { + if (FromLT2) _TIFFfree(FromLT2); + if (From14) _TIFFfree(From14); + if (From8) _TIFFfree(From8); + if (ToLinearF) _TIFFfree(ToLinearF); + if (ToLinear16) _TIFFfree(ToLinear16); + if (ToLinear8) _TIFFfree(ToLinear8); + sp->FromLT2 = NULL; + sp->From14 = NULL; + sp->From8 = NULL; + sp->ToLinearF = NULL; + sp->ToLinear16 = NULL; + sp->ToLinear8 = NULL; + return 0; + } + + j = 0; + + for (i = 0; i < nlin; i++) { + v = i * linstep; + ToLinearF[j++] = v; + } + + for (i = nlin; i < TSIZE; i++) + ToLinearF[j++] = b*exp(c*i); + + ToLinearF[2048] = ToLinearF[2047]; + + for (i = 0; i < TSIZEP1; i++) { + v = ToLinearF[i]*65535.0 + 0.5; + ToLinear16[i] = (v > 65535.0) ? 65535 : v; + v = ToLinearF[i]*255.0 + 0.5; + ToLinear8[i] = (v > 255.0) ? 255 : v; + } + + j = 0; + for (i = 0; i < lt2size; i++) { + if ((i*linstep)*(i*linstep) > ToLinearF[j]*ToLinearF[j+1]) + j++; + FromLT2[i] = j; + } + + /* + * Since we lose info anyway on 16-bit data, we set up a 14-bit + * table and shift 16-bit values down two bits on input. + * saves a little table space. + */ + j = 0; + for (i = 0; i < 16384; i++) { + while ((i/16383.)*(i/16383.) > ToLinearF[j]*ToLinearF[j+1]) + j++; + From14[i] = j; + } + + j = 0; + for (i = 0; i < 256; i++) { + while ((i/255.)*(i/255.) > ToLinearF[j]*ToLinearF[j+1]) + j++; + From8[i] = j; + } + + Fltsize = lt2size/2; + + sp->ToLinearF = ToLinearF; + sp->ToLinear16 = ToLinear16; + sp->ToLinear8 = ToLinear8; + sp->FromLT2 = FromLT2; + sp->From14 = From14; + sp->From8 = From8; + + return 1; +} + +#define DecoderState(tif) ((PixarLogState*) (tif)->tif_data) +#define EncoderState(tif) ((PixarLogState*) (tif)->tif_data) + +static int PixarLogEncode(TIFF*, tidata_t, tsize_t, tsample_t); +static int PixarLogDecode(TIFF*, tidata_t, tsize_t, tsample_t); + +#define N(a) (sizeof(a)/sizeof(a[0])) +#define PIXARLOGDATAFMT_UNKNOWN -1 + +static int +PixarLogGuessDataFmt(TIFFDirectory *td) +{ + int guess = PIXARLOGDATAFMT_UNKNOWN; + int format = td->td_sampleformat; + + /* If the user didn't tell us his datafmt, + * take our best guess from the bitspersample. + */ + switch (td->td_bitspersample) { + case 32: + if (format == SAMPLEFORMAT_IEEEFP) + guess = PIXARLOGDATAFMT_FLOAT; + break; + case 16: + if (format == SAMPLEFORMAT_VOID || format == SAMPLEFORMAT_UINT) + guess = PIXARLOGDATAFMT_16BIT; + break; + case 12: + if (format == SAMPLEFORMAT_VOID || format == SAMPLEFORMAT_INT) + guess = PIXARLOGDATAFMT_12BITPICIO; + break; + case 11: + if (format == SAMPLEFORMAT_VOID || format == SAMPLEFORMAT_UINT) + guess = PIXARLOGDATAFMT_11BITLOG; + break; + case 8: + if (format == SAMPLEFORMAT_VOID || format == SAMPLEFORMAT_UINT) + guess = PIXARLOGDATAFMT_8BIT; + break; + } + + return guess; +} + +static int +PixarLogSetupDecode(TIFF* tif) +{ + TIFFDirectory *td = &tif->tif_dir; + PixarLogState* sp = DecoderState(tif); + static char module[] = "PixarLogSetupDecode"; + + assert(sp != NULL); + + /* Make sure no byte swapping happens on the data + * after decompression. */ + tif->tif_postdecode = _TIFFNoPostDecode; + + /* for some reason, we can't do this in TIFFInitPixarLog */ + + sp->stride = (td->td_planarconfig == PLANARCONFIG_CONTIG ? + td->td_samplesperpixel : 1); + sp->tbuf = (uint16 *) _TIFFmalloc(sp->stride * + td->td_imagewidth * td->td_rowsperstrip * sizeof(uint16)); + if (sp->user_datafmt == PIXARLOGDATAFMT_UNKNOWN) + sp->user_datafmt = PixarLogGuessDataFmt(td); + if (sp->user_datafmt == PIXARLOGDATAFMT_UNKNOWN) { + TIFFError(module, + "PixarLog compression can't handle bits depth/data format combination (depth: %d)", + td->td_bitspersample); + return (0); + } + + if (inflateInit(&sp->stream) != Z_OK) { + TIFFError(module, "%s: %s", tif->tif_name, sp->stream.msg); + return (0); + } else { + sp->state |= PLSTATE_INIT; + return (1); + } +} + +/* + * Setup state for decoding a strip. + */ +static int +PixarLogPreDecode(TIFF* tif, tsample_t s) +{ + TIFFDirectory *td = &tif->tif_dir; + PixarLogState* sp = DecoderState(tif); + + (void) s; + assert(sp != NULL); + sp->stream.next_in = tif->tif_rawdata; + sp->stream.avail_in = tif->tif_rawcc; + return (inflateReset(&sp->stream) == Z_OK); +} + +static int +PixarLogDecode(TIFF* tif, tidata_t op, tsize_t occ, tsample_t s) +{ + TIFFDirectory *td = &tif->tif_dir; + PixarLogState* sp = DecoderState(tif); + static char module[] = "PixarLogDecode"; + int i, nsamples, llen; + uint16 *up; + + switch (sp->user_datafmt) { + case PIXARLOGDATAFMT_FLOAT: + nsamples = occ / sizeof(float); /* XXX float == 32 bits */ + break; + case PIXARLOGDATAFMT_16BIT: + case PIXARLOGDATAFMT_12BITPICIO: + case PIXARLOGDATAFMT_11BITLOG: + nsamples = occ / sizeof(uint16); /* XXX uint16 == 16 bits */ + break; + case PIXARLOGDATAFMT_8BIT: + case PIXARLOGDATAFMT_8BITABGR: + nsamples = occ; + break; + default: + TIFFError(tif->tif_name, + "%d bit input not supported in PixarLog", + td->td_bitspersample); + return 0; + } + + llen = sp->stride * td->td_imagewidth; + + (void) s; + assert(sp != NULL); + sp->stream.next_out = (unsigned char *) sp->tbuf; + sp->stream.avail_out = nsamples * sizeof(uint16); + do { + int state = inflate(&sp->stream, Z_PARTIAL_FLUSH); + if (state == Z_STREAM_END) { + break; /* XXX */ + } + if (state == Z_DATA_ERROR) { + TIFFError(module, + "%s: Decoding error at scanline %d, %s", + tif->tif_name, tif->tif_row, sp->stream.msg); + if (inflateSync(&sp->stream) != Z_OK) + return (0); + continue; + } + if (state != Z_OK) { + TIFFError(module, "%s: zlib error: %s", + tif->tif_name, sp->stream.msg); + return (0); + } + } while (sp->stream.avail_out > 0); + + /* hopefully, we got all the bytes we needed */ + if (sp->stream.avail_out != 0) { + TIFFError(module, + "%s: Not enough data at scanline %d (short %d bytes)", + tif->tif_name, tif->tif_row, sp->stream.avail_out); + return (0); + } + + up = sp->tbuf; + /* Swap bytes in the data if from a different endian machine. */ + if (tif->tif_flags & TIFF_SWAB) + TIFFSwabArrayOfShort(up, nsamples); + + for (i = 0; i < nsamples; i += llen, up += llen) { + switch (sp->user_datafmt) { + case PIXARLOGDATAFMT_FLOAT: + horizontalAccumulateF(up, llen, sp->stride, + (float *)op, sp->ToLinearF); + op += llen * sizeof(float); + break; + case PIXARLOGDATAFMT_16BIT: + horizontalAccumulate16(up, llen, sp->stride, + (uint16 *)op, sp->ToLinear16); + op += llen * sizeof(uint16); + break; + case PIXARLOGDATAFMT_12BITPICIO: + horizontalAccumulate12(up, llen, sp->stride, + (int16 *)op, sp->ToLinearF); + op += llen * sizeof(int16); + break; + case PIXARLOGDATAFMT_11BITLOG: + horizontalAccumulate11(up, llen, sp->stride, + (uint16 *)op); + op += llen * sizeof(uint16); + break; + case PIXARLOGDATAFMT_8BIT: + horizontalAccumulate8(up, llen, sp->stride, + (unsigned char *)op, sp->ToLinear8); + op += llen * sizeof(unsigned char); + break; + case PIXARLOGDATAFMT_8BITABGR: + horizontalAccumulate8abgr(up, llen, sp->stride, + (unsigned char *)op, sp->ToLinear8); + op += llen * sizeof(unsigned char); + break; + default: + TIFFError(tif->tif_name, + "PixarLogDecode: unsupported bits/sample: %d", + td->td_bitspersample); + return (0); + } + } + + return (1); +} + +static int +PixarLogSetupEncode(TIFF* tif) +{ + TIFFDirectory *td = &tif->tif_dir; + PixarLogState* sp = EncoderState(tif); + static char module[] = "PixarLogSetupEncode"; + + assert(sp != NULL); + + /* for some reason, we can't do this in TIFFInitPixarLog */ + + sp->stride = (td->td_planarconfig == PLANARCONFIG_CONTIG ? + td->td_samplesperpixel : 1); + sp->tbuf = (uint16 *) _TIFFmalloc(sp->stride * + td->td_imagewidth * td->td_rowsperstrip * sizeof(uint16)); + if (sp->user_datafmt == PIXARLOGDATAFMT_UNKNOWN) + sp->user_datafmt = PixarLogGuessDataFmt(td); + if (sp->user_datafmt == PIXARLOGDATAFMT_UNKNOWN) { + TIFFError(module, "PixarLog compression can't handle %d bit linear encodings", td->td_bitspersample); + return (0); + } + + if (deflateInit(&sp->stream, sp->quality) != Z_OK) { + TIFFError(module, "%s: %s", tif->tif_name, sp->stream.msg); + return (0); + } else { + sp->state |= PLSTATE_INIT; + return (1); + } +} + +/* + * Reset encoding state at the start of a strip. + */ +static int +PixarLogPreEncode(TIFF* tif, tsample_t s) +{ + TIFFDirectory *td = &tif->tif_dir; + PixarLogState *sp = EncoderState(tif); + + (void) s; + assert(sp != NULL); + sp->stream.next_out = tif->tif_rawdata; + sp->stream.avail_out = tif->tif_rawdatasize; + return (deflateReset(&sp->stream) == Z_OK); +} + +static void +horizontalDifferenceF(float *ip, int n, int stride, uint16 *wp, uint16 *FromLT2) +{ + + register int r1, g1, b1, a1, r2, g2, b2, a2, mask; + register float fltsize = Fltsize; + +#define CLAMP(v) ( (v<(float)0.) ? 0 \ + : (v<(float)2.) ? FromLT2[(int)(v*fltsize)] \ + : (v>(float)24.2) ? 2047 \ + : LogK1*log(v*LogK2) + 0.5 ) + + mask = CODE_MASK; + if (n >= stride) { + if (stride == 3) { + r2 = wp[0] = CLAMP(ip[0]); g2 = wp[1] = CLAMP(ip[1]); + b2 = wp[2] = CLAMP(ip[2]); + n -= 3; + while (n > 0) { + n -= 3; + wp += 3; + ip += 3; + r1 = CLAMP(ip[0]); wp[0] = (r1-r2) & mask; r2 = r1; + g1 = CLAMP(ip[1]); wp[1] = (g1-g2) & mask; g2 = g1; + b1 = CLAMP(ip[2]); wp[2] = (b1-b2) & mask; b2 = b1; + } + } else if (stride == 4) { + r2 = wp[0] = CLAMP(ip[0]); g2 = wp[1] = CLAMP(ip[1]); + b2 = wp[2] = CLAMP(ip[2]); a2 = wp[3] = CLAMP(ip[3]); + n -= 4; + while (n > 0) { + n -= 4; + wp += 4; + ip += 4; + r1 = CLAMP(ip[0]); wp[0] = (r1-r2) & mask; r2 = r1; + g1 = CLAMP(ip[1]); wp[1] = (g1-g2) & mask; g2 = g1; + b1 = CLAMP(ip[2]); wp[2] = (b1-b2) & mask; b2 = b1; + a1 = CLAMP(ip[3]); wp[3] = (a1-a2) & mask; a2 = a1; + } + } else { + ip += n - 1; /* point to last one */ + wp += n - 1; /* point to last one */ + n -= stride; + while (n > 0) { + REPEAT(stride, wp[0] = CLAMP(ip[0]); + wp[stride] -= wp[0]; + wp[stride] &= mask; + wp--; ip--) + n -= stride; + } + REPEAT(stride, wp[0] = CLAMP(ip[0]); wp--; ip--) + } + } +} + +static void +horizontalDifference16(unsigned short *ip, int n, int stride, + unsigned short *wp, uint16 *From14) +{ + register int r1, g1, b1, a1, r2, g2, b2, a2, mask; + +/* assumption is unsigned pixel values */ +#undef CLAMP +#define CLAMP(v) From14[(v) >> 2] + + mask = CODE_MASK; + if (n >= stride) { + if (stride == 3) { + r2 = wp[0] = CLAMP(ip[0]); g2 = wp[1] = CLAMP(ip[1]); + b2 = wp[2] = CLAMP(ip[2]); + n -= 3; + while (n > 0) { + n -= 3; + wp += 3; + ip += 3; + r1 = CLAMP(ip[0]); wp[0] = (r1-r2) & mask; r2 = r1; + g1 = CLAMP(ip[1]); wp[1] = (g1-g2) & mask; g2 = g1; + b1 = CLAMP(ip[2]); wp[2] = (b1-b2) & mask; b2 = b1; + } + } else if (stride == 4) { + r2 = wp[0] = CLAMP(ip[0]); g2 = wp[1] = CLAMP(ip[1]); + b2 = wp[2] = CLAMP(ip[2]); a2 = wp[3] = CLAMP(ip[3]); + n -= 4; + while (n > 0) { + n -= 4; + wp += 4; + ip += 4; + r1 = CLAMP(ip[0]); wp[0] = (r1-r2) & mask; r2 = r1; + g1 = CLAMP(ip[1]); wp[1] = (g1-g2) & mask; g2 = g1; + b1 = CLAMP(ip[2]); wp[2] = (b1-b2) & mask; b2 = b1; + a1 = CLAMP(ip[3]); wp[3] = (a1-a2) & mask; a2 = a1; + } + } else { + ip += n - 1; /* point to last one */ + wp += n - 1; /* point to last one */ + n -= stride; + while (n > 0) { + REPEAT(stride, wp[0] = CLAMP(ip[0]); + wp[stride] -= wp[0]; + wp[stride] &= mask; + wp--; ip--) + n -= stride; + } + REPEAT(stride, wp[0] = CLAMP(ip[0]); wp--; ip--) + } + } +} + + +static void +horizontalDifference8(unsigned char *ip, int n, int stride, + unsigned short *wp, uint16 *From8) +{ + register int r1, g1, b1, a1, r2, g2, b2, a2, mask; + +#undef CLAMP +#define CLAMP(v) (From8[(v)]) + + mask = CODE_MASK; + if (n >= stride) { + if (stride == 3) { + r2 = wp[0] = CLAMP(ip[0]); g2 = wp[1] = CLAMP(ip[1]); + b2 = wp[2] = CLAMP(ip[2]); + n -= 3; + while (n > 0) { + n -= 3; + r1 = CLAMP(ip[3]); wp[3] = (r1-r2) & mask; r2 = r1; + g1 = CLAMP(ip[4]); wp[4] = (g1-g2) & mask; g2 = g1; + b1 = CLAMP(ip[5]); wp[5] = (b1-b2) & mask; b2 = b1; + wp += 3; + ip += 3; + } + } else if (stride == 4) { + r2 = wp[0] = CLAMP(ip[0]); g2 = wp[1] = CLAMP(ip[1]); + b2 = wp[2] = CLAMP(ip[2]); a2 = wp[3] = CLAMP(ip[3]); + n -= 4; + while (n > 0) { + n -= 4; + r1 = CLAMP(ip[4]); wp[4] = (r1-r2) & mask; r2 = r1; + g1 = CLAMP(ip[5]); wp[5] = (g1-g2) & mask; g2 = g1; + b1 = CLAMP(ip[6]); wp[6] = (b1-b2) & mask; b2 = b1; + a1 = CLAMP(ip[7]); wp[7] = (a1-a2) & mask; a2 = a1; + wp += 4; + ip += 4; + } + } else { + wp += n + stride - 1; /* point to last one */ + ip += n + stride - 1; /* point to last one */ + n -= stride; + while (n > 0) { + REPEAT(stride, wp[0] = CLAMP(ip[0]); + wp[stride] -= wp[0]; + wp[stride] &= mask; + wp--; ip--) + n -= stride; + } + REPEAT(stride, wp[0] = CLAMP(ip[0]); wp--; ip--) + } + } +} + +/* + * Encode a chunk of pixels. + */ +static int +PixarLogEncode(TIFF* tif, tidata_t bp, tsize_t cc, tsample_t s) +{ + TIFFDirectory *td = &tif->tif_dir; + PixarLogState *sp = EncoderState(tif); + static char module[] = "PixarLogEncode"; + int i, n, llen; + unsigned short * up; + + (void) s; + + switch (sp->user_datafmt) { + case PIXARLOGDATAFMT_FLOAT: + n = cc / sizeof(float); /* XXX float == 32 bits */ + break; + case PIXARLOGDATAFMT_16BIT: + case PIXARLOGDATAFMT_12BITPICIO: + case PIXARLOGDATAFMT_11BITLOG: + n = cc / sizeof(uint16); /* XXX uint16 == 16 bits */ + break; + case PIXARLOGDATAFMT_8BIT: + case PIXARLOGDATAFMT_8BITABGR: + n = cc; + break; + default: + TIFFError(tif->tif_name, + "%d bit input not supported in PixarLog", + td->td_bitspersample); + return 0; + } + + llen = sp->stride * td->td_imagewidth; + + for (i = 0, up = sp->tbuf; i < n; i += llen, up += llen) { + switch (sp->user_datafmt) { + case PIXARLOGDATAFMT_FLOAT: + horizontalDifferenceF((float *)bp, llen, + sp->stride, up, sp->FromLT2); + bp += llen * sizeof(float); + break; + case PIXARLOGDATAFMT_16BIT: + horizontalDifference16((uint16 *)bp, llen, + sp->stride, up, sp->From14); + bp += llen * sizeof(uint16); + break; + case PIXARLOGDATAFMT_8BIT: + horizontalDifference8((unsigned char *)bp, llen, + sp->stride, up, sp->From8); + bp += llen * sizeof(unsigned char); + break; + default: + TIFFError(tif->tif_name, + "%d bit input not supported in PixarLog", + td->td_bitspersample); + return 0; + } + } + + sp->stream.next_in = (unsigned char *) sp->tbuf; + sp->stream.avail_in = n * sizeof(uint16); + + do { + if (deflate(&sp->stream, Z_NO_FLUSH) != Z_OK) { + TIFFError(module, "%s: Encoder error: %s", + tif->tif_name, sp->stream.msg); + return (0); + } + if (sp->stream.avail_out == 0) { + tif->tif_rawcc = tif->tif_rawdatasize; + TIFFFlushData1(tif); + sp->stream.next_out = tif->tif_rawdata; + sp->stream.avail_out = tif->tif_rawdatasize; + } + } while (sp->stream.avail_in > 0); + return (1); +} + +/* + * Finish off an encoded strip by flushing the last + * string and tacking on an End Of Information code. + */ + +static int +PixarLogPostEncode(TIFF* tif) +{ + PixarLogState *sp = EncoderState(tif); + static char module[] = "PixarLogPostEncode"; + int state; + + sp->stream.avail_in = 0; + + do { + state = deflate(&sp->stream, Z_FINISH); + switch (state) { + case Z_STREAM_END: + case Z_OK: + if (sp->stream.avail_out != tif->tif_rawdatasize) { + tif->tif_rawcc = + tif->tif_rawdatasize - sp->stream.avail_out; + TIFFFlushData1(tif); + sp->stream.next_out = tif->tif_rawdata; + sp->stream.avail_out = tif->tif_rawdatasize; + } + break; + default: + TIFFError(module, "%s: zlib error: %s", + tif->tif_name, sp->stream.msg); + return (0); + } + } while (state != Z_STREAM_END); + return (1); +} + +static void +PixarLogClose(TIFF* tif) +{ + TIFFDirectory *td = &tif->tif_dir; + + /* In a really sneaky maneuver, on close, we covertly modify both + * bitspersample and sampleformat in the directory to indicate + * 8-bit linear. This way, the decode "just works" even for + * readers that don't know about PixarLog, or how to set + * the PIXARLOGDATFMT pseudo-tag. + */ + td->td_bitspersample = 8; + td->td_sampleformat = SAMPLEFORMAT_UINT; +} + +static void +PixarLogCleanup(TIFF* tif) +{ + PixarLogState* sp = (PixarLogState*) tif->tif_data; + + if (sp) { + if (sp->FromLT2) _TIFFfree(sp->FromLT2); + if (sp->From14) _TIFFfree(sp->From14); + if (sp->From8) _TIFFfree(sp->From8); + if (sp->ToLinearF) _TIFFfree(sp->ToLinearF); + if (sp->ToLinear16) _TIFFfree(sp->ToLinear16); + if (sp->ToLinear8) _TIFFfree(sp->ToLinear8); + if (tif->tif_mode == O_RDONLY) + inflateEnd(&sp->stream); + else + deflateEnd(&sp->stream); + _TIFFfree(sp->tbuf); + _TIFFfree(sp); + tif->tif_data = NULL; + } +} + +static int +PixarLogVSetField(TIFF* tif, ttag_t tag, va_list ap) +{ + PixarLogState *sp = (PixarLogState *)tif->tif_data; + int result; + static char module[] = "PixarLogVSetField"; + + switch (tag) { + case TIFFTAG_PIXARLOGQUALITY: + sp->quality = va_arg(ap, int); + if (tif->tif_mode != O_RDONLY && (sp->state&PLSTATE_INIT)) { + if (deflateParams(&sp->stream, + sp->quality, Z_DEFAULT_STRATEGY) != Z_OK) { + TIFFError(module, "%s: zlib error: %s", + tif->tif_name, sp->stream.msg); + return (0); + } + } + return (1); + case TIFFTAG_PIXARLOGDATAFMT: + sp->user_datafmt = va_arg(ap, int); + /* Tweak the TIFF header so that the rest of libtiff knows what + * size of data will be passed between app and library, and + * assume that the app knows what it is doing and is not + * confused by these header manipulations... + */ + switch (sp->user_datafmt) { + case PIXARLOGDATAFMT_8BIT: + case PIXARLOGDATAFMT_8BITABGR: + TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, 8); + TIFFSetField(tif, TIFFTAG_DATATYPE, SAMPLEFORMAT_UINT); + break; + case PIXARLOGDATAFMT_11BITLOG: + TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, 16); + TIFFSetField(tif, TIFFTAG_DATATYPE, SAMPLEFORMAT_UINT); + break; + case PIXARLOGDATAFMT_12BITPICIO: + TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, 16); + TIFFSetField(tif, TIFFTAG_DATATYPE, SAMPLEFORMAT_INT); + break; + case PIXARLOGDATAFMT_16BIT: + TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, 16); + TIFFSetField(tif, TIFFTAG_DATATYPE, SAMPLEFORMAT_UINT); + break; + case PIXARLOGDATAFMT_FLOAT: + TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, 32); + TIFFSetField(tif, TIFFTAG_DATATYPE, SAMPLEFORMAT_IEEEFP); + break; + } + result = 1; /* NB: pseudo tag */ + break; + default: + result = (*sp->vsetparent)(tif, tag, ap); + } + return (result); +} + +static int +PixarLogVGetField(TIFF* tif, ttag_t tag, va_list ap) +{ + PixarLogState *sp = (PixarLogState *)tif->tif_data; + + switch (tag) { + case TIFFTAG_PIXARLOGDATAFMT: + *va_arg(ap, int*) = sp->user_datafmt; + break; + default: + return (*sp->vgetparent)(tif, tag, ap); + } + return (1); +} + +static const TIFFFieldInfo pixarlogFieldInfo[] = { + {TIFFTAG_PIXARLOGDATAFMT,0,0,TIFF_SHORT,FIELD_PSEUDO,FALSE,FALSE,""}, + {TIFFTAG_PIXARLOGQUALITY,0,0,TIFF_ANY, FIELD_PSEUDO,FALSE,FALSE,""} +}; + +int +TIFFInitPixarLog(TIFF* tif, int scheme) +{ + PixarLogState* sp; + + assert(scheme == COMPRESSION_PIXARLOG); + + /* + * Allocate state block so tag methods have storage to record values. + */ + tif->tif_data = (tidata_t) _TIFFmalloc(sizeof (PixarLogState)); + if (tif->tif_data == NULL) + goto bad; + sp = (PixarLogState*) tif->tif_data; + sp->stream.zalloc = NULL; + sp->stream.zfree = NULL; + sp->stream.opaque = NULL; + sp->stream.data_type = Z_BINARY; + sp->user_datafmt = PIXARLOGDATAFMT_UNKNOWN; + + /* + * Install codec methods. + */ + tif->tif_setupdecode = PixarLogSetupDecode; + tif->tif_predecode = PixarLogPreDecode; + tif->tif_decoderow = PixarLogDecode; + tif->tif_decodestrip = PixarLogDecode; + tif->tif_decodetile = PixarLogDecode; + tif->tif_setupencode = PixarLogSetupEncode; + tif->tif_preencode = PixarLogPreEncode; + tif->tif_postencode = PixarLogPostEncode; + tif->tif_encoderow = PixarLogEncode; + tif->tif_encodestrip = PixarLogEncode; + tif->tif_encodetile = PixarLogEncode; + tif->tif_close = PixarLogClose; + tif->tif_cleanup = PixarLogCleanup; + + /* Override SetField so we can handle our private pseudo-tag */ + _TIFFMergeFieldInfo(tif, pixarlogFieldInfo, N(pixarlogFieldInfo)); + sp->vgetparent = tif->tif_vgetfield; + tif->tif_vgetfield = PixarLogVGetField; /* hook for codec tags */ + sp->vsetparent = tif->tif_vsetfield; + tif->tif_vsetfield = PixarLogVSetField; /* hook for codec tags */ + + /* Default values for codec-specific fields */ + sp->quality = Z_DEFAULT_COMPRESSION; /* default comp. level */ + sp->state = 0; + + /* we don't wish to use the predictor, + * the default is none, which predictor value 1 + */ + (void) TIFFPredictorInit(tif); + + /* + * build the companding tables + */ + PixarLogMakeTables(sp); + + return (1); +bad: + TIFFError("TIFFInitPixarLog", "No space for PixarLog state block"); + return (0); +} +#endif /* PIXARLOG_SUPPORT */ diff --git a/libtiff/tif_vms.c b/libtiff/tif_vms.c index 24f90fd2..aede7734 100644 --- a/libtiff/tif_vms.c +++ b/libtiff/tif_vms.c @@ -1,4 +1,4 @@ -/* $Header: /usr/people/sam/tiff/libtiff/RCS/tif_vms.c,v 1.20 1996/01/10 19:33:16 sam Exp $ */ +/* $Header: /usr/people/sam/tiff/libtiff/RCS/tif_vms.c,v 1.21 1996/03/29 16:37:53 sam Exp $ */ /* * Copyright (c) 1988-1996 Sam Leffler @@ -281,7 +281,7 @@ _TIFFmemset(tdata_t p, int v, tsize_t c) } void -_TIFFmemcpy(tdata_t d, const void* s, tsize_t c) +_TIFFmemcpy(tdata_t d, const tdata_t s, tsize_t c) { memcpy(d, s, (size_t) c); } @@ -339,10 +339,10 @@ asm("_$$PsectAttributes_NOSHR$$_TIFFerrorHandler") /* IEEE floting point handling */ typedef struct ieeedouble { + u_long mant2; /* fix NDR: full 8-byte swap */ u_long mant : 20, exp : 11, sign : 1; - u_long mant2; } ieeedouble; typedef struct ieeefloat { u_long mant : 23, @@ -350,6 +350,11 @@ typedef struct ieeefloat { sign : 1; } ieeefloat; +/* + * NB: These are D_FLOAT's, not G_FLOAT's. A G_FLOAT is + * simply a reverse-IEEE float/double. + */ + typedef struct { u_long mant1 : 7, exp : 8, @@ -418,7 +423,7 @@ ieeetod(double *dp) long sign,exp,mant; double dmant; - source.d = *dp; + source.ieee = ((double_t*)dp)->ieee; sign = source.ieee.sign; exp = source.ieee.exp; mant = source.ieee.mant; @@ -489,7 +494,7 @@ dtoieee(double *dp) } else { /* Get rid of most significant bit */ x *= 2; x -= 1; - exp += 1023; + exp += 1022; /* fix NDR: 1.0 -> x=0.5, exp=1 -> ieee.exp = 1023 */ } num.ieee.exp = exp; @@ -502,7 +507,7 @@ dtoieee(double *dp) /* Avoid negative zero */ num.ieee.sign = 0; } - *dp = num.d; + ((double_t*)dp)->ieee = num.ieee; } /* @@ -560,9 +565,9 @@ TIFFCvtNativeToIEEEFloat(TIFF* tif, u_int n, float* f) } } void -TIFFCvtIEEEDoubleToNative(TIFF* tif, u_int n, float* f) +TIFFCvtIEEEDoubleToNative(TIFF* tif, u_int n, double* f) { - float_t* fp = (float_t*) f; + double_t* fp = (double_t*) f; while (n-- > 0) { IEEEDOUBLE2NATIVE(fp); @@ -571,9 +576,9 @@ TIFFCvtIEEEDoubleToNative(TIFF* tif, u_int n, float* f) } void -TIFFCvtNativeToIEEEDouble(TIFF* tif, u_int n, float* f) +TIFFCvtNativeToIEEEDouble(TIFF* tif, u_int n, double* f) { - float_t* fp = (float_t*) f; + double_t* fp = (double_t*) f; while (n-- > 0) { NATIVE2IEEEDOUBLE(fp); diff --git a/libtiff/tiff.h b/libtiff/tiff.h index 3272c63a..98d4ad38 100644 --- a/libtiff/tiff.h +++ b/libtiff/tiff.h @@ -1,4 +1,4 @@ -/* $Header: /usr/people/sam/tiff/libtiff/RCS/tiff.h,v 1.67 1996/03/04 17:46:53 sam Exp $ */ +/* $Header: /usr/people/sam/tiff/libtiff/RCS/tiff.h,v 1.68 1996/04/05 17:36:53 sam Exp $ */ /* * Copyright (c) 1988-1996 Sam Leffler @@ -42,6 +42,8 @@ #define TIFF_BIGENDIAN 0x4d4d #define TIFF_LITTLEENDIAN 0x4949 +#ifndef _TIFF_DATA_TYPEDEFS_ +#define _TIFF_DATA_TYPEDEFS_ /* * Intrinsic data types required by the file format: * @@ -61,6 +63,7 @@ typedef unsigned int uint32; /* sizeof (uint32) must == 4 */ typedef long int32; typedef unsigned long uint32; /* sizeof (uint32) must == 4 */ #endif +#endif /* _TIFF_DATA_TYPEDEFS_ */ typedef struct { uint16 tiff_magic; /* magic number (defines byte order) */ @@ -144,7 +147,8 @@ typedef enum { #define COMPRESSION_PACKBITS 32773 /* Macintosh RLE */ #define COMPRESSION_THUNDERSCAN 32809 /* ThunderScan RLE */ /* compression codes 32908-32911 are reserved for Pixar */ -#define COMPRESSION_PIXARFILM 32908 /* Pixar companded 10bit LZW */ +#define COMPRESSION_PIXARFILM 32908 /* Pixar companded 10bit LZW */ +#define COMPRESSION_PIXARLOG 32909 /* Pixar companded 11bit ZIP */ #define COMPRESSION_DEFLATE 32946 /* Deflate compression */ #define COMPRESSION_JBIG 34661 /* ISO JBIG */ #define TIFFTAG_PHOTOMETRIC 262 /* photometric interpretation */ @@ -343,7 +347,7 @@ typedef enum { #define TIFFTAG_PIXARLOGDATAFMT 65549 /* PixarLogCodec I/O data sz */ #define PIXARLOGDATAFMT_8BIT 0 /* regular u_char samples */ #define PIXARLOGDATAFMT_8BITABGR 1 /* ABGR-order u_chars */ -#define PIXARLOGDATAFMT_10BITLOG 2 /* 10-bit log-encoded (raw) */ +#define PIXARLOGDATAFMT_11BITLOG 2 /* 11-bit log-encoded (raw) */ #define PIXARLOGDATAFMT_12BITPICIO 3 /* as per PICIO (1.0==2048) */ #define PIXARLOGDATAFMT_16BIT 4 /* signed short samples */ #define PIXARLOGDATAFMT_FLOAT 5 /* IEEE float samples */ @@ -366,4 +370,5 @@ typedef enum { #define TIFFTAG_DCSCALIBRATIONFD 65556 /* calibration file desc */ /* Note: quality level is on the ZLIB 1-9 scale. Default value is -1 */ #define TIFFTAG_ZIPQUALITY 65557 /* compression quality level */ +#define TIFFTAG_PIXARLOGQUALITY 65558 /* PixarLog uses same scale */ #endif /* _TIFF_ */ diff --git a/libtiff/tiffconf.h b/libtiff/tiffconf.h index 598bf8b2..13f1ccde 100644 --- a/libtiff/tiffconf.h +++ b/libtiff/tiffconf.h @@ -1,4 +1,4 @@ -/* $Header: /usr/people/sam/tiff/libtiff/RCS/tiffconf.h,v 1.12 1996/01/10 19:33:24 sam Exp $ */ +/* $Header: /usr/people/sam/tiff/libtiff/RCS/tiffconf.h,v 1.13 1996/04/05 17:36:53 sam Exp $ */ /* * Copyright (c) 1988-1996 Sam Leffler * Copyright (c) 1991-1996 Silicon Graphics, Inc. @@ -90,6 +90,7 @@ * (requires freely available IJG software, see tif_jpeg.c) * ZIP_SUPPORT enable support for Deflate algorithm * (requires freely available zlib software, see tif_zip.c) + * PIXARLOG_SUPPORT enable support for Pixar log-format algorithm */ #define CCITT_SUPPORT #define PACKBITS_SUPPORT diff --git a/libtiff/tiffiop.h b/libtiff/tiffiop.h index 967e7954..6412898a 100644 --- a/libtiff/tiffiop.h +++ b/libtiff/tiffiop.h @@ -1,4 +1,4 @@ -/* $Header: /usr/people/sam/tiff/libtiff/RCS/tiffiop.h,v 1.79 1996/01/10 19:33:26 sam Exp $ */ +/* $Header: /usr/people/sam/tiff/libtiff/RCS/tiffiop.h,v 1.80 1996/04/05 17:36:53 sam Exp $ */ /* * Copyright (c) 1988-1996 Sam Leffler @@ -272,6 +272,9 @@ extern int TIFFInitJBIG(TIFF*, int); #ifdef ZIP_SUPPORT extern int TIFFInitZIP(TIFF*, int); #endif +#ifdef PIXARLOG_SUPPORT +extern int TIFFInitPixarLog(TIFF*, int); +#endif #ifdef VMS extern const TIFFCodec _TIFFBuiltinCODECS[]; #else diff --git a/tools/tiffdump.c b/tools/tiffdump.c index c74f37a1..16a9f3a3 100644 --- a/tools/tiffdump.c +++ b/tools/tiffdump.c @@ -1,4 +1,4 @@ -/* $Header: /usr/people/sam/tiff/tools/RCS/tiffdump.c,v 1.48 1996/01/10 19:35:38 sam Exp $ */ +/* $Header: /usr/people/sam/tiff/tools/RCS/tiffdump.c,v 1.49 1996/03/29 16:38:33 sam Exp $ */ /* * Copyright (c) 1988-1996 Sam Leffler @@ -684,14 +684,18 @@ TIFFFetchData(int fd, TIFFDirEntry* dir, void* cp) break; case TIFF_LONG: case TIFF_SLONG: + case TIFF_FLOAT: TIFFSwabArrayOfLong((uint32*) cp, dir->tdir_count); break; case TIFF_RATIONAL: - case TIFF_DOUBLE: TIFFSwabArrayOfLong((uint32*) cp, 2*dir->tdir_count); break; + case TIFF_DOUBLE: + TIFFSwabArrayOfDouble((double*) cp, + dir->tdir_count); + break; } } return (cc); -- cgit v1.2.1