libcamera v0.0.1
Supporting cameras in Linux since 2019
agc.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: LGPL-2.1-or-later */
2/*
3 * Copyright (C) 2021, Ideas On Board
4 *
5 * agc.h - IPU3 AGC/AEC mean-based control algorithm
6 */
7
8#pragma once
9
10#include <linux/intel-ipu3.h>
11
13
14#include <libcamera/geometry.h>
15
16#include "algorithm.h"
17
18namespace libcamera {
19
20struct IPACameraSensorInfo;
21
22namespace ipa::ipu3::algorithms {
23
24class Agc : public Algorithm
25{
26public:
27 Agc();
28 ~Agc() = default;
29
30 int configure(IPAContext &context, const IPAConfigInfo &configInfo) override;
31 void process(IPAContext &context, const uint32_t frame,
32 IPAFrameContext &frameContext,
33 const ipu3_uapi_stats_3a *stats) override;
34
35private:
36 double measureBrightness(const ipu3_uapi_stats_3a *stats,
37 const ipu3_uapi_grid_config &grid) const;
38 utils::Duration filterExposure(utils::Duration currentExposure);
39 void computeExposure(IPAContext &context, IPAFrameContext &frameContext,
40 double yGain, double iqMeanGain);
41 double estimateLuminance(IPAActiveState &activeState,
42 const ipu3_uapi_grid_config &grid,
43 const ipu3_uapi_stats_3a *stats,
44 double gain);
45
46 uint64_t frameCount_;
47
48 utils::Duration minShutterSpeed_;
49 utils::Duration maxShutterSpeed_;
50
51 double minAnalogueGain_;
52 double maxAnalogueGain_;
53
54 utils::Duration filteredExposure_;
55
56 uint32_t stride_;
57};
58
59} /* namespace ipa::ipu3::algorithms */
60
61} /* namespace libcamera */
The base class for all IPA algorithms.
Definition: algorithm.h:23
A mean-based auto-exposure algorithm.
Definition: agc.h:25
void process(IPAContext &context, const uint32_t frame, IPAFrameContext &frameContext, const ipu3_uapi_stats_3a *stats) override
Process IPU3 statistics, and run AGC operations.
Definition: agc.cpp:327
int configure(IPAContext &context, const IPAConfigInfo &configInfo) override
Configure the AGC given a configInfo.
Definition: agc.cpp:86
Helper class from std::chrono::duration that represents a time duration in nanoseconds with double pr...
Definition: utils.h:330
Data structures related to geometric objects.
Algorithm common interface.
Top-level libcamera namespace.
Definition: backtrace.h:17
The active state of the IPA algorithms.
Definition: ipa_context.h:47
Global IPA context data shared between all algorithms.
Definition: ipa_context.h:82
IPU3-specific FrameContext.
Definition: ipa_context.h:75
Miscellaneous utility functions.