[{"id":30934,"web_url":"https://patchwork.libcamera.org/comment/30934/","msgid":"<Zs7P8oik2APnwXB4@pyrite.rasen.tech>","date":"2024-08-28T07:21:22","subject":"Re: [PATCH v4 5/6] libtuning: Add initial AWB module","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:22AM +0200, Stefan Klug wrote:\n> This AWB modules uses the awb function from Raspberry Pi to calculate\n> the needed white balance gains per colour temperature. It stores these\n> gains in the tuning file. Currently they are only used for the manual\n> colour temperature control. It is likely that they will be used with\n> more complex awb algorithms.\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>  .../tuning/libtuning/modules/awb/__init__.py  |  6 +++\n>  utils/tuning/libtuning/modules/awb/awb.py     | 42 +++++++++++++++++++\n>  utils/tuning/libtuning/modules/awb/rkisp1.py  | 27 ++++++++++++\n>  3 files changed, 75 insertions(+)\n>  create mode 100644 utils/tuning/libtuning/modules/awb/__init__.py\n>  create mode 100644 utils/tuning/libtuning/modules/awb/awb.py\n>  create mode 100644 utils/tuning/libtuning/modules/awb/rkisp1.py\n> \n> diff --git a/utils/tuning/libtuning/modules/awb/__init__.py b/utils/tuning/libtuning/modules/awb/__init__.py\n> new file mode 100644\n> index 000000000000..2d67f10cfc4f\n> --- /dev/null\n> +++ b/utils/tuning/libtuning/modules/awb/__init__.py\n> @@ -0,0 +1,6 @@\n> +# SPDX-License-Identifier: GPL-2.0-or-later\n> +#\n> +# Copyright (C) 2024, Ideas On Board\n> +\n> +from libtuning.modules.awb.awb import AWB\n> +from libtuning.modules.awb.rkisp1 import AWBRkISP1\n> diff --git a/utils/tuning/libtuning/modules/awb/awb.py b/utils/tuning/libtuning/modules/awb/awb.py\n> new file mode 100644\n> index 000000000000..5680a44fd3e3\n> --- /dev/null\n> +++ b/utils/tuning/libtuning/modules/awb/awb.py\n> @@ -0,0 +1,42 @@\n> +# SPDX-License-Identifier: GPL-2.0-or-later\n> +#\n> +# Copyright (C) 2024, Ideas On Board\n> +\n> +import logging\n> +\n> +from ..module import Module\n> +\n> +from libtuning.ctt_awb import awb\n> +import numpy as np\n> +\n> +logger = logging.getLogger(__name__)\n> +\n> +\n> +class AWB(Module):\n> +    type = 'awb'\n> +    hr_name = 'AWB (Base)'\n> +    out_name = 'GenericAWB'\n> +\n> +    def __init__(self, *,\n> +                 debug: list):\n> +        super().__init__()\n> +\n> +        self.debug = debug\n> +\n> +    def do_calculation(self, images):\n> +        logger.info('Starting AWB calculation')\n> +\n> +        imgs = [img for img in images if img.macbeth is not None]\n> +\n> +        gains, _, _ = awb(imgs, None, None, False)\n> +        gains = np.array(gains)\n> +        gains = gains.reshape(-1, 3)\n> +\n> +        res = []\n> +        for v in gains:\n> +            res.append({\n> +                'ct': int(v[0]),\n> +                'gains': [float(1.0 / v[1]), float(1.0 / v[2])]\n> +            })\n> +\n> +        return res\n> diff --git a/utils/tuning/libtuning/modules/awb/rkisp1.py b/utils/tuning/libtuning/modules/awb/rkisp1.py\n> new file mode 100644\n> index 000000000000..e3ddeb50c9a1\n> --- /dev/null\n> +++ b/utils/tuning/libtuning/modules/awb/rkisp1.py\n> @@ -0,0 +1,27 @@\n> +# SPDX-License-Identifier: GPL-2.0-or-later\n> +#\n> +# Copyright (C) 2024, Ideas On Board\n> +#\n> +# AWB module for tuning rkisp1\n> +\n> +from .awb import AWB\n> +\n> +import libtuning as lt\n> +\n> +\n> +class AWBRkISP1(AWB):\n> +    hr_name = 'AWB (RkISP1)'\n> +    out_name = 'Awb'\n> +\n> +    def __init__(self, **kwargs):\n> +        super().__init__(**kwargs)\n> +\n> +    def validate_config(self, config: dict) -> bool:\n> +        return True\n> +\n> +    def process(self, config: dict, images: list, outputs: dict) -> dict:\n> +        output = {}\n> +\n> +        output['gains'] = self.do_calculation(images)\n> +\n> +        return output\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 7D572C324C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 28 Aug 2024 07:21:32 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 7A17763466;\n\tWed, 28 Aug 2024 09:21:31 +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 ECDB76345D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 28 Aug 2024 09:21:29 +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 21F297E4;\n\tWed, 28 Aug 2024 09:20:20 +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=\"JhTv3od4\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1724829622;\n\tbh=CAN0w+fpzZ+76hK0l+tP94Y/Jr3+SS0gzIT60aQSRNI=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=JhTv3od4Oe6FVf9UGS3oIEsm+P5DyMpcbj+BUKZhOOTwO+uVenuW+GOFclbtO4uoN\n\tslT/j1wa1mUXsnNn5inV8O0dPgJpefI2NWSREkb6GNh260vP5y5MaZH2+ftlYVjqV9\n\tJQzkMzFyPJDIvvhpTaPiBSZtI++wJOkYO5GWt8Rk=","Date":"Wed, 28 Aug 2024 16:21:22 +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 5/6] libtuning: Add initial AWB module","Message-ID":"<Zs7P8oik2APnwXB4@pyrite.rasen.tech>","References":"<20240813084451.44099-1-stefan.klug@ideasonboard.com>\n\t<20240813084451.44099-6-stefan.klug@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","In-Reply-To":"<20240813084451.44099-6-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":30973,"web_url":"https://patchwork.libcamera.org/comment/30973/","msgid":"<20240829233115.GB26181@pendragon.ideasonboard.com>","date":"2024-08-29T23:31:15","subject":"Re: [PATCH v4 5/6] libtuning: Add initial AWB module","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:22AM +0200, Stefan Klug wrote:\n> This AWB modules uses the awb function from Raspberry Pi to calculate\n\ns/modules/module/\n\n> the needed white balance gains per colour temperature. It stores these\n> gains in the tuning file. Currently they are only used for the manual\n> colour temperature control. It is likely that they will be used with\n> more complex awb algorithms.\n\nI would drop the last two sentences as they are not relevant to the\ntuning tool (unless I'm missing something).\n\n> \n> Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\n> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> ---\n>  .../tuning/libtuning/modules/awb/__init__.py  |  6 +++\n>  utils/tuning/libtuning/modules/awb/awb.py     | 42 +++++++++++++++++++\n>  utils/tuning/libtuning/modules/awb/rkisp1.py  | 27 ++++++++++++\n>  3 files changed, 75 insertions(+)\n>  create mode 100644 utils/tuning/libtuning/modules/awb/__init__.py\n>  create mode 100644 utils/tuning/libtuning/modules/awb/awb.py\n>  create mode 100644 utils/tuning/libtuning/modules/awb/rkisp1.py\n> \n> diff --git a/utils/tuning/libtuning/modules/awb/__init__.py b/utils/tuning/libtuning/modules/awb/__init__.py\n> new file mode 100644\n> index 000000000000..2d67f10cfc4f\n> --- /dev/null\n> +++ b/utils/tuning/libtuning/modules/awb/__init__.py\n> @@ -0,0 +1,6 @@\n> +# SPDX-License-Identifier: GPL-2.0-or-later\n> +#\n> +# Copyright (C) 2024, Ideas On Board\n> +\n> +from libtuning.modules.awb.awb import AWB\n> +from libtuning.modules.awb.rkisp1 import AWBRkISP1\n> diff --git a/utils/tuning/libtuning/modules/awb/awb.py b/utils/tuning/libtuning/modules/awb/awb.py\n> new file mode 100644\n> index 000000000000..5680a44fd3e3\n> --- /dev/null\n> +++ b/utils/tuning/libtuning/modules/awb/awb.py\n> @@ -0,0 +1,42 @@\n> +# SPDX-License-Identifier: GPL-2.0-or-later\n> +#\n> +# Copyright (C) 2024, Ideas On Board\n> +\n> +import logging\n> +\n> +from ..module import Module\n> +\n> +from libtuning.ctt_awb import awb\n> +import numpy as np\n> +\n> +logger = logging.getLogger(__name__)\n> +\n> +\n> +class AWB(Module):\n> +    type = 'awb'\n> +    hr_name = 'AWB (Base)'\n> +    out_name = 'GenericAWB'\n> +\n> +    def __init__(self, *,\n> +                 debug: list):\n\nIs the line break necessary ?\n\n> +        super().__init__()\n> +\n> +        self.debug = debug\n> +\n> +    def do_calculation(self, images):\n> +        logger.info('Starting AWB calculation')\n> +\n> +        imgs = [img for img in images if img.macbeth is not None]\n> +\n> +        gains, _, _ = awb(imgs, None, None, False)\n> +        gains = np.array(gains)\n> +        gains = gains.reshape(-1, 3)\n\nDo we really need numpy for this, can you write\n\n        res = []\n        for i in range(len(gains) // 3):\n            res.append({\n                'ct': int(v[i*3]),\n                'gains': [float(1.0 / v[i*3+1]), float(1.0 / v[i*3+2])]\n            })\n\nI suppose numpy may make it clearer, and shouldn't be a performance\nissue... In that case, maybe\n\n        return [{'ct': int(v[0]), 'gains': [float(1.0 / v[1]), float(1.0 / v[2])]} for v in gains]\n\nor maybe that's too long. Up to you.\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> +\n> +        res = []\n> +        for v in gains:\n> +            res.append({\n> +                'ct': int(v[0]),\n> +                'gains': [float(1.0 / v[1]), float(1.0 / v[2])]\n> +            })\n> +\n> +        return res\n> diff --git a/utils/tuning/libtuning/modules/awb/rkisp1.py b/utils/tuning/libtuning/modules/awb/rkisp1.py\n> new file mode 100644\n> index 000000000000..e3ddeb50c9a1\n> --- /dev/null\n> +++ b/utils/tuning/libtuning/modules/awb/rkisp1.py\n> @@ -0,0 +1,27 @@\n> +# SPDX-License-Identifier: GPL-2.0-or-later\n> +#\n> +# Copyright (C) 2024, Ideas On Board\n> +#\n> +# AWB module for tuning rkisp1\n> +\n> +from .awb import AWB\n> +\n> +import libtuning as lt\n> +\n> +\n> +class AWBRkISP1(AWB):\n> +    hr_name = 'AWB (RkISP1)'\n> +    out_name = 'Awb'\n> +\n> +    def __init__(self, **kwargs):\n> +        super().__init__(**kwargs)\n> +\n> +    def validate_config(self, config: dict) -> bool:\n> +        return True\n> +\n> +    def process(self, config: dict, images: list, outputs: dict) -> dict:\n> +        output = {}\n> +\n> +        output['gains'] = self.do_calculation(images)\n> +\n> +        return output","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 7435AC324C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 29 Aug 2024 23:31:49 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 2F42063458;\n\tFri, 30 Aug 2024 01:31:48 +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 168C96002E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 30 Aug 2024 01:31:46 +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 390C43A2;\n\tFri, 30 Aug 2024 01:30:37 +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=\"juKX+FjT\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1724974237;\n\tbh=08qZwb6fn/WVFrgVY+wP1E3tASpQKTDcGrqqqm+wXRk=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=juKX+FjTofYqKTY2uDqXJ+Av7jiie7sSjacGGuX7DkQPk+8oYZV6lBu1G23o2A304\n\tCdlP2gL7nUS5i4Et99TE/BKY9ITqnP47mMaPQQrD9SJtqOs1I1f7XoQJQOichEeOpv\n\t0r3fPh2aOBmG4xbGchgKU48rniBYBs7Sinr8lrzs=","Date":"Fri, 30 Aug 2024 02:31:15 +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 5/6] libtuning: Add initial AWB module","Message-ID":"<20240829233115.GB26181@pendragon.ideasonboard.com>","References":"<20240813084451.44099-1-stefan.klug@ideasonboard.com>\n\t<20240813084451.44099-6-stefan.klug@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20240813084451.44099-6-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":30980,"web_url":"https://patchwork.libcamera.org/comment/30980/","msgid":"<yuin4fg2fyft5qrfthurxlb6pjx555getu6rx5c4qxpap4nfze@xwpcw6jljyke>","date":"2024-08-30T07:59:38","subject":"Re: [PATCH v4 5/6] libtuning: Add initial AWB module","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 02:31:15AM +0300, Laurent Pinchart wrote:\n> Hi Stefan,\n> \n> Thank you for the patch.\n> \n> On Tue, Aug 13, 2024 at 10:44:22AM +0200, Stefan Klug wrote:\n> > This AWB modules uses the awb function from Raspberry Pi to calculate\n> \n> s/modules/module/\n> \n> > the needed white balance gains per colour temperature. It stores these\n> > gains in the tuning file. Currently they are only used for the manual\n> > colour temperature control. It is likely that they will be used with\n> > more complex awb algorithms.\n> \n> I would drop the last two sentences as they are not relevant to the\n> tuning tool (unless I'm missing something).\n> \n> > \n> > Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\n> > Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> > ---\n> >  .../tuning/libtuning/modules/awb/__init__.py  |  6 +++\n> >  utils/tuning/libtuning/modules/awb/awb.py     | 42 +++++++++++++++++++\n> >  utils/tuning/libtuning/modules/awb/rkisp1.py  | 27 ++++++++++++\n> >  3 files changed, 75 insertions(+)\n> >  create mode 100644 utils/tuning/libtuning/modules/awb/__init__.py\n> >  create mode 100644 utils/tuning/libtuning/modules/awb/awb.py\n> >  create mode 100644 utils/tuning/libtuning/modules/awb/rkisp1.py\n> > \n> > diff --git a/utils/tuning/libtuning/modules/awb/__init__.py b/utils/tuning/libtuning/modules/awb/__init__.py\n> > new file mode 100644\n> > index 000000000000..2d67f10cfc4f\n> > --- /dev/null\n> > +++ b/utils/tuning/libtuning/modules/awb/__init__.py\n> > @@ -0,0 +1,6 @@\n> > +# SPDX-License-Identifier: GPL-2.0-or-later\n> > +#\n> > +# Copyright (C) 2024, Ideas On Board\n> > +\n> > +from libtuning.modules.awb.awb import AWB\n> > +from libtuning.modules.awb.rkisp1 import AWBRkISP1\n> > diff --git a/utils/tuning/libtuning/modules/awb/awb.py b/utils/tuning/libtuning/modules/awb/awb.py\n> > new file mode 100644\n> > index 000000000000..5680a44fd3e3\n> > --- /dev/null\n> > +++ b/utils/tuning/libtuning/modules/awb/awb.py\n> > @@ -0,0 +1,42 @@\n> > +# SPDX-License-Identifier: GPL-2.0-or-later\n> > +#\n> > +# Copyright (C) 2024, Ideas On Board\n> > +\n> > +import logging\n> > +\n> > +from ..module import Module\n> > +\n> > +from libtuning.ctt_awb import awb\n> > +import numpy as np\n> > +\n> > +logger = logging.getLogger(__name__)\n> > +\n> > +\n> > +class AWB(Module):\n> > +    type = 'awb'\n> > +    hr_name = 'AWB (Base)'\n> > +    out_name = 'GenericAWB'\n> > +\n> > +    def __init__(self, *,\n> > +                 debug: list):\n> \n> Is the line break necessary ?\n\nNope, that was a copy paste remnant.\n\n> \n> > +        super().__init__()\n> > +\n> > +        self.debug = debug\n> > +\n> > +    def do_calculation(self, images):\n> > +        logger.info('Starting AWB calculation')\n> > +\n> > +        imgs = [img for img in images if img.macbeth is not None]\n> > +\n> > +        gains, _, _ = awb(imgs, None, None, False)\n> > +        gains = np.array(gains)\n> > +        gains = gains.reshape(-1, 3)\n> \n> Do we really need numpy for this, can you write\n> \n>         res = []\n>         for i in range(len(gains) // 3):\n>             res.append({\n>                 'ct': int(v[i*3]),\n>                 'gains': [float(1.0 / v[i*3+1]), float(1.0 / v[i*3+2])]\n>             })\n> \n> I suppose numpy may make it clearer, and shouldn't be a performance\n> issue... In that case, maybe\n> \n>         return [{'ct': int(v[0]), 'gains': [float(1.0 / v[1]), float(1.0 / v[2])]} for v in gains]\n> \n> or maybe that's too long. Up to you.\n\nI like the expressiveness of numpy. I changed it to \n\n        gains = np.reshape(gains, (-1, 3))\n\n        return [{\n                    'ct': int(v[0]),\n                    'gains': [float(1.0 / v[1]), float(1.0 / v[2])]\n                } for v in gains]\n\n\nwhich (to me) is still readable but more compact.\n\n> \n> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\nThanks. \nStefan\n\n> \n> > +\n> > +        res = []\n> > +        for v in gains:\n> > +            res.append({\n> > +                'ct': int(v[0]),\n> > +                'gains': [float(1.0 / v[1]), float(1.0 / v[2])]\n> > +            })\n> > +\n> > +        return res\n> > diff --git a/utils/tuning/libtuning/modules/awb/rkisp1.py b/utils/tuning/libtuning/modules/awb/rkisp1.py\n> > new file mode 100644\n> > index 000000000000..e3ddeb50c9a1\n> > --- /dev/null\n> > +++ b/utils/tuning/libtuning/modules/awb/rkisp1.py\n> > @@ -0,0 +1,27 @@\n> > +# SPDX-License-Identifier: GPL-2.0-or-later\n> > +#\n> > +# Copyright (C) 2024, Ideas On Board\n> > +#\n> > +# AWB module for tuning rkisp1\n> > +\n> > +from .awb import AWB\n> > +\n> > +import libtuning as lt\n> > +\n> > +\n> > +class AWBRkISP1(AWB):\n> > +    hr_name = 'AWB (RkISP1)'\n> > +    out_name = 'Awb'\n> > +\n> > +    def __init__(self, **kwargs):\n> > +        super().__init__(**kwargs)\n> > +\n> > +    def validate_config(self, config: dict) -> bool:\n> > +        return True\n> > +\n> > +    def process(self, config: dict, images: list, outputs: dict) -> dict:\n> > +        output = {}\n> > +\n> > +        output['gains'] = self.do_calculation(images)\n> > +\n> > +        return output\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 2F25BC323E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 30 Aug 2024 07:59:44 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id CCF1B63466;\n\tFri, 30 Aug 2024 09:59:42 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id CEB2B633CD\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 30 Aug 2024 09:59:41 +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 B6E08227;\n\tFri, 30 Aug 2024 09:58:32 +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=\"OZ1+WDHo\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1725004712;\n\tbh=ni2RdTL380Ei1IC8DUQFElAsZonKPFpRM7dGUkStPxE=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=OZ1+WDHoSSDO4YwMNWD/nRbnfqs728Q8Ss1GFSGcZvlHK16vzd6QJSypSBGkOl15R\n\tseWXLCV8C2A8+inpMxFteoytIJdHNFPZ7b9W/sW86IZAW2bpkoI7a/vMbmJhbgoFWK\n\tdnir17zWxlOz9daQa6kqugEqrqhlKEHLPBfVYRwk=","Date":"Fri, 30 Aug 2024 09:59:38 +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 5/6] libtuning: Add initial AWB module","Message-ID":"<yuin4fg2fyft5qrfthurxlb6pjx555getu6rx5c4qxpap4nfze@xwpcw6jljyke>","References":"<20240813084451.44099-1-stefan.klug@ideasonboard.com>\n\t<20240813084451.44099-6-stefan.klug@ideasonboard.com>\n\t<20240829233115.GB26181@pendragon.ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20240829233115.GB26181@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>"}}]