libcamera: src/ipa/libipa/exposure_mode_helper.h Source File

libcamera v0.3.2 Supporting cameras in Linux since 2019

Loading...
Searching...
No Matches
exposure_mode_helper.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: LGPL-2.1-or-later */
2/*
3 * Copyright (C) 2024, Paul Elder <paul.elder@ideasonboard.com>
4 *
5 * Helper class that performs computations relating to exposure
6 */
7
8#pragma once
9
10#include <tuple>
11#include <utility>
12#include <vector>
13
14#include <libcamera/base/span.h>
15#include <libcamera/base/utils.h>
16
17namespace libcamera {
18
19namespace ipa {
20
21 class ExposureModeHelper
22{
23public:
24 ExposureModeHelper(const Span<std::pair<utils::Duration, double>> stages);
25 ~ExposureModeHelper() = default;
26
27 void setLimits(utils::Duration minShutter, utils::Duration maxShutter,
28 double minGain, double maxGain);
29
30 std::tuple<utils::Duration, double, double>
31 splitExposure(utils::Duration exposure) const;
32
33 utils::Duration minShutter() const { return minShutter_; }
34 utils::Duration maxShutter() const { return maxShutter_; }
35 double minGain() const { return minGain_; }
36 double maxGain() const { return maxGain_; }
37
38private:
39 utils::Duration clampShutter(utils::Duration shutter) const;
40 double clampGain(double gain) const;
41
42 std::vector<utils::Duration> shutters_;
43 std::vector<double> gains_;
44
45 utils::Duration minShutter_;
46 utils::Duration maxShutter_;
47 double minGain_;
48 double maxGain_;
49};
50
51} /* namespace ipa */
52
53} /* namespace libcamera */
libcamera::ipa::ExposureModeHelper
Class for splitting exposure into shutter time and total gain.
Definition exposure_mode_helper.h:22
libcamera::ipa::ExposureModeHelper::maxShutter
utils::Duration maxShutter() const
Retrieve the configured maximum shutter time set through setShutterGainLimits()
Definition exposure_mode_helper.h:34
libcamera::ipa::ExposureModeHelper::splitExposure
std::tuple< utils::Duration, double, double > splitExposure(utils::Duration exposure) const
Split exposure time into shutter time and gain.
Definition exposure_mode_helper.cpp:153
libcamera::ipa::ExposureModeHelper::minShutter
utils::Duration minShutter() const
Retrieve the configured minimum shutter time limit set through setShutterGainLimits()
Definition exposure_mode_helper.h:33
libcamera::ipa::ExposureModeHelper::setLimits
void setLimits(utils::Duration minShutter, utils::Duration maxShutter, double minGain, double maxGain)
Set the shutter time and gain limits.
Definition exposure_mode_helper.cpp:101
libcamera::ipa::ExposureModeHelper::minGain
double minGain() const
Retrieve the configured minimum gain set through setShutterGainLimits()
Definition exposure_mode_helper.h:35
libcamera::ipa::ExposureModeHelper::ExposureModeHelper
ExposureModeHelper(const Span< std::pair< utils::Duration, double > > stages)
Construct an ExposureModeHelper instance.
Definition exposure_mode_helper.cpp:72
libcamera::ipa::ExposureModeHelper::maxGain
double maxGain() const
Retrieve the configured maximum gain set through setShutterGainLimits()
Definition exposure_mode_helper.h:36
libcamera::utils::Duration
Helper class from std::chrono::duration that represents a time duration in nanoseconds with double pr...
Definition utils.h:354
libcamera
Top-level libcamera namespace.
Definition backtrace.h:17
utils.h
Miscellaneous utility functions.