[v1,11/11] ipa: rkisp1: awb: Apply gains based on default colour temperature on start
diff mbox series

Message ID 20250109115412.356768-12-stefan.klug@ideasonboard.com
State New
Headers show
Series
  • Add Bayesian AWB algorithm to libipa and rkisp1
Related show

Commit Message

Stefan Klug Jan. 9, 2025, 11:54 a.m. UTC
The colour gains are initialized with a default value of 1. Improve that
by querying the auto white balance algorithm for the gains for a default
colour temperature. This is still not based on measurements, but it is
still better than the current implementation. If the algorithm doesn't
implement mapping from colour temperature to gains, it will internally
fallback to 1.0.

Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
---
 src/ipa/rkisp1/algorithms/awb.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Paul Elder Jan. 14, 2025, 12:10 a.m. UTC | #1
On Thu, Jan 09, 2025 at 12:54:02PM +0100, Stefan Klug wrote:
> The colour gains are initialized with a default value of 1. Improve that
> by querying the auto white balance algorithm for the gains for a default
> colour temperature. This is still not based on measurements, but it is
> still better than the current implementation. If the algorithm doesn't
> implement mapping from colour temperature to gains, it will internally
> fallback to 1.0.
> 
> Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>

Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>

> ---
>  src/ipa/rkisp1/algorithms/awb.cpp | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/src/ipa/rkisp1/algorithms/awb.cpp b/src/ipa/rkisp1/algorithms/awb.cpp
> index 39a2c0589943..1761185b1181 100644
> --- a/src/ipa/rkisp1/algorithms/awb.cpp
> +++ b/src/ipa/rkisp1/algorithms/awb.cpp
> @@ -125,7 +125,8 @@ int Awb::configure(IPAContext &context,
>  		   const IPACameraSensorInfo &configInfo)
>  {
>  	context.activeState.awb.gains.manual = RGB<double>{ 1.0 };
> -	context.activeState.awb.gains.automatic = RGB<double>{ 1.0 };
> +	context.activeState.awb.gains.automatic =
> +		awbAlgo_->gainsFromColourTemperature(kDefaultColourTemperature);
>  	context.activeState.awb.autoEnabled = true;
>  	context.activeState.awb.temperatureK = kDefaultColourTemperature;
>  
> -- 
> 2.43.0
>
Dan Scally Jan. 20, 2025, 3:49 p.m. UTC | #2
On 09/01/2025 11:54, Stefan Klug wrote:
> The colour gains are initialized with a default value of 1. Improve that
> by querying the auto white balance algorithm for the gains for a default
> colour temperature. This is still not based on measurements, but it is
> still better than the current implementation. If the algorithm doesn't
> implement mapping from colour temperature to gains, it will internally
> fallback to 1.0.
>
> Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
> ---
Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>
>   src/ipa/rkisp1/algorithms/awb.cpp | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/src/ipa/rkisp1/algorithms/awb.cpp b/src/ipa/rkisp1/algorithms/awb.cpp
> index 39a2c0589943..1761185b1181 100644
> --- a/src/ipa/rkisp1/algorithms/awb.cpp
> +++ b/src/ipa/rkisp1/algorithms/awb.cpp
> @@ -125,7 +125,8 @@ int Awb::configure(IPAContext &context,
>   		   const IPACameraSensorInfo &configInfo)
>   {
>   	context.activeState.awb.gains.manual = RGB<double>{ 1.0 };
> -	context.activeState.awb.gains.automatic = RGB<double>{ 1.0 };
> +	context.activeState.awb.gains.automatic =
> +		awbAlgo_->gainsFromColourTemperature(kDefaultColourTemperature);
>   	context.activeState.awb.autoEnabled = true;
>   	context.activeState.awb.temperatureK = kDefaultColourTemperature;
>

Patch
diff mbox series

diff --git a/src/ipa/rkisp1/algorithms/awb.cpp b/src/ipa/rkisp1/algorithms/awb.cpp
index 39a2c0589943..1761185b1181 100644
--- a/src/ipa/rkisp1/algorithms/awb.cpp
+++ b/src/ipa/rkisp1/algorithms/awb.cpp
@@ -125,7 +125,8 @@  int Awb::configure(IPAContext &context,
 		   const IPACameraSensorInfo &configInfo)
 {
 	context.activeState.awb.gains.manual = RGB<double>{ 1.0 };
-	context.activeState.awb.gains.automatic = RGB<double>{ 1.0 };
+	context.activeState.awb.gains.automatic =
+		awbAlgo_->gainsFromColourTemperature(kDefaultColourTemperature);
 	context.activeState.awb.autoEnabled = true;
 	context.activeState.awb.temperatureK = kDefaultColourTemperature;