GM TIFF updates
Bob Friesenhahn <[email protected]>
| Newsgroups | gmane.comp.video.graphicsmagick.core |
|---|---|
| Message-ID | <Pine.GSO.4.44.0310061707290.16213-100000@scooby.simplesystems.org> |
I have spent some time re-implementing how GraphicsMagick's TIFF coder reads and writes colormapped and grayscale TIFF files. The previous implementation used hand-coded/tuned cases for every depth and condition. While this approach is as fast as possible, it requires that every case be specifically supported. The modified TIFF coder uses some new implementation functions that support reading and writing generic "bit streams". The functions provide for writing or reading a specified number of bits (1-32) to/from a byte array. A result of using this simple interface is that the supportive code is now very concise and compact since the same code handles every possible bit-depth as well as a transparency channel. The generic approach is a bit slower, but it can be expected to succeed for cases that have never been tested (e.g. 10-bit grayscale TIFF) and since there is only one code path to test, it doesn't require as much validation testing. The new implementation eliminates a number of bugs (mostly having to do with transparency) and enables writing more compact TIFF files since low-color or shallow-gray images can be encoded using fewer bits. The currently supported bits-per-sample values when writing are 1,4,8, and 16. A mechanism may be provided in the future to override the default logic so that other values may be used. We believe that bits-per-sample values ranging from 1-16 (even odd values!) should be supported for read. Bob ====================================== Bob Friesenhahn [email protected] http://www.simplesystems.org/users/bfriesen ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf