Opened 23 months ago

Closed 23 months ago

Last modified 23 months ago

#6001 closed defect (fixed)

TIFF TileByteCounts problem

Reported by: dengo Owned by: warmerdam
Priority: normal Milestone: 1.11.3
Component: default Version: unspecified
Severity: normal Keywords:
Cc:

Description (last modified by dengo)

Hey guys,

we’ve encountered a strange problem with a big 32bit float TIFF. The TIFF is created with GDAL. Later the pyramids and statistics on this file are calculated with ERDAS Imagine 2015. Now when we try to read the file with GDAL again, there is a problem (GetBlockRef? failed) I’ve tried to debug the problem and it seems the problem is related to the TIFF Tag TileByteCounts?. After the file was adjusted by ERDAS the bytecount per tile is read as 1067030938 instead of 65536 (128x128 block size). Another thing I’ve notices that the tdir_type of the TileByteCounts? Tag which was 16 before now is 4. I’ve tried to debug further but I did not really understand where those strange td_stripbytecount are coming from.

I’m not sure if it is more of a ERDAS bug than a problem with GDAL, nevertheless ERDAS and ESRI ArcMap? don’t seem to have a problem with the file after ERDAS adjusted it. I’ve created two zips, working.zip with the raster before, and notworking.zip with the raster after ERDAS modified the file. The test file has the same value for all pixels so the zip files are quite small.

working.zip notworking.zip

The problem occurs with GDAL 1.11.2 and GDAL 2.0 (not the very latest version tested).

Best regards, Dennis

Change History (3)

comment:1 Changed 23 months ago by dengo

Description: modified (diff)

comment:2 Changed 23 months ago by Even Rouault

Milestone: 1.11.3
Resolution: fixed
Status: newclosed

This was a defect of a GDAL specific optimization. The file is correct, although a bit unusual since it uses 8-byte values for the offsets and 4-byte values for the bytecounts. libtiff in particular doesn't generate such files AFAIK.

trunk r29354, branches/2.0 r29355 (post RC2, so likely 2.0.1), branches/1.11 r29356 "GTiff: fix GTiffDataset::IsBlockAvailable?() wrong behaviour when compiling against internal libtiff, when a BigTIFF file has a TileByteCounts? with LONG/4-byte counts and not LONG8 (#6001)"

So a workaround is to compile against an external libtiff 4.0.3 or 4.0.4beta

comment:3 Changed 23 months ago by dengo

As always competent and quick reply.

I've recompiled GDAL with the current version from the 2.0 branch and it works without problems now.

Thanks a lot.

Note: See TracTickets for help on using tickets.