From patchwork Sun Feb 23 23:04:01 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 22835 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 ABC9BBDB13 for ; Sun, 23 Feb 2025 23:04:58 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 58A52686EF; Mon, 24 Feb 2025 00:04:57 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="Fw/Lk/JN"; 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 EF2FA686D9 for ; Mon, 24 Feb 2025 00:04:38 +0100 (CET) Received: from pendragon.ideasonboard.com (81-175-209-231.bb.dnainternet.fi [81.175.209.231]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id EE2B482A for ; Mon, 24 Feb 2025 00:03:12 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1740351793; bh=G4gewnWK8OyfuhD2zFrCm4NqwzDTbAcZCjL60GYX7OA=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Fw/Lk/JNcEWOMI0VTfqtZ2dRxJBOebfJYyGEThfNgK5Oq+iWdKjMz5nSpoNCAUwKR rP9Lo+Jz/7F2DHMq5dNlw8+SCIFjr+X7I72BbEw8ZNz0WdsqtY80JtI0qWfeWmH3cy hM0GcvwLN6EJ1tXju8yJqwjz7a7RS9HqMbjs9QPw= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Subject: [PATCH 13/15] ipa: rkisp1: awb: Don't calculate RGB means if stats are missing Date: Mon, 24 Feb 2025 01:04:01 +0200 Message-ID: <20250223230403.1226-14-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.45.3 In-Reply-To: <20250223230403.1226-1-laurent.pinchart@ideasonboard.com> References: <20250223230403.1226-1-laurent.pinchart@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 statistics are missing we can't meaningfully calculate the RGB means. Move their calculation after checking if stats are available. Signed-off-by: Laurent Pinchart Reviewed-by: Stefan Klug --- src/ipa/rkisp1/algorithms/awb.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ipa/rkisp1/algorithms/awb.cpp b/src/ipa/rkisp1/algorithms/awb.cpp index af34b81beb96..7f333ef86518 100644 --- a/src/ipa/rkisp1/algorithms/awb.cpp +++ b/src/ipa/rkisp1/algorithms/awb.cpp @@ -282,7 +282,6 @@ void Awb::process(IPAContext &context, const rkisp1_cif_isp_stat *params = &stats->params; const rkisp1_cif_isp_awb_stat *awb = ¶ms->awb; IPAActiveState &activeState = context.activeState; - RGB rgbMeans = calculateRgbMeans(frameContext, awb); metadata.set(controls::AwbEnable, frameContext.awb.autoEnabled); metadata.set(controls::ColourGains, { @@ -296,6 +295,8 @@ void Awb::process(IPAContext &context, return; } + RGB rgbMeans = calculateRgbMeans(frameContext, awb); + /* * If the means are too small we don't have enough information to * meaningfully calculate gains. Freeze the algorithm in that case.