[PATCH 13/15] ipa: rkisp1: awb: Don't calculate RGB means if stats are missing

Stefan Klug stefan.klug at ideasonboard.com
Mon Feb 24 10:40:45 CET 2025


Hi Laurent,

Thank you for the patch.

On Mon, Feb 24, 2025 at 01:04:01AM +0200, Laurent Pinchart wrote:
> When statistics are missing we can't meaningfully calculate the RGB
> means. Move their calculation after checking if stats are available.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart at 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 af34b81beb96..7f333ef86518 100644
> --- a/src/ipa/rkisp1/algorithms/awb.cpp
> +++ b/src/ipa/rkisp1/algorithms/awb.cpp
> @@ -282,7 +282,6 @@ void Awb::process(IPAContext &context,
>  	const rkisp1_cif_isp_stat *params = &stats->params;
>  	const rkisp1_cif_isp_awb_stat *awb = &params->awb;
>  	IPAActiveState &activeState = context.activeState;
> -	RGB<double> rgbMeans = calculateRgbMeans(frameContext, awb);

Right. In that case we should also move the declaration of params and
awb down after the check.

Reviewed-by: Stefan Klug <stefan.klug at ideasonboard.com> 

Best regards,
Stefan

>  
>  	metadata.set(controls::AwbEnable, frameContext.awb.autoEnabled);
>  	metadata.set(controls::ColourGains, {
> @@ -296,6 +295,8 @@ void Awb::process(IPAContext &context,
>  		return;
>  	}
>  
> +	RGB<double> rgbMeans = calculateRgbMeans(frameContext, awb);
> +
>  	/*
>  	 * If the means are too small we don't have enough information to
>  	 * meaningfully calculate gains. Freeze the algorithm in that case.
> -- 
> Regards,
> 
> Laurent Pinchart
> 


More information about the libcamera-devel mailing list