libsdfio 1.0.0
Reader and writer for ISO 25178-71 SDF surface data files in C
Loading...
Searching...
No Matches
sdfio_layout Struct Reference

Description of a buffer of the caller for heights or for the values of the data area: the type of its elements, and how the matrix lies in memory. More...

#include <layout.h>

Data Fields

sdfio_data_type type
 Type of the elements of the buffer.
ptrdiff_t element_stride
 Distance in bytes between consecutive elements within a row.
ptrdiff_t row_stride
 Distance in bytes between consecutive rows.

Detailed Description

Description of a buffer of the caller for heights or for the values of the data area: the type of its elements, and how the matrix lies in memory.

The element (y, x) is at data + y * row_stride + x * element_stride. Both strides can be negative. They must keep the elements apart: either the rows or the columns must not overlap. This allows heights and values to be read or written in place where they are not contiguous, for example the z member of an array of points, one channel of an interleaved image or a column-major matrix. sdfio_layout_packed() describes a plain array. Without an initializer, call sdfio_layout_init() before assigning fields.

The structure is frozen for the major version: it has these three fields and a new property of a buffer is a new function.

Examples
eigen.cpp, opencv.cpp, read_coded.c, read_stream.c, and write_coded.c.

Field Documentation

◆ element_stride

ptrdiff_t sdfio_layout::element_stride

Distance in bytes between consecutive elements within a row.

0 selects elements that follow each other directly.

Examples
eigen.cpp.

◆ row_stride

ptrdiff_t sdfio_layout::row_stride

Distance in bytes between consecutive rows.

0 selects rows that follow each other, each containing the columns of the matrix at element_stride. A column-major matrix needs an explicit value. sdfio_decode_heights() and sdfio_encode_heights() convert one row and ignore it.

Examples
eigen.cpp, and opencv.cpp.

◆ type

sdfio_data_type sdfio_layout::type

Type of the elements of the buffer.

For heights it is SDFIO_TYPE_FLOAT or SDFIO_TYPE_DOUBLE, and for the values of the data area it is the data type of the file.


The documentation for this struct was generated from the following file:
  • /home/runner/work/libsdfio/libsdfio/include/sdfio/layout.h