[gdal-dev] LZW Compression on geotiffs

Even Rouault even.rouault at spatialys.com
Thu Oct 2 02:05:23 PDT 2014


Le jeudi 02 octobre 2014 09:55:17, Jukka Rahkonen a écrit :
> Rahkonen Jukka (Tike <jukka.rahkonen <at> mmmtike.fi> writes:
> > > True, a way to improve things might be to specify -co PREDICTOR=2.
> > > Should apply to both LZW and DEFLATE.
> > > This is one of the filter that might be used by PNG, except that PNG
> > > has
> 
> different
> 
> > > filters, so it will eventually beat TIFF deflate.
> > 
> > Not a bad suggestion.
> > 
> > Original                                             424 MB
> > DEFLATE without predictor          380 MB
> > DEFLATE with -co predictor=2     280 MB
> 
> One more test with LZW
> 
> Without predictor                 474 MB
> With -co predictor=2              307 MB
> 
> Is there something that prevents changing the default to "predictor=2" from
> the current default value "1"?

I guess you can find cases where predictor=2 leads to bigger sizes, otherwise 
you could do several predictor passes and if each time the size would be 
smaller, you would violate principles of the information theory (you would 
compress less than the entropy of the data). But in practice, with non pure-
noise images, I think that horizontal differencing result in smaller files in 
nearly all cases. Would be good to know if someone has lead a test campaign on 
that, with various types of images, and particularly the ones involved in GIS.

There's at least one case I can think of where horizontal differencing would 
likely have no effect, or some negative effect. For paletted images where the 
index values of neighbour pixels have no correlation.

Adobe did apparently some tests, as mentionned in section 14 of 
https://partners.adobe.com/public/developer/en/tiff/TIFF6.pdf, but they don't 
compare the effect of horizontal differencing vs non-differencing. Interestingly 
they mention a trick (masking of low-order bits) that can enhance the effect of 
horizontal differencing at the expense of some loss of course. That's something 
is only relevant on the compression side. Completely transparent for the 
decompression side.

As raised by Andrea, there might be an impact of horizontal differencing on 
decompression time, but I'd expect it to be small. There's only one integer 
addition per sample value to undo the effect of the predictor.

> 
> -Jukka Rahkonen-
> 
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com


More information about the gdal-dev mailing list