summaryrefslogtreecommitdiff
path: root/src/ipa/ipu3/algorithms/agc.cpp
diff options
context:
space:
mode:
authorJean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>2021-10-12 16:44:54 +0200
committerJean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>2021-10-22 07:29:53 +0200
commita58a784e53f4c350a912aa36a1103ee2f259aedb (patch)
tree0697a9f34290ad5ad48488fbe32e8c41980fa656 /src/ipa/ipu3/algorithms/agc.cpp
parent355503233baae4ebf4ad6fd64023e66d4b05cb7e (diff)
ipa: ipu3: agc: Change analogue gain limits
The gains are currently set as a uint32_t while the analogue gain is passed as a double. We also have a default maximum analogue gain of 15 which is quite high for a number of sensors. Use a maximum value of 8 which should really be configured by the IPA and not fixed as it is now. While at it make it a double. Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'src/ipa/ipu3/algorithms/agc.cpp')
-rw-r--r--src/ipa/ipu3/algorithms/agc.cpp14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/ipa/ipu3/algorithms/agc.cpp b/src/ipa/ipu3/algorithms/agc.cpp
index 58872410..984aed53 100644
--- a/src/ipa/ipu3/algorithms/agc.cpp
+++ b/src/ipa/ipu3/algorithms/agc.cpp
@@ -30,14 +30,10 @@ static constexpr uint32_t kInitialFrameMinAECount = 4;
/* Number of frames to wait between new gain/exposure estimations */
static constexpr uint32_t kFrameSkipCount = 6;
-/* Maximum ISO value for analogue gain */
-static constexpr uint32_t kMinISO = 100;
-static constexpr uint32_t kMaxISO = 1500;
-
/* Maximum analogue gain value
* \todo grab it from a camera helper */
-static constexpr uint32_t kMinGain = kMinISO / 100;
-static constexpr uint32_t kMaxGain = kMaxISO / 100;
+static constexpr double kMinGain = 1.0;
+static constexpr double kMaxGain = 8.0;
/* Histogram constants */
static constexpr uint32_t knumHistogramBins = 256;
@@ -166,9 +162,11 @@ void Agc::lockExposureGain(uint32_t &exposure, double &gain)
minExposureLines_,
maxExposureLines_);
newExposure = currentExposure_ / exposure;
- gain = std::clamp(static_cast<uint32_t>(gain * currentExposure_ / newExposure), kMinGain, kMaxGain);
+ gain = std::clamp(gain * currentExposure_ / newExposure,
+ kMinGain, kMaxGain);
} else {
- gain = std::clamp(static_cast<uint32_t>(gain * currentExposure_ / currentExposureNoDg_), kMinGain, kMaxGain);
+ gain = std::clamp(gain * currentExposure_ / currentExposureNoDg_,
+ kMinGain, kMaxGain);
newExposure = currentExposure_ / gain;
exposure = std::clamp<uint32_t>(exposure * currentExposure_ / newExposure,
minExposureLines_,