[{"id":25009,"web_url":"https://patchwork.libcamera.org/comment/25009/","msgid":"<166368032082.3912877.3927370723272133210@Monstersaurus>","date":"2022-09-20T13:25:20","subject":"Re: [libcamera-devel] [PATCH v4 03/32] ipa: libipa: Pass a\n\treference instead of pointer to Algorithm::process()","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Laurent Pinchart via libcamera-devel (2022-09-08 02:41:31)\n> Frame contexts will become the core component of IPA modules, always\n> available to functions of the algorithms. To indicate and prepare for\n> this, turn the frame context pointer passed to Algorithm::process() into\n> a reference.\n\nExcellent.\n\n> The RkISP1 IPA module doesn't use frame contexts yet, so pass a dummy\n> context for now.\n> \n> While at it, drop an unneeded [[maybe_unused]] from Agc::process().\n> \n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> ---\n>  src/ipa/ipu3/algorithms/af.cpp           | 2 +-\n>  src/ipa/ipu3/algorithms/af.h             | 2 +-\n>  src/ipa/ipu3/algorithms/agc.cpp          | 8 ++++----\n>  src/ipa/ipu3/algorithms/agc.h            | 4 ++--\n>  src/ipa/ipu3/algorithms/awb.cpp          | 2 +-\n>  src/ipa/ipu3/algorithms/awb.h            | 2 +-\n>  src/ipa/ipu3/algorithms/tone_mapping.cpp | 2 +-\n>  src/ipa/ipu3/algorithms/tone_mapping.h   | 2 +-\n>  src/ipa/ipu3/ipu3.cpp                    | 2 +-\n>  src/ipa/libipa/algorithm.h               | 2 +-\n>  src/ipa/rkisp1/algorithms/agc.cpp        | 3 ++-\n>  src/ipa/rkisp1/algorithms/agc.h          | 2 +-\n>  src/ipa/rkisp1/algorithms/awb.cpp        | 2 +-\n>  src/ipa/rkisp1/algorithms/awb.h          | 2 +-\n>  src/ipa/rkisp1/rkisp1.cpp                | 5 ++++-\n>  15 files changed, 23 insertions(+), 19 deletions(-)\n> \n> diff --git a/src/ipa/ipu3/algorithms/af.cpp b/src/ipa/ipu3/algorithms/af.cpp\n> index 9127c24f1287..5ab64bf88313 100644\n> --- a/src/ipa/ipu3/algorithms/af.cpp\n> +++ b/src/ipa/ipu3/algorithms/af.cpp\n> @@ -417,7 +417,7 @@ bool Af::afIsOutOfFocus(IPAContext &context)\n>   *\n>   * [1] Hill Climbing Algorithm, https://en.wikipedia.org/wiki/Hill_climbing\n>   */\n> -void Af::process(IPAContext &context, [[maybe_unused]] IPAFrameContext *frameContext,\n> +void Af::process(IPAContext &context, [[maybe_unused]] IPAFrameContext &frameContext,\n>                  const ipu3_uapi_stats_3a *stats)\n>  {\n>         /* Evaluate the AF buffer length */\n> diff --git a/src/ipa/ipu3/algorithms/af.h b/src/ipa/ipu3/algorithms/af.h\n> index 9b93594898bb..29117e8bdd0d 100644\n> --- a/src/ipa/ipu3/algorithms/af.h\n> +++ b/src/ipa/ipu3/algorithms/af.h\n> @@ -32,7 +32,7 @@ public:\n>  \n>         void prepare(IPAContext &context, ipu3_uapi_params *params) override;\n>         int configure(IPAContext &context, const IPAConfigInfo &configInfo) override;\n> -       void process(IPAContext &context, IPAFrameContext *frameContext,\n> +       void process(IPAContext &context, IPAFrameContext &frameContext,\n>                      const ipu3_uapi_stats_3a *stats) override;\n>  \n>  private:\n> diff --git a/src/ipa/ipu3/algorithms/agc.cpp b/src/ipa/ipu3/algorithms/agc.cpp\n> index ed4809d98007..f8ca29640a44 100644\n> --- a/src/ipa/ipu3/algorithms/agc.cpp\n> +++ b/src/ipa/ipu3/algorithms/agc.cpp\n> @@ -183,13 +183,13 @@ utils::Duration Agc::filterExposure(utils::Duration exposureValue)\n>   * \\param[in] yGain The gain calculated based on the relative luminance target\n>   * \\param[in] iqMeanGain The gain calculated based on the relative luminance target\n>   */\n> -void Agc::computeExposure(IPAContext &context, IPAFrameContext *frameContext,\n> +void Agc::computeExposure(IPAContext &context, IPAFrameContext &frameContext,\n>                           double yGain, double iqMeanGain)\n>  {\n>         const IPASessionConfiguration &configuration = context.configuration;\n>         /* Get the effective exposure and gain applied on the sensor. */\n> -       uint32_t exposure = frameContext->sensor.exposure;\n> -       double analogueGain = frameContext->sensor.gain;\n> +       uint32_t exposure = frameContext.sensor.exposure;\n> +       double analogueGain = frameContext.sensor.gain;\n>  \n>         /* Use the highest of the two gain estimates. */\n>         double evGain = std::max(yGain, iqMeanGain);\n> @@ -323,7 +323,7 @@ double Agc::estimateLuminance(IPAActiveState &activeState,\n>   * Identify the current image brightness, and use that to estimate the optimal\n>   * new exposure and gain for the scene.\n>   */\n> -void Agc::process(IPAContext &context, [[maybe_unused]] IPAFrameContext *frameContext,\n> +void Agc::process(IPAContext &context, IPAFrameContext &frameContext,\n>                   const ipu3_uapi_stats_3a *stats)\n>  {\n>         /*\n> diff --git a/src/ipa/ipu3/algorithms/agc.h b/src/ipa/ipu3/algorithms/agc.h\n> index 105ae0f2aac6..876fbbb6b585 100644\n> --- a/src/ipa/ipu3/algorithms/agc.h\n> +++ b/src/ipa/ipu3/algorithms/agc.h\n> @@ -28,14 +28,14 @@ public:\n>         ~Agc() = default;\n>  \n>         int configure(IPAContext &context, const IPAConfigInfo &configInfo) override;\n> -       void process(IPAContext &context, IPAFrameContext *frameContext,\n> +       void process(IPAContext &context, IPAFrameContext &frameContext,\n>                      const ipu3_uapi_stats_3a *stats) override;\n>  \n>  private:\n>         double measureBrightness(const ipu3_uapi_stats_3a *stats,\n>                                  const ipu3_uapi_grid_config &grid) const;\n>         utils::Duration filterExposure(utils::Duration currentExposure);\n> -       void computeExposure(IPAContext &context, IPAFrameContext *frameContext,\n> +       void computeExposure(IPAContext &context, IPAFrameContext &frameContext,\n>                              double yGain, double iqMeanGain);\n>         double estimateLuminance(IPAActiveState &activeState,\n>                                  const ipu3_uapi_grid_config &grid,\n> diff --git a/src/ipa/ipu3/algorithms/awb.cpp b/src/ipa/ipu3/algorithms/awb.cpp\n> index b658ee546b87..128f5d9d5351 100644\n> --- a/src/ipa/ipu3/algorithms/awb.cpp\n> +++ b/src/ipa/ipu3/algorithms/awb.cpp\n> @@ -387,7 +387,7 @@ void Awb::calculateWBGains(const ipu3_uapi_stats_3a *stats)\n>  /**\n>   * \\copydoc libcamera::ipa::Algorithm::process\n>   */\n> -void Awb::process(IPAContext &context, [[maybe_unused]] IPAFrameContext *frameContext,\n> +void Awb::process(IPAContext &context, [[maybe_unused]] IPAFrameContext &frameContext,\n>                   const ipu3_uapi_stats_3a *stats)\n>  {\n>         calculateWBGains(stats);\n> diff --git a/src/ipa/ipu3/algorithms/awb.h b/src/ipa/ipu3/algorithms/awb.h\n> index 0acd21480845..ebbb2d58be7e 100644\n> --- a/src/ipa/ipu3/algorithms/awb.h\n> +++ b/src/ipa/ipu3/algorithms/awb.h\n> @@ -40,7 +40,7 @@ public:\n>  \n>         int configure(IPAContext &context, const IPAConfigInfo &configInfo) override;\n>         void prepare(IPAContext &context, ipu3_uapi_params *params) override;\n> -       void process(IPAContext &context, IPAFrameContext *frameContext,\n> +       void process(IPAContext &context, IPAFrameContext &frameContext,\n>                      const ipu3_uapi_stats_3a *stats) override;\n>  \n>  private:\n> diff --git a/src/ipa/ipu3/algorithms/tone_mapping.cpp b/src/ipa/ipu3/algorithms/tone_mapping.cpp\n> index c21647e8c51b..24faba9be2b2 100644\n> --- a/src/ipa/ipu3/algorithms/tone_mapping.cpp\n> +++ b/src/ipa/ipu3/algorithms/tone_mapping.cpp\n> @@ -78,7 +78,7 @@ void ToneMapping::prepare([[maybe_unused]] IPAContext &context,\n>   * The tone mapping look up table is generated as an inverse power curve from\n>   * our gamma setting.\n>   */\n> -void ToneMapping::process(IPAContext &context, [[maybe_unused]] IPAFrameContext *frameContext,\n> +void ToneMapping::process(IPAContext &context, [[maybe_unused]] IPAFrameContext &frameContext,\n>                           [[maybe_unused]] const ipu3_uapi_stats_3a *stats)\n>  {\n>         /*\n> diff --git a/src/ipa/ipu3/algorithms/tone_mapping.h b/src/ipa/ipu3/algorithms/tone_mapping.h\n> index d7d4800628f2..5be62f6ee9bd 100644\n> --- a/src/ipa/ipu3/algorithms/tone_mapping.h\n> +++ b/src/ipa/ipu3/algorithms/tone_mapping.h\n> @@ -20,7 +20,7 @@ public:\n>  \n>         int configure(IPAContext &context, const IPAConfigInfo &configInfo) override;\n>         void prepare(IPAContext &context, ipu3_uapi_params *params) override;\n> -       void process(IPAContext &context, IPAFrameContext *frameContext,\n> +       void process(IPAContext &context, IPAFrameContext &frameContext,\n>                      const ipu3_uapi_stats_3a *stats) override;\n>  \n>  private:\n> diff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp\n> index e3c1e8160759..f0c92507533c 100644\n> --- a/src/ipa/ipu3/ipu3.cpp\n> +++ b/src/ipa/ipu3/ipu3.cpp\n> @@ -616,7 +616,7 @@ void IPAIPU3::processStatsBuffer(const uint32_t frame,\n>         ControlList ctrls(controls::controls);\n>  \n>         for (auto const &algo : algorithms())\n> -               algo->process(context_, &frameContext, stats);\n> +               algo->process(context_, frameContext, stats);\n>  \n>         setControls(frame);\n>  \n> diff --git a/src/ipa/libipa/algorithm.h b/src/ipa/libipa/algorithm.h\n> index ccc659a63e3b..0fe3d772963a 100644\n> --- a/src/ipa/libipa/algorithm.h\n> +++ b/src/ipa/libipa/algorithm.h\n> @@ -49,7 +49,7 @@ public:\n>         }\n>  \n>         virtual void process([[maybe_unused]] typename Module::Context &context,\n> -                            [[maybe_unused]] typename Module::FrameContext *frameContext,\n> +                            [[maybe_unused]] typename Module::FrameContext &frameContext,\n>                              [[maybe_unused]] const typename Module::Stats *stats)\n>         {\n>         }\n> diff --git a/src/ipa/rkisp1/algorithms/agc.cpp b/src/ipa/rkisp1/algorithms/agc.cpp\n> index 708c36ed1af8..7642796d69a3 100644\n> --- a/src/ipa/rkisp1/algorithms/agc.cpp\n> +++ b/src/ipa/rkisp1/algorithms/agc.cpp\n> @@ -275,13 +275,14 @@ double Agc::measureBrightness(const rkisp1_cif_isp_hist_stat *hist) const\n>  /**\n>   * \\brief Process RkISP1 statistics, and run AGC operations\n>   * \\param[in] context The shared IPA context\n> + * \\param[in] frame The frame context sequence number\n\nI don't think this is in yet ... Perhaps this is for a later patch.\n\nWith that,\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n\n>   * \\param[in] stats The RKISP1 statistics and ISP results\n>   *\n>   * Identify the current image brightness, and use that to estimate the optimal\n>   * new exposure and gain for the scene.\n>   */\n>  void Agc::process(IPAContext &context,\n> -                 [[maybe_unused]] IPAFrameContext *frameContext,\n> +                 [[maybe_unused]] IPAFrameContext &frameContext,\n>                   const rkisp1_stat_buffer *stats)\n>  {\n>         const rkisp1_cif_isp_stat *params = &stats->params;\n> diff --git a/src/ipa/rkisp1/algorithms/agc.h b/src/ipa/rkisp1/algorithms/agc.h\n> index 1c9818b7db2a..6a5723ecbcf8 100644\n> --- a/src/ipa/rkisp1/algorithms/agc.h\n> +++ b/src/ipa/rkisp1/algorithms/agc.h\n> @@ -27,7 +27,7 @@ public:\n>  \n>         int configure(IPAContext &context, const IPACameraSensorInfo &configInfo) override;\n>         void prepare(IPAContext &context, rkisp1_params_cfg *params) override;\n> -       void process(IPAContext &context, IPAFrameContext *frameContext,\n> +       void process(IPAContext &context, IPAFrameContext &frameContext,\n>                      const rkisp1_stat_buffer *stats) override;\n>  \n>  private:\n> diff --git a/src/ipa/rkisp1/algorithms/awb.cpp b/src/ipa/rkisp1/algorithms/awb.cpp\n> index b12df21de4aa..2bc5d3aa16ab 100644\n> --- a/src/ipa/rkisp1/algorithms/awb.cpp\n> +++ b/src/ipa/rkisp1/algorithms/awb.cpp\n> @@ -152,7 +152,7 @@ void Awb::queueRequest(IPAContext &context,\n>   * \\copydoc libcamera::ipa::Algorithm::process\n>   */\n>  void Awb::process([[maybe_unused]] IPAContext &context,\n> -                 [[maybe_unused]] IPAFrameContext *frameCtx,\n> +                 [[maybe_unused]] IPAFrameContext &frameCtx,\n>                   const rkisp1_stat_buffer *stats)\n>  {\n>         const rkisp1_cif_isp_stat *params = &stats->params;\n> diff --git a/src/ipa/rkisp1/algorithms/awb.h b/src/ipa/rkisp1/algorithms/awb.h\n> index 4917267bb99d..fc221acea617 100644\n> --- a/src/ipa/rkisp1/algorithms/awb.h\n> +++ b/src/ipa/rkisp1/algorithms/awb.h\n> @@ -23,7 +23,7 @@ public:\n>         void prepare(IPAContext &context, rkisp1_params_cfg *params) override;\n>         void queueRequest(IPAContext &context, const uint32_t frame,\n>                           const ControlList &controls) override;\n> -       void process(IPAContext &context, IPAFrameContext *frameCtx,\n> +       void process(IPAContext &context, IPAFrameContext &frameCtx,\n>                      const rkisp1_stat_buffer *stats) override;\n>  \n>  private:\n> diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp\n> index 3ff1eb48f605..3bc6d4dd2784 100644\n> --- a/src/ipa/rkisp1/rkisp1.cpp\n> +++ b/src/ipa/rkisp1/rkisp1.cpp\n> @@ -326,8 +326,11 @@ void IPARkISP1::processStatsBuffer(const uint32_t frame, const uint32_t bufferId\n>  \n>         unsigned int aeState = 0;\n>  \n> +       /* \\todo Obtain the frame context to pass to process from the FCQueue */\n> +       IPAFrameContext frameContext;\n> +\n>         for (auto const &algo : algorithms())\n> -               algo->process(context_, nullptr, stats);\n> +               algo->process(context_, frameContext, stats);\n>  \n>         setControls(frame);\n>  \n> -- \n> Regards,\n> \n> Laurent Pinchart\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 44399C0DA4\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 20 Sep 2022 13:25:26 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 7F393621AC;\n\tTue, 20 Sep 2022 15:25:25 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 30E046218B\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 20 Sep 2022 15:25:24 +0200 (CEST)","from pendragon.ideasonboard.com\n\t(cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id A172C6BE;\n\tTue, 20 Sep 2022 15:25:23 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1663680325;\n\tbh=NCquhcH86SRM5bwO9MDBHwQXovz+WCGfqh70hJtosms=;\n\th=In-Reply-To:References:To:Date:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=1oDoXRN6vtbErwMgPsVe7WnOpATNiuWxujH6BX3tGqcWCdM32koYstZu0SqoHnoaw\n\tiFe00jNRiHNUQityCa1t/H2mi6qWNZqv4rP1wIU83jzSqQ52sj/gVRFRkvSVd+Ug5V\n\tded0N3NvLoPvgr5FlcKO8wMjyUbT1KxCD0ZoWXxEYHrgAyz6vLsLMD/EdUAsujmnGK\n\tgioNbXFGdL+JAa1a4ZQmgFm2AVn+JXP+Zyh5nzUJwyiHMpj25ezgF7QkL0Ozji6V3P\n\t5bygdFdrzuzz47NkBgCw36l6azKtgoksk5gAiQw67kDMupfe3MFal+TgoI1IidCfNp\n\tyv9+I2Z+HMBtQ==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1663680323;\n\tbh=NCquhcH86SRM5bwO9MDBHwQXovz+WCGfqh70hJtosms=;\n\th=In-Reply-To:References:Subject:From:To:Date:From;\n\tb=d411c8naG7oXbafmZL5C240ewN/5Lpc21T7e0gw00xobuvX/aD/1H0tJIxeQdLxuS\n\t6xtK1lSDfQ42Br+UBpN7GMlN7oyp9Ju/BfH0HfkfSRBiUob0lDa+NLGT/vgkHuD2xC\n\tsJrYso2LOAk3yoiy1K7haMmgGIs6IbifprICv1ps="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"d411c8na\"; dkim-atps=neutral","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20220908014200.28728-4-laurent.pinchart@ideasonboard.com>","References":"<20220908014200.28728-1-laurent.pinchart@ideasonboard.com>\n\t<20220908014200.28728-4-laurent.pinchart@ideasonboard.com>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","Date":"Tue, 20 Sep 2022 14:25:20 +0100","Message-ID":"<166368032082.3912877.3927370723272133210@Monstersaurus>","User-Agent":"alot/0.10","Subject":"Re: [libcamera-devel] [PATCH v4 03/32] ipa: libipa: Pass a\n\treference instead of pointer to Algorithm::process()","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>","From":"Kieran Bingham via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":25025,"web_url":"https://patchwork.libcamera.org/comment/25025/","msgid":"<YyoPMiz5r64k2i7k@pendragon.ideasonboard.com>","date":"2022-09-20T19:06:26","subject":"Re: [libcamera-devel] [PATCH v4 03/32] ipa: libipa: Pass a\n\treference instead of pointer to Algorithm::process()","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Kieran,\n\nOn Tue, Sep 20, 2022 at 02:25:20PM +0100, Kieran Bingham wrote:\n> Quoting Laurent Pinchart via libcamera-devel (2022-09-08 02:41:31)\n> > Frame contexts will become the core component of IPA modules, always\n> > available to functions of the algorithms. To indicate and prepare for\n> > this, turn the frame context pointer passed to Algorithm::process() into\n> > a reference.\n> \n> Excellent.\n> \n> > The RkISP1 IPA module doesn't use frame contexts yet, so pass a dummy\n> > context for now.\n> > \n> > While at it, drop an unneeded [[maybe_unused]] from Agc::process().\n> > \n> > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> > ---\n> >  src/ipa/ipu3/algorithms/af.cpp           | 2 +-\n> >  src/ipa/ipu3/algorithms/af.h             | 2 +-\n> >  src/ipa/ipu3/algorithms/agc.cpp          | 8 ++++----\n> >  src/ipa/ipu3/algorithms/agc.h            | 4 ++--\n> >  src/ipa/ipu3/algorithms/awb.cpp          | 2 +-\n> >  src/ipa/ipu3/algorithms/awb.h            | 2 +-\n> >  src/ipa/ipu3/algorithms/tone_mapping.cpp | 2 +-\n> >  src/ipa/ipu3/algorithms/tone_mapping.h   | 2 +-\n> >  src/ipa/ipu3/ipu3.cpp                    | 2 +-\n> >  src/ipa/libipa/algorithm.h               | 2 +-\n> >  src/ipa/rkisp1/algorithms/agc.cpp        | 3 ++-\n> >  src/ipa/rkisp1/algorithms/agc.h          | 2 +-\n> >  src/ipa/rkisp1/algorithms/awb.cpp        | 2 +-\n> >  src/ipa/rkisp1/algorithms/awb.h          | 2 +-\n> >  src/ipa/rkisp1/rkisp1.cpp                | 5 ++++-\n> >  15 files changed, 23 insertions(+), 19 deletions(-)\n> > \n> > diff --git a/src/ipa/ipu3/algorithms/af.cpp b/src/ipa/ipu3/algorithms/af.cpp\n> > index 9127c24f1287..5ab64bf88313 100644\n> > --- a/src/ipa/ipu3/algorithms/af.cpp\n> > +++ b/src/ipa/ipu3/algorithms/af.cpp\n> > @@ -417,7 +417,7 @@ bool Af::afIsOutOfFocus(IPAContext &context)\n> >   *\n> >   * [1] Hill Climbing Algorithm, https://en.wikipedia.org/wiki/Hill_climbing\n> >   */\n> > -void Af::process(IPAContext &context, [[maybe_unused]] IPAFrameContext *frameContext,\n> > +void Af::process(IPAContext &context, [[maybe_unused]] IPAFrameContext &frameContext,\n> >                  const ipu3_uapi_stats_3a *stats)\n> >  {\n> >         /* Evaluate the AF buffer length */\n> > diff --git a/src/ipa/ipu3/algorithms/af.h b/src/ipa/ipu3/algorithms/af.h\n> > index 9b93594898bb..29117e8bdd0d 100644\n> > --- a/src/ipa/ipu3/algorithms/af.h\n> > +++ b/src/ipa/ipu3/algorithms/af.h\n> > @@ -32,7 +32,7 @@ public:\n> >  \n> >         void prepare(IPAContext &context, ipu3_uapi_params *params) override;\n> >         int configure(IPAContext &context, const IPAConfigInfo &configInfo) override;\n> > -       void process(IPAContext &context, IPAFrameContext *frameContext,\n> > +       void process(IPAContext &context, IPAFrameContext &frameContext,\n> >                      const ipu3_uapi_stats_3a *stats) override;\n> >  \n> >  private:\n> > diff --git a/src/ipa/ipu3/algorithms/agc.cpp b/src/ipa/ipu3/algorithms/agc.cpp\n> > index ed4809d98007..f8ca29640a44 100644\n> > --- a/src/ipa/ipu3/algorithms/agc.cpp\n> > +++ b/src/ipa/ipu3/algorithms/agc.cpp\n> > @@ -183,13 +183,13 @@ utils::Duration Agc::filterExposure(utils::Duration exposureValue)\n> >   * \\param[in] yGain The gain calculated based on the relative luminance target\n> >   * \\param[in] iqMeanGain The gain calculated based on the relative luminance target\n> >   */\n> > -void Agc::computeExposure(IPAContext &context, IPAFrameContext *frameContext,\n> > +void Agc::computeExposure(IPAContext &context, IPAFrameContext &frameContext,\n> >                           double yGain, double iqMeanGain)\n> >  {\n> >         const IPASessionConfiguration &configuration = context.configuration;\n> >         /* Get the effective exposure and gain applied on the sensor. */\n> > -       uint32_t exposure = frameContext->sensor.exposure;\n> > -       double analogueGain = frameContext->sensor.gain;\n> > +       uint32_t exposure = frameContext.sensor.exposure;\n> > +       double analogueGain = frameContext.sensor.gain;\n> >  \n> >         /* Use the highest of the two gain estimates. */\n> >         double evGain = std::max(yGain, iqMeanGain);\n> > @@ -323,7 +323,7 @@ double Agc::estimateLuminance(IPAActiveState &activeState,\n> >   * Identify the current image brightness, and use that to estimate the optimal\n> >   * new exposure and gain for the scene.\n> >   */\n> > -void Agc::process(IPAContext &context, [[maybe_unused]] IPAFrameContext *frameContext,\n> > +void Agc::process(IPAContext &context, IPAFrameContext &frameContext,\n> >                   const ipu3_uapi_stats_3a *stats)\n> >  {\n> >         /*\n> > diff --git a/src/ipa/ipu3/algorithms/agc.h b/src/ipa/ipu3/algorithms/agc.h\n> > index 105ae0f2aac6..876fbbb6b585 100644\n> > --- a/src/ipa/ipu3/algorithms/agc.h\n> > +++ b/src/ipa/ipu3/algorithms/agc.h\n> > @@ -28,14 +28,14 @@ public:\n> >         ~Agc() = default;\n> >  \n> >         int configure(IPAContext &context, const IPAConfigInfo &configInfo) override;\n> > -       void process(IPAContext &context, IPAFrameContext *frameContext,\n> > +       void process(IPAContext &context, IPAFrameContext &frameContext,\n> >                      const ipu3_uapi_stats_3a *stats) override;\n> >  \n> >  private:\n> >         double measureBrightness(const ipu3_uapi_stats_3a *stats,\n> >                                  const ipu3_uapi_grid_config &grid) const;\n> >         utils::Duration filterExposure(utils::Duration currentExposure);\n> > -       void computeExposure(IPAContext &context, IPAFrameContext *frameContext,\n> > +       void computeExposure(IPAContext &context, IPAFrameContext &frameContext,\n> >                              double yGain, double iqMeanGain);\n> >         double estimateLuminance(IPAActiveState &activeState,\n> >                                  const ipu3_uapi_grid_config &grid,\n> > diff --git a/src/ipa/ipu3/algorithms/awb.cpp b/src/ipa/ipu3/algorithms/awb.cpp\n> > index b658ee546b87..128f5d9d5351 100644\n> > --- a/src/ipa/ipu3/algorithms/awb.cpp\n> > +++ b/src/ipa/ipu3/algorithms/awb.cpp\n> > @@ -387,7 +387,7 @@ void Awb::calculateWBGains(const ipu3_uapi_stats_3a *stats)\n> >  /**\n> >   * \\copydoc libcamera::ipa::Algorithm::process\n> >   */\n> > -void Awb::process(IPAContext &context, [[maybe_unused]] IPAFrameContext *frameContext,\n> > +void Awb::process(IPAContext &context, [[maybe_unused]] IPAFrameContext &frameContext,\n> >                   const ipu3_uapi_stats_3a *stats)\n> >  {\n> >         calculateWBGains(stats);\n> > diff --git a/src/ipa/ipu3/algorithms/awb.h b/src/ipa/ipu3/algorithms/awb.h\n> > index 0acd21480845..ebbb2d58be7e 100644\n> > --- a/src/ipa/ipu3/algorithms/awb.h\n> > +++ b/src/ipa/ipu3/algorithms/awb.h\n> > @@ -40,7 +40,7 @@ public:\n> >  \n> >         int configure(IPAContext &context, const IPAConfigInfo &configInfo) override;\n> >         void prepare(IPAContext &context, ipu3_uapi_params *params) override;\n> > -       void process(IPAContext &context, IPAFrameContext *frameContext,\n> > +       void process(IPAContext &context, IPAFrameContext &frameContext,\n> >                      const ipu3_uapi_stats_3a *stats) override;\n> >  \n> >  private:\n> > diff --git a/src/ipa/ipu3/algorithms/tone_mapping.cpp b/src/ipa/ipu3/algorithms/tone_mapping.cpp\n> > index c21647e8c51b..24faba9be2b2 100644\n> > --- a/src/ipa/ipu3/algorithms/tone_mapping.cpp\n> > +++ b/src/ipa/ipu3/algorithms/tone_mapping.cpp\n> > @@ -78,7 +78,7 @@ void ToneMapping::prepare([[maybe_unused]] IPAContext &context,\n> >   * The tone mapping look up table is generated as an inverse power curve from\n> >   * our gamma setting.\n> >   */\n> > -void ToneMapping::process(IPAContext &context, [[maybe_unused]] IPAFrameContext *frameContext,\n> > +void ToneMapping::process(IPAContext &context, [[maybe_unused]] IPAFrameContext &frameContext,\n> >                           [[maybe_unused]] const ipu3_uapi_stats_3a *stats)\n> >  {\n> >         /*\n> > diff --git a/src/ipa/ipu3/algorithms/tone_mapping.h b/src/ipa/ipu3/algorithms/tone_mapping.h\n> > index d7d4800628f2..5be62f6ee9bd 100644\n> > --- a/src/ipa/ipu3/algorithms/tone_mapping.h\n> > +++ b/src/ipa/ipu3/algorithms/tone_mapping.h\n> > @@ -20,7 +20,7 @@ public:\n> >  \n> >         int configure(IPAContext &context, const IPAConfigInfo &configInfo) override;\n> >         void prepare(IPAContext &context, ipu3_uapi_params *params) override;\n> > -       void process(IPAContext &context, IPAFrameContext *frameContext,\n> > +       void process(IPAContext &context, IPAFrameContext &frameContext,\n> >                      const ipu3_uapi_stats_3a *stats) override;\n> >  \n> >  private:\n> > diff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp\n> > index e3c1e8160759..f0c92507533c 100644\n> > --- a/src/ipa/ipu3/ipu3.cpp\n> > +++ b/src/ipa/ipu3/ipu3.cpp\n> > @@ -616,7 +616,7 @@ void IPAIPU3::processStatsBuffer(const uint32_t frame,\n> >         ControlList ctrls(controls::controls);\n> >  \n> >         for (auto const &algo : algorithms())\n> > -               algo->process(context_, &frameContext, stats);\n> > +               algo->process(context_, frameContext, stats);\n> >  \n> >         setControls(frame);\n> >  \n> > diff --git a/src/ipa/libipa/algorithm.h b/src/ipa/libipa/algorithm.h\n> > index ccc659a63e3b..0fe3d772963a 100644\n> > --- a/src/ipa/libipa/algorithm.h\n> > +++ b/src/ipa/libipa/algorithm.h\n> > @@ -49,7 +49,7 @@ public:\n> >         }\n> >  \n> >         virtual void process([[maybe_unused]] typename Module::Context &context,\n> > -                            [[maybe_unused]] typename Module::FrameContext *frameContext,\n> > +                            [[maybe_unused]] typename Module::FrameContext &frameContext,\n> >                              [[maybe_unused]] const typename Module::Stats *stats)\n> >         {\n> >         }\n> > diff --git a/src/ipa/rkisp1/algorithms/agc.cpp b/src/ipa/rkisp1/algorithms/agc.cpp\n> > index 708c36ed1af8..7642796d69a3 100644\n> > --- a/src/ipa/rkisp1/algorithms/agc.cpp\n> > +++ b/src/ipa/rkisp1/algorithms/agc.cpp\n> > @@ -275,13 +275,14 @@ double Agc::measureBrightness(const rkisp1_cif_isp_hist_stat *hist) const\n> >  /**\n> >   * \\brief Process RkISP1 statistics, and run AGC operations\n> >   * \\param[in] context The shared IPA context\n> > + * \\param[in] frame The frame context sequence number\n> \n> I don't think this is in yet ... Perhaps this is for a later patch.\n\nIndeed. This is missing documentation of the frameContext argument\nthough. I'll fix that, with a \"while at it\" comment in the commit\nmessage.\n\n> With that,\n> \n> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> \n> >   * \\param[in] stats The RKISP1 statistics and ISP results\n> >   *\n> >   * Identify the current image brightness, and use that to estimate the optimal\n> >   * new exposure and gain for the scene.\n> >   */\n> >  void Agc::process(IPAContext &context,\n> > -                 [[maybe_unused]] IPAFrameContext *frameContext,\n> > +                 [[maybe_unused]] IPAFrameContext &frameContext,\n> >                   const rkisp1_stat_buffer *stats)\n> >  {\n> >         const rkisp1_cif_isp_stat *params = &stats->params;\n> > diff --git a/src/ipa/rkisp1/algorithms/agc.h b/src/ipa/rkisp1/algorithms/agc.h\n> > index 1c9818b7db2a..6a5723ecbcf8 100644\n> > --- a/src/ipa/rkisp1/algorithms/agc.h\n> > +++ b/src/ipa/rkisp1/algorithms/agc.h\n> > @@ -27,7 +27,7 @@ public:\n> >  \n> >         int configure(IPAContext &context, const IPACameraSensorInfo &configInfo) override;\n> >         void prepare(IPAContext &context, rkisp1_params_cfg *params) override;\n> > -       void process(IPAContext &context, IPAFrameContext *frameContext,\n> > +       void process(IPAContext &context, IPAFrameContext &frameContext,\n> >                      const rkisp1_stat_buffer *stats) override;\n> >  \n> >  private:\n> > diff --git a/src/ipa/rkisp1/algorithms/awb.cpp b/src/ipa/rkisp1/algorithms/awb.cpp\n> > index b12df21de4aa..2bc5d3aa16ab 100644\n> > --- a/src/ipa/rkisp1/algorithms/awb.cpp\n> > +++ b/src/ipa/rkisp1/algorithms/awb.cpp\n> > @@ -152,7 +152,7 @@ void Awb::queueRequest(IPAContext &context,\n> >   * \\copydoc libcamera::ipa::Algorithm::process\n> >   */\n> >  void Awb::process([[maybe_unused]] IPAContext &context,\n> > -                 [[maybe_unused]] IPAFrameContext *frameCtx,\n> > +                 [[maybe_unused]] IPAFrameContext &frameCtx,\n> >                   const rkisp1_stat_buffer *stats)\n> >  {\n> >         const rkisp1_cif_isp_stat *params = &stats->params;\n> > diff --git a/src/ipa/rkisp1/algorithms/awb.h b/src/ipa/rkisp1/algorithms/awb.h\n> > index 4917267bb99d..fc221acea617 100644\n> > --- a/src/ipa/rkisp1/algorithms/awb.h\n> > +++ b/src/ipa/rkisp1/algorithms/awb.h\n> > @@ -23,7 +23,7 @@ public:\n> >         void prepare(IPAContext &context, rkisp1_params_cfg *params) override;\n> >         void queueRequest(IPAContext &context, const uint32_t frame,\n> >                           const ControlList &controls) override;\n> > -       void process(IPAContext &context, IPAFrameContext *frameCtx,\n> > +       void process(IPAContext &context, IPAFrameContext &frameCtx,\n> >                      const rkisp1_stat_buffer *stats) override;\n> >  \n> >  private:\n> > diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp\n> > index 3ff1eb48f605..3bc6d4dd2784 100644\n> > --- a/src/ipa/rkisp1/rkisp1.cpp\n> > +++ b/src/ipa/rkisp1/rkisp1.cpp\n> > @@ -326,8 +326,11 @@ void IPARkISP1::processStatsBuffer(const uint32_t frame, const uint32_t bufferId\n> >  \n> >         unsigned int aeState = 0;\n> >  \n> > +       /* \\todo Obtain the frame context to pass to process from the FCQueue */\n> > +       IPAFrameContext frameContext;\n> > +\n> >         for (auto const &algo : algorithms())\n> > -               algo->process(context_, nullptr, stats);\n> > +               algo->process(context_, frameContext, stats);\n> >  \n> >         setControls(frame);\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 2DB63C3272\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 20 Sep 2022 19:06:44 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 92DA2621C4;\n\tTue, 20 Sep 2022 21:06:43 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 905D06218B\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 20 Sep 2022 21:06:41 +0200 (CEST)","from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi\n\t[62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id DE2066BE;\n\tTue, 20 Sep 2022 21:06:40 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1663700803;\n\tbh=3CHBE0CMr5CBWc5iM6ROIpXGDzmKzuIqX9tF1RPcuqY=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=Wu19KbxmC9YU4MOSVQPwe1+0ovPPwB+PMcnXsF4Mjru7PVnwliYSQ/A5adUZzwU0Z\n\tYUwz9JRxcOJr5fAu4QRZtSPS8Vr3pqnsWnF6jppBWAajPHMrBVWQVw5qEEYV8SyQt0\n\tRF9w+/rfsTSHU17zQsXAanSTrMhU3NO1IUktOAaKgshdbh4bieBbdzZLxZYQYxbMuh\n\tSiM2Q3OqF8GCgRNWVC7wZ4rOmD1vZ474Tgg2U7Ph/5fLmFfa8FiwoidGLTG7fZpCQM\n\tQBcJBhIpdnxdbt6ClKYAzIAa9o1OgMzAENdtSl9b52dMleAH/WPUj9UbGJTG/55CYD\n\tqRueUFgvCt9Lg==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1663700801;\n\tbh=3CHBE0CMr5CBWc5iM6ROIpXGDzmKzuIqX9tF1RPcuqY=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=BDEt3EyEIjggsq8XdzVpp9br/pyU2nUFbujIG8JYVgX9xixGz3e7u9gSjFnbXpYSk\n\tkLAGMr0Bc5wCSfcqpZoHWzsjB1PdGjsfr+pdjjtGusR0vxtv657FcXTGIn2S9RbOIX\n\t3j/pClbwa3IUhhlMPSEvu1aKCg/gla0r3dO8IfhU="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"BDEt3EyE\"; dkim-atps=neutral","Date":"Tue, 20 Sep 2022 22:06:26 +0300","To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Message-ID":"<YyoPMiz5r64k2i7k@pendragon.ideasonboard.com>","References":"<20220908014200.28728-1-laurent.pinchart@ideasonboard.com>\n\t<20220908014200.28728-4-laurent.pinchart@ideasonboard.com>\n\t<166368032082.3912877.3927370723272133210@Monstersaurus>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<166368032082.3912877.3927370723272133210@Monstersaurus>","Subject":"Re: [libcamera-devel] [PATCH v4 03/32] ipa: libipa: Pass a\n\treference instead of pointer to Algorithm::process()","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>","From":"Laurent Pinchart via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":25050,"web_url":"https://patchwork.libcamera.org/comment/25050/","msgid":"<20220921171737.eh7rqll6m2p5ncwq@uno.localdomain>","date":"2022-09-21T17:17:37","subject":"Re: [libcamera-devel] [PATCH v4 03/32] ipa: libipa: Pass a\n\treference instead of pointer to Algorithm::process()","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"content":"Hi Laurent,\n\nOn Thu, Sep 08, 2022 at 04:41:31AM +0300, Laurent Pinchart via libcamera-devel wrote:\n> Frame contexts will become the core component of IPA modules, always\n> available to functions of the algorithms. To indicate and prepare for\n> this, turn the frame context pointer passed to Algorithm::process() into\n> a reference.\n>\n> The RkISP1 IPA module doesn't use frame contexts yet, so pass a dummy\n> context for now.\n>\n> While at it, drop an unneeded [[maybe_unused]] from Agc::process().\n>\n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\nReviewed-by: Jacopo Mondi <jacopo@jmondi.org>\n\nThanks\n  j\n> ---\n>  src/ipa/ipu3/algorithms/af.cpp           | 2 +-\n>  src/ipa/ipu3/algorithms/af.h             | 2 +-\n>  src/ipa/ipu3/algorithms/agc.cpp          | 8 ++++----\n>  src/ipa/ipu3/algorithms/agc.h            | 4 ++--\n>  src/ipa/ipu3/algorithms/awb.cpp          | 2 +-\n>  src/ipa/ipu3/algorithms/awb.h            | 2 +-\n>  src/ipa/ipu3/algorithms/tone_mapping.cpp | 2 +-\n>  src/ipa/ipu3/algorithms/tone_mapping.h   | 2 +-\n>  src/ipa/ipu3/ipu3.cpp                    | 2 +-\n>  src/ipa/libipa/algorithm.h               | 2 +-\n>  src/ipa/rkisp1/algorithms/agc.cpp        | 3 ++-\n>  src/ipa/rkisp1/algorithms/agc.h          | 2 +-\n>  src/ipa/rkisp1/algorithms/awb.cpp        | 2 +-\n>  src/ipa/rkisp1/algorithms/awb.h          | 2 +-\n>  src/ipa/rkisp1/rkisp1.cpp                | 5 ++++-\n>  15 files changed, 23 insertions(+), 19 deletions(-)\n>\n> diff --git a/src/ipa/ipu3/algorithms/af.cpp b/src/ipa/ipu3/algorithms/af.cpp\n> index 9127c24f1287..5ab64bf88313 100644\n> --- a/src/ipa/ipu3/algorithms/af.cpp\n> +++ b/src/ipa/ipu3/algorithms/af.cpp\n> @@ -417,7 +417,7 @@ bool Af::afIsOutOfFocus(IPAContext &context)\n>   *\n>   * [1] Hill Climbing Algorithm, https://en.wikipedia.org/wiki/Hill_climbing\n>   */\n> -void Af::process(IPAContext &context, [[maybe_unused]] IPAFrameContext *frameContext,\n> +void Af::process(IPAContext &context, [[maybe_unused]] IPAFrameContext &frameContext,\n>  \t\t const ipu3_uapi_stats_3a *stats)\n>  {\n>  \t/* Evaluate the AF buffer length */\n> diff --git a/src/ipa/ipu3/algorithms/af.h b/src/ipa/ipu3/algorithms/af.h\n> index 9b93594898bb..29117e8bdd0d 100644\n> --- a/src/ipa/ipu3/algorithms/af.h\n> +++ b/src/ipa/ipu3/algorithms/af.h\n> @@ -32,7 +32,7 @@ public:\n>\n>  \tvoid prepare(IPAContext &context, ipu3_uapi_params *params) override;\n>  \tint configure(IPAContext &context, const IPAConfigInfo &configInfo) override;\n> -\tvoid process(IPAContext &context, IPAFrameContext *frameContext,\n> +\tvoid process(IPAContext &context, IPAFrameContext &frameContext,\n>  \t\t     const ipu3_uapi_stats_3a *stats) override;\n>\n>  private:\n> diff --git a/src/ipa/ipu3/algorithms/agc.cpp b/src/ipa/ipu3/algorithms/agc.cpp\n> index ed4809d98007..f8ca29640a44 100644\n> --- a/src/ipa/ipu3/algorithms/agc.cpp\n> +++ b/src/ipa/ipu3/algorithms/agc.cpp\n> @@ -183,13 +183,13 @@ utils::Duration Agc::filterExposure(utils::Duration exposureValue)\n>   * \\param[in] yGain The gain calculated based on the relative luminance target\n>   * \\param[in] iqMeanGain The gain calculated based on the relative luminance target\n>   */\n> -void Agc::computeExposure(IPAContext &context, IPAFrameContext *frameContext,\n> +void Agc::computeExposure(IPAContext &context, IPAFrameContext &frameContext,\n>  \t\t\t  double yGain, double iqMeanGain)\n>  {\n>  \tconst IPASessionConfiguration &configuration = context.configuration;\n>  \t/* Get the effective exposure and gain applied on the sensor. */\n> -\tuint32_t exposure = frameContext->sensor.exposure;\n> -\tdouble analogueGain = frameContext->sensor.gain;\n> +\tuint32_t exposure = frameContext.sensor.exposure;\n> +\tdouble analogueGain = frameContext.sensor.gain;\n>\n>  \t/* Use the highest of the two gain estimates. */\n>  \tdouble evGain = std::max(yGain, iqMeanGain);\n> @@ -323,7 +323,7 @@ double Agc::estimateLuminance(IPAActiveState &activeState,\n>   * Identify the current image brightness, and use that to estimate the optimal\n>   * new exposure and gain for the scene.\n>   */\n> -void Agc::process(IPAContext &context, [[maybe_unused]] IPAFrameContext *frameContext,\n> +void Agc::process(IPAContext &context, IPAFrameContext &frameContext,\n>  \t\t  const ipu3_uapi_stats_3a *stats)\n>  {\n>  \t/*\n> diff --git a/src/ipa/ipu3/algorithms/agc.h b/src/ipa/ipu3/algorithms/agc.h\n> index 105ae0f2aac6..876fbbb6b585 100644\n> --- a/src/ipa/ipu3/algorithms/agc.h\n> +++ b/src/ipa/ipu3/algorithms/agc.h\n> @@ -28,14 +28,14 @@ public:\n>  \t~Agc() = default;\n>\n>  \tint configure(IPAContext &context, const IPAConfigInfo &configInfo) override;\n> -\tvoid process(IPAContext &context, IPAFrameContext *frameContext,\n> +\tvoid process(IPAContext &context, IPAFrameContext &frameContext,\n>  \t\t     const ipu3_uapi_stats_3a *stats) override;\n>\n>  private:\n>  \tdouble measureBrightness(const ipu3_uapi_stats_3a *stats,\n>  \t\t\t\t const ipu3_uapi_grid_config &grid) const;\n>  \tutils::Duration filterExposure(utils::Duration currentExposure);\n> -\tvoid computeExposure(IPAContext &context, IPAFrameContext *frameContext,\n> +\tvoid computeExposure(IPAContext &context, IPAFrameContext &frameContext,\n>  \t\t\t     double yGain, double iqMeanGain);\n>  \tdouble estimateLuminance(IPAActiveState &activeState,\n>  \t\t\t\t const ipu3_uapi_grid_config &grid,\n> diff --git a/src/ipa/ipu3/algorithms/awb.cpp b/src/ipa/ipu3/algorithms/awb.cpp\n> index b658ee546b87..128f5d9d5351 100644\n> --- a/src/ipa/ipu3/algorithms/awb.cpp\n> +++ b/src/ipa/ipu3/algorithms/awb.cpp\n> @@ -387,7 +387,7 @@ void Awb::calculateWBGains(const ipu3_uapi_stats_3a *stats)\n>  /**\n>   * \\copydoc libcamera::ipa::Algorithm::process\n>   */\n> -void Awb::process(IPAContext &context, [[maybe_unused]] IPAFrameContext *frameContext,\n> +void Awb::process(IPAContext &context, [[maybe_unused]] IPAFrameContext &frameContext,\n>  \t\t  const ipu3_uapi_stats_3a *stats)\n>  {\n>  \tcalculateWBGains(stats);\n> diff --git a/src/ipa/ipu3/algorithms/awb.h b/src/ipa/ipu3/algorithms/awb.h\n> index 0acd21480845..ebbb2d58be7e 100644\n> --- a/src/ipa/ipu3/algorithms/awb.h\n> +++ b/src/ipa/ipu3/algorithms/awb.h\n> @@ -40,7 +40,7 @@ public:\n>\n>  \tint configure(IPAContext &context, const IPAConfigInfo &configInfo) override;\n>  \tvoid prepare(IPAContext &context, ipu3_uapi_params *params) override;\n> -\tvoid process(IPAContext &context, IPAFrameContext *frameContext,\n> +\tvoid process(IPAContext &context, IPAFrameContext &frameContext,\n>  \t\t     const ipu3_uapi_stats_3a *stats) override;\n>\n>  private:\n> diff --git a/src/ipa/ipu3/algorithms/tone_mapping.cpp b/src/ipa/ipu3/algorithms/tone_mapping.cpp\n> index c21647e8c51b..24faba9be2b2 100644\n> --- a/src/ipa/ipu3/algorithms/tone_mapping.cpp\n> +++ b/src/ipa/ipu3/algorithms/tone_mapping.cpp\n> @@ -78,7 +78,7 @@ void ToneMapping::prepare([[maybe_unused]] IPAContext &context,\n>   * The tone mapping look up table is generated as an inverse power curve from\n>   * our gamma setting.\n>   */\n> -void ToneMapping::process(IPAContext &context, [[maybe_unused]] IPAFrameContext *frameContext,\n> +void ToneMapping::process(IPAContext &context, [[maybe_unused]] IPAFrameContext &frameContext,\n>  \t\t\t  [[maybe_unused]] const ipu3_uapi_stats_3a *stats)\n>  {\n>  \t/*\n> diff --git a/src/ipa/ipu3/algorithms/tone_mapping.h b/src/ipa/ipu3/algorithms/tone_mapping.h\n> index d7d4800628f2..5be62f6ee9bd 100644\n> --- a/src/ipa/ipu3/algorithms/tone_mapping.h\n> +++ b/src/ipa/ipu3/algorithms/tone_mapping.h\n> @@ -20,7 +20,7 @@ public:\n>\n>  \tint configure(IPAContext &context, const IPAConfigInfo &configInfo) override;\n>  \tvoid prepare(IPAContext &context, ipu3_uapi_params *params) override;\n> -\tvoid process(IPAContext &context, IPAFrameContext *frameContext,\n> +\tvoid process(IPAContext &context, IPAFrameContext &frameContext,\n>  \t\t     const ipu3_uapi_stats_3a *stats) override;\n>\n>  private:\n> diff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp\n> index e3c1e8160759..f0c92507533c 100644\n> --- a/src/ipa/ipu3/ipu3.cpp\n> +++ b/src/ipa/ipu3/ipu3.cpp\n> @@ -616,7 +616,7 @@ void IPAIPU3::processStatsBuffer(const uint32_t frame,\n>  \tControlList ctrls(controls::controls);\n>\n>  \tfor (auto const &algo : algorithms())\n> -\t\talgo->process(context_, &frameContext, stats);\n> +\t\talgo->process(context_, frameContext, stats);\n>\n>  \tsetControls(frame);\n>\n> diff --git a/src/ipa/libipa/algorithm.h b/src/ipa/libipa/algorithm.h\n> index ccc659a63e3b..0fe3d772963a 100644\n> --- a/src/ipa/libipa/algorithm.h\n> +++ b/src/ipa/libipa/algorithm.h\n> @@ -49,7 +49,7 @@ public:\n>  \t}\n>\n>  \tvirtual void process([[maybe_unused]] typename Module::Context &context,\n> -\t\t\t     [[maybe_unused]] typename Module::FrameContext *frameContext,\n> +\t\t\t     [[maybe_unused]] typename Module::FrameContext &frameContext,\n>  \t\t\t     [[maybe_unused]] const typename Module::Stats *stats)\n>  \t{\n>  \t}\n> diff --git a/src/ipa/rkisp1/algorithms/agc.cpp b/src/ipa/rkisp1/algorithms/agc.cpp\n> index 708c36ed1af8..7642796d69a3 100644\n> --- a/src/ipa/rkisp1/algorithms/agc.cpp\n> +++ b/src/ipa/rkisp1/algorithms/agc.cpp\n> @@ -275,13 +275,14 @@ double Agc::measureBrightness(const rkisp1_cif_isp_hist_stat *hist) const\n>  /**\n>   * \\brief Process RkISP1 statistics, and run AGC operations\n>   * \\param[in] context The shared IPA context\n> + * \\param[in] frame The frame context sequence number\n>   * \\param[in] stats The RKISP1 statistics and ISP results\n>   *\n>   * Identify the current image brightness, and use that to estimate the optimal\n>   * new exposure and gain for the scene.\n>   */\n>  void Agc::process(IPAContext &context,\n> -\t\t  [[maybe_unused]] IPAFrameContext *frameContext,\n> +\t\t  [[maybe_unused]] IPAFrameContext &frameContext,\n>  \t\t  const rkisp1_stat_buffer *stats)\n>  {\n>  \tconst rkisp1_cif_isp_stat *params = &stats->params;\n> diff --git a/src/ipa/rkisp1/algorithms/agc.h b/src/ipa/rkisp1/algorithms/agc.h\n> index 1c9818b7db2a..6a5723ecbcf8 100644\n> --- a/src/ipa/rkisp1/algorithms/agc.h\n> +++ b/src/ipa/rkisp1/algorithms/agc.h\n> @@ -27,7 +27,7 @@ public:\n>\n>  \tint configure(IPAContext &context, const IPACameraSensorInfo &configInfo) override;\n>  \tvoid prepare(IPAContext &context, rkisp1_params_cfg *params) override;\n> -\tvoid process(IPAContext &context, IPAFrameContext *frameContext,\n> +\tvoid process(IPAContext &context, IPAFrameContext &frameContext,\n>  \t\t     const rkisp1_stat_buffer *stats) override;\n>\n>  private:\n> diff --git a/src/ipa/rkisp1/algorithms/awb.cpp b/src/ipa/rkisp1/algorithms/awb.cpp\n> index b12df21de4aa..2bc5d3aa16ab 100644\n> --- a/src/ipa/rkisp1/algorithms/awb.cpp\n> +++ b/src/ipa/rkisp1/algorithms/awb.cpp\n> @@ -152,7 +152,7 @@ void Awb::queueRequest(IPAContext &context,\n>   * \\copydoc libcamera::ipa::Algorithm::process\n>   */\n>  void Awb::process([[maybe_unused]] IPAContext &context,\n> -\t\t  [[maybe_unused]] IPAFrameContext *frameCtx,\n> +\t\t  [[maybe_unused]] IPAFrameContext &frameCtx,\n>  \t\t  const rkisp1_stat_buffer *stats)\n>  {\n>  \tconst rkisp1_cif_isp_stat *params = &stats->params;\n> diff --git a/src/ipa/rkisp1/algorithms/awb.h b/src/ipa/rkisp1/algorithms/awb.h\n> index 4917267bb99d..fc221acea617 100644\n> --- a/src/ipa/rkisp1/algorithms/awb.h\n> +++ b/src/ipa/rkisp1/algorithms/awb.h\n> @@ -23,7 +23,7 @@ public:\n>  \tvoid prepare(IPAContext &context, rkisp1_params_cfg *params) override;\n>  \tvoid queueRequest(IPAContext &context, const uint32_t frame,\n>  \t\t\t  const ControlList &controls) override;\n> -\tvoid process(IPAContext &context, IPAFrameContext *frameCtx,\n> +\tvoid process(IPAContext &context, IPAFrameContext &frameCtx,\n>  \t\t     const rkisp1_stat_buffer *stats) override;\n>\n>  private:\n> diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp\n> index 3ff1eb48f605..3bc6d4dd2784 100644\n> --- a/src/ipa/rkisp1/rkisp1.cpp\n> +++ b/src/ipa/rkisp1/rkisp1.cpp\n> @@ -326,8 +326,11 @@ void IPARkISP1::processStatsBuffer(const uint32_t frame, const uint32_t bufferId\n>\n>  \tunsigned int aeState = 0;\n>\n> +\t/* \\todo Obtain the frame context to pass to process from the FCQueue */\n> +\tIPAFrameContext frameContext;\n> +\n>  \tfor (auto const &algo : algorithms())\n> -\t\talgo->process(context_, nullptr, stats);\n> +\t\talgo->process(context_, frameContext, stats);\n>\n>  \tsetControls(frame);\n>\n> --\n> Regards,\n>\n> Laurent Pinchart\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 AC8D3C3272\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 21 Sep 2022 17:17:41 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id E0160621E0;\n\tWed, 21 Sep 2022 19:17:40 +0200 (CEST)","from relay11.mail.gandi.net (relay11.mail.gandi.net\n\t[217.70.178.231])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 17204600AA\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 21 Sep 2022 19:17:40 +0200 (CEST)","(Authenticated sender: jacopo@jmondi.org)\n\tby mail.gandi.net (Postfix) with ESMTPSA id 4C4BA10000C;\n\tWed, 21 Sep 2022 17:17:38 +0000 (UTC)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1663780660;\n\tbh=YuT19SExUZjnDlGBiAIkkPefK3Ebh7nBbSQ8i3jIhLo=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=kR5fvbOSgh/uwpO3nqDnnu7FXP42lhvC8ZV1WAtzSj2TzJgWp8GENq2Xs1kNTYtDT\n\t6pJ/BeAarPhDYSzp6SEYMymbY485ZTQxvp+Mmt8OIwYy0ZGN+zbaeR0HpurVO6ZJ0D\n\tqRm5Zn3S7QZvwLfx9GynsGxQg7zoqSeIpdXgUpaE43dxfG5xckLSXMjqnOsO6HbLHl\n\tyWwHBbqiIcbpUPaQ2Js6hf/+eOQtheguEZe5zgS0ADy7agr9o0AJr7DpAp4H1JmsLC\n\tOoamN1GSHVj8JhYMesEGM4yt5dhThTVb2V2kfAugDWUPVYavmJ3LumfGykxc8laTpF\n\tbFAX6jP8o0a2Q==","Date":"Wed, 21 Sep 2022 19:17:37 +0200","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Message-ID":"<20220921171737.eh7rqll6m2p5ncwq@uno.localdomain>","References":"<20220908014200.28728-1-laurent.pinchart@ideasonboard.com>\n\t<20220908014200.28728-4-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20220908014200.28728-4-laurent.pinchart@ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH v4 03/32] ipa: libipa: Pass a\n\treference instead of pointer to Algorithm::process()","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>","From":"Jacopo Mondi via libcamera-devel <libcamera-devel@lists.libcamera.org>","Reply-To":"Jacopo Mondi <jacopo@jmondi.org>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]