summaryrefslogtreecommitdiff
path: root/src/ipa/ipu3/ipu3.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/ipa/ipu3/ipu3.cpp')
-rw-r--r--src/ipa/ipu3/ipu3.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp
index a4d327ab..f5343547 100644
--- a/src/ipa/ipu3/ipu3.cpp
+++ b/src/ipa/ipu3/ipu3.cpp
@@ -21,6 +21,7 @@
#include "libcamera/internal/buffer.h"
#include "libcamera/internal/log.h"
+#include "ipu3_agc.h"
#include "ipu3_awb.h"
static constexpr uint32_t kMaxCellWidthPerSet = 160;
@@ -72,6 +73,8 @@ private:
/* Interface to the AWB algorithm */
std::unique_ptr<IPU3Awb> awbAlgo_;
+ /* Interface to the AEC/AGC algorithm */
+ std::unique_ptr<IPU3Agc> agcAlgo_;
/* Local parameter storage */
struct ipu3_uapi_params params_;
@@ -170,6 +173,9 @@ void IPAIPU3::configure(const std::map<uint32_t, ControlInfoMap> &entityControls
awbAlgo_ = std::make_unique<IPU3Awb>();
awbAlgo_->initialise(params_, bdsOutputSize, bdsGrid_);
+
+ agcAlgo_ = std::make_unique<IPU3Agc>();
+ agcAlgo_->initialise(bdsGrid_);
}
void IPAIPU3::mapBuffers(const std::vector<IPABuffer> &buffers)
@@ -241,8 +247,8 @@ void IPAIPU3::processControls([[maybe_unused]] unsigned int frame,
void IPAIPU3::fillParams(unsigned int frame, ipu3_uapi_params *params)
{
- /* Pass a default gamma of 1.0 (default linear correction) */
- awbAlgo_->updateWbParameters(params_, 1.0);
+ if (agcAlgo_->updateControls())
+ awbAlgo_->updateWbParameters(params_, agcAlgo_->gamma());
*params = params_;
@@ -257,8 +263,12 @@ void IPAIPU3::parseStatistics(unsigned int frame,
{
ControlList ctrls(controls::controls);
+ agcAlgo_->process(stats, exposure_, gain_);
awbAlgo_->calculateWBGains(stats);
+ if (agcAlgo_->updateControls())
+ setControls(frame);
+
IPU3Action op;
op.op = ActionMetadataReady;
op.controls = ctrls;