Gdal Bug? was: Re: [gdal-dev] JP2MRSID Issues
Frank Warmerdam
warmerdam at pobox.com
Fri Nov 14 14:07:52 EST 2008
Stephen Woodbridge wrote:
> Frank,
>
> Here is what I get from the debug output. I'm a little surprised it is
> trying to extract from zoom 1 instead of zoom 0. I didn't think I was
> scaling this but maybe some rounding is causing that.
...
> GDAL: GDALDriver::Create(GTiff,out.tif,6029,6029,3,Byte,0x86d1bc0)
> MrSID: Opened zoom level 1 with size 18005x24724.
>
> MrSID: Opened zoom level 2 with size 9003x12362.
...
> MrSID: Opened zoom level 0 with size 36010x49447.
>
> MrSID: Opened image: width 36010, height 49447, bands 4
> MrSID: RasterIO() - using optimized dataset level IO.
> MrSID: Dataset:IRasterIO(25432,42149 5066x6973 -> 5066x6973 ->
> 5066x6973, zoom=1)
> gdalwarp: ../compressed/compressed.cpp:1724: bool
> kd_tile::read_tile_part_header(): Assertion `tpart_body_length >= 0'
> failed.
Steve,
I think the zoom level is a red herring. I believe the zoom=1 is reporting
the zoom level (1:1) in lizardtech terms, and is not directly related to
the earlier reporting of "zoom level 1" which is the 2:1 down sampled layer.
Looking in the code in gdal/frmts/mrsid/mrsiddataset.cpp near this case I see:
int sceneWidth = (int)(nXSize * maxWidth / (double)maxWidthAtL0 + 0.99);
int sceneHeight = (int)(nYSize * maxHeight / (double)maxHeightAtL0 + 0.99);
In this case I believe there might sometimes be a problem with the calculation
of nYSize * maxHeight being done with 32bit integers. Could you possibly try
changing these two lines to look like:
int sceneWidth =
(int)((nXSize * (GIntBig)maxWidth ) / (double)maxWidthAtL0 + 0.99);
int sceneHeight =
(int)((nYSize * (GIntBit)maxHeight) / (double)maxHeightAtL0 + 0.99);
and see if that helps? If so, I'll get this into 1.6 and 1.5 as a priority
fix.
Best regards,
--
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush | Geospatial Programmer for Rent
More information about the gdal-dev
mailing list