From patchwork Mon Feb 17 10:01:48 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Klug X-Patchwork-Id: 22793 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 47F32C327D for ; Mon, 17 Feb 2025 10:02:33 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 0579568674; Mon, 17 Feb 2025 11:02:33 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="d4/hMwM7"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id D165A6866C for ; Mon, 17 Feb 2025 11:02:27 +0100 (CET) Received: from ideasonboard.com (unknown [IPv6:2a00:6020:448c:6c00:b47f:e20a:c4c7:ece1]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 89F0A1047; Mon, 17 Feb 2025 11:01:06 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1739786466; bh=Ev7zgdYMk1QUM3ZHUsPzzLl+Q5H2fFyX75+sOBob7fU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=d4/hMwM7uUwJ8C2gdEmsVTNB5xUAP5bAAxp2VS42ORLutQNjzXwzUMW5YptYN/fY5 giB3y6HqrG8WIE/HjrqrYHBDeC5cSBuB02e9IKj+ARAp9mryS4cdQjF1s17cxO8hXR DgzT0rNnhuMh3N/iEOOPb09ie8jlfsO3Mc6G1lgM= From: Stefan Klug To: libcamera-devel@lists.libcamera.org Cc: Stefan Klug Subject: [PATCH 07/10] ipa: rkisp1: Damp color temperature regulation Date: Mon, 17 Feb 2025 11:01:48 +0100 Message-ID: <20250217100203.297894-8-stefan.klug@ideasonboard.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250217100203.297894-1-stefan.klug@ideasonboard.com> References: <20250217100203.297894-1-stefan.klug@ideasonboard.com> MIME-Version: 1.0 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" Damp the regulation of the color temperature with the same factor as the gains. Not damping the color temperature leads to visible flicker, as the CCM changes too much. Signed-off-by: Stefan Klug Reviewed-by: Kieran Bingham --- src/ipa/rkisp1/algorithms/awb.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/ipa/rkisp1/algorithms/awb.cpp b/src/ipa/rkisp1/algorithms/awb.cpp index 9244a1e64f41..347d38d226b4 100644 --- a/src/ipa/rkisp1/algorithms/awb.cpp +++ b/src/ipa/rkisp1/algorithms/awb.cpp @@ -320,8 +320,6 @@ void Awb::process(IPAContext &context, rgbMeans.b() < kMeanMinThreshold) return; - activeState.awb.automatic.temperatureK = estimateCCT(rgbMeans); - /* * Estimate the red and blue gains to apply in a grey world. The green * gain is hardcoded to 1.0. Avoid divisions by zero by clamping the @@ -343,8 +341,11 @@ void Awb::process(IPAContext &context, /* Filter the values to avoid oscillations. */ double speed = 0.2; + double ct = estimateCCT(rgbMeans); + ct = ct * speed + activeState.awb.automatic.temperatureK * (1 - speed); gains = gains * speed + activeState.awb.automatic.gains * (1 - speed); + activeState.awb.automatic.temperatureK = static_cast(ct); activeState.awb.automatic.gains = gains; LOG(RkISP1Awb, Debug)