[02/10] ipu3: awb: Remove CCM settings from Awb algorithm
diff mbox series

Message ID 20260616-ipu3-libipa-rework-v1-2-d4448b54f1d8@ideasonboard.com
State Superseded
Headers show
Series
  • libipa: Re-work IPU3 IPA to use libipa algorithms
Related show

Commit Message

Dan Scally June 16, 2026, 6:41 a.m. UTC
The IPU3 AWB algorithm currently defines a CCM matrix that is just
a no-op. Remove the settings entirely; they need really to go in to
a dedicated CCM algorithm.

Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com>
---
 src/ipa/ipu3/algorithms/awb.cpp | 10 ----------
 1 file changed, 10 deletions(-)

Comments

Pőcze Barnabás June 16, 2026, 8:29 a.m. UTC | #1
2026. 06. 16. 8:41 keltezéssel, Daniel Scally írta:
> The IPU3 AWB algorithm currently defines a CCM matrix that is just
> a no-op. Remove the settings entirely; they need really to go in to
> a dedicated CCM algorithm.
> 
> Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com>
> ---

I presume no transformation is done by the hardware after this change?

Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>


>   src/ipa/ipu3/algorithms/awb.cpp | 10 ----------
>   1 file changed, 10 deletions(-)
> 
> diff --git a/src/ipa/ipu3/algorithms/awb.cpp b/src/ipa/ipu3/algorithms/awb.cpp
> index 6b4418aa6f3add0a41cae77000c1f5f67897111a..613bdbbf51cd127e03906571813260a6857067dc 100644
> --- a/src/ipa/ipu3/algorithms/awb.cpp
> +++ b/src/ipa/ipu3/algorithms/awb.cpp
> @@ -112,13 +112,6 @@ static const struct ipu3_uapi_bnr_static_config imguCssBnrDefaults = {
>   	.opt_center_sqr = { 419904, 133956 },
>   };
> 
> -/* Default color correction matrix defined as an identity matrix */
> -static const struct ipu3_uapi_ccm_mat_config imguCssCcmDefault = {
> -	8191, 0, 0, 0,
> -	0, 8191, 0, 0,
> -	0, 0, 8191, 0
> -};
> -
>   /**
>    * \class Awb
>    * \brief A Grey world white balance correction algorithm
> @@ -293,12 +286,9 @@ void Awb::prepare(IPAContext &context,
> 
>   	LOG(IPU3Awb, Debug) << "Color temperature estimated: " << asyncResults_.temperatureK;
> 
> -	/* The CCM matrix may change when color temperature will be used */
> -	params->acc_param.ccm = imguCssCcmDefault;
> 
>   	params->use.acc_awb = 1;
>   	params->use.acc_bnr = 1;
> -	params->use.acc_ccm = 1;
>   }
> 
>   /* Generate an RGB vector with the average values for each zone */
> 
> --
> 2.43.0
>
Dan Scally June 16, 2026, 8:41 a.m. UTC | #2
Hi Barnabas

On 16/06/2026 09:29, Pőcze Barnabás wrote:
> 2026. 06. 16. 8:41 keltezéssel, Daniel Scally írta:
>> The IPU3 AWB algorithm currently defines a CCM matrix that is just
>> a no-op. Remove the settings entirely; they need really to go in to
>> a dedicated CCM algorithm.
>>
>> Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com>
>> ---
> 
> I presume no transformation is done by the hardware after this change?

Hm no actually it will revert to using the driver defined matrix [1], which is not an identity matrix:

const struct ipu3_uapi_ccm_mat_config imgu_css_ccm_defaults = {
	 9775, -2671,  1087, 0,
	-1071,  8303,   815, 0,
	  -23, -7887, 16103, 0
};


[1] https://elixir.bootlin.com/linux/v7.1/source/drivers/staging/media/ipu3/ipu3-tables.c#L9334
> 
> Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
> 
> 
>>    src/ipa/ipu3/algorithms/awb.cpp | 10 ----------
>>    1 file changed, 10 deletions(-)
>>
>> diff --git a/src/ipa/ipu3/algorithms/awb.cpp b/src/ipa/ipu3/algorithms/awb.cpp
>> index 6b4418aa6f3add0a41cae77000c1f5f67897111a..613bdbbf51cd127e03906571813260a6857067dc 100644
>> --- a/src/ipa/ipu3/algorithms/awb.cpp
>> +++ b/src/ipa/ipu3/algorithms/awb.cpp
>> @@ -112,13 +112,6 @@ static const struct ipu3_uapi_bnr_static_config imguCssBnrDefaults = {
>>    	.opt_center_sqr = { 419904, 133956 },
>>    };
>>
>> -/* Default color correction matrix defined as an identity matrix */
>> -static const struct ipu3_uapi_ccm_mat_config imguCssCcmDefault = {
>> -	8191, 0, 0, 0,
>> -	0, 8191, 0, 0,
>> -	0, 0, 8191, 0
>> -};
>> -
>>    /**
>>     * \class Awb
>>     * \brief A Grey world white balance correction algorithm
>> @@ -293,12 +286,9 @@ void Awb::prepare(IPAContext &context,
>>
>>    	LOG(IPU3Awb, Debug) << "Color temperature estimated: " << asyncResults_.temperatureK;
>>
>> -	/* The CCM matrix may change when color temperature will be used */
>> -	params->acc_param.ccm = imguCssCcmDefault;
>>
>>    	params->use.acc_awb = 1;
>>    	params->use.acc_bnr = 1;
>> -	params->use.acc_ccm = 1;
>>    }
>>
>>    /* Generate an RGB vector with the average values for each zone */
>>
>> --
>> 2.43.0
>>
> 
>
Barnabás Pőcze June 16, 2026, 8:48 a.m. UTC | #3
2026. 06. 16. 10:41 keltezéssel, Dan Scally írta:
> Hi Barnabas
> 
> On 16/06/2026 09:29, Pőcze Barnabás wrote:
>> 2026. 06. 16. 8:41 keltezéssel, Daniel Scally írta:
>>> The IPU3 AWB algorithm currently defines a CCM matrix that is just
>>> a no-op. Remove the settings entirely; they need really to go in to
>>> a dedicated CCM algorithm.
>>>
>>> Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com>
>>> ---
>>
>> I presume no transformation is done by the hardware after this change?
> 
> Hm no actually it will revert to using the driver defined matrix [1], which is not an identity matrix:
> 
> const struct ipu3_uapi_ccm_mat_config imgu_css_ccm_defaults = {
>       9775, -2671,  1087, 0,
>      -1071,  8303,   815, 0,
>        -23, -7887, 16103, 0
> };
> 

Ahh, I see, I suppose it's fine because later changes will set the CCM matrix.


> 
> [1] https://elixir.bootlin.com/linux/v7.1/source/drivers/staging/media/ipu3/ipu3-tables.c#L9334
>>
>> Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
>>
>>
>>>    src/ipa/ipu3/algorithms/awb.cpp | 10 ----------
>>>    1 file changed, 10 deletions(-)
>>>
>>> diff --git a/src/ipa/ipu3/algorithms/awb.cpp b/src/ipa/ipu3/algorithms/awb.cpp
>>> index 6b4418aa6f3add0a41cae77000c1f5f67897111a..613bdbbf51cd127e03906571813260a6857067dc 100644
>>> --- a/src/ipa/ipu3/algorithms/awb.cpp
>>> +++ b/src/ipa/ipu3/algorithms/awb.cpp
>>> @@ -112,13 +112,6 @@ static const struct ipu3_uapi_bnr_static_config imguCssBnrDefaults = {
>>>        .opt_center_sqr = { 419904, 133956 },
>>>    };
>>>
>>> -/* Default color correction matrix defined as an identity matrix */
>>> -static const struct ipu3_uapi_ccm_mat_config imguCssCcmDefault = {
>>> -    8191, 0, 0, 0,
>>> -    0, 8191, 0, 0,
>>> -    0, 0, 8191, 0
>>> -};
>>> -
>>>    /**
>>>     * \class Awb
>>>     * \brief A Grey world white balance correction algorithm
>>> @@ -293,12 +286,9 @@ void Awb::prepare(IPAContext &context,
>>>
>>>        LOG(IPU3Awb, Debug) << "Color temperature estimated: " << asyncResults_.temperatureK;
>>>
>>> -    /* The CCM matrix may change when color temperature will be used */
>>> -    params->acc_param.ccm = imguCssCcmDefault;
>>>
>>>        params->use.acc_awb = 1;
>>>        params->use.acc_bnr = 1;
>>> -    params->use.acc_ccm = 1;
>>>    }
>>>
>>>    /* Generate an RGB vector with the average values for each zone */
>>>
>>> -- 
>>> 2.43.0
>>>
>>
>>
>

Patch
diff mbox series

diff --git a/src/ipa/ipu3/algorithms/awb.cpp b/src/ipa/ipu3/algorithms/awb.cpp
index 6b4418aa6f3add0a41cae77000c1f5f67897111a..613bdbbf51cd127e03906571813260a6857067dc 100644
--- a/src/ipa/ipu3/algorithms/awb.cpp
+++ b/src/ipa/ipu3/algorithms/awb.cpp
@@ -112,13 +112,6 @@  static const struct ipu3_uapi_bnr_static_config imguCssBnrDefaults = {
 	.opt_center_sqr = { 419904, 133956 },
 };
 
-/* Default color correction matrix defined as an identity matrix */
-static const struct ipu3_uapi_ccm_mat_config imguCssCcmDefault = {
-	8191, 0, 0, 0,
-	0, 8191, 0, 0,
-	0, 0, 8191, 0
-};
-
 /**
  * \class Awb
  * \brief A Grey world white balance correction algorithm
@@ -293,12 +286,9 @@  void Awb::prepare(IPAContext &context,
 
 	LOG(IPU3Awb, Debug) << "Color temperature estimated: " << asyncResults_.temperatureK;
 
-	/* The CCM matrix may change when color temperature will be used */
-	params->acc_param.ccm = imguCssCcmDefault;
 
 	params->use.acc_awb = 1;
 	params->use.acc_bnr = 1;
-	params->use.acc_ccm = 1;
 }
 
 /* Generate an RGB vector with the average values for each zone */