[v1,26/35] ipa: rkisp1: awb: Ignore empty AWB statistics
diff mbox series

Message ID 20251024085130.995967-27-stefan.klug@ideasonboard.com
State New
Headers show
Series
  • rkisp1: pipeline rework for PFC
Related show

Commit Message

Stefan Klug Oct. 24, 2025, 8:50 a.m. UTC
When the AWB engine doesn't find a valid pixel because all pixels lie
outside the configured colour range it returns an AWB measurement value
of 255, 255, 255. This leaves the regulation in an unrecoverable state
noticeable by a completely green image. Fix that by skipping the AWB
calculation in case there were no valid pixels.

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

Comments

Barnabás Pőcze Oct. 24, 2025, 11 a.m. UTC | #1
2025. 10. 24. 10:50 keltezéssel, Stefan Klug írta:
> When the AWB engine doesn't find a valid pixel because all pixels lie
> outside the configured colour range it returns an AWB measurement value
> of 255, 255, 255. This leaves the regulation in an unrecoverable state
> noticeable by a completely green image. Fix that by skipping the AWB
> calculation in case there were no valid pixels.
> 
> Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
> ---
>   src/ipa/rkisp1/algorithms/awb.cpp | 5 +++++
>   1 file changed, 5 insertions(+)
> 
> diff --git a/src/ipa/rkisp1/algorithms/awb.cpp b/src/ipa/rkisp1/algorithms/awb.cpp
> index 27109478c340..81c767531c03 100644
> --- a/src/ipa/rkisp1/algorithms/awb.cpp
> +++ b/src/ipa/rkisp1/algorithms/awb.cpp
> @@ -313,6 +313,11 @@ void Awb::process(IPAContext &context,
>   		return;
>   	}
> 
> +	if (awb->awb_mean[0].cnt == 0) {
> +		LOG(RkISP1Awb, Warning) << "AWB statistics are empty";
> +		return;
> +	}
> +

Isn't this already there? (Although with "Debug" instead of "Warning".)

https://gitlab.freedesktop.org/camera/libcamera/-/commit/0069b9ceb1e03d5887ac614e35d79602b003ff27



>   	RGB<double> rgbMeans = calculateRgbMeans(frameContext, awb);
> 
>   	/*
> --
> 2.48.1
>

Patch
diff mbox series

diff --git a/src/ipa/rkisp1/algorithms/awb.cpp b/src/ipa/rkisp1/algorithms/awb.cpp
index 27109478c340..81c767531c03 100644
--- a/src/ipa/rkisp1/algorithms/awb.cpp
+++ b/src/ipa/rkisp1/algorithms/awb.cpp
@@ -313,6 +313,11 @@  void Awb::process(IPAContext &context,
 		return;
 	}
 
+	if (awb->awb_mean[0].cnt == 0) {
+		LOG(RkISP1Awb, Warning) << "AWB statistics are empty";
+		return;
+	}
+
 	RGB<double> rgbMeans = calculateRgbMeans(frameContext, awb);
 
 	/*