|
libcamera v0.8.0+1-3c8337a0-nvm
Supporting cameras in Linux since 2019
|
The libipa gamma correction algorithm. More...


Public Member Functions | |
| int | init (ControlInfoMap::Map &controls, const ValueNode &tuningData, std::optional< std::span< const unsigned int, NLutNodes - 1 > > segments={}) |
| Initialise the algorithm with the given tuning data. | |
| template<typename T > | |
| void | prepare (gamma::FrameContext &context, std::span< T, NLutNodes > lut) |
Public Member Functions inherited from libcamera::ipa::GammaAlgorithmBase | |
| GammaAlgorithmBase (unsigned int nLutNodes) | |
| Construct an instance of the class. | |
| 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. | |
Additional Inherited Members | |
Protected Member Functions inherited from libcamera::ipa::GammaAlgorithmBase | |
| int | init (ControlInfoMap::Map &controls, const ValueNode &tuningData, std::span< const unsigned int > segments) |
| Initialise the algorithm with the given tuning data. | |
Protected Attributes inherited from libcamera::ipa::GammaAlgorithmBase | |
| 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 | |
The libipa gamma correction algorithm.
| NLutNodes | The number of gamma LUT sampling points |
| UQ | The fixedpoint representation of the gamma correction values |
Gamma correction adjusts for the differences in the way light is perceived by a camera and the human eye by applying a function to the input values. The GammaAlgorithm class facilitates this by building a piecewise linear function from a gamma parameter and supplying it in the hardware-specific formats defined by the IPA algorithms.
IPA modules are expected to store an instance of GammaAlgorithm as a class member, templated with the format and number of knee-points in the PWL expected by their hardware and then call its functions in their overload of the Algorithm class's function.
When an application queues a new value for the gamma parameter with a Request, the GammaAlgorithm will recalculate and populate the new LUT to be sent to the ISP.
Useful links:
|
inline |
Initialise the algorithm with the given tuning data.
| [out] | controls | The ControlList into which this algorithm's supported controls will be emplaced. |
| [in] | tuningData | The tuning data to use with the algorithm |
| [in] | segments | A 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 doesn't provide segments, the GammaAlgorithm class constructs an evenly-spaced default.
IPA modules are expected to call this function as part of their implementation of Algorithm::init()
|
inline |
| T | The type of data expected by the hardware's look-up table |
| [in] | context | The frame context |
| [out] | lut | The std::span into which to place the calculated look-up table |