libcamera v0.0.0+3423-a7ab5ef1
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 ipu3_uapi_stats_3a *stats) override;
32
33private:
34 double measureBrightness(const ipu3_uapi_stats_3a *stats,
35 const ipu3_uapi_grid_config &grid) const;
36 void filterExposure();
37 void computeExposure(IPAFrameContext &frameContext, double yGain,
38 double iqMeanGain);
39 double estimateLuminance(IPAFrameContext &frameContext,
40 const ipu3_uapi_grid_config &grid,
41 const ipu3_uapi_stats_3a *stats,
42 double gain);
43
44 uint64_t frameCount_;
45
46 utils::Duration lineDuration_;
47 utils::Duration minShutterSpeed_;
48 utils::Duration maxShutterSpeed_;
49
50 double minAnalogueGain_;
51 double maxAnalogueGain_;
52
53 utils::Duration filteredExposure_;
54 utils::Duration currentExposure_;
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:15
A mean-based auto-exposure algorithm.
Definition: agc.h:25
int configure(IPAContext &context, const IPAConfigInfo &configInfo) override
Configure the AGC given a configInfo.
Definition: agc.cpp:86
void process(IPAContext &context, const ipu3_uapi_stats_3a *stats) override
Process IPU3 statistics, and run AGC operations.
Definition: agc.cpp:316
Helper class from std::chrono::duration that represents a time duration in nanoseconds with double pr...
Definition: utils.h:324
Data structures related to geometric objects.
Algorithm common interface.
Top-level libcamera namespace.
Definition: backtrace.h:17
Global IPA context data shared between all algorithms.
Definition: ipa_context.h:63
Per-frame context for algorithms.
Definition: ipa_context.h:36
Miscellaneous utility functions.