libcamera v0.7.0+1-4ceceb68
Supporting cameras in Linux since 2019
Loading...
Searching...
No Matches
Classes | Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
libcamera::ConverterDW100Module Class Reference

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

Collaboration diagram for libcamera::ConverterDW100Module:
Collaboration graph
[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< ConverterDW100ModulecreateModule (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]pixFmtThe pixel format of the converter input stream
[in]sizeThe converter input size to adjust to a valid value
[in]alignThe 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]pixFmtThe pixel format of the converter output stream
[in]sizeThe converter output size to adjust to a valid value
[in]alignThe 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]inputCfgInput stream configuration
[out]outputCfgsA 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]enumeratorThe 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]streamOutput stream pointer exporting the buffers
[in]countNumber of buffers to allocate
[out]buffersVector 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]paramsThe 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]streamThe 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]streamThe stream
[in]metaThe 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]inputThe frame buffer to apply the conversion
[out]outputsThe 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]streamThe stream to update
[in]controlsThe 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]rectThe 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]streamThe stream
[in]transformThe 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]streamThe stream
[in,out]controlsThe 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]cfgThe StreamConfiguration to validate and adjust
[out]adjustedSet to true if cfg has been adjusted
[in]alignThe 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: