libcamera: software_isp: Store color temperature to metadata

Image color temperature is a piece of information that should be
reported in metadata, let's put it there.

Metadata is currently not reported in simple pipeline but we should make
at least newly added information ready to be reported.

Signed-off-by: Milan Zamazal <mzamazal@redhat.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Milan Zamazal <mzamazal@redhat.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
Milan Zamazal 2025-03-26 10:08:40 +01:00 committed by Kieran Bingham
parent 94e849bcf7
commit 7d4b4a1a79

View file

@ -12,6 +12,8 @@
#include <libcamera/base/log.h> #include <libcamera/base/log.h>
#include <libcamera/control_ids.h>
#include "libipa/colours.h" #include "libipa/colours.h"
#include "simple/ipa_context.h" #include "simple/ipa_context.h"
@ -34,7 +36,7 @@ void Awb::process(IPAContext &context,
[[maybe_unused]] const uint32_t frame, [[maybe_unused]] const uint32_t frame,
[[maybe_unused]] IPAFrameContext &frameContext, [[maybe_unused]] IPAFrameContext &frameContext,
const SwIspStats *stats, const SwIspStats *stats,
[[maybe_unused]] ControlList &metadata) ControlList &metadata)
{ {
const SwIspStats::Histogram &histogram = stats->yHistogram; const SwIspStats::Histogram &histogram = stats->yHistogram;
const uint8_t blackLevel = context.activeState.blc.level; const uint8_t blackLevel = context.activeState.blc.level;
@ -64,6 +66,7 @@ void Awb::process(IPAContext &context,
RGB<double> rgbGains{ { 1 / gains.r(), 1 / gains.g(), 1 / gains.b() } }; RGB<double> rgbGains{ { 1 / gains.r(), 1 / gains.g(), 1 / gains.b() } };
context.activeState.awb.temperatureK = estimateCCT(rgbGains); context.activeState.awb.temperatureK = estimateCCT(rgbGains);
metadata.set(controls::ColourTemperature, context.activeState.awb.temperatureK);
LOG(IPASoftAwb, Debug) LOG(IPASoftAwb, Debug)
<< "gain R/B: " << gains << "; temperature: " << "gain R/B: " << gains << "; temperature: "