@@ -400,8 +400,10 @@ void Agc::fillMetadata(IPAContext &context, IPAFrameContext &frameContext,
{
utils::Duration exposureTime = context.configuration.sensor.lineDuration
* frameContext.sensor.exposure;
+ utils::Duration exposureTimeCorrected = exposureTime * frameContext.awb.additionalGain;
metadata.set(controls::AnalogueGain, frameContext.sensor.gain);
metadata.set(controls::ExposureTime, exposureTime.get<std::micro>());
+ metadata.set<float>(controls::debug::ExposureTimeCorrected, exposureTimeCorrected.get<std::micro>());
metadata.set(controls::FrameDuration, frameContext.agc.frameDuration.get<std::micro>());
metadata.set(controls::ExposureTimeMode,
frameContext.agc.autoExposureEnabled
@@ -574,6 +576,20 @@ void Agc::process(IPAContext &context, [[maybe_unused]] const uint32_t frame,
frameContext.agc.exposureMode,
hist, effectiveExposureValue);
+ auto &debugMeta = context.debugMetadata;
+ std::vector<int32_t> histMeta;
+ for (unsigned i = 0; i < context.hw->numHistogramBins; i++)
+ histMeta.push_back(params->hist.hist_bins[i] >> 4);
+ debugMeta.set<Span<const int32_t>>(controls::debug::StatsHistogram, histMeta);
+
+ double meanExposure = 0;
+ for (uint8_t expMean : expMeans_)
+ meanExposure += expMean;
+ meanExposure = meanExposure / expMeans_.size() / 255.0;
+ debugMeta.set<const float>(controls::debug::StatsExpMean, meanExposure);
+
+ debugMeta.set<Span<const uint8_t>>(controls::debug::StatsExpMeans, expMeans_);
+
LOG(RkISP1Agc, Debug)
<< "Divided up exposure time, analogue gain and digital gain are "
<< newExposureTime << ", " << aGain << " and " << dGain;
@@ -310,6 +310,9 @@ void Awb::process(IPAContext &context,
RGB<double> rgbMeans = calculateRgbMeans(frameContext, awb);
+ context.debugMetadata.set<Span<const float>>(controls::debug::RgbMeans, Vector<float, 3>(rgbMeans).data());
+ context.debugMetadata.set<int>(controls::debug::AwbCount, awb->awb_mean[0].cnt);
+
/*
* If the means are too small we don't have enough information to
* meaningfully calculate gains. Freeze the algorithm in that case.
@@ -1,9 +1,38 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
#
+# This file was generated by utils/gen-debug-controls.py
+#
%YAML 1.1
---
vendor: debug
controls:
+- AwbCount:
+ type: int
+ direction: out
+ description: Debug control AwbCount found in src/ipa/rkisp1/algorithms/awb.cpp
+- ExposureTimeCorrected:
+ type: float
+ direction: out
+ description: Debug control ExposureTimeCorrected found in src/ipa/rkisp1/algorithms/agc.cpp
+- RgbMeans:
+ type: float
+ direction: out
+ description: Debug control RgbMeans found in src/ipa/rkisp1/algorithms/awb.cpp
+ size: '[n]'
+- StatsExpMean:
+ type: const float
+ direction: out
+ description: Debug control StatsExpMean found in src/ipa/rkisp1/algorithms/agc.cpp
+- StatsExpMeans:
+ type: uint8_t
+ direction: out
+ description: Debug control StatsExpMeans found in src/ipa/rkisp1/algorithms/agc.cpp
+ size: '[n]'
+- StatsHistogram:
+ type: int32_t
+ direction: out
+ description: Debug control StatsHistogram found in src/ipa/rkisp1/algorithms/agc.cpp
+ size: '[n]'
- WdrCurve:
type: Point
direction: out
Add debug controls for AWB stats and exposure means. Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> --- src/ipa/rkisp1/algorithms/agc.cpp | 16 +++++++++++++++ src/ipa/rkisp1/algorithms/awb.cpp | 3 +++ src/libcamera/control_ids_debug.yaml | 29 ++++++++++++++++++++++++++++ 3 files changed, 48 insertions(+)