From patchwork Fri Nov 15 07:46:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Scally X-Patchwork-Id: 21899 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 C7CADC0F1B for ; Fri, 15 Nov 2024 07:46:57 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id E9C2465869; Fri, 15 Nov 2024 08:46:53 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="jzxLBMn2"; 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 0D1516585E for ; Fri, 15 Nov 2024 08:46:49 +0100 (CET) Received: from mail.ideasonboard.com (cpc141996-chfd3-2-0-cust928.12-3.cable.virginm.net [86.13.91.161]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id DAA72FC5; Fri, 15 Nov 2024 08:46:33 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1731656794; bh=pYUogIqwFlE9rtSCiMpCOv+mp+KdUEJQt/YLSUmQY2M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jzxLBMn23Kl0C6VfveVtulnt42I0sE583H/az83MaIRKHwwuJtqjlPJnpXCPoPkkB K4qJji4BaGkPIaMjPXX8/UYR5dHxfRi/LooKmgRgmVbzmg3nlGHxAdjvT6xDXFjdmd KLdbtyPfdqQtUH9BPOhYFq2amvtt7Jf0PZO4k66Y= From: Daniel Scally To: libcamera-devel@lists.libcamera.org Cc: mike.rudenko@gmail.com, Daniel Scally , Jacopo Mondi Subject: [PATCH v3 3/6] ipa: rkisp1: Use centralised libipa helpers Date: Fri, 15 Nov 2024 07:46:25 +0000 Message-Id: <20241115074628.417215-4-dan.scally@ideasonboard.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241115074628.417215-1-dan.scally@ideasonboard.com> References: <20241115074628.417215-1-dan.scally@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" Use the centralised libipa helpers instead of open-coding common functions. Reviewed-by: Jacopo Mondi Signed-off-by: Daniel Scally Reviewed-by: Kieran Bingham Reviewed-by: Milan Zamazal Reviewed-by: Laurent Pinchart --- Changes in v3: - None Changes in v2: - Dropped the ipa:: prefix for function calls src/ipa/rkisp1/algorithms/awb.cpp | 18 ++---------------- src/ipa/rkisp1/algorithms/awb.h | 2 -- 2 files changed, 2 insertions(+), 18 deletions(-) diff --git a/src/ipa/rkisp1/algorithms/awb.cpp b/src/ipa/rkisp1/algorithms/awb.cpp index b3c00bef..5c1d9511 100644 --- a/src/ipa/rkisp1/algorithms/awb.cpp +++ b/src/ipa/rkisp1/algorithms/awb.cpp @@ -16,6 +16,8 @@ #include +#include "libipa/colours.h" + /** * \file awb.h */ @@ -178,22 +180,6 @@ void Awb::prepare(IPAContext &context, const uint32_t frame, } } -uint32_t Awb::estimateCCT(double red, double green, double blue) -{ - /* Convert the RGB values to CIE tristimulus values (XYZ) */ - double X = (-0.14282) * (red) + (1.54924) * (green) + (-0.95641) * (blue); - double Y = (-0.32466) * (red) + (1.57837) * (green) + (-0.73191) * (blue); - double Z = (-0.68202) * (red) + (0.77073) * (green) + (0.56332) * (blue); - - /* Calculate the normalized chromaticity values */ - double x = X / (X + Y + Z); - double y = Y / (X + Y + Z); - - /* Calculate CCT */ - double n = (x - 0.3320) / (0.1858 - y); - return 449 * n * n * n + 3525 * n * n + 6823.3 * n + 5520.33; -} - /** * \copydoc libcamera::ipa::Algorithm::process */ diff --git a/src/ipa/rkisp1/algorithms/awb.h b/src/ipa/rkisp1/algorithms/awb.h index b3b2c0bb..6ac3a5c3 100644 --- a/src/ipa/rkisp1/algorithms/awb.h +++ b/src/ipa/rkisp1/algorithms/awb.h @@ -32,8 +32,6 @@ public: ControlList &metadata) override; private: - uint32_t estimateCCT(double red, double green, double blue); - bool rgbMode_; };