libcamera  v0.2.0+31-5e4dc46a
Supporting cameras in Linux since 2019
Classes | Public Member Functions | Protected Types | Protected Attributes | List of all members
libcamera::ipa::CameraSensorHelper Class Reference

Base class for computing sensor tuning parameters using sensor-specific constants. More...

Collaboration diagram for libcamera::ipa::CameraSensorHelper:
Collaboration graph
[legend]

Classes

struct  AnalogueGainConstants
 Analogue gain model constants. More...
 
struct  AnalogueGainExpConstants
 Analogue gain constants for the exponential gain model. More...
 
struct  AnalogueGainLinearConstants
 Analogue gain constants for the linear gain model. More...
 

Public Member Functions

virtual uint32_t gainCode (double gain) const
 Construct a CameraSensorHelper instance. More...
 
virtual double gain (uint32_t gainCode) const
 Compute the real gain from the V4L2 subdev control gain code. More...
 

Protected Types

enum  AnalogueGainType { AnalogueGainLinear, AnalogueGainExponential }
 The gain calculation modes as defined by the MIPI CCS. More...
 

Protected Attributes

AnalogueGainType gainType_
 The analogue gain model type.
 
AnalogueGainConstants gainConstants_
 The analogue gain parameters used for calculation. More...
 

Detailed Description

Base class for computing sensor tuning parameters using sensor-specific constants.

Instances derived from CameraSensorHelper class are sensor-specific. Each supported sensor will have an associated base class defined.

Member Enumeration Documentation

◆ AnalogueGainType

The gain calculation modes as defined by the MIPI CCS.

Describes the image sensor analogue gain capabilities. Two modes are possible, depending on the sensor: Linear and Exponential.

Enumerator
AnalogueGainLinear 

Gain is computed using linear gain estimation.

The relationship between the integer gain parameter and the resulting gain multiplier is given by the following equation:

$gain=\frac{m0x+c0}{m1x+c1}$

Where 'x' is the gain control parameter, and m0, m1, c0 and c1 are image-sensor-specific constants of the sensor. These constants are static parameters, and for any given image sensor either m0 or m1 shall be zero.

The full Gain equation therefore reduces to either:

$gain=\frac{c0}{m1x+c1}$ or $\frac{m0x+c0}{c1}$

AnalogueGainExponential 

Gain is expressed using an exponential model.

The relationship between the integer gain parameter and the resulting gain multiplier is given by the following equation:

$gain = a \cdot 2^{m \cdot x}$

Where 'x' is the gain control parameter, and 'a' and 'm' are image sensor-specific constants.

This is a subset of the MIPI CCS exponential gain model with the linear factor 'a' being a constant, but with the exponent being configurable through the 'm' coefficient.

When the gain is expressed in dB, 'a' is equal to 1 and 'm' to $log_{2}{10^{\frac{1}{20}}}$.

Member Function Documentation

◆ gain()

double libcamera::ipa::CameraSensorHelper::gain ( uint32_t  gainCode) const
virtual

Compute the real gain from the V4L2 subdev control gain code.

Parameters
[in]gainCodeThe V4L2 subdev control gain

This function aims to abstract the calculation of the gain letting the IPA use the real gain for its estimations. It is the counterpart of the function CameraSensorHelper::gainCode.

Returns
The real gain

◆ gainCode()

uint32_t libcamera::ipa::CameraSensorHelper::gainCode ( double  gain) const
virtual

Construct a CameraSensorHelper instance.

CameraSensorHelper derived class instances shall never be constructed manually but always through the CameraSensorHelperFactoryBase::create() function. Compute gain code from the analogue gain absolute value

Parameters
[in]gainThe real gain to pass

This function aims to abstract the calculation of the gain letting the IPA use the real gain for its estimations.

Returns
The gain code to pass to V4L2

Member Data Documentation

◆ gainConstants_

libcamera::ipa::CameraSensorHelper::gainConstants_
protected

The analogue gain parameters used for calculation.

The analogue gain is calculated through a formula, and its parameters are sensor specific. Use this variable to store the values at init time.


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