From patchwork Fri Oct 24 08:50:50 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Klug X-Patchwork-Id: 24792 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 05C8FBE080 for ; Fri, 24 Oct 2025 08:52:58 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id B3BA460941; Fri, 24 Oct 2025 10:52:57 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="bDeLakYX"; 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 450CE608FE for ; Fri, 24 Oct 2025 10:52:56 +0200 (CEST) Received: from ideasonboard.com (unknown [IPv6:2a00:6020:448c:6c00:7edc:62f4:c118:1549]) by perceval.ideasonboard.com (Postfix) with UTF8SMTPSA id A8F1C4B0C; Fri, 24 Oct 2025 10:51:10 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1761295870; bh=eByHVcvUquYqQ2+UqMyFSY2oHfGcKMqRDTkbu8g8WQY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bDeLakYXKLE1w3Npi9ysOlKh3NLM41/H4PMA9z2AUnYxgcjCYsdRNVDDByLKQIIff uhLjwJjU6q0rb02XSob8PKQNsOV6eysyGMevYJ6G50brG+C04OxqsLrCt5AmdOsXKO kslYmle72jf5khbKrEa3JCgT3XVHi1idleavg+Pg= From: Stefan Klug To: libcamera-devel@lists.libcamera.org Cc: Stefan Klug Subject: [PATCH v1 26/35] ipa: rkisp1: awb: Ignore empty AWB statistics Date: Fri, 24 Oct 2025 10:50:50 +0200 Message-ID: <20251024085130.995967-27-stefan.klug@ideasonboard.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20251024085130.995967-1-stefan.klug@ideasonboard.com> References: <20251024085130.995967-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" 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 --- 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; + } + RGB rgbMeans = calculateRgbMeans(frameContext, awb); /*