summaryrefslogtreecommitdiff
path: root/src/ipa/ipu3/algorithms/agc.cpp
diff options
context:
space:
mode:
authorJean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>2021-10-25 23:28:48 +0200
committerJean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>2021-10-26 14:10:34 +0200
commit4d4694cd9f4ea73586dcb75d19905a1860356d9f (patch)
treeef9085636d7c9f9e99bb70c3b657279353282da1 /src/ipa/ipu3/algorithms/agc.cpp
parent40eb2309997806f8671d820af580073e4aaf20da (diff)
ipa: ipu3: agc: Clamp shutter speed
In case the maximum exposure received from the sensor is very high, we can have a very high shutter speed with a small analogue gain, and it may result in very slow framerate. We are not really supporting it for the moment, so clamp the shutter speed to an arbitrary value of 60ms. Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com> Tested-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Diffstat (limited to 'src/ipa/ipu3/algorithms/agc.cpp')
-rw-r--r--src/ipa/ipu3/algorithms/agc.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/ipa/ipu3/algorithms/agc.cpp b/src/ipa/ipu3/algorithms/agc.cpp
index b89d1559..b5d736c1 100644
--- a/src/ipa/ipu3/algorithms/agc.cpp
+++ b/src/ipa/ipu3/algorithms/agc.cpp
@@ -54,6 +54,9 @@ static constexpr uint32_t kFrameSkipCount = 6;
static constexpr double kMinAnalogueGain = 1.0;
static constexpr double kMaxAnalogueGain = 8.0;
+/* \todo Honour the FrameDurationLimits control instead of hardcoding a limit */
+static constexpr utils::Duration kMaxShutterSpeed = 60ms;
+
/* Histogram constants */
static constexpr uint32_t knumHistogramBins = 256;
@@ -84,7 +87,8 @@ int Agc::configure(IPAContext &context, const IPAConfigInfo &configInfo)
/* \todo replace the exposure in lines storage with time based ones. */
minExposureLines_ = context.configuration.agc.minShutterSpeed / lineDuration_;
- maxExposureLines_ = context.configuration.agc.maxShutterSpeed / lineDuration_;
+ maxExposureLines_ = std::min(context.configuration.agc.maxShutterSpeed / lineDuration_,
+ kMaxShutterSpeed / lineDuration_);
minAnalogueGain_ = std::max(context.configuration.agc.minAnalogueGain, kMinAnalogueGain);
maxAnalogueGain_ = std::min(context.configuration.agc.maxAnalogueGain, kMaxAnalogueGain);