From patchwork Sat Jun 20 23:00:29 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 26997 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 130ACC3302 for ; Sat, 20 Jun 2026 23:00:43 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 598B062899; Sun, 21 Jun 2026 01:00:39 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="QlU1bJE8"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 25516656DD for ; Sun, 21 Jun 2026 01:00:36 +0200 (CEST) Received: from [192.168.0.240] (cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id F16A4CF5; Sun, 21 Jun 2026 00:59:58 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1781996399; bh=D509HpL8p5KRn2kdLFIfhcUDFCTpKKZwYkSVgUsRw4I=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=QlU1bJE8KO652RjW0PBjL2Q4SQNBEocgCFKswvtN72XGq85KFjFwzK2qSP8wfYkbh 0p2nEliHMNmxm+yp1z6v6CfKsLFHwfWZN/VOHKwmJDemdfhca4okMFVRFk76LPTMaE xfqZiWYTC4Y+paOY/8bVrb7mogQ+gJWMbGabJJJ4= From: Kieran Bingham Date: Sun, 21 Jun 2026 00:00:29 +0100 Subject: [PATCH 2/7] ipa: rkisp1: awb: Utilise clamp function MIME-Version: 1.0 Message-Id: <20260621-kbingham-awb-saturation-v1-2-b91ea59c6cfb@ideasonboard.com> References: <20260621-kbingham-awb-saturation-v1-0-b91ea59c6cfb@ideasonboard.com> In-Reply-To: <20260621-kbingham-awb-saturation-v1-0-b91ea59c6cfb@ideasonboard.com> To: libcamera-devel@lists.libcamera.org Cc: Kieran Bingham X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1781996434; l=910; i=kieran.bingham@ideasonboard.com; s=20260204; h=from:subject:message-id; bh=D509HpL8p5KRn2kdLFIfhcUDFCTpKKZwYkSVgUsRw4I=; b=IP+G3XtibBNCcNP/0EsaRmhSxrZI8hmH/nA1xtyItihLYgJMMfdeL9Sk/i8zm/gVu2J/cSkx+ ccHvbNZF7uBDdZqOFSSrICFkAqI+prGO3a8MpxXmdDYfwm7WZo05PXS X-Developer-Key: i=kieran.bingham@ideasonboard.com; a=ed25519; pk=IOxS2C6nWHNjLfkDR71Iesk904i6wJDfEERqV7hDBdY= X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Use the newly introduced 'clamp' operation on the RGB vector type to restrict the raw RGB means. Signed-off-by: Kieran Bingham Reviewed-by: Laurent Pinchart --- 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;