From patchwork Fri Nov 15 07:46:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Scally X-Patchwork-Id: 21900 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 6C929C32CE for ; Fri, 15 Nov 2024 07:46:58 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 51D0165873; Fri, 15 Nov 2024 08:46:55 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="IIg0UbqG"; 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 1E29C6585F 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 3BF8C1114; Fri, 15 Nov 2024 08:46:34 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1731656794; bh=lcrlNkc6CH1nbUiNUpE3DSZJPddES9HIFWoJs45Fifk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IIg0UbqG41RmfD6k4zpsmay9OhQ+hdmNnJsPm9t+ecmSvMwDQN5Xvq20RVDJgWnKI YmyJc24ZESKwH8gpsqcVU1WqWeIvLMcIGlzTvgZ8Fx6FoG3hlXhG7MdRtug0FAvhbf YumQNOBW3NipJdpaVvhhgMR+sh6B8kiNmOMTTUDc= From: Daniel Scally To: libcamera-devel@lists.libcamera.org Cc: mike.rudenko@gmail.com, Daniel Scally Subject: [PATCH v3 4/6] ipa: rpi: Use centralised libipa helpers Date: Fri, 15 Nov 2024 07:46:26 +0000 Message-Id: <20241115074628.417215-5-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 rather than open coding common functions. Signed-off-by: Daniel Scally Reviewed-by: Kieran Bingham Reviewed-by: Laurent Pinchart Reviewed-by: Naushir Patuck --- Changes in v3: - None Changes in v2: - None. Jacopo; this isn't in the libcamera::ipa namespace. As an alternative to the prefix I could "using namespace libcamera::ipa" if that's better? src/ipa/rpi/controller/rpi/agc_channel.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/ipa/rpi/controller/rpi/agc_channel.cpp b/src/ipa/rpi/controller/rpi/agc_channel.cpp index c9df9b5b..8583f4f3 100644 --- a/src/ipa/rpi/controller/rpi/agc_channel.cpp +++ b/src/ipa/rpi/controller/rpi/agc_channel.cpp @@ -12,6 +12,8 @@ #include +#include "libipa/colours.h" + #include "../awb_status.h" #include "../device_status.h" #include "../histogram.h" @@ -694,11 +696,11 @@ static double computeInitialY(StatisticsPtr &stats, AwbStatus const &awb, double ySum; /* Factor in the AWB correction if needed. */ if (stats->agcStatsPos == Statistics::AgcStatsPos::PreWb) { - ySum = rSum * awb.gainR * .299 + - gSum * awb.gainG * .587 + - bSum * awb.gainB * .114; + ySum = ipa::rec601LuminanceFromRGB(rSum * awb.gainR, + gSum * awb.gainG, + bSum * awb.gainB); } else - ySum = rSum * .299 + gSum * .587 + bSum * .114; + ySum = ipa::rec601LuminanceFromRGB(rSum, gSum, bSum); return ySum / pixelSum / (1 << 16); }