1994.06.29 10:17 "tiff "Bugs and such" v3.3beta002", by Lars Farm

1994.06.29 10:17 "tiff "Bugs and such" v3.3beta002", by Lars Farm

I picked up libtiff and have one small and fixed bug to report, a possible bug and a couple of problems that might be bad example images, problems with libtiff or my bugs. I want to know if the images are known to be good or bad.

First, may I ask about faxcompression?

I noticed that for the (Mac)-MPW port fax compression was excluded. This is because of the very large state tables in g3states.h. Using Metrowerks Codewarrior on Macintosh I had no problem compiling, but I get some 140000 bytes of global data in tif_fax3.c. I think this is rather a bit on the much side. Is there a leaner "tif_fax3.c" or a leaner way to do fax (de-)compression? sources available?

Lars Farm

Problems in (v3.3beta002.src.tar.Z):

====================================

-- Problem # 1: tif_dir.c
-- there seems to be a misspelled variable in...

static int
TIFFSetField1(TIFF* tif, ttag_t tag, va_list ap)
{
/* around line 381: */
    case TIFFTAG_TILEDEPTH:
        v32 = va_arg(ap, uint32);
//+++   if (v == 0)
        if ( v32 == 0 )         // seems to work better...
            goto badvalue32;
        td->td_tiledepth = v32;
        break;

This is running on a (68K)Macintosh using Metrowerks C/C++ (compiler set to 16-bit ints (default on this compiler for 68K)).

-- (possible?) Problem # 2: tif_dir.c
-- (I don't know how many bits are needed at most.)

static int
TIFFSetField1(TIFF* tif, ttag_t tag, va_list ap)
{
/* around line 339:
   will 1L<<td->td_bitspersample always fit into a signed 16-bit int? */

    case TIFFTAG_COLORMAP:
        v = 1L<<td->td_bitspersample;
        setShortArray(&td->td_colormap[0], va_arg(ap, uint16*), v);
        setShortArray(&td->td_colormap[1], va_arg(ap, uint16*), v);
        setShortArray(&td->td_colormap[2], va_arg(ap, uint16*), v);
        break;

fix(?): use v32 instead of v.

-- (possible?) Problem # 3: example tiff images

with the change above (and a bit of tweeking in tiffdump (ansi-i/o instead of unix-i/o)) tiffdump and tiffinfo might work. I say might because they complain about several of the example tiff-images. Is this (1) right, (2) indication of other problems in libtiff or (3) user bugs? Well, the question is: Are these images known to be correct or known to be bad?

What follows is example outputs from tiffdump and tiffinfo:

from tiffdump:

- cramps.tif    DocumentName    (  269) SHORT     ( 3) 1:<1>
- fax2d.tif     DocumentName    (  269) SHORT     ( 3) 1:<2>
- text.tif      DocumentName    (  269) SHORT     ( 3) 1:<1>
                DocumentName    (  269) SHORT     ( 3) 1:<1>
                (text.tif has two directories)

I would have thought docname should be ascii, tiffinfo complains to (is ascii ascii (7bit) or are you allowed to use the whole alphabet - 8bit?)

- jim___dg.tif
Directory 1: offset 327962 (0x5011a)

Munin:untitled folder:pics:jim___dg.tif: Error while reading directory count.

327962 is the file size so there can't be another dir after the file.

- oxford.tif
  tiffinfo

Sleipner:pics:oxford.tif: Warning, invalid TIFF directory; tags are not
sorted in ascending order.
Sleipner:pics:oxford.tif: Warning, unknown field with tag 0 (0x0) ignored.
Sleipner:pics:oxford.tif: Warning, unknown field with tag 8 (0x8) ignored.
Sleipner:pics:oxford.tif: Warning, unknown field with tag 247 (0xf7) ignored.

TIFF Directory at offset 0x0
    Image Width: 601 Image Length: 81
    Bits/Sample: 8
    Compression Scheme: Lempel-Ziv & Welch encoding
    Photometric Interpretation: RGB color
    Samples/Pixel: 3
    Rows/Strip: 1
    Planar Configuration: separate image planes

Sleipner:pics:oxford.tif: Seek error accessing TIFF directory.

  tiffdump:

Sleipner:pics:oxford.tif:
Magic: 0x4d4d <big-endian> Version: 0x2a
Directory 0: offset 19094 (0x4a96)
ImageWidth               (  256) SHORT     ( 3) 1:<601>
ImageLength              (  257) SHORT     ( 3) 1:<81>
BitsPerSample            (  258) SHORT     ( 3) 3:<8 8 8>
Compression              (  259) SHORT     ( 3) 1:<5>
Photometric              (  262) SHORT     ( 3) 1:<2>
StripOffsets             (  273) LONG      ( 4) 243:<...>
SamplesPerPixel          (  277) SHORT     ( 3) 1:<3>
RowsPerStrip             (  278) LONG      ( 4) 1:<1>
StripByteCounts          (  279) LONG      ( 4) 243:<...>
PlanarConfig             (  284) SHORT     ( 3) 1:<2>
0 (0x0) 0         ( 0) 524296:<>
8 (0x8) 0         ( 0) 6291456:<>
247 (0xf7) 0         ( 0) 20578304:<>

Directory 1: offset 28901376 (0x1b90000) Sleipner:pics:oxford.tif: Seek error accessing TIFF directory.

file size is 21170 bytes

- ycbcr-cat.tif
  tiffinfo says:

Sleipner:pics:ycbcr-cat.tif: Warning, incorrect count for field "StripOffsets" (33, expecting 25); tag ignored. and then silence....

  tiffdump says:

Sleipner:pics:ycbcr-cat.tif:
Magic: 0x4d4d <big-endian> Version: 0x2a
Directory 0: offset 72198 (0x11a06)
ImageWidth             (  256) SHORT     ( 3) 1<250>
ImageLength            (  257) SHORT     ( 3) 1<325>
BitsPerSample          (  258) SHORT     ( 3) 3<8 8 8>
Compression            (  259) SHORT     ( 3) 1<5>
Photometric            (  262) SHORT     ( 3) 1<6>
ImageDescription       (  270) ASCII     ( 2) 28<YCbCr conversion of cat.tif>
StripOffsets           (  273) LONG      ( 4) 33<8 1852 3783 5699 7614 9639
11716 13874 16055 18269 20409 22471 24684 26981 29242 31415 33585 35991
38488 40862 43192 45569 48021 50527 53015 55416 57729 60087 62316 64462
66405 68431 70614>
Orientation            (  274) SHORT     ( 3) 1<1>
SamplesPerPixel        (  277) SHORT     ( 3) 1<3>
RowsPerStrip           (  278) LONG      ( 4) 1<13>
StripByteCounts        (  279) LONG      ( 4) 33<1844 1931 1916 1915 2025
2077 2158 2181 2214 2140 2062 2213 2297 2261 2173 2170 2406 2497 2374 2330
2377 2452 2506 2488 2401 2313 2358 2229 2146 1943 2026 2183 1583>
PlanarConfig           (  284) SHORT     ( 3) 1<1>
YCbCrCoefficients      (  529) RATIONAL  ( 5) 3<0.2989 0.587 0.114>
YCbCrSubsampling       (  530) SHORT     ( 3) 2<2 2>
YCbCrPositioning       (  531) SHORT     ( 3) 1<1>
ReferenceBlackWhite    (  532) RATIONAL  ( 5) 6<0 255 128 255 128 255>

--
Lars Farm <Lars.Farm@nts.mh.se>                 Ph: +46 60 188779
Krönvägen 33b, 856 44 Sundsvall, Sweden         home+46 60 110703