ftp.nice.ch/NiCE/X/xv-3.00a.tar.gz#/xv-3.00a/tiff

CHANGES-v2.3
 
CHANGES-v2.4
 
CHANGES-v2.5
 
CHANGES-v3.0
 
CHANGES-v3.1
 
CHANGES-v3.2
 
Copyright
 
DIFF
 
HOWTO
 
Imakefile
 
Makefile
 
Makefile.aix
 
Makefile.apollo
 
Makefile.gcc
 
Makefile.hpux
 
Makefile.mips
 
Makefile.mpw
 
Makefile.next
 
Makefile.sgi
 
Makefile.sun
 
Makefile.tahoe
 
Makefile.vax
 
RANLIB.csh
 
README
 
VERSION
 
machdep.h
[View machdep.h] 
mkg3states.c
[View mkg3states.c] 
mkg3states.c.orig
 
mkspans.c
[View mkspans.c] 
t4.h
[View t4.h] 
tif_apple.c
[View tif_apple.c] 
tif_aux.c
[View tif_aux.c] 
tif_ccittrle.c
[View tif_ccittrle.c] 
tif_close.c
[View tif_close.c] 
tif_compress.c
[View tif_compress.c] 
tif_dir.c
[View tif_dir.c] 
tif_dirinfo.c
[View tif_dirinfo.c] 
tif_dirread.c
[View tif_dirread.c] 
tif_dirwrite.c
[View tif_dirwrite.c] 
tif_dumpmode.c
[View tif_dumpmode.c] 
tif_error.c
[View tif_error.c] 
tif_fax3.c
[View tif_fax3.c] 
tif_fax3.h
[View tif_fax3.h] 
tif_fax4.c
[View tif_fax4.c] 
tif_flush.c
[View tif_flush.c] 
tif_getimage.c
[View tif_getimage.c] 
tif_jpeg.c
[View tif_jpeg.c] 
tif_lzw.c
[View tif_lzw.c] 
tif_machdep.c
[View tif_machdep.c] 
tif_msdos.c
[View tif_msdos.c] 
tif_next.c
[View tif_next.c] 
tif_open.c
[View tif_open.c] 
tif_packbits.c
[View tif_packbits.c] 
tif_print.c
[View tif_print.c] 
tif_read.c
[View tif_read.c] 
tif_strip.c
[View tif_strip.c] 
tif_swab.c
[View tif_swab.c] 
tif_thunder.c
[View tif_thunder.c] 
tif_tile.c
[View tif_tile.c] 
tif_unix.c
[View tif_unix.c] 
tif_version.c
[View tif_version.c] 
tif_vms.c
[View tif_vms.c] 
tif_warning.c
[View tif_warning.c] 
tif_write.c
[View tif_write.c] 
tiff.h
[View tiff.h] 
tiffcomp.h
[View tiffcomp.h] 
tiffconf.h
[View tiffconf.h] 
tiffio.h
[View tiffio.h] 
tiffiop.h
[View tiffiop.h] 

README

$Header: /usr/people/sam/tiff/libtiff/RCS/README,v 1.16 92/10/21 16:37:31 sam Exp $

Configuration Comments:
----------------------
Aside from the compression algorithm support, there are
configuration-related defines that you can override in the Makefile
or in the default configuration file tiffconf.h:

COLORIMETRY_SUPPORT
		if this is defined, support for the colorimetry
		tags will be compiled in.
JPEG_SUPPORT	if this is defined, support for the JPEG-related
		tags will be compiled in.  Note that at the present
		time the JPEG compression support is not included.
YCBCR_SUPPORT	if this is defined, support for the YCbCr-related
		tags will be compiled in.  Note that you'll want
		YCBCR support for JPEG compression+decompression.
CMYK_SUPPORT	if this is defined, support for the CMYK-related
		tags will be compiled in.
MMAP_SUPPORT	if this is set, and OS support exists for memory
		mapping files, then the library will try to map
		a file if it is opened for reading.  If mmap does
		not exist on your system, or the mmap call fails
		on the file, then the normal read system calls are
		used.  It is not clear how useful this facility is.

By default tiffconf.h defines COLORIMETRY_SUPPORT, JPEG_SUPPORT,
YCBCR_SUPPORT, CMYK_SUPPORT.  MMAP_SUPPORT is not defined.

Portability Comments:
--------------------
I run this code on SGI machines (big-endian, MIPS CPU, 32-bit ints,
IEEE floating point).  Makefiles exist for other platforms that the
code runs on -- this work has mostly been done by other people.
I've also been told that the code runs on Macintosh and PC-based
systems, although I don't know the particulars.

In general, I promise only that the code runs on SGI machines.
I will, however, gladly take back fixes to make it work on other
systems -- when the changes are reasonable unobtrusive.

I've tried to isolate as many of the OS-dependencies as possible in
two files: tiffcomp.h and tif_<os>.c.  The latter file contains
OS-specific routines to do I/O and I/O-related operations.  The
UNIX (tif_unix.c), Macintosh (tif_apple.c), and VMS (tif_vms.c)
code has had the most use; the MS/DOS support (tif_msdos.c) assumes
some level of UNIX system call emulation (i.e. open, read, write,
fstat, malloc, free).

Machine dependencies such as byte order are determined on the
fly and do not need to be specified.

Five general portability-related defines are:
    USE_VARARGS		define as 0 or 1 to select between the use of
			varargs.h and stdarg.h; i.e.  -DUSE_VARARGS=0
			means use stdarg.h
    USE_PROTOTYPES	define as 0 or 1 to select function declarations
			and definitions with parameter types
    USE_CONST		if your compiler defines __STDC__ or __EXTENSIONS__,
			but does not support const, define this as 0,
			otherwise leave it alone
    BSDTYPES		define this if your system does NOT define the
			usual 4BSD typedefs
    HAVE_IEEEFP		define as 0 or 1 according to the floating point
			format suported by the machine

If you compile the code with prototypes (USE_PROTOTYPES=1), then
you must have USE_VARARGS=0.

Note that tiffcomp.h defines:
    USE_PROTOTYPES	1
    USE_VARARGS		0
    USE_CONST		1
    HAVE_IEEEFP		1
(BSDTYPES is not defined).

General Comments:
----------------
The library is designed to hide as much of the details of TIFF as
possible.  In particular, TIFF directories are read in their entirety
into an internal format.  Only the tags known by the library are
available to a user and certain tag data may be maintained that a user
doesn't care about (e.g. transfer function tables).

To add support for a new directory tag the following mods are needed:

1. Define the tag in tiff.h.
2. Add a field to the directory structure in tiffioP.h and define a
   FIELD_* bit.
3. Add an entry in the FieldInfo array defined at the top of tiff_dirinfo.c.
4. Add entries in TIFFSetField1() and TIFFGetField1() for the new tag.
5. (optional) If the value associated with the tag is not a scalar value
   (e.g. the array for TransferFunction), then add the appropriate
   code to TIFFReadDirectory() and TIFFWriteDirectory().  You're best
   off finding a similar tag and cribbing code.
6. Add support to TIFFPrintDirectory() in tiff_print.c to print the
   tag's value.

To add support for a compression algorithm:

1. Define the tag value in tiff.h.
2. Edit the file tiff_compress.c to add an entry to the
   CompressionSchemes[] array.
3. Create a file with the compression scheme code, by convention files
   are named tif_*.c (except perhaps on some systems where the tif_ prefix
   pushes some filenames over 14 chars.
4. Edit the Makefiles to include the new source file.

A compression scheme, say foo, can have up to 10 entry points:

TIFFfoo(tif)		/* initialize scheme and setup entry points in tif */
fooPreDecode(tif)	/* called once per strip, after data is read,
			   but before the first row in a strip is decoded */
fooDecode*(tif, bp, cc, sample)/* decode cc bytes of data into the buffer */
    fooDecodeRow(...)	/* called to decode a single scanline */
    fooDecodeStrip(...)	/* called to decode an entire strip */
    fooDecodeTile(...)	/* called to decode an entire tile */
fooPreEncode(tif)	/* called once per strip/tile, before the first row in
			   a strip is encoded */
fooEncode*(tif, bp, cc, sample)/* encode cc bytes of user data (bp) */
    fooEncodeRow(...)	/* called to decode a single scanline */
    fooEncodeStrip(...)	/* called to decode an entire strip */
    fooEncodeTile(...)	/* called to decode an entire tile */
fooPostEncode(tif)	/* called once per strip/tile, just before data is written */
fooSeek(tif, row)	/* seek forwards row scanlines from the beginning
			   of a strip (row will always be >0 and <rows/strip */
fooCleanup(tif)		/* called when compression scheme is replaced by user */

Note that the encoding and decoding variants are only needed when
a compression algorithm is dependent on the structure of the data.
For example, Group 3 2D encoding and decoding maintains a reference
scanline.  The sample parameter identifies which sample is to be
encoded or decoded if the image is organized with PlanarConfig=2
(separate planes).  This is important for algorithms such as JPEG.
If PlanarConfig=1 (interleaved), then sample will always be 0.

The library handles most I/O buffering.  There are two data buffers
when decoding data: a raw data buffer that holds all the data in a
strip, and a user-supplied scanline buffer that compression schemes
place decoded data into.  When encoding data the data in the
user-supplied scanline buffer is encoded into the raw data buffer (from
where it's written).  Decoding routines should never have to explicitly
read data -- a full strip/tile's worth of raw data is read and scanlines
never cross strip boundaries.  Encoding routines must be cognizant of
the raw data buffer size and call TIFFFlushData1() when necessary.
Note that any pending data is automatically flushed when a new strip/tile is
started, so there's no need do that in the tif_postencode routine (if
one exists).

The variables tif_rawcc, tif_rawdata, and tif_rawcp in a TIFF structure
are associated with the raw data buffer.  tif_rawcc must be non-zero
for the library to automatically flush data.  The variable
tif_scanlinesize is the size a user's scanline buffer should be.  The
variable tif_tilesize is the size of a tile for tiled images.  This
should not normally be used by compression routines, except where it
relates to the compression algorithm.  That is, the cc parameter to the
tif_decode* and tif_encode* routines should be used in terminating
decompression/compression.  This ensures these routines can be used,
for example, to decode/encode entire strips of data.

In general, if you have a new compression algorithm to add, work from
the code for an existing routine.  In particular, tiff_dumpmode.c has
the trivial code for the "nil" compression scheme, tiff_packbits.c is a
simple byte-oriented scheme that has to watch out for buffer
boundaries, and tiff_lzw.c has the LZW scheme that has the most
complexity -- it tracks the buffer boundary at a bit level.

Of course, using a private compression scheme (or private tags) limits
the portability of your TIFF files.

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.