Gdal Bug? was: Re: [gdal-dev] JP2MRSID Issues

Stephen Woodbridge woodbri at swoodbridge.com
Sun Nov 16 20:56:24 EST 2008


Frank Warmerdam wrote:
> 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,

Hi Frank,

Sorry no joy with the patch applied. Here are the results. I had them 
patch and set the prefix /usr/local/swoodbridge/ and then used the 
following script to make sure I pulled in the new executables and libraries.

-Steve

[swoodbridge at booboo tif-test]$ cat test-it
#
PATH=/usr/local/swoodbridge/bin:$PATH
LD_LIBRARY_PATH=/usr/local/swoodbridge/lib:$LD_LIBRARY_PATH

env

gdalinfo --version

ldd /usr/local/swoodbridge/bin/gdalwarp

rm out.tif

GDAL_SKIP=JPEG2000 /usr/local/swoodbridge/bin/gdalwarp -srcnodata 0 
-dstnodata 0 -s_srs +init=epsg:26915 -t_srs EPSG:4326 -te -93.5 43.8125 
-93.4375 43.875 -rb -wm 250 --config GDAL_ONE_BIG_READ ON -co 
"TILED=YES" --debug on tmp.vrt out.tif


[swoodbridge at booboo tif-test]$ ./test-it
HOSTNAME=booboo
SHELL=/bin/bash
TERM=xterm
HISTSIZE=1000
SSH_CLIENT=::ffff:192.168.100.8 33122 22
LIC_ECHO=echo -e
SSH_TTY=/dev/pts/1
USER=swoodbridge
LS_COLORS=no=00:fi=00:di=00;34:ln=00;36:pi=40;33:so=00;35:bd=40;33;01:cd=40;33;01:or=01;05;37;41:mi=01;05;37;41:ex=00;32:*.cmd=00;32:*.exe=00;32:*.com=00;32:*.btm=00;32:*.bat=00;32:*.sh=00;32:*.csh=00;32:*.tar=00;31:*.tgz=00;31:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.zip=00;31:*.z=00;31:*.Z=00;31:*.gz=00;31:*.bz2=00;31:*.bz=00;31:*.tz=00;31:*.rpm=00;31:*.cpio=00;31:*.jpg=00;35:*.gif=00;35:*.bmp=00;35:*.xbm=00;35:*.xpm=00;35:*.png=00;35:*.tif=00;35:
LD_LIBRARY_PATH=/usr/local/swoodbridge/lib:/opt/CA/SharedComponents/lib
PATH=/usr/local/swoodbridge/bin:/home/swoodbridge/bin:/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin
MAIL=/var/spool/mail/swoodbridge
PWD=/home/swoodbridge/tif-test
INPUTRC=/etc/inputrc
EDITOR=vi
LANG=en_US.UTF-8
HOME=/home/swoodbridge
SHLVL=2
LOGNAME=swoodbridge
SSH_CONNECTION=::ffff:192.168.100.8 33122 ::ffff:192.168.100.9 22
LESSOPEN=|/usr/bin/lesspipe.sh %s
CASHCOMP=/opt/CA/SharedComponents
CALIB=/opt/CA/SharedComponents/lib
G_BROKEN_FILENAMES=1
_=/bin/env
GDAL 1.5.3, released 2008/09/09
         libgdal.so.1 => /usr/local/swoodbridge/lib/libgdal.so.1 
(0x00111000)
         libgeos_c.so.1 => /usr/lib/libgeos_c.so.1 (0x00809000)
         libgeos.so.2 => /usr/lib/libgeos.so.2 (0x008bd000)
         libpthread.so.0 => /lib/tls/libpthread.so.0 (0x00a1b000)
         libjpeg.so.62 => /usr/lib/libjpeg.so.62 (0x00d0c000)
         libpq.so.4 => /usr/lib/libpq.so.4 (0x00816000)
         librt.so.1 => /lib/tls/librt.so.1 (0x00832000)
         libcurl.so.3 => /usr/lib/libcurl.so.3 (0x00846000)
         libidn.so.11 => /usr/lib/libidn.so.11 (0x00dab000)
         libssl.so.4 => /lib/libssl.so.4 (0x00bc3000)
         libcrypto.so.4 => /lib/libcrypto.so.4 (0x043d6000)
         libgssapi_krb5.so.2 => /usr/lib/libgssapi_krb5.so.2 (0x00b80000)
         libkrb5.so.3 => /usr/lib/libkrb5.so.3 (0x0436f000)
         libcom_err.so.2 => /lib/libcom_err.so.2 (0x00bf9000)
         libk5crypto.so.3 => /usr/lib/libk5crypto.so.3 (0x00ce9000)
         libresolv.so.2 => /lib/libresolv.so.2 (0x00a74000)
         libdl.so.2 => /lib/libdl.so.2 (0x009f0000)
         libz.so.1 => /usr/lib/libz.so.1 (0x00a2f000)
         libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00c03000)
         libm.so.6 => /lib/tls/libm.so.6 (0x009f6000)
         libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00cd0000)
         libc.so.6 => /lib/tls/libc.so.6 (0x00ddb000)
         /lib/ld-linux.so.2 (0x008a5000)
         libcrypt.so.1 => /lib/libcrypt.so.1 (0x00a41000)
         libnsl.so.1 => /lib/libnsl.so.1 (0x00b5f000)
MrSID: Opened zoom level 1 with size 18005x24724.

MrSID: Opened zoom level 2 with size 9003x12362.

MrSID: Opened zoom level 3 with size 4502x6181.

MrSID: Opened zoom level 4 with size 2251x3091.

MrSID: Opened zoom level 5 with size 1126x1546.

MrSID: Opened zoom level 6 with size 563x773.

MrSID: Opened zoom level 7 with size 282x387.

MrSID: Opened zoom level 8 with size 141x194.

MrSID: Opened zoom level 9 with size 71x97.

MrSID: Opened zoom level 10 with size 36x49.

MrSID: Opened zoom level 0 with size 36010x49447.

MrSID: Opened image: width 36010, height 49447, bands 4
GDAL: 
GDALOpen(/var/data/raw_data/minnesota/ortho_1-1_1m_j_mn161_2008_1.aux) 
succeeds as HFA.
GDAL: 
GDALClose(/var/data/raw_data/minnesota/ortho_1-1_1m_j_mn161_2008_1.aux)
GDAL: 
GDALOpen(/var/data/raw_data/minnesota/ortho_1-1_1m_j_mn161_2008_1.jp2) 
succeeds as JP2MrSID.
GDAL: GDALOpen(tmp.vrt) succeeds as VRT.
OGRCT: Source: +proj=utm +zone=15 +ellps=GRS80 +datum=NAD83 +units=m 
+no_defs
OGRCT: Target: +proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs
OGRCT: Source: +proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs
OGRCT: Target: +proj=utm +zone=15 +ellps=GRS80 +datum=NAD83 +units=m 
+no_defs
GDAL: GDALClose(tmp.vrt)
GDAL: GDALClose()
GDAL: GDALClose()
GDAL: GDALClose()
GDAL: GDALClose()
GDAL: GDALClose()
GDAL: GDALClose()
GDAL: GDALClose()
GDAL: GDALClose()
GDAL: GDALClose()
GDAL: GDALClose()
GDAL: 
GDALClose(/var/data/raw_data/minnesota/ortho_1-1_1m_j_mn161_2008_1.jp2)
Creating output file that is 6029P x 6029L.
GDAL: QuietDelete(out.tif) invoking Delete()
ERROR 4: `out.tif' not recognised as a supported file format.

GDAL: GDALDriver::Create(GTiff,out.tif,6029,6029,3,Byte,0x80d9c30)
MrSID: Opened zoom level 1 with size 18005x24724.

MrSID: Opened zoom level 2 with size 9003x12362.

MrSID: Opened zoom level 3 with size 4502x6181.

MrSID: Opened zoom level 4 with size 2251x3091.

MrSID: Opened zoom level 5 with size 1126x1546.

MrSID: Opened zoom level 6 with size 563x773.

MrSID: Opened zoom level 7 with size 282x387.

MrSID: Opened zoom level 8 with size 141x194.

MrSID: Opened zoom level 9 with size 71x97.

MrSID: Opened zoom level 10 with size 36x49.

MrSID: Opened zoom level 0 with size 36010x49447.

MrSID: Opened image: width 36010, height 49447, bands 4
GDAL: 
GDALOpen(/var/data/raw_data/minnesota/ortho_1-1_1m_j_mn161_2008_1.aux) 
succeeds as HFA.
GDAL: 
GDALClose(/var/data/raw_data/minnesota/ortho_1-1_1m_j_mn161_2008_1.aux)
GDAL: 
GDALOpen(/var/data/raw_data/minnesota/ortho_1-1_1m_j_mn161_2008_1.jp2) 
succeeds as JP2MrSID.
GDAL: GDALOpen(tmp.vrt) succeeds as VRT.
Processing input file tmp.vrt.
OGRCT: Source: +proj=utm +zone=15 +ellps=GRS80 +datum=NAD83 +units=m 
+no_defs
OGRCT: Target: +proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs
OGRCT: Source: +proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs
OGRCT: Target: +proj=utm +zone=15 +ellps=GRS80 +datum=NAD83 +units=m 
+no_defs
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.
./test-it: line 13: 19703 Aborted                 GDAL_SKIP=JPEG2000 
gdalwarp -srcnodata 0 -dstnodata 0 -s_srs +init=epsg:26915 -t_srs 
EPSG:4326 -te -93.5 43.8125 -93.4375 43.875 -rb -wm 250 --config 
GDAL_ONE_BIG_READ ON -co "TILED=YES" --debug on tmp.vrt out.tif



More information about the gdal-dev mailing list