[{"id":30932,"web_url":"https://patchwork.libcamera.org/comment/30932/","msgid":"<Zs7ObkEn2Gtt543-@pyrite.rasen.tech>","date":"2024-08-28T07:14:54","subject":"Re: [PATCH v4 3/6] ipa: rkisp1: awb: Implement ColourTemperature\n\tcontrol","submitter":{"id":17,"url":"https://patchwork.libcamera.org/api/people/17/","name":"Paul Elder","email":"paul.elder@ideasonboard.com"},"content":"On Tue, Aug 13, 2024 at 10:44:20AM +0200, Stefan Klug wrote:\n> There are many use-cases (tuning-validation, working in static\n> environments) where a manual ColourTemperature control is helpful.\n> Implement that by interpolating and applying the white balance gains\n> from the tuning file according to the requested colour temperature. If\n> colour gains are provided on the same request, they take precedence. As\n> the colour temperature reported in the metadata is always based on the\n> measurements, we don't have to touch that.\n> \n> Note that in the automatic case, the colour gains are still based on the\n> gray world model and the ones from the tuning file get ignored.\n> \n> Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\n\nReviewed-by: Paul Elder <paul.elder@ideasonboard.com>\n\n> ---\n>  src/ipa/rkisp1/algorithms/awb.cpp | 22 +++++++++++++++++++++-\n>  1 file changed, 21 insertions(+), 1 deletion(-)\n> \n> diff --git a/src/ipa/rkisp1/algorithms/awb.cpp b/src/ipa/rkisp1/algorithms/awb.cpp\n> index c23f749c192b..d482eda5b541 100644\n> --- a/src/ipa/rkisp1/algorithms/awb.cpp\n> +++ b/src/ipa/rkisp1/algorithms/awb.cpp\n> @@ -31,6 +31,10 @@ namespace ipa::rkisp1::algorithms {\n>  \n>  LOG_DEFINE_CATEGORY(RkISP1Awb)\n>  \n> +constexpr int32_t kMinColourTemperature = 2500;\n> +constexpr int32_t kMaxColourTemperature = 10000;\n> +constexpr int32_t kDefaultColourTemperature = 6500;\n> +\n>  /* Minimum mean value below which AWB can't operate. */\n>  constexpr double kMeanMinThreshold = 2.0;\n>  \n> @@ -42,8 +46,13 @@ Awb::Awb()\n>  /**\n>   * \\copydoc libcamera::ipa::Algorithm::init\n>   */\n> -int Awb::init([[maybe_unused]] IPAContext &context, const YamlObject &tuningData)\n> +int Awb::init(IPAContext &context, const YamlObject &tuningData)\n>  {\n> +\tauto &cmap = context.ctrlMap;\n> +\tcmap[&controls::ColourTemperature] = ControlInfo(kMinColourTemperature,\n> +\t\t\t\t\t\t\t kMaxColourTemperature,\n> +\t\t\t\t\t\t\t kDefaultColourTemperature);\n> +\n>  \tMatrixInterpolator<double, 2, 1> gains;\n>  \tint ret = gains.readYaml(tuningData[\"gains\"], \"ct\", \"gains\");\n>  \tif (ret < 0)\n> @@ -113,6 +122,17 @@ void Awb::queueRequest(IPAContext &context,\n>  \t\t\t<< \", blue: \" << awb.gains.manual.blue;\n>  \t}\n>  \n> +\tconst auto &colourTemperature = controls.get(controls::ColourTemperature);\n> +\tif (colourTemperature && !awb.autoEnabled && gains_ && !colourGains) {\n> +\t\tMatrix<double, 2, 1> gains = gains_->get(*colourTemperature);\n> +\t\tawb.gains.manual.red = gains[0][0];\n> +\t\tawb.gains.manual.blue = gains[1][0];\n> +\n> +\t\tLOG(RkISP1Awb, Debug)\n> +\t\t\t<< \"Set colour gains to red: \" << awb.gains.manual.red\n> +\t\t\t<< \", blue: \" << awb.gains.manual.blue;\n> +\t}\n> +\n>  \tframeContext.awb.autoEnabled = awb.autoEnabled;\n>  \n>  \tif (!awb.autoEnabled) {\n> -- \n> 2.43.0\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 5C2CDC323E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 28 Aug 2024 07:15:07 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 4B37863460;\n\tWed, 28 Aug 2024 09:15:06 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id A775561903\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 28 Aug 2024 09:15:03 +0200 (CEST)","from pyrite.rasen.tech (unknown\n\t[IPv6:2404:7a81:160:2100:632b:90c4:b4b9:9e22])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 031B27E4;\n\tWed, 28 Aug 2024 09:13:54 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"rNW9BfRA\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1724829236;\n\tbh=0XOwb5ZvDSPPKDsR/RpsUaI+3CdhThfmk/3vIEubjak=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=rNW9BfRALRJuiJ0cVl4IEtCjLS5XFAeF2gUwvsYtzXf+tHn9C5/HWWKuSdWf99qpe\n\tSxS1ENqn55Hb3iR8ube4xabgU1UR2A9RxkdLOq8vwOWmPWUng/WdJZiksk9DeAZiIs\n\t6SOJwiXJvS0cLH5qpTFfiC1OdJPZmlS5i+VrN4EY=","Date":"Wed, 28 Aug 2024 16:14:54 +0900","From":"Paul Elder <paul.elder@ideasonboard.com>","To":"Stefan Klug <stefan.klug@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Subject":"Re: [PATCH v4 3/6] ipa: rkisp1: awb: Implement ColourTemperature\n\tcontrol","Message-ID":"<Zs7ObkEn2Gtt543-@pyrite.rasen.tech>","References":"<20240813084451.44099-1-stefan.klug@ideasonboard.com>\n\t<20240813084451.44099-4-stefan.klug@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","In-Reply-To":"<20240813084451.44099-4-stefan.klug@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>"}},{"id":30975,"web_url":"https://patchwork.libcamera.org/comment/30975/","msgid":"<20240830000207.GD26181@pendragon.ideasonboard.com>","date":"2024-08-30T00:02:07","subject":"Re: [PATCH v4 3/6] ipa: rkisp1: awb: Implement ColourTemperature\n\tcontrol","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Stefan,\n\nThank you for the patch.\n\nOn Tue, Aug 13, 2024 at 10:44:20AM +0200, Stefan Klug wrote:\n> There are many use-cases (tuning-validation, working in static\n> environments) where a manual ColourTemperature control is helpful.\n> Implement that by interpolating and applying the white balance gains\n> from the tuning file according to the requested colour temperature. If\n> colour gains are provided on the same request, they take precedence. As\n> the colour temperature reported in the metadata is always based on the\n> measurements, we don't have to touch that.\n\nI thought the metadata would report the colour temperature that was set\nmanually. This likely calls for a clarification in the control\ndocumentation.\n\nReading https://lists.libcamera.org/pipermail/libcamera-devel/2023-December/039733.html,\nit sounds like the Raspberry Pi implementation would stop evaluating the\ncolour temperature when AWB is disabled. Do we need to leave this\nbehaviour undocumented and up to pipeline handlers ? I usually try to\navoid that. Can we standardize on one behaviour that would work for\neverybody ?\n\n> Note that in the automatic case, the colour gains are still based on the\n> gray world model and the ones from the tuning file get ignored.\n> \n> Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\n> ---\n>  src/ipa/rkisp1/algorithms/awb.cpp | 22 +++++++++++++++++++++-\n>  1 file changed, 21 insertions(+), 1 deletion(-)\n> \n> diff --git a/src/ipa/rkisp1/algorithms/awb.cpp b/src/ipa/rkisp1/algorithms/awb.cpp\n> index c23f749c192b..d482eda5b541 100644\n> --- a/src/ipa/rkisp1/algorithms/awb.cpp\n> +++ b/src/ipa/rkisp1/algorithms/awb.cpp\n> @@ -31,6 +31,10 @@ namespace ipa::rkisp1::algorithms {\n>  \n>  LOG_DEFINE_CATEGORY(RkISP1Awb)\n>  \n> +constexpr int32_t kMinColourTemperature = 2500;\n> +constexpr int32_t kMaxColourTemperature = 10000;\n> +constexpr int32_t kDefaultColourTemperature = 6500;\n> +\n>  /* Minimum mean value below which AWB can't operate. */\n>  constexpr double kMeanMinThreshold = 2.0;\n>  \n> @@ -42,8 +46,13 @@ Awb::Awb()\n>  /**\n>   * \\copydoc libcamera::ipa::Algorithm::init\n>   */\n> -int Awb::init([[maybe_unused]] IPAContext &context, const YamlObject &tuningData)\n> +int Awb::init(IPAContext &context, const YamlObject &tuningData)\n>  {\n> +\tauto &cmap = context.ctrlMap;\n> +\tcmap[&controls::ColourTemperature] = ControlInfo(kMinColourTemperature,\n> +\t\t\t\t\t\t\t kMaxColourTemperature,\n> +\t\t\t\t\t\t\t kDefaultColourTemperature);\n> +\n>  \tMatrixInterpolator<double, 2, 1> gains;\n>  \tint ret = gains.readYaml(tuningData[\"gains\"], \"ct\", \"gains\");\n>  \tif (ret < 0)\n> @@ -113,6 +122,17 @@ void Awb::queueRequest(IPAContext &context,\n>  \t\t\t<< \", blue: \" << awb.gains.manual.blue;\n>  \t}\n>  \n> +\tconst auto &colourTemperature = controls.get(controls::ColourTemperature);\n> +\tif (colourTemperature && !awb.autoEnabled && gains_ && !colourGains) {\n> +\t\tMatrix<double, 2, 1> gains = gains_->get(*colourTemperature);\n> +\t\tawb.gains.manual.red = gains[0][0];\n> +\t\tawb.gains.manual.blue = gains[1][0];\n> +\n> +\t\tLOG(RkISP1Awb, Debug)\n> +\t\t\t<< \"Set colour gains to red: \" << awb.gains.manual.red\n> +\t\t\t<< \", blue: \" << awb.gains.manual.blue;\n> +\t}\n\nI wonder if the following would make the logic clearer:\n\n\tconst auto &colourGains = controls.get(controls::ColourGains);\n\tconst auto &colourTemperature = controls.get(controls::ColourTemperature);\n\n\tif (!awb.autoEnabled) {\n\t\tbool update = false;\n\n\t\tif (colourGains) {\n\t\t\tawb.gains.manual.red = (*colourGains)[0];\n\t\t\tawb.gains.manual.blue = (*colourGains)[1];\n\t\t\tupdate = true;\n\t\t} else if (colourTemperature && gains_) {\n\t\t\tMatrix<double, 2, 1> gains = gains_->get(*colourTemperature);\n\t\t\tawb.gains.manual.red = gains[0][0];\n\t\t\tawb.gains.manual.blue = gains[1][0];\n\t\t\tupdate = true;\n\t\t}\n\n\t\tif (update)\n\t\t\tLOG(RkISP1Awb, Debug)\n\t\t\t\t<< \"Set colour gains to red: \" << awb.gains.manual.red\n\t\t\t\t<< \", blue: \" << awb.gains.manual.blue;\n\t}\n\n> +\n>  \tframeContext.awb.autoEnabled = awb.autoEnabled;\n>  \n>  \tif (!awb.autoEnabled) {","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 DA077C324C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 30 Aug 2024 00:02:40 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 97A3663458;\n\tFri, 30 Aug 2024 02:02:39 +0200 (CEST)","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 A33606002E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 30 Aug 2024 02:02:38 +0200 (CEST)","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 83BD3524;\n\tFri, 30 Aug 2024 02:01:29 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"GfwdjDT7\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1724976089;\n\tbh=VUOsUGFKboZnkq50TmVPi57S4CqQD7ss/SzzmnVKRDY=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=GfwdjDT7/62LeKysQrVSCR21fjVw9JZX86QAIRjZOOlXmAVX2Caepi90oBjIn6Ppw\n\tfALJlGYZBAT18MC4oZVqabRTtvAi1Sq+rTEnhIuWBwMwnWIFJQCg0OCUlsFCUa/Amk\n\tQF/v+yaLn0aUuWGPwIojVzLUODtfyd5E4MCupYvU=","Date":"Fri, 30 Aug 2024 03:02:07 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Stefan Klug <stefan.klug@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Subject":"Re: [PATCH v4 3/6] ipa: rkisp1: awb: Implement ColourTemperature\n\tcontrol","Message-ID":"<20240830000207.GD26181@pendragon.ideasonboard.com>","References":"<20240813084451.44099-1-stefan.klug@ideasonboard.com>\n\t<20240813084451.44099-4-stefan.klug@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20240813084451.44099-4-stefan.klug@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>"}},{"id":30978,"web_url":"https://patchwork.libcamera.org/comment/30978/","msgid":"<km6cfywnhy2gwstcrk2qnk54dktl5n3n2ku2vbo6rpqd6ygaeu@iit5dclnmdu7>","date":"2024-08-30T06:20:16","subject":"Re: [PATCH v4 3/6] ipa: rkisp1: awb: Implement ColourTemperature\n\tcontrol","submitter":{"id":184,"url":"https://patchwork.libcamera.org/api/people/184/","name":"Stefan Klug","email":"stefan.klug@ideasonboard.com"},"content":"Hi Laurent,\n\nThank you for the review. \n\nOn Fri, Aug 30, 2024 at 03:02:07AM +0300, Laurent Pinchart wrote:\n> Hi Stefan,\n> \n> Thank you for the patch.\n> \n> On Tue, Aug 13, 2024 at 10:44:20AM +0200, Stefan Klug wrote:\n> > There are many use-cases (tuning-validation, working in static\n> > environments) where a manual ColourTemperature control is helpful.\n> > Implement that by interpolating and applying the white balance gains\n> > from the tuning file according to the requested colour temperature. If\n> > colour gains are provided on the same request, they take precedence. As\n> > the colour temperature reported in the metadata is always based on the\n> > measurements, we don't have to touch that.\n> \n> I thought the metadata would report the colour temperature that was set\n> manually. This likely calls for a clarification in the control\n> documentation.\n> \n> Reading https://lists.libcamera.org/pipermail/libcamera-devel/2023-December/039733.html,\n> it sounds like the Raspberry Pi implementation would stop evaluating the\n> colour temperature when AWB is disabled. Do we need to leave this\n> behaviour undocumented and up to pipeline handlers ? I usually try to\n> avoid that. Can we standardize on one behaviour that would work for\n> everybody ?\n\nThis goes hand in hand with what I replied on Patch 1. We also had a\ndiscussion on IRC what you would expect in metadata:\n a) the measurements for the current frame (which get applied on the next), \n b) the temperature used to process the current frame.\n\nThe difficulty is, that if you specify manual ColourGains and manual\nColorCorrectionMatrix, there is no temperature used at all for\nprocessing that frame. So b) can not be realized properly.\n\nBy implementing a), the complexity goes away and the behaviour works for\nthe RPi case you mention above.\n\nThe only corner case that is left, is that with regards to PFC, you\ndon't know when a manually set colour temperature got applied. But I\nthink we can neglect that one.\n\n> \n> > Note that in the automatic case, the colour gains are still based on the\n> > gray world model and the ones from the tuning file get ignored.\n> > \n> > Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\n> > ---\n> >  src/ipa/rkisp1/algorithms/awb.cpp | 22 +++++++++++++++++++++-\n> >  1 file changed, 21 insertions(+), 1 deletion(-)\n> > \n> > diff --git a/src/ipa/rkisp1/algorithms/awb.cpp b/src/ipa/rkisp1/algorithms/awb.cpp\n> > index c23f749c192b..d482eda5b541 100644\n> > --- a/src/ipa/rkisp1/algorithms/awb.cpp\n> > +++ b/src/ipa/rkisp1/algorithms/awb.cpp\n> > @@ -31,6 +31,10 @@ namespace ipa::rkisp1::algorithms {\n> >  \n> >  LOG_DEFINE_CATEGORY(RkISP1Awb)\n> >  \n> > +constexpr int32_t kMinColourTemperature = 2500;\n> > +constexpr int32_t kMaxColourTemperature = 10000;\n> > +constexpr int32_t kDefaultColourTemperature = 6500;\n> > +\n> >  /* Minimum mean value below which AWB can't operate. */\n> >  constexpr double kMeanMinThreshold = 2.0;\n> >  \n> > @@ -42,8 +46,13 @@ Awb::Awb()\n> >  /**\n> >   * \\copydoc libcamera::ipa::Algorithm::init\n> >   */\n> > -int Awb::init([[maybe_unused]] IPAContext &context, const YamlObject &tuningData)\n> > +int Awb::init(IPAContext &context, const YamlObject &tuningData)\n> >  {\n> > +\tauto &cmap = context.ctrlMap;\n> > +\tcmap[&controls::ColourTemperature] = ControlInfo(kMinColourTemperature,\n> > +\t\t\t\t\t\t\t kMaxColourTemperature,\n> > +\t\t\t\t\t\t\t kDefaultColourTemperature);\n> > +\n> >  \tMatrixInterpolator<double, 2, 1> gains;\n> >  \tint ret = gains.readYaml(tuningData[\"gains\"], \"ct\", \"gains\");\n> >  \tif (ret < 0)\n> > @@ -113,6 +122,17 @@ void Awb::queueRequest(IPAContext &context,\n> >  \t\t\t<< \", blue: \" << awb.gains.manual.blue;\n> >  \t}\n> >  \n> > +\tconst auto &colourTemperature = controls.get(controls::ColourTemperature);\n> > +\tif (colourTemperature && !awb.autoEnabled && gains_ && !colourGains) {\n> > +\t\tMatrix<double, 2, 1> gains = gains_->get(*colourTemperature);\n> > +\t\tawb.gains.manual.red = gains[0][0];\n> > +\t\tawb.gains.manual.blue = gains[1][0];\n> > +\n> > +\t\tLOG(RkISP1Awb, Debug)\n> > +\t\t\t<< \"Set colour gains to red: \" << awb.gains.manual.red\n> > +\t\t\t<< \", blue: \" << awb.gains.manual.blue;\n> > +\t}\n> \n> I wonder if the following would make the logic clearer:\n> \n> \tconst auto &colourGains = controls.get(controls::ColourGains);\n> \tconst auto &colourTemperature = controls.get(controls::ColourTemperature);\n> \n> \tif (!awb.autoEnabled) {\n> \t\tbool update = false;\n> \n> \t\tif (colourGains) {\n> \t\t\tawb.gains.manual.red = (*colourGains)[0];\n> \t\t\tawb.gains.manual.blue = (*colourGains)[1];\n> \t\t\tupdate = true;\n> \t\t} else if (colourTemperature && gains_) {\n> \t\t\tMatrix<double, 2, 1> gains = gains_->get(*colourTemperature);\n> \t\t\tawb.gains.manual.red = gains[0][0];\n> \t\t\tawb.gains.manual.blue = gains[1][0];\n> \t\t\tupdate = true;\n> \t\t}\n> \n> \t\tif (update)\n> \t\t\tLOG(RkISP1Awb, Debug)\n> \t\t\t\t<< \"Set colour gains to red: \" << awb.gains.manual.red\n> \t\t\t\t<< \", blue: \" << awb.gains.manual.blue;\n> \t}\n\nIf I remember correctly, I tried to stick to the style of low nesting\nlevels, but I think you are right, it is easier to comprehend. No that I\nlook at it again, the frameContext access below is also guared with\nif(!awb.autoEnable) so we can even do a \n\nframeContext.awb.autoEnabled = awb.autoEnabled;\n\nif(awb.autoEnable)\n\treturn;\n\nif (colourGains) {\n        awb.gains.manual.red = (*colourGains)[0];\n        awb.gains.manual.blue = (*colourGains)[1];\n        update = true;\n} else if (colourTemperature && gains_) {\n         Matrix<double, 2, 1> gains = gains_->get(*colourTemperature);\n         awb.gains.manual.red = gains[0][0];\n         awb.gains.manual.blue = gains[1][0];\n         update = true;\n}\n \nif (update)\n          LOG(RkISP1Awb, Debug)\n                 << \"Set colour gains to red: \" << awb.gains.manual.red\n                 << \", blue: \" << awb.gains.manual.blue;\n\nframeContext.awb.gains.red = awb.gains.manual.red;\nframeContext.awb.gains.green = 1.0;\nframeContext.awb.gains.blue = awb.gains.manual.blue;\n\n\nI'll prepare an new patch.\n\nRegards,\nStefan\n\n> \n> > +\n> >  \tframeContext.awb.autoEnabled = awb.autoEnabled;\n> >  \n> >  \tif (!awb.autoEnabled) {\n> \n> -- \n> Regards,\n> \n> Laurent Pinchart","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 50488C324C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 30 Aug 2024 06:20:22 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 27D0263458;\n\tFri, 30 Aug 2024 08:20:21 +0200 (CEST)","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 11E3961900\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 30 Aug 2024 08:20:20 +0200 (CEST)","from ideasonboard.com (unknown\n\t[IPv6:2a00:6020:448c:6c00:e99d:2bef:156e:346a])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id EB1AF229;\n\tFri, 30 Aug 2024 08:19:10 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"mxShpPx1\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1724998751;\n\tbh=5s30GIZqp5pljNeRYxgR1gzF2oOV2KZh+CK5t2iJ19s=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=mxShpPx1/7TSQucFvmJzQid8pIBcru62UiGaMHgZaDa3uBu3/AoJY/MIBDu890p22\n\tYlTpuqypEZh7CEJTp1YUhl9FDtD138+hGkuLryDxTvjpSDSkH+Zf+w+YHcbIZvDcMK\n\tXOX7m8jrSLGCaP6IR/CzSAJkguMyiuCV0SkI1h9E=","Date":"Fri, 30 Aug 2024 08:20:16 +0200","From":"Stefan Klug <stefan.klug@ideasonboard.com>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Subject":"Re: [PATCH v4 3/6] ipa: rkisp1: awb: Implement ColourTemperature\n\tcontrol","Message-ID":"<km6cfywnhy2gwstcrk2qnk54dktl5n3n2ku2vbo6rpqd6ygaeu@iit5dclnmdu7>","References":"<20240813084451.44099-1-stefan.klug@ideasonboard.com>\n\t<20240813084451.44099-4-stefan.klug@ideasonboard.com>\n\t<20240830000207.GD26181@pendragon.ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20240830000207.GD26181@pendragon.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>"}}]