Loading...
Searching...
No Matches
libcamera::ConverterDW100Module Class Reference

A converter module for the dw100 dewarper. More...

Collaboration diagram for libcamera::ConverterDW100Module:
[legend]

## Public Member Functions

int | init (const YamlObject &params)
| Initialize the module with configuration data.
int | configure (const StreamConfiguration &inputCfg, const std::vector< std::reference_wrapper< StreamConfiguration > > &outputCfg)
| Configure a set of output stream conversion from an input stream.
bool | isConfigured (const Stream *stream) const
| Check if a given stream is configured.
Size | adjustInputSize (const PixelFormat &pixFmt, const Size &size, Converter::Alignment align=Converter::Alignment::Down)
| Adjust the converter input size to a valid value.
Size | adjustOutputSize (const PixelFormat &pixFmt, const Size &size, Converter::Alignment align=Converter::Alignment::Down)
| Adjust the converter output size to a valid value.
int | exportBuffers (const Stream *stream, unsigned int count, std::vector< std::unique_ptr< FrameBuffer > > *buffers)
| Export buffers from the converter device.
int | validateOutput (StreamConfiguration *cfg, bool *adjusted, Converter::Alignment align=Converter::Alignment::Down)
| Validate and possibily adjust cfg to a valid converter output.
int | queueBuffers (FrameBuffer *input, const std::map< const Stream *, FrameBuffer * > &outputs)
| Queue buffers to converter device.
int | start ()
| Start the converter streaming operation.
void | stop ()
| Stop the converter streaming operation.
void | updateControlInfos (const Stream *stream, ControlInfoMap::Map &infos)
| Update the controls.
void | setControls (const Stream *stream, const ControlList &controls)
| Set libcamera controls.
void | populateMetadata (const Stream *stream, ControlList &meta)
| Retrieve updated metadata.
void | setSensorCrop (const Rectangle &rect)
| Set sensor crop rectangle.
void | setTransform (const Stream *stream, const Transform &transform)
| Set transform.

## Static Public Member Functions

static std::unique_ptr< ConverterDW100Module > | createModule (DeviceEnumerator *enumerator)
| Create a ConverterDW100Module.

## Public Attributes

Signal< FrameBuffer * > | inputBufferReady
| A signal emitted when the input frame buffer completes.
Signal< FrameBuffer * > | outputBufferReady
| A signal emitted on each frame buffer completion of the output queue.

## Detailed Description

A converter module for the dw100 dewarper.

This class implements a converter module with direct support for libcamera controls. Functionality wise it closely resembles the libcamera::Converter interface. The main difference is that V4L2 requests are handled internally and it has direct support for libcamera controls.

## Member Function Documentation

## adjustInputSize()

Size libcamera::ConverterDW100Module::adjustInputSize | ( | const PixelFormat & | pixFmt,
|  | const Size & | size,
|  | Converter::Alignment | align = Converter::Alignment::Down )

Adjust the converter input size to a valid value.

Parameters

  [in] | pixFmt | The pixel format of the converter input stream
  [in] | size | The converter input size to adjust to a valid value
  [in] | align | The desired alignment

Returns
  The adjusted converter input size or a null Size if size cannot be adjusted

## adjustOutputSize()

Size libcamera::ConverterDW100Module::adjustOutputSize | ( | const PixelFormat & | pixFmt,
|  | const Size & | size,
|  | Converter::Alignment | align = Converter::Alignment::Down )

Adjust the converter output size to a valid value.

Parameters

  [in] | pixFmt | The pixel format of the converter output stream
  [in] | size | The converter output size to adjust to a valid value
  [in] | align | The desired alignment

Returns
  The adjusted converter output size or a null Size if size cannot be adjusted

## configure()

int libcamera::ConverterDW100Module::configure | ( | const StreamConfiguration & | inputCfg,
|  | const std::vector< std::reference_wrapper< StreamConfiguration > > & | outputCfgs )

Configure a set of output stream conversion from an input stream.

Parameters

  [in] | inputCfg | Input stream configuration
  [out] | outputCfgs | A list of output stream configurations

Returns
  0 on success or a negative error code otherwise

## createModule()

std::unique_ptr< ConverterDW100Module > libcamera::ConverterDW100Module::createModule | ( | DeviceEnumerator * | enumerator | ) |

static

Create a ConverterDW100Module.

Parameters

  [in] | enumerator | The enumerator

Static factory function that searches for the dw100 device using the provided enumerator. If found, a ConverterDW100Module is instantiated and returned.

Returns
  A ConverterDW100Module or null if no converter was found

## exportBuffers()

int libcamera::ConverterDW100Module::exportBuffers | ( | const Stream * | stream,
|  | unsigned int | count,
|  | std::vector< std::unique_ptr< FrameBuffer > > * | buffers )

Export buffers from the converter device.

Parameters

  [in] | stream | Output stream pointer exporting the buffers
  [in] | count | Number of buffers to allocate
  [out] | buffers | Vector to store allocated buffers

This function operates similarly to V4L2VideoDevice::exportBuffers() on the output stream indicated by the output.

Returns
  The number of allocated buffers on success or a negative error code otherwise

## init()

int libcamera::ConverterDW100Module::init | ( | const YamlObject & | params | ) |

Initialize the module with configuration data.

Parameters

  [in] | params | The config parameters

This function shall be called from the pipeline handler to initialize the module with the provided parameters.

A typical tuning file entry for the dewarper looks like this:

modules:
- Dewarp:
cm: [
1.0, 0.0, 0.0,
0.0, 1.0, 0.0,
0.0, 0.0, 1.0,
]
coefficients: [
0,0,0,0,0,
]

The cm and coefficients parameters are documented in Dw100VertexMap::setDewarpParams()

See also
  Dw100VertexMap::setDewarpParams()

Returns
  0 if successful, an error code otherwise

## isConfigured()

bool libcamera::ConverterDW100Module::isConfigured | ( | const Stream * | stream | ) | const

Check if a given stream is configured.

Parameters

  [in] | stream | The output stream

Returns
  True if the stream is configured or false otherwise

## populateMetadata()

void libcamera::ConverterDW100Module::populateMetadata | ( | const Stream * | stream,
|  | ControlList & | meta )

Retrieve updated metadata.

Parameters

  [in] | stream | The stream
  [in] | meta | The metadata list

This function retrieves the metadata for the provided stream and writes it to list. It shall be called after queueBuffers().

## queueBuffers()

int libcamera::ConverterDW100Module::queueBuffers | ( | FrameBuffer * | input,
|  | const std::map< const Stream *, FrameBuffer * > & | outputs )

Queue buffers to converter device.

Parameters

  [in] | input | The frame buffer to apply the conversion
  [out] | outputs | The container holding the output stream pointers and their respective frame buffer outputs.

This function queues the input frame buffer and the output frame buffers contained in outputs to the device for processing.

Controls are automatically applied to the device before queuing buffers. V4L2 requests are used to atomically apply the controls if the kernel supports it.

Returns
  0 on success or a negative error code otherwise

## setControls()

void libcamera::ConverterDW100Module::setControls | ( | const Stream * | stream,
|  | const ControlList & | controls )

Set libcamera controls.

Parameters

  [in] | stream | The stream to update
  [in] | controls | The controls

Looks up all supported controls in controls and sets them on stream stream. The controls will be applied to the device on the next call to queueBuffers().

## setSensorCrop()

void libcamera::ConverterDW100Module::setSensorCrop | ( | const Rectangle & | rect | ) |

Set sensor crop rectangle.

Parameters

  [in] | rect | The crop rectangle

Set the sensor crop rectangle to rect. This rectangle describes the area covered by the input buffers in sensor coordinates. It is used internally to handle the ScalerCrop control and related metadata.

## setTransform()

void libcamera::ConverterDW100Module::setTransform | ( | const Stream * | stream,
|  | const Transform & | transform )

Set transform.

Parameters

  [in] | stream | The stream
  [in] | transform | The transform

Set the transform that shall be applied by the dewarper on the given stream. As orientation is a property of libcamera::CameraConfiguration, the transform needs to be set at configure time.

## start()

int libcamera::ConverterDW100Module::start | ( |  | ) |

Start the converter streaming operation.

Returns
  0 on success or a negative error code otherwise

## stop()

void libcamera::ConverterDW100Module::stop | ( |  | ) |

Stop the converter streaming operation.

## updateControlInfos()

void libcamera::ConverterDW100Module::updateControlInfos | ( | const Stream * | stream,
|  | ControlInfoMap::Map & | controls )

Update the controls.

Parameters

  [in] | stream | The stream
  [in,out] | controls | The controls info map to update

Updated the controls map with all the controls and limits provided by this class.

## validateOutput()

int libcamera::ConverterDW100Module::validateOutput | ( | StreamConfiguration * | cfg,
|  | bool * | adjusted,
|  | Converter::Alignment | align = Converter::Alignment::Down )

Validate and possibily adjust cfg to a valid converter output.

Parameters

  [in,out] | cfg | The StreamConfiguration to validate and adjust
  [out] | adjusted | Set to true if cfg has been adjusted
  [in] | align | The desired alignment

Returns
  0 if cfg is valid or has been adjusted, a negative error code otherwise if cfg cannot be adjusted

The documentation for this class was generated from the following files:

- include/libcamera/internal/converter/converter_dw100.h
- src/libcamera/converter/converter_dw100.cpp