libcamera v0.7.2+rpt20260817
Supporting cameras in Linux since 2019
Loading...
Searching...
No Matches
libcamera::ipa::V4L2Stats< Traits > Class Template Reference

Helper class that represents an ISP statistics buffer. More...

Inheritance diagram for libcamera::ipa::V4L2Stats< Traits >:
Collaboration diagram for libcamera::ipa::V4L2Stats< Traits >:

Public Member Functions

 V4L2Stats (Span< uint8_t > data, unsigned int version)
 Construct an instance of V4L2Stats.
 
template<typename Traits::id_type Id>
const Traits::template id_to_details< Id >::type * block () const
 Retrieve a pointer to an ISP statistics block.
 
- Public Member Functions inherited from libcamera::ipa::V4L2StatsBase
 V4L2StatsBase (Span< uint8_t > data, unsigned int version)
 Construct an instance of V4L2StatsBase.
 
Span< const uint8_t > block (unsigned int blockType, size_t blockSize) const
 Retrieve an ISP statistics block and return a reference to it.
 
constexpr operator bool ()
 Retrieve if a V4L2StatsBase has been successfully constructed.
 

Detailed Description

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

Helper class that represents an ISP statistics buffer.

This class represents an ISP statistics buffer. It is constructed with a reference to the memory mapped buffer that has been dequeued from 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 'stats_traits' type that helps the class associate a block type with the actual memory area that represents the ISP statistics block.

// Define the supported ISP statistics blocks
enum class myISPStats {
Agc,
Awb,
...
};
// Maps the C++ enum type to the kernel enum type and concrete parameter type
template<myISPStats B>
struct block_type {
};
template<>
struct block_type<myISPStats::Agc> {
using type = struct my_isp_kernel_stats_type_agc;
static constexpr kernel_enum_type blockType = MY_ISP_STATS_TYPE_AGC;
};
template<>
struct block_type<myISPStats::Awb> {
using type = struct my_isp_kernel_stats_type_awb;
static constexpr kernel_enum_type blockType = MY_ISP_STATS_TYPE_AWB;
};
// Convenience type to associate a block id to the 'block_type' overload
struct stats_traits {
using id_type = myISPStats;
template<id_type Id> using id_to_details = block_type<Id>;
};
...
// Derive the V4L2Stats class by providing stats_traits
class MyISPStats : public V4L2Stats<stats_traits>
{
public:
MyISPStats::MyISPStats(Span<uint8_t> data)
: V4L2Stats(data, V4L2_ISP_VERSION_V1)
{
}
};
V4L2Stats(Span< uint8_t > data, unsigned int version)
Construct an instance of V4L2Stats.
Definition v4l2_stats.h:44

Users of this class can then easily access an ISP statistics block using the block() function.

MyISPStats stats(data);
auto awb = stats.block<myISPStats::AWB>();
auto mean_r = awb->mean_r;
auto mean_g = awb->mean_g;
auto mean_b = awb->mean_b;

Constructor & Destructor Documentation

◆ V4L2Stats()

template<typename Traits >
libcamera::ipa::V4L2Stats< Traits >::V4L2Stats ( Span< uint8_t >  data,
unsigned int  version 
)
inline

Construct an instance of V4L2Stats.

Parameters
[in]dataReference to the v4l2-buffer memory mapped area
[in]versionThe expected V4L2 ISP serialization format version

Member Function Documentation

◆ block()

template<typename Traits >
template<typename Traits::id_type Id>
libcamera::ipa::V4L2Stats< Traits >::block ( ) const
inline

Retrieve a pointer to an ISP statistics block.

Returns
A pointer to the ISP statistics block or nullptr if the block is not present in the statistics buffer

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