2011.06.06 16:55 "Re: [Tiff] Questions on TIFF LZW compression", by Bob Friesenhahn
First, how does LZW compression work for images that are not 8 bits/pixel?
As far as I read the specs, the input to the LZW compression is the
"raw" TIFF stripe buffer, but this leaves a couple of corner
cases open. I see that this type of compression works for any bit depth
that divides eight, or is a multiple of eight, but what
happens for 10 bits per pixel images? Is LZW really applied to the
bit-packed(!) input, or is the LZW algorithm applied to 16 bit
data, where 10 bits are packed (left-justified? right-justified?) into a
16 bit word? In the former case, LZW will very unlikely give
much compression performance, of course.
While I am not an expert at TIFF compression issues, I suspect that you are correct that the predictor has little value (and may cause harm) at depths other than 8 (and perhaps 16) bits since the compressor works on an octet stream. The value of the predictor depends on the nature of the image. When Adobe produced a preliminary application note about Photoshop CS2's added support for 16 and 24 bit floats, they also defined new types of predictors which work better for that sort of data.
TIFF is not PNG. PNG has a huge number of filter mechanisms, but TIFF is more of a "working format" so it focuses less on achieving the absolute smallest file size. The ability of TIFF to directly store 10 bit data is already an accomplishment compared with other formats which would be forced to promote to 16-bit and then use compression to make the result smaller.
GraphicsMagick Maintainer, http://www.GraphicsMagick.org/