[mapserver-dev] Extending LUT syntax to support rasters with bit depth > 8 bit ?
Even Rouault
even.rouault at spatialys.com
Tue Aug 4 13:19:47 PDT 2015
Hi,
Currently if we want to use the LUT with 16 bit raster, we have necessary to
use SCALE before to reduce the dynamics to 8 bits, since LUT are only
supported for [0,255]->[0,255] mapping. However, for example in the case of a
12 bit raster where the desired LUT [0,4095]->[0,255] would have segments with
a width of input values < 16, it is not possible to derive a proper 8 bit LUT.
For example, let's assume we want this LUT : 0:0,15:15,4080:240,4095:255
and that the input raster dynamics is effectively [0,4095]. Once we have
rescaled to 8 bits, we cannot "convert" this 12 bit LUT into a 8 bit LUT since
it would become this degenerated LUT: 0:0,0:15,255:240,255:255
The current pseudo code of LoadGDALImages() is :
(1) if there are no SCALE processing option,
- acquire the imagery on 8 bit
- apply 8 bit LUTs when they're defined
(2) otherwise if there's a SCALE processing option
- acquire the imagery on 32 bit floats
- do the scaling to get a 8 bit buffer
- apply 8 bit LUTs when they're defined
My proposal would be to modify (1) to detect first if there's a LUT defined with
its maximum input value greater than 255. In which case, the imagery would be
acquired on 16 bit unsigned and the extended LUT would be applied.
It seems to me a natural extension of the current LUT syntax that shouldn't
have backward compatibility issues.
For now, I would be interested only in 16 bit unsigned imagery, but the same
idea could potentially be later applied to other cases like floating point
values.
Opinions ?
Even
--
Spatialys - Geospatial professional services
http://www.spatialys.com
More information about the mapserver-dev
mailing list