blob: 85c665d7d187305e741c4b9165b4d2b669791405 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
/* SPDX-License-Identifier: LGPL-2.1-or-later */
/*
* Copyright (C) 2024, Paul Elder <paul.elder@ideasonboard.com>
*
* Helper class that performs computations relating to exposure
*/
#pragma once
#include <tuple>
#include <utility>
#include <vector>
#include <libcamera/base/span.h>
#include <libcamera/base/utils.h>
namespace libcamera {
namespace ipa {
class ExposureModeHelper
{
public:
ExposureModeHelper(const Span<std::pair<utils::Duration, double>> stages);
~ExposureModeHelper() = default;
void setLimits(utils::Duration minShutter, utils::Duration maxShutter,
double minGain, double maxGain);
std::tuple<utils::Duration, double, double>
splitExposure(utils::Duration exposure) const;
utils::Duration minShutter() const { return minShutter_; }
utils::Duration maxShutter() const { return maxShutter_; }
double minGain() const { return minGain_; }
double maxGain() const { return maxGain_; }
private:
utils::Duration clampShutter(utils::Duration shutter) const;
double clampGain(double gain) const;
std::vector<utils::Duration> shutters_;
std::vector<double> gains_;
utils::Duration minShutter_;
utils::Duration maxShutter_;
double minGain_;
double maxGain_;
};
} /* namespace ipa */
} /* namespace libcamera */
|