From 9613cf0ad0f9ad1e09b76ada7f5e11edfe6a9532 Mon Sep 17 00:00:00 2001 From: Jacopo Mondi Date: Fri, 10 Mar 2023 16:51:25 +0100 Subject: ipa: rkisp1: agc: Load ExposureValue from config Load the initial ExpoureValue correction value from configuration file. Signed-off-by: Jacopo Mondi --- src/ipa/rkisp1/algorithms/agc.cpp | 15 ++++++++++++++- src/ipa/rkisp1/algorithms/agc.h | 1 + 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/ipa/rkisp1/algorithms/agc.cpp b/src/ipa/rkisp1/algorithms/agc.cpp index 97a08c35..cb72962c 100644 --- a/src/ipa/rkisp1/algorithms/agc.cpp +++ b/src/ipa/rkisp1/algorithms/agc.cpp @@ -63,6 +63,7 @@ static constexpr double kEvGainTarget = 0.5; * \todo Why is the value different between IPU3 and RkISP1 ? */ static constexpr double kRelativeLuminanceTarget = 0.4; +static double initExposureValue = 0.0; Agc::Agc() : frameCount_(0), numCells_(0), numHistBins_(0), filteredExposure_(0s) @@ -70,6 +71,17 @@ Agc::Agc() supportsRaw_ = true; } +/** + * \copydoc libcamera::ipa::Algorithm::init + */ +int Agc::init([[maybe_unused]] IPAContext &context, + const YamlObject &tuningData) +{ + initExposureValue = tuningData["ExposureValue"].get().value_or(0.0); + + return 0; +} + /** * \brief Configure the AGC given a configInfo * \param[in] context The shared IPA context @@ -88,7 +100,8 @@ int Agc::configure(IPAContext &context, const IPACameraSensorInfo &configInfo) 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; - context.activeState.agc.exposureValue = 0.0; + + context.activeState.agc.exposureValue = initExposureValue; /* * According to the RkISP1 documentation: diff --git a/src/ipa/rkisp1/algorithms/agc.h b/src/ipa/rkisp1/algorithms/agc.h index 8a222637..0fc3acb5 100644 --- a/src/ipa/rkisp1/algorithms/agc.h +++ b/src/ipa/rkisp1/algorithms/agc.h @@ -25,6 +25,7 @@ public: Agc(); ~Agc() = default; + int init(IPAContext &context, const YamlObject &tuningData) override; int configure(IPAContext &context, const IPACameraSensorInfo &configInfo) override; void queueRequest(IPAContext &context, const uint32_t frame, -- cgit v1.2.1