2004.05.27 01:15 "[Tiff] large TIFF - two alternatives", by Steve Carlsen

2004.05.27 01:15 "[Tiff] large TIFF - two alternatives", by Steve Carlsen

Greetings all,

I haven't been involved in TIFF for a very long time, but I've been talking to Chris Cox about the subject of "Large TIFF", and would like to run a couple of alternatives by this group.

The first alternative is, I think, the smallest number of changes possible such that the result cleanly supports 8-byte addresses.

The second alternative is the way I would design TIFF if I were doing it over again today, taking advantage of the fact that no old TIFF readers will be able to read "Large TIFF" files anyway, even with the minimal approach.

The second alternative is more general, more flexible, easier to debug, supports layers, and simplifies a number of things.

I don't _really_ expect to convince everyone that Alternative 2 is worth the new code that it would require (not that any of it is difficult); but I thought I should bring it up because if we're ever going to move to a a more powerful version of the 'old TIFF', there will never be a better opportunity than now.

- SteveC

Alternative 1: Minimal changes for TIFF to support 8-byte addresses

  1. ID = 43 (or maybe 0x4242?)
  2. 8-byte offset to 0th IFD
  3. Value/Offset fields are 8 bytes
  4. 8-byte offset to the next IFD (does anyone use this?)
  5. add TIFFType of LONG8, an 8 byte (unsigned) int
  6. StripOffsets and TileOffsets and ByteCounts can be LONG8

Alternative 2: A more modern and general approach

(in the following, any power of two can be used instead of 8)

  1. ID = the string "TIFF2"
  2. 8-byte pointer to 0th IFD/Dictionary
  3. Value/pointer fields are 8 (2**x) bytes
  4. 8-byte child pointers
  5. add an 8-byte TIFF integer type, but it's rarely used explicitly
  6. StripOffsets and TileOffsets and ByteCounts are 8 bytes
  7. support for 4 or 8 or 16 or ... 2**X byte addresses (header tells which one you're using)
  8. use of ASCII tags/keys instead of binary ones
  9. most values are ASCII strings, too: integers, floating point numbers, enums, yielding fewer data types
  10. Dictionaries (IFDs) can be really large.
  11. Cleaner hierarchical structure, with explicit inheritance from parents. top-level dictionary contains metadata only; it does not point to image data.
  12. Explicit support for layers
  13. All data is planar (though it can be interleaved by row or tile)
  14. So there are 4 levels to the hierarchy: Root, Image, Layer, and Channel. Only Channel dictionaries point to image data.
  15. Multi-byte numeric values are always big-endian, not that it matters very often in this more string-oriented approach.
  16. All other rules are normal TIFF rules.