[2/7] ipa: rkisp1: awb: Utilise clamp function
diff mbox series

Message ID 20260621-kbingham-awb-saturation-v1-2-b91ea59c6cfb@ideasonboard.com
State New
Headers show
Series
  • softisp: Fix Saturation and Black level handling
Related show

Commit Message

Kieran Bingham June 20, 2026, 11 p.m. UTC
Use the newly introduced 'clamp' operation on the RGB vector type to
restrict the raw RGB means.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
---
 src/ipa/rkisp1/algorithms/awb.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Laurent Pinchart June 21, 2026, 12:45 a.m. UTC | #1
On Sun, Jun 21, 2026 at 12:00:29AM +0100, Kieran Bingham wrote:
> Use the newly introduced 'clamp' operation on the RGB vector type to
> restrict the raw RGB means.
> 
> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
>  src/ipa/rkisp1/algorithms/awb.cpp | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/ipa/rkisp1/algorithms/awb.cpp b/src/ipa/rkisp1/algorithms/awb.cpp
> index 5ae5b647164329573f0a233ee36d1db7b3683ef9..0eb05c2b6e1ac9e159e050bae3d5c56ec3045299 100644
> --- a/src/ipa/rkisp1/algorithms/awb.cpp
> +++ b/src/ipa/rkisp1/algorithms/awb.cpp
> @@ -332,7 +332,7 @@ void Awb::process(IPAContext &context,
>  	 * divisions by zero when computing the raw means in subsequent
>  	 * iterations.
>  	 */
> -	awbResult.gains = awbResult.gains.max(1.0 / 256).min(1023.0 / 256);
> +	awbResult.gains = awbResult.gains.clamp(1.0 / 256, 1023.0 / 256);
>  
>  	/* Filter the values to avoid oscillations. */
>  	double speed = 0.2;

Patch
diff mbox series

diff --git a/src/ipa/rkisp1/algorithms/awb.cpp b/src/ipa/rkisp1/algorithms/awb.cpp
index 5ae5b647164329573f0a233ee36d1db7b3683ef9..0eb05c2b6e1ac9e159e050bae3d5c56ec3045299 100644
--- a/src/ipa/rkisp1/algorithms/awb.cpp
+++ b/src/ipa/rkisp1/algorithms/awb.cpp
@@ -332,7 +332,7 @@  void Awb::process(IPAContext &context,
 	 * divisions by zero when computing the raw means in subsequent
 	 * iterations.
 	 */
-	awbResult.gains = awbResult.gains.max(1.0 / 256).min(1023.0 / 256);
+	awbResult.gains = awbResult.gains.clamp(1.0 / 256, 1023.0 / 256);
 
 	/* Filter the values to avoid oscillations. */
 	double speed = 0.2;