[{"id":30913,"web_url":"https://patchwork.libcamera.org/comment/30913/","msgid":"<Zs2IL5p61KztfvZp@pyrite.rasen.tech>","date":"2024-08-27T08:02:55","subject":"Re: [PATCH v4 2/6] ipa: rkisp1: awb: Load white balance gains from\n\ttuning file","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:19AM +0200, Stefan Klug wrote:\n> For the implementation of a manual colour temperature setting, it is\n> necessary to read predefined colour gains per colour temperature from\n> the tuning file. Implement this in a backwards compatible way. If no\n> gains are contained in the tuning file, loading just continues as\n> before.\n> \n> Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\n> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\nReviewed-by: Paul Elder <paul.elder@ideasonboard.com>\n\n> ---\n>  src/ipa/rkisp1/algorithms/awb.cpp | 18 ++++++++++++++++++\n>  src/ipa/rkisp1/algorithms/awb.h   |  6 ++++++\n>  2 files changed, 24 insertions(+)\n> \n> diff --git a/src/ipa/rkisp1/algorithms/awb.cpp b/src/ipa/rkisp1/algorithms/awb.cpp\n> index 4ccafd48dedd..c23f749c192b 100644\n> --- a/src/ipa/rkisp1/algorithms/awb.cpp\n> +++ b/src/ipa/rkisp1/algorithms/awb.cpp\n> @@ -39,6 +39,24 @@ Awb::Awb()\n>  {\n>  }\n>  \n> +/**\n> + * \\copydoc libcamera::ipa::Algorithm::init\n> + */\n> +int Awb::init([[maybe_unused]] IPAContext &context, const YamlObject &tuningData)\n> +{\n> +\tMatrixInterpolator<double, 2, 1> gains;\n> +\tint ret = gains.readYaml(tuningData[\"gains\"], \"ct\", \"gains\");\n> +\tif (ret < 0)\n> +\t\tLOG(RkISP1Awb, Warning)\n> +\t\t\t<< \"Failed to parse 'gains' \"\n> +\t\t\t<< \"parameter from tuning file; \"\n> +\t\t\t<< \"rgb gains will not be set based on colour temperature\";\n> +\telse\n> +\t\tgains_ = gains;\n> +\n> +\treturn 0;\n> +}\n> +\n>  /**\n>   * \\copydoc libcamera::ipa::Algorithm::configure\n>   */\n> diff --git a/src/ipa/rkisp1/algorithms/awb.h b/src/ipa/rkisp1/algorithms/awb.h\n> index 06c92896e2dc..a010e6d1cb3c 100644\n> --- a/src/ipa/rkisp1/algorithms/awb.h\n> +++ b/src/ipa/rkisp1/algorithms/awb.h\n> @@ -7,6 +7,10 @@\n>  \n>  #pragma once\n>  \n> +#include <optional>\n> +\n> +#include \"libipa/matrix_interpolator.h\"\n> +\n>  #include \"algorithm.h\"\n>  \n>  namespace libcamera {\n> @@ -19,6 +23,7 @@ public:\n>  \tAwb();\n>  \t~Awb() = default;\n>  \n> +\tint init(IPAContext &context, const YamlObject &tuningData) override;\n>  \tint configure(IPAContext &context, const IPACameraSensorInfo &configInfo) override;\n>  \tvoid queueRequest(IPAContext &context, const uint32_t frame,\n>  \t\t\t  IPAFrameContext &frameContext,\n> @@ -34,6 +39,7 @@ public:\n>  private:\n>  \tuint32_t estimateCCT(double red, double green, double blue);\n>  \n> +\tstd::optional<MatrixInterpolator<double, 2, 1>> gains_;\n>  \tbool rgbMode_;\n>  };\n>  \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 BC38CC323E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 27 Aug 2024 08:03:04 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id BF31963453;\n\tTue, 27 Aug 2024 10:03:03 +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 BBF3161901\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 27 Aug 2024 10:03:02 +0200 (CEST)","from pyrite.rasen.tech (unknown\n\t[IPv6:2404:7a81:160:2100:b8b8:7adf:d5d3:ce44])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id A8AC43D5;\n\tTue, 27 Aug 2024 10:01: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=\"kqnQDWZJ\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1724745715;\n\tbh=btfQwIC4NX3guDRy6Gu4D1ECgGrDPjXjQ5y/48do8E8=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=kqnQDWZJSyVF1bi/ktGbgfmRdJ01nT9iWoojRSzu2bY4GzTZrWc/ji7YAGMTbxRiu\n\tJlI1Y4d3FL0Ej6kYNQFzjCjvFA8322Q2ZdMSRRmdCXOgzDcnqqnTL3b8+h5mPq+zRl\n\t6rRvsv4MvFn16hr/U9pN2pKPonO+DpIaKOeMG5Us=","Date":"Tue, 27 Aug 2024 17:02:55 +0900","From":"Paul Elder <paul.elder@ideasonboard.com>","To":"Stefan Klug <stefan.klug@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org,\n\tKieran Bingham <kieran.bingham@ideasonboard.com>","Subject":"Re: [PATCH v4 2/6] ipa: rkisp1: awb: Load white balance gains from\n\ttuning file","Message-ID":"<Zs2IL5p61KztfvZp@pyrite.rasen.tech>","References":"<20240813084451.44099-1-stefan.klug@ideasonboard.com>\n\t<20240813084451.44099-3-stefan.klug@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","In-Reply-To":"<20240813084451.44099-3-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":30976,"web_url":"https://patchwork.libcamera.org/comment/30976/","msgid":"<20240830000925.GB25163@pendragon.ideasonboard.com>","date":"2024-08-30T00:09:25","subject":"Re: [PATCH v4 2/6] ipa: rkisp1: awb: Load white balance gains from\n\ttuning file","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:19AM +0200, Stefan Klug wrote:\n> For the implementation of a manual colour temperature setting, it is\n> necessary to read predefined colour gains per colour temperature from\n> the tuning file. Implement this in a backwards compatible way. If no\n> gains are contained in the tuning file, loading just continues as\n> before.\n> \n> Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\n> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> ---\n>  src/ipa/rkisp1/algorithms/awb.cpp | 18 ++++++++++++++++++\n>  src/ipa/rkisp1/algorithms/awb.h   |  6 ++++++\n>  2 files changed, 24 insertions(+)\n> \n> diff --git a/src/ipa/rkisp1/algorithms/awb.cpp b/src/ipa/rkisp1/algorithms/awb.cpp\n> index 4ccafd48dedd..c23f749c192b 100644\n> --- a/src/ipa/rkisp1/algorithms/awb.cpp\n> +++ b/src/ipa/rkisp1/algorithms/awb.cpp\n> @@ -39,6 +39,24 @@ Awb::Awb()\n>  {\n>  }\n>  \n> +/**\n> + * \\copydoc libcamera::ipa::Algorithm::init\n> + */\n> +int Awb::init([[maybe_unused]] IPAContext &context, const YamlObject &tuningData)\n> +{\n> +\tMatrixInterpolator<double, 2, 1> gains;\n> +\tint ret = gains.readYaml(tuningData[\"gains\"], \"ct\", \"gains\");\n> +\tif (ret < 0)\n> +\t\tLOG(RkISP1Awb, Warning)\n> +\t\t\t<< \"Failed to parse 'gains' \"\n> +\t\t\t<< \"parameter from tuning file; \"\n> +\t\t\t<< \"rgb gains will not be set based on colour temperature\";\n\nDo you expect we will do more with the tuning parameters later ? If so I\nwould make the message less specific already and just mention that AWB\nwill not work optimally.\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> +\telse\n> +\t\tgains_ = gains;\n> +\n> +\treturn 0;\n> +}\n> +\n>  /**\n>   * \\copydoc libcamera::ipa::Algorithm::configure\n>   */\n> diff --git a/src/ipa/rkisp1/algorithms/awb.h b/src/ipa/rkisp1/algorithms/awb.h\n> index 06c92896e2dc..a010e6d1cb3c 100644\n> --- a/src/ipa/rkisp1/algorithms/awb.h\n> +++ b/src/ipa/rkisp1/algorithms/awb.h\n> @@ -7,6 +7,10 @@\n>  \n>  #pragma once\n>  \n> +#include <optional>\n> +\n> +#include \"libipa/matrix_interpolator.h\"\n> +\n>  #include \"algorithm.h\"\n>  \n>  namespace libcamera {\n> @@ -19,6 +23,7 @@ public:\n>  \tAwb();\n>  \t~Awb() = default;\n>  \n> +\tint init(IPAContext &context, const YamlObject &tuningData) override;\n>  \tint configure(IPAContext &context, const IPACameraSensorInfo &configInfo) override;\n>  \tvoid queueRequest(IPAContext &context, const uint32_t frame,\n>  \t\t\t  IPAFrameContext &frameContext,\n> @@ -34,6 +39,7 @@ public:\n>  private:\n>  \tuint32_t estimateCCT(double red, double green, double blue);\n>  \n> +\tstd::optional<MatrixInterpolator<double, 2, 1>> gains_;\n>  \tbool rgbMode_;\n>  };\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 1C81BC323E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 30 Aug 2024 00:09:59 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id E99B563458;\n\tFri, 30 Aug 2024 02:09:57 +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 E5B9A6002E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 30 Aug 2024 02:09:56 +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 C28E7524;\n\tFri, 30 Aug 2024 02:08:47 +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=\"eeD+S74a\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1724976528;\n\tbh=MVufntkDG3m5k2NsZsFZRPavkUgvZMQR/20Kckciplk=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=eeD+S74azl520O+ZZox/Toly7CawaiJOw4m7DGcdDBj7oxbVe7R7fiLNp/zZT63YU\n\tv0WwFIMkAewNu85LQ+RdwQd0Da9ciKHIvIO5eQ6STNSatBKb+ssedPJJExq3Bfs3ue\n\t/g8Mwyk0f7HIrutNBp5Z5k7L20ppqmCfeOxgUF+A=","Date":"Fri, 30 Aug 2024 03:09:25 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Stefan Klug <stefan.klug@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org,\n\tKieran Bingham <kieran.bingham@ideasonboard.com>","Subject":"Re: [PATCH v4 2/6] ipa: rkisp1: awb: Load white balance gains from\n\ttuning file","Message-ID":"<20240830000925.GB25163@pendragon.ideasonboard.com>","References":"<20240813084451.44099-1-stefan.klug@ideasonboard.com>\n\t<20240813084451.44099-3-stefan.klug@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20240813084451.44099-3-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":30979,"web_url":"https://patchwork.libcamera.org/comment/30979/","msgid":"<5edshld4sxswkodxa77i7nvcun6oarphe7scq4mtcv2cz5ey6p@anxehgzomzs2>","date":"2024-08-30T07:20:05","subject":"Re: [PATCH v4 2/6] ipa: rkisp1: awb: Load white balance gains from\n\ttuning file","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 patch. \n\nOn Fri, Aug 30, 2024 at 03:09:25AM +0300, Laurent Pinchart wrote:\n> Hi Stefan,\n> \n> Thank you for the patch.\n> \n> On Tue, Aug 13, 2024 at 10:44:19AM +0200, Stefan Klug wrote:\n> > For the implementation of a manual colour temperature setting, it is\n> > necessary to read predefined colour gains per colour temperature from\n> > the tuning file. Implement this in a backwards compatible way. If no\n> > gains are contained in the tuning file, loading just continues as\n> > before.\n> > \n> > Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\n> > Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> > ---\n> >  src/ipa/rkisp1/algorithms/awb.cpp | 18 ++++++++++++++++++\n> >  src/ipa/rkisp1/algorithms/awb.h   |  6 ++++++\n> >  2 files changed, 24 insertions(+)\n> > \n> > diff --git a/src/ipa/rkisp1/algorithms/awb.cpp b/src/ipa/rkisp1/algorithms/awb.cpp\n> > index 4ccafd48dedd..c23f749c192b 100644\n> > --- a/src/ipa/rkisp1/algorithms/awb.cpp\n> > +++ b/src/ipa/rkisp1/algorithms/awb.cpp\n> > @@ -39,6 +39,24 @@ Awb::Awb()\n> >  {\n> >  }\n> >  \n> > +/**\n> > + * \\copydoc libcamera::ipa::Algorithm::init\n> > + */\n> > +int Awb::init([[maybe_unused]] IPAContext &context, const YamlObject &tuningData)\n> > +{\n> > +\tMatrixInterpolator<double, 2, 1> gains;\n> > +\tint ret = gains.readYaml(tuningData[\"gains\"], \"ct\", \"gains\");\n> > +\tif (ret < 0)\n> > +\t\tLOG(RkISP1Awb, Warning)\n> > +\t\t\t<< \"Failed to parse 'gains' \"\n> > +\t\t\t<< \"parameter from tuning file; \"\n> > +\t\t\t<< \"rgb gains will not be set based on colour temperature\";\n> \n> Do you expect we will do more with the tuning parameters later ? If so I\n> would make the message less specific already and just mention that AWB\n> will not work optimally.\n\nI really don't know atm. And the current gray world model works well\nwithout the gains, so I'd prefer to be specific if that's ok for you.\nMaybe \"manual color temperature will not work properly\"?\n\n> \n> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> \n\nThanks.\nStefan\n\n> > +\telse\n> > +\t\tgains_ = gains;\n> > +\n> > +\treturn 0;\n> > +}\n> > +\n> >  /**\n> >   * \\copydoc libcamera::ipa::Algorithm::configure\n> >   */\n> > diff --git a/src/ipa/rkisp1/algorithms/awb.h b/src/ipa/rkisp1/algorithms/awb.h\n> > index 06c92896e2dc..a010e6d1cb3c 100644\n> > --- a/src/ipa/rkisp1/algorithms/awb.h\n> > +++ b/src/ipa/rkisp1/algorithms/awb.h\n> > @@ -7,6 +7,10 @@\n> >  \n> >  #pragma once\n> >  \n> > +#include <optional>\n> > +\n> > +#include \"libipa/matrix_interpolator.h\"\n> > +\n> >  #include \"algorithm.h\"\n> >  \n> >  namespace libcamera {\n> > @@ -19,6 +23,7 @@ public:\n> >  \tAwb();\n> >  \t~Awb() = default;\n> >  \n> > +\tint init(IPAContext &context, const YamlObject &tuningData) override;\n> >  \tint configure(IPAContext &context, const IPACameraSensorInfo &configInfo) override;\n> >  \tvoid queueRequest(IPAContext &context, const uint32_t frame,\n> >  \t\t\t  IPAFrameContext &frameContext,\n> > @@ -34,6 +39,7 @@ public:\n> >  private:\n> >  \tuint32_t estimateCCT(double red, double green, double blue);\n> >  \n> > +\tstd::optional<MatrixInterpolator<double, 2, 1>> gains_;\n> >  \tbool rgbMode_;\n> >  };\n> >  \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 29864C323E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 30 Aug 2024 07:20:12 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id D1DAE63466;\n\tFri, 30 Aug 2024 09:20:10 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id CEC9A633CD\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 30 Aug 2024 09:20:08 +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 B9F2F227;\n\tFri, 30 Aug 2024 09:18:59 +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=\"oTi2Hxvo\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1725002339;\n\tbh=4bc3di0T36yulo1OD7NdBQ5h/KtGzjvlrspl4FZCdK4=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=oTi2Hxvo6mQxxPuukJzoiu5PhQhzLXhnE9Zy1l4mvbA2wXTj2TvX3K6oWlpWwwbUc\n\tRGWD9WDTB+mLi4khcGvlK820padGWkbmSHMCpRM+K19sddJ42eC9S11sT3ldhCX8LY\n\tEPCyjUFpB5/Zkc5pQYKQC2mm84+jWdnyx1g2p1OM=","Date":"Fri, 30 Aug 2024 09:20:05 +0200","From":"Stefan Klug <stefan.klug@ideasonboard.com>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org, \n\tKieran Bingham <kieran.bingham@ideasonboard.com>","Subject":"Re: [PATCH v4 2/6] ipa: rkisp1: awb: Load white balance gains from\n\ttuning file","Message-ID":"<5edshld4sxswkodxa77i7nvcun6oarphe7scq4mtcv2cz5ey6p@anxehgzomzs2>","References":"<20240813084451.44099-1-stefan.klug@ideasonboard.com>\n\t<20240813084451.44099-3-stefan.klug@ideasonboard.com>\n\t<20240830000925.GB25163@pendragon.ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20240830000925.GB25163@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>"}},{"id":30983,"web_url":"https://patchwork.libcamera.org/comment/30983/","msgid":"<20240830092651.GF25163@pendragon.ideasonboard.com>","date":"2024-08-30T09:26:51","subject":"Re: [PATCH v4 2/6] ipa: rkisp1: awb: Load white balance gains from\n\ttuning file","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"On Fri, Aug 30, 2024 at 09:20:05AM +0200, Stefan Klug wrote:\n> Hi Laurent,\n> \n> Thank you for the patch. \n\nDid I send one ? :-)\n\n> On Fri, Aug 30, 2024 at 03:09:25AM +0300, Laurent Pinchart wrote:\n> > On Tue, Aug 13, 2024 at 10:44:19AM +0200, Stefan Klug wrote:\n> > > For the implementation of a manual colour temperature setting, it is\n> > > necessary to read predefined colour gains per colour temperature from\n> > > the tuning file. Implement this in a backwards compatible way. If no\n> > > gains are contained in the tuning file, loading just continues as\n> > > before.\n> > > \n> > > Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\n> > > Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> > > ---\n> > >  src/ipa/rkisp1/algorithms/awb.cpp | 18 ++++++++++++++++++\n> > >  src/ipa/rkisp1/algorithms/awb.h   |  6 ++++++\n> > >  2 files changed, 24 insertions(+)\n> > > \n> > > diff --git a/src/ipa/rkisp1/algorithms/awb.cpp b/src/ipa/rkisp1/algorithms/awb.cpp\n> > > index 4ccafd48dedd..c23f749c192b 100644\n> > > --- a/src/ipa/rkisp1/algorithms/awb.cpp\n> > > +++ b/src/ipa/rkisp1/algorithms/awb.cpp\n> > > @@ -39,6 +39,24 @@ Awb::Awb()\n> > >  {\n> > >  }\n> > >  \n> > > +/**\n> > > + * \\copydoc libcamera::ipa::Algorithm::init\n> > > + */\n> > > +int Awb::init([[maybe_unused]] IPAContext &context, const YamlObject &tuningData)\n> > > +{\n> > > +\tMatrixInterpolator<double, 2, 1> gains;\n> > > +\tint ret = gains.readYaml(tuningData[\"gains\"], \"ct\", \"gains\");\n> > > +\tif (ret < 0)\n> > > +\t\tLOG(RkISP1Awb, Warning)\n> > > +\t\t\t<< \"Failed to parse 'gains' \"\n> > > +\t\t\t<< \"parameter from tuning file; \"\n> > > +\t\t\t<< \"rgb gains will not be set based on colour temperature\";\n> > \n> > Do you expect we will do more with the tuning parameters later ? If so I\n> > would make the message less specific already and just mention that AWB\n> > will not work optimally.\n> \n> I really don't know atm. And the current gray world model works well\n> without the gains, so I'd prefer to be specific if that's ok for you.\n> Maybe \"manual color temperature will not work properly\"?\n\nI like that a bit more yes.\n\n> > Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> \n> > > +\telse\n> > > +\t\tgains_ = gains;\n> > > +\n> > > +\treturn 0;\n> > > +}\n> > > +\n> > >  /**\n> > >   * \\copydoc libcamera::ipa::Algorithm::configure\n> > >   */\n> > > diff --git a/src/ipa/rkisp1/algorithms/awb.h b/src/ipa/rkisp1/algorithms/awb.h\n> > > index 06c92896e2dc..a010e6d1cb3c 100644\n> > > --- a/src/ipa/rkisp1/algorithms/awb.h\n> > > +++ b/src/ipa/rkisp1/algorithms/awb.h\n> > > @@ -7,6 +7,10 @@\n> > >  \n> > >  #pragma once\n> > >  \n> > > +#include <optional>\n> > > +\n> > > +#include \"libipa/matrix_interpolator.h\"\n> > > +\n> > >  #include \"algorithm.h\"\n> > >  \n> > >  namespace libcamera {\n> > > @@ -19,6 +23,7 @@ public:\n> > >  \tAwb();\n> > >  \t~Awb() = default;\n> > >  \n> > > +\tint init(IPAContext &context, const YamlObject &tuningData) override;\n> > >  \tint configure(IPAContext &context, const IPACameraSensorInfo &configInfo) override;\n> > >  \tvoid queueRequest(IPAContext &context, const uint32_t frame,\n> > >  \t\t\t  IPAFrameContext &frameContext,\n> > > @@ -34,6 +39,7 @@ public:\n> > >  private:\n> > >  \tuint32_t estimateCCT(double red, double green, double blue);\n> > >  \n> > > +\tstd::optional<MatrixInterpolator<double, 2, 1>> gains_;\n> > >  \tbool rgbMode_;\n> > >  };\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 73C44C323E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 30 Aug 2024 09:27:24 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 45A9463466;\n\tFri, 30 Aug 2024 11:27:23 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 7B6D1633CD\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 30 Aug 2024 11:27:21 +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 481E8229;\n\tFri, 30 Aug 2024 11:26:12 +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=\"MkoDWH8s\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1725009972;\n\tbh=8LGMiOvz09GDj2GmG82yKV+cXJ7jHYLMrX55GAcXRsQ=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=MkoDWH8sl1adPAu+g4Bw1L/grpG/CJ1qIZ2cSWMH9uYifftZVcUdga4InBBZ1+14F\n\taFRIZ13qntRW2Dauo4ngbb1dkGqZKFB1+sTS0yHPc01YCP8wHq2R450TlZ6x1mvRW9\n\tv2/kHnTKTw6PsjvT1zpDOA4TvMRT0hdtbnlZIwSk=","Date":"Fri, 30 Aug 2024 12:26:51 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Stefan Klug <stefan.klug@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org,\n\tKieran Bingham <kieran.bingham@ideasonboard.com>","Subject":"Re: [PATCH v4 2/6] ipa: rkisp1: awb: Load white balance gains from\n\ttuning file","Message-ID":"<20240830092651.GF25163@pendragon.ideasonboard.com>","References":"<20240813084451.44099-1-stefan.klug@ideasonboard.com>\n\t<20240813084451.44099-3-stefan.klug@ideasonboard.com>\n\t<20240830000925.GB25163@pendragon.ideasonboard.com>\n\t<5edshld4sxswkodxa77i7nvcun6oarphe7scq4mtcv2cz5ey6p@anxehgzomzs2>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<5edshld4sxswkodxa77i7nvcun6oarphe7scq4mtcv2cz5ey6p@anxehgzomzs2>","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":30985,"web_url":"https://patchwork.libcamera.org/comment/30985/","msgid":"<zwib7alktmmbwlvwyllhbuxk7cajm4aeiz5qzgogdkqvrimtpq@ouqqui4dns5j>","date":"2024-08-30T10:04:07","subject":"Re: [PATCH v4 2/6] ipa: rkisp1: awb: Load white balance gains from\n\ttuning file","submitter":{"id":184,"url":"https://patchwork.libcamera.org/api/people/184/","name":"Stefan Klug","email":"stefan.klug@ideasonboard.com"},"content":"On Fri, Aug 30, 2024 at 12:26:51PM +0300, Laurent Pinchart wrote:\n> On Fri, Aug 30, 2024 at 09:20:05AM +0200, Stefan Klug wrote:\n> > Hi Laurent,\n> > \n> > Thank you for the patch. \n> \n> Did I send one ? :-)\n\nOuch wrong shortcut. Same for the next answers :-/\n\n> \n> > On Fri, Aug 30, 2024 at 03:09:25AM +0300, Laurent Pinchart wrote:\n> > > On Tue, Aug 13, 2024 at 10:44:19AM +0200, Stefan Klug wrote:\n> > > > For the implementation of a manual colour temperature setting, it is\n> > > > necessary to read predefined colour gains per colour temperature from\n> > > > the tuning file. Implement this in a backwards compatible way. If no\n> > > > gains are contained in the tuning file, loading just continues as\n> > > > before.\n> > > > \n> > > > Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\n> > > > Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> > > > ---\n> > > >  src/ipa/rkisp1/algorithms/awb.cpp | 18 ++++++++++++++++++\n> > > >  src/ipa/rkisp1/algorithms/awb.h   |  6 ++++++\n> > > >  2 files changed, 24 insertions(+)\n> > > > \n> > > > diff --git a/src/ipa/rkisp1/algorithms/awb.cpp b/src/ipa/rkisp1/algorithms/awb.cpp\n> > > > index 4ccafd48dedd..c23f749c192b 100644\n> > > > --- a/src/ipa/rkisp1/algorithms/awb.cpp\n> > > > +++ b/src/ipa/rkisp1/algorithms/awb.cpp\n> > > > @@ -39,6 +39,24 @@ Awb::Awb()\n> > > >  {\n> > > >  }\n> > > >  \n> > > > +/**\n> > > > + * \\copydoc libcamera::ipa::Algorithm::init\n> > > > + */\n> > > > +int Awb::init([[maybe_unused]] IPAContext &context, const YamlObject &tuningData)\n> > > > +{\n> > > > +\tMatrixInterpolator<double, 2, 1> gains;\n> > > > +\tint ret = gains.readYaml(tuningData[\"gains\"], \"ct\", \"gains\");\n> > > > +\tif (ret < 0)\n> > > > +\t\tLOG(RkISP1Awb, Warning)\n> > > > +\t\t\t<< \"Failed to parse 'gains' \"\n> > > > +\t\t\t<< \"parameter from tuning file; \"\n> > > > +\t\t\t<< \"rgb gains will not be set based on colour temperature\";\n> > > \n> > > Do you expect we will do more with the tuning parameters later ? If so I\n> > > would make the message less specific already and just mention that AWB\n> > > will not work optimally.\n> > \n> > I really don't know atm. And the current gray world model works well\n> > without the gains, so I'd prefer to be specific if that's ok for you.\n> > Maybe \"manual color temperature will not work properly\"?\n> \n> I like that a bit more yes.\n> \n> > > Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> > \n> > > > +\telse\n> > > > +\t\tgains_ = gains;\n> > > > +\n> > > > +\treturn 0;\n> > > > +}\n> > > > +\n> > > >  /**\n> > > >   * \\copydoc libcamera::ipa::Algorithm::configure\n> > > >   */\n> > > > diff --git a/src/ipa/rkisp1/algorithms/awb.h b/src/ipa/rkisp1/algorithms/awb.h\n> > > > index 06c92896e2dc..a010e6d1cb3c 100644\n> > > > --- a/src/ipa/rkisp1/algorithms/awb.h\n> > > > +++ b/src/ipa/rkisp1/algorithms/awb.h\n> > > > @@ -7,6 +7,10 @@\n> > > >  \n> > > >  #pragma once\n> > > >  \n> > > > +#include <optional>\n> > > > +\n> > > > +#include \"libipa/matrix_interpolator.h\"\n> > > > +\n> > > >  #include \"algorithm.h\"\n> > > >  \n> > > >  namespace libcamera {\n> > > > @@ -19,6 +23,7 @@ public:\n> > > >  \tAwb();\n> > > >  \t~Awb() = default;\n> > > >  \n> > > > +\tint init(IPAContext &context, const YamlObject &tuningData) override;\n> > > >  \tint configure(IPAContext &context, const IPACameraSensorInfo &configInfo) override;\n> > > >  \tvoid queueRequest(IPAContext &context, const uint32_t frame,\n> > > >  \t\t\t  IPAFrameContext &frameContext,\n> > > > @@ -34,6 +39,7 @@ public:\n> > > >  private:\n> > > >  \tuint32_t estimateCCT(double red, double green, double blue);\n> > > >  \n> > > > +\tstd::optional<MatrixInterpolator<double, 2, 1>> gains_;\n> > > >  \tbool rgbMode_;\n> > > >  };\n> > > >  \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 86DFCC323E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 30 Aug 2024 10:04:12 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 955D863466;\n\tFri, 30 Aug 2024 12:04:11 +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 D429C61E4A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 30 Aug 2024 12:04:10 +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 93ADE512;\n\tFri, 30 Aug 2024 12:03:01 +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=\"iTsiDSaU\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1725012181;\n\tbh=hfeMnNcqXEUkKirgoiU6xsZbtqikK3hjoclhLo0SX0k=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=iTsiDSaUFe+f16cAZ7WgMftq8qObw2V7qfbePXB71sBuA9CempPEUNk1Xx63tPyqJ\n\thx/dW1kY0u3GTl9+U0jR7kNMR6Hy2fIRxoR69y6FGXluZ+Eum0NHNis/nXIhHEnvVY\n\t/IQc/c0klhqwzLHfwcUSW3VonBVzz6NMxDhuiLAA=","Date":"Fri, 30 Aug 2024 12:04:07 +0200","From":"Stefan Klug <stefan.klug@ideasonboard.com>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org, \n\tKieran Bingham <kieran.bingham@ideasonboard.com>","Subject":"Re: [PATCH v4 2/6] ipa: rkisp1: awb: Load white balance gains from\n\ttuning file","Message-ID":"<zwib7alktmmbwlvwyllhbuxk7cajm4aeiz5qzgogdkqvrimtpq@ouqqui4dns5j>","References":"<20240813084451.44099-1-stefan.klug@ideasonboard.com>\n\t<20240813084451.44099-3-stefan.klug@ideasonboard.com>\n\t<20240830000925.GB25163@pendragon.ideasonboard.com>\n\t<5edshld4sxswkodxa77i7nvcun6oarphe7scq4mtcv2cz5ey6p@anxehgzomzs2>\n\t<20240830092651.GF25163@pendragon.ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20240830092651.GF25163@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>"}}]