libcamera: src/ipa/ipu3/ipa_context.h Source File

libcamera v0.3.2 Supporting cameras in Linux since 2019

Loading...
Searching...
No Matches
ipa_context.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: LGPL-2.1-or-later */
2/*
3 * Copyright (C) 2021, Google Inc.
4 *
5 * IPU3 IPA Context
6 *
7 */
8
9#pragma once
10
11#include <linux/intel-ipu3.h>
12
13#include <libcamera/base/utils.h>
14
15#include <libcamera/controls.h>
16#include <libcamera/geometry.h>
17
18#include <libipa/fc_queue.h>
19
20namespace libcamera {
21
22namespace ipa::ipu3 {
23
24 struct IPASessionConfiguration {
25 struct {
26 ipu3_uapi_grid_config bdsGrid;
27 Size bdsOutputSize;
28 uint32_t stride;
29 } grid;
30
31 struct {
32 ipu3_uapi_grid_config afGrid;
33 } af;
34
35 struct {
36 utils::Duration minShutterSpeed;
37 utils::Duration maxShutterSpeed;
38 double minAnalogueGain;
39 double maxAnalogueGain;
40 } agc;
41
42 struct {
43 int32_t defVBlank;
44 utils::Duration lineDuration;
45 Size size;
46 } sensor;
47};
48
49 struct IPAActiveState {
50 struct {
51 uint32_t focus;
52 double maxVariance;
53 bool stable;
54 } af;
55
56 struct {
57 uint32_t exposure;
58 double gain;
59 uint32_t constraintMode;
60 uint32_t exposureMode;
61 } agc;
62
63 struct {
64 struct {
65 double red;
66 double green;
67 double blue;
68 } gains;
69
70 double temperatureK;
71 } awb;
72
73 struct {
74 double gamma;
75 struct ipu3_uapi_gamma_corr_lut gammaCorrection;
76 } toneMapping;
77};
78
79 struct IPAFrameContext : public FrameContext {
80 struct {
81 uint32_t exposure;
82 double gain;
83 } sensor;
84};
85
86 struct IPAContext {
87 IPASessionConfiguration configuration;
88 IPAActiveState activeState;
89
90 FCQueue<IPAFrameContext> frameContexts;
91
92 ControlInfoMap::Map ctrlMap;
93};
94
95} /* namespace ipa::ipu3 */
96
97} /* namespace libcamera*/
libcamera::ControlInfoMap::Map
std::unordered_map< const ControlId *, ControlInfo > Map
The base std::unsorted_map<> container.
Definition controls.h:308
libcamera::Size
Describe a two-dimensional size.
Definition geometry.h:53
libcamera::ipa::FCQueue
A support class for managing FrameContext instances in IPA modules.
Definition fc_queue.h:32
libcamera::utils::Duration
Helper class from std::chrono::duration that represents a time duration in nanoseconds with double pr...
Definition utils.h:354
controls.h
Framework to manage controls related to an object.
fc_queue.h
Queue of per-frame contexts.
geometry.h
Data structures related to geometric objects.
libcamera
Top-level libcamera namespace.
Definition backtrace.h:17
libcamera::ipa::FrameContext
Context for a frame.
Definition fc_queue.h:24
libcamera::ipa::ipu3::IPAActiveState
The active state of the IPA algorithms.
Definition ipa_context.h:49
libcamera::ipa::ipu3::IPAActiveState::gamma
double gamma
Gamma value for the LUT.
Definition ipa_context.h:74
libcamera::ipa::ipu3::IPAActiveState::exposure
uint32_t exposure
Exposure time expressed as a number of lines.
Definition ipa_context.h:57
libcamera::ipa::ipu3::IPAActiveState::blue
double blue
White balance gain for B channel.
Definition ipa_context.h:67
libcamera::ipa::ipu3::IPAActiveState::awb
struct libcamera::ipa::ipu3::IPAActiveState::@11 awb
Context for the Automatic White Balance algorithm.
libcamera::ipa::ipu3::IPAActiveState::gains
struct libcamera::ipa::ipu3::IPAActiveState::@11::@13 gains
White balance gains.
libcamera::ipa::ipu3::IPAActiveState::green
double green
White balance gain for G channel.
Definition ipa_context.h:66
libcamera::ipa::ipu3::IPAActiveState::gain
double gain
Analogue gain multiplier.
Definition ipa_context.h:58
libcamera::ipa::ipu3::IPAActiveState::stable
bool stable
It is set to true, if the best focus is found.
Definition ipa_context.h:53
libcamera::ipa::ipu3::IPAActiveState::af
struct libcamera::ipa::ipu3::IPAActiveState::@9 af
Context for the Automatic Focus algorithm.
libcamera::ipa::ipu3::IPAActiveState::red
double red
White balance gain for R channel.
Definition ipa_context.h:65
libcamera::ipa::ipu3::IPAActiveState::gammaCorrection
struct ipu3_uapi_gamma_corr_lut gammaCorrection
Per-pixel tone mapping implemented as a LUT.
Definition ipa_context.h:75
libcamera::ipa::ipu3::IPAActiveState::focus
uint32_t focus
Current position of the lens.
Definition ipa_context.h:51
libcamera::ipa::ipu3::IPAActiveState::toneMapping
struct libcamera::ipa::ipu3::IPAActiveState::@12 toneMapping
Context for ToneMapping and Gamma control.
libcamera::ipa::ipu3::IPAActiveState::maxVariance
double maxVariance
The maximum variance of the current image.
Definition ipa_context.h:52
libcamera::ipa::ipu3::IPAActiveState::temperatureK
double temperatureK
Estimated color temperature.
Definition ipa_context.h:70
libcamera::ipa::ipu3::IPAActiveState::agc
struct libcamera::ipa::ipu3::IPAActiveState::@10 agc
Context for the Automatic Gain Control algorithm.
libcamera::ipa::ipu3::IPAContext
Global IPA context data shared between all algorithms.
Definition ipa_context.h:86
libcamera::ipa::ipu3::IPAContext::configuration
IPASessionConfiguration configuration
The IPA session configuration, immutable during the session.
Definition ipa_context.h:87
libcamera::ipa::ipu3::IPAContext::frameContexts
FCQueue< IPAFrameContext > frameContexts
Ring buffer of the IPAFrameContext(s)
Definition ipa_context.h:90
libcamera::ipa::ipu3::IPAContext::ctrlMap
ControlInfoMap::Map ctrlMap
A ControlInfoMap::Map of controls populated by the algorithms.
Definition ipa_context.h:92
libcamera::ipa::ipu3::IPAContext::activeState
IPAActiveState activeState
The current state of IPA algorithms.
Definition ipa_context.h:88
libcamera::ipa::ipu3::IPAFrameContext
IPU3-specific FrameContext.
Definition ipa_context.h:79
libcamera::ipa::ipu3::IPAFrameContext::gain
double gain
Analogue gain multiplier.
Definition ipa_context.h:82
libcamera::ipa::ipu3::IPAFrameContext::exposure
uint32_t exposure
Exposure time expressed as a number of lines.
Definition ipa_context.h:81
libcamera::ipa::ipu3::IPAFrameContext::sensor
struct libcamera::ipa::ipu3::IPAFrameContext::@14 sensor
Effective sensor values that were applied for the frame.
libcamera::ipa::ipu3::IPASessionConfiguration
Session configuration for the IPA module.
Definition ipa_context.h:24
libcamera::ipa::ipu3::IPASessionConfiguration::bdsGrid
ipu3_uapi_grid_config bdsGrid
Bayer Down Scaler grid plane config used by the kernel.
Definition ipa_context.h:26
libcamera::ipa::ipu3::IPASessionConfiguration::afGrid
ipu3_uapi_grid_config afGrid
AF scene grid configuration.
Definition ipa_context.h:32
libcamera::ipa::ipu3::IPASessionConfiguration::minAnalogueGain
double minAnalogueGain
Minimum analogue gain supported with the configured sensor.
Definition ipa_context.h:38
libcamera::ipa::ipu3::IPASessionConfiguration::af
struct libcamera::ipa::ipu3::IPASessionConfiguration::@6 af
AF grid configuration of the IPA.
libcamera::ipa::ipu3::IPASessionConfiguration::agc
struct libcamera::ipa::ipu3::IPASessionConfiguration::@7 agc
AGC parameters configuration of the IPA.
libcamera::ipa::ipu3::IPASessionConfiguration::grid
struct libcamera::ipa::ipu3::IPASessionConfiguration::@5 grid
Grid configuration of the IPA.
libcamera::ipa::ipu3::IPASessionConfiguration::sensor
struct libcamera::ipa::ipu3::IPASessionConfiguration::@8 sensor
Sensor-specific configuration of the IPA.
libcamera::ipa::ipu3::IPASessionConfiguration::lineDuration
utils::Duration lineDuration
Line duration in microseconds.
Definition ipa_context.h:44
libcamera::ipa::ipu3::IPASessionConfiguration::minShutterSpeed
utils::Duration minShutterSpeed
Minimum shutter speed supported with the configured sensor.
Definition ipa_context.h:36
libcamera::ipa::ipu3::IPASessionConfiguration::size
Size size
Sensor output resolution.
Definition ipa_context.h:45
libcamera::ipa::ipu3::IPASessionConfiguration::bdsOutputSize
Size bdsOutputSize
BDS output size configured by the pipeline handler.
Definition ipa_context.h:27
libcamera::ipa::ipu3::IPASessionConfiguration::defVBlank
int32_t defVBlank
The default vblank value of the sensor.
Definition ipa_context.h:43
libcamera::ipa::ipu3::IPASessionConfiguration::maxShutterSpeed
utils::Duration maxShutterSpeed
Maximum shutter speed supported with the configured sensor.
Definition ipa_context.h:37
libcamera::ipa::ipu3::IPASessionConfiguration::maxAnalogueGain
double maxAnalogueGain
Maximum analogue gain supported with the configured sensor.
Definition ipa_context.h:39
libcamera::ipa::ipu3::IPASessionConfiguration::stride
uint32_t stride
Number of cells on one line including the ImgU padding.
Definition ipa_context.h:28
utils.h
Miscellaneous utility functions.