preliminary support for MS MDI format, bug 1002

This commit is contained in:
Frank Warmerdam 2005-11-21 03:35:05 +00:00
parent 7fd3fba4f3
commit b86f199feb
6 changed files with 340 additions and 178 deletions

View File

@ -1,5 +1,9 @@
2005-11-20 Frank Warmerdam <warmerdam@pobox.com>
* tif_open.c, tiff.h, tiffdump.c: Incorporate preliminary support
for MS MDI format.
http://bugzilla.remotesensing.org/show_bug.cgi?id=1002
* .cvsignore: many files added, and a few update according
to suggestion of Brad HArds on tiff mailing list.

461
configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -251,6 +251,19 @@ if test "$HAVE_LOGLUV" = "yes" ; then
AC_DEFINE(LOGLUV_SUPPORT,1,[Support LogLuv high dynamic range encoding])
fi
dnl ---------------------------------------------------------------------------
dnl Switch on/off support for Microsoft Document Imaging
dnl ---------------------------------------------------------------------------
AC_ARG_ENABLE(mdi,
AS_HELP_STRING([--disable-mdi],
[disable support for Microsoft Document Imaging]),
[HAVE_MDI=$enableval], [HAVE_MDI=yes])
if test "$HAVE_MDI" = "yes" ; then
AC_DEFINE(MDI_SUPPORT,1,[Support Microsoft Document Imaging format])
fi
dnl ---------------------------------------------------------------------------
dnl Check for ZLIB.
dnl ---------------------------------------------------------------------------
@ -529,6 +542,7 @@ LOC_MSG([ Documentation directory: ${LIBTIFF_DOCDIR}])
LOC_MSG([ C compiler: ${CC} ${CFLAGS}])
LOC_MSG([ C++ compiler: ${CXX} ${CXXFLAGS}])
LOC_MSG([ Enable runtime linker paths: ${HAVE_RPATH}])
LOC_MSG([ Support Microsoft Document Imaging: ${HAVE_MDI}])
LOC_MSG()
LOC_MSG([ Support for internal codecs:])
LOC_MSG([ CCITT Group 3 & 4 algorithms: ${HAVE_CCITT}])

View File

@ -1,4 +1,4 @@
/* $Id: tif_open.c,v 1.27 2005-09-12 16:31:04 fwarmerdam Exp $ */
/* $Id: tif_open.c,v 1.28 2005-11-21 03:35:05 fwarmerdam Exp $ */
/*
* Copyright (c) 1988-1997 Sam Leffler
@ -357,8 +357,20 @@ TIFFClientOpen(
* Setup the byte order handling.
*/
if (tif->tif_header.tiff_magic != TIFF_BIGENDIAN &&
tif->tif_header.tiff_magic != TIFF_LITTLEENDIAN) {
tif->tif_header.tiff_magic != TIFF_LITTLEENDIAN
#if MDI_SUPPORT
&&
#if HOST_BIGENDIAN
tif->tif_header.tiff_magic != MDI_BIGENDIAN
#else
tif->tif_header.tiff_magic != MDI_LITTLEENDIAN
#endif
) {
TIFFError(name, "Not a TIFF or MDI file, bad magic number %d (0x%x)",
#else
) {
TIFFError(name, "Not a TIFF file, bad magic number %d (0x%x)",
#endif
tif->tif_header.tiff_magic,
tif->tif_header.tiff_magic);
goto bad;

View File

@ -1,4 +1,4 @@
/* $Id: tiff.h,v 1.38 2005-07-26 10:33:57 dron Exp $ */
/* $Id: tiff.h,v 1.39 2005-11-21 03:35:05 fwarmerdam Exp $ */
/*
* Copyright (c) 1988-1997 Sam Leffler
@ -50,7 +50,8 @@
#define TIFF_BIGENDIAN 0x4d4d
#define TIFF_LITTLEENDIAN 0x4949
#define MDI_LITTLEENDIAN 0x5045
#define MDI_BIGENDIAN 0x4550
/*
* Intrinsic data types required by the file format:
*

View File

@ -1,4 +1,4 @@
/* $Id: tiffdump.c,v 1.12 2005-10-31 13:08:19 dron Exp $ */
/* $Id: tiffdump.c,v 1.13 2005-11-21 03:35:06 fwarmerdam Exp $ */
/*
* Copyright (c) 1988-1997 Sam Leffler
@ -162,7 +162,7 @@ InitByteOrder(int magic)
typeshift[ord(TIFF_SRATIONAL)] = 0;
typeshift[ord(TIFF_FLOAT)] = 0;
typeshift[ord(TIFF_DOUBLE)] = 0;
if (magic == TIFF_BIGENDIAN) {
if (magic == TIFF_BIGENDIAN || magic == MDI_BIGENDIAN) {
typeshift[ord(TIFF_BYTE)] = 24;
typeshift[ord(TIFF_SBYTE)] = 24;
typeshift[ord(TIFF_SHORT)] = 16;
@ -193,8 +193,14 @@ dump(int fd, off_t diroff)
/*
* Setup the byte order handling.
*/
if (hdr.tiff_magic != TIFF_BIGENDIAN && hdr.tiff_magic != TIFF_LITTLEENDIAN)
Fatal("Not a TIFF file, bad magic number %u (%#x)",
if (hdr.tiff_magic != TIFF_BIGENDIAN && hdr.tiff_magic != TIFF_LITTLEENDIAN &&
#if HOST_BIGENDIAN
// MDI is sensitive to the host byte order, unlike TIFF
MDI_BIGENDIAN != hdr.tiff_magic )
#else
MDI_LITTLEENDIAN != hdr.tiff_magic )
#endif
Fatal("Not a TIFF or MDI file, bad magic number %u (%#x)",
hdr.tiff_magic, hdr.tiff_magic);
InitByteOrder(hdr.tiff_magic);
/*
@ -520,7 +526,7 @@ PrintByte(FILE* fd, const char* fmt, TIFFDirEntry* dp)
{
char* sep = "";
if (hdr.tiff_magic != TIFF_LITTLEENDIAN) {
if (hdr.tiff_magic == TIFF_BIGENDIAN) {
switch ((int)dp->tdir_count) {
case 4: fprintf(fd, fmt, sep, dp->tdir_offset&0xff);
sep = " ";
@ -548,7 +554,7 @@ PrintShort(FILE* fd, const char* fmt, TIFFDirEntry* dp)
{
char *sep = "";
if (hdr.tiff_magic != TIFF_LITTLEENDIAN) {
if (hdr.tiff_magic == TIFF_BIGENDIAN) {
switch (dp->tdir_count) {
case 2: fprintf(fd, fmt, sep, dp->tdir_offset&0xffff);
sep = " ";