[PATCH v2 13/17] ipa: rkisp1: awb: Use gains from color temperature curve

Laurent Pinchart laurent.pinchart at ideasonboard.com
Tue Apr 1 04:02:58 CEST 2025


Hi Stefan,

Thank you for the patch.

On Wed, Mar 19, 2025 at 05:11:18PM +0100, Stefan Klug wrote:
> Use the color gains for white balance if calibrated light sources are
> contained in the tuning file. The results are generally better
> especially when large uniformly colored objects are in the scene. Pure
> grey world model is still available by removing the color gains from the
> tuning file.

We'll get an error in the log for every frame then. I think that needs
to be addressed.

> 
> Signed-off-by: Stefan Klug <stefan.klug at ideasonboard.com>
> ---
>  src/ipa/rkisp1/algorithms/awb.cpp | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/src/ipa/rkisp1/algorithms/awb.cpp b/src/ipa/rkisp1/algorithms/awb.cpp
> index 58b8370d2c61..286d9e3e2018 100644
> --- a/src/ipa/rkisp1/algorithms/awb.cpp
> +++ b/src/ipa/rkisp1/algorithms/awb.cpp
> @@ -218,6 +218,16 @@ void Awb::prepare(IPAContext &context, const uint32_t frame,
>  		auto &awb = context.activeState.awb;
>  		frameContext.awb.gains = awb.automatic.gains;

This doesn't seem to be needed anymore.

>  		frameContext.awb.temperatureK = awb.automatic.temperatureK;
> +
> +		const auto &gains = awbAlgo_->gainsFromColourTemperature(
> +			awb.automatic.temperatureK);
> +		if (gains) {
> +			frameContext.awb.gains.r() = gains->r();
> +			frameContext.awb.gains.g() = 1.0;
> +			frameContext.awb.gains.b() = gains->b();
> +		} else {
> +			frameContext.awb.gains = awb.automatic.gains;
> +		}

Shouldn't this be done in Awb::process() where awb.automatic.gains is
set ? Or maybe even in calculateAwb() ?

>  	}
>  
>  	auto gainConfig = params->block<BlockType::AwbGain>();

-- 
Regards,

Laurent Pinchart


More information about the libcamera-devel mailing list