diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2022-10-19 02:34:13 +0300 |
---|---|---|
committer | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2022-10-24 16:40:24 +0300 |
commit | 32d5f0d2a41a3e973afa4318b37a6db34fe82983 (patch) | |
tree | 6def55a94265bfcf52bb817e4accb427554d1660 /src/ipa/rkisp1/algorithms | |
parent | c20ca6587dcba983e192c65124accacb3a0d21ac (diff) |
ipa: rkisp1: Fill AGC and AWB metadata
Fill the frame metadata in the AGC and AWB algorithm's prepare()
function. Additional metadata for other algorithms will be addressed
later.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Diffstat (limited to 'src/ipa/rkisp1/algorithms')
-rw-r--r-- | src/ipa/rkisp1/algorithms/agc.cpp | 15 | ||||
-rw-r--r-- | src/ipa/rkisp1/algorithms/awb.cpp | 9 |
2 files changed, 22 insertions, 2 deletions
diff --git a/src/ipa/rkisp1/algorithms/agc.cpp b/src/ipa/rkisp1/algorithms/agc.cpp index 37cd10f9..b4fc7aed 100644 --- a/src/ipa/rkisp1/algorithms/agc.cpp +++ b/src/ipa/rkisp1/algorithms/agc.cpp @@ -14,6 +14,7 @@ #include <libcamera/base/log.h> #include <libcamera/base/utils.h> +#include <libcamera/control_ids.h> #include <libcamera/ipa/core_ipa_interface.h> #include "libipa/histogram.h" @@ -290,7 +291,7 @@ double Agc::measureBrightness(const rkisp1_cif_isp_hist_stat *hist) const */ void Agc::process(IPAContext &context, [[maybe_unused]] const uint32_t frame, IPAFrameContext &frameContext, const rkisp1_stat_buffer *stats, - [[maybe_unused]] ControlList &metadata) + ControlList &metadata) { /* * \todo Verify that the exposure and gain applied by the sensor for @@ -333,6 +334,18 @@ void Agc::process(IPAContext &context, [[maybe_unused]] const uint32_t frame, computeExposure(context, frameContext, yGain, iqMeanGain); frameCount_++; + + utils::Duration exposureTime = context.configuration.sensor.lineDuration + * frameContext.sensor.exposure; + metadata.set(controls::AnalogueGain, frameContext.sensor.gain); + metadata.set(controls::ExposureTime, exposureTime.get<std::micro>()); + + /* \todo Use VBlank value calculated from each frame exposure. */ + uint32_t vTotal = context.configuration.sensor.size.height + + context.configuration.sensor.defVBlank; + utils::Duration frameDuration = context.configuration.sensor.lineDuration + * vTotal; + metadata.set(controls::FrameDuration, frameDuration.get<std::micro>()); } /** diff --git a/src/ipa/rkisp1/algorithms/awb.cpp b/src/ipa/rkisp1/algorithms/awb.cpp index f597ded8..083c2d98 100644 --- a/src/ipa/rkisp1/algorithms/awb.cpp +++ b/src/ipa/rkisp1/algorithms/awb.cpp @@ -209,7 +209,7 @@ void Awb::process(IPAContext &context, [[maybe_unused]] const uint32_t frame, IPAFrameContext &frameContext, const rkisp1_stat_buffer *stats, - [[maybe_unused]] ControlList &metadata) + ControlList &metadata) { const rkisp1_cif_isp_stat *params = &stats->params; const rkisp1_cif_isp_awb_stat *awb = ¶ms->awb; @@ -307,6 +307,13 @@ void Awb::process(IPAContext &context, frameContext.awb.temperatureK = activeState.awb.temperatureK; + metadata.set(controls::AwbEnable, frameContext.awb.autoEnabled); + metadata.set(controls::ColourGains, { + static_cast<float>(frameContext.awb.gains.red), + static_cast<float>(frameContext.awb.gains.blue) + }); + metadata.set(controls::ColourTemperature, frameContext.awb.temperatureK); + LOG(RkISP1Awb, Debug) << std::showpoint << "Means [" << redMean << ", " << greenMean << ", " << blueMean << "], gains [" << activeState.awb.gains.automatic.red << ", " |