[gdal-dev] Support for Float16 and CFloat16

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[gdal-dev] Support for Float16 and CFloat16

Agram, Piyush S (334D)

Hi,

    I tried to search the gdal-dev archives but could not find much on this topic.

 

HDF5 files support half precision floats and so does numpy. I was wondering if there were any plans to include support for this data type?

I understand that some compilers may not support it but support could be provided by external libraries like “half”.

A lot of SAR imagery is expected to be put out in this format in the future, as it has better properties than the current CInt16 format.

 

Piyush


_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev
Reply | Threaded
Open this post in threaded view
|

Re: Support for Float16 and CFloat16

Even Rouault-2
Piyush,

>     I tried to search the gdal-dev archives but could not find much on this
> topic.
 
> HDF5 files support half precision floats and so does numpy. I was wondering
> if there were any plans to include support for this data type?

There's no native support for Float16 in C++, so your best option is to
promote to Float32 (or CFloat32) when reading for a format where there are
stored as half floats. This is for example what is done in the GTiff driver (
HalfToFloat() function in frmts/gtiff/tif_float.c )

You could add a NBITS=16 metadata item in the IMAGE_STRUCTURE metadata domain
of the band(s) to reflect the original precision.

Even

--
Spatialys - Geospatial professional services
http://www.spatialys.com
_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev