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

Stephen Woodbridge woodbri at swoodbridge.com
Wed Nov 19 21:44:45 EST 2008


Frank Warmerdam wrote:
> Stephen Woodbridge wrote:
>> 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.
> ...
>> 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 confirmed the code I pointed out was buggy, but it does not appear to
> be directly responsible for your problem.  I'm not sure what else to tell
> you.  We could try and add more detailed debug output in the area of the
> IRasterIO() message but what is there seems to suggest the requested area
> will be on the database.
> 
> Best regards,

Frank,

Trying to dig a little deeper into this. I have pasted a gdb backtrace 
on the abort that I'm getting. I'm not sure if that will help.

Just a sanity check, here is a simple code change that is not reflected 
in the executable:

[swoodbridge at booboo gdal-1.5.3]$ vi ./frmts/mrsid/mrsiddataset.cpp
> CPLErr MrSIDDataset::IRasterIO( GDALRWFlag eRWFlag,
>                                 int nXOff, int nYOff, int nXSize, int nYSize,
>                                 void * pData, int nBufXSize, int nBufYSize,
>                                 GDALDataType eBufType,
>                                 int nBandCount, int *panBandMap,
>                                 int nPixelSpace, int nLineSpace, int nBandSpace )
> 
> {
> /* -------------------------------------------------------------------- */
> /*      We need various criteria to skip out to block based methods.    */
> /* -------------------------------------------------------------------- */
>     int bUseBlockedIO = bForceCachedIO;
> 
>     if( nYSize == 1 || nXSize * ((double) nYSize) < 100.0 )
>         bUseBlockedIO = TRUE;
> 
>     if( nBufYSize == 1 || nBufXSize * ((double) nBufYSize) < 100.0 )
>         bUseBlockedIO = TRUE;
> 
>     if( CSLTestBoolean( CPLGetConfigOption( "GDAL_ONE_BIG_READ", "NO") ) )
>         bUseBlockedIO = FALSE;
> 
>     CPLDebug( "MrSID", "RasterIO() - bUseBlockedIO=%d", bUseBlockedIO );

########### I added this statement ^
########### I assume this should print with --debug on the command line.

>     if( bUseBlockedIO )
>         return GDALDataset::BlockBasedRasterIO(
>             eRWFlag, nXOff, nYOff, nXSize, nYSize,
>             pData, nBufXSize, nBufYSize, eBufType,
>             nBandCount, panBandMap, nPixelSpace, nLineSpace, nBandSpace );
>     CPLDebug( "MrSID", "RasterIO() - using optimized dataset level IO." );
> 

make
make install

I get new files in PREFIX=/usr/local/swoodbridge/
and ran it as below, but do not get that new line to print! Should this 
line be executing? I ran strace and got:

open("/usr/local/swoodbridge/lib/libgdal.so.1", O_RDONLY) = 3

and checked all the other opens and it looks like the correct files are 
all getting loaded.


gdb /usr/local/swoodbridge/bin/gdalwarp
(gdb) set env LD_LIBRARY_PATH /usr/local/swoodbridge/lib
(gdb) set env GDAL_SKIP JPEG2000
(gdb) break main
(gdb) run -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
[Thread debugging using libthread_db enabled]
[New Thread -1208879424 (LWP 30108)]
[Switching to Thread -1208879424 (LWP 30108)]

Breakpoint 1, main (argc=26, argv=0xbfe4f8c4) at gdalwarp.cpp:107
(gdb) c
Continuing.
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,0x933ac50)
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.

Program received signal SIGABRT, Aborted.
0x008a57a2 in _dl_sysinfo_int80 () from /lib/ld-linux.so.2
(gdb) bt
#0  0x008a57a2 in _dl_sysinfo_int80 () from /lib/ld-linux.so.2
#1  0x008e6825 in raise () from /lib/tls/libc.so.6
#2  0x008e8289 in abort () from /lib/tls/libc.so.6
#3  0x008dfda1 in __assert_fail () from /lib/tls/libc.so.6
#4  0x005caa29 in kd_tile::read_tile_part_header ()
    from /usr/local/swoodbridge/lib/libgdal.so.1
#5  0x005cc28a in kdu_subband::open_block ()
    from /usr/local/swoodbridge/lib/libgdal.so.1
#6  0x006206a3 in kd_decoder::decode_row_of_blocks ()
    from /usr/local/swoodbridge/lib/libgdal.so.1
#7  0x0062123b in kd_decoder::pull ()
    from /usr/local/swoodbridge/lib/libgdal.so.1
#8  0x0061a976 in kd_synthesis::horizontal_synthesis ()
    from /usr/local/swoodbridge/lib/libgdal.so.1
#9  0x0061b84d in kd_synthesis::pull ()
    from /usr/local/swoodbridge/lib/libgdal.so.1
#10 0x005ff50c in kdsd_tile::process ()
    from /usr/local/swoodbridge/lib/libgdal.so.1
#11 0x00600883 in kdu_stripe_decompressor::pull_common ()
    from /usr/local/swoodbridge/lib/libgdal.so.1
#12 0x00600a8f in kdu_stripe_decompressor::pull_stripe ()
    from /usr/local/swoodbridge/lib/libgdal.so.1
#13 0x005195ec in LizardTech::JPCReader::doDecodeU8 ()
    from /usr/local/swoodbridge/lib/libgdal.so.1
#14 0x005197a3 in LizardTech::JPCReader::decodeStrip_kak ()
    from /usr/local/swoodbridge/lib/libgdal.so.1
#15 0x005197d8 in LizardTech::JPCReader::decodeStrip ()
    from /usr/local/swoodbridge/lib/libgdal.so.1
#16 0x0051de40 in LizardTech::Jpeg2000Reader::decodeStrip ()
    from /usr/local/swoodbridge/lib/libgdal.so.1
#17 0x005171ae in LizardTech::J2KImageReader::decodeStrip ()
    from /usr/local/swoodbridge/lib/libgdal.so.1
#18 0x0052b2bd in LizardTech::LTIImageStage::readStrip ()
    from /usr/local/swoodbridge/lib/libgdal.so.1
#19 0x0052b5d3 in LizardTech::LTIImageStage::read ()
    from /usr/local/swoodbridge/lib/libgdal.so.1
#20 0x0032fe8a in MrSIDDataset::IRasterIO (this=0x93e3d48, eRWFlag=GF_Read,
     nXOff=25432, nYOff=42149, nXSize=5066, nYSize=6973, pData=0xab0fa008,
     nBufXSize=5066, nBufYSize=6973, eBufType=GDT_Byte, nBandCount=1,
     panBandMap=0x93e7d38, nPixelSpace=1, nLineSpace=5066, nBandSpace=0)
     at mrsiddataset.cpp:856
#21 0x0032efd3 in MrSIDRasterBand::IRasterIO (this=0x93e7d20, 
eRWFlag=GF_Read,
     nXOff=25432, nYOff=42149, nXSize=5066, nYSize=6973, pData=0xab0fa008,
     nBufXSize=5066, nBufYSize=6973, eBufType=GDT_Byte, nPixelSpace=1,
     nLineSpace=5066) at mrsiddataset.cpp:523
#22 0x003f3dd4 in GDALRasterBand::RasterIO (this=0x93e7d20, eRWFlag=GF_Read,
     nXOff=25432, nYOff=42149, nXSize=5066, nYSize=6973, pData=0xab0fa008,
     nBufXSize=5066, nBufYSize=6973, eBufType=GDT_Byte, nPixelSpace=6,
     nLineSpace=5066) at gdalrasterband.cpp:235
#23 0x003d4d76 in VRTSimpleSource::RasterIO (this=0x933bcd8, nXOff=25432,
     nYOff=42149, nXSize=5066, nYSize=6973, pData=0xab0fa008, 
nBufXSize=5066,
     nBufYSize=6973, eBufType=GDT_Byte, nPixelSpace=1, nLineSpace=5066)
     at vrtsources.cpp:518
#24 0x003d3144 in VRTSourcedRasterBand::IRasterIO (this=0x933b9d8,
     eRWFlag=GF_Read, nXOff=25432, nYOff=42149, nXSize=5066, nYSize=6973,
---Type <return> to continue, or q <return> to quit---
     pData=0xab0fa008, nBufXSize=5066, nBufYSize=6973, eBufType=GDT_Byte,
     nPixelSpace=1, nLineSpace=5066) at vrtsourcedrasterband.cpp:176
#25 0x003e0712 in GDALDataset::IRasterIO (this=0x933b178, eRWFlag=GF_Read,
     nXOff=25432, nYOff=42149, nXSize=5066, nYSize=6973, pData=0xab0fa008,
     nBufXSize=5066, nBufYSize=6973, eBufType=GDT_Byte, nBandCount=3,
     panBandMap=0x9335888, nPixelSpace=1, nLineSpace=5066, 
nBandSpace=35325218)
     at gdaldataset.cpp:1239
#26 0x003e09f9 in GDALDataset::RasterIO (this=0x933b178, eRWFlag=GF_Read,
     nXOff=25432, nYOff=42149, nXSize=5066, nYSize=6973, pData=0xab0fa008,
     nBufXSize=5066, nBufYSize=6973, eBufType=GDT_Byte, nBandCount=3,
     panBandMap=0x9335888, nPixelSpace=1, nLineSpace=5066, 
nBandSpace=35325218)
     at gdaldataset.cpp:1430
#27 0x003e0a8d in GDALDatasetRasterIO (hDS=0x0, eRWFlag=GF_Read, 
nXOff=25432,
     nYOff=42149, nXSize=5066, nYSize=6973, pData=0xab0fa008, 
nBufXSize=5066,
     nBufYSize=6973, eBufType=GDT_Byte, nBandCount=3, panBandMap=0x9335888,
     nPixelSpace=0, nLineSpace=0, nBandSpace=0) at gdaldataset.cpp:1467
#28 0x00426575 in GDALWarpOperation::WarpRegionToBuffer (this=0xbfe4f750,
     nDstXOff=0, nDstYOff=0, nDstXSize=6029, nDstYSize=6029,
     pDataBuf=0xb160b008, eBufDataType=GDT_Byte, nSrcXOff=25432,
     nSrcYOff=42149, nSrcXSize=30108, nSrcYSize=6) at 
gdalwarpoperation.cpp:1319
#29 0x0042718d in GDALWarpOperation::WarpRegion (this=0xbfe4f750, 
nDstXOff=0,
     nDstYOff=0, nDstXSize=6029, nDstYSize=6029, nSrcXOff=25432,
     nSrcYOff=42149, nSrcXSize=5066, nSrcYSize=6973)
     at gdalwarpoperation.cpp:1151
#30 0x004274d1 in GDALWarpOperation::ChunkAndWarpImage (this=0xbfe4f750,
     nDstXOff=0, nDstYOff=0, nDstXSize=6029, nDstYSize=6029)
     at gdalwarpoperation.cpp:625
#31 0x0804d088 in main (argc=Variable "argc" is not available.
) at gdalwarp.cpp:695



More information about the gdal-dev mailing list