[{"id":32180,"web_url":"https://patchwork.libcamera.org/comment/32180/","msgid":"<173167181439.4187655.17698454770945316664@ping.linuxembedded.co.uk>","date":"2024-11-15T11:56:54","subject":"Re: [PATCH v3 2/6] ipa: ipu3: Use centralised libipa helpers","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Daniel Scally (2024-11-15 07:46:24)\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> ---\n> Changes in v3:\n> \n>         - None\n> \n> Changes in v2:\n> \n>         - Dropped the ipa:: prefix for function calls\n> \n>  src/ipa/ipu3/algorithms/agc.cpp |  7 ++++---\n>  src/ipa/ipu3/algorithms/awb.cpp | 32 ++------------------------------\n>  src/ipa/ipu3/algorithms/awb.h   |  1 -\n>  3 files changed, 6 insertions(+), 34 deletions(-)\n> \n> diff --git a/src/ipa/ipu3/algorithms/agc.cpp b/src/ipa/ipu3/algorithms/agc.cpp\n> index c5f3d8f0..466b3fb3 100644\n> --- a/src/ipa/ipu3/algorithms/agc.cpp\n> +++ b/src/ipa/ipu3/algorithms/agc.cpp\n> @@ -17,6 +17,7 @@\n>  \n>  #include <libcamera/ipa/core_ipa_interface.h>\n>  \n> +#include \"libipa/colours.h\"\n>  #include \"libipa/histogram.h\"\n>  \n>  /**\n> @@ -185,9 +186,9 @@ double Agc::estimateLuminance(double gain) const\n>                 blueSum += std::min(std::get<2>(rgbTriples_[i]) * gain, 255.0);\n>         }\n>  \n> -       double ySum = redSum * rGain_ * 0.299\n> -                   + greenSum * gGain_ * 0.587\n> -                   + blueSum * bGain_ * 0.114;\n> +       double ySum = rec601LuminanceFromRGB(redSum * rGain_,\n> +                                            greenSum * gGain_,\n> +                                            blueSum * bGain_);\n\n\n\\o/\n\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n>  \n>         return ySum / (bdsGrid_.height * bdsGrid_.width) / 255;\n>  }\n> diff --git a/src/ipa/ipu3/algorithms/awb.cpp b/src/ipa/ipu3/algorithms/awb.cpp\n> index 4d6e3994..c3c8b074 100644\n> --- a/src/ipa/ipu3/algorithms/awb.cpp\n> +++ b/src/ipa/ipu3/algorithms/awb.cpp\n> @@ -13,6 +13,8 @@\n>  \n>  #include <libcamera/control_ids.h>\n>  \n> +#include \"libipa/colours.h\"\n> +\n>  /**\n>   * \\file awb.h\n>   */\n> @@ -301,36 +303,6 @@ void Awb::prepare(IPAContext &context,\n>         params->use.acc_ccm = 1;\n>  }\n>  \n> -/**\n> - * The function estimates the correlated color temperature using\n> - * from RGB color space input.\n> - * In physics and color science, the Planckian locus or black body locus is\n> - * the path or locus that the color of an incandescent black body would take\n> - * in a particular chromaticity space as the blackbody temperature changes.\n> - *\n> - * If a narrow range of color temperatures is considered (those encapsulating\n> - * daylight being the most practical case) one can approximate the Planckian\n> - * locus in order to calculate the CCT in terms of chromaticity coordinates.\n> - *\n> - * More detailed information can be found in:\n> - * https://en.wikipedia.org/wiki/Color_temperature#Approximation\n> - */\n> -uint32_t Awb::estimateCCT(double red, double green, double blue)\n> -{\n> -       /* Convert the RGB values to CIE tristimulus values (XYZ) */\n> -       double X = (-0.14282) * (red) + (1.54924) * (green) + (-0.95641) * (blue);\n> -       double Y = (-0.32466) * (red) + (1.57837) * (green) + (-0.73191) * (blue);\n> -       double Z = (-0.68202) * (red) + (0.77073) * (green) + (0.56332) * (blue);\n> -\n> -       /* Calculate the normalized chromaticity values */\n> -       double x = X / (X + Y + Z);\n> -       double y = Y / (X + Y + Z);\n> -\n> -       /* Calculate CCT */\n> -       double n = (x - 0.3320) / (0.1858 - y);\n> -       return 449 * n * n * n + 3525 * n * n + 6823.3 * n + 5520.33;\n> -}\n> -\n>  /* Generate an RGB vector with the average values for each zone */\n>  void Awb::generateZones()\n>  {\n> diff --git a/src/ipa/ipu3/algorithms/awb.h b/src/ipa/ipu3/algorithms/awb.h\n> index c0202823..a13c49ac 100644\n> --- a/src/ipa/ipu3/algorithms/awb.h\n> +++ b/src/ipa/ipu3/algorithms/awb.h\n> @@ -75,7 +75,6 @@ private:\n>         void generateAwbStats(const ipu3_uapi_stats_3a *stats);\n>         void clearAwbStats();\n>         void awbGreyWorld();\n> -       uint32_t estimateCCT(double red, double green, double blue);\n>         static constexpr uint16_t threshold(float value);\n>         static constexpr uint16_t gainValue(double gain);\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 76240C0F1B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 15 Nov 2024 11:57:00 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id A25026586F;\n\tFri, 15 Nov 2024 12:56:59 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 0CA806580A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 15 Nov 2024 12:56:58 +0100 (CET)","from pendragon.ideasonboard.com\n\t(cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 456F8496;\n\tFri, 15 Nov 2024 12:56:43 +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=\"L1OKZJYE\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1731671803;\n\tbh=7o7nHl2OIx6H9rOmbEM/5TiV9fI9+tB435kz2jGXLJM=;\n\th=In-Reply-To:References:Subject:From:Cc:To:Date:From;\n\tb=L1OKZJYE67FBTk/tTwLsV9ZIWRmiHXqeAgVpLHk7/QKJZznkEYbIP7jhQMo/9Bgc1\n\tvT7y6efQRGsriJgc4BRwml4MuWaCDRr1DnRUQrIZDl9UHPXXLuoxxTkxWqZtIF0/8n\n\tzmXJqc+O6UE5qnSlhVz1Lq+h0JSXM+mwHDwjkWWc=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20241115074628.417215-3-dan.scally@ideasonboard.com>","References":"<20241115074628.417215-1-dan.scally@ideasonboard.com>\n\t<20241115074628.417215-3-dan.scally@ideasonboard.com>","Subject":"Re: [PATCH v3 2/6] ipa: ipu3: Use centralised libipa helpers","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"mike.rudenko@gmail.com, Daniel Scally <dan.scally@ideasonboard.com>","To":"Daniel Scally <dan.scally@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","Date":"Fri, 15 Nov 2024 11:56:54 +0000","Message-ID":"<173167181439.4187655.17698454770945316664@ping.linuxembedded.co.uk>","User-Agent":"alot/0.10","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>"}},{"id":32196,"web_url":"https://patchwork.libcamera.org/comment/32196/","msgid":"<87h688lhtn.fsf@redhat.com>","date":"2024-11-15T13:58:28","subject":"Re: [PATCH v3 2/6] ipa: ipu3: Use centralised libipa helpers","submitter":{"id":177,"url":"https://patchwork.libcamera.org/api/people/177/","name":"Milan Zamazal","email":"mzamazal@redhat.com"},"content":"Daniel Scally <dan.scally@ideasonboard.com> writes:\n\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\nReviewed-by: Milan Zamazal <mzamazal@redhat.com>\n\n> ---\n> Changes in v3:\n>\n> \t- None\n>\n> Changes in v2:\n>\n> \t- Dropped the ipa:: prefix for function calls\n>\n>  src/ipa/ipu3/algorithms/agc.cpp |  7 ++++---\n>  src/ipa/ipu3/algorithms/awb.cpp | 32 ++------------------------------\n>  src/ipa/ipu3/algorithms/awb.h   |  1 -\n>  3 files changed, 6 insertions(+), 34 deletions(-)\n>\n> diff --git a/src/ipa/ipu3/algorithms/agc.cpp b/src/ipa/ipu3/algorithms/agc.cpp\n> index c5f3d8f0..466b3fb3 100644\n> --- a/src/ipa/ipu3/algorithms/agc.cpp\n> +++ b/src/ipa/ipu3/algorithms/agc.cpp\n> @@ -17,6 +17,7 @@\n>  \n>  #include <libcamera/ipa/core_ipa_interface.h>\n>  \n> +#include \"libipa/colours.h\"\n>  #include \"libipa/histogram.h\"\n>  \n>  /**\n> @@ -185,9 +186,9 @@ double Agc::estimateLuminance(double gain) const\n>  \t\tblueSum += std::min(std::get<2>(rgbTriples_[i]) * gain, 255.0);\n>  \t}\n>  \n> -\tdouble ySum = redSum * rGain_ * 0.299\n> -\t\t    + greenSum * gGain_ * 0.587\n> -\t\t    + blueSum * bGain_ * 0.114;\n> +\tdouble ySum = rec601LuminanceFromRGB(redSum * rGain_,\n> +\t\t\t\t\t     greenSum * gGain_,\n> +\t\t\t\t\t     blueSum * bGain_);\n>  \n>  \treturn ySum / (bdsGrid_.height * bdsGrid_.width) / 255;\n>  }\n> diff --git a/src/ipa/ipu3/algorithms/awb.cpp b/src/ipa/ipu3/algorithms/awb.cpp\n> index 4d6e3994..c3c8b074 100644\n> --- a/src/ipa/ipu3/algorithms/awb.cpp\n> +++ b/src/ipa/ipu3/algorithms/awb.cpp\n> @@ -13,6 +13,8 @@\n>  \n>  #include <libcamera/control_ids.h>\n>  \n> +#include \"libipa/colours.h\"\n> +\n>  /**\n>   * \\file awb.h\n>   */\n> @@ -301,36 +303,6 @@ void Awb::prepare(IPAContext &context,\n>  \tparams->use.acc_ccm = 1;\n>  }\n>  \n> -/**\n> - * The function estimates the correlated color temperature using\n> - * from RGB color space input.\n> - * In physics and color science, the Planckian locus or black body locus is\n> - * the path or locus that the color of an incandescent black body would take\n> - * in a particular chromaticity space as the blackbody temperature changes.\n> - *\n> - * If a narrow range of color temperatures is considered (those encapsulating\n> - * daylight being the most practical case) one can approximate the Planckian\n> - * locus in order to calculate the CCT in terms of chromaticity coordinates.\n> - *\n> - * More detailed information can be found in:\n> - * https://en.wikipedia.org/wiki/Color_temperature#Approximation\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>  /* Generate an RGB vector with the average values for each zone */\n>  void Awb::generateZones()\n>  {\n> diff --git a/src/ipa/ipu3/algorithms/awb.h b/src/ipa/ipu3/algorithms/awb.h\n> index c0202823..a13c49ac 100644\n> --- a/src/ipa/ipu3/algorithms/awb.h\n> +++ b/src/ipa/ipu3/algorithms/awb.h\n> @@ -75,7 +75,6 @@ private:\n>  \tvoid generateAwbStats(const ipu3_uapi_stats_3a *stats);\n>  \tvoid clearAwbStats();\n>  \tvoid awbGreyWorld();\n> -\tuint32_t estimateCCT(double red, double green, double blue);\n>  \tstatic constexpr uint16_t threshold(float value);\n>  \tstatic constexpr uint16_t gainValue(double gain);","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 503D2C3257\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 15 Nov 2024 13:58:39 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 4E77465895;\n\tFri, 15 Nov 2024 14:58:38 +0100 (CET)","from us-smtp-delivery-124.mimecast.com\n\t(us-smtp-delivery-124.mimecast.com [170.10.129.124])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 7FD206580A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 15 Nov 2024 14:58:36 +0100 (CET)","from mail-wm1-f70.google.com (mail-wm1-f70.google.com\n\t[209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS\n\t(version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id\n\tus-mta-381-uq_-2Y7aOnu2pL6rVPndeA-1; Fri, 15 Nov 2024 08:58:32 -0500","by mail-wm1-f70.google.com with SMTP id\n\t5b1f17b1804b1-4316655b2f1so5170105e9.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 15 Nov 2024 05:58:31 -0800 (PST)","from nuthatch (ip-77-48-47-2.net.vodafone.cz. [77.48.47.2])\n\tby smtp.gmail.com with ESMTPSA id\n\t5b1f17b1804b1-432d478511dsm80382455e9.0.2024.11.15.05.58.29\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tFri, 15 Nov 2024 05:58:29 -0800 (PST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=redhat.com header.i=@redhat.com\n\theader.b=\"P26EysDb\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n\ts=mimecast20190719; t=1731679115;\n\th=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n\tto:to:cc:cc:mime-version:mime-version:content-type:content-type:\n\tin-reply-to:in-reply-to:references:references;\n\tbh=Fn1gd+/aG3fim9vcamhti6OKIDm7py0CVHrwlZ6xOTU=;\n\tb=P26EysDbUEBvTbIjgD5rlWqSr9Af1jV2qk4OHikcoRXMmHSryWlNlqCokosHlrIxyK29JT\n\tr3ZJ3e390xEXV9pjq0hf9msHMKEcfC6zpKE8x0ZgpubfewACdTE78WsOKM7MuX8hYeokL9\n\t9aKTgj2VPZEjlxlhncQbj8ub1MOrfX4=","X-MC-Unique":"uq_-2Y7aOnu2pL6rVPndeA-1","X-Mimecast-MFC-AGG-ID":"uq_-2Y7aOnu2pL6rVPndeA","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1731679110; x=1732283910;\n\th=mime-version:user-agent:message-id:date:references:in-reply-to\n\t:subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date\n\t:message-id:reply-to;\n\tbh=Fn1gd+/aG3fim9vcamhti6OKIDm7py0CVHrwlZ6xOTU=;\n\tb=sP5jUeXUmmELpcvadnenkEfRtsT/X7BJt5qiD6ouK/oymi9yOPpSjtjZlOahhref7c\n\tNhYnDZ5Sd7LP5AIdCd4mpCrgbOmiv2aX9HmL+biDTK2Nhh7FNy18d0L3KMUyVWnWmwAn\n\tjTGQU9Zpzwll+hhy7k0tcyj3+nkxEk5phHQBWRMFZ7c5q9t+R0MUOPz9pfJ39AblUiiP\n\tPTreTFhuiCFaXngB1tfp6btj7MqZu91e4E/Y9orQey1eZKs98vYDhTlfHN3SYX9wjGDf\n\tEmGTrggb+zQXpYajWa3b8ieFcmc/GJIEgvfxangBwceGSbm12hBTeozTP/wHt9fh6GFU\n\tBJMg==","X-Gm-Message-State":"AOJu0Yx7+DOY8QmgKxx6yIDeE9BBaF/DPsrGyISYxgY4+L0Vs+/B1j14\n\tfJFiI8V6BNpd2sVeI2aqdEpq6Szv/w2iswZZr6g9zvkx+RMV8rnG+g3gTREY/gl/oxr1uT+RXEd\n\tWnIZtV8MTZebMBRgv9708vUQcqejxcCt9immSmnBRTF6j9x/q1zjaeOg8ENMjB8NzbIY/2Utx3n\n\taOGlY=","X-Received":["by 2002:a05:600c:1f94:b0:42c:bd27:4c12 with SMTP id\n\t5b1f17b1804b1-432df72c661mr26086895e9.10.1731679110233; \n\tFri, 15 Nov 2024 05:58:30 -0800 (PST)","by 2002:a05:600c:1f94:b0:42c:bd27:4c12 with SMTP id\n\t5b1f17b1804b1-432df72c661mr26086735e9.10.1731679109840; \n\tFri, 15 Nov 2024 05:58:29 -0800 (PST)"],"X-Google-Smtp-Source":"AGHT+IE2KTBZi7TPPw6XTT2YYZxn8EaK4u35/ZY/joJjKukYIvhvkk46vF6Q2tDYjPbSgbl4e5ed8Q==","From":"Milan Zamazal <mzamazal@redhat.com>","To":"Daniel Scally <dan.scally@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org,  mike.rudenko@gmail.com","Subject":"Re: [PATCH v3 2/6] ipa: ipu3: Use centralised libipa helpers","In-Reply-To":"<20241115074628.417215-3-dan.scally@ideasonboard.com> (Daniel\n\tScally's message of \"Fri, 15 Nov 2024 07:46:24 +0000\")","References":"<20241115074628.417215-1-dan.scally@ideasonboard.com>\n\t<20241115074628.417215-3-dan.scally@ideasonboard.com>","Date":"Fri, 15 Nov 2024 14:58:28 +0100","Message-ID":"<87h688lhtn.fsf@redhat.com>","User-Agent":"Gnus/5.13 (Gnus v5.13)","MIME-Version":"1.0","X-Mimecast-Spam-Score":"0","X-Mimecast-MFC-PROC-ID":"aNkfz--QFyoXYPtCjuQlgXTfHoUG7LIb6hPjoDZ-EBw_1731679111","X-Mimecast-Originator":"redhat.com","Content-Type":"text/plain","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>"}},{"id":32204,"web_url":"https://patchwork.libcamera.org/comment/32204/","msgid":"<20241118004853.GF30787@pendragon.ideasonboard.com>","date":"2024-11-18T00:48:53","subject":"Re: [PATCH v3 2/6] ipa: ipu3: Use centralised libipa helpers","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Dan,\n\nThank you for the patch.\n\nOn Fri, Nov 15, 2024 at 07:46:24AM +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\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> ---\n> Changes in v3:\n> \n> \t- None\n> \n> Changes in v2:\n> \n> \t- Dropped the ipa:: prefix for function calls\n> \n>  src/ipa/ipu3/algorithms/agc.cpp |  7 ++++---\n>  src/ipa/ipu3/algorithms/awb.cpp | 32 ++------------------------------\n>  src/ipa/ipu3/algorithms/awb.h   |  1 -\n>  3 files changed, 6 insertions(+), 34 deletions(-)\n> \n> diff --git a/src/ipa/ipu3/algorithms/agc.cpp b/src/ipa/ipu3/algorithms/agc.cpp\n> index c5f3d8f0..466b3fb3 100644\n> --- a/src/ipa/ipu3/algorithms/agc.cpp\n> +++ b/src/ipa/ipu3/algorithms/agc.cpp\n> @@ -17,6 +17,7 @@\n>  \n>  #include <libcamera/ipa/core_ipa_interface.h>\n>  \n> +#include \"libipa/colours.h\"\n>  #include \"libipa/histogram.h\"\n>  \n>  /**\n> @@ -185,9 +186,9 @@ double Agc::estimateLuminance(double gain) const\n>  \t\tblueSum += std::min(std::get<2>(rgbTriples_[i]) * gain, 255.0);\n>  \t}\n>  \n> -\tdouble ySum = redSum * rGain_ * 0.299\n> -\t\t    + greenSum * gGain_ * 0.587\n> -\t\t    + blueSum * bGain_ * 0.114;\n> +\tdouble ySum = rec601LuminanceFromRGB(redSum * rGain_,\n> +\t\t\t\t\t     greenSum * gGain_,\n> +\t\t\t\t\t     blueSum * bGain_);\n>  \n>  \treturn ySum / (bdsGrid_.height * bdsGrid_.width) / 255;\n>  }\n> diff --git a/src/ipa/ipu3/algorithms/awb.cpp b/src/ipa/ipu3/algorithms/awb.cpp\n> index 4d6e3994..c3c8b074 100644\n> --- a/src/ipa/ipu3/algorithms/awb.cpp\n> +++ b/src/ipa/ipu3/algorithms/awb.cpp\n> @@ -13,6 +13,8 @@\n>  \n>  #include <libcamera/control_ids.h>\n>  \n> +#include \"libipa/colours.h\"\n> +\n>  /**\n>   * \\file awb.h\n>   */\n> @@ -301,36 +303,6 @@ void Awb::prepare(IPAContext &context,\n>  \tparams->use.acc_ccm = 1;\n>  }\n>  \n> -/**\n> - * The function estimates the correlated color temperature using\n> - * from RGB color space input.\n> - * In physics and color science, the Planckian locus or black body locus is\n> - * the path or locus that the color of an incandescent black body would take\n> - * in a particular chromaticity space as the blackbody temperature changes.\n> - *\n> - * If a narrow range of color temperatures is considered (those encapsulating\n> - * daylight being the most practical case) one can approximate the Planckian\n> - * locus in order to calculate the CCT in terms of chromaticity coordinates.\n> - *\n> - * More detailed information can be found in:\n> - * https://en.wikipedia.org/wiki/Color_temperature#Approximation\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>  /* Generate an RGB vector with the average values for each zone */\n>  void Awb::generateZones()\n>  {\n> diff --git a/src/ipa/ipu3/algorithms/awb.h b/src/ipa/ipu3/algorithms/awb.h\n> index c0202823..a13c49ac 100644\n> --- a/src/ipa/ipu3/algorithms/awb.h\n> +++ b/src/ipa/ipu3/algorithms/awb.h\n> @@ -75,7 +75,6 @@ private:\n>  \tvoid generateAwbStats(const ipu3_uapi_stats_3a *stats);\n>  \tvoid clearAwbStats();\n>  \tvoid awbGreyWorld();\n> -\tuint32_t estimateCCT(double red, double green, double blue);\n>  \tstatic constexpr uint16_t threshold(float value);\n>  \tstatic constexpr uint16_t gainValue(double gain);\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 E1150C32E0\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 18 Nov 2024 00:49:05 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 1EB6B658B5;\n\tMon, 18 Nov 2024 01:49:05 +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 0699C600F2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 18 Nov 2024 01:49:02 +0100 (CET)","from pendragon.ideasonboard.com (81-175-209-231.bb.dnainternet.fi\n\t[81.175.209.231])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 5624375A;\n\tMon, 18 Nov 2024 01:48:46 +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=\"aX7bXhx7\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1731890926;\n\tbh=IY1VNDfUj7or5LUL7eTSuo2N606fpU/a9uhGYW7a+nc=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=aX7bXhx7AoKBogFX9ErOvuu/3PSpmtFINHhyDyEDaNn1aSDMZfyvEIpueQysb0WEA\n\tMVTuXHkHdEnsXZOcB1rmmoTIfIhGQaNPSdXWeJe0p89Tt6MVkCpe9QFCXDTzRM/G4W\n\t1t0gEr///tg6wGCtKswgdouNVOP7Ih+k5Zr6ck/U=","Date":"Mon, 18 Nov 2024 02:48:53 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Daniel Scally <dan.scally@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org, mike.rudenko@gmail.com","Subject":"Re: [PATCH v3 2/6] ipa: ipu3: Use centralised libipa helpers","Message-ID":"<20241118004853.GF30787@pendragon.ideasonboard.com>","References":"<20241115074628.417215-1-dan.scally@ideasonboard.com>\n\t<20241115074628.417215-3-dan.scally@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20241115074628.417215-3-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>"}}]