From patchwork Thu Nov 7 10:25:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Scally X-Patchwork-Id: 21829 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 B7E58C324E for ; Thu, 7 Nov 2024 10:25:33 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 9C3736546A; Thu, 7 Nov 2024 11:25:30 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="ArKqoVLS"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 1B0D065461 for ; Thu, 7 Nov 2024 11:25:25 +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 35146A47; Thu, 7 Nov 2024 11:25:16 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1730975116; bh=BwEUT8FYeYLXaHND3HTKt1hkwG1fTX2LYd7awR8CRiI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ArKqoVLSUFl2DlxXOh7ciilSrEFgnK1QGbt6pTOD7pKgIQA1HibwEvIJTiTXnxfbu mU/QnFC9RWQCAoYyieIfy5H4vh0++GwNMyhBGzKoWVFDAfBfYyzncrRZQgKrWgk6vI 5JY2+AqMVjTiCRm6rdnqDL0beLlTFXzkofNxFvXM= From: Daniel Scally To: libcamera-devel@lists.libcamera.org Cc: mike.rudenko@gmail.com, Daniel Scally , Jacopo Mondi Subject: [PATCH v2 3/6] ipa: rkisp1: Use centralised libipa helpers Date: Thu, 7 Nov 2024 10:25:05 +0000 Message-Id: <20241107102508.48322-4-dan.scally@ideasonboard.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241107102508.48322-1-dan.scally@ideasonboard.com> References: <20241107102508.48322-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 --- 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..b8cdfa91 100644 --- a/src/ipa/rkisp1/algorithms/awb.cpp +++ b/src/ipa/rkisp1/algorithms/awb.cpp @@ -16,6 +16,8 @@ #include +#include "libipa/helpers.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_; };