2005.10.27 06:40 "[Tiff] How located pixels with BitsPerSample not bound to byte?", by Шебеко Евгений

2005.10.28 03:42 "Re: [Tiff] How located pixels with BitsPerSample not bound to byte?", by Frank Warmerdam

On 10/27/05, David McKenzie <davidmck@austin.rr.com> wrote:

It so happens that while testing a viewer application I'm working on, two problems were tracked to this section of GDAL code (in geotiff.cpp). The first is apparently a simple coding error. Notice that the local variable iPixelBitSkip in the code excerpt is initialized but never used. I saw this first in a separate section that handles 12-bit samples as a special case. There I fixed the problem by simply replacing the statement "iBitOffset += 12" with "iBitOffset += iPixelBitSkip". In the section here that handles other 1-32 bit samples a similar fix is necessary. I haven't tried the very latest version of OpenEV, but I believe for the above reason it can't correctly display many of Bob Friesenhahn's example TIFFs (see below) with "contig" in the name.


Yikes! And here I thought I had tested comprehensively with Bob's images. I must have been out of it that day. I have fixed this and now all the contig rgb images work fine in OpenEV.

Note there is the fix for incrementing iBitOffset, and a fix to the computation of nBitsPerLine.

The updated code is available at:


The second problem involves this same section of code (1-32 bit sample

I'll stay out of this issue, though I suspect that 24bit data should not be byte swapped.

Best regards,

I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam@pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent