[v4,19/23] libcamera: software_isp: Implement a static init() routine
diff mbox series

Message ID 20251120233347.5046-20-bryan.odonoghue@linaro.org
State New
Headers show
Series
  • Add GLES 2.0 GPUISP to libcamera
Related show

Commit Message

Bryan O'Donoghue Nov. 20, 2025, 11:33 p.m. UTC
This is an overloaded init() routine that allows the CCM class to self
enumerate a default identity CCM at colour temperature 6500k.

This is required for the case where we are running GPUISP but don't have a
CCM for the sensor. In this case we want to generate a default CCM and use
it instead of using the CPUISP's lookup tables.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
---
 src/ipa/simple/algorithms/ccm.cpp | 18 ++++++++++++++++++
 src/ipa/simple/algorithms/ccm.h   |  1 +
 2 files changed, 19 insertions(+)

Patch
diff mbox series

diff --git a/src/ipa/simple/algorithms/ccm.cpp b/src/ipa/simple/algorithms/ccm.cpp
index 0a98406c1..e3da6adfc 100644
--- a/src/ipa/simple/algorithms/ccm.cpp
+++ b/src/ipa/simple/algorithms/ccm.cpp
@@ -42,6 +42,24 @@  int Ccm::init([[maybe_unused]] IPAContext &context, const YamlObject &tuningData
 	return 0;
 }
 
+int Ccm::init([[maybe_unused]] IPAContext &context)
+{
+	/* Initialize with identity CCM at standard D65 color temperature */
+	float identity[] = { 1, 0, 0,
+			     0, 1, 0,
+			     0, 0, 1 };
+	Matrix<float, 3, 3> identityMatrix(identity);
+
+	std::map<unsigned int, Matrix<float, 3, 3>> ccmData;
+	ccmData[6500] = identityMatrix;
+
+	ccm_ = Interpolator<Matrix<float, 3, 3>>(std::move(ccmData));
+
+	context.ccmEnabled = true;
+	context.ctrlMap[&controls::Saturation] = ControlInfo(0.0f, 2.0f, 1.0f);
+	return 0;
+}
+
 int Ccm::configure(IPAContext &context,
 		   [[maybe_unused]] const IPAConfigInfo &configInfo)
 {
diff --git a/src/ipa/simple/algorithms/ccm.h b/src/ipa/simple/algorithms/ccm.h
index 8279a3d59..b46f17726 100644
--- a/src/ipa/simple/algorithms/ccm.h
+++ b/src/ipa/simple/algorithms/ccm.h
@@ -26,6 +26,7 @@  public:
 	~Ccm() = default;
 
 	int init(IPAContext &context, const YamlObject &tuningData) override;
+	int init(IPAContext &context) override;
 	int configure(IPAContext &context,
 		      const IPAConfigInfo &configInfo) override;
 	void queueRequest(typename Module::Context &context,