[mapserver-users] ECW Image Quality

Frank Warmerdam warmerdam at pobox.com
Tue Jan 22 09:49:14 EST 2002


On Tue, Jan 22, 2002 at 02:12:31PM +0800, brad wrote:
> 
> Rich,
> 
> I noticed this as well.  The reason for the poor quality is that GDAL will
> only return an 8 bit image for ECW.  I get this from the following statement
> "The current implementation reads any number of bands but returns only as
> eight bit image data" at the following URL.
> http://www.remotesensing.org/gdal/frmt_ecw.html
> Does MapServer itself have a limit to 8 bits for images other than ECW.  I
> have only tried ECW as this is the image format most commonly used by us.

Brad / Rich,

The MapServer support for 24bit images via GDAL maps them into a 5x5x5 
fixed color cube; which not surprisingly sucks for smoothly varying images. 
You mention that conversion to TIFF and then displaying via MapServer works
fine.  Could you provide a "tiffinfo" or similar report on the TIFF file? 
I wonder if it has already been rendered down to 8bit using a more 
intellegent mechanism. 

We could modify MapServer to use error diffusion to improve the quality of
the result though the real fix is to make MapServer support 24bit output.  It
is currently limited to 8 bit paletted output. 

> I also experienced the black image as I was zooming in close to the photo.
> I can't explain that, anyone else getting this ?  

I think I know what this is.  MapServer is requesting GDAL to "upsample"
the image, and GDAL asked the ECW library the same thing but the ECW
library doesn't support upsampling.  I don't see this problem in my other
applications because they will generally never ask for data at higher 
resolution that 1:1.  

I have added a TODO item to myself to fix this but I am not sure when I 
will get to it.  Feel free to prompt me now and then. 

> I am also getting an error that says:
> 
> -----------------
> CGI Error
> The specified CGI application misbehaved by not returning a complete set of
> HTTP headers. The headers it did return are:
>
> abnormal program termination
> -----------------
> 
> when I try using an ECW image that is large (671 MB).  It only happens
> sometimes and if I look at the memory consumption on my machine it only
> seems to happen when it gets to ~35MB usage for the mapserv.exe process.  If
> the memory consumed is less than this approximate value then there is not a
> problem displaying the image (albeit in 8 bit).

Skimming the code, I see an embarrassing memory leak that I imagine is 
responsible.  I have checked a fix into gdal/frmts/ecw/ecwdataset.cpp. 

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 mapserver-users mailing list