[Qgis-developer] Ticket 778 and slow loading rasters

Frank Warmerdam warmerdam at pobox.com
Wed Apr 16 11:52:07 EDT 2008

Peter Ersts wrote:
> Howdy all,
> Carlos Dávila has been good enough to keep reminding me of Ticket 778 
> (http://trac.osgeo.org/qgis/ticket/778) and supplied me with one of his 
> ecw images. The image that Carlos sent me is 53k pixels by 14k pixels 
> and it took about 106 seconds to load on my older desktop.
> The slowness on initial load has to do with determining the min and max 
> values for contrast enhancement, the default is a linear min-max 
> stretch. On initial load of a raster, we have it set so that GDAL 
> provides an approximation of the min and max for each band, later the 
> user can elect to load the actual min max -- very slooooow right now. 
> Even with only asking for an approximation, with an image that size 
> there is going to be a bit of a delay. If you set the default contrast 
> enhancement to "no stretch" these same data load in only 2 seconds.


I would be interested to investigate why getting approximate statistics
for this file is so slow.  I does not seem like it ought to be.

In fact the ECW driver in GDAL is somewhat special in that it does not
have fixed overview levels, which means that approximate statistics are
computed by fetching a sampling of full resolution blocks.  I think it
would be better to fix this by modifying GDAL to select an appropriate
resolution and read the whole image highly decimated to get statistics
for formats like ECW with "arbitrary" overviews.

I'll work on this now and see if it helps alot.

The other thing is that I see GDAL isn't saving it's approximate
stats to an .aux.xml file as I would have expected.  If this gets
enabled it will help performance on subsequent openings of the file.

> --> Keep the default contrast enhancement as linear min-max on initial
> --> If the total number of pixels in the image is greater than some 
> threshold revert back to "no stretch" as the default on initial load

I would like to think this isn't necessary.  I am however confused
about why 8bit images are stretched by default.  The default rule in
OpenEV for instance is to do no stretching for 8bit images, but to
use linear stretch for non-8bit images.

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    | President OSGeo, http://osgeo.org

More information about the Qgis-developer mailing list