[{"id":30749,"web_url":"https://patchwork.libcamera.org/comment/30749/","msgid":"<2b2b4a57-b22d-4c55-b632-76d4a81cfe3d@ideasonboard.com>","date":"2024-08-12T13:15:29","subject":"Re: [PATCH v3 08/23] libcamera: software_isp: Define skeletons for\n\tIPA refactoring","submitter":{"id":156,"url":"https://patchwork.libcamera.org/api/people/156/","name":"Dan Scally","email":"dan.scally@ideasonboard.com"},"content":"Hi Milan, what a cool set - thanks - I think it's great to move the Software ISP to the same model \nas the other IPAs.\n\nOn 17/07/2024 09:54, Milan Zamazal wrote:\n> Software ISP image processing algorithms are currently defined in a\n> simplified way, different from other libcamera pipelines.  This is not\n> good for several reasons:\n>\n> - It makes the software ISP code harder to understand due to its\n>    different structuring.\n> - Adding more algorithms may make the code harder to understand\n>    generally.\n> - Mass libcamera code changes may not be easily applicable to software\n>    ISP.\n> - Algorithm sharing with other pipelines is not easily possible.\n>\n> This patch introduces basic software ISP IPA skeletons structured\n> similarly to the other pipelines.  The newly added files are currently\n> not used or compiled and the general skeleton structures don't contain\n> anything particular.  It is just a preparation step for a larger\n> refactoring and the code will be actually used and extended as needed in\n> followup patches.\n>\n> Signed-off-by: Milan Zamazal <mzamazal@redhat.com>\n> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>\n> ---\n>   src/ipa/simple/algorithms/algorithm.h | 22 +++++++++++\n>   src/ipa/simple/ipa_context.cpp        | 53 +++++++++++++++++++++++++++\n>   src/ipa/simple/ipa_context.h          | 34 +++++++++++++++++\n>   src/ipa/simple/meson.build            |  1 +\n>   src/ipa/simple/module.h               | 28 ++++++++++++++\n>   5 files changed, 138 insertions(+)\n>   create mode 100644 src/ipa/simple/algorithms/algorithm.h\n>   create mode 100644 src/ipa/simple/ipa_context.cpp\n>   create mode 100644 src/ipa/simple/ipa_context.h\n>   create mode 100644 src/ipa/simple/module.h\n>\n> diff --git a/src/ipa/simple/algorithms/algorithm.h b/src/ipa/simple/algorithms/algorithm.h\n> new file mode 100644\n> index 00000000..41f63170\n> --- /dev/null\n> +++ b/src/ipa/simple/algorithms/algorithm.h\n> @@ -0,0 +1,22 @@\n> +/* SPDX-License-Identifier: LGPL-2.1-or-later */\n> +/*\n> + * Copyright (C) 2024 Red Hat, Inc.\n> + *\n> + * Software ISP control algorithm interface\n> + */\n> +\n> +#pragma once\n> +\n> +#include <libipa/algorithm.h>\n> +\n> +#include \"module.h\"\n> +\n> +namespace libcamera {\n> +\n> +namespace ipa::soft {\n> +\n> +using Algorithm = libcamera::ipa::Algorithm<Module>;\n> +\n> +} /* namespace ipa::soft */\n> +\n> +} /* namespace libcamera */\n> diff --git a/src/ipa/simple/ipa_context.cpp b/src/ipa/simple/ipa_context.cpp\n> new file mode 100644\n> index 00000000..3c1c7262\n> --- /dev/null\n> +++ b/src/ipa/simple/ipa_context.cpp\n> @@ -0,0 +1,53 @@\n> +/* SPDX-License-Identifier: LGPL-2.1-or-later */\n> +/*\n> + * Copyright (C) 2021, Google Inc.\n> + * Copyright (C) 2024 Red Hat Inc.\n> + *\n> + * Software ISP IPA Context\n> + */\n> +\n> +#include \"ipa_context.h\"\n> +\n> +/**\n> + * \\file ipa_context.h\n> + * \\brief Context and state information shared between the algorithms\n> + */\n> +\n> +namespace libcamera::ipa::soft {\n> +\n> +/**\n> + * \\struct IPASessionConfiguration\n> + * \\brief Session configuration for the IPA module\n> + *\n> + * The session configuration contains all IPA configuration parameters that\n> + * remain constant during the capture session, from IPA module start to stop.\n> + * It is typically set during the configure() operation of the IPA module, but\n> + * may also be updated in the start() operation.\n> + */\n> +\n> +/**\n> + * \\struct IPAActiveState\n> + * \\brief The active state of the IPA algorithms\n> + *\n> + * The IPA is fed with the statistics generated from the latest frame processed.\n> + * The statistics are then processed by the IPA algorithms to compute parameters\n> + * required for the next frame capture and processing. The current state of the\n> + * algorithms is reflected through the IPAActiveState to store the values most\n> + * recently computed by the IPA algorithms.\n> + */\n> +\n> +/**\n> + * \\struct IPAContext\n> + * \\brief Global IPA context data shared between all algorithms\n> + *\n> + * \\var IPAContext::configuration\n> + * \\brief The IPA session configuration, immutable during the session\n> + *\n> + * \\var IPAContext::frameContexts\n> + * \\brief Ring buffer of the IPAFrameContext(s)\n> + *\n> + * \\var IPAContext::activeState\n> + * \\brief The current state of IPA algorithms\n> + */\n> +\n> +} /* namespace libcamera::ipa::soft */\n> diff --git a/src/ipa/simple/ipa_context.h b/src/ipa/simple/ipa_context.h\n> new file mode 100644\n> index 00000000..bc1235b6\n> --- /dev/null\n> +++ b/src/ipa/simple/ipa_context.h\n> @@ -0,0 +1,34 @@\n> +/* SPDX-License-Identifier: LGPL-2.1-or-later */\n> +/*\n> + * Copyright (C) 2024 Red Hat, Inc.\n> + *\n> + * Simple pipeline IPA Context\n> + *\n> + */\n> +\n> +#pragma once\n> +\n> +#include <libipa/fc_queue.h>\n> +\n> +namespace libcamera {\n> +\n> +namespace ipa::soft {\n> +\n> +struct IPASessionConfiguration {\n> +};\n> +\n> +struct IPAActiveState {\n> +};\n> +\n> +struct IPAFrameContext : public FrameContext {\n> +};\n> +\n> +struct IPAContext {\n> +\tIPASessionConfiguration configuration;\n> +\tIPAActiveState activeState;\n> +\tFCQueue<IPAFrameContext> frameContexts;\n> +};\n> +\n> +} /* namespace ipa::soft */\n> +\n> +} /* namespace libcamera */\n> diff --git a/src/ipa/simple/meson.build b/src/ipa/simple/meson.build\n> index 33d1c96a..363251fb 100644\n> --- a/src/ipa/simple/meson.build\n> +++ b/src/ipa/simple/meson.build\n> @@ -3,6 +3,7 @@\n>   ipa_name = 'ipa_soft_simple'\n>   \n>   soft_simple_sources = files([\n> +    'ipa_context.cpp',\n>       'soft_simple.cpp',\n>       'black_level.cpp',\n>   ])\n> diff --git a/src/ipa/simple/module.h b/src/ipa/simple/module.h\n> new file mode 100644\n> index 00000000..33a7d1db\n> --- /dev/null\n> +++ b/src/ipa/simple/module.h\n> @@ -0,0 +1,28 @@\n> +/* SPDX-License-Identifier: LGPL-2.1-or-later */\n> +/*\n> + * Copyright (C) 2024 Red Hat, Inc.\n> + *\n> + * Software ISP IPA Module\n> + */\n> +\n> +#pragma once\n> +\n> +#include <libcamera/controls.h>\n> +\n> +#include \"libcamera/internal/software_isp/debayer_params.h\"\n> +#include \"libcamera/internal/software_isp/swisp_stats.h\"\n> +\n> +#include <libipa/module.h>\n> +\n> +#include \"ipa_context.h\"\n> +\n> +namespace libcamera {\n> +\n> +namespace ipa::soft {\n> +\n> +using Module = ipa::Module<IPAContext, IPAFrameContext, ControlInfoMap,\n\nThe ControlInfoMap here rather than some mojom generated struct surprises me a little, but the rest \nis fine and I assume that will become clear later:\n\n\nReviewed-by: Daniel Scally <dan.scally@ideasonboard.com>\n\n> +\t\t\t   DebayerParams, SwIspStats>;\n> +\n> +} /* namespace ipa::soft */\n> +\n> +} /* namespace libcamera */","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 6E12ABE173\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 12 Aug 2024 13:15:34 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 54EC4633BA;\n\tMon, 12 Aug 2024 15:15:33 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 4906763398\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 12 Aug 2024 15:15:32 +0200 (CEST)","from [192.168.0.43]\n\t(cpc141996-chfd3-2-0-cust928.12-3.cable.virginm.net [86.13.91.161])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id D961B7CC\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 12 Aug 2024 15:14:35 +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=\"hMSJfhef\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1723468475;\n\tbh=KZ0q5Fddsp7rcvK0iYWcyBO44TGZLzb0SWku8tzKSs0=;\n\th=Date:Subject:To:References:From:In-Reply-To:From;\n\tb=hMSJfhefrWujW5R625cSKySBxqM+xcY9eKuG1VVYjfpXZ0kIWJ8ssHESAi+1hLCQ5\n\t3OObjq3/dBd5+ls2sf7CELsc4DScWNq2EFSRY6cQtqYSMclbYT0VXx3USaxto8+ClO\n\tURYAqsAVEiLgoJZgZcRWiz7nQfmiMxh+JpZDnbCE=","Message-ID":"<2b2b4a57-b22d-4c55-b632-76d4a81cfe3d@ideasonboard.com>","Date":"Mon, 12 Aug 2024 14:15:29 +0100","MIME-Version":"1.0","User-Agent":"Mozilla Thunderbird","Subject":"Re: [PATCH v3 08/23] libcamera: software_isp: Define skeletons for\n\tIPA refactoring","To":"libcamera-devel@lists.libcamera.org","References":"<20240717085444.289997-1-mzamazal@redhat.com>\n\t<20240717085444.289997-9-mzamazal@redhat.com>","Content-Language":"en-US","From":"Dan Scally <dan.scally@ideasonboard.com>","Autocrypt":"addr=dan.scally@ideasonboard.com; keydata=\n\t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","In-Reply-To":"<20240717085444.289997-9-mzamazal@redhat.com>","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"7bit","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":30765,"web_url":"https://patchwork.libcamera.org/comment/30765/","msgid":"<20240812212738.GD32749@pendragon.ideasonboard.com>","date":"2024-08-12T21:27:38","subject":"Re: [PATCH v3 08/23] libcamera: software_isp: Define skeletons for\n\tIPA refactoring","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"On Mon, Aug 12, 2024 at 02:15:29PM +0100, Daniel Scally wrote:\n> Hi Milan, what a cool set - thanks - I think it's great to move the\n> Software ISP to the same model as the other IPAs.\n> \n> On 17/07/2024 09:54, Milan Zamazal wrote:\n> > Software ISP image processing algorithms are currently defined in a\n> > simplified way, different from other libcamera pipelines.  This is not\n> > good for several reasons:\n> >\n> > - It makes the software ISP code harder to understand due to its\n> >    different structuring.\n> > - Adding more algorithms may make the code harder to understand\n> >    generally.\n> > - Mass libcamera code changes may not be easily applicable to software\n> >    ISP.\n> > - Algorithm sharing with other pipelines is not easily possible.\n> >\n> > This patch introduces basic software ISP IPA skeletons structured\n> > similarly to the other pipelines.  The newly added files are currently\n> > not used or compiled and the general skeleton structures don't contain\n\ns/don't/doesn't/\n\n> > anything particular.  It is just a preparation step for a larger\n> > refactoring and the code will be actually used and extended as needed in\n> > followup patches.\n> >\n> > Signed-off-by: Milan Zamazal <mzamazal@redhat.com>\n> > Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>\n> > ---\n> >   src/ipa/simple/algorithms/algorithm.h | 22 +++++++++++\n> >   src/ipa/simple/ipa_context.cpp        | 53 +++++++++++++++++++++++++++\n> >   src/ipa/simple/ipa_context.h          | 34 +++++++++++++++++\n> >   src/ipa/simple/meson.build            |  1 +\n> >   src/ipa/simple/module.h               | 28 ++++++++++++++\n> >   5 files changed, 138 insertions(+)\n> >   create mode 100644 src/ipa/simple/algorithms/algorithm.h\n> >   create mode 100644 src/ipa/simple/ipa_context.cpp\n> >   create mode 100644 src/ipa/simple/ipa_context.h\n> >   create mode 100644 src/ipa/simple/module.h\n> >\n> > diff --git a/src/ipa/simple/algorithms/algorithm.h b/src/ipa/simple/algorithms/algorithm.h\n> > new file mode 100644\n> > index 00000000..41f63170\n> > --- /dev/null\n> > +++ b/src/ipa/simple/algorithms/algorithm.h\n> > @@ -0,0 +1,22 @@\n> > +/* SPDX-License-Identifier: LGPL-2.1-or-later */\n> > +/*\n> > + * Copyright (C) 2024 Red Hat, Inc.\n> > + *\n> > + * Software ISP control algorithm interface\n> > + */\n> > +\n> > +#pragma once\n> > +\n> > +#include <libipa/algorithm.h>\n> > +\n> > +#include \"module.h\"\n> > +\n> > +namespace libcamera {\n> > +\n> > +namespace ipa::soft {\n> > +\n> > +using Algorithm = libcamera::ipa::Algorithm<Module>;\n> > +\n> > +} /* namespace ipa::soft */\n> > +\n> > +} /* namespace libcamera */\n> > diff --git a/src/ipa/simple/ipa_context.cpp b/src/ipa/simple/ipa_context.cpp\n> > new file mode 100644\n> > index 00000000..3c1c7262\n> > --- /dev/null\n> > +++ b/src/ipa/simple/ipa_context.cpp\n> > @@ -0,0 +1,53 @@\n> > +/* SPDX-License-Identifier: LGPL-2.1-or-later */\n> > +/*\n> > + * Copyright (C) 2021, Google Inc.\n> > + * Copyright (C) 2024 Red Hat Inc.\n> > + *\n> > + * Software ISP IPA Context\n> > + */\n> > +\n> > +#include \"ipa_context.h\"\n> > +\n> > +/**\n> > + * \\file ipa_context.h\n> > + * \\brief Context and state information shared between the algorithms\n> > + */\n> > +\n> > +namespace libcamera::ipa::soft {\n> > +\n> > +/**\n> > + * \\struct IPASessionConfiguration\n> > + * \\brief Session configuration for the IPA module\n> > + *\n> > + * The session configuration contains all IPA configuration parameters that\n> > + * remain constant during the capture session, from IPA module start to stop.\n> > + * It is typically set during the configure() operation of the IPA module, but\n> > + * may also be updated in the start() operation.\n> > + */\n> > +\n> > +/**\n> > + * \\struct IPAActiveState\n> > + * \\brief The active state of the IPA algorithms\n> > + *\n> > + * The IPA is fed with the statistics generated from the latest frame processed.\n> > + * The statistics are then processed by the IPA algorithms to compute parameters\n> > + * required for the next frame capture and processing. The current state of the\n> > + * algorithms is reflected through the IPAActiveState to store the values most\n> > + * recently computed by the IPA algorithms.\n> > + */\n> > +\n> > +/**\n> > + * \\struct IPAContext\n> > + * \\brief Global IPA context data shared between all algorithms\n> > + *\n> > + * \\var IPAContext::configuration\n> > + * \\brief The IPA session configuration, immutable during the session\n> > + *\n> > + * \\var IPAContext::frameContexts\n> > + * \\brief Ring buffer of the IPAFrameContext(s)\n> > + *\n> > + * \\var IPAContext::activeState\n> > + * \\brief The current state of IPA algorithms\n> > + */\n> > +\n> > +} /* namespace libcamera::ipa::soft */\n> > diff --git a/src/ipa/simple/ipa_context.h b/src/ipa/simple/ipa_context.h\n> > new file mode 100644\n> > index 00000000..bc1235b6\n> > --- /dev/null\n> > +++ b/src/ipa/simple/ipa_context.h\n> > @@ -0,0 +1,34 @@\n> > +/* SPDX-License-Identifier: LGPL-2.1-or-later */\n> > +/*\n> > + * Copyright (C) 2024 Red Hat, Inc.\n> > + *\n> > + * Simple pipeline IPA Context\n> > + *\n\nExtra blank line.\n\n> > + */\n> > +\n> > +#pragma once\n> > +\n> > +#include <libipa/fc_queue.h>\n> > +\n> > +namespace libcamera {\n> > +\n> > +namespace ipa::soft {\n> > +\n> > +struct IPASessionConfiguration {\n> > +};\n> > +\n> > +struct IPAActiveState {\n> > +};\n> > +\n> > +struct IPAFrameContext : public FrameContext {\n> > +};\n> > +\n> > +struct IPAContext {\n> > +\tIPASessionConfiguration configuration;\n> > +\tIPAActiveState activeState;\n> > +\tFCQueue<IPAFrameContext> frameContexts;\n> > +};\n> > +\n> > +} /* namespace ipa::soft */\n> > +\n> > +} /* namespace libcamera */\n> > diff --git a/src/ipa/simple/meson.build b/src/ipa/simple/meson.build\n> > index 33d1c96a..363251fb 100644\n> > --- a/src/ipa/simple/meson.build\n> > +++ b/src/ipa/simple/meson.build\n> > @@ -3,6 +3,7 @@\n> >   ipa_name = 'ipa_soft_simple'\n> >   \n> >   soft_simple_sources = files([\n> > +     'ipa_context.cpp',\n> >       'soft_simple.cpp',\n> >       'black_level.cpp',\n> >   ])\n> > diff --git a/src/ipa/simple/module.h b/src/ipa/simple/module.h\n> > new file mode 100644\n> > index 00000000..33a7d1db\n> > --- /dev/null\n> > +++ b/src/ipa/simple/module.h\n> > @@ -0,0 +1,28 @@\n> > +/* SPDX-License-Identifier: LGPL-2.1-or-later */\n> > +/*\n> > + * Copyright (C) 2024 Red Hat, Inc.\n> > + *\n> > + * Software ISP IPA Module\n> > + */\n> > +\n> > +#pragma once\n> > +\n> > +#include <libcamera/controls.h>\n> > +\n> > +#include \"libcamera/internal/software_isp/debayer_params.h\"\n> > +#include \"libcamera/internal/software_isp/swisp_stats.h\"\n> > +\n> > +#include <libipa/module.h>\n> > +\n> > +#include \"ipa_context.h\"\n> > +\n> > +namespace libcamera {\n> > +\n> > +namespace ipa::soft {\n> > +\n> > +using Module = ipa::Module<IPAContext, IPAFrameContext, ControlInfoMap,\n> \n> The ControlInfoMap here rather than some mojom generated struct surprises me a little, but the rest \n> is fine and I assume that will become clear later:\n> \n> \n> Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> > +\t\t\t   DebayerParams, SwIspStats>;\n> > +\n> > +} /* namespace ipa::soft */\n> > +\n> > +} /* namespace libcamera */","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 05E08C323E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 12 Aug 2024 21:28:06 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 435AF633B5;\n\tMon, 12 Aug 2024 23:28:05 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 8CFA863369\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 12 Aug 2024 23:28:03 +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 AE0A1836;\n\tMon, 12 Aug 2024 23:27:06 +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=\"Sddi55Sg\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1723498026;\n\tbh=1LgbtvqH+5cwX2mcvIY0elPbavJIGf4qtMfFX1l+mTw=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=Sddi55SgJExLs8D3gPGEol7rV9wUNY5dmxSFfhxAu+xo7HkWjQm8lFrx8M1/NHGpj\n\twUToFR8NcszS8OR/rtyNZ5h3UJoTjn71FwnGXrOrc3z6VvKt6C07OtpeU3BpEmEMXd\n\tkbaR509Lq1pq5e0zAlCwZWQeRnd2N951ynDft99I=","Date":"Tue, 13 Aug 2024 00:27:38 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Dan Scally <dan.scally@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Subject":"Re: [PATCH v3 08/23] libcamera: software_isp: Define skeletons for\n\tIPA refactoring","Message-ID":"<20240812212738.GD32749@pendragon.ideasonboard.com>","References":"<20240717085444.289997-1-mzamazal@redhat.com>\n\t<20240717085444.289997-9-mzamazal@redhat.com>\n\t<2b2b4a57-b22d-4c55-b632-76d4a81cfe3d@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<2b2b4a57-b22d-4c55-b632-76d4a81cfe3d@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":30774,"web_url":"https://patchwork.libcamera.org/comment/30774/","msgid":"<87plqcygji.fsf@redhat.com>","date":"2024-08-13T08:26:41","subject":"Re: [PATCH v3 08/23] libcamera: software_isp: Define skeletons for\n\tIPA refactoring","submitter":{"id":177,"url":"https://patchwork.libcamera.org/api/people/177/","name":"Milan Zamazal","email":"mzamazal@redhat.com"},"content":"Hi Laurent,\n\nthank you for review.\n\nLaurent Pinchart <laurent.pinchart@ideasonboard.com> writes:\n\n> On Mon, Aug 12, 2024 at 02:15:29PM +0100, Daniel Scally wrote:\n>> Hi Milan, what a cool set - thanks - I think it's great to move the\n>> Software ISP to the same model as the other IPAs.\n>\n>> \n>> On 17/07/2024 09:54, Milan Zamazal wrote:\n>> > Software ISP image processing algorithms are currently defined in a\n>> > simplified way, different from other libcamera pipelines.  This is not\n>> > good for several reasons:\n>> >\n>> > - It makes the software ISP code harder to understand due to its\n>> >    different structuring.\n>> > - Adding more algorithms may make the code harder to understand\n>> >    generally.\n>> > - Mass libcamera code changes may not be easily applicable to software\n>> >    ISP.\n>> > - Algorithm sharing with other pipelines is not easily possible.\n>> >\n>> > This patch introduces basic software ISP IPA skeletons structured\n>> > similarly to the other pipelines.  The newly added files are currently\n>> > not used or compiled and the general skeleton structures don't contain\n>\n> s/don't/doesn't/\n\n? \"structures\" is plural.\n\n>> > anything particular.  It is just a preparation step for a larger\n>> > refactoring and the code will be actually used and extended as needed in\n>> > followup patches.\n>> >\n>> > Signed-off-by: Milan Zamazal <mzamazal@redhat.com>\n>> > Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>\n>> > ---\n>> >   src/ipa/simple/algorithms/algorithm.h | 22 +++++++++++\n>> >   src/ipa/simple/ipa_context.cpp        | 53 +++++++++++++++++++++++++++\n>> >   src/ipa/simple/ipa_context.h          | 34 +++++++++++++++++\n>> >   src/ipa/simple/meson.build            |  1 +\n>> >   src/ipa/simple/module.h               | 28 ++++++++++++++\n>> >   5 files changed, 138 insertions(+)\n>> >   create mode 100644 src/ipa/simple/algorithms/algorithm.h\n>> >   create mode 100644 src/ipa/simple/ipa_context.cpp\n>> >   create mode 100644 src/ipa/simple/ipa_context.h\n>> >   create mode 100644 src/ipa/simple/module.h\n>> >\n>> > diff --git a/src/ipa/simple/algorithms/algorithm.h b/src/ipa/simple/algorithms/algorithm.h\n>> > new file mode 100644\n>> > index 00000000..41f63170\n>> > --- /dev/null\n>> > +++ b/src/ipa/simple/algorithms/algorithm.h\n>> > @@ -0,0 +1,22 @@\n>> > +/* SPDX-License-Identifier: LGPL-2.1-or-later */\n>> > +/*\n>> > + * Copyright (C) 2024 Red Hat, Inc.\n>> > + *\n>> > + * Software ISP control algorithm interface\n>> > + */\n>> > +\n>> > +#pragma once\n>> > +\n>> > +#include <libipa/algorithm.h>\n>> > +\n>> > +#include \"module.h\"\n>> > +\n>> > +namespace libcamera {\n>> > +\n>> > +namespace ipa::soft {\n>> > +\n>> > +using Algorithm = libcamera::ipa::Algorithm<Module>;\n>> > +\n>> > +} /* namespace ipa::soft */\n>> > +\n>> > +} /* namespace libcamera */\n>> > diff --git a/src/ipa/simple/ipa_context.cpp b/src/ipa/simple/ipa_context.cpp\n>> > new file mode 100644\n>> > index 00000000..3c1c7262\n>> > --- /dev/null\n>> > +++ b/src/ipa/simple/ipa_context.cpp\n>> > @@ -0,0 +1,53 @@\n>> > +/* SPDX-License-Identifier: LGPL-2.1-or-later */\n>> > +/*\n>> > + * Copyright (C) 2021, Google Inc.\n>> > + * Copyright (C) 2024 Red Hat Inc.\n>> > + *\n>> > + * Software ISP IPA Context\n>> > + */\n>> > +\n>> > +#include \"ipa_context.h\"\n>> > +\n>> > +/**\n>> > + * \\file ipa_context.h\n>> > + * \\brief Context and state information shared between the algorithms\n>> > + */\n>> > +\n>> > +namespace libcamera::ipa::soft {\n>> > +\n>> > +/**\n>> > + * \\struct IPASessionConfiguration\n>> > + * \\brief Session configuration for the IPA module\n>> > + *\n>> > + * The session configuration contains all IPA configuration parameters that\n>> > + * remain constant during the capture session, from IPA module start to stop.\n>> > + * It is typically set during the configure() operation of the IPA module, but\n>> > + * may also be updated in the start() operation.\n>> > + */\n>> > +\n>> > +/**\n>> > + * \\struct IPAActiveState\n>> > + * \\brief The active state of the IPA algorithms\n>> > + *\n>> > + * The IPA is fed with the statistics generated from the latest frame processed.\n>> > + * The statistics are then processed by the IPA algorithms to compute parameters\n>> > + * required for the next frame capture and processing. The current state of the\n>> > + * algorithms is reflected through the IPAActiveState to store the values most\n>> > + * recently computed by the IPA algorithms.\n>> > + */\n>> > +\n>> > +/**\n>> > + * \\struct IPAContext\n>> > + * \\brief Global IPA context data shared between all algorithms\n>> > + *\n>> > + * \\var IPAContext::configuration\n>> > + * \\brief The IPA session configuration, immutable during the session\n>> > + *\n>> > + * \\var IPAContext::frameContexts\n>> > + * \\brief Ring buffer of the IPAFrameContext(s)\n>> > + *\n>> > + * \\var IPAContext::activeState\n>> > + * \\brief The current state of IPA algorithms\n>> > + */\n>> > +\n>> > +} /* namespace libcamera::ipa::soft */\n>> > diff --git a/src/ipa/simple/ipa_context.h b/src/ipa/simple/ipa_context.h\n>> > new file mode 100644\n>> > index 00000000..bc1235b6\n>> > --- /dev/null\n>> > +++ b/src/ipa/simple/ipa_context.h\n>> > @@ -0,0 +1,34 @@\n>> > +/* SPDX-License-Identifier: LGPL-2.1-or-later */\n>> > +/*\n>> > + * Copyright (C) 2024 Red Hat, Inc.\n>> > + *\n>> > + * Simple pipeline IPA Context\n>> > + *\n>\n> Extra blank line.\n\nOK, I'll remove it.\n\n>> > + */\n>> > +\n>> > +#pragma once\n>> > +\n>> > +#include <libipa/fc_queue.h>\n>> > +\n>> > +namespace libcamera {\n>> > +\n>> > +namespace ipa::soft {\n>> > +\n>> > +struct IPASessionConfiguration {\n>> > +};\n>> > +\n>> > +struct IPAActiveState {\n>> > +};\n>> > +\n>> > +struct IPAFrameContext : public FrameContext {\n>> > +};\n>> > +\n>> > +struct IPAContext {\n>> > +\tIPASessionConfiguration configuration;\n>> > +\tIPAActiveState activeState;\n>> > +\tFCQueue<IPAFrameContext> frameContexts;\n>> > +};\n>> > +\n>> > +} /* namespace ipa::soft */\n>> > +\n>> > +} /* namespace libcamera */\n>> > diff --git a/src/ipa/simple/meson.build b/src/ipa/simple/meson.build\n>> > index 33d1c96a..363251fb 100644\n>> > --- a/src/ipa/simple/meson.build\n>> > +++ b/src/ipa/simple/meson.build\n>> > @@ -3,6 +3,7 @@\n>> >   ipa_name = 'ipa_soft_simple'\n>> >   \n>> >   soft_simple_sources = files([\n>> > +     'ipa_context.cpp',\n>> >       'soft_simple.cpp',\n>> >       'black_level.cpp',\n>> >   ])\n>> > diff --git a/src/ipa/simple/module.h b/src/ipa/simple/module.h\n>> > new file mode 100644\n>> > index 00000000..33a7d1db\n>> > --- /dev/null\n>> > +++ b/src/ipa/simple/module.h\n>> > @@ -0,0 +1,28 @@\n>> > +/* SPDX-License-Identifier: LGPL-2.1-or-later */\n>> > +/*\n>> > + * Copyright (C) 2024 Red Hat, Inc.\n>> > + *\n>> > + * Software ISP IPA Module\n>> > + */\n>> > +\n>> > +#pragma once\n>> > +\n>> > +#include <libcamera/controls.h>\n>> > +\n>> > +#include \"libcamera/internal/software_isp/debayer_params.h\"\n>> > +#include \"libcamera/internal/software_isp/swisp_stats.h\"\n>> > +\n>> > +#include <libipa/module.h>\n>> > +\n>> > +#include \"ipa_context.h\"\n>> > +\n>> > +namespace libcamera {\n>> > +\n>> > +namespace ipa::soft {\n>> > +\n>> > +using Module = ipa::Module<IPAContext, IPAFrameContext, ControlInfoMap,\n>> \n>> The ControlInfoMap here rather than some mojom generated struct surprises me a little, but the rest \n>> is fine and I assume that will become clear later:\n>> \n>> \n>> Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>\n>\n> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n>\n>> > +\t\t\t   DebayerParams, SwIspStats>;\n>> > +\n>> > +} /* namespace ipa::soft */\n>> > +\n>> > +} /* namespace libcamera */","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 95CC8C323E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 13 Aug 2024 08:26:51 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id CFDC96337E;\n\tTue, 13 Aug 2024 10:26:50 +0200 (CEST)","from us-smtp-delivery-124.mimecast.com\n\t(us-smtp-delivery-124.mimecast.com [170.10.133.124])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 6514D6337E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 13 Aug 2024 10:26:48 +0200 (CEST)","from mail-lf1-f69.google.com (mail-lf1-f69.google.com\n\t[209.85.167.69]) by relay.mimecast.com with ESMTP with STARTTLS\n\t(version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id\n\tus-mta-482-vSxLhyeyOzOMqRCKuqdnCQ-1; Tue, 13 Aug 2024 04:26:45 -0400","by mail-lf1-f69.google.com with SMTP id\n\t2adb3069b0e04-52efe4c2261so6894924e87.1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 13 Aug 2024 01:26:45 -0700 (PDT)","from nuthatch (nat-pool-brq-t.redhat.com. [213.175.37.10])\n\tby smtp.gmail.com with ESMTPSA id\n\t5b1f17b1804b1-429c750393asm129637405e9.1.2024.08.13.01.26.41\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 13 Aug 2024 01:26:42 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=redhat.com header.i=@redhat.com\n\theader.b=\"Abq6BY42\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n\ts=mimecast20190719; t=1723537607;\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=aMcP7j/+w8voK1TZdEroSZCT4PZkZ+v4fl+OOykDV9E=;\n\tb=Abq6BY42HAllmhDWNvryQP5rWb7K5RiUe72Gm3jEKlQVyZR9r8dRZtFF8BT0fLvoi8trQb\n\tuXQQefk3TJVNJl63zBHbMukG68TzNd/8n68Q/QEHQwsAaENsA2mHTZZODOg4iTSXe+AwWz\n\tgQF9TMB2GDVAYPHURFVSk/QcE797Fwg=","X-MC-Unique":"vSxLhyeyOzOMqRCKuqdnCQ-1","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1723537603; x=1724142403;\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=aMcP7j/+w8voK1TZdEroSZCT4PZkZ+v4fl+OOykDV9E=;\n\tb=s1vZVj2WI7OAIIjrL5HrCmq7BxPcwgkPOYaSrjNqPEeQjRY+AyFbH1azvAv+MllIN8\n\ttab9aCwSdi6UQHhrwtscGTXexF/XDovxhNakMHhdngUTenl4ObaHsQCZGZrNzWnPUy5d\n\tLK4XGohWrkECITQgYJVJ2gfYr9EVP3EPvV/Trnb7rLxZpXgxVCyRySPoJt3WhY0JhmWO\n\t/HGBDaS3HXJGGl8P1Ts9B2pXDuBla23T7OxFtBriSGE2/ByKd9K5rt4F48DNn20qvXql\n\tjHMKLUsclYWvloOyNWXrP4NFDkXI/78JX3CDikhF0/WvnSDk4CyyGQOiZQGi4nFp7WIf\n\tqf+A==","X-Forwarded-Encrypted":"i=1;\n\tAJvYcCWGsqMp2D66h+5dgzbiH+PBR4TxfFUJ0onPNxgbEVzydXjbibhFzTq7PGgREYZngLiDjaS8hkE6EjFqZvNdi6MLxrfnhY72CyEnjNfFHzLv8fbbFw==","X-Gm-Message-State":"AOJu0YzTXbPRZhz2vLGAAQqlkLMjREqmIk5uZf5+hEacqZNoFFYJ6jrS\n\taAHQojKoBBMK0P+3guBldD4TU//cmYXnNCaNGbXUpmBHXFMqOsH19sE4n5a3W6SWwy7VsrbgEev\n\tvd/EIbfHsqj7Z5FzBqG4GBMnWq1hmTkZLyVO+lLSsGcJOeZ4jvXoPQ1otDer/elbtUuBIRVPAmq\n\t+hgw+brLFkE2kZvdd1mNd6Bq8RTpjVYoEHVCahg6G2RdxgV6Tplx/hwmU=","X-Received":["by 2002:a05:6512:3a8b:b0:530:ae35:be42 with SMTP id\n\t2adb3069b0e04-53213647801mr2142691e87.7.1723537603421; \n\tTue, 13 Aug 2024 01:26:43 -0700 (PDT)","by 2002:a05:6512:3a8b:b0:530:ae35:be42 with SMTP id\n\t2adb3069b0e04-53213647801mr2142662e87.7.1723537602641; \n\tTue, 13 Aug 2024 01:26:42 -0700 (PDT)"],"X-Google-Smtp-Source":"AGHT+IF1lqo89m4pcpxJkqYO6ZILBDut2yD4HR3WZNT66vOV2WVMKp5IIjuqagNRh2P0s6mqXiFCbg==","From":"Milan Zamazal <mzamazal@redhat.com>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"Dan Scally <dan.scally@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","Subject":"Re: [PATCH v3 08/23] libcamera: software_isp: Define skeletons for\n\tIPA refactoring","In-Reply-To":"<20240812212738.GD32749@pendragon.ideasonboard.com> (Laurent\n\tPinchart's message of \"Tue, 13 Aug 2024 00:27:38 +0300\")","References":"<20240717085444.289997-1-mzamazal@redhat.com>\n\t<20240717085444.289997-9-mzamazal@redhat.com>\n\t<2b2b4a57-b22d-4c55-b632-76d4a81cfe3d@ideasonboard.com>\n\t<20240812212738.GD32749@pendragon.ideasonboard.com>","Date":"Tue, 13 Aug 2024 10:26:41 +0200","Message-ID":"<87plqcygji.fsf@redhat.com>","User-Agent":"Gnus/5.13 (Gnus v5.13)","MIME-Version":"1.0","X-Mimecast-Spam-Score":"0","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":30777,"web_url":"https://patchwork.libcamera.org/comment/30777/","msgid":"<20240813083233.GJ32749@pendragon.ideasonboard.com>","date":"2024-08-13T08:32:33","subject":"Re: [PATCH v3 08/23] libcamera: software_isp: Define skeletons for\n\tIPA refactoring","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"On Tue, Aug 13, 2024 at 10:26:41AM +0200, Milan Zamazal wrote:\n> Hi Laurent,\n> \n> thank you for review.\n> \n> Laurent Pinchart <laurent.pinchart@ideasonboard.com> writes:\n> \n> > On Mon, Aug 12, 2024 at 02:15:29PM +0100, Daniel Scally wrote:\n> >> Hi Milan, what a cool set - thanks - I think it's great to move the\n> >> Software ISP to the same model as the other IPAs.\n> >\n> >> \n> >> On 17/07/2024 09:54, Milan Zamazal wrote:\n> >> > Software ISP image processing algorithms are currently defined in a\n> >> > simplified way, different from other libcamera pipelines.  This is not\n> >> > good for several reasons:\n> >> >\n> >> > - It makes the software ISP code harder to understand due to its\n> >> >    different structuring.\n> >> > - Adding more algorithms may make the code harder to understand\n> >> >    generally.\n> >> > - Mass libcamera code changes may not be easily applicable to software\n> >> >    ISP.\n> >> > - Algorithm sharing with other pipelines is not easily possible.\n> >> >\n> >> > This patch introduces basic software ISP IPA skeletons structured\n> >> > similarly to the other pipelines.  The newly added files are currently\n> >> > not used or compiled and the general skeleton structures don't contain\n> >\n> > s/don't/doesn't/\n> \n> ? \"structures\" is plural.\n\nI'm not sure what I misread. Please ignore my comment.\n\n> >> > anything particular.  It is just a preparation step for a larger\n> >> > refactoring and the code will be actually used and extended as needed in\n> >> > followup patches.\n> >> >\n> >> > Signed-off-by: Milan Zamazal <mzamazal@redhat.com>\n> >> > Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>\n> >> > ---\n> >> >   src/ipa/simple/algorithms/algorithm.h | 22 +++++++++++\n> >> >   src/ipa/simple/ipa_context.cpp        | 53 +++++++++++++++++++++++++++\n> >> >   src/ipa/simple/ipa_context.h          | 34 +++++++++++++++++\n> >> >   src/ipa/simple/meson.build            |  1 +\n> >> >   src/ipa/simple/module.h               | 28 ++++++++++++++\n> >> >   5 files changed, 138 insertions(+)\n> >> >   create mode 100644 src/ipa/simple/algorithms/algorithm.h\n> >> >   create mode 100644 src/ipa/simple/ipa_context.cpp\n> >> >   create mode 100644 src/ipa/simple/ipa_context.h\n> >> >   create mode 100644 src/ipa/simple/module.h\n> >> >\n> >> > diff --git a/src/ipa/simple/algorithms/algorithm.h b/src/ipa/simple/algorithms/algorithm.h\n> >> > new file mode 100644\n> >> > index 00000000..41f63170\n> >> > --- /dev/null\n> >> > +++ b/src/ipa/simple/algorithms/algorithm.h\n> >> > @@ -0,0 +1,22 @@\n> >> > +/* SPDX-License-Identifier: LGPL-2.1-or-later */\n> >> > +/*\n> >> > + * Copyright (C) 2024 Red Hat, Inc.\n> >> > + *\n> >> > + * Software ISP control algorithm interface\n> >> > + */\n> >> > +\n> >> > +#pragma once\n> >> > +\n> >> > +#include <libipa/algorithm.h>\n> >> > +\n> >> > +#include \"module.h\"\n> >> > +\n> >> > +namespace libcamera {\n> >> > +\n> >> > +namespace ipa::soft {\n> >> > +\n> >> > +using Algorithm = libcamera::ipa::Algorithm<Module>;\n> >> > +\n> >> > +} /* namespace ipa::soft */\n> >> > +\n> >> > +} /* namespace libcamera */\n> >> > diff --git a/src/ipa/simple/ipa_context.cpp b/src/ipa/simple/ipa_context.cpp\n> >> > new file mode 100644\n> >> > index 00000000..3c1c7262\n> >> > --- /dev/null\n> >> > +++ b/src/ipa/simple/ipa_context.cpp\n> >> > @@ -0,0 +1,53 @@\n> >> > +/* SPDX-License-Identifier: LGPL-2.1-or-later */\n> >> > +/*\n> >> > + * Copyright (C) 2021, Google Inc.\n> >> > + * Copyright (C) 2024 Red Hat Inc.\n> >> > + *\n> >> > + * Software ISP IPA Context\n> >> > + */\n> >> > +\n> >> > +#include \"ipa_context.h\"\n> >> > +\n> >> > +/**\n> >> > + * \\file ipa_context.h\n> >> > + * \\brief Context and state information shared between the algorithms\n> >> > + */\n> >> > +\n> >> > +namespace libcamera::ipa::soft {\n> >> > +\n> >> > +/**\n> >> > + * \\struct IPASessionConfiguration\n> >> > + * \\brief Session configuration for the IPA module\n> >> > + *\n> >> > + * The session configuration contains all IPA configuration parameters that\n> >> > + * remain constant during the capture session, from IPA module start to stop.\n> >> > + * It is typically set during the configure() operation of the IPA module, but\n> >> > + * may also be updated in the start() operation.\n> >> > + */\n> >> > +\n> >> > +/**\n> >> > + * \\struct IPAActiveState\n> >> > + * \\brief The active state of the IPA algorithms\n> >> > + *\n> >> > + * The IPA is fed with the statistics generated from the latest frame processed.\n> >> > + * The statistics are then processed by the IPA algorithms to compute parameters\n> >> > + * required for the next frame capture and processing. The current state of the\n> >> > + * algorithms is reflected through the IPAActiveState to store the values most\n> >> > + * recently computed by the IPA algorithms.\n> >> > + */\n> >> > +\n> >> > +/**\n> >> > + * \\struct IPAContext\n> >> > + * \\brief Global IPA context data shared between all algorithms\n> >> > + *\n> >> > + * \\var IPAContext::configuration\n> >> > + * \\brief The IPA session configuration, immutable during the session\n> >> > + *\n> >> > + * \\var IPAContext::frameContexts\n> >> > + * \\brief Ring buffer of the IPAFrameContext(s)\n> >> > + *\n> >> > + * \\var IPAContext::activeState\n> >> > + * \\brief The current state of IPA algorithms\n> >> > + */\n> >> > +\n> >> > +} /* namespace libcamera::ipa::soft */\n> >> > diff --git a/src/ipa/simple/ipa_context.h b/src/ipa/simple/ipa_context.h\n> >> > new file mode 100644\n> >> > index 00000000..bc1235b6\n> >> > --- /dev/null\n> >> > +++ b/src/ipa/simple/ipa_context.h\n> >> > @@ -0,0 +1,34 @@\n> >> > +/* SPDX-License-Identifier: LGPL-2.1-or-later */\n> >> > +/*\n> >> > + * Copyright (C) 2024 Red Hat, Inc.\n> >> > + *\n> >> > + * Simple pipeline IPA Context\n> >> > + *\n> >\n> > Extra blank line.\n> \n> OK, I'll remove it.\n> \n> >> > + */\n> >> > +\n> >> > +#pragma once\n> >> > +\n> >> > +#include <libipa/fc_queue.h>\n> >> > +\n> >> > +namespace libcamera {\n> >> > +\n> >> > +namespace ipa::soft {\n> >> > +\n> >> > +struct IPASessionConfiguration {\n> >> > +};\n> >> > +\n> >> > +struct IPAActiveState {\n> >> > +};\n> >> > +\n> >> > +struct IPAFrameContext : public FrameContext {\n> >> > +};\n> >> > +\n> >> > +struct IPAContext {\n> >> > +\tIPASessionConfiguration configuration;\n> >> > +\tIPAActiveState activeState;\n> >> > +\tFCQueue<IPAFrameContext> frameContexts;\n> >> > +};\n> >> > +\n> >> > +} /* namespace ipa::soft */\n> >> > +\n> >> > +} /* namespace libcamera */\n> >> > diff --git a/src/ipa/simple/meson.build b/src/ipa/simple/meson.build\n> >> > index 33d1c96a..363251fb 100644\n> >> > --- a/src/ipa/simple/meson.build\n> >> > +++ b/src/ipa/simple/meson.build\n> >> > @@ -3,6 +3,7 @@\n> >> >   ipa_name = 'ipa_soft_simple'\n> >> >   \n> >> >   soft_simple_sources = files([\n> >> > +     'ipa_context.cpp',\n> >> >       'soft_simple.cpp',\n> >> >       'black_level.cpp',\n> >> >   ])\n> >> > diff --git a/src/ipa/simple/module.h b/src/ipa/simple/module.h\n> >> > new file mode 100644\n> >> > index 00000000..33a7d1db\n> >> > --- /dev/null\n> >> > +++ b/src/ipa/simple/module.h\n> >> > @@ -0,0 +1,28 @@\n> >> > +/* SPDX-License-Identifier: LGPL-2.1-or-later */\n> >> > +/*\n> >> > + * Copyright (C) 2024 Red Hat, Inc.\n> >> > + *\n> >> > + * Software ISP IPA Module\n> >> > + */\n> >> > +\n> >> > +#pragma once\n> >> > +\n> >> > +#include <libcamera/controls.h>\n> >> > +\n> >> > +#include \"libcamera/internal/software_isp/debayer_params.h\"\n> >> > +#include \"libcamera/internal/software_isp/swisp_stats.h\"\n> >> > +\n> >> > +#include <libipa/module.h>\n> >> > +\n> >> > +#include \"ipa_context.h\"\n> >> > +\n> >> > +namespace libcamera {\n> >> > +\n> >> > +namespace ipa::soft {\n> >> > +\n> >> > +using Module = ipa::Module<IPAContext, IPAFrameContext, ControlInfoMap,\n> >> \n> >> The ControlInfoMap here rather than some mojom generated struct surprises me a little, but the rest \n> >> is fine and I assume that will become clear later:\n> >> \n> >> \n> >> Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>\n> >\n> > Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> >\n> >> > +\t\t\t   DebayerParams, SwIspStats>;\n> >> > +\n> >> > +} /* namespace ipa::soft */\n> >> > +\n> >> > +} /* namespace libcamera */\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 6AD78BDB13\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 13 Aug 2024 08:32:59 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id E8A13633BD;\n\tTue, 13 Aug 2024 10:32:58 +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 493BA633B3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 13 Aug 2024 10:32:57 +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 4E282827;\n\tTue, 13 Aug 2024 10:32:00 +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=\"ACPS7pAJ\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1723537920;\n\tbh=XESqCuuRuxpapqX10ij31aAEs9a+PF3baWA3dNxnyPc=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=ACPS7pAJsFdD3aA8ZZnNAy4LwdcfBBxgpheezw03DfUjw2SuFGjkJ6fvezVyF9up0\n\tloYztbmLtGDnKikpqhZgnZGjV00wj/lYShVmQJQpFCAf95OG8klNL1Ul6JTHyspxLE\n\tebM0RPz9CNEsZSvjz/xXE2TGMorufX+5h3N986Ho=","Date":"Tue, 13 Aug 2024 11:32:33 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Milan Zamazal <mzamazal@redhat.com>","Cc":"Dan Scally <dan.scally@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","Subject":"Re: [PATCH v3 08/23] libcamera: software_isp: Define skeletons for\n\tIPA refactoring","Message-ID":"<20240813083233.GJ32749@pendragon.ideasonboard.com>","References":"<20240717085444.289997-1-mzamazal@redhat.com>\n\t<20240717085444.289997-9-mzamazal@redhat.com>\n\t<2b2b4a57-b22d-4c55-b632-76d4a81cfe3d@ideasonboard.com>\n\t<20240812212738.GD32749@pendragon.ideasonboard.com>\n\t<87plqcygji.fsf@redhat.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<87plqcygji.fsf@redhat.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>"}}]