1993.08.17 00:06 "byte swapping 16- and 32-bit data", by Sam Leffler

1993.08.17 20:45 "Re: byte swapping 16- and 32-bit data", by Richard Minner

(Oh boy, design by committee, what fun! I'll bet Sam is thrilled. ;-)

Here's my proposal:

Libtiff provides swabbing for >8-bit samples, but not un-avoidably. Libtiff already provides a number of ways of reading pixel data; I suggest providing the following behaviors, with two new trivial routines:

Do swab:
        TIFFReadRGBAImage()             should always swab, even now
        TIFFReadScanline()              "fix" to always swab
        TIFFReadEncodedStrip()          ditto
        TIFFReadEncodedTile()           ditto
        TIFFReadTile()                  ditto

Don't swab:
        TIFFReadRawStrip()              as always, "raw bytes"
        TIFFReadRawTile()               ditto
  new   TIFFReadEncodedStripNoSwab()    decode without swab
  new   TIFFReadEncodedTileNoSwab()     ditto
? new   TIFFReadTileNoSwab()            (not really needed)

This just involves renaming TIFFReadEncoded*() to

TIFFReadEncoded*NoSwab() and providing TIFFReadEncoded*()

as simple wrappers that do the swabbing no done only in tif_dumpmode.c:DumpModeDecode(). I probably wouldn't bother providing TIFFReadTileNoSwab() since swab-avoiding clients can just use TIFFReadEncodedTileNoSwab() with little added overhead.

[Note: any direct replies use rtm@island.com explicitly; my return address is likely to be bogus.]

--

Richard Minner  rtm@island.com  {uunet,sun,well}!island!rtm
Island Graphics Corporation  Sacramento, CA  (916) 736-1323