libcamera v0.7.2+rpt20260817
Supporting cameras in Linux since 2019
Loading...
Searching...
No Matches
ccm.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: LGPL-2.1-or-later */
2/*
3 * Copyright (C) 2026 Ideas on Board Oy
4 *
5 * libIPA CCM algorithm
6 */
7
8#pragma once
9
11#include <libcamera/controls.h>
12
14
15#include "fixedpoint.h"
16#include "interpolator.h"
17
18namespace libcamera {
19
20namespace ipa {
21
22namespace ccm {
23
28
33
35
36} /* namespace ccm */
37
39{
40public:
41 int init(const ValueNode &tuningData);
42 int configure(ccm::ActiveState &state, unsigned int temperatureK);
44 const ControlList &controls);
45
46 void prepare(ccm::ActiveState &state, ccm::FrameContext &context,
47 unsigned int frame, unsigned int temperatureK);
48 void process(ccm::FrameContext &context, ControlList &metadata);
49
50private:
51 unsigned int ct_;
54};
55
56template<typename Q>
58{
59public:
60 int init(const ValueNode &tuningData, ControlInfoMap::Map &controls)
61 {
62 int ret = CcmAlgorithmBase::init(tuningData);
63 if (ret)
64 return ret;
65
67 ControlInfo(ControlValue(Q::TraitsType::min),
68 ControlValue(Q::TraitsType::max),
70
71 return 0;
72 }
73};
74
75} /* namespace ipa */
76
77} /* namespace libcamera */
std::unordered_map< const ControlId *, ControlInfo > Map
The base std::unsorted_map<> container.
Definition controls.h:367
Describe the limits of valid values for a Control.
Definition controls.h:330
Associate a list of ControlId with their values for an object.
Definition controls.h:409
Abstract type representing the value of a control.
Definition controls.h:134
Matrix class.
Definition matrix.h:31
A class representing a tree structure of values.
Definition value_node.h:27
Base class for CcmAlgorithm for non-templated functions implementation.
Definition ccm.h:39
int init(const ValueNode &tuningData)
Initialize the algorithm with the given tuning data.
Definition ccm.cpp:70
void prepare(ccm::ActiveState &state, ccm::FrameContext &context, unsigned int frame, unsigned int temperatureK)
Calculate the matrix coefficients for a colour temperature.
Definition ccm.cpp:170
int configure(ccm::ActiveState &state, unsigned int temperatureK)
Configure the CCM algorithm.
Definition ccm.cpp:103
void queueRequest(ccm::ActiveState &state, ccm::FrameContext &context, const ControlList &controls)
Queue a Request to the CCM algorithm.
Definition ccm.cpp:137
void process(ccm::FrameContext &context, ControlList &metadata)
Populate metadata with the latest correction matrix coefficients.
Definition ccm.cpp:191
The libipa CCM algorithm.
Definition ccm.h:58
int init(const ValueNode &tuningData, ControlInfoMap::Map &controls)
Definition ccm.h:60
Class for storing, retrieving, and interpolating objects.
Definition interpolator.h:28
Camera controls identifiers.
Framework to manage controls related to an object.
Helper class for linear interpolating a set of objects.
Matrix class.
const Control< Span< const float, 9 > > ColourCorrectionMatrix
The 3x3 matrix that converts camera RGB to sRGB within the imaging pipeline.
Top-level libcamera namespace.
Definition backtrace.h:17
Active CCM state.
Definition ccm.h:29
struct CcmContext manual
The most recent manually requested CCM state.
Definition ccm.h:30
struct CcmContext automatic
The most recent automatically calculated CCM state.
Definition ccm.h:31
CCM coefficients and offsets.
Definition ccm.h:24
Matrix< int16_t, 3, 1 > offsets
Vector of RGB CCM offsets.
Definition ccm.h:26
Matrix< float, 3, 3 > ccm
Matrix of 3x3 CCM coefficients.
Definition ccm.h:25