summaryrefslogtreecommitdiff
path: root/src/ipa/ipu3/ipu3.cpp
diff options
context:
space:
mode:
authorJean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>2021-08-18 17:54:03 +0200
committerJean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>2021-08-20 12:11:29 +0200
commit93802f600cf4c3bf15c9d044b980927615e800f4 (patch)
tree0f8415569586240b89560b59984052598f4e38cb /src/ipa/ipu3/ipu3.cpp
parentb145ae42428b9f21fff01d7353a655e07e818c33 (diff)
ipa: ipu3: Move IPU3 agc into algorithms
Now that the interface is properly used by the AGC class, move it into ipa::ipu3::algorithms and let the loops do the calls. As we need to exchange the exposure_ and gain_ by passing them through the FrameContext, use the calculated values in setControls() function to ease the reading. Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'src/ipa/ipu3/ipu3.cpp')
-rw-r--r--src/ipa/ipu3/ipu3.cpp20
1 files changed, 8 insertions, 12 deletions
diff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp
index 5fc358fa..0ed0a6f1 100644
--- a/src/ipa/ipu3/ipu3.cpp
+++ b/src/ipa/ipu3/ipu3.cpp
@@ -29,10 +29,10 @@
#include "libcamera/internal/mapped_framebuffer.h"
+#include "algorithms/agc.h"
#include "algorithms/algorithm.h"
#include "algorithms/awb.h"
#include "algorithms/tone_mapping.h"
-#include "ipu3_agc.h"
#include "libipa/camera_sensor_helper.h"
/**
@@ -187,8 +187,6 @@ private:
uint32_t minGain_;
uint32_t maxGain_;
- /* Interface to the AEC/AGC algorithm */
- std::unique_ptr<IPU3Agc> agcAlgo_;
/* Interface to the Camera Helper */
std::unique_ptr<CameraSensorHelper> camHelper_;
@@ -268,6 +266,7 @@ int IPAIPU3::init(const IPASettings &settings,
*ipaControls = ControlInfoMap(std::move(controls), controls::controls);
/* Construct our Algorithms */
+ algorithms_.push_back(std::make_unique<algorithms::Agc>());
algorithms_.push_back(std::make_unique<algorithms::Awb>());
algorithms_.push_back(std::make_unique<algorithms::ToneMapping>());
@@ -386,9 +385,6 @@ int IPAIPU3::configure(const IPAConfigInfo &configInfo)
return ret;
}
- agcAlgo_ = std::make_unique<IPU3Agc>();
- agcAlgo_->configure(context_, configInfo);
-
return 0;
}
@@ -476,15 +472,12 @@ void IPAIPU3::parseStatistics(unsigned int frame,
{
ControlList ctrls(controls::controls);
- for (auto const &algo : algorithms_)
- algo->process(context_, stats);
-
/* \todo These fields should not be written by the IPAIPU3 layer */
context_.frameContext.agc.gain = camHelper_->gain(gain_);
context_.frameContext.agc.exposure = exposure_;
- agcAlgo_->process(context_, stats);
- exposure_ = context_.frameContext.agc.exposure;
- gain_ = camHelper_->gainCode(context_.frameContext.agc.gain);
+
+ for (auto const &algo : algorithms_)
+ algo->process(context_, stats);
setControls(frame);
@@ -505,6 +498,9 @@ void IPAIPU3::setControls(unsigned int frame)
IPU3Action op;
op.op = ActionSetSensorControls;
+ exposure_ = context_.frameContext.agc.exposure;
+ gain_ = camHelper_->gainCode(context_.frameContext.agc.gain);
+
ControlList ctrls(ctrls_);
ctrls.set(V4L2_CID_EXPOSURE, static_cast<int32_t>(exposure_));
ctrls.set(V4L2_CID_ANALOGUE_GAIN, static_cast<int32_t>(gain_));