summaryrefslogtreecommitdiff
path: root/src/ipa/rkisp1/algorithms/agc.cpp
diff options
context:
space:
mode:
authorJacopo Mondi <jacopo.mondi@ideasonboard.com>2023-05-29 14:39:26 +0200
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2023-06-06 18:17:35 +0300
commitea93e7899fbfbc34dec3cdb08aca8ac9a51d414b (patch)
tree818aaa25376befa02a1b68ab3f341608ac074451 /src/ipa/rkisp1/algorithms/agc.cpp
parentdb86713ec17978cd4d42b74cece5be34aaa6a693 (diff)
ipa: rkisp1: agc: Restore minimum analogue gain limit
Commit a3178dd0391f ("ipa: rkisp1: agc: drop hard-coded analogue gain range") removed both minimum and maximum limits for the analogue gain value. However, as some sensors can potentially have a minimum gain lower than 1.0, restore the check for the minimum limit. Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'src/ipa/rkisp1/algorithms/agc.cpp')
-rw-r--r--src/ipa/rkisp1/algorithms/agc.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/ipa/rkisp1/algorithms/agc.cpp b/src/ipa/rkisp1/algorithms/agc.cpp
index a4e5500e..e5aeb342 100644
--- a/src/ipa/rkisp1/algorithms/agc.cpp
+++ b/src/ipa/rkisp1/algorithms/agc.cpp
@@ -36,6 +36,9 @@ namespace ipa::rkisp1::algorithms {
LOG_DEFINE_CATEGORY(RkISP1Agc)
+/* Minimum limit for analogue gain value */
+static constexpr double kMinAnalogueGain = 1.0;
+
/* \todo Honour the FrameDurationLimits control instead of hardcoding a limit */
static constexpr utils::Duration kMaxShutterSpeed = 60ms;
@@ -254,7 +257,8 @@ void Agc::computeExposure(IPAContext &context, IPAFrameContext &frameContext,
utils::Duration maxShutterSpeed = std::min(configuration.sensor.maxShutterSpeed,
kMaxShutterSpeed);
- double minAnalogueGain = configuration.sensor.minAnalogueGain;
+ double minAnalogueGain = std::max(configuration.sensor.minAnalogueGain,
+ kMinAnalogueGain);
double maxAnalogueGain = configuration.sensor.maxAnalogueGain;
/* Consider within 1% of the target as correctly exposed. */