AWARE [SYSTEMS]
AWare Systems, Home TIFF and LibTiff Mail List Archive

LibTiff Mailing List

TIFF and LibTiff Mailing List Archive
February 2016

Previous Thread
Next Thread

Previous by Thread
Next by Thread

Previous by Date
Next by Date

Contact

The TIFF Mailing List Homepage
Archive maintained by AWare Systems



New Datamatrix section



Valid HTML 4.01!



Thread

2016.02.04 07:16 "[Tiff] Image data layout", by Maximilian Heinzler
2016.02.04 07:19 "Re: [Tiff] Image data layout", by Kandel, Mikhail Eugene
2016.02.04 19:39 "Re: [Tiff] Image data layout", by Maximilian Heinzler
2016.02.04 14:42 "Re: [Tiff] Image data layout", by Bob Friesenhahn
2016.02.04 16:34 "Re: [Tiff] Image data layout", by Edward Lam
2016.02.04 19:57 "RE: [Tiff] Image data layout", by Maximilian Heinzler
2016.02.05 00:22 "Re: [Tiff] Image data layout", by Bob Friesenhahn
2016.02.05 16:34 "RE: [Tiff] Image data layout", by Maximilian Heinzler

2016.02.04 07:16 "[Tiff] Image data layout", by Maximilian Heinzler

Hi everyone,

I'm currently implementing TIFF write support in my image library. While testing some larger values for the bits per sample field, I noticed that LibTIFF does some internal swapping of the image data for some of these values. But I’m not sure if it uses the correct method for the 128 bits per sample case. Is this supposed to be correct? Shouldn’t it use a real 128 bit swap here?

Here is the part of the code I’m talking about (from tif_dir.c):

if (tif->tif_flags & TIFF_SWAB) {
     if (td->td_bitspersample == 8)

          tif->tif_postdecode = _TIFFNoPostDecode;
     else if (td->td_bitspersample == 16)
          tif->tif_postdecode = _TIFFSwab16BitData;
     else if (td->td_bitspersample == 24)
          tif->tif_postdecode = _TIFFSwab24BitData;
     else if (td->td_bitspersample == 32)
          tif->tif_postdecode = _TIFFSwab32BitData;
     else if (td->td_bitspersample == 64)
          tif->tif_postdecode = _TIFFSwab64BitData;
     else if (td->td_bitspersample == 128) /* two 64's */
          tif->tif_postdecode = _TIFFSwab64BitData; // Is this correct?

}

By the way, is there any definition of how the layout of the image data looks like for odd bit depths (like 7)? I can’t find anything in the specification about this and it looks like that in most cases a big endian layout is used regardless of the file’s endianness. For example, if I use ImageMagick to create a TIFF file with 48 bits per sample, the image data is exactly the same for both little and big endian files.

I would appreciate any hints on this subject.

Regards,

Max