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

libcamera v0.7.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
17#include "camera_sensor_helper.h"
18
19namespace libcamera {
20
21namespace ipa {
22
23 class ExposureModeHelper
24{
25public:
26 ExposureModeHelper(const Span<std::pair<utils::Duration, double>> stages);
27 ~ExposureModeHelper() = default;
28
29 void configure(utils::Duration lineLength, const CameraSensorHelper *sensorHelper);
30 void setLimits(utils::Duration minExposureTime, utils::Duration maxExposureTime,
31 double minGain, double maxGain);
32
33 std::tuple<utils::Duration, double, double, double>
34 splitExposure(utils::Duration exposure) const;
35
36 utils::Duration minExposureTime() const { return minExposureTime_; }
37 utils::Duration maxExposureTime() const { return maxExposureTime_; }
38 double minGain() const { return minGain_; }
39 double maxGain() const { return maxGain_; }
40
41private:
42 utils::Duration clampExposureTime(utils::Duration exposureTime,
43 double *quantizationGain = nullptr) const;
44 double clampGain(double gain, double *quantizationGain = nullptr) const;
45
46 std::vector<utils::Duration> exposureTimes_;
47 std::vector<double> gains_;
48
49 utils::Duration lineDuration_;
50 utils::Duration minExposureTime_;
51 utils::Duration maxExposureTime_;
52 double minGain_;
53 double maxGain_;
54 const CameraSensorHelper *sensorHelper_;
55};
56
57} /* namespace ipa */
58
59} /* namespace libcamera */
camera_sensor_helper.h
Helper class that performs sensor-specific parameter computations.
libcamera::ipa::CameraSensorHelper
Base class for computing sensor tuning parameters using sensor-specific constants.
Definition camera_sensor_helper.h:24
libcamera::ipa::ExposureModeHelper::configure
void configure(utils::Duration lineLength, const CameraSensorHelper *sensorHelper)
Configure sensor details.
Definition exposure_mode_helper.cpp:97
libcamera::ipa::ExposureModeHelper::minExposureTime
utils::Duration minExposureTime() const
Retrieve the configured minimum exposure time limit set through setLimits().
Definition exposure_mode_helper.h:36
libcamera::ipa::ExposureModeHelper::splitExposure
std::tuple< utils::Duration, double, double, double > splitExposure(utils::Duration exposure) const
Split exposure into exposure time and gain.
Definition exposure_mode_helper.cpp:194
libcamera::ipa::ExposureModeHelper::setLimits
void setLimits(utils::Duration minExposureTime, utils::Duration maxExposureTime, double minGain, double maxGain)
Set the exposure time and gain limits.
Definition exposure_mode_helper.cpp:120
libcamera::ipa::ExposureModeHelper::minGain
double minGain() const
Retrieve the configured minimum gain set through setLimits().
Definition exposure_mode_helper.h:38
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 setLimits().
Definition exposure_mode_helper.h:39
libcamera::ipa::ExposureModeHelper::maxExposureTime
utils::Duration maxExposureTime() const
Retrieve the configured maximum exposure time set through setLimits().
Definition exposure_mode_helper.h:37
libcamera::utils::Duration
Helper class from std::chrono::duration that represents a time duration in nanoseconds with double pr...
Definition utils.h:331
libcamera::ipa
The IPA (Image Processing Algorithm) namespace.
Definition af.cpp:58
libcamera
Top-level libcamera namespace.
Definition backtrace.h:17
utils.h
Miscellaneous utility functions.