Opened 11 years ago

Closed 11 years ago

#4965 closed defect (fixed)

Intergraph image scaling is so slow as to be unusable and incorrect offset if first read isn't top scanline

Reported by: cleo Owned by: warmerdam
Priority: normal Milestone: 1.10.0
Component: GDAL_Raster Version: 1.9.1
Severity: major Keywords: ingr rle
Cc:

Description (last modified by cleo)

I provide three fixes in the attached patches for their respective files in frmts/ingr. I ask if these fixes can be verified and applied to the GDAL codebase. Thank you.

  1. Using the arbitrary nearest neighbour downsampler, the INGR driver's IReadBlock function would loop and each iteration would recurse causing all previous scanlines to be repeatedly and recursively loaded making the read time near infinitely long.

Included Fix: Loop backwards in scanlines until a valid RLE offset is found and then start updating RLE offsets from there. Also, no more recursion.

  1. When updating the cached scanline offset table, it would decompress the entire scanline even if that scanline was not used.

Included Fix: The INGR_Decode function may now take a NULL pointer for the destination pointer argument pabyDstData indicating that decompression may be bypassed. Value pointed to by pnBytesConsumed is still updated and this is what we want to update the scanline offset table anyhow. IReadBlock has been updated to pass NULL when updating scanline offsets mentioned in item #1.

Could have added a check that if both pabyDstData and pnBytesConsumed are NULL to return immediately, but figured it's unnecessary since it's the caller that is using it incorrectly and doesn't harm anything.

  1. When using the arbitrary downsampler (and likely any reads though I haven't tested it), if the first scanline is not read, the image will always have a strange offset applied making the image look cut off or crash. The offset applied happens to be the width of an uncompressed scanline times the scanline index and this gets applied to the RLE buffer which is incorrect and why the offset happened.

Included fix: In IReadBlock, when doing LoadBlockBuf for non-tiled images, use block offset (0,0) to load entire RLE data. Since this never gets called again for non-tiled images, this should not break other RLE files.

All fixes provided used version 1.9.1.

Attachments (2)

IngrTypes.patch (2.3 KB ) - added by cleo 11 years ago.
IntergraphBand.patch (2.5 KB ) - added by cleo 11 years ago.

Download all attachments as: .zip

Change History (5)

by cleo, 11 years ago

Attachment: IngrTypes.patch added

by cleo, 11 years ago

Attachment: IntergraphBand.patch added

comment:1 by cleo, 11 years ago

Description: modified (diff)

comment:2 by cleo, 11 years ago

Description: modified (diff)

comment:3 by Even Rouault, 11 years ago

Keywords: ingr rle added
Milestone: 1.10.0
Resolution: fixed
Status: newclosed

Patch applied in trunk in r25556. Thanks

Note: See TracTickets for help on using tickets.