[v8,20/26] libcamera: software_isp: ccm: Add self-initialising identity CCM to Ccm::init
diff mbox series

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

Commit Message

Bryan O'Donoghue Dec. 12, 2025, 12:29 a.m. UTC
We have a need to generate an identity CCM when running the GPUIsp without
a sensor tuning file.

A preivous patch added a selfInitialising bool to the IPAContext structure.
When that bool is true generate an identity CCM at colour temperature
6500k.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
---
 src/ipa/simple/algorithms/ccm.cpp | 22 ++++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)

Patch
diff mbox series

diff --git a/src/ipa/simple/algorithms/ccm.cpp b/src/ipa/simple/algorithms/ccm.cpp
index 0a98406c1..ac1ce1685 100644
--- a/src/ipa/simple/algorithms/ccm.cpp
+++ b/src/ipa/simple/algorithms/ccm.cpp
@@ -27,13 +27,23 @@  namespace ipa::soft::algorithms {
 
 LOG_DEFINE_CATEGORY(IPASoftCcm)
 
-int Ccm::init([[maybe_unused]] IPAContext &context, const YamlObject &tuningData)
+int Ccm::init([[maybe_unused]] IPAContext &context, [[maybe_unused]] const YamlObject &tuningData)
 {
-	int ret = ccm_.readYaml(tuningData["ccms"], "ct", "ccm");
-	if (ret < 0) {
-		LOG(IPASoftCcm, Error)
-			<< "Failed to parse 'ccm' parameter from tuning file.";
-		return ret;
+	if (!context.selfInitialising) {
+		int ret = ccm_.readYaml(tuningData["ccms"], "ct", "ccm");
+		if (ret < 0) {
+			LOG(IPASoftCcm, Error)
+				<< "Failed to parse 'ccm' parameter from tuning file.";
+			return ret;
+		}
+	} else {
+		/* Initialize with identity CCM at standard D65 color temperature */
+		Matrix<float, 3, 3> identityMatrix = Matrix<float, 3, 3>::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;