From patchwork Tue Apr 29 11:59:19 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Klug X-Patchwork-Id: 23297 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by patchwork.libcamera.org (Postfix) with ESMTPS id 81CB8C327D for ; Tue, 29 Apr 2025 13:02:27 +0000 (UTC) Received: from pendragon.ideasonboard.com (cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 9DCFBAF for ; Tue, 29 Apr 2025 15:02:21 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1745931741; bh=/8eFKApEsVCqI8plrPF3+y+xLShljT4rtHenq+3/rYY=; h=From:To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:Resent-From:Resent-To:From; b=nUYKKKHv0gYr73ax1DPCdIChCkyS1TCK3b/2nQSAB83JDnAejAAVdonvD3CSdSJly BUBmSyCIH4Lmbvja+Lyz8VDXmgETd0qiDszMrxQ1Afj2zFXNQ1ymfhQttzWgdHAWYf M8QkCb1V2dUUdO3EfawMI/eH5BtllCQDJdSDAXjA= Delivered-To: kbingham@ideasonboard.com Received: from perceval.ideasonboard.com by perceval.ideasonboard.com with LMTP id SLd2Gyq/EGieDjgA4E0KoQ (envelope-from ) for ; Tue, 29 Apr 2025 13:59:38 +0200 Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by perceval.ideasonboard.com (Postfix) with ESMTPS id 0EC16669; Tue, 29 Apr 2025 13:59:38 +0200 (CEST) Authentication-Results: perceval.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.a=rsa-sha256 header.s=mail header.b=GBlwtaRn; dkim-atps=neutral Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 3BD3768AD5; Tue, 29 Apr 2025 13:59:42 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="GBlwtaRn"; 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 8377A617DB for ; Tue, 29 Apr 2025 13:59:40 +0200 (CEST) Received: from ideasonboard.com (unknown [IPv6:2a00:6020:448c:6c00:79bc:8373:e04e:9a51]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id B720C669; Tue, 29 Apr 2025 13:59:34 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1745927974; bh=/8eFKApEsVCqI8plrPF3+y+xLShljT4rtHenq+3/rYY=; h=From:To:Cc:Subject:Date:From; b=GBlwtaRnKRjnzj32hrFZg1mQZFfytFmygB3fV+YQ20wSTNCLKeL79GEM0xilfYPeA igo/uDhq+Re/gq5GFWjA1bBRVvHqxSLOkDF+yu9PEOaZWgN4rlLuKvFqRIKc5DjEG1 vvWboHxiO3nuB/MNYEx1A0P9UllUvARrNxrpoDFU= From: Stefan Klug To: libcamera-devel@lists.libcamera.org Cc: Stefan Klug Subject: [PATCH] ipa: rkisp1: awb: Ignore empty AWB statistics Date: Tue, 29 Apr 2025 13:59:19 +0200 Message-ID: <20250429115934.3551701-1-stefan.klug@ideasonboard.com> X-Mailer: git-send-email 2.43.0 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" X-TUID: +vUbSA6pLHJ2 Resent-From: Kieran Bingham Resent-To: parsemail@patchwork.libcamera.org 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 . Reviewed-by: Daniel Scally Reviewed-by: Kieran Bingham --- 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 eafe93081bb1..2b8b41ecccbe 100644 --- a/src/ipa/rkisp1/algorithms/awb.cpp +++ b/src/ipa/rkisp1/algorithms/awb.cpp @@ -296,6 +296,11 @@ void Awb::process(IPAContext &context, const rkisp1_cif_isp_stat *params = &stats->params; const rkisp1_cif_isp_awb_stat *awb = ¶ms->awb; + if (awb->awb_mean[0].cnt == 0) { + LOG(RkISP1Awb, Warning) << "AWB statistics are empty"; + return; + } + RGB rgbMeans = calculateRgbMeans(frameContext, awb); /*