Skip to content

LERC codec: deal with issues with multi-band PlanarConfig=Contig and NaN values

Even Rouault requested to merge rouault/libtiff:fix_gdal_9548 into master

Fixes https://github.com/OSGeo/gdal/issues/9530. Cf https://github.com/OSGeo/gdal/pull/9548 for the GDAL specific fix.

The LERC codec up-to-now didn't do any special processing when writing a strile in a multi-band PlanarConfig=Contig file, resulting in corruptions. Now we generate a mask buffer in that situation. Actually, if the NaN values are not at the same location accross bands, we need to write one mask-per-band, which requires liblerc >= 3.0, and in that situation change the LERC blob to multi-band instead of multi-depth/dim, with liblerc >= 3.0. When all bands have NaN values at the same location, we generate a single mask, which is compatible of liblerc < 3.0, but requires at last this version of libtiff to be read. This is the best solution we come with to fix the issue while having the maximum backward compatibility.

Merge request reports