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

Message ID 20241017124613.3853273-2-mike.rudenko@gmail.com
State Superseded
Headers show
Series
  • Reduce rkisp1 flicker on first start
Related show

Commit Message

Mikhail Rudenko Oct. 17, 2024, 12:46 p.m. UTC
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@gmail.com>
---
 src/ipa/rkisp1/algorithms/agc.cpp | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Patch
diff mbox series

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;