diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/Makefile.in | 6 | ||||
-rw-r--r-- | tools/Makefile.lcc | 6 | ||||
-rw-r--r-- | tools/fax2ps.c | 6 | ||||
-rw-r--r-- | tools/fax2tiff.c | 6 | ||||
-rw-r--r-- | tools/gif2tiff.c | 13 | ||||
-rw-r--r-- | tools/pal2rgb.c | 6 | ||||
-rw-r--r-- | tools/ppm2tiff.c | 6 | ||||
-rw-r--r-- | tools/ras2tiff.c | 6 | ||||
-rw-r--r-- | tools/rasterfile.h | 2 | ||||
-rw-r--r-- | tools/rgb2ycbcr.c | 6 | ||||
-rw-r--r-- | tools/sgi2tiff.c | 6 | ||||
-rw-r--r-- | tools/sgigt.c | 18 | ||||
-rw-r--r-- | tools/sgisv.c | 6 | ||||
-rw-r--r-- | tools/thumbnail.c | 6 | ||||
-rw-r--r-- | tools/tiff2bw.c | 6 | ||||
-rw-r--r-- | tools/tiff2ps.c | 55 | ||||
-rw-r--r-- | tools/tiffcmp.c | 6 | ||||
-rw-r--r-- | tools/tiffcp.c | 71 | ||||
-rw-r--r-- | tools/tiffdither.c | 6 | ||||
-rw-r--r-- | tools/tiffdump.c | 8 | ||||
-rw-r--r-- | tools/tiffinfo.c | 6 | ||||
-rw-r--r-- | tools/tiffmedian.c | 9 | ||||
-rw-r--r-- | tools/tiffsplit.c | 6 |
23 files changed, 158 insertions, 114 deletions
diff --git a/tools/Makefile.in b/tools/Makefile.in index dc522592..cb0c13af 100644 --- a/tools/Makefile.in +++ b/tools/Makefile.in @@ -1,11 +1,11 @@ -# $Header: /usr/people/sam/tiff/tools/RCS/Makefile.in,v 1.21 1996/08/26 23:39:12 sam Exp $ +# $Header: /d1/sam/tiff/tools/RCS/Makefile.in,v 1.22 1997/08/29 21:46:45 sam Exp $ # # @WARNING@ # # TIFF Library Tools # -# 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 diff --git a/tools/Makefile.lcc b/tools/Makefile.lcc index 0e78b453..4e6643a1 100644 --- a/tools/Makefile.lcc +++ b/tools/Makefile.lcc @@ -1,9 +1,9 @@ -# $Header: /usr/people/sam/tiff/tools/RCS/Makefile.lcc,v 1.4 1996/01/10 19:35:26 sam Exp $ +# $Header: /d1/sam/tiff/tools/RCS/Makefile.lcc,v 1.5 1997/08/29 21:46:45 sam Exp $ # # TIFF Library Tools # -# 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 diff --git a/tools/fax2ps.c b/tools/fax2ps.c index 65f68c90..f2efa53a 100644 --- a/tools/fax2ps.c +++ b/tools/fax2ps.c @@ -1,8 +1,8 @@ -/* $Header: /usr/people/sam/tiff/tools/RCS/fax2ps.c,v 1.10 1996/04/29 21:58:49 sam Exp $" */ +/* $Header: /d1/sam/tiff/tools/RCS/fax2ps.c,v 1.11 1997/08/29 21:46:46 sam Exp $" */ /* - * Copyright (c) 1991-1996 Sam Leffler - * Copyright (c) 1991-1996 Silicon Graphics, Inc. + * Copyright (c) 1991-1997 Sam Leffler + * Copyright (c) 1991-1997 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided diff --git a/tools/fax2tiff.c b/tools/fax2tiff.c index 9ceb5278..941d7a0e 100644 --- a/tools/fax2tiff.c +++ b/tools/fax2tiff.c @@ -1,8 +1,8 @@ -/* $Header: /usr/people/sam/tiff/tools/RCS/fax2tiff.c,v 1.40 1996/01/10 19:35:27 sam Exp $ */ +/* $Header: /d1/sam/tiff/tools/RCS/fax2tiff.c,v 1.41 1997/08/29 21:46:46 sam Exp $ */ /* - * Copyright (c) 1990-1996 Sam Leffler - * Copyright (c) 1991-1996 Silicon Graphics, Inc. + * Copyright (c) 1990-1997 Sam Leffler + * Copyright (c) 1991-1997 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided diff --git a/tools/gif2tiff.c b/tools/gif2tiff.c index 263bcff7..e6691928 100644 --- a/tools/gif2tiff.c +++ b/tools/gif2tiff.c @@ -1,8 +1,8 @@ -/* $Header: /usr/people/sam/tiff/tools/RCS/gif2tiff.c,v 1.27 1996/04/22 22:03:26 sam Exp $ */ +/* $Header: /d1/sam/tiff/tools/RCS/gif2tiff.c,v 1.29 1997/08/29 21:46:46 sam Exp $ */ /* - * Copyright (c) 1990-1996 Sam Leffler - * Copyright (c) 1991-1996 Silicon Graphics, Inc. + * Copyright (c) 1990-1997 Sam Leffler + * Copyright (c) 1991-1997 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided @@ -450,8 +450,8 @@ void rasterize(int interleaved, char* mode) { register long row; - register unsigned char *rr; unsigned char *newras; + unsigned char *ras; TIFF *tif; tstrip_t strip; tsize_t stripsize; @@ -461,13 +461,12 @@ rasterize(int interleaved, char* mode) return; } #define DRAWSEGMENT(offset, step) { \ - register unsigned char* ras = raster; \ for (row = offset; row < height; row += step) { \ - rr = newras + row*width; \ - _TIFFmemcpy(rr, ras, width); \ + _TIFFmemcpy(newras + row*width, ras, width);\ ras += width; \ } \ } + ras = raster; if (interleaved) { DRAWSEGMENT(0, 8); DRAWSEGMENT(4, 8); diff --git a/tools/pal2rgb.c b/tools/pal2rgb.c index fced076c..9b853182 100644 --- a/tools/pal2rgb.c +++ b/tools/pal2rgb.c @@ -1,8 +1,8 @@ -/* $Header: /usr/people/sam/tiff/tools/RCS/pal2rgb.c,v 1.30 1996/06/20 18:55:15 sam Exp $ */ +/* $Header: /d1/sam/tiff/tools/RCS/pal2rgb.c,v 1.31 1997/08/29 21:46:47 sam 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 diff --git a/tools/ppm2tiff.c b/tools/ppm2tiff.c index b53e06b7..489cb9fa 100644 --- a/tools/ppm2tiff.c +++ b/tools/ppm2tiff.c @@ -1,8 +1,8 @@ -/* $Header: /usr/people/sam/tiff/tools/RCS/ppm2tiff.c,v 1.26 1996/04/22 22:03:26 sam Exp $ */ +/* $Header: /d1/sam/tiff/tools/RCS/ppm2tiff.c,v 1.27 1997/08/29 21:46:47 sam Exp $ */ /* - * Copyright (c) 1991-1996 Sam Leffler - * Copyright (c) 1991-1996 Silicon Graphics, Inc. + * Copyright (c) 1991-1997 Sam Leffler + * Copyright (c) 1991-1997 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided diff --git a/tools/ras2tiff.c b/tools/ras2tiff.c index 467f0e85..86b9168d 100644 --- a/tools/ras2tiff.c +++ b/tools/ras2tiff.c @@ -1,8 +1,8 @@ -/* $Header: /usr/people/sam/tiff/tools/RCS/ras2tiff.c,v 1.30 1996/06/10 20:47:54 sam Exp $ */ +/* $Header: /d1/sam/tiff/tools/RCS/ras2tiff.c,v 1.31 1997/08/29 21:46:48 sam 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 diff --git a/tools/rasterfile.h b/tools/rasterfile.h index 30c09a7c..1ebf3528 100644 --- a/tools/rasterfile.h +++ b/tools/rasterfile.h @@ -1,4 +1,4 @@ -/* $Header: /usr/people/sam/tiff/tools/RCS/rasterfile.h,v 1.1 1990/10/08 17:24:23 sam Exp $ */ +/* $Header: /d1/sam/tiff/tools/RCS/rasterfile.h,v 1.1 1990/10/08 17:24:23 sam Exp $ */ /* * Description of header for files containing raster images diff --git a/tools/rgb2ycbcr.c b/tools/rgb2ycbcr.c index 925efe0a..f08fae2f 100644 --- a/tools/rgb2ycbcr.c +++ b/tools/rgb2ycbcr.c @@ -1,8 +1,8 @@ -/* $Header: /usr/people/sam/tiff/tools/RCS/rgb2ycbcr.c,v 1.28 1996/06/10 20:47:54 sam Exp $ */ +/* $Header: /d1/sam/tiff/tools/RCS/rgb2ycbcr.c,v 1.29 1997/08/29 21:46:48 sam Exp $ */ /* - * Copyright (c) 1991-1996 Sam Leffler - * Copyright (c) 1991-1996 Silicon Graphics, Inc. + * Copyright (c) 1991-1997 Sam Leffler + * Copyright (c) 1991-1997 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided diff --git a/tools/sgi2tiff.c b/tools/sgi2tiff.c index 01d3d7c6..dbe30cf5 100644 --- a/tools/sgi2tiff.c +++ b/tools/sgi2tiff.c @@ -1,8 +1,8 @@ -/* $Header: /usr/people/sam/tiff/tools/RCS/sgi2tiff.c,v 1.26 1996/01/10 19:35:31 sam Exp $ */ +/* $Header: /d1/sam/tiff/tools/RCS/sgi2tiff.c,v 1.27 1997/08/29 21:46:49 sam Exp $ */ /* - * Copyright (c) 1991-1996 Sam Leffler - * Copyright (c) 1991-1996 Silicon Graphics, Inc. + * Copyright (c) 1991-1997 Sam Leffler + * Copyright (c) 1991-1997 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided diff --git a/tools/sgigt.c b/tools/sgigt.c index 98f04cd4..d9d14d46 100644 --- a/tools/sgigt.c +++ b/tools/sgigt.c @@ -1,8 +1,8 @@ -/* $Header: /usr/people/sam/tiff/tools/RCS/sgigt.c,v 1.67 1996/11/11 16:18:16 sam Exp $ */ +/* $Header: /d1/sam/tiff/tools/RCS/sgigt.c,v 1.70 1997/08/31 23:54:02 sam 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 @@ -183,7 +183,8 @@ main(int argc, char* argv[]) (img.photometric == PHOTOMETRIC_RGB || img.photometric == PHOTOMETRIC_YCBCR || img.photometric == PHOTOMETRIC_SEPARATED || - img.photometric == PHOTOMETRIC_PALETTE)); + img.photometric == PHOTOMETRIC_PALETTE || + img.photometric == PHOTOMETRIC_LOGLUV)); /* * Check to see if the hardware can display 24-bit RGB. */ @@ -545,6 +546,10 @@ photoArg(const char* arg) return (PHOTOMETRIC_YCBCR); else if (strcmp(arg, "cielab") == 0) return (PHOTOMETRIC_CIELAB); + else if (strcmp(arg, "logl") == 0) + return (PHOTOMETRIC_LOGL); + else if (strcmp(arg, "logluv") == 0) + return (PHOTOMETRIC_LOGLUV); else return ((uint16) -1); } @@ -575,9 +580,9 @@ putSeparateAndDraw(TIFFRGBAImage* img, uint32* raster, if (x+w == width) { w = width; if (img->orientation == ORIENTATION_TOPLEFT) - lrectwrite(x, y-(h-1), w-1, y, raster-x-(h-1)*w); + lrectwrite(0, y-(h-1), w-1, y, raster-x-(h-1)*w); else - lrectwrite(x, y, w-1, y+h-1, raster); + lrectwrite(0, y, w-1, y+h-1, raster); } } @@ -938,6 +943,7 @@ setupColormapSupport(TIFFRGBAImage* img) } else if (img->isContig) { switch (img->photometric) { case PHOTOMETRIC_RGB: + case PHOTOMETRIC_LOGLUV: switch (bitspersample) { case 8: img->put.contig = putcontig8bittile; break; case 16: img->put.contig = putcontig16bittile; break; diff --git a/tools/sgisv.c b/tools/sgisv.c index 3b14ff11..3fd937eb 100644 --- a/tools/sgisv.c +++ b/tools/sgisv.c @@ -1,8 +1,8 @@ -/* $Header: /usr/people/sam/tiff/tools/RCS/sgisv.c,v 1.25 1996/01/10 19:35:33 sam Exp $ */ +/* $Header: /d1/sam/tiff/tools/RCS/sgisv.c,v 1.26 1997/08/29 21:46:50 sam Exp $ */ /* - * Copyright (c) 1990-1996 Sam Leffler - * Copyright (c) 1991-1996 Silicon Graphics, Inc. + * Copyright (c) 1990-1997 Sam Leffler + * Copyright (c) 1991-1997 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided diff --git a/tools/thumbnail.c b/tools/thumbnail.c index a5f72cdb..d55c5f1b 100644 --- a/tools/thumbnail.c +++ b/tools/thumbnail.c @@ -1,8 +1,8 @@ -/* $Header: /usr/people/sam/tiff/tools/RCS/thumbnail.c,v 1.11 1996/01/10 19:35:33 sam Exp $ */ +/* $Header: /d1/sam/tiff/tools/RCS/thumbnail.c,v 1.12 1997/08/29 21:46:50 sam Exp $ */ /* - * Copyright (c) 1994-1996 Sam Leffler - * Copyright (c) 1994-1996 Silicon Graphics, Inc. + * Copyright (c) 1994-1997 Sam Leffler + * Copyright (c) 1994-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 diff --git a/tools/tiff2bw.c b/tools/tiff2bw.c index c0f0945c..3455f5c8 100644 --- a/tools/tiff2bw.c +++ b/tools/tiff2bw.c @@ -1,8 +1,8 @@ -/* $Header: /usr/people/sam/tiff/tools/RCS/tiff2bw.c,v 1.21 1996/01/10 19:35:34 sam Exp $ */ +/* $Header: /d1/sam/tiff/tools/RCS/tiff2bw.c,v 1.22 1997/08/29 21:46:50 sam 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 diff --git a/tools/tiff2ps.c b/tools/tiff2ps.c index 2ceab788..b0f0d032 100644 --- a/tools/tiff2ps.c +++ b/tools/tiff2ps.c @@ -1,8 +1,8 @@ -/* $Header: /usr/people/sam/tiff/tools/RCS/tiff2ps.c,v 1.51 1997/02/20 20:15:03 sam Exp $ */ +/* $Header: /d1/sam/tiff/tools/RCS/tiff2ps.c,v 1.53 1997/08/29 21:46:51 sam 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 @@ -174,15 +174,6 @@ static int alpha; static int checkImage(TIFF* tif) { - switch (bitspersample) { - case 1: case 2: - case 4: case 8: - break; - default: - TIFFError(filename, "Can not handle %d-bit/sample image", - bitspersample); - return (0); - } switch (photometric) { case PHOTOMETRIC_YCBCR: if (compression == COMPRESSION_JPEG && @@ -212,6 +203,23 @@ checkImage(TIFF* tif) case PHOTOMETRIC_MINISBLACK: case PHOTOMETRIC_MINISWHITE: break; + case PHOTOMETRIC_LOGL: + case PHOTOMETRIC_LOGLUV: + if (compression != COMPRESSION_SGILOG && + compression != COMPRESSION_SGILOG24) { + TIFFError(filename, + "Can not handle %s data with compression other than SGILog", + (photometric == PHOTOMETRIC_LOGL) ? + "LogL" : "LogLuv" + ); + return (0); + } + /* rely on library to convert to RGB/greyscale */ + TIFFSetField(tif, TIFFTAG_SGILOGDATAFMT, SGILOGDATAFMT_8BIT); + photometric = (photometric == PHOTOMETRIC_LOGL) ? + PHOTOMETRIC_MINISBLACK : PHOTOMETRIC_RGB; + bitspersample = 8; + break; case PHOTOMETRIC_CIELAB: /* fall thru... */ default: @@ -220,6 +228,15 @@ checkImage(TIFF* tif) photometric); return (0); } + switch (bitspersample) { + case 1: case 2: + case 4: case 8: + break; + default: + TIFFError(filename, "Can not handle %d-bit/sample image", + bitspersample); + return (0); + } if (planarconfiguration == PLANARCONFIG_SEPARATE && extrasamples > 0) TIFFWarning(filename, "Ignoring extra samples"); return (1); @@ -336,7 +353,6 @@ TIFF2PS(FILE* fd, TIFF* tif, float pw, float ph) setupPageState(tif, &w, &h, &prw, &prh); if (!npages) PSHead(fd, tif, w, h, prw, prh, ox, oy); - tf_bytesperrow = TIFFScanlineSize(tif); TIFFGetFieldDefaulted(tif, TIFFTAG_BITSPERSAMPLE, &bitspersample); TIFFGetFieldDefaulted(tif, TIFFTAG_SAMPLESPERPIXEL, @@ -362,6 +378,7 @@ TIFF2PS(FILE* fd, TIFF* tif, float pw, float ph) } } if (checkImage(tif)) { + tf_bytesperrow = TIFFScanlineSize(tif); npages++; fprintf(fd, "%%%%Page: %d %d\n", npages, npages); fprintf(fd, "gsave\n"); @@ -688,7 +705,7 @@ PS_Lvl2ImageDict(FILE* fd, TIFF* tif, uint32 w, uint32 h) use_rawdata = TRUE; switch (compression) { - case COMPRESSION_NONE: /* 1: uncompressed */ + case COMPRESSION_NONE: /* 1: uncompressed */ break; case COMPRESSION_CCITTRLE: /* 2: CCITT modified Huffman RLE */ case COMPRESSION_CCITTRLEW: /* 32771: #1 w/ word alignment */ @@ -746,12 +763,12 @@ PS_Lvl2ImageDict(FILE* fd, TIFF* tif, uint32 w, uint32 h) } fputs(" /LZWDecode filter", fd); break; - case COMPRESSION_PACKBITS: /* 32773: Macintosh RLE */ + case COMPRESSION_PACKBITS: /* 32773: Macintosh RLE */ fputs(" /RunLengthDecode filter", fd); use_rawdata = TRUE; break; - case COMPRESSION_OJPEG: /* 6: !6.0 JPEG */ - case COMPRESSION_JPEG: /* 7: %JPEG DCT compression */ + case COMPRESSION_OJPEG: /* 6: !6.0 JPEG */ + case COMPRESSION_JPEG: /* 7: %JPEG DCT compression */ #ifdef notdef /* * Code not tested yet @@ -769,6 +786,10 @@ PS_Lvl2ImageDict(FILE* fd, TIFF* tif, uint32 w, uint32 h) case COMPRESSION_JBIG: /* 34661: ISO JBIG */ use_rawdata = FALSE; break; + case COMPRESSION_SGILOG: /* 34676: SGI LogL or LogLuv */ + case COMPRESSION_SGILOG24: /* 34677: SGI 24-bit LogLuv */ + use_rawdata = FALSE; + break; default: /* * ERROR... diff --git a/tools/tiffcmp.c b/tools/tiffcmp.c index 570611ab..81b84e3d 100644 --- a/tools/tiffcmp.c +++ b/tools/tiffcmp.c @@ -1,8 +1,8 @@ -/* $Header: /usr/people/sam/tiff/tools/RCS/tiffcmp.c,v 1.29 1996/01/10 19:35:36 sam Exp $ */ +/* $Header: /d1/sam/tiff/tools/RCS/tiffcmp.c,v 1.30 1997/08/29 21:46:51 sam 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 diff --git a/tools/tiffcp.c b/tools/tiffcp.c index ef155698..fc9ea4b8 100644 --- a/tools/tiffcp.c +++ b/tools/tiffcp.c @@ -1,8 +1,8 @@ -/* $Header: /usr/people/sam/tiff/tools/RCS/tiffcp.c,v 1.51 1996/12/13 05:22:37 sam Exp $ */ +/* $Header: /d1/sam/tiff/tools/RCS/tiffcp.c,v 1.54 1997/09/01 03:22:05 sam 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 @@ -205,11 +205,11 @@ processG3Options(char* cp) static int processCompressOptions(char* opt) { - if (streq(opt, "none")) + if (streq(opt, "none")) { defcompression = COMPRESSION_NONE; - else if (streq(opt, "packbits")) + } else if (streq(opt, "packbits")) { defcompression = COMPRESSION_PACKBITS; - else if (strneq(opt, "jpeg", 4)) { + } else if (strneq(opt, "jpeg", 4)) { char* cp = strchr(opt, ':'); if (cp && isdigit(cp[1])) quality = atoi(cp+1); @@ -219,9 +219,9 @@ processCompressOptions(char* opt) } else if (strneq(opt, "g3", 2)) { processG3Options(opt); defcompression = COMPRESSION_CCITTFAX3; - } else if (streq(opt, "g4")) + } else if (streq(opt, "g4")) { defcompression = COMPRESSION_CCITTFAX4; - else if (strneq(opt, "lzw", 3)) { + } else if (strneq(opt, "lzw", 3)) { char* cp = strchr(opt, ':'); if (cp) defpredictor = atoi(cp+1); @@ -410,6 +410,7 @@ static struct cpTag { { TIFFTAG_EXTRASAMPLES, (uint16) -1, TIFF_SHORT }, { TIFFTAG_SMINSAMPLEVALUE, 1, TIFF_DOUBLE }, { TIFFTAG_SMAXSAMPLEVALUE, 1, TIFF_DOUBLE }, + { TIFFTAG_STONITS, 1, TIFF_DOUBLE }, }; #define NTAGS (sizeof (tags) / sizeof (tags[0])) @@ -430,19 +431,23 @@ tiffcp(TIFF* in, TIFF* out) CopyField(TIFFTAG_IMAGEWIDTH, w); CopyField(TIFFTAG_IMAGELENGTH, l); CopyField(TIFFTAG_BITSPERSAMPLE, bitspersample); + CopyField(TIFFTAG_SAMPLESPERPIXEL, samplesperpixel); if (compression != (uint16)-1) TIFFSetField(out, TIFFTAG_COMPRESSION, compression); else CopyField(TIFFTAG_COMPRESSION, compression); if (compression == COMPRESSION_JPEG && jpegcolormode == JPEGCOLORMODE_RGB) TIFFSetField(out, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_YCBCR); + else if (compression == COMPRESSION_SGILOG || compression == COMPRESSION_SGILOG24) + TIFFSetField(out, TIFFTAG_PHOTOMETRIC, + samplesperpixel == 1 ? + PHOTOMETRIC_LOGL : PHOTOMETRIC_LOGLUV); else CopyTag(TIFFTAG_PHOTOMETRIC, 1, TIFF_SHORT); if (fillorder != 0) TIFFSetField(out, TIFFTAG_FILLORDER, fillorder); else CopyTag(TIFFTAG_FILLORDER, 1, TIFF_SHORT); - CopyField(TIFFTAG_SAMPLESPERPIXEL, samplesperpixel); /* * Choose tiles/strip for the output image according to * the command line arguments (-tiles, -strips) and the @@ -882,35 +887,44 @@ done: DECLAREwriteFunc(writeBufferToContigStrips) { - tsize_t scanline = TIFFScanlineSize(out); - uint32 row; + uint32 row, rowsperstrip; + tstrip_t strip = 0; (void) imagewidth; (void) spp; - for (row = 0; row < imagelength; row++) { - if (TIFFWriteScanline(out, buf, row, 0) < 0) + (void) TIFFGetFieldDefaulted(out, TIFFTAG_ROWSPERSTRIP, &rowsperstrip); + for (row = 0; row < imagelength; row += rowsperstrip) { + uint32 nrows = (row+rowsperstrip > imagelength) ? + imagelength-row : rowsperstrip; + tsize_t stripsize = TIFFVStripSize(out, nrows); + if (TIFFWriteEncodedStrip(out, strip++, buf, stripsize) < 0) return (FALSE); - buf += scanline; + row += rowsperstrip, buf += stripsize; } return (TRUE); } DECLAREwriteFunc(writeBufferToSeparateStrips) { - tdata_t obuf = _TIFFmalloc(TIFFScanlineSize(out)); + uint32 rowsize = imagewidth * spp; + uint32 rowsperstrip; + tdata_t obuf = _TIFFmalloc(TIFFStripSize(out)); + tstrip_t strip = 0; tsample_t s; if (obuf == NULL) return (0); + (void) TIFFGetFieldDefaulted(out, TIFFTAG_ROWSPERSTRIP, &rowsperstrip); for (s = 0; s < spp; s++) { uint32 row; - for (row = 0; row < imagelength; row++) { - uint8* inp = ((uint8*) buf) + s; - uint8* outp = (uint8*) obuf; - uint32 n = imagewidth; - - while (n-- > 0) - *outp++ = *inp, inp += spp; - if (TIFFWriteScanline(out, obuf, row, s) < 0) { + for (row = 0; row < imagelength; row += rowsperstrip) { + uint32 nrows = (row+rowsperstrip > imagelength) ? + imagelength-row : rowsperstrip; + tsize_t stripsize = TIFFVStripSize(out, nrows); + + cpContigBufToSeparateBuf( + obuf, (uint8*) buf + row*rowsize + s, + nrows, imagewidth, 0, 0, spp); + if (TIFFWriteEncodedStrip(out, strip++, obuf, stripsize) < 0) { _TIFFfree(obuf); return (FALSE); } @@ -970,7 +984,8 @@ DECLAREwriteFunc(writeBufferToSeparateTiles) { uint32 imagew = TIFFScanlineSize(out); tsize_t tilew = TIFFTileRowSize(out); - int iskew = imagew - tilew; + uint32 iimagew = TIFFRasterScanlineSize(out); + int iskew = iimagew - tilew*spp; tdata_t obuf = _TIFFmalloc(TIFFTileSize(out)); uint8* bufp = (uint8*) buf; uint32 tl, tw; @@ -997,12 +1012,12 @@ DECLAREwriteFunc(writeBufferToSeparateTiles) int oskew = tilew - width; cpContigBufToSeparateBuf(obuf, - bufp + colb + s, + bufp + (colb*spp) + s, nrow, width, - oskew/spp, oskew + imagew, spp); + oskew, (oskew*spp)+iskew, spp); } else cpContigBufToSeparateBuf(obuf, - bufp + colb + s, + bufp + (colb*spp) + s, nrow, tilewidth, 0, iskew, spp); if (TIFFWriteTile(out, obuf, col, row, 0, s) < 0) { @@ -1012,7 +1027,7 @@ DECLAREwriteFunc(writeBufferToSeparateTiles) } colb += tilew; } - bufp += nrow * imagew; + bufp += nrow * iimagew; } _TIFFfree(obuf); return (TRUE); diff --git a/tools/tiffdither.c b/tools/tiffdither.c index cf1e671f..524de264 100644 --- a/tools/tiffdither.c +++ b/tools/tiffdither.c @@ -1,8 +1,8 @@ -/* $Header: /usr/people/sam/tiff/tools/RCS/tiffdither.c,v 1.26 1996/01/10 19:35:37 sam Exp $ */ +/* $Header: /d1/sam/tiff/tools/RCS/tiffdither.c,v 1.27 1997/08/29 21:46:52 sam 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 diff --git a/tools/tiffdump.c b/tools/tiffdump.c index 883d87d9..3ff9f595 100644 --- a/tools/tiffdump.c +++ b/tools/tiffdump.c @@ -1,8 +1,8 @@ -/* $Header: /usr/people/sam/tiff/tools/RCS/tiffdump.c,v 1.51 1996/12/13 04:47:56 sam Exp $ */ +/* $Header: /d1/sam/tiff/tools/RCS/tiffdump.c,v 1.53 1997/08/29 21:46:53 sam 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 @@ -318,6 +318,7 @@ ReadDirectory(int fd, unsigned ix, uint32 off) space = dp->tdir_count * datawidth[dp->tdir_type]; if (space <= 4) { switch (dp->tdir_type) { + case TIFF_FLOAT: case TIFF_UNDEFINED: case TIFF_ASCII: { unsigned char data[4]; @@ -464,6 +465,7 @@ static struct tagname { { TIFFTAG_COPYRIGHT, "Copyright" }, { TIFFTAG_ICCPROFILE, "ICC Profile" }, { TIFFTAG_JBIGOPTIONS, "JBIG Options" }, + { TIFFTAG_STONITS, "StoNits" }, }; #define NTAGS (sizeof (tagnames) / sizeof (tagnames[0])) diff --git a/tools/tiffinfo.c b/tools/tiffinfo.c index 3a30909e..01e66d83 100644 --- a/tools/tiffinfo.c +++ b/tools/tiffinfo.c @@ -1,8 +1,8 @@ -/* $Header: /usr/people/sam/tiff/tools/RCS/tiffinfo.c,v 1.27 1997/01/27 22:54:52 sam Exp $ */ +/* $Header: /d1/sam/tiff/tools/RCS/tiffinfo.c,v 1.28 1997/08/29 21:46:54 sam 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 diff --git a/tools/tiffmedian.c b/tools/tiffmedian.c index 967bb185..31eaca47 100644 --- a/tools/tiffmedian.c +++ b/tools/tiffmedian.c @@ -1,4 +1,4 @@ -/* $Header: /usr/people/sam/tiff/tools/RCS/tiffmedian.c,v 1.18 1995/10/10 00:35:22 sam Exp $ */ +/* $Header: /d1/sam/tiff/tools/RCS/tiffmedian.c,v 1.19 1997/08/29 22:35:33 sam Exp $ */ /* * Apply median cut on an image. @@ -806,10 +806,11 @@ quant_fsdither(TIFF* in, TIFF* out) outline = (unsigned char *) _TIFFmalloc(TIFFScanlineSize(out)); GetInputLine(in, 0, goto bad); /* get first line */ - for (i = 1; i < imagelength; ++i) { + for (i = 1; i <= imagelength; ++i) { SWAP(short *, thisline, nextline); - lastline = (i == imax); - GetInputLine(in, i, break); + lastline = (i >= imax); + if (i <= imax) + GetInputLine(in, i, break); thisptr = thisline; nextptr = nextline; outptr = outline; diff --git a/tools/tiffsplit.c b/tools/tiffsplit.c index 48baf8ec..6bdd5215 100644 --- a/tools/tiffsplit.c +++ b/tools/tiffsplit.c @@ -1,8 +1,8 @@ -/* $Header: /usr/people/sam/tiff/tools/RCS/tiffsplit.c,v 1.13 1996/01/10 19:35:40 sam Exp $ */ +/* $Header: /d1/sam/tiff/tools/RCS/tiffsplit.c,v 1.14 1997/08/29 21:46:55 sam Exp $ */ /* - * Copyright (c) 1992-1996 Sam Leffler - * Copyright (c) 1992-1996 Silicon Graphics, Inc. + * Copyright (c) 1992-1997 Sam Leffler + * Copyright (c) 1992-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 |