From 87353f2bba282dbe52d610b1de1c2a638f70fc09 Mon Sep 17 00:00:00 2001 From: Daniel Scally Date: Thu, 2 May 2024 14:30:43 +0100 Subject: ipa: ipu3: Derive ipu3::algorithms::Agc from AgcMeanLuminance In preparation for switching to a derivation of AgcMeanLuminance, add a function to parse and store the statistics for easy retrieval in an overriding estimateLuminance() function. Now that we have a MeanLuminanceAgc class that centralises our AEGC algorithm, derive the IPU3's Agc class from it and plumb in the necessary framework to enable it to be used. For simplicity's sake this commit switches the algorithm to use the derived class, but does not remove the bespoke functions at this time. Reviewed-by: Stefan Klug Signed-off-by: Daniel Scally Reviewed-by: Jacopo Mondi Signed-off-by: Kieran Bingham --- src/ipa/ipu3/algorithms/agc.h | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src/ipa/ipu3/algorithms/agc.h') diff --git a/src/ipa/ipu3/algorithms/agc.h b/src/ipa/ipu3/algorithms/agc.h index 9d6e3ff1..1d6855a9 100644 --- a/src/ipa/ipu3/algorithms/agc.h +++ b/src/ipa/ipu3/algorithms/agc.h @@ -13,6 +13,9 @@ #include +#include "libipa/agc_mean_luminance.h" +#include "libipa/histogram.h" + #include "algorithm.h" namespace libcamera { @@ -21,12 +24,13 @@ struct IPACameraSensorInfo; namespace ipa::ipu3::algorithms { -class Agc : public Algorithm +class Agc : public Algorithm, public AgcMeanLuminance { public: Agc(); ~Agc() = default; + int init(IPAContext &context, const YamlObject &tuningData) override; int configure(IPAContext &context, const IPAConfigInfo &configInfo) override; void process(IPAContext &context, const uint32_t frame, IPAFrameContext &frameContext, @@ -43,6 +47,9 @@ private: const ipu3_uapi_grid_config &grid, const ipu3_uapi_stats_3a *stats, double gain); + double estimateLuminance(double gain) const override; + Histogram parseStatistics(const ipu3_uapi_stats_3a *stats, + const ipu3_uapi_grid_config &grid); uint64_t frameCount_; @@ -55,6 +62,11 @@ private: utils::Duration filteredExposure_; uint32_t stride_; + double rGain_; + double gGain_; + double bGain_; + ipu3_uapi_grid_config bdsGrid_; + std::vector> rgbTriples_; }; } /* namespace ipa::ipu3::algorithms */ -- cgit v1.2.1