[2/9] libcamera: software_isp: Store color temperature to metadata
diff mbox series

Message ID 20241120180104.1221846-3-mzamazal@redhat.com
State New
Headers show
Series
  • Software ISP support for CCM
Related show

Commit Message

Milan Zamazal Nov. 20, 2024, 6 p.m. UTC
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>
---
 src/ipa/simple/algorithms/awb.cpp | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Patch
diff mbox series

diff --git a/src/ipa/simple/algorithms/awb.cpp b/src/ipa/simple/algorithms/awb.cpp
index db384c3fa..eef8277fc 100644
--- a/src/ipa/simple/algorithms/awb.cpp
+++ b/src/ipa/simple/algorithms/awb.cpp
@@ -12,6 +12,8 @@ 
 
 #include <libcamera/base/log.h>
 
+#include <libcamera/control_ids.h>
+
 #include "libipa/colours.h"
 #include "simple/ipa_context.h"
 
@@ -34,7 +36,7 @@  void Awb::process(IPAContext &context,
 		  [[maybe_unused]] const uint32_t frame,
 		  [[maybe_unused]] IPAFrameContext &frameContext,
 		  const SwIspStats *stats,
-		  [[maybe_unused]] ControlList &metadata)
+		  ControlList &metadata)
 {
 	const SwIspStats::Histogram &histogram = stats->yHistogram;
 	const uint8_t blackLevel = context.activeState.blc.level;
@@ -60,8 +62,10 @@  void Awb::process(IPAContext &context,
 	gains.blue = sumB <= sumG / 4 ? 4.0 : static_cast<double>(sumG) / sumB;
 	/* Green gain is fixed to 1.0 */
 
-	context.activeState.awb.temperatureK =
+	uint32_t temperature =
 		estimateCCT(1 / gains.red, 1 / gains.green, 1 / gains.blue);
+	context.activeState.awb.temperatureK = temperature;
+	metadata.set(controls::ColourTemperature, temperature);
 
 	LOG(IPASoftAwb, Debug)
 		<< "gain R/B: " << gains.red << "/" << gains.blue