hololink::module::csi::CsiConverterV1
hololink::module::csi::CsiConverterV1
Tells the component that interprets received image data how that data is laid out in the receive buffer.
The device delivers each frame into a buffer as CSI-2 data: possibly some leading bytes (metadata, framing), then the image lines, each padded to whatever alignment the receiving hardware or software requires, then possibly some trailing bytes. The component that converts that buffer into an image (a converter operator, or a capture operator that does so itself) implements this interface. A sensor driver uses it to find out how the receiver arranges the data, and then tells the converter where within that arrangement the image is.
Typical use, by a sensor driver:
- Ask for the receiver’s geometry with receiver_start_byte(), transmitted_line_bytes() and received_line_bytes().
- Add the sensor’s own non-image content to the start offset (for example metadata lines and optical-black lines that precede the image).
- Call configure() with the resulting layout.
The geometry depends on the converter in use: for example, how many bytes a RAW_10 line occupies, and the alignment of received lines, differ between converters. Applications and drivers must therefore ask the converter and not assume.
This is not a service obtained from a Module; the application hands the converter to the sensor driver as a std::shared_ptr.
Methods
configure
Tell the converter where the image is in the receive buffer and how it is encoded.
Call this before frames are processed, once the geometry above is known.
Parameters
Offset, from the start of the receive buffer, of the first byte of the first image line; everything before it (leading framing, metadata, and any sensor lines that are not image) is skipped.
Distance in bytes from the start of one image line to the start of the next, including padding (see received_line_bytes()).
Image width, in pixels.
Image height, in lines.
How pixels are encoded in the received data.
Bytes in the buffer, after the last image line, that are not image data.
receiver_start_byte
Offset in the receive buffer at which the receiver puts the first byte of the data the sensor sent.
Accounts for anything the receiver places before the sensor’s data. Add the sensor’s own leading non-image bytes to this to obtain the start_byte for configure().
Returns: The offset, in bytes.
received_line_bytes
The distance, in the receive buffer, from the start of one line to the start of the next.
The receiver pads each line it stores to a multiple of an alignment it requires, so this is line_bytes rounded up accordingly.
Returns: The spacing between received lines, in bytes.
Parameters
Bytes the sensor transmits for a line, as given by transmitted_line_bytes() (or the size of any other sensor line, such as metadata).
transmitted_line_bytes
The number of bytes the sensor transmits for one image line.
Depends on how many bits the pixel format uses and on how the converter packs pixels (for example RAW_8 uses one byte per pixel, while RAW_10 and RAW_12 pack several pixels across a smaller number of bytes). The count excludes any padding the receiver adds; see received_line_bytes().
Returns: Bytes per transmitted line.
Throws: std::runtime_error if the converter does not support pixel_format, or if it needs to be told which format to expect before it can answer and has not been.
Parameters
How pixels are encoded.
Image width, in pixels.