libcamera v0.7.1 Supporting cameras in Linux since 2019

Loading...
Searching...
No Matches
libcamera::ipa::V4L2Params< Traits > Class Template Reference

Helper class that represent an ISP configuration buffer. More...

## Public Member Functions
| V4L2Params (Span< uint8_t > data, unsigned int version)
| Construct an instance of V4L2Params.
size_t | bytesused () const
| Retrieve the used size of the parameters buffer (in bytes).
template<typename Traits::id_type Id>
auto | block ()
| Retrieve the location of an ISP configuration block a return it.

## Protected Member Functions
Span< uint8_t > | block (typename Traits::id_type type, unsigned int blockType, size_t blockSize)
| Populate an ISP configuration block a returns a reference to its memory.

## Protected Attributes
Span< uint8_t > | data_
| The ISP parameters buffer memory.
size_t | used_
| The number of bytes used in the parameters buffer.
std::map< typename Traits::id_type, Span< uint8_t > > | blocks_
| Cache of ISP configuration blocks.

## Detailed Description

template<typename Traits>
class libcamera::ipa::V4L2Params< Traits >

Helper class that represent an ISP configuration buffer.

This class represents an ISP configuration buffer. It is constructed with a reference to the memory mapped buffer that will be queued to the ISP driver.

This class is templated with the type of the enumeration of ISP blocks that each IPA module is expected to support. IPA modules are expected to derive this class by providing a 'param_traits' type that helps the class associate a block type with the actual memory area that represents the ISP configuration block.

// Define the supported ISP blocks
enum class myISPBlocks {
Agc,
Awb,
...
};
// Maps the C++ enum type to the kernel enum type and concrete parameter type
template<myISPBlocks B>
struct block_type {
};
template<>
struct block_type<myISPBlock::Agc> {
using type = struct my_isp_kernel_config_type_agc;
static constexpr kernel_enum_type blockType = MY_ISP_TYPE_AGC;
};
template<>
struct block_type<myISPBlock::Awb> {
using type = struct my_isp_kernel_config_type_awb;
static constexpr kernel_enum_type blockType = MY_ISP_TYPE_AWB;
};
// Convenience type to associate a block id to the 'block_type' overload
struct params_traits {
using id_type = myISPBlocks;
template<id_type Id> using id_to_details = block_type<Id>;
};
...
// Derive the V4L2Params class by providing params_traits
class MyISPParams : public V4L2Params<params_traits>
{
public:
MyISPParams::MyISPParams(Span<uint8_t> data)
: V4L2Params(data, kVersion)
{
}
};
libcamera::ipa::V4L2Params::V4L2Params
V4L2Params(Span< uint8_t > data, unsigned int version)
Construct an instance of V4L2Params.
Definition v4l2_params.h:75

Users of this class can then easily access an ISP configuration block as a V4L2ParamsBlock instance.

MyISPParams params(data);
auto awb = params.block<myISPBlocks::AWB>();
awb->gain00 = ...;
awb->gain01 = ...;
awb->gain10 = ...;
awb->gain11 = ...;

## Constructor & Destructor Documentation

## ◆ V4L2Params()

template<typename Traits>

libcamera::ipa::V4L2Params< Traits >::V4L2Params | ( | Span< uint8_t > | data,
|  | unsigned int | version )
| inline

Construct an instance of V4L2Params.

Parameters

  [in] | data | Reference to the v4l2-buffer memory mapped area
  [in] | version | The ISP parameters version the implementation supports

## Member Function Documentation

## ◆ block() [1/2]

template<typename Traits>
template<typename Traits::id_type Id>

auto libcamera::ipa::V4L2Params< Traits >::block | ( |  | ) |
| inline

Retrieve the location of an ISP configuration block a return it.

Returns
  A V4L2ParamsBlock instance that points to the ISP configuration block

## ◆ block() [2/2]

template<typename Traits>

Span< uint8_t > libcamera::ipa::V4L2Params< Traits >::block | ( | typename Traits::id_type | type,
|  | unsigned int | blockType,
|  | size_t | blockSize )
| inline protected

Populate an ISP configuration block a returns a reference to its memory.

Parameters

  [in] | type | The ISP block identifier enumerated by the IPA module
  [in] | blockType | The kernel-defined ISP block identifier, used to populate the block header
  [in] | blockSize | The ISP block size, used to populate the block header

Initialize the block header with blockType and blockSize and returns a reference to the memory used to store an ISP configuration block.

IPA modules that derive the V4L2Params class shall use this function to retrieve the memory area that will be used to construct a V4L2ParamsBlock<T> before returning it to the caller.

## ◆ bytesused()

template<typename Traits>

size_t libcamera::ipa::V4L2Params< Traits >::bytesused | ( |  | ) | const
| inline

Retrieve the used size of the parameters buffer (in bytes).

The parameters buffer size is mostly used to populate the v4l2_buffer bytesused field before queueing the buffer to the ISP.

Returns
  The number of bytes occupied by the ISP configuration parameters

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

- src/ipa/libipa/v4l2_params.h
- src/ipa/libipa/v4l2_params.cpp