libcamera v0.5.1 Supporting cameras in Linux since 2019 |

Loading...
Searching...
No Matches
Classes | Public Member Functions | Protected Attributes | List of all members
libcamera::ipa::CameraSensorHelper Class Reference

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

## Classes
struct | AnalogueGainExp
| Analogue gain constants for the exponential gain model. More...
struct | AnalogueGainLinear
| Analogue gain constants for the linear gain model. More...

## Public Member Functions
| CameraSensorHelper ()=default
| Construct a CameraSensorHelper instance.
std::optional< int16_t > | blackLevel () const
| Fetch the black level of the sensor.
virtual uint32_t | gainCode (double gain) const
| Compute gain code from the analogue gain absolute value.
virtual double | gain (uint32_t gainCode) const
| Compute the real gain from the V4L2 subdev control gain code.

## Protected Attributes
std::optional< int16_t > | blackLevel_
| The black level of the sensor.
std::variant< std::monostate, AnalogueGainLinear, AnalogueGainExp > | gain_
| The analogue gain parameters used for calculation.

## 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.

## Constructor & Destructor Documentation

## ◆ CameraSensorHelper()

libcamera::ipa::CameraSensorHelper::CameraSensorHelper | ( |  | ) |
| default

Construct a CameraSensorHelper instance.

CameraSensorHelper derived class instances shall never be constructed manually but always through the CameraSensorHelperFactoryBase::create() function.

## Member Function Documentation

## ◆ blackLevel()

std::optional< int16_t > libcamera::ipa::CameraSensorHelper::blackLevel | ( |  | ) | const
| inline

Fetch the black level of the sensor.

This function returns the black level of the sensor scaled to a 16bit pixel width. If it is unknown an empty optional is returned.

Todo
  Fill the blanks and add pedestal values for all supported sensors. Once done, drop the std::optional<>.

Black levels are typically the result of the following phenomena:

- Pedestal added by the sensor to pixel values. They are typically fixed, sometimes programmable and should be reported in datasheets (but documentation is not always available).
- Dark currents and other physical effects that add charge to pixels in the absence of light. Those can depend on the integration time and the sensor die temperature, and their contribution to pixel values depend on the sensor gains.

The pedestal is usually the value with the biggest contribution to the overall black level. In most cases it is either known before or in rare cases (there is not a single driver with such a control in the linux kernel) can be queried from the sensor. This function provides that fixed, known value.

Returns
  The black level of the sensor, or std::nullopt if not known

## ◆ gain()

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

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

Parameters

  [in] | gainCode | The 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

Compute gain code from the analogue gain absolute value.

Parameters

  [in] | gain | The 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

## ◆ blackLevel_

std::optional<int16_t> libcamera::ipa::CameraSensorHelper::blackLevel_
| protected

The black level of the sensor.

See also
  CameraSensorHelper::blackLevel()

## ◆ gain_

std::variant<std::monostate, AnalogueGainLinear, AnalogueGainExp> libcamera::ipa::CameraSensorHelper::gain_
| 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:

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