[{"id":32000,"web_url":"https://patchwork.libcamera.org/comment/32000/","msgid":"<gm3xpjzufeenq3wtnatekhlxbulxs32sacxdqwk6pb64dsqyd5@dgexz6k372xs>","date":"2024-11-04T11:08:54","subject":"Re: [PATCH 3/6] ipa: rkisp1: Use centralised libipa helpers","submitter":{"id":143,"url":"https://patchwork.libcamera.org/api/people/143/","name":"Jacopo Mondi","email":"jacopo.mondi@ideasonboard.com"},"content":"On Thu, Oct 31, 2024 at 04:07:38PM +0000, Daniel Scally wrote:\n> Use the centralised libipa helpers instead of open-coding common\n> functions.\n>\n> Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com>\n\nWith the ipa:: prefix dropped\n\nReviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\n\nThanks\n  j\n> ---\n>  src/ipa/rkisp1/algorithms/awb.cpp | 20 +++-----------------\n>  src/ipa/rkisp1/algorithms/awb.h   |  2 --\n>  2 files changed, 3 insertions(+), 19 deletions(-)\n>\n> diff --git a/src/ipa/rkisp1/algorithms/awb.cpp b/src/ipa/rkisp1/algorithms/awb.cpp\n> index b3c00bef..623c4eb2 100644\n> --- a/src/ipa/rkisp1/algorithms/awb.cpp\n> +++ b/src/ipa/rkisp1/algorithms/awb.cpp\n> @@ -16,6 +16,8 @@\n>\n>  #include <libcamera/ipa/core_ipa_interface.h>\n>\n> +#include \"libipa/helpers.h\"\n> +\n>  /**\n>   * \\file awb.h\n>   */\n> @@ -178,22 +180,6 @@ void Awb::prepare(IPAContext &context, const uint32_t frame,\n>  \t}\n>  }\n>\n> -uint32_t Awb::estimateCCT(double red, double green, double blue)\n> -{\n> -\t/* Convert the RGB values to CIE tristimulus values (XYZ) */\n> -\tdouble X = (-0.14282) * (red) + (1.54924) * (green) + (-0.95641) * (blue);\n> -\tdouble Y = (-0.32466) * (red) + (1.57837) * (green) + (-0.73191) * (blue);\n> -\tdouble Z = (-0.68202) * (red) + (0.77073) * (green) + (0.56332) * (blue);\n> -\n> -\t/* Calculate the normalized chromaticity values */\n> -\tdouble x = X / (X + Y + Z);\n> -\tdouble y = Y / (X + Y + Z);\n> -\n> -\t/* Calculate CCT */\n> -\tdouble n = (x - 0.3320) / (0.1858 - y);\n> -\treturn 449 * n * n * n + 3525 * n * n + 6823.3 * n + 5520.33;\n> -}\n> -\n>  /**\n>   * \\copydoc libcamera::ipa::Algorithm::process\n>   */\n> @@ -279,7 +265,7 @@ void Awb::process(IPAContext &context,\n>  \t    blueMean < kMeanMinThreshold)\n>  \t\treturn;\n>\n> -\tactiveState.awb.temperatureK = estimateCCT(redMean, greenMean, blueMean);\n> +\tactiveState.awb.temperatureK = ipa::estimateCCT(redMean, greenMean, blueMean);\n>\n>  \t/* Metadata shall contain the up to date measurement */\n>  \tmetadata.set(controls::ColourTemperature, activeState.awb.temperatureK);\n> diff --git a/src/ipa/rkisp1/algorithms/awb.h b/src/ipa/rkisp1/algorithms/awb.h\n> index b3b2c0bb..6ac3a5c3 100644\n> --- a/src/ipa/rkisp1/algorithms/awb.h\n> +++ b/src/ipa/rkisp1/algorithms/awb.h\n> @@ -32,8 +32,6 @@ public:\n>  \t\t     ControlList &metadata) override;\n>\n>  private:\n> -\tuint32_t estimateCCT(double red, double green, double blue);\n> -\n>  \tbool rgbMode_;\n>  };\n>\n> --\n> 2.30.2\n>","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 6497CBDB1C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon,  4 Nov 2024 11:09:00 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 139C9653CC;\n\tMon,  4 Nov 2024 12:09:00 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id EA1AA653C6\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  4 Nov 2024 12:08:57 +0100 (CET)","from ideasonboard.com (mob-5-90-48-188.net.vodafone.it\n\t[5.90.48.188])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 28A7A22E;\n\tMon,  4 Nov 2024 12:08:51 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"UEARVdP2\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1730718531;\n\tbh=VspndvGGhQXWs8+CB8Cjv50+75IZzhwiTw/Y8TSCtC0=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=UEARVdP234iYZCS7yKFhjEovFpOjGdT63S/drhaJZsUH7q3BDZMEcs1ummoto29ph\n\tOfo53J+Y9rZl5RlYvNwrOMQRuxRIzWdnxRaunWGxGNgImfXVvTZ2vecLpxmWppCpCa\n\ttfI/vTMOIunkhKXGjNBvj8PUgD3DYApiD8ytyivY=","Date":"Mon, 4 Nov 2024 12:08:54 +0100","From":"Jacopo Mondi <jacopo.mondi@ideasonboard.com>","To":"Daniel Scally <dan.scally@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org, mike.rudenko@gmail.com","Subject":"Re: [PATCH 3/6] ipa: rkisp1: Use centralised libipa helpers","Message-ID":"<gm3xpjzufeenq3wtnatekhlxbulxs32sacxdqwk6pb64dsqyd5@dgexz6k372xs>","References":"<20241031160741.253855-1-dan.scally@ideasonboard.com>\n\t<20241031160741.253855-4-dan.scally@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20241031160741.253855-4-dan.scally@ideasonboard.com>","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]