Updated libtiff library version to 3.8.2 (for WIN32)
authorFrancois-Olivier Devaux <fodevaux@users.noreply.github.com>
Thu, 19 Jul 2007 13:44:04 +0000 (13:44 +0000)
committerFrancois-Olivier Devaux <fodevaux@users.noreply.github.com>
Thu, 19 Jul 2007 13:44:04 +0000 (13:44 +0000)
Updated BMP and PxM truncation when decoding J2K files with more than 8 bits (convert.c)

12 files changed:
ChangeLog
codec/convert.c
codec/image_to_j2k.dsp
codec/j2k_to_image.dsp
libs/libtiff/Tiffcomp.h [deleted file]
libs/libtiff/Tiffiop.h [deleted file]
libs/libtiff/Version.h [deleted file]
libs/libtiff/libtiff.lib
libs/libtiff/tiff.h
libs/libtiff/tiffconf.h [new file with mode: 0644]
libs/libtiff/tiffio.h
libs/libtiff/tiffvers.h [new file with mode: 0644]

index 974fc7053e237f815b5a64f7de60e19ae1bd85aa..50efa40617efbbcaf642e4af9b5e9df0e322d082 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,10 @@ What's New for OpenJPEG
 ! : changed
 + : added
 
+July 18, 2007
+! [FOD] Updated libtiff library version to 3.8.2 (for WIN32)
+* [FOD] Updated BMP and PxM truncation when decoding J2K files with more than 8 bits
+
 July 17, 2007
 * [FOD] Fixed raw option for images with more than three components
 
index 1dc2ca66547ec5458be6f95d791b9149fba9de1b..17ecf49b7e89cadb311e30989fcdd89b9b9618a6 100644 (file)
@@ -473,6 +473,7 @@ int imagetobmp(opj_image_t * image, const char *outfile) {
        int w, wr, h, hr;
        int i, pad;
        FILE *fdest = NULL;
+       int adjustR, adjustG, adjustB;
 
        if (image->numcomps == 3 && image->comps[0].dx == image->comps[1].dx
                && image->comps[1].dx == image->comps[2].dx
@@ -491,13 +492,9 @@ int imagetobmp(opj_image_t * image, const char *outfile) {
                        return 1;
                }
            
-               /* w = int_ceildiv(image->x1 - image->x0, image->comps[0].dx); */
-               /* wr = int_ceildiv(int_ceildivpow2(image->x1 - image->x0,image->factor), image->comps[0].dx); */
                w = image->comps[0].w;
                wr = int_ceildivpow2(image->comps[0].w, image->comps[0].factor);
            
-               /* h = int_ceildiv(image->y1 - image->y0, image->comps[0].dy); */
-               /* hr = int_ceildiv(int_ceildivpow2(image->y1 - image->y0,image->factor), image->comps[0].dy); */
                h = image->comps[0].h;
                hr = int_ceildivpow2(image->comps[0].h, image->comps[0].factor);
            
@@ -536,16 +533,40 @@ int imagetobmp(opj_image_t * image, const char *outfile) {
                fprintf(fdest, "%c%c%c%c", (0) & 0xff, ((0) >> 8) & 0xff, ((0) >> 16) & 0xff, ((0) >> 24) & 0xff);
                fprintf(fdest, "%c%c%c%c", (0) & 0xff, ((0) >> 8) & 0xff, ((0) >> 16) & 0xff, ((0) >> 24) & 0xff);
            
+               if (image->comps[0].prec > 8) {
+                       adjustR = image->comps[0].prec - 8;
+                       printf("BMP CONVERSION: Truncating component 0 from %d bits to 8 bits\n", image->comps[0].prec);
+               }
+               else 
+                       adjustR = 0;
+               if (image->comps[1].prec > 8) {
+                       adjustG = image->comps[1].prec - 8;
+                       printf("BMP CONVERSION: Truncating component 1 from %d bits to 8 bits\n", image->comps[1].prec);
+               }
+               else 
+                       adjustG = 0;
+               if (image->comps[2].prec > 8) {
+                       adjustB = image->comps[2].prec - 8;
+                       printf("BMP CONVERSION: Truncating component 2 from %d bits to 8 bits\n", image->comps[2].prec);
+               }
+               else 
+                       adjustB = 0;
+
                for (i = 0; i < wr * hr; i++) {
-                       unsigned char R, G, B;
-                       /* a modifier */
-                       /* R = image->comps[0].data[w * h - ((i) / (w) + 1) * w + (i) % (w)]; */
-                       R = image->comps[0].data[w * hr - ((i) / (wr) + 1) * w + (i) % (wr)];
-                       /* G = image->comps[1].data[w * h - ((i) / (w) + 1) * w + (i) % (w)]; */
-                       G = image->comps[1].data[w * hr - ((i) / (wr) + 1) * w + (i) % (wr)];
-                       /* B = image->comps[2].data[w * h - ((i) / (w) + 1) * w + (i) % (w)]; */
-                       B = image->comps[2].data[w * hr - ((i) / (wr) + 1) * w + (i) % (wr)];
-                       fprintf(fdest, "%c%c%c", B, G, R);
+                       unsigned char rc, gc, bc;
+                       int r, g, b;
+                                                       
+                       r = image->comps[0].data[w * hr - ((i) / (wr) + 1) * w + (i) % (wr)];
+                       r += (image->comps[0].sgnd ? 1 << (image->comps[0].prec - 1) : 0);
+                       rc = (unsigned char) ((r >> adjustR)+((r >> (adjustR-1))%2));
+                       g = image->comps[1].data[w * hr - ((i) / (wr) + 1) * w + (i) % (wr)];
+                       g += (image->comps[1].sgnd ? 1 << (image->comps[1].prec - 1) : 0);
+                       gc = (unsigned char) ((g >> adjustG)+((g >> (adjustG-1))%2));
+                       b = image->comps[2].data[w * hr - ((i) / (wr) + 1) * w + (i) % (wr)];
+                       b += (image->comps[2].sgnd ? 1 << (image->comps[2].prec - 1) : 0);
+                       bc = (unsigned char) ((b >> adjustB)+((b >> (adjustB-1))%2));
+
+                       fprintf(fdest, "%c%c%c", bc, gc, rc);
                        
                        if ((i + 1) % wr == 0) {
                                for (pad = (3 * wr) % 4 ? 4 - (3 * wr) % 4 : 0; pad > 0; pad--) /* ADD */
@@ -560,13 +581,9 @@ int imagetobmp(opj_image_t * image, const char *outfile) {
                <<-- <<-- <<-- <<-- */
 
                fdest = fopen(outfile, "wb");
-               /* w = int_ceildiv(image->x1 - image->x0, image->comps[0].dx); */
-               /* wr = int_ceildiv(int_ceildivpow2(image->x1 - image->x0,image->factor), image->comps[0].dx); */
                w = image->comps[0].w;
                wr = int_ceildivpow2(image->comps[0].w, image->comps[0].factor);
            
-               /* h = int_ceildiv(image->y1 - image->y0, image->comps[0].dy); */
-               /* hr = int_ceildiv(int_ceildivpow2(image->y1 - image->y0,image->factor), image->comps[0].dy); */
                h = image->comps[0].h;
                hr = int_ceildivpow2(image->comps[0].h, image->comps[0].factor);
            
@@ -606,16 +623,25 @@ int imagetobmp(opj_image_t * image, const char *outfile) {
                fprintf(fdest, "%c%c%c%c", (256) & 0xff, ((256) >> 8) & 0xff, ((256) >> 16) & 0xff, ((256) >> 24) & 0xff);
                fprintf(fdest, "%c%c%c%c", (256) & 0xff, ((256) >> 8) & 0xff, ((256) >> 16) & 0xff, ((256) >> 24) & 0xff);
 
+               if (image->comps[0].prec > 8) {
+                       adjustR = image->comps[0].prec - 8;
+                       printf("BMP CONVERSION: Truncating component 0 from %d bits to 8 bits\n", image->comps[0].prec);
+               }
+
                for (i = 0; i < 256; i++) {
                        fprintf(fdest, "%c%c%c%c", i, i, i, 0);
                }
 
                for (i = 0; i < wr * hr; i++) {
-                       /* a modifier !! */
-                       /* fprintf(fdest, "%c", image->comps[0].data[w * h - ((i) / (w) + 1) * w + (i) % (w)]); */
-                       fprintf(fdest, "%c", image->comps[0].data[w * hr - ((i) / (wr) + 1) * w + (i) % (wr)]);
-                       /*if (((i + 1) % w == 0 && w % 2))
-                       fprintf(fdest, "%c", 0); */
+                       unsigned char rc;
+                       int r;
+                       
+                       r = image->comps[0].data[w * hr - ((i) / (wr) + 1) * w + (i) % (wr)];
+                       r += (image->comps[0].sgnd ? 1 << (image->comps[0].prec - 1) : 0);
+                       rc = (unsigned char) ((r >> adjustR)+((r >> (adjustR-1))%2));
+                       
+                       fprintf(fdest, "%c", rc);
+
                        if ((i + 1) % wr == 0) {
                                for (pad = wr % 4 ? 4 - wr % 4 : 0; pad > 0; pad--)     /* ADD */
                                        fprintf(fdest, "%c", 0);
@@ -813,13 +839,10 @@ int imagetopgx(opj_image_t * image, const char *outfile) {
     if( total > 256 ) {
       free(name);
       }
-               /* w = int_ceildiv(image->x1 - image->x0, comp->dx); */
-               /* wr = int_ceildiv(int_ceildivpow2(image->x1 - image->x0,image->factor), comp->dx); */
+
                w = image->comps[compno].w;
                wr = int_ceildivpow2(image->comps[compno].w, image->comps[compno].factor);
            
-               /* h = int_ceildiv(image->y1 - image->y0, comp->dy); */
-               /* hr = int_ceildiv(int_ceildivpow2(image->y1 - image->y0,image->factor), comp->dy); */
                h = image->comps[compno].h;
                hr = int_ceildivpow2(image->comps[compno].h, image->comps[compno].factor);
            
@@ -952,7 +975,7 @@ opj_image_t* pnmtoimage(const char *filename, opj_cparameters_t *parameters) {
 int imagetopnm(opj_image_t * image, const char *outfile) {
        int w, wr, wrr, h, hr, hrr, max;
        int i, compno;
-       int adjust;
+       int adjustR, adjustG, adjustB, adjustX;
        FILE *fdest = NULL;
        char S2;
        const char *tmp = outfile;
@@ -979,12 +1002,10 @@ int imagetopnm(opj_image_t * image, const char *outfile) {
                }
 
                w = int_ceildiv(image->x1 - image->x0, image->comps[0].dx);
-               /* wr = int_ceildiv(int_ceildivpow2(image->x1 - image->x0,image->factor),image->comps[0].dx); */
                wr = image->comps[0].w;
                wrr = int_ceildivpow2(image->comps[0].w, image->comps[0].factor);
         
                h = int_ceildiv(image->y1 - image->y0, image->comps[0].dy);
-               /* hr = int_ceildiv(int_ceildivpow2(image->y1 - image->y0,image->factor), image->comps[0].dy); */
                hr = image->comps[0].h;
                hrr = int_ceildivpow2(image->comps[0].h, image->comps[0].factor);
            
@@ -994,28 +1015,49 @@ int imagetopnm(opj_image_t * image, const char *outfile) {
                image->comps[0].y0 = int_ceildivpow2(image->comps[0].y0 -       int_ceildiv(image->y0, image->comps[0].dy), image->comps[0].factor);
 
                fprintf(fdest, "P6\n%d %d\n%d\n", wrr, hrr, max);
-               adjust = image->comps[0].prec > 8 ? image->comps[0].prec - 8 : 0;
+
+               if (image->comps[0].prec > 8) {
+                       adjustR = image->comps[0].prec - 8;
+                       printf("PNM CONVERSION: Truncating component 0 from %d bits to 8 bits\n", image->comps[0].prec);
+               }
+               else 
+                       adjustR = 0;
+               if (image->comps[1].prec > 8) {
+                       adjustG = image->comps[1].prec - 8;
+                       printf("PNM CONVERSION: Truncating component 1 from %d bits to 8 bits\n", image->comps[1].prec);
+               }
+               else 
+                       adjustG = 0;
+               if (image->comps[2].prec > 8) {
+                       adjustB = image->comps[2].prec - 8;
+                       printf("PNM CONVERSION: Truncating component 2 from %d bits to 8 bits\n", image->comps[2].prec);
+               }
+               else 
+                       adjustB = 0;
+
+
                for (i = 0; i < wrr * hrr; i++) {
                        int r, g, b;
                        unsigned char rc,gc,bc;
                        r = image->comps[0].data[i / wrr * wr + i % wrr];
                        r += (image->comps[0].sgnd ? 1 << (image->comps[0].prec - 1) : 0);
-                       rc = (unsigned char) ((r >> adjust)+((r >> (adjust-1))%2));
+                       rc = (unsigned char) ((r >> adjustR)+((r >> (adjustR-1))%2));
 
                        g = image->comps[1].data[i / wrr * wr + i % wrr];
                        g += (image->comps[1].sgnd ? 1 << (image->comps[1].prec - 1) : 0);
-                       gc = (unsigned char) ((g >> adjust)+((g >> (adjust-1))%2));
+                       gc = (unsigned char) ((g >> adjustG)+((g >> (adjustG-1))%2));
                        
                        b = image->comps[2].data[i / wrr * wr + i % wrr];
                        b += (image->comps[2].sgnd ? 1 << (image->comps[2].prec - 1) : 0);
-                       bc = (unsigned char) ((b >> adjust)+((b >> (adjust-1))%2));
+                       bc = (unsigned char) ((b >> adjustB)+((b >> (adjustB-1))%2));
                        
                        fprintf(fdest, "%c%c%c", rc, gc, bc);
                }
                fclose(fdest);
+
        } else {
                int ncomp=(S2=='g' || S2=='G')?1:image->numcomps;
-               if (image->numcomps>ncomp) {
+               if (image->numcomps > ncomp) {
                        fprintf(stderr,"WARNING -> [PGM files] Only the first component\n");
                        fprintf(stderr,"           is written to the file\n");
                }
@@ -1034,12 +1076,10 @@ int imagetopnm(opj_image_t * image, const char *outfile) {
                        }
             
                        w = int_ceildiv(image->x1 - image->x0, image->comps[compno].dx);
-                       /* wr = int_ceildiv(int_ceildivpow2(image->x1 - image->x0,image->factor),image->comps[compno].dx); */
                        wr = image->comps[compno].w;
                        wrr = int_ceildivpow2(image->comps[compno].w, image->comps[compno].factor);
                        
                        h = int_ceildiv(image->y1 - image->y0, image->comps[compno].dy);
-                       /* hr = int_ceildiv(int_ceildivpow2(image->y1 - image->y0,image->factor), image->comps[compno].dy); */
                        hr = image->comps[compno].h;
                        hrr = int_ceildivpow2(image->comps[compno].h, image->comps[compno].factor);
                        
@@ -1049,14 +1089,20 @@ int imagetopnm(opj_image_t * image, const char *outfile) {
                        image->comps[compno].y0 = int_ceildivpow2(image->comps[compno].y0 - int_ceildiv(image->y0, image->comps[compno].dy), image->comps[compno].factor);
                        
                        fprintf(fdest, "P5\n%d %d\n%d\n", wrr, hrr, max);
-                       adjust = image->comps[compno].prec > 8 ? image->comps[compno].prec - 8 : 0;
-
+                       
+                       if (image->comps[compno].prec > 8) {
+                               adjustX = image->comps[0].prec - 8;
+                               printf("PNM CONVERSION: Truncating component %d from %d bits to 8 bits\n",compno, image->comps[compno].prec);
+                       }
+                       else 
+                               adjustX = 0;
+                       
                        for (i = 0; i < wrr * hrr; i++) {
                                int l;
                                unsigned char lc;
                                l = image->comps[compno].data[i / wrr * wr + i % wrr];
                                l += (image->comps[compno].sgnd ? 1 << (image->comps[compno].prec - 1) : 0);
-                               lc = (unsigned char) ((l >> adjust)+((l >> (adjust-1))%2));
+                               lc = (unsigned char) ((l >> adjustX)+((l >> (adjustX-1))%2));
                                fprintf(fdest, "%c", lc);
                        }
                        fclose(fdest);
index 389ef7a26e9871b679a711d813171226b9bbc493..ee02c169a793abec5086ca7fd26eed50c4c74a9b 100644 (file)
@@ -51,7 +51,7 @@ BSC32=bscmake.exe
 # ADD BSC32 /nologo\r
 LINK32=link.exe\r
 # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386\r
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../libs/libtiff/libtiff.lib /nologo /subsystem:console /machine:I386 /nodefaultlib:"libc"\r
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../libs/libtiff/libtiff.lib /nologo /subsystem:console /machine:I386 /nodefaultlib:"LIBC"\r
 # SUBTRACT LINK32 /pdb:none\r
 \r
 !ELSEIF  "$(CFG)" == "image_to_j2k - Win32 Debug"\r
@@ -77,7 +77,7 @@ BSC32=bscmake.exe
 # ADD BSC32 /nologo\r
 LINK32=link.exe\r
 # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept\r
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../libs/libtiff/libtiff.lib /nologo /subsystem:console /debug /machine:I386 /nodefaultlib:"libc" /pdbtype:sept\r
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../libs/libtiff/libtiff.lib /nologo /subsystem:console /debug /machine:I386 /nodefaultlib:"LIBC" /nodefaultlib:"LIBCMT" /pdbtype:sept\r
 # SUBTRACT LINK32 /pdb:none\r
 \r
 !ENDIF \r
index 6c2f70d5fa6dd4cc09f4a8a911e5b05f087f61ab..36fc74bbbdb26dbd74f3311c50a10db862b2c0d3 100644 (file)
@@ -76,7 +76,7 @@ BSC32=bscmake.exe
 # ADD BSC32 /nologo\r
 LINK32=link.exe\r
 # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept\r
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../libs/libtiff/libtiff.lib /nologo /subsystem:console /debug /machine:I386 /nodefaultlib:"libc" /pdbtype:sept\r
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../libs/libtiff/libtiff.lib /nologo /subsystem:console /debug /machine:I386 /nodefaultlib:"libc" /nodefaultlib:"libcmt" /pdbtype:sept\r
 # SUBTRACT LINK32 /pdb:none\r
 \r
 !ENDIF \r
diff --git a/libs/libtiff/Tiffcomp.h b/libs/libtiff/Tiffcomp.h
deleted file mode 100644 (file)
index 516e638..0000000
+++ /dev/null
@@ -1,214 +0,0 @@
-/* $Header: /usr/people/sam/tiff/libtiff/RCS/tiffcomp.h,v 1.49 1996/04/29 21:56:21 sam Rel $ */
-
-/*
- * Copyright (c) 1990-1996 Sam Leffler
- * Copyright (c) 1991-1996 Silicon Graphics, Inc.
- *
- * Permission to use, copy, modify, distribute, and sell this software and 
- * its documentation for any purpose is hereby granted without fee, provided
- * that (i) the above copyright notices and this permission notice appear in
- * all copies of the software and related documentation, and (ii) the names of
- * Sam Leffler and Silicon Graphics may not be used in any advertising or
- * publicity relating to the software without the specific, prior written
- * permission of Sam Leffler and Silicon Graphics.
- * 
- * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
- * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
- * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
- * 
- * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
- * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
- * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
- * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
- * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
- * OF THIS SOFTWARE.
- */
-
-#ifndef _COMPAT_
-#define        _COMPAT_
-/*
- * This file contains a hodgepodge of definitions and
- * declarations that are needed to provide compatibility
- * between the native system and the base implementation
- * that the library assumes.
- *
- * NB: This file is a mess.
- */
-
-/*
- * Setup basic type definitions and function declaratations.
- */
-
-/*
- * Simplify Acorn RISC OS identifier (to avoid confusion with Acorn RISC iX
- * and with defunct Unix Risc OS)
- * No need to specify __arm - hey, Acorn might port the OS, no problem here!
- */
-#ifdef __acornriscos
-#undef __acornriscos
-#endif
-#if defined(__acorn) && defined(__riscos)
-#define __acornriscos
-#endif
-
-#if defined(__MWERKS__) || defined(THINK_C)
-#include <unix.h>
-#include <math.h>
-#endif
-
-#include <stdio.h>
-
-#if defined(__PPCC__) || defined(__SC__) || defined(__MRC__)
-#include <types.h>
-#elif !defined(__MWERKS__) && !defined(THINK_C) && !defined(__acornriscos) && !defined(applec)
-#include <sys/types.h>
-#endif
-
-#if defined(VMS)
-#include <file.h>
-#include <unixio.h>
-#elif !defined(__acornriscos)
-#include <fcntl.h>
-#endif
-
-/*
- * This maze of checks controls defines or not the
- * target system has BSD-style typdedefs declared in
- * an include file and/or whether or not to include
- * <unistd.h> to get the SEEK_* definitions.  Some
- * additional includes are also done to pull in the
- * appropriate definitions we're looking for.
- */
-#if defined(__MWERKS__) || defined(THINK_C) || defined(__PPCC__) || defined(__SC__) || defined(__MRC__)
-#include <stdlib.h>
-#define        BSDTYPES
-#define        HAVE_UNISTD_H   0
-#elif defined(_WINDOWS) || defined(__WIN32__) || defined(_Windows)
-#define        BSDTYPES
-#elif defined(OS2_16) || defined(OS2_32)
-#define        BSDTYPES
-#elif defined(__acornriscos)
-#include <stdlib.h>
-#define        BSDTYPES
-#define        HAVE_UNISTD_H   0
-#elif defined(VMS)
-#define        HAVE_UNISTD_H   0
-#else
-#define        HAVE_UNISTD_H   1
-#endif
-
-/*
- * The library uses the ANSI C/POSIX SEEK_*
- * definitions that should be defined in unistd.h
- * (except on system where they are in stdio.h and
- * there is no unistd.h).
- */
-#if !defined(SEEK_SET) && HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
-/*
- * The library uses memset, memcpy, and memcmp.
- * ANSI C and System V define these in string.h.
- */
-#include <string.h>
-
-/*
- * The BSD typedefs are used throughout the library.
- * If your system doesn't have them in <sys/types.h>,
- * then define BSDTYPES in your Makefile.
- */
-#if defined(BSDTYPES)
-typedef        unsigned char u_char;
-typedef        unsigned short u_short;
-typedef        unsigned int u_int;
-typedef        unsigned long u_long;
-#endif
-
-/*
- * dblparam_t is the type that a double precision
- * floating point value will have on the parameter
- * stack (when coerced by the compiler).
- */
-/* Note: on MacPowerPC "extended" is undefined. So only use it for 68K-Macs */
-#if defined(__SC__) || defined(THINK_C)
-typedef extended dblparam_t;
-#else
-typedef double dblparam_t;
-#endif
-
-/*
- * If your compiler supports inline functions, then
- * set INLINE appropriately to get the known hotspots
- * in the library expanded inline.
- */
-#if defined(__GNUC__)
-#if defined(__STRICT_ANSI__)
-#define        INLINE  __inline__
-#else
-#define        INLINE  inline
-#endif
-#else /* !__GNUC__ */
-#define        INLINE
-#endif
-
-/*
- * GLOBALDATA is a macro that is used to define global variables
- * private to the library.  We use this indirection to hide
- * brain-damage in VAXC (and GCC) under VAX/VMS.  In these
- * environments the macro places the variable in a non-shareable
- * program section, which ought to be done by default (sigh!)
- *
- * Apparently DEC are aware of the problem as this behaviour is the
- * default under VMS on AXP.
- *
- * The GNU C variant is untested.
- */
-#if defined(VAX) && defined(VMS)
-#if defined(VAXC)
-#define GLOBALDATA(TYPE,NAME)  extern noshare TYPE NAME
-#endif
-#if defined(__GNUC__)
-#define GLOBALDATA(TYPE,NAME)  extern TYPE NAME \
-       asm("_$$PsectAttributes_NOSHR$$" #NAME)
-#endif
-#else  /* !VAX/VMS */
-#define GLOBALDATA(TYPE,NAME)  extern TYPE NAME
-#endif
-
-#if defined(__acornriscos)
-/*
- * osfcn.h is part of C++Lib on Acorn C/C++, and as such can't be used
- * on C alone. For that reason, the relevant functions are
- * implemented in tif_acorn.c, and the elements from the header
- * file are included here.
- */
-#if defined(__cplusplus)
-#include <osfcn.h>
-#else
-#define        O_RDONLY        0
-#define        O_WRONLY        1
-#define        O_RDWR          2
-#define        O_APPEND        8
-#define        O_CREAT         0x200
-#define        O_TRUNC         0x400
-typedef long off_t;
-extern int open(const char *name, int flags, int mode);
-extern int close(int fd);
-extern int write(int fd, const char *buf, int nbytes);
-extern int read(int fd, char *buf, int nbytes);
-extern off_t lseek(int fd, off_t offset, int whence);
-extern int creat(const char *path, int mode);
-#endif /* __cplusplus */
-#endif /* __acornriscos */
-
-/* Bit and byte order, the default is MSB to LSB */
-#ifdef VMS
-#undef HOST_FILLORDER
-#undef HOST_BIGENDIAN
-#define HOST_FILLORDER FILLORDER_LSB2MSB
-#define HOST_BIGENDIAN 0
-#endif
-
-
-#endif /* _COMPAT_ */
diff --git a/libs/libtiff/Tiffiop.h b/libs/libtiff/Tiffiop.h
deleted file mode 100644 (file)
index e4ffc59..0000000
+++ /dev/null
@@ -1,287 +0,0 @@
-/* $Header: /usr/people/sam/tiff/libtiff/RCS/tiffiop.h,v 1.80 1996/04/05 17:36:53 sam Rel $ */
-
-/*
- * Copyright (c) 1988-1996 Sam Leffler
- * Copyright (c) 1991-1996 Silicon Graphics, Inc.
- *
- * Permission to use, copy, modify, distribute, and sell this software and 
- * its documentation for any purpose is hereby granted without fee, provided
- * that (i) the above copyright notices and this permission notice appear in
- * all copies of the software and related documentation, and (ii) the names of
- * Sam Leffler and Silicon Graphics may not be used in any advertising or
- * publicity relating to the software without the specific, prior written
- * permission of Sam Leffler and Silicon Graphics.
- * 
- * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
- * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
- * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
- * 
- * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
- * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
- * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
- * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
- * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
- * OF THIS SOFTWARE.
- */
-
-#ifndef _TIFFIOP_
-#define        _TIFFIOP_
-/*
- * ``Library-private'' definitions.
- */
-/*
- * UNIX systems should run the configure script to generate
- * a port.h file that reflects the system capabilities.
- * Doing this obviates all the dreck done in tiffcomp.h.
- */
-#if defined(unix) || defined(__unix)
-#include "port.h"
-#include "tiffconf.h"
-#else
-#include "tiffconf.h"
-#include "tiffcomp.h"
-#endif
-#include "tiffio.h"
-#include "tif_dir.h"
-
-#ifndef TRUE
-#define        TRUE    1
-#define        FALSE   0
-#endif
-
-/*
- * Typedefs for ``method pointers'' used internally.
- */
-typedef        unsigned char tidataval_t;      /* internal image data value type */
-typedef        tidataval_t* tidata_t;          /* reference to internal image data */
-
-typedef        void (*TIFFVoidMethod)(TIFF*);
-typedef        int (*TIFFBoolMethod)(TIFF*);
-typedef        int (*TIFFPreMethod)(TIFF*, tsample_t);
-typedef        int (*TIFFCodeMethod)(TIFF*, tidata_t, tsize_t, tsample_t);
-typedef        int (*TIFFSeekMethod)(TIFF*, uint32);
-typedef        void (*TIFFPostMethod)(TIFF*, tidata_t, tsize_t);
-typedef        int (*TIFFVSetMethod)(TIFF*, ttag_t, va_list);
-typedef        int (*TIFFVGetMethod)(TIFF*, ttag_t, va_list);
-typedef        void (*TIFFPrintMethod)(TIFF*, FILE*, long);
-typedef        uint32 (*TIFFStripMethod)(TIFF*, uint32);
-typedef        void (*TIFFTileMethod)(TIFF*, uint32*, uint32*);
-
-struct tiff {
-       char*           tif_name;       /* name of open file */
-       int             tif_fd;         /* open file descriptor */
-       int             tif_mode;       /* open mode (O_*) */
-       uint32          tif_flags;
-#define        TIFF_FILLORDER          0x0003  /* natural bit fill order for machine */
-#define        TIFF_DIRTYHEADER        0x0004  /* header must be written on close */
-#define        TIFF_DIRTYDIRECT        0x0008  /* current directory must be written */
-#define        TIFF_BUFFERSETUP        0x0010  /* data buffers setup */
-#define        TIFF_CODERSETUP         0x0020  /* encoder/decoder setup done */
-#define        TIFF_BEENWRITING        0x0040  /* written 1+ scanlines to file */
-#define        TIFF_SWAB               0x0080  /* byte swap file information */
-#define        TIFF_NOBITREV           0x0100  /* inhibit bit reversal logic */
-#define        TIFF_MYBUFFER           0x0200  /* my raw data buffer; free on close */
-#define        TIFF_ISTILED            0x0400  /* file is tile, not strip- based */
-#define        TIFF_MAPPED             0x0800  /* file is mapped into memory */
-#define        TIFF_POSTENCODE         0x1000  /* need call to postencode routine */
-#define        TIFF_INSUBIFD           0x2000  /* currently writing a subifd */
-#define        TIFF_UPSAMPLED          0x4000  /* library is doing data up-sampling */ 
-#define        TIFF_STRIPCHOP          0x8000  /* enable strip chopping support */
-       toff_t          tif_diroff;     /* file offset of current directory */
-       toff_t          tif_nextdiroff; /* file offset of following directory */
-       TIFFDirectory   tif_dir;        /* internal rep of current directory */
-       TIFFHeader      tif_header;     /* file's header block */
-        tidata_t        tif_clientdir;  /* client TIFF directory */
-       const int*      tif_typeshift;  /* data type shift counts */
-       const long*     tif_typemask;   /* data type masks */
-       uint32          tif_row;        /* current scanline */
-       tdir_t          tif_curdir;     /* current directory (index) */
-       tstrip_t        tif_curstrip;   /* current strip for read/write */
-       toff_t          tif_curoff;     /* current offset for read/write */
-       toff_t          tif_dataoff;    /* current offset for writing dir */
-#if SUBIFD_SUPPORT
-       uint16          tif_nsubifd;    /* remaining subifds to write */
-       toff_t          tif_subifdoff;  /* offset for patching SubIFD link */
-#endif
-/* tiling support */
-       uint32          tif_col;        /* current column (offset by row too) */
-       ttile_t         tif_curtile;    /* current tile for read/write */
-       tsize_t         tif_tilesize;   /* # of bytes in a tile */
-/* compression scheme hooks */
-       TIFFBoolMethod  tif_setupdecode;/* called once before predecode */
-       TIFFPreMethod   tif_predecode;  /* pre- row/strip/tile decoding */
-       TIFFBoolMethod  tif_setupencode;/* called once before preencode */
-       TIFFPreMethod   tif_preencode;  /* pre- row/strip/tile encoding */
-       TIFFBoolMethod  tif_postencode; /* post- row/strip/tile encoding */
-       TIFFCodeMethod  tif_decoderow;  /* scanline decoding routine */
-       TIFFCodeMethod  tif_encoderow;  /* scanline encoding routine */
-       TIFFCodeMethod  tif_decodestrip;/* strip decoding routine */
-       TIFFCodeMethod  tif_encodestrip;/* strip encoding routine */
-       TIFFCodeMethod  tif_decodetile; /* tile decoding routine */
-       TIFFCodeMethod  tif_encodetile; /* tile encoding routine */
-       TIFFVoidMethod  tif_close;      /* cleanup-on-close routine */
-       TIFFSeekMethod  tif_seek;       /* position within a strip routine */
-       TIFFVoidMethod  tif_cleanup;    /* cleanup state routine */
-       TIFFStripMethod tif_defstripsize;/* calculate/constrain strip size */
-       TIFFTileMethod  tif_deftilesize;/* calculate/constrain tile size */
-       tidata_t        tif_data;       /* compression scheme private data */
-/* input/output buffering */
-       tsize_t         tif_scanlinesize;/* # of bytes in a scanline */
-       tsize_t         tif_scanlineskew;/* scanline skew for reading strips */
-       tidata_t        tif_rawdata;    /* raw data buffer */
-       tsize_t         tif_rawdatasize;/* # of bytes in raw data buffer */
-       tidata_t        tif_rawcp;      /* current spot in raw buffer */
-       tsize_t         tif_rawcc;      /* bytes unread from raw buffer */
-/* memory-mapped file support */
-       tidata_t        tif_base;       /* base of mapped file */
-#ifdef __WIN32__
-       void*           pv_map_handle;  /* WIN32 file mapping handle;
-                                        * must be contiguous with tif_base
-                                        * since map & unmap only get tif_base
-                                        * and assume 4 byte offset to
-                                        * pv_map_handle. */
-#endif
-       toff_t          tif_size;       /* size of mapped file region (bytes) */
-       TIFFMapFileProc tif_mapproc;    /* map file method */
-       TIFFUnmapFileProc tif_unmapproc;/* unmap file method */
-/* input/output callback methods */
-       thandle_t       tif_clientdata; /* callback parameter */
-       TIFFReadWriteProc tif_readproc; /* read method */
-       TIFFReadWriteProc tif_writeproc;/* write method */
-       TIFFSeekProc    tif_seekproc;   /* lseek method */
-       TIFFCloseProc   tif_closeproc;  /* close method */
-       TIFFSizeProc    tif_sizeproc;   /* filesize method */
-/* post-decoding support */
-       TIFFPostMethod  tif_postdecode; /* post decoding routine */
-/* tag support */
-       TIFFFieldInfo** tif_fieldinfo;  /* sorted table of registered tags */
-       int             tif_nfields;    /* # entries in registered tag table */
-       TIFFVSetMethod  tif_vsetfield;  /* tag set routine */
-       TIFFVGetMethod  tif_vgetfield;  /* tag get routine */
-       TIFFPrintMethod tif_printdir;   /* directory print routine */
-};
-
-#define        isPseudoTag(t)  (t > 0xffff)    /* is tag value normal or pseudo */
-
-#define        isTiled(tif)    (((tif)->tif_flags & TIFF_ISTILED) != 0)
-#define        isMapped(tif)   (((tif)->tif_flags & TIFF_MAPPED) != 0)
-#define        isFillOrder(tif, o)     (((tif)->tif_flags & (o)) != 0)
-#define        isUpSampled(tif)        (((tif)->tif_flags & TIFF_UPSAMPLED) != 0)
-#define        TIFFReadFile(tif, buf, size) \
-       ((*(tif)->tif_readproc)((tif)->tif_clientdata,buf,size))
-#define        TIFFWriteFile(tif, buf, size) \
-       ((*(tif)->tif_writeproc)((tif)->tif_clientdata,buf,size))
-#define        TIFFSeekFile(tif, off, whence) \
-       ((*(tif)->tif_seekproc)((tif)->tif_clientdata,(toff_t)(off),whence))
-#define        TIFFCloseFile(tif) \
-       ((*(tif)->tif_closeproc)((tif)->tif_clientdata))
-#define        TIFFGetFileSize(tif) \
-       ((*(tif)->tif_sizeproc)((tif)->tif_clientdata))
-#define        TIFFMapFileContents(tif, paddr, psize) \
-       ((*(tif)->tif_mapproc)((tif)->tif_clientdata,paddr,psize))
-#ifdef __WIN32__
-#define        TIFFUnmapFileContents(tif, addr, dummy) \
-       ((*(tif)->tif_unmapproc)((tif)->tif_clientdata,addr,\
-           (toff_t)(tif)->pv_map_handle))
-#else
-#define        TIFFUnmapFileContents(tif, addr, size) \
-       ((*(tif)->tif_unmapproc)((tif)->tif_clientdata,addr,size))
-#endif
-
-/*
- * Default Read/Seek/Write definitions.
- */
-#ifndef ReadOK
-#define        ReadOK(tif, buf, size) \
-       (TIFFReadFile(tif, (tdata_t) buf, (tsize_t) size) == (tsize_t) size)
-#endif
-#ifndef SeekOK
-#define        SeekOK(tif, off) \
-       (TIFFSeekFile(tif, (toff_t) off, SEEK_SET) == (toff_t) off)
-#endif
-#ifndef WriteOK
-#define        WriteOK(tif, buf, size) \
-       (TIFFWriteFile(tif, (tdata_t) buf, (tsize_t) size) == (tsize_t) size)
-#endif
-
-/* NB: the uint32 casts are to silence certain ANSI-C compilers */
-#define        TIFFhowmany(x, y) ((((uint32)(x))+(((uint32)(y))-1))/((uint32)(y)))
-#define        TIFFroundup(x, y) (TIFFhowmany(x,y)*((uint32)(y)))
-
-#if defined(__cplusplus)
-extern "C" {
-#endif
-extern int _TIFFgetMode(const char*, const char*);
-extern int _TIFFNoRowEncode(TIFF*, tidata_t, tsize_t, tsample_t);
-extern int _TIFFNoStripEncode(TIFF*, tidata_t, tsize_t, tsample_t);
-extern int _TIFFNoTileEncode(TIFF*, tidata_t, tsize_t, tsample_t);
-extern int _TIFFNoRowDecode(TIFF*, tidata_t, tsize_t, tsample_t);
-extern int _TIFFNoStripDecode(TIFF*, tidata_t, tsize_t, tsample_t);
-extern int _TIFFNoTileDecode(TIFF*, tidata_t, tsize_t, tsample_t);
-extern void _TIFFNoPostDecode(TIFF*, tidata_t, tsize_t);
-extern int _TIFFNoSeek(TIFF*, uint32);
-extern void _TIFFSwab16BitData(TIFF*, tidata_t, tsize_t);
-extern void _TIFFSwab32BitData(TIFF*, tidata_t, tsize_t);
-extern void _TIFFSwab64BitData(TIFF*, tidata_t, tsize_t);
-extern int TIFFFlushData1(TIFF*);
-extern void TIFFFreeDirectory(TIFF*);
-extern int TIFFDefaultDirectory(TIFF*);
-extern int TIFFSetCompressionScheme(TIFF*, int);
-extern uint32 _TIFFDefaultStripSize(TIFF*, uint32);
-extern void _TIFFDefaultTileSize(TIFF*, uint32*, uint32*);
-
-extern void _TIFFsetByteArray(void**, void*, long);
-extern void _TIFFsetString(char**, char*);
-extern void _TIFFsetShortArray(uint16**, uint16*, long);
-extern void _TIFFsetLongArray(uint32**, uint32*, long);
-extern void _TIFFsetFloatArray(float**, float*, long);
-extern void _TIFFsetDoubleArray(double**, double*, long);
-
-extern void _TIFFprintAscii(FILE*, const char*);
-extern void _TIFFprintAsciiTag(FILE*, const char*, const char*);
-
-GLOBALDATA(TIFFErrorHandler,_TIFFwarningHandler);
-GLOBALDATA(TIFFErrorHandler,_TIFFerrorHandler);
-
-extern int TIFFInitDumpMode(TIFF*, int);
-#ifdef PACKBITS_SUPPORT
-extern int TIFFInitPackBits(TIFF*, int);
-#endif
-#ifdef CCITT_SUPPORT
-extern int TIFFInitCCITTRLE(TIFF*, int), TIFFInitCCITTRLEW(TIFF*, int);
-extern int TIFFInitCCITTFax3(TIFF*, int), TIFFInitCCITTFax4(TIFF*, int);
-#endif
-#ifdef THUNDER_SUPPORT
-extern int TIFFInitThunderScan(TIFF*, int);
-#endif
-#ifdef NEXT_SUPPORT
-extern int TIFFInitNeXT(TIFF*, int);
-#endif
-#ifdef LZW_SUPPORT
-extern int TIFFInitLZW(TIFF*, int);
-#endif
-#ifdef OJPEG_SUPPORT
-extern int TIFFInitOJPEG(TIFF*, int);
-#endif
-#ifdef JPEG_SUPPORT
-extern int TIFFInitJPEG(TIFF*, int);
-#endif
-#ifdef JBIG_SUPPORT
-extern int TIFFInitJBIG(TIFF*, int);
-#endif
-#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
-extern TIFFCodec _TIFFBuiltinCODECS[];
-#endif
-
-#if defined(__cplusplus)
-}
-#endif
-#endif /* _TIFFIOP_ */
diff --git a/libs/libtiff/Version.h b/libs/libtiff/Version.h
deleted file mode 100644 (file)
index 11b9435..0000000
+++ /dev/null
@@ -1 +0,0 @@
-#define VERSION "LIBTIFF, Version 3.4beta024\nCopyright (c) 1988-1995 Sam Leffler\nCopyright (c) 1991-1995 Silicon Graphics, Inc."\r
index 224b1e8d250857da3770d8cb59973660a69dd94a..6bc8d5297186f852939ad8c0d0f58fc6d5577347 100644 (file)
Binary files a/libs/libtiff/libtiff.lib and b/libs/libtiff/libtiff.lib differ
index d6e146e71e055bfd809e902199c873855b211c0a..6330795b6f1eb816dcd8806ce1a4b65b159c0df8 100644 (file)
@@ -1,8 +1,8 @@
-/* $Header: /usr/people/sam/tiff/libtiff/RCS/tiff.h,v 1.71 1996/04/29 22:16:05 sam Rel $ */
+/* $Id: tiff.h,v 1.42 2005/12/23 15:10:45 dron Exp $ */
 
 /*
- * Copyright (c) 1988-1996 Sam Leffler
- * Copyright (c) 1991-1996 Silicon Graphics, Inc.
+ * Copyright (c) 1988-1997 Sam Leffler
+ * Copyright (c) 1991-1997 Silicon Graphics, Inc.
  *
  * Permission to use, copy, modify, distribute, and sell this software and 
  * its documentation for any purpose is hereby granted without fee, provided
@@ -26,6 +26,9 @@
 
 #ifndef _TIFF_
 #define        _TIFF_
+
+#include "tiffconf.h"
+
 /*
  * Tag Image File Format (TIFF)
  *
  *    Suite 200
  *    Seattle, WA  98104
  *    206-622-5500
+ *    
+ *    (http://partners.adobe.com/asn/developer/PDFS/TN/TIFF6.pdf)
+ *
+ * For Big TIFF design notes see the following link
+ *    http://gdal.maptools.org/twiki/bin/view/libtiff/BigTIFFDesign
  */
-#define        TIFF_VERSION    42
+#define        TIFF_VERSION            42
+#define TIFF_BIGTIFF_VERSION    43
 
 #define        TIFF_BIGENDIAN          0x4d4d
 #define        TIFF_LITTLEENDIAN       0x4949
-
-#ifndef _TIFF_DATA_TYPEDEFS_
-#define _TIFF_DATA_TYPEDEFS_
+#define        MDI_LITTLEENDIAN        0x5045
+#define        MDI_BIGENDIAN           0x4550
 /*
  * Intrinsic data types required by the file format:
  *
  * 32-bit quantities   int32/uint32
  * strings             unsigned char*
  */
-#ifdef __STDC__
+
+#ifndef HAVE_INT8
 typedef        signed char int8;       /* NB: non-ANSI compilers may not grok */
-#else
-typedef        char int8;
 #endif
 typedef        unsigned char uint8;
+#ifndef HAVE_INT16
 typedef        short int16;
+#endif
 typedef        unsigned short uint16;  /* sizeof (uint16) must == 2 */
-#if defined(__alpha) || (defined(_MIPS_SZLONG) && _MIPS_SZLONG == 64)
+#if SIZEOF_INT == 4
+#ifndef HAVE_INT32
 typedef        int int32;
+#endif
 typedef        unsigned int uint32;    /* sizeof (uint32) must == 4 */
-#else
+#elif SIZEOF_LONG == 4
+#ifndef HAVE_INT32
 typedef        long int32;
+#endif
 typedef        unsigned long uint32;   /* sizeof (uint32) must == 4 */
 #endif
-#endif /* _TIFF_DATA_TYPEDEFS_ */
 
+/* For TIFFReassignTagToIgnore */
+enum TIFFIgnoreSense /* IGNORE tag table */
+{
+       TIS_STORE,
+       TIS_EXTRACT,
+       TIS_EMPTY
+};
+
+/*
+ * TIFF header.
+ */
 typedef        struct {
        uint16  tiff_magic;     /* magic number (defines byte order) */
+#define TIFF_MAGIC_SIZE                2
        uint16  tiff_version;   /* TIFF version number */
+#define TIFF_VERSION_SIZE      2
        uint32  tiff_diroff;    /* byte offset to first directory */
+#define TIFF_DIROFFSET_SIZE    4
 } TIFFHeader;
 
+
 /*
- * TIFF Image File Directories are comprised of
- * a table of field descriptors of the form shown
- * below.  The table is sorted in ascending order
- * by tag.  The values associated with each entry
- * are disjoint and may appear anywhere in the file
- * (so long as they are placed on a word boundary).
+ * TIFF Image File Directories are comprised of a table of field
+ * descriptors of the form shown below.  The table is sorted in
+ * ascending order by tag.  The values associated with each entry are
+ * disjoint and may appear anywhere in the file (so long as they are
+ * placed on a word boundary).
  *
- * If the value is 4 bytes or less, then it is placed
- * in the offset field to save space.  If the value
- * is less than 4 bytes, it is left-justified in the
- * offset field.
+ * If the value is 4 bytes or less, then it is placed in the offset
+ * field to save space.  If the value is less than 4 bytes, it is
+ * left-justified in the offset field.
  */
 typedef        struct {
-       uint16  tdir_tag;       /* see below */
-       uint16  tdir_type;      /* data type; see below */
-       uint32  tdir_count;     /* number of items; length in spec */
-       uint32  tdir_offset;    /* byte offset to field data */
+       uint16          tdir_tag;       /* see below */
+       uint16          tdir_type;      /* data type; see below */
+       uint32          tdir_count;     /* number of items; length in spec */
+       uint32          tdir_offset;    /* byte offset to field data */
 } TIFFDirEntry;
 
 /*
@@ -101,6 +126,7 @@ typedef     struct {
  *  - items marked with a ! are introduced in revision 6.0.
  *  - items marked with a % are introduced post revision 6.0.
  *  - items marked with a $ are obsoleted by revision 6.0.
+ *  - items marked with a & are introduced by Adobe DNG specification.
  */
 
 /*
@@ -121,7 +147,8 @@ typedef     enum {
        TIFF_SLONG      = 9,    /* !32-bit signed integer */
        TIFF_SRATIONAL  = 10,   /* !64-bit signed fraction */
        TIFF_FLOAT      = 11,   /* !32-bit IEEE floating point */
-       TIFF_DOUBLE     = 12    /* !64-bit IEEE floating point */
+       TIFF_DOUBLE     = 12,   /* !64-bit IEEE floating point */
+       TIFF_IFD        = 13    /* %32-bit unsigned integer (offset) */
 } TIFFDataType;
 
 /*
@@ -142,21 +169,33 @@ typedef   enum {
 #define            COMPRESSION_NONE            1       /* dump mode */
 #define            COMPRESSION_CCITTRLE        2       /* CCITT modified Huffman RLE */
 #define            COMPRESSION_CCITTFAX3       3       /* CCITT Group 3 fax encoding */
+#define     COMPRESSION_CCITT_T4        3       /* CCITT T.4 (TIFF 6 name) */
 #define            COMPRESSION_CCITTFAX4       4       /* CCITT Group 4 fax encoding */
-#define            COMPRESSION_LZW             5       /* Lempel-Ziv  & Welch */
+#define     COMPRESSION_CCITT_T6        4       /* CCITT T.6 (TIFF 6 name) */
+#define            COMPRESSION_LZW             5       /* Lempel-Ziv  & Welch */
 #define            COMPRESSION_OJPEG           6       /* !6.0 JPEG */
 #define            COMPRESSION_JPEG            7       /* %JPEG DCT compression */
 #define            COMPRESSION_NEXT            32766   /* NeXT 2-bit RLE */
 #define            COMPRESSION_CCITTRLEW       32771   /* #1 w/ word alignment */
 #define            COMPRESSION_PACKBITS        32773   /* Macintosh RLE */
 #define            COMPRESSION_THUNDERSCAN     32809   /* ThunderScan RLE */
+/* codes 32895-32898 are reserved for ANSI IT8 TIFF/IT <dkelly@apago.com) */
+#define            COMPRESSION_IT8CTPAD        32895   /* IT8 CT w/padding */
+#define            COMPRESSION_IT8LW           32896   /* IT8 Linework RLE */
+#define            COMPRESSION_IT8MP           32897   /* IT8 Monochrome picture */
+#define            COMPRESSION_IT8BL           32898   /* IT8 Binary line art */
 /* compression codes 32908-32911 are reserved for Pixar */
 #define     COMPRESSION_PIXARFILM      32908   /* Pixar companded 10bit LZW */
 #define            COMPRESSION_PIXARLOG        32909   /* Pixar companded 11bit ZIP */
 #define            COMPRESSION_DEFLATE         32946   /* Deflate compression */
+#define     COMPRESSION_ADOBE_DEFLATE   8       /* Deflate compression,
+                                                  as recognized by Adobe */
 /* compression code 32947 is reserved for Oceana Matrix <dev@oceana.com> */
 #define     COMPRESSION_DCS             32947   /* Kodak DCS encoding */
 #define            COMPRESSION_JBIG            34661   /* ISO JBIG */
+#define     COMPRESSION_SGILOG         34676   /* SGI Log Luminance RLE */
+#define     COMPRESSION_SGILOG24       34677   /* SGI Log 24-bit packed */
+#define     COMPRESSION_JP2000          34712   /* Leadtools JPEG2000 */
 #define        TIFFTAG_PHOTOMETRIC             262     /* photometric interpretation */
 #define            PHOTOMETRIC_MINISWHITE      0       /* min value is white */
 #define            PHOTOMETRIC_MINISBLACK      1       /* min value is black */
@@ -166,6 +205,10 @@ typedef    enum {
 #define            PHOTOMETRIC_SEPARATED       5       /* !color separations */
 #define            PHOTOMETRIC_YCBCR           6       /* !CCIR 601 */
 #define            PHOTOMETRIC_CIELAB          8       /* !1976 CIE L*a*b* */
+#define            PHOTOMETRIC_ICCLAB          9       /* ICC L*a*b* [Adobe TIFF Technote 4] */
+#define            PHOTOMETRIC_ITULAB          10      /* ITU L*a*b* */
+#define     PHOTOMETRIC_LOGL           32844   /* CIE Log2(L) */
+#define     PHOTOMETRIC_LOGLUV         32845   /* CIE Log2(L) (u',v') */
 #define        TIFFTAG_THRESHHOLDING           263     /* +thresholding used on data */
 #define            THRESHHOLD_BILEVEL          1       /* b&w art scan */
 #define            THRESHHOLD_HALFTONE         2       /* or dithered scan */
@@ -212,10 +255,12 @@ typedef   enum {
 #define            GRAYRESPONSEUNIT_100000S    5       /* hundred-thousandths */
 #define        TIFFTAG_GRAYRESPONSECURVE       291     /* $gray scale response curve */
 #define        TIFFTAG_GROUP3OPTIONS           292     /* 32 flag bits */
+#define        TIFFTAG_T4OPTIONS               292     /* TIFF 6.0 proper name alias */
 #define            GROUP3OPT_2DENCODING        0x1     /* 2-dimensional coding */
 #define            GROUP3OPT_UNCOMPRESSED      0x2     /* data not compressed */
 #define            GROUP3OPT_FILLBITS          0x4     /* fill to byte boundary */
 #define        TIFFTAG_GROUP4OPTIONS           293     /* 32 flag bits */
+#define TIFFTAG_T6OPTIONS               293     /* TIFF 6.0 proper name */
 #define            GROUP4OPT_UNCOMPRESSED      0x2     /* data not compressed */
 #define        TIFFTAG_RESOLUTIONUNIT          296     /* units of resolutions */
 #define            RESUNIT_NONE                1       /* no meaningful units */
@@ -234,12 +279,15 @@ typedef   enum {
 #define        TIFFTAG_ARTIST                  315     /* creator of image */
 #define        TIFFTAG_HOSTCOMPUTER            316     /* machine where created */
 #define        TIFFTAG_PREDICTOR               317     /* prediction scheme w/ LZW */
+#define     PREDICTOR_NONE             1       /* no prediction scheme used */
+#define     PREDICTOR_HORIZONTAL       2       /* horizontal differencing */
+#define     PREDICTOR_FLOATINGPOINT    3       /* floating point predictor */
 #define        TIFFTAG_WHITEPOINT              318     /* image white point */
 #define        TIFFTAG_PRIMARYCHROMATICITIES   319     /* !primary chromaticities */
 #define        TIFFTAG_COLORMAP                320     /* RGB map for pallette image */
 #define        TIFFTAG_HALFTONEHINTS           321     /* !highlight+shadow info */
-#define        TIFFTAG_TILEWIDTH               322     /* !rows/data tile */
-#define        TIFFTAG_TILELENGTH              323     /* !cols/data tile */
+#define        TIFFTAG_TILEWIDTH               322     /* !tile width in pixels */
+#define        TIFFTAG_TILELENGTH              323     /* !tile height in pixels */
 #define TIFFTAG_TILEOFFSETS            324     /* !offsets to data tiles */
 #define TIFFTAG_TILEBYTECOUNTS         325     /* !byte counts for tiles */
 #define        TIFFTAG_BADFAXLINES             326     /* lines w/ wrong pixel count */
@@ -250,8 +298,10 @@ typedef    enum {
 #define        TIFFTAG_CONSECUTIVEBADFAXLINES  328     /* max consecutive bad lines */
 #define        TIFFTAG_SUBIFD                  330     /* subimage descriptors */
 #define        TIFFTAG_INKSET                  332     /* !inks in separated image */
-#define            INKSET_CMYK                 1       /* !cyan-magenta-yellow-black */
+#define            INKSET_CMYK                 1       /* !cyan-magenta-yellow-black color */
+#define            INKSET_MULTIINK             2       /* !multi-ink or hi-fi color */
 #define        TIFFTAG_INKNAMES                333     /* !ascii names of inks */
+#define        TIFFTAG_NUMBEROFINKS            334     /* !number of inks */
 #define        TIFFTAG_DOTRANGE                336     /* !0% and 100% dot codes */
 #define        TIFFTAG_TARGETPRINTER           337     /* !separation target */
 #define        TIFFTAG_EXTRASAMPLES            338     /* !info about extra samples */
@@ -263,12 +313,23 @@ typedef   enum {
 #define            SAMPLEFORMAT_INT            2       /* !signed integer data */
 #define            SAMPLEFORMAT_IEEEFP         3       /* !IEEE floating point data */
 #define            SAMPLEFORMAT_VOID           4       /* !untyped data */
+#define            SAMPLEFORMAT_COMPLEXINT     5       /* !complex signed int */
+#define            SAMPLEFORMAT_COMPLEXIEEEFP  6       /* !complex ieee floating */
 #define        TIFFTAG_SMINSAMPLEVALUE         340     /* !variable MinSampleValue */
 #define        TIFFTAG_SMAXSAMPLEVALUE         341     /* !variable MaxSampleValue */
+#define        TIFFTAG_CLIPPATH                343     /* %ClipPath
+                                                  [Adobe TIFF technote 2] */
+#define        TIFFTAG_XCLIPPATHUNITS          344     /* %XClipPathUnits
+                                                  [Adobe TIFF technote 2] */
+#define        TIFFTAG_YCLIPPATHUNITS          345     /* %YClipPathUnits
+                                                  [Adobe TIFF technote 2] */
+#define        TIFFTAG_INDEXED                 346     /* %Indexed
+                                                  [Adobe TIFF Technote 3] */
 #define        TIFFTAG_JPEGTABLES              347     /* %JPEG table stream */
+#define        TIFFTAG_OPIPROXY                351     /* %OPI Proxy [Adobe TIFF technote] */
 /*
- * Tags 512-521 are obsoleted by Technical Note #2
- * which specifies a revised JPEG-in-TIFF scheme.
+ * Tags 512-521 are obsoleted by Technical Note #2 which specifies a
+ * revised JPEG-in-TIFF scheme.
  */
 #define        TIFFTAG_JPEGPROC                512     /* !JPEG processing algorithm */
 #define            JPEGPROC_BASELINE           1       /* !baseline sequential */
@@ -287,6 +348,11 @@ typedef    enum {
 #define            YCBCRPOSITION_CENTERED      1       /* !as in PostScript Level 2 */
 #define            YCBCRPOSITION_COSITED       2       /* !as in CCIR 601-1 */
 #define        TIFFTAG_REFERENCEBLACKWHITE     532     /* !colorimetry info */
+#define        TIFFTAG_XMLPACKET               700     /* %XML packet
+                                                  [Adobe XMP Specification,
+                                                  January 2004 */
+#define TIFFTAG_OPIIMAGEID             32781   /* %OPI ImageID
+                                                  [Adobe TIFF technote] */
 /* tags 32952-32956 are private tags registered to Island Graphics */
 #define TIFFTAG_REFPTS                 32953   /* image reference points */
 #define TIFFTAG_REGIONTACKPOINT                32954   /* region-xform tack point */
@@ -307,31 +373,154 @@ typedef  enum {
  */
 #define TIFFTAG_PIXAR_IMAGEFULLWIDTH    33300   /* full image size in x */
 #define TIFFTAG_PIXAR_IMAGEFULLLENGTH   33301   /* full image size in y */
+ /* Tags 33302-33306 are used to identify special image modes and data
+  * used by Pixar's texture formats.
+  */
+#define TIFFTAG_PIXAR_TEXTUREFORMAT    33302   /* texture map format */
+#define TIFFTAG_PIXAR_WRAPMODES                33303   /* s & t wrap modes */
+#define TIFFTAG_PIXAR_FOVCOT           33304   /* cotan(fov) for env. maps */
+#define TIFFTAG_PIXAR_MATRIX_WORLDTOSCREEN 33305
+#define TIFFTAG_PIXAR_MATRIX_WORLDTOCAMERA 33306
 /* tag 33405 is a private tag registered to Eastman Kodak */
 #define TIFFTAG_WRITERSERIALNUMBER      33405   /* device serial number */
 /* tag 33432 is listed in the 6.0 spec w/ unknown ownership */
 #define        TIFFTAG_COPYRIGHT               33432   /* copyright string */
+/* IPTC TAG from RichTIFF specifications */
+#define TIFFTAG_RICHTIFFIPTC           33723
+/* 34016-34029 are reserved for ANSI IT8 TIFF/IT <dkelly@apago.com) */
+#define TIFFTAG_IT8SITE                        34016   /* site name */
+#define TIFFTAG_IT8COLORSEQUENCE       34017   /* color seq. [RGB,CMYK,etc] */
+#define TIFFTAG_IT8HEADER              34018   /* DDES Header */
+#define TIFFTAG_IT8RASTERPADDING       34019   /* raster scanline padding */
+#define TIFFTAG_IT8BITSPERRUNLENGTH    34020   /* # of bits in short run */
+#define TIFFTAG_IT8BITSPEREXTENDEDRUNLENGTH 34021/* # of bits in long run */
+#define TIFFTAG_IT8COLORTABLE          34022   /* LW colortable */
+#define TIFFTAG_IT8IMAGECOLORINDICATOR 34023   /* BP/BL image color switch */
+#define TIFFTAG_IT8BKGCOLORINDICATOR   34024   /* BP/BL bg color switch */
+#define TIFFTAG_IT8IMAGECOLORVALUE     34025   /* BP/BL image color value */
+#define TIFFTAG_IT8BKGCOLORVALUE       34026   /* BP/BL bg color value */
+#define TIFFTAG_IT8PIXELINTENSITYRANGE 34027   /* MP pixel intensity value */
+#define TIFFTAG_IT8TRANSPARENCYINDICATOR 34028 /* HC transparency switch */
+#define TIFFTAG_IT8COLORCHARACTERIZATION 34029 /* color character. table */
+#define TIFFTAG_IT8HCUSAGE             34030   /* HC usage indicator */
+#define TIFFTAG_IT8TRAPINDICATOR       34031   /* Trapping indicator
+                                                  (untrapped=0, trapped=1) */
+#define TIFFTAG_IT8CMYKEQUIVALENT      34032   /* CMYK color equivalents */
 /* tags 34232-34236 are private tags registered to Texas Instruments */
 #define TIFFTAG_FRAMECOUNT              34232   /* Sequence Frame Count */
+/* tag 34377 is private tag registered to Adobe for PhotoShop */
+#define TIFFTAG_PHOTOSHOP              34377 
+/* tags 34665, 34853 and 40965 are documented in EXIF specification */
+#define TIFFTAG_EXIFIFD                        34665   /* Pointer to EXIF private directory */
+/* tag 34750 is a private tag registered to Adobe? */
+#define TIFFTAG_ICCPROFILE             34675   /* ICC profile data */
 /* tag 34750 is a private tag registered to Pixel Magic */
 #define        TIFFTAG_JBIGOPTIONS             34750   /* JBIG options */
+#define TIFFTAG_GPSIFD                 34853   /* Pointer to GPS private directory */
 /* tags 34908-34914 are private tags registered to SGI */
 #define        TIFFTAG_FAXRECVPARAMS           34908   /* encoded Class 2 ses. parms */
 #define        TIFFTAG_FAXSUBADDRESS           34909   /* received SubAddr string */
 #define        TIFFTAG_FAXRECVTIME             34910   /* receive time (secs) */
+#define        TIFFTAG_FAXDCS                  34911   /* encoded fax ses. params, Table 2/T.30 */
+/* tags 37439-37443 are registered to SGI <gregl@sgi.com> */
+#define TIFFTAG_STONITS                        37439   /* Sample value to Nits */
+/* tag 34929 is a private tag registered to FedEx */
+#define        TIFFTAG_FEDEX_EDR               34929   /* unknown use */
+#define TIFFTAG_INTEROPERABILITYIFD    40965   /* Pointer to Interoperability private directory */
+/* Adobe Digital Negative (DNG) format tags */
+#define TIFFTAG_DNGVERSION             50706   /* &DNG version number */
+#define TIFFTAG_DNGBACKWARDVERSION     50707   /* &DNG compatibility version */
+#define TIFFTAG_UNIQUECAMERAMODEL      50708   /* &name for the camera model */
+#define TIFFTAG_LOCALIZEDCAMERAMODEL   50709   /* &localized camera model
+                                                  name */
+#define TIFFTAG_CFAPLANECOLOR          50710   /* &CFAPattern->LinearRaw space
+                                                  mapping */
+#define TIFFTAG_CFALAYOUT              50711   /* &spatial layout of the CFA */
+#define TIFFTAG_LINEARIZATIONTABLE     50712   /* &lookup table description */
+#define TIFFTAG_BLACKLEVELREPEATDIM    50713   /* &repeat pattern size for
+                                                  the BlackLevel tag */
+#define TIFFTAG_BLACKLEVEL             50714   /* &zero light encoding level */
+#define TIFFTAG_BLACKLEVELDELTAH       50715   /* &zero light encoding level
+                                                  differences (columns) */
+#define TIFFTAG_BLACKLEVELDELTAV       50716   /* &zero light encoding level
+                                                  differences (rows) */
+#define TIFFTAG_WHITELEVEL             50717   /* &fully saturated encoding
+                                                  level */
+#define TIFFTAG_DEFAULTSCALE           50718   /* &default scale factors */
+#define TIFFTAG_DEFAULTCROPORIGIN      50719   /* &origin of the final image
+                                                  area */
+#define TIFFTAG_DEFAULTCROPSIZE                50720   /* &size of the final image 
+                                                  area */
+#define TIFFTAG_COLORMATRIX1           50721   /* &XYZ->reference color space
+                                                  transformation matrix 1 */
+#define TIFFTAG_COLORMATRIX2           50722   /* &XYZ->reference color space
+                                                  transformation matrix 2 */
+#define TIFFTAG_CAMERACALIBRATION1     50723   /* &calibration matrix 1 */
+#define TIFFTAG_CAMERACALIBRATION2     50724   /* &calibration matrix 2 */
+#define TIFFTAG_REDUCTIONMATRIX1       50725   /* &dimensionality reduction
+                                                  matrix 1 */
+#define TIFFTAG_REDUCTIONMATRIX2       50726   /* &dimensionality reduction
+                                                  matrix 2 */
+#define TIFFTAG_ANALOGBALANCE          50727   /* &gain applied the stored raw
+                                                  values*/
+#define TIFFTAG_ASSHOTNEUTRAL          50728   /* &selected white balance in
+                                                  linear reference space */
+#define TIFFTAG_ASSHOTWHITEXY          50729   /* &selected white balance in
+                                                  x-y chromaticity
+                                                  coordinates */
+#define TIFFTAG_BASELINEEXPOSURE       50730   /* &how much to move the zero
+                                                  point */
+#define TIFFTAG_BASELINENOISE          50731   /* &relative noise level */
+#define TIFFTAG_BASELINESHARPNESS      50732   /* &relative amount of
+                                                  sharpening */
+#define TIFFTAG_BAYERGREENSPLIT                50733   /* &how closely the values of
+                                                  the green pixels in the
+                                                  blue/green rows track the
+                                                  values of the green pixels
+                                                  in the red/green rows */
+#define TIFFTAG_LINEARRESPONSELIMIT    50734   /* &non-linear encoding range */
+#define TIFFTAG_CAMERASERIALNUMBER     50735   /* &camera's serial number */
+#define TIFFTAG_LENSINFO               50736   /* info about the lens */
+#define TIFFTAG_CHROMABLURRADIUS       50737   /* &chroma blur radius */
+#define TIFFTAG_ANTIALIASSTRENGTH      50738   /* &relative strength of the
+                                                  camera's anti-alias filter */
+#define TIFFTAG_SHADOWSCALE            50739   /* &used by Adobe Camera Raw */
+#define TIFFTAG_DNGPRIVATEDATA         50740   /* &manufacturer's private data */
+#define TIFFTAG_MAKERNOTESAFETY                50741   /* &whether the EXIF MakerNote
+                                                  tag is safe to preserve
+                                                  along with the rest of the
+                                                  EXIF data */
+#define        TIFFTAG_CALIBRATIONILLUMINANT1  50778   /* &illuminant 1 */
+#define TIFFTAG_CALIBRATIONILLUMINANT2 50779   /* &illuminant 2 */
+#define TIFFTAG_BESTQUALITYSCALE       50780   /* &best quality multiplier */
+#define TIFFTAG_RAWDATAUNIQUEID                50781   /* &unique identifier for
+                                                  the raw image data */
+#define TIFFTAG_ORIGINALRAWFILENAME    50827   /* &file name of the original
+                                                  raw file */
+#define TIFFTAG_ORIGINALRAWFILEDATA    50828   /* &contents of the original
+                                                  raw file */
+#define TIFFTAG_ACTIVEAREA             50829   /* &active (non-masked) pixels
+                                                  of the sensor */
+#define TIFFTAG_MASKEDAREAS            50830   /* &list of coordinates
+                                                  of fully masked pixels */
+#define TIFFTAG_ASSHOTICCPROFILE       50831   /* &these two tags used to */
+#define TIFFTAG_ASSHOTPREPROFILEMATRIX 50832   /* map cameras's color space
+                                                  into ICC profile space */
+#define TIFFTAG_CURRENTICCPROFILE      50833   /* & */
+#define TIFFTAG_CURRENTPREPROFILEMATRIX        50834   /* & */
 /* tag 65535 is an undefined tag used by Eastman Kodak */
 #define TIFFTAG_DCSHUESHIFTVALUES       65535   /* hue shift correction data */
 
 /*
- * The following are ``pseudo tags'' that can be
- * used to control codec-specific functionality.
- * These tags are not written to file.  Note that
- * these values start at 0xffff+1 so that they'll
- * never collide with Aldus-assigned tags.
+ * The following are ``pseudo tags'' that can be used to control
+ * codec-specific functionality.  These tags are not written to file.
+ * Note that these values start at 0xffff+1 so that they'll never
+ * collide with Aldus-assigned tags.
  *
- * If you want your private pseudo tags ``registered''
- * (i.e. added to this file), send mail to sam@sgi.com
- * with the appropriate C definitions to add.
+ * If you want your private pseudo tags ``registered'' (i.e. added to
+ * this file), please post a bug report via the tracking system at
+ * http://www.remotesensing.org/libtiff/bugs.html with the appropriate
+ * C definitions to add.
  */
 #define        TIFFTAG_FAXMODE                 65536   /* Group 3/4 format control */
 #define            FAXMODE_CLASSIC     0x0000          /* default, include RTC */
@@ -377,4 +566,82 @@ typedef    enum {
 /* 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 */
+/* 65559 is allocated to Oceana Matrix <dev@oceana.com> */
+#define TIFFTAG_DCSCLIPRECTANGLE       65559   /* area of image to acquire */
+#define TIFFTAG_SGILOGDATAFMT          65560   /* SGILog user data format */
+#define     SGILOGDATAFMT_FLOAT                0       /* IEEE float samples */
+#define     SGILOGDATAFMT_16BIT                1       /* 16-bit samples */
+#define     SGILOGDATAFMT_RAW          2       /* uninterpreted data */
+#define     SGILOGDATAFMT_8BIT         3       /* 8-bit RGB monitor values */
+#define TIFFTAG_SGILOGENCODE           65561 /* SGILog data encoding control*/
+#define     SGILOGENCODE_NODITHER      0     /* do not dither encoded values*/
+#define     SGILOGENCODE_RANDITHER     1     /* randomly dither encd values */
+
+/*
+ * EXIF tags
+ */
+#define EXIFTAG_EXPOSURETIME           33434   /* Exposure time */
+#define EXIFTAG_FNUMBER                        33437   /* F number */
+#define EXIFTAG_EXPOSUREPROGRAM                34850   /* Exposure program */
+#define EXIFTAG_SPECTRALSENSITIVITY    34852   /* Spectral sensitivity */
+#define EXIFTAG_ISOSPEEDRATINGS                34855   /* ISO speed rating */
+#define EXIFTAG_OECF                   34856   /* Optoelectric conversion
+                                                  factor */
+#define EXIFTAG_EXIFVERSION            36864   /* Exif version */
+#define EXIFTAG_DATETIMEORIGINAL       36867   /* Date and time of original
+                                                  data generation */
+#define EXIFTAG_DATETIMEDIGITIZED      36868   /* Date and time of digital
+                                                  data generation */
+#define EXIFTAG_COMPONENTSCONFIGURATION        37121   /* Meaning of each component */
+#define EXIFTAG_COMPRESSEDBITSPERPIXEL 37122   /* Image compression mode */
+#define EXIFTAG_SHUTTERSPEEDVALUE      37377   /* Shutter speed */
+#define EXIFTAG_APERTUREVALUE          37378   /* Aperture */
+#define EXIFTAG_BRIGHTNESSVALUE                37379   /* Brightness */
+#define EXIFTAG_EXPOSUREBIASVALUE      37380   /* Exposure bias */
+#define EXIFTAG_MAXAPERTUREVALUE       37381   /* Maximum lens aperture */
+#define EXIFTAG_SUBJECTDISTANCE                37382   /* Subject distance */
+#define EXIFTAG_METERINGMODE           37383   /* Metering mode */
+#define EXIFTAG_LIGHTSOURCE            37384   /* Light source */
+#define EXIFTAG_FLASH                  37385   /* Flash */
+#define EXIFTAG_FOCALLENGTH            37386   /* Lens focal length */
+#define EXIFTAG_SUBJECTAREA            37396   /* Subject area */
+#define EXIFTAG_MAKERNOTE              37500   /* Manufacturer notes */
+#define EXIFTAG_USERCOMMENT            37510   /* User comments */
+#define EXIFTAG_SUBSECTIME             37520   /* DateTime subseconds */
+#define EXIFTAG_SUBSECTIMEORIGINAL     37521   /* DateTimeOriginal subseconds */
+#define EXIFTAG_SUBSECTIMEDIGITIZED    37522   /* DateTimeDigitized subseconds */
+#define EXIFTAG_FLASHPIXVERSION                40960   /* Supported Flashpix version */
+#define EXIFTAG_COLORSPACE             40961   /* Color space information */
+#define EXIFTAG_PIXELXDIMENSION                40962   /* Valid image width */
+#define EXIFTAG_PIXELYDIMENSION                40963   /* Valid image height */
+#define EXIFTAG_RELATEDSOUNDFILE       40964   /* Related audio file */
+#define EXIFTAG_FLASHENERGY            41483   /* Flash energy */
+#define EXIFTAG_SPATIALFREQUENCYRESPONSE 41484 /* Spatial frequency response */
+#define EXIFTAG_FOCALPLANEXRESOLUTION  41486   /* Focal plane X resolution */
+#define EXIFTAG_FOCALPLANEYRESOLUTION  41487   /* Focal plane Y resolution */
+#define EXIFTAG_FOCALPLANERESOLUTIONUNIT 41488 /* Focal plane resolution unit */
+#define EXIFTAG_SUBJECTLOCATION                41492   /* Subject location */
+#define EXIFTAG_EXPOSUREINDEX          41493   /* Exposure index */
+#define EXIFTAG_SENSINGMETHOD          41495   /* Sensing method */
+#define EXIFTAG_FILESOURCE             41728   /* File source */
+#define EXIFTAG_SCENETYPE              41729   /* Scene type */
+#define EXIFTAG_CFAPATTERN             41730   /* CFA pattern */
+#define EXIFTAG_CUSTOMRENDERED         41985   /* Custom image processing */
+#define EXIFTAG_EXPOSUREMODE           41986   /* Exposure mode */
+#define EXIFTAG_WHITEBALANCE           41987   /* White balance */
+#define EXIFTAG_DIGITALZOOMRATIO       41988   /* Digital zoom ratio */
+#define EXIFTAG_FOCALLENGTHIN35MMFILM  41989   /* Focal length in 35 mm film */
+#define EXIFTAG_SCENECAPTURETYPE       41990   /* Scene capture type */
+#define EXIFTAG_GAINCONTROL            41991   /* Gain control */
+#define EXIFTAG_CONTRAST               41992   /* Contrast */
+#define EXIFTAG_SATURATION             41993   /* Saturation */
+#define EXIFTAG_SHARPNESS              41994   /* Sharpness */
+#define EXIFTAG_DEVICESETTINGDESCRIPTION 41995 /* Device settings description */
+#define EXIFTAG_SUBJECTDISTANCERANGE   41996   /* Subject distance range */
+#define EXIFTAG_GAINCONTROL            41991   /* Gain control */
+#define EXIFTAG_GAINCONTROL            41991   /* Gain control */
+#define EXIFTAG_IMAGEUNIQUEID          42016   /* Unique image ID */
+
 #endif /* _TIFF_ */
+
+/* vim: set ts=8 sts=8 sw=8 noet: */
diff --git a/libs/libtiff/tiffconf.h b/libs/libtiff/tiffconf.h
new file mode 100644 (file)
index 0000000..bf88938
--- /dev/null
@@ -0,0 +1,101 @@
+/* libtiff/tiffconf.h.  Generated by configure.  */
+/*
+  Configuration defines for installed libtiff.
+  This file maintained for backward compatibility. Do not use definitions
+  from this file in your programs.
+*/
+
+#ifndef _TIFFCONF_
+#define _TIFFCONF_
+
+/* Define to 1 if the system has the type `int16'. */
+/* #undef HAVE_INT16 */
+
+/* Define to 1 if the system has the type `int32'. */
+/* #undef HAVE_INT32 */
+
+/* Define to 1 if the system has the type `int8'. */
+/* #undef HAVE_INT8 */
+
+/* The size of a `int', as computed by sizeof. */
+#define SIZEOF_INT 4
+
+/* The size of a `long', as computed by sizeof. */
+#define SIZEOF_LONG 4
+
+/* Compatibility stuff. */
+
+/* Define as 0 or 1 according to the floating point format suported by the
+   machine */
+#define HAVE_IEEEFP 1
+
+/* Set the native cpu bit order (FILLORDER_LSB2MSB or FILLORDER_MSB2LSB) */
+#define HOST_FILLORDER FILLORDER_LSB2MSB
+
+/* Native cpu byte order: 1 if big-endian (Motorola) or 0 if little-endian
+   (Intel) */
+#define HOST_BIGENDIAN 0
+
+/* Support CCITT Group 3 & 4 algorithms */
+#define CCITT_SUPPORT 1
+
+/* Support JPEG compression (requires IJG JPEG library) */
+#define JPEG_SUPPORT 1
+
+/* Support LogLuv high dynamic range encoding */
+#define LOGLUV_SUPPORT 1
+
+/* Support LZW algorithm */
+#define LZW_SUPPORT 1
+
+/* Support NeXT 2-bit RLE algorithm */
+#define NEXT_SUPPORT 1
+
+/* Support Old JPEG compresson (read contrib/ojpeg/README first! Compilation
+   fails with unpatched IJG JPEG library) */
+/* #undef OJPEG_SUPPORT */
+
+/* Support Macintosh PackBits algorithm */
+#define PACKBITS_SUPPORT 1
+
+/* Support Pixar log-format algorithm (requires Zlib) */
+#define PIXARLOG_SUPPORT 1
+
+/* Support ThunderScan 4-bit RLE algorithm */
+#define THUNDER_SUPPORT 1
+
+/* Support Deflate compression */
+#define ZIP_SUPPORT 1
+
+/* Support strip chopping (whether or not to convert single-strip uncompressed
+   images to mutiple strips of ~8Kb to reduce memory usage) */
+#define STRIPCHOP_DEFAULT TIFF_STRIPCHOP
+
+/* Enable SubIFD tag (330) support */
+#define SUBIFD_SUPPORT 1
+
+/* Treat extra sample as alpha (default enabled). The RGBA interface will
+   treat a fourth sample with no EXTRASAMPLE_ value as being ASSOCALPHA. Many
+   packages produce RGBA files but don't mark the alpha properly. */
+#define DEFAULT_EXTRASAMPLE_AS_ALPHA 1
+
+/* Pick up YCbCr subsampling info from the JPEG data stream to support files
+   lacking the tag (default enabled). */
+#define CHECK_JPEG_YCBCR_SUBSAMPLING 1
+
+/* Support MS MDI magic number files as TIFF */
+#define MDI_SUPPORT 1
+
+/*
+ * Feature support definitions.
+ * XXX: These macros are obsoleted. Don't use them in your apps!
+ * Macros stays here for backward compatibility and should be always defined.
+ */
+#define COLORIMETRY_SUPPORT
+#define YCBCR_SUPPORT
+#define CMYK_SUPPORT
+#define ICC_SUPPORT
+#define PHOTOSHOP_SUPPORT
+#define IPTC_SUPPORT
+
+#endif /* _TIFFCONF_ */
index 2c1e16ff422e007ff76073efb538364fb8178e4a..7aaf561386a99ea3c43b21cf23c42f80e2cc4aa1 100644 (file)
@@ -1,8 +1,8 @@
-/* $Header: /usr/people/sam/tiff/libtiff/RCS/tiffio.h,v 1.93 1996/03/07 17:00:14 sam Rel $ */
+/* $Id: tiffio.h,v 1.50 2006/03/21 16:37:51 dron Exp $ */
 
 /*
- * Copyright (c) 1988-1996 Sam Leffler
- * Copyright (c) 1991-1996 Silicon Graphics, Inc.
+ * Copyright (c) 1988-1997 Sam Leffler
+ * Copyright (c) 1991-1997 Silicon Graphics, Inc.
  *
  * Permission to use, copy, modify, distribute, and sell this software and 
  * its documentation for any purpose is hereby granted without fee, provided
@@ -19,8 +19,8 @@
  * 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 
+ * 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.
  */
 
  * TIFF I/O Library Definitions.
  */
 #include "tiff.h"
-
-/*
- * This define can be used in code that requires
- * compilation-related definitions specific to a
- * version or versions of the library.  Runtime
- * version checking should be done based on the
- * string returned by TIFFGetVersion.
- */
-#define        TIFFLIB_VERSION 19960307        /* March 7, 1996 */
+#include "tiffvers.h"
 
 /*
  * TIFF is defined as an incomplete type to hide the
@@ -52,7 +44,7 @@ typedef       struct tiff TIFF;
  * data types used in the *exported* interfaces.  These
  * definitions depend on the proper definition of types
  * in tiff.h.  Note also that the varargs interface used
- * pass tag types and values uses the types defined in
+ * to pass tag types and values uses the types defined in
  * tiff.h directly.
  *
  * NB: ttag_t is unsigned int and not unsigned short because
@@ -63,29 +55,49 @@ typedef     struct tiff TIFF;
  * NB: tsize_t is int32 and not uint32 because some functions
  *     return -1.
  * NB: toff_t is not off_t for many reasons; TIFFs max out at
- *     32-bit file offsets being the most important
+ *     32-bit file offsets being the most important, and to ensure
+ *     that it is unsigned, rather than signed.
  */
-typedef        unsigned int ttag_t;    /* directory tag */
+typedef        uint32 ttag_t;          /* directory tag */
 typedef        uint16 tdir_t;          /* directory index */
 typedef        uint16 tsample_t;       /* sample number */
 typedef        uint32 tstrip_t;        /* strip number */
 typedef uint32 ttile_t;                /* tile number */
 typedef        int32 tsize_t;          /* i/o size in bytes */
+typedef        void* tdata_t;          /* image data ref */
+typedef        uint32 toff_t;          /* file offset */
+
+#if !defined(__WIN32__) && (defined(_WIN32) || defined(WIN32))
+#define __WIN32__
+#endif
+
+/*
+ * On windows you should define USE_WIN32_FILEIO if you are using tif_win32.c
+ * or AVOID_WIN32_FILEIO if you are using something else (like tif_unix.c).
+ *
+ * By default tif_unix.c is assumed.
+ */
+
 #if defined(_WINDOWS) || defined(__WIN32__) || defined(_Windows)
-#include <windows.h>
-#ifdef __WIN32__
+#  if !defined(__CYGWIN) && !defined(AVOID_WIN32_FILEIO) && !defined(USE_WIN32_FILEIO)
+#    define AVOID_WIN32_FILEIO
+#  endif
+#endif
+
+#if defined(USE_WIN32_FILEIO)
+# define VC_EXTRALEAN
+# include <windows.h>
+# ifdef __WIN32__
 DECLARE_HANDLE(thandle_t);     /* Win32 file handle */
-#else
+# else
 typedef        HFILE thandle_t;        /* client data handle */
-#endif
+# endif /* __WIN32__ */
 #else
 typedef        void* thandle_t;        /* client data handle */
-#endif
-typedef        void* tdata_t;          /* image data ref */
-typedef        int32 toff_t;           /* file offset */
+#endif /* USE_WIN32_FILEIO */
 
 #ifndef NULL
-#define        NULL    0
+# define NULL  (void *)0
 #endif
 
 /*
@@ -102,10 +114,62 @@ typedef   int32 toff_t;           /* file offset */
 #define        TIFFPRINT_JPEGACTABLES  0x200           /* JPEG AC tables */
 #define        TIFFPRINT_JPEGDCTABLES  0x200           /* JPEG DC tables */
 
+/* 
+ * Colour conversion stuff
+ */
+
+/* reference white */
+#define D65_X0 (95.0470F)
+#define D65_Y0 (100.0F)
+#define D65_Z0 (108.8827F)
+
+#define D50_X0 (96.4250F)
+#define D50_Y0 (100.0F)
+#define D50_Z0 (82.4680F)
+
+/* Structure for holding information about a display device. */
+
+typedef        unsigned char TIFFRGBValue;             /* 8-bit samples */
+
+typedef struct {
+       float d_mat[3][3];              /* XYZ -> luminance matrix */
+       float d_YCR;                    /* Light o/p for reference white */
+       float d_YCG;
+       float d_YCB;
+       uint32 d_Vrwr;                  /* Pixel values for ref. white */
+       uint32 d_Vrwg;
+       uint32 d_Vrwb;
+       float d_Y0R;                    /* Residual light for black pixel */
+       float d_Y0G;
+       float d_Y0B;
+       float d_gammaR;                 /* Gamma values for the three guns */
+       float d_gammaG;
+       float d_gammaB;
+} TIFFDisplay;
+
+typedef struct {                               /* YCbCr->RGB support */
+       TIFFRGBValue* clamptab;                 /* range clamping table */
+       int*    Cr_r_tab;
+       int*    Cb_b_tab;
+       int32*  Cr_g_tab;
+       int32*  Cb_g_tab;
+        int32*  Y_tab;
+} TIFFYCbCrToRGB;
+
+typedef struct {                               /* CIE Lab 1976->RGB support */
+       int     range;                          /* Size of conversion table */
+#define CIELABTORGB_TABLE_RANGE 1500
+       float   rstep, gstep, bstep;
+       float   X0, Y0, Z0;                     /* Reference white point */
+       TIFFDisplay display;
+       float   Yr2r[CIELABTORGB_TABLE_RANGE + 1];  /* Conversion of Yr to r */
+       float   Yg2g[CIELABTORGB_TABLE_RANGE + 1];  /* Conversion of Yg to g */
+       float   Yb2b[CIELABTORGB_TABLE_RANGE + 1];  /* Conversion of Yb to b */
+} TIFFCIELabToRGB;
+
 /*
  * RGBA-style image support.
  */
-typedef        unsigned char TIFFRGBValue;             /* 8-bit samples */
 typedef struct _TIFFRGBAImage TIFFRGBAImage;
 /*
  * The image reading and conversion routines invoke
@@ -126,15 +190,6 @@ typedef void (*tileSeparateRoutine)
 /*
  * RGBA-reader state.
  */
-typedef struct {                               /* YCbCr->RGB support */
-       TIFFRGBValue* clamptab;                 /* range clamping table */
-       int*    Cr_r_tab;
-       int*    Cb_b_tab;
-       int32*  Cr_g_tab;
-       int32*  Cb_g_tab;
-       float   coeffs[3];                      /* cached for repeated use */
-} TIFFYCbCrToRGB;
-
 struct _TIFFRGBAImage {
        TIFF*   tif;                            /* image handle */
        int     stoponerr;                      /* stop on read error */
@@ -145,6 +200,7 @@ struct _TIFFRGBAImage {
        uint16  bitspersample;                  /* image bits/sample */
        uint16  samplesperpixel;                /* image samples/pixel */
        uint16  orientation;                    /* image orientation */
+       uint16  req_orientation;                /* requested orientation */
        uint16  photometric;                    /* image photometric interp */
        uint16* redcmap;                        /* colormap pallete */
        uint16* greencmap;
@@ -160,6 +216,10 @@ struct _TIFFRGBAImage {
        uint32** BWmap;                         /* black&white map */
        uint32** PALmap;                        /* palette image map */
        TIFFYCbCrToRGB* ycbcr;                  /* YCbCr conversion state */
+        TIFFCIELabToRGB* cielab;               /* CIE L*a*b conversion state */
+
+        int    row_offset;
+        int     col_offset;
 };
 
 /*
@@ -188,10 +248,16 @@ typedef struct {
 #include <stdio.h>
 #include <stdarg.h>
 
-#if defined(__cplusplus)
+/* share internal LogLuv conversion routines? */
+#ifndef LOGLUV_PUBLIC
+#define LOGLUV_PUBLIC          1
+#endif
+
+#if defined(c_plusplus) || defined(__cplusplus)
 extern "C" {
 #endif
 typedef        void (*TIFFErrorHandler)(const char*, const char*, va_list);
+typedef        void (*TIFFErrorHandlerExt)(thandle_t, const char*, const char*, va_list);
 typedef        tsize_t (*TIFFReadWriteProc)(thandle_t, tdata_t, tsize_t);
 typedef        toff_t (*TIFFSeekProc)(thandle_t, toff_t, int);
 typedef        int (*TIFFCloseProc)(thandle_t);
@@ -205,6 +271,12 @@ extern     const char* TIFFGetVersion(void);
 extern const TIFFCodec* TIFFFindCODEC(uint16);
 extern TIFFCodec* TIFFRegisterCODEC(uint16, const char*, TIFFInitMethod);
 extern void TIFFUnRegisterCODEC(TIFFCodec*);
+extern  int TIFFIsCODECConfigured(uint16);
+extern TIFFCodec* TIFFGetConfiguredCODECs(void);
+
+/*
+ * Auxiliary functions.
+ */
 
 extern tdata_t _TIFFmalloc(tsize_t);
 extern tdata_t _TIFFrealloc(tdata_t, tsize_t);
@@ -213,6 +285,58 @@ extern     void _TIFFmemcpy(tdata_t, const tdata_t, tsize_t);
 extern int _TIFFmemcmp(const tdata_t, const tdata_t, tsize_t);
 extern void _TIFFfree(tdata_t);
 
+/*
+** Stuff, related to tag handling and creating custom tags.
+*/
+extern  int  TIFFGetTagListCount( TIFF * );
+extern  ttag_t TIFFGetTagListEntry( TIFF *, int tag_index );
+    
+#define        TIFF_ANY        TIFF_NOTYPE     /* for field descriptor searching */
+#define        TIFF_VARIABLE   -1              /* marker for variable length tags */
+#define        TIFF_SPP        -2              /* marker for SamplesPerPixel tags */
+#define        TIFF_VARIABLE2  -3              /* marker for uint32 var-length tags */
+
+#define FIELD_CUSTOM    65    
+
+typedef        struct {
+       ttag_t  field_tag;              /* field's tag */
+       short   field_readcount;        /* read count/TIFF_VARIABLE/TIFF_SPP */
+       short   field_writecount;       /* write count/TIFF_VARIABLE */
+       TIFFDataType field_type;        /* type of associated data */
+        unsigned short field_bit;      /* bit in fieldsset bit vector */
+       unsigned char field_oktochange; /* if true, can change while writing */
+       unsigned char field_passcount;  /* if true, pass dir count on set */
+       char    *field_name;            /* ASCII name */
+} TIFFFieldInfo;
+
+typedef struct _TIFFTagValue {
+    const TIFFFieldInfo  *info;
+    int             count;
+    void           *value;
+} TIFFTagValue;
+
+extern void TIFFMergeFieldInfo(TIFF*, const TIFFFieldInfo[], int);
+extern const TIFFFieldInfo* TIFFFindFieldInfo(TIFF*, ttag_t, TIFFDataType);
+extern  const TIFFFieldInfo* TIFFFindFieldInfoByName(TIFF* , const char *,
+                                                    TIFFDataType);
+extern const TIFFFieldInfo* TIFFFieldWithTag(TIFF*, ttag_t);
+extern const TIFFFieldInfo* TIFFFieldWithName(TIFF*, const char *);
+
+typedef        int (*TIFFVSetMethod)(TIFF*, ttag_t, va_list);
+typedef        int (*TIFFVGetMethod)(TIFF*, ttag_t, va_list);
+typedef        void (*TIFFPrintMethod)(TIFF*, FILE*, long);
+    
+typedef struct {
+    TIFFVSetMethod     vsetfield;      /* tag set routine */
+    TIFFVGetMethod     vgetfield;      /* tag get routine */
+    TIFFPrintMethod    printdir;       /* directory print routine */
+} TIFFTagMethods;
+        
+extern  TIFFTagMethods *TIFFAccessTagMethods( TIFF * );
+extern  void *TIFFGetClientInfo( TIFF *, const char * );
+extern  void TIFFSetClientInfo( TIFF *, void *, const char * );
+
+extern void TIFFCleanup(TIFF*);
 extern void TIFFClose(TIFF*);
 extern int TIFFFlush(TIFF*);
 extern int TIFFFlushData(TIFF*);
@@ -221,9 +345,13 @@ extern     int TIFFVGetField(TIFF*, ttag_t, va_list);
 extern int TIFFGetFieldDefaulted(TIFF*, ttag_t, ...);
 extern int TIFFVGetFieldDefaulted(TIFF*, ttag_t, va_list);
 extern int TIFFReadDirectory(TIFF*);
+extern int TIFFReadCustomDirectory(TIFF*, toff_t, const TIFFFieldInfo[],
+                                   size_t);
+extern int TIFFReadEXIFDirectory(TIFF*, toff_t);
 extern tsize_t TIFFScanlineSize(TIFF*);
 extern tsize_t TIFFRasterScanlineSize(TIFF*);
 extern tsize_t TIFFStripSize(TIFF*);
+extern tsize_t TIFFRawStripSize(TIFF*, tstrip_t);
 extern tsize_t TIFFVStripSize(TIFF*, uint32);
 extern tsize_t TIFFTileRowSize(TIFF*);
 extern tsize_t TIFFTileSize(TIFF*);
@@ -231,18 +359,35 @@ extern    tsize_t TIFFVTileSize(TIFF*, uint32);
 extern uint32 TIFFDefaultStripSize(TIFF*, uint32);
 extern void TIFFDefaultTileSize(TIFF*, uint32*, uint32*);
 extern int TIFFFileno(TIFF*);
+extern  int TIFFSetFileno(TIFF*, int);
+extern  thandle_t TIFFClientdata(TIFF*);
+extern  thandle_t TIFFSetClientdata(TIFF*, thandle_t);
 extern int TIFFGetMode(TIFF*);
+extern int TIFFSetMode(TIFF*, int);
 extern int TIFFIsTiled(TIFF*);
 extern int TIFFIsByteSwapped(TIFF*);
 extern int TIFFIsUpSampled(TIFF*);
 extern int TIFFIsMSB2LSB(TIFF*);
+extern int TIFFIsBigEndian(TIFF*);
+extern TIFFReadWriteProc TIFFGetReadProc(TIFF*);
+extern TIFFReadWriteProc TIFFGetWriteProc(TIFF*);
+extern TIFFSeekProc TIFFGetSeekProc(TIFF*);
+extern TIFFCloseProc TIFFGetCloseProc(TIFF*);
+extern TIFFSizeProc TIFFGetSizeProc(TIFF*);
+extern TIFFMapFileProc TIFFGetMapFileProc(TIFF*);
+extern TIFFUnmapFileProc TIFFGetUnmapFileProc(TIFF*);
 extern uint32 TIFFCurrentRow(TIFF*);
 extern tdir_t TIFFCurrentDirectory(TIFF*);
+extern tdir_t TIFFNumberOfDirectories(TIFF*);
 extern uint32 TIFFCurrentDirOffset(TIFF*);
 extern tstrip_t TIFFCurrentStrip(TIFF*);
 extern ttile_t TIFFCurrentTile(TIFF*);
 extern int TIFFReadBufferSetup(TIFF*, tdata_t, tsize_t);
 extern int TIFFWriteBufferSetup(TIFF*, tdata_t, tsize_t);
+extern int TIFFSetupStrips(TIFF *);
+extern  int TIFFWriteCheck(TIFF*, int, const char *);
+extern void TIFFFreeDirectory(TIFF*);
+extern  int TIFFCreateDirectory(TIFF*);
 extern int TIFFLastDirectory(TIFF*);
 extern int TIFFSetDirectory(TIFF*, tdir_t);
 extern int TIFFSetSubDirectory(TIFF*, uint32);
@@ -250,22 +395,35 @@ extern    int TIFFUnlinkDirectory(TIFF*, tdir_t);
 extern int TIFFSetField(TIFF*, ttag_t, ...);
 extern int TIFFVSetField(TIFF*, ttag_t, va_list);
 extern int TIFFWriteDirectory(TIFF *);
+extern int TIFFCheckpointDirectory(TIFF *);
+extern int TIFFRewriteDirectory(TIFF *);
+extern int TIFFReassignTagToIgnore(enum TIFFIgnoreSense, int);
+
 #if defined(c_plusplus) || defined(__cplusplus)
 extern void TIFFPrintDirectory(TIFF*, FILE*, long = 0);
 extern int TIFFReadScanline(TIFF*, tdata_t, uint32, tsample_t = 0);
 extern int TIFFWriteScanline(TIFF*, tdata_t, uint32, tsample_t = 0);
 extern int TIFFReadRGBAImage(TIFF*, uint32, uint32, uint32*, int = 0);
+extern int TIFFReadRGBAImageOriented(TIFF*, uint32, uint32, uint32*,
+                                     int = ORIENTATION_BOTLEFT, int = 0);
 #else
 extern void TIFFPrintDirectory(TIFF*, FILE*, long);
 extern int TIFFReadScanline(TIFF*, tdata_t, uint32, tsample_t);
 extern int TIFFWriteScanline(TIFF*, tdata_t, uint32, tsample_t);
 extern int TIFFReadRGBAImage(TIFF*, uint32, uint32, uint32*, int);
+extern int TIFFReadRGBAImageOriented(TIFF*, uint32, uint32, uint32*, int, int);
 #endif
+
+extern int TIFFReadRGBAStrip(TIFF*, tstrip_t, uint32 * );
+extern int TIFFReadRGBATile(TIFF*, uint32, uint32, uint32 * );
 extern int TIFFRGBAImageOK(TIFF*, char [1024]);
 extern int TIFFRGBAImageBegin(TIFFRGBAImage*, TIFF*, int, char [1024]);
 extern int TIFFRGBAImageGet(TIFFRGBAImage*, uint32*, uint32, uint32);
 extern void TIFFRGBAImageEnd(TIFFRGBAImage*);
 extern TIFF* TIFFOpen(const char*, const char*);
+# ifdef __WIN32__
+extern TIFF* TIFFOpenW(const wchar_t*, const char*);
+# endif /* __WIN32__ */
 extern TIFF* TIFFFdOpen(int, const char*, const char*);
 extern TIFF* TIFFClientOpen(const char*, const char*,
            thandle_t,
@@ -274,10 +432,15 @@ extern    TIFF* TIFFClientOpen(const char*, const char*,
            TIFFSizeProc,
            TIFFMapFileProc, TIFFUnmapFileProc);
 extern const char* TIFFFileName(TIFF*);
+extern const char* TIFFSetFileName(TIFF*, const char *);
 extern void TIFFError(const char*, const char*, ...);
+extern void TIFFErrorExt(thandle_t, const char*, const char*, ...);
 extern void TIFFWarning(const char*, const char*, ...);
+extern void TIFFWarningExt(thandle_t, const char*, const char*, ...);
 extern TIFFErrorHandler TIFFSetErrorHandler(TIFFErrorHandler);
+extern TIFFErrorHandlerExt TIFFSetErrorHandlerExt(TIFFErrorHandlerExt);
 extern TIFFErrorHandler TIFFSetWarningHandler(TIFFErrorHandler);
+extern TIFFErrorHandlerExt TIFFSetWarningHandlerExt(TIFFErrorHandlerExt);
 extern TIFFExtendProc TIFFSetTagExtender(TIFFExtendProc);
 extern ttile_t TIFFComputeTile(TIFF*, uint32, uint32, uint32, tsample_t);
 extern int TIFFCheckTile(TIFF*, uint32, uint32, uint32, tsample_t);
@@ -296,16 +459,57 @@ extern    tsize_t TIFFWriteEncodedStrip(TIFF*, tstrip_t, tdata_t, tsize_t);
 extern tsize_t TIFFWriteRawStrip(TIFF*, tstrip_t, tdata_t, tsize_t);
 extern tsize_t TIFFWriteEncodedTile(TIFF*, ttile_t, tdata_t, tsize_t);
 extern tsize_t TIFFWriteRawTile(TIFF*, ttile_t, tdata_t, tsize_t);
+extern int TIFFDataWidth(TIFFDataType);    /* table of tag datatype widths */
 extern void TIFFSetWriteOffset(TIFF*, toff_t);
 extern void TIFFSwabShort(uint16*);
 extern void TIFFSwabLong(uint32*);
 extern void TIFFSwabDouble(double*);
 extern void TIFFSwabArrayOfShort(uint16*, unsigned long);
+extern void TIFFSwabArrayOfTriples(uint8*, unsigned long);
 extern void TIFFSwabArrayOfLong(uint32*, unsigned long);
 extern void TIFFSwabArrayOfDouble(double*, unsigned long);
 extern void TIFFReverseBits(unsigned char *, unsigned long);
 extern const unsigned char* TIFFGetBitRevTable(int);
-#if defined(__cplusplus)
+
+#ifdef LOGLUV_PUBLIC
+#define U_NEU          0.210526316
+#define V_NEU          0.473684211
+#define UVSCALE                410.
+extern double LogL16toY(int);
+extern double LogL10toY(int);
+extern void XYZtoRGB24(float*, uint8*);
+extern int uv_decode(double*, double*, int);
+extern void LogLuv24toXYZ(uint32, float*);
+extern void LogLuv32toXYZ(uint32, float*);
+#if defined(c_plusplus) || defined(__cplusplus)
+extern int LogL16fromY(double, int = SGILOGENCODE_NODITHER);
+extern int LogL10fromY(double, int = SGILOGENCODE_NODITHER);
+extern int uv_encode(double, double, int = SGILOGENCODE_NODITHER);
+extern uint32 LogLuv24fromXYZ(float*, int = SGILOGENCODE_NODITHER);
+extern uint32 LogLuv32fromXYZ(float*, int = SGILOGENCODE_NODITHER);
+#else
+extern int LogL16fromY(double, int);
+extern int LogL10fromY(double, int);
+extern int uv_encode(double, double, int);
+extern uint32 LogLuv24fromXYZ(float*, int);
+extern uint32 LogLuv32fromXYZ(float*, int);
+#endif
+#endif /* LOGLUV_PUBLIC */
+    
+extern int TIFFCIELabToRGBInit(TIFFCIELabToRGB*, TIFFDisplay *, float*);
+extern void TIFFCIELabToXYZ(TIFFCIELabToRGB *, uint32, int32, int32,
+                           float *, float *, float *);
+extern void TIFFXYZToRGB(TIFFCIELabToRGB *, float, float, float,
+                        uint32 *, uint32 *, uint32 *);
+
+extern int TIFFYCbCrToRGBInit(TIFFYCbCrToRGB*, float*, float*);
+extern void TIFFYCbCrtoRGB(TIFFYCbCrToRGB *, uint32, int32, int32,
+                          uint32 *, uint32 *, uint32 *);
+
+#if defined(c_plusplus) || defined(__cplusplus)
 }
 #endif
+
 #endif /* _TIFFIO_ */
+
+/* vim: set ts=8 sts=8 sw=8 noet: */
diff --git a/libs/libtiff/tiffvers.h b/libs/libtiff/tiffvers.h
new file mode 100644 (file)
index 0000000..9744f8d
--- /dev/null
@@ -0,0 +1,9 @@
+#define TIFFLIB_VERSION_STR "LIBTIFF, Version 3.8.2\nCopyright (c) 1988-1996 Sam Leffler\nCopyright (c) 1991-1996 Silicon Graphics, Inc."
+/*
+ * This define can be used in code that requires
+ * compilation-related definitions specific to a
+ * version or versions of the library.  Runtime
+ * version checking should be done based on the
+ * string returned by TIFFGetVersion.
+ */
+#define TIFFLIB_VERSION 20060323