diff options
author | Paul Elder <paul.elder@ideasonboard.com> | 2024-12-16 16:01:48 +0900 |
---|---|---|
committer | Paul Elder <paul.elder@ideasonboard.com> | 2024-12-23 17:37:34 +0900 |
commit | bd077a11eed5bad324cfe72ae04f8d3835bb2459 (patch) | |
tree | e7a383536d7201778a38f1ae5202b201c87686e7 /src/ipa/libipa/lux.h | |
parent | e37830925130afd541449ed22df0bc952c19a94a (diff) |
ipa: libipa: Add Lux helper
Add a Lux helper to libipa that does the estimation of the lux level
given gain, exposure, and luminance histogram. The helper also
handles reading the reference values from the tuning file. These are
expected to be common operations of lux algorithm modules in IPAs, and
is modeled/copied from Raspberry Pi.
Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Isaac Scott <isaac.scott@ideasonboard.com>
Diffstat (limited to 'src/ipa/libipa/lux.h')
-rw-r--r-- | src/ipa/libipa/lux.h | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/src/ipa/libipa/lux.h b/src/ipa/libipa/lux.h new file mode 100644 index 00000000..93ca6479 --- /dev/null +++ b/src/ipa/libipa/lux.h @@ -0,0 +1,42 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ +/* + * Copyright (C) 2019, Raspberry Pi Ltd + * Copyright (C) 2024, Paul Elder <paul.elder@ideasonboard.com> + * + * Helper class that implements lux estimation + */ + +#pragma once + +#include <libcamera/base/utils.h> + +namespace libcamera { + +class YamlObject; + +namespace ipa { + +class Histogram; + +class Lux +{ +public: + Lux(unsigned int binSize); + + int parseTuningData(const YamlObject &tuningData); + double estimateLux(utils::Duration exposureTime, + double aGain, double dGain, + const Histogram &yHist) const; + +private: + unsigned int binSize_; + utils::Duration referenceExposureTime_; + double referenceAnalogueGain_; + double referenceDigitalGain_; + double referenceY_; + double referenceLux_; +}; + +} /* namespace ipa */ + +} /* namespace libcamera */ |