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

Message ID 20250223230403.1226-14-laurent.pinchart@ideasonboard.com
State Accepted
Headers show
Series
  • libipa: awb: Drive-by fixes
Related show

Commit Message

Laurent Pinchart Feb. 23, 2025, 11:04 p.m. UTC
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@ideasonboard.com>
---
 src/ipa/rkisp1/algorithms/awb.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Stefan Klug Feb. 24, 2025, 9:40 a.m. UTC | #1
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@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@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
>

Patch
diff mbox series

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);
 
 	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.