From patchwork Thu Nov 7 10:25:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Scally X-Patchwork-Id: 21830 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 E2BBEBDB13 for ; Thu, 7 Nov 2024 10:25:34 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 6D4396547A; Thu, 7 Nov 2024 11:25:31 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="v6CnzBal"; 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 5DBC765466 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 83DF35B3; 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=mD+Z0ouAQECHnuk0+cWyhyDiBcfqd4axufnS7EXoZo4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=v6CnzBalIdmc9J/SNUpwlJNaAZ9TJOxuvh3bIbh3wXMZXD99DLYBB9JPUvhlFe5zn 7z/cPhcnB1lg+bzrd3gXJhjBSzdCL2QCg+pekSXamPJ2ubmNkLuBr+C21T0OY9lMSE gWGlAryXFTqjBouV3ihpZPhhUygAtoW2OSE4kFWc= From: Daniel Scally To: libcamera-devel@lists.libcamera.org Cc: mike.rudenko@gmail.com, Daniel Scally Subject: [PATCH v2 4/6] ipa: rpi: Use centralised libipa helpers Date: Thu, 7 Nov 2024 10:25:06 +0000 Message-Id: <20241107102508.48322-5-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 rather than open coding common functions. Signed-off-by: Daniel Scally --- 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..30e94b9b 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/helpers.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); }