[PATCH 1/3] ipa: rkisp1: agc: Use better default value for analogue gain

Mikhail Rudenko mike.rudenko at gmail.com
Thu Oct 17 14:46:11 CEST 2024


At present, analogue gain in IPA context is initialized to the minimum
sensor gain in configure(). Many sensors report minimum analogue gain
of 0, which is by no means a sane default. Use a reasonable default of
1.0 instead. Also move the default exposure to a named constant.

Signed-off-by: Mikhail Rudenko <mike.rudenko at gmail.com>
---
 src/ipa/rkisp1/algorithms/agc.cpp | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/ipa/rkisp1/algorithms/agc.cpp b/src/ipa/rkisp1/algorithms/agc.cpp
index 17d074d9..339cddef 100644
--- a/src/ipa/rkisp1/algorithms/agc.cpp
+++ b/src/ipa/rkisp1/algorithms/agc.cpp
@@ -30,9 +30,13 @@
 namespace libcamera {
 
 using namespace std::literals::chrono_literals;
+using utils::Duration;
 
 namespace ipa::rkisp1::algorithms {
 
+constexpr double defaultAnalogueGain = 1.0;
+constexpr Duration defaultExposureTime = 10.0ms;
+
 /**
  * \class Agc
  * \brief A mean-based auto-exposure algorithm
@@ -164,9 +168,9 @@ int Agc::init(IPAContext &context, const YamlObject &tuningData)
 int Agc::configure(IPAContext &context, const IPACameraSensorInfo &configInfo)
 {
 	/* Configure the default exposure and gain. */
-	context.activeState.agc.automatic.gain = context.configuration.sensor.minAnalogueGain;
+	context.activeState.agc.automatic.gain = defaultAnalogueGain;
 	context.activeState.agc.automatic.exposure =
-		10ms / context.configuration.sensor.lineDuration;
+		defaultExposureTime / context.configuration.sensor.lineDuration;
 	context.activeState.agc.manual.gain = context.activeState.agc.automatic.gain;
 	context.activeState.agc.manual.exposure = context.activeState.agc.automatic.exposure;
 	context.activeState.agc.autoEnabled = !context.configuration.raw;
-- 
2.46.0



More information about the libcamera-devel mailing list