Opened 18 years ago

Last modified 16 years ago

#1000 closed defect

HFA reading code does not handle reduced precision properly — at Version 5

Reported by: sam.gillingham@… Owned by: Mateusz Łoskot
Priority: normal Milestone: 1.5.3
Component: GDAL_Raster Version: unspecified
Severity: normal Keywords: hfa
Cc: Mateusz Łoskot, globalmapper

Description (last modified by Mateusz Łoskot)

Frank,

I am having some trouble reading some compressed img files which I will attach
to this bug. One is float and the other signed 32 bit int. The central block of
each of these images is compressed using the 'reduced precision' system (numruns
= -1). I see this was added back in GDAL 1.1.5. However, the values GDAL reads
out are quite different from what Imagine displays - the numbers are huge for
floats and zero for ints where they should be more similar to the sorrounding
values. 

I had a quick look and couldn't see anything obvious in the reading code and I
couldn't find any documentation about the layout of reduced precision blocks. Do
you have additional documentation or any insight as to what could be going wrong?

Thanks,

Sam.

Change History (4)

by sam.gillingham@…, 18 years ago

Attachment: reduced_precision.zip added

img files that demonstrate the problem

comment:1 by warmerdam, 17 years ago

I have confirmed this is still a problem. 

The int.img file blows the assertion in UncompressBlock (hfaband.cpp)
which indicates it is not a supported block code. 

The float file seems to be something different, but does seem to 
produce bad results. 

If you can come up with patches for this it would be quite helpful.  Otherwise, 
I'll try and have it addressed for the 1.4.1 release.

comment:2 by warmerdam, 17 years ago

On review I remember that the UncompressBlock() code in hfaband.cpp is
derived from the similar code in the arcinfo binary grid reader 
(gdal/frmts/aigrid/gridlib.c) but it hasn't been kept up to date as 
fixes and improvements were made in that module. 

I'm turning this over to Mateusz to try and synchronize the code. 

Mateusz, please insure that int.img is added to the test suite as it
is of modest size and would be a good check that the compression 
support hasn't rotted. 

The fixes should go into trunk and 1.4 branch. 


comment:5 by Mateusz Łoskot, 17 years ago

Description: modified (diff)
Milestone: 1.4.0
Status: newassigned
Note: See TracTickets for help on using tickets.