[PATCH v2 14/17] libipa: lux: Update for a normalized referenceY to 1
Stefan Klug
stefan.klug at ideasonboard.com
Thu Jan 23 12:41:04 CET 2025
By normalizing the referenceY value to 1 (which is the usual range for
Y) in the tuning file, the bins_ value is no longer needed. Remove it.
Signed-off-by: Stefan Klug <stefan.klug at ideasonboard.com>
---
Changes in v2:
- Added this patch
---
src/ipa/libipa/lux.cpp | 16 ++++------------
src/ipa/libipa/lux.h | 3 +--
src/ipa/rkisp1/algorithms/lux.cpp | 4 ----
3 files changed, 5 insertions(+), 18 deletions(-)
diff --git a/src/ipa/libipa/lux.cpp b/src/ipa/libipa/lux.cpp
index bae8198fa169..899e88248f04 100644
--- a/src/ipa/libipa/lux.cpp
+++ b/src/ipa/libipa/lux.cpp
@@ -43,11 +43,6 @@ namespace ipa {
* that depend on the estimated lux value.
*/
-/**
- * \var Lux::binSize_
- * \brief The maximum count of each bin
- */
-
/**
* \var Lux::referenceExposureTime_
* \brief The exposure time of the reference image, in microseconds
@@ -65,9 +60,8 @@ namespace ipa {
/**
* \var Lux::referenceY_
- * \brief The measured luminance of the reference image, out of the bin size
+ * \brief The measured luminance of the reference image, normalized to 1
*
- * \sa binSize_
*/
/**
@@ -77,10 +71,8 @@ namespace ipa {
/**
* \brief Construct the Lux helper module
- * \param[in] binSize The maximum count of each bin
*/
-Lux::Lux(unsigned int binSize)
- : binSize_(binSize)
+Lux::Lux()
{
}
@@ -97,7 +89,7 @@ Lux::Lux(unsigned int binSize)
* referenceExposureTime: 10000
* referenceAnalogueGain: 4.0
* referenceDigitalGain: 1.0
- * referenceY: 12000
+ * referenceY: 0.1831
* referenceLux: 1000
* \endcode
*
@@ -167,7 +159,7 @@ double Lux::estimateLux(utils::Duration exposureTime,
double exposureTimeRatio = referenceExposureTime_ / exposureTime;
double aGainRatio = referenceAnalogueGain_ / aGain;
double dGainRatio = referenceDigitalGain_ / dGain;
- double yRatio = currentY * (binSize_ / yHist.bins()) / referenceY_;
+ double yRatio = (currentY / yHist.bins()) / referenceY_;
double estimatedLux = exposureTimeRatio * aGainRatio * dGainRatio *
yRatio * referenceLux_;
diff --git a/src/ipa/libipa/lux.h b/src/ipa/libipa/lux.h
index 93ca64795803..d95bcdafcfcd 100644
--- a/src/ipa/libipa/lux.h
+++ b/src/ipa/libipa/lux.h
@@ -21,7 +21,7 @@ class Histogram;
class Lux
{
public:
- Lux(unsigned int binSize);
+ Lux();
int parseTuningData(const YamlObject &tuningData);
double estimateLux(utils::Duration exposureTime,
@@ -29,7 +29,6 @@ public:
const Histogram &yHist) const;
private:
- unsigned int binSize_;
utils::Duration referenceExposureTime_;
double referenceAnalogueGain_;
double referenceDigitalGain_;
diff --git a/src/ipa/rkisp1/algorithms/lux.cpp b/src/ipa/rkisp1/algorithms/lux.cpp
index b0f74963af4f..a467767e1298 100644
--- a/src/ipa/rkisp1/algorithms/lux.cpp
+++ b/src/ipa/rkisp1/algorithms/lux.cpp
@@ -33,12 +33,8 @@ namespace ipa::rkisp1::algorithms {
/**
* \brief Construct an rkisp1 Lux algo module
- *
- * The Lux helper is initialized to 65535 as that is the max bin count on the
- * rkisp1.
*/
Lux::Lux()
- : lux_(65535)
{
}
--
2.43.0
More information about the libcamera-devel
mailing list