57 std::span<const unsigned int> segments);
64template<
unsigned int NLutNodes,
typename UQ>
67 static_assert(NLutNodes >= 2);
76 std::optional<std::span<const unsigned int, NLutNodes - 1>> segments = {})
80 segments ? *segments : std::span<const unsigned int>{});
86 for (
unsigned int i = 0; i < nLutNodes_; i++) {
87 float gamma = std::pow(kneePoints_[i], 1.0f / context.
gamma);
88 lut[i] =
UQ(gamma).quantized();
90 LOG(Gamma, Debug) <<
"LUT[" << i <<
"]=" << gamma
91 <<
"(" << lut[i] <<
")";
std::unordered_map< const ControlId *, ControlInfo > Map
The base std::unsorted_map<> container.
Definition controls.h:411
Associate a list of ControlId with their values for an object.
Definition controls.h:453
A class representing a tree structure of values.
Definition value_node.h:27
Base class for GammaAlgorithm to implement non-templated functions.
Definition gamma.h:43
void queueRequest(gamma::ActiveState &state, const uint32_t frame, gamma::FrameContext &context, const ControlList &controls)
Queue a request to the gamma correction algorithm.
Definition gamma.cpp:147
int init(ControlInfoMap::Map &controls, const ValueNode &tuningData, std::span< const unsigned int > segments)
Initialise the algorithm with the given tuning data.
Definition gamma.cpp:80
GammaAlgorithmBase(unsigned int nLutNodes)
Construct an instance of the class.
Definition gamma.h:45
void configure(gamma::ActiveState &state)
Configure the gamma correction algorithm.
Definition gamma.cpp:124
float defaultGamma_
The default gamma parameter.
Definition gamma.h:60
unsigned int nLutNodes_
The number of gamma LUT sampling points.
Definition gamma.h:59
void process(gamma::FrameContext &context, ControlList &metadata)
Populate metadata with the gamma correction values for a frame.
Definition gamma.cpp:173
std::vector< float > kneePoints_
a vector holding the X-position of the knee points of the curve
Definition gamma.h:61
The libipa gamma correction algorithm.
Definition gamma.h:66
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.
Definition gamma.h:75
void prepare(gamma::FrameContext &context, std::span< T, NLutNodes > lut)
Definition gamma.h:84
Camera controls identifiers.
#define LOG_DECLARE_CATEGORY(name)
Declare a category of log messages.
Definition log.h:51
#define LOG(category, severity)
Log a message.
Definition log.h:155
Quantized< FixedPointQTraits< I, F, std::make_unsigned_t< decltype(details::qtype< I+F >())> > > UQ
Define an unsigned fixed-point quantized type with automatic storage width.
Definition fixedpoint.h:111
Top-level libcamera namespace.
Definition backtrace.h:17
Active gamma correction algorithm state.
Definition gamma.h:31
float gamma
The gamma correction value.
Definition gamma.h:32
Per-frame gamma correction settings.
Definition gamma.h:35
bool update
A flag instructing the algorithm to push an update to the hardware.
Definition gamma.h:37
float gamma
The gamma correction value applied for this frame.
Definition gamma.h:36
Data structure to manage tree of values.