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

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

I'm preparing a 3.3beta distribution and ran across an old design decision that I don't like (someone talked me into it, but I now regret it). When reading data either as scanlines, tiles, or strips, if the data is not compressed and has samples >8 bits, the library currently does the appropriate work to byte swap the data. This is non-orthogonal; an application must still check if the data is encoded with a compression algorithm other than 1 and handle byte swapping for samples >8 bits.

I've added a call TIFFIsByteSwapped that lets apps find out if >8-bit data needs to be byte swapped. I'd like to change the library so that the no compression decoding and encoding routines no longer byte swap data.

Anyone have a problem with my doing this? It will mean that some folks will need to change some code.

BTW, I don't plan to add this byte-swapping into the library because my experience indicates this is a mistake--byte swapping can almost always be combined with some other operation and so amortize the cost. If the swapping is done in the library then it's a fixed cost that can't be amortized.

Sam