libcamera v0.7.2+rpt20261009
Supporting cameras in Linux since 2019
Loading...
Searching...
No Matches
libcamera::ipa::GammaAlgorithmBase Class Reference

Base class for GammaAlgorithm to implement non-templated functions. More...

Inheritance diagram for libcamera::ipa::GammaAlgorithmBase:

Public Member Functions

 GammaAlgorithmBase (unsigned int nLutNodes)
 Construct an instance of the class.
 
int init (ControlInfoMap::Map &controls, const ValueNode &tuningData, std::span< unsigned int > segments={})
 Initialise the algorithm with the given tuning data.
 
void configure (gamma::ActiveState &state)
 Configure the gamma correction algorithm.
 
void queueRequest (gamma::ActiveState &state, const uint32_t frame, gamma::FrameContext &context, const ControlList &controls)
 Queue a request to the gamma correction algorithm.
 
void process (gamma::FrameContext &context, ControlList &metadata)
 Populate metadata with the gamma correction values for a frame.
 

Protected Attributes

unsigned int nLutNodes_
 The number of gamma LUT sampling points.
 
float defaultGamma_
 The default gamma parameter.
 
std::vector< float > kneePoints_
 a vector holding the X-position of the knee points of the curve
 

Detailed Description

Base class for GammaAlgorithm to implement non-templated functions.

This base class for GammeaAlgorithm allows us to implement non templated functions. IPA specific implementations shall derive from GammaAlgorithm and not this class.

Constructor & Destructor Documentation

◆ GammaAlgorithmBase()

libcamera::ipa::GammaAlgorithmBase::GammaAlgorithmBase ( unsigned int  nLutNodes)
inline

Construct an instance of the class.

Parameters
[in]nLutNodesSet the number of function knee-points expected by the IPA algorithm

Member Function Documentation

◆ configure()

void libcamera::ipa::GammaAlgorithmBase::configure ( gamma::ActiveState &  state)

Configure the gamma correction algorithm.

Parameters
[out]stateThe gamma correction algorithm's active state

Reset to the default gamma correction value.

IPA modules are expected to call this function as part of their implementation of Algorithm::configure()

◆ init()

int libcamera::ipa::GammaAlgorithmBase::init ( ControlInfoMap::Map &  controls,
const ValueNode &  tuningData,
std::span< unsigned int >  segments = {} 
)

Initialise the algorithm with the given tuning data.

Parameters
[out]controlsThe ControlList into which this algorithm's supported controls will be emplaced.
[in]tuningDataThe tuning data to use with the algorithm
[in]segmentsA vector of segment spacings to define a custom X coordinate system for the curve

Parse tuningData and segments to initialize the gamma correction curve. The tuning data may contain a default gamma value to use; otherwise the value of kDefaultGamma will be taken as the default. The piecewise linear function will be applied on a number of knots whose position is described by the optional segments argument, which describes each segment's relative length.

For example, if the gamma correction has to be applied on 16 equally spaced sampling points, a segments array like:

[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]

would result in evenly spaced knee-points along the X-axis.

Hardware may expect the knee-points to be spaced more densely towards the start of the curve and more sparsely towards the end, in which case an alternative array might be:

[1, 1, 1, 1, 2, 2, 2, 2, 4, 4, 4, 8, 8, 8, 8, 8]

As the values in segments represent the distance between two knee-points relative to the total distance between the first and last point, the length of segments should be equal to the number of knee-points minus one. ; If an IPA implementation doesnt't provide segments, the GammaAlgorithm class consturcts an evenly-spaced default.

IPA modules are expected to call this function as part of their implementation of Algorithm::init()

Returns
0 on success, a negative error code otherwise

◆ process()

void libcamera::ipa::GammaAlgorithmBase::process ( gamma::FrameContext &  context,
ControlList &  metadata 
)

Populate metadata with the gamma correction values for a frame.

Parameters
[in]contextThe frame context
[out]metadataThe ControlList of metadata for a frame

Report the gamma value used to calculate the correction curve that was applied to a frame.

◆ queueRequest()

void libcamera::ipa::GammaAlgorithmBase::queueRequest ( gamma::ActiveState &  state,
const uint32_t  frame,
gamma::FrameContext &  context,
const ControlList &  controls 
)

Queue a request to the gamma correction algorithm.

Parameters
[in]stateThe algorithm's active state
[in]frameThe current frame number
[in]contextThe algorithm's frame context
[in]controlsThe ControlList that was queued with the request

Queue a new request to the gamma correction algorithm and handle any relevant controls that were queued. The only control currently handled is:

If a control with that ID is queued the value is stored in state and context.

IPA modules are expected to call this function as part of their implementation of Algorithm::queueRequest()


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