[19/22] libcamera: software_isp: lut: Make CCM available in debayer params
diff mbox series

Message ID 20251120232019.3590-20-bryan.odonoghue@linaro.org
State Superseded
Headers show
Series
  • GPUISP precursor series
Related show

Commit Message

Bryan O'Donoghue Nov. 20, 2025, 11:20 p.m. UTC
Provide the CCM calculated in LUT to the debayer params structure for
consumption in the debayer shaders.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
---
 include/libcamera/internal/software_isp/debayer_params.h | 7 +++++++
 src/ipa/simple/algorithms/lut.cpp                        | 1 +
 2 files changed, 8 insertions(+)

Comments

Milan Zamazal Nov. 21, 2025, 3:42 p.m. UTC | #1
Hi Bryan,

see
https://lists.libcamera.org/pipermail/libcamera-devel/2025-October/053872.html

Bryan O'Donoghue <bryan.odonoghue@linaro.org> writes:

> Provide the CCM calculated in LUT to the debayer params structure for
> consumption in the debayer shaders.
>
> Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
> ---
>  include/libcamera/internal/software_isp/debayer_params.h | 7 +++++++
>  src/ipa/simple/algorithms/lut.cpp                        | 1 +
>  2 files changed, 8 insertions(+)
>
> diff --git a/include/libcamera/internal/software_isp/debayer_params.h b/include/libcamera/internal/software_isp/debayer_params.h
> index 217cd5d92..019df2048 100644
> --- a/include/libcamera/internal/software_isp/debayer_params.h
> +++ b/include/libcamera/internal/software_isp/debayer_params.h
> @@ -13,6 +13,8 @@
>  #include <array>
>  #include <stdint.h>
>  
> +#include "libcamera/internal/matrix.h"
> +
>  namespace libcamera {
>  
>  struct DebayerParams {
> @@ -49,6 +51,11 @@ struct DebayerParams {
>  	CcmLookupTable greenCcm;
>  	CcmLookupTable blueCcm;
>  	LookupTable gammaLut;
> +
> +	/*
> +	 * Per frame CCM values as calcualted by the IPA
> +	 */
> +	Matrix<float, 3, 3> ccm;	/**< Per frame colour correction matrix for GPUISP */
>  };
>  
>  } /* namespace libcamera */
> diff --git a/src/ipa/simple/algorithms/lut.cpp b/src/ipa/simple/algorithms/lut.cpp
> index d4a79e101..49482d711 100644
> --- a/src/ipa/simple/algorithms/lut.cpp
> +++ b/src/ipa/simple/algorithms/lut.cpp
> @@ -133,6 +133,7 @@ void Lut::prepare(IPAContext &context,
>  		auto &red = params->redCcm;
>  		auto &green = params->greenCcm;
>  		auto &blue = params->blueCcm;
> +		params->ccm = ccm;
>  		for (unsigned int i = 0; i < DebayerParams::kRGBLookupSize; i++) {
>  			red[i].r = ccmValue(i, ccm[0][0]);
>  			red[i].g = ccmValue(i, ccm[1][0]);
Milan Zamazal Nov. 21, 2025, 3:47 p.m. UTC | #2
Milan Zamazal <mzamazal@redhat.com> writes:

> Hi Bryan,
>
> see
> https://lists.libcamera.org/pipermail/libcamera-devel/2025-October/053872.html

Sorry, wrong link, it should have been
https://lists.libcamera.org/pipermail/libcamera-devel/2025-June/050886.html

> Bryan O'Donoghue <bryan.odonoghue@linaro.org> writes:
>
>> Provide the CCM calculated in LUT to the debayer params structure for
>> consumption in the debayer shaders.
>>
>> Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
>> ---
>>  include/libcamera/internal/software_isp/debayer_params.h | 7 +++++++
>>  src/ipa/simple/algorithms/lut.cpp                        | 1 +
>>  2 files changed, 8 insertions(+)
>>
>> diff --git a/include/libcamera/internal/software_isp/debayer_params.h b/include/libcamera/internal/software_isp/debayer_params.h
>> index 217cd5d92..019df2048 100644
>> --- a/include/libcamera/internal/software_isp/debayer_params.h
>> +++ b/include/libcamera/internal/software_isp/debayer_params.h
>> @@ -13,6 +13,8 @@
>>  #include <array>
>>  #include <stdint.h>
>>  
>> +#include "libcamera/internal/matrix.h"
>> +
>>  namespace libcamera {
>>  
>>  struct DebayerParams {
>> @@ -49,6 +51,11 @@ struct DebayerParams {
>>  	CcmLookupTable greenCcm;
>>  	CcmLookupTable blueCcm;
>>  	LookupTable gammaLut;
>> +
>> +	/*
>> +	 * Per frame CCM values as calcualted by the IPA
>> +	 */
>> +	Matrix<float, 3, 3> ccm;	/**< Per frame colour correction matrix for GPUISP */
>>  };
>>  
>>  } /* namespace libcamera */
>> diff --git a/src/ipa/simple/algorithms/lut.cpp b/src/ipa/simple/algorithms/lut.cpp
>> index d4a79e101..49482d711 100644
>> --- a/src/ipa/simple/algorithms/lut.cpp
>> +++ b/src/ipa/simple/algorithms/lut.cpp
>> @@ -133,6 +133,7 @@ void Lut::prepare(IPAContext &context,
>>  		auto &red = params->redCcm;
>>  		auto &green = params->greenCcm;
>>  		auto &blue = params->blueCcm;
>> +		params->ccm = ccm;
>>  		for (unsigned int i = 0; i < DebayerParams::kRGBLookupSize; i++) {
>>  			red[i].r = ccmValue(i, ccm[0][0]);
>>  			red[i].g = ccmValue(i, ccm[1][0]);

Patch
diff mbox series

diff --git a/include/libcamera/internal/software_isp/debayer_params.h b/include/libcamera/internal/software_isp/debayer_params.h
index 217cd5d92..019df2048 100644
--- a/include/libcamera/internal/software_isp/debayer_params.h
+++ b/include/libcamera/internal/software_isp/debayer_params.h
@@ -13,6 +13,8 @@ 
 #include <array>
 #include <stdint.h>
 
+#include "libcamera/internal/matrix.h"
+
 namespace libcamera {
 
 struct DebayerParams {
@@ -49,6 +51,11 @@  struct DebayerParams {
 	CcmLookupTable greenCcm;
 	CcmLookupTable blueCcm;
 	LookupTable gammaLut;
+
+	/*
+	 * Per frame CCM values as calcualted by the IPA
+	 */
+	Matrix<float, 3, 3> ccm;	/**< Per frame colour correction matrix for GPUISP */
 };
 
 } /* namespace libcamera */
diff --git a/src/ipa/simple/algorithms/lut.cpp b/src/ipa/simple/algorithms/lut.cpp
index d4a79e101..49482d711 100644
--- a/src/ipa/simple/algorithms/lut.cpp
+++ b/src/ipa/simple/algorithms/lut.cpp
@@ -133,6 +133,7 @@  void Lut::prepare(IPAContext &context,
 		auto &red = params->redCcm;
 		auto &green = params->greenCcm;
 		auto &blue = params->blueCcm;
+		params->ccm = ccm;
 		for (unsigned int i = 0; i < DebayerParams::kRGBLookupSize; i++) {
 			red[i].r = ccmValue(i, ccm[0][0]);
 			red[i].g = ccmValue(i, ccm[1][0]);