[{"id":24112,"web_url":"https://patchwork.libcamera.org/comment/24112/","msgid":"<20220725154842.c2kb2auji3vlsdci@uno.localdomain>","date":"2022-07-25T15:48:42","subject":"Re: [libcamera-devel] [RFC PATCH 09/12] ipa: libipa: algorithm:\n\tprocess(): Pass frame number","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"content":"Hi Kieran\n\nOn Thu, Jul 21, 2022 at 01:13:07PM +0100, Kieran Bingham via libcamera-devel wrote:\n> Pass the frame number of the current frame being processed.\n>\n> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n>\n>  - Use RKISP1FrameContext from the queue during IPARkISP1::processStatsBuffer\n>\n> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\nIf I'm not mistaken this is not currently used.\nHow do you think it will ? The algorithms receive the frameContext\nalready, so they don't need the frame id to access it, right ?\n\n> ---\n>  src/ipa/ipu3/algorithms/af.cpp           | 2 ++\n>  src/ipa/ipu3/algorithms/af.h             | 4 +++-\n>  src/ipa/ipu3/algorithms/agc.cpp          | 2 ++\n>  src/ipa/ipu3/algorithms/agc.h            | 3 ++-\n>  src/ipa/ipu3/algorithms/awb.cpp          | 1 +\n>  src/ipa/ipu3/algorithms/awb.h            | 3 ++-\n>  src/ipa/ipu3/algorithms/tone_mapping.cpp | 2 ++\n>  src/ipa/ipu3/algorithms/tone_mapping.h   | 3 ++-\n>  src/ipa/ipu3/ipu3.cpp                    | 2 +-\n>  src/ipa/libipa/algorithm.cpp             | 1 +\n>  src/ipa/libipa/algorithm.h               | 1 +\n>  src/ipa/rkisp1/algorithms/agc.cpp        | 1 +\n>  src/ipa/rkisp1/algorithms/agc.h          | 3 ++-\n>  src/ipa/rkisp1/algorithms/awb.cpp        | 1 +\n>  src/ipa/rkisp1/algorithms/awb.h          | 3 ++-\n>  src/ipa/rkisp1/rkisp1.cpp                | 2 +-\n>  16 files changed, 26 insertions(+), 8 deletions(-)\n>\n> diff --git a/src/ipa/ipu3/algorithms/af.cpp b/src/ipa/ipu3/algorithms/af.cpp\n> index 1faf92969ee5..29a9f520d93c 100644\n> --- a/src/ipa/ipu3/algorithms/af.cpp\n> +++ b/src/ipa/ipu3/algorithms/af.cpp\n> @@ -409,6 +409,7 @@ bool Af::afIsOutOfFocus(IPAContext context)\n>  /**\n>   * \\brief Determine the max contrast image and lens position.\n>   * \\param[in] context The IPA context.\n> + * \\param[in] frame The frame context sequence number\n>   * \\param[in] frameContext The current frame context\n>   * \\param[in] stats The statistics buffer of IPU3.\n>   *\n> @@ -424,6 +425,7 @@ bool Af::afIsOutOfFocus(IPAContext context)\n>   * [1] Hill Climbing Algorithm, https://en.wikipedia.org/wiki/Hill_climbing\n>   */\n>  void Af::process(IPAContext &context,\n> +\t\t [[maybe_unused]] unsigned int frame,\n>  \t\t [[maybe_unused]] IPU3FrameContext &frameContext,\n>  \t\t const ipu3_uapi_stats_3a *stats)\n>  {\n> diff --git a/src/ipa/ipu3/algorithms/af.h b/src/ipa/ipu3/algorithms/af.h\n> index 4e2bbd08c3bf..977112506c98 100644\n> --- a/src/ipa/ipu3/algorithms/af.h\n> +++ b/src/ipa/ipu3/algorithms/af.h\n> @@ -31,10 +31,12 @@ public:\n>  \t~Af() = default;\n>\n>  \tint configure(IPAContext &context, const IPAConfigInfo &configInfo) override;\n> +\n>  \tvoid prepare(IPAContext &context, unsigned int frame,\n>  \t\t     IPU3FrameContext &frameContext,\n>  \t\t     ipu3_uapi_params *params) override;\n> -\tvoid process(IPAContext &context, IPU3FrameContext &frameContext,\n> +\tvoid process(IPAContext &context, unsigned int frame,\n> +\t\t     IPU3FrameContext &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 92ea6249798d..00ef54d45574 100644\n> --- a/src/ipa/ipu3/algorithms/agc.cpp\n> +++ b/src/ipa/ipu3/algorithms/agc.cpp\n> @@ -317,6 +317,7 @@ double Agc::estimateLuminance(IPAActiveState &activeState,\n>  /**\n>   * \\brief Process IPU3 statistics, and run AGC operations\n>   * \\param[in] context The shared IPA context\n> + * \\param[in] frame The current frame sequence number\n>   * \\param[in] frameContext The current frame context\n>   * \\param[in] stats The IPU3 statistics and ISP results\n>   *\n> @@ -324,6 +325,7 @@ double Agc::estimateLuminance(IPAActiveState &activeState,\n>   * new exposure and gain for the scene.\n>   */\n>  void Agc::process(IPAContext &context,\n> +\t\t  [[maybe_unused]] unsigned int frame,\n>  \t\t  IPU3FrameContext &frameContext,\n>  \t\t  const ipu3_uapi_stats_3a *stats)\n>  {\n> diff --git a/src/ipa/ipu3/algorithms/agc.h b/src/ipa/ipu3/algorithms/agc.h\n> index 96585f48933f..5bb9dc8f610e 100644\n> --- a/src/ipa/ipu3/algorithms/agc.h\n> +++ b/src/ipa/ipu3/algorithms/agc.h\n> @@ -28,7 +28,8 @@ public:\n>  \t~Agc() = default;\n>\n>  \tint configure(IPAContext &context, const IPAConfigInfo &configInfo) override;\n> -\tvoid process(IPAContext &context, IPU3FrameContext &frameContext,\n> +\tvoid process(IPAContext &context, unsigned int frame,\n> +\t\t     IPU3FrameContext &frameContext,\n>  \t\t     const ipu3_uapi_stats_3a *stats) override;\n>\n>  private:\n> diff --git a/src/ipa/ipu3/algorithms/awb.cpp b/src/ipa/ipu3/algorithms/awb.cpp\n> index b110ad404fd1..8943ead6fc4c 100644\n> --- a/src/ipa/ipu3/algorithms/awb.cpp\n> +++ b/src/ipa/ipu3/algorithms/awb.cpp\n> @@ -388,6 +388,7 @@ void Awb::calculateWBGains(const ipu3_uapi_stats_3a *stats)\n>   * \\copydoc libcamera::ipa::Algorithm::process\n>   */\n>  void Awb::process(IPAContext &context,\n> +\t\t  [[maybe_unused]] unsigned int frame,\n>  \t\t  [[maybe_unused]] IPU3FrameContext &frameContext,\n>  \t\t  const ipu3_uapi_stats_3a *stats)\n>  {\n> diff --git a/src/ipa/ipu3/algorithms/awb.h b/src/ipa/ipu3/algorithms/awb.h\n> index 731e5bae17de..094b177672ca 100644\n> --- a/src/ipa/ipu3/algorithms/awb.h\n> +++ b/src/ipa/ipu3/algorithms/awb.h\n> @@ -43,7 +43,8 @@ public:\n>  \tvoid prepare(IPAContext &context, unsigned int frame,\n>  \t\t     IPU3FrameContext &frameContext,\n>  \t\t     ipu3_uapi_params *params) override;\n> -\tvoid process(IPAContext &context, IPU3FrameContext &frameContext,\n> +\tvoid process(IPAContext &context, unsigned int frame,\n> +\t\t     IPU3FrameContext &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 9ca3f471cbaf..e545011ce203 100644\n> --- a/src/ipa/ipu3/algorithms/tone_mapping.cpp\n> +++ b/src/ipa/ipu3/algorithms/tone_mapping.cpp\n> @@ -76,6 +76,7 @@ void ToneMapping::prepare([[maybe_unused]] IPAContext &context,\n>  /**\n>   * \\brief Calculate the tone mapping look up table\n>   * \\param context The shared IPA context\n> + * \\param frame The current frame sequence number\n>   * \\param frameContext The current frame context\n>   * \\param stats The IPU3 statistics and ISP results\n>   *\n> @@ -83,6 +84,7 @@ void ToneMapping::prepare([[maybe_unused]] IPAContext &context,\n>   * our gamma setting.\n>   */\n>  void ToneMapping::process(IPAContext &context,\n> +\t\t\t  [[maybe_unused]] unsigned int frame,\n>  \t\t\t  [[maybe_unused]] IPU3FrameContext &frameContext,\n>  \t\t\t  [[maybe_unused]] const ipu3_uapi_stats_3a *stats)\n>  {\n> diff --git a/src/ipa/ipu3/algorithms/tone_mapping.h b/src/ipa/ipu3/algorithms/tone_mapping.h\n> index cfb3de01b7f3..a3ab285c927f 100644\n> --- a/src/ipa/ipu3/algorithms/tone_mapping.h\n> +++ b/src/ipa/ipu3/algorithms/tone_mapping.h\n> @@ -21,7 +21,8 @@ public:\n>  \tint configure(IPAContext &context, const IPAConfigInfo &configInfo) override;\n>  \tvoid prepare(IPAContext &context, unsigned int frame,\n>  \t\t     IPU3FrameContext &frameContext, ipu3_uapi_params *params) override;\n> -\tvoid process(IPAContext &context, IPU3FrameContext &frameContext,\n> +\tvoid process(IPAContext &context, unsigned int frame,\n> +\t\t     IPU3FrameContext &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 5663b1f4bb51..4d7a54f8d1a5 100644\n> --- a/src/ipa/ipu3/ipu3.cpp\n> +++ b/src/ipa/ipu3/ipu3.cpp\n> @@ -585,7 +585,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_, frame, frameContext, stats);\n>\n>  \tsetControls(frame);\n>\n> diff --git a/src/ipa/libipa/algorithm.cpp b/src/ipa/libipa/algorithm.cpp\n> index bc7c130d3e09..65e9e8a56fc4 100644\n> --- a/src/ipa/libipa/algorithm.cpp\n> +++ b/src/ipa/libipa/algorithm.cpp\n> @@ -87,6 +87,7 @@ namespace ipa {\n>   * \\fn Algorithm::process()\n>   * \\brief Process ISP statistics, and run algorithm operations\n>   * \\param[in] context The shared IPA context\n> + * \\param[in] frame The frame context sequence number\n>   * \\param[in] frameContext The current frame's context\n>   * \\param[in] stats The IPA statistics and ISP results\n>   *\n> diff --git a/src/ipa/libipa/algorithm.h b/src/ipa/libipa/algorithm.h\n> index ce5c7cc491d8..1d2544a767eb 100644\n> --- a/src/ipa/libipa/algorithm.h\n> +++ b/src/ipa/libipa/algorithm.h\n> @@ -43,6 +43,7 @@ public:\n>  \t}\n>\n>  \tvirtual void process([[maybe_unused]] typename Module::Context &context,\n> +\t\t\t     [[maybe_unused]] unsigned int frame,\n>  \t\t\t     [[maybe_unused]] typename Module::FrameContext &frameContext,\n>  \t\t\t     [[maybe_unused]] const typename Module::Stats *stats)\n>  \t{\n> diff --git a/src/ipa/rkisp1/algorithms/agc.cpp b/src/ipa/rkisp1/algorithms/agc.cpp\n> index 2d436511caf7..60018db73260 100644\n> --- a/src/ipa/rkisp1/algorithms/agc.cpp\n> +++ b/src/ipa/rkisp1/algorithms/agc.cpp\n> @@ -281,6 +281,7 @@ double Agc::measureBrightness(const rkisp1_cif_isp_hist_stat *hist) const\n>   * new exposure and gain for the scene.\n>   */\n>  void Agc::process(IPAContext &context,\n> +\t\t  [[maybe_unused]] unsigned int frame,\n>  \t\t  [[maybe_unused]] RKISP1FrameContext &frameContext,\n>  \t\t  const rkisp1_stat_buffer *stats)\n>  {\n> diff --git a/src/ipa/rkisp1/algorithms/agc.h b/src/ipa/rkisp1/algorithms/agc.h\n> index 7844cd2e3b47..05bda50c5962 100644\n> --- a/src/ipa/rkisp1/algorithms/agc.h\n> +++ b/src/ipa/rkisp1/algorithms/agc.h\n> @@ -31,7 +31,8 @@ public:\n>  \tvoid prepare(IPAContext &context, unsigned int frame,\n>  \t\t     RKISP1FrameContext &frameContext,\n>  \t\t     rkisp1_params_cfg *params) override;\n> -\tvoid process(IPAContext &context, RKISP1FrameContext &frameContext,\n> +\tvoid process(IPAContext &context, unsigned int frame,\n> +\t\t     RKISP1FrameContext &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 1af6d98c5252..b3ffa6cda4ea 100644\n> --- a/src/ipa/rkisp1/algorithms/awb.cpp\n> +++ b/src/ipa/rkisp1/algorithms/awb.cpp\n> @@ -123,6 +123,7 @@ void Awb::prepare(IPAContext &context,\n>   * \\copydoc libcamera::ipa::Algorithm::process\n>   */\n>  void Awb::process([[maybe_unused]] IPAContext &context,\n> +\t\t  [[maybe_unused]] unsigned int frame,\n>  \t\t  [[maybe_unused]] RKISP1FrameContext &frameCtx,\n>  \t\t  const rkisp1_stat_buffer *stats)\n>  {\n> diff --git a/src/ipa/rkisp1/algorithms/awb.h b/src/ipa/rkisp1/algorithms/awb.h\n> index 8fd5b706861a..510fbad9958e 100644\n> --- a/src/ipa/rkisp1/algorithms/awb.h\n> +++ b/src/ipa/rkisp1/algorithms/awb.h\n> @@ -25,7 +25,8 @@ public:\n>  \tvoid prepare(IPAContext &context, unsigned int frame,\n>  \t\t     RKISP1FrameContext &frameContext,\n>  \t\t     rkisp1_params_cfg *params) override;\n> -\tvoid process(IPAContext &context, RKISP1FrameContext &frameCtx,\n> +\tvoid process(IPAContext &context, unsigned int frame,\n> +\t\t     RKISP1FrameContext &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 f97484ce5030..b468e08a67fa 100644\n> --- a/src/ipa/rkisp1/rkisp1.cpp\n> +++ b/src/ipa/rkisp1/rkisp1.cpp\n> @@ -308,7 +308,7 @@ void IPARkISP1::processStatsBuffer(const uint32_t frame, const uint32_t bufferId\n>  \tunsigned int aeState = 0;\n>\n>  \tfor (auto const &algo : algorithms())\n> -\t\talgo->process(context_, frameContext, stats);\n> +\t\talgo->process(context_, frame, frameContext, stats);\n>\n>  \tsetControls(frame);\n>\n> --\n> 2.34.1\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 66EC2C3275\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 25 Jul 2022 15:48:46 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 279DB63312;\n\tMon, 25 Jul 2022 17:48:46 +0200 (CEST)","from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net\n\t[217.70.183.197])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 8BE356330A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 25 Jul 2022 17:48:44 +0200 (CEST)","(Authenticated sender: jacopo@jmondi.org)\n\tby mail.gandi.net (Postfix) with ESMTPSA id 26D331C0004;\n\tMon, 25 Jul 2022 15:48:43 +0000 (UTC)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1658764126;\n\tbh=AJ45Bf4rlajdQrVKoacFMYrKvkUOIA0PKSFY+onzJfQ=;\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=CrzH3DV9wB+k7CuccQ8yrV4yHbjA0OpwiP8pLIXYfhzd6RPF0itaJwKqVrkRBNNrC\n\ttYiq6WXnWI86+Fmp9M4uro+k9jTKBb3XMGcAJisqvDCTFP1ddoLkx0HrboTZw8pV2/\n\t9uDX8D47hIrupWn9UyZWqAU2M/3Ug+e+TE8GRBzdrnuL2ueO86wHZSlA478ereCc8m\n\tgfTZ/LzGKd6gzgok1FC46U//oqeM/hm1ohtNErANf5qnK2jFICjWVCeAFPjc4txrEk\n\tZH0sn6NORG3NB/7v3DbyOhFm/adSOa3R4J0KsxQdMMvIAvuY5WqEWIq3T7QVaKtm62\n\tHmGn11Qbburnw==","Date":"Mon, 25 Jul 2022 17:48:42 +0200","To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Message-ID":"<20220725154842.c2kb2auji3vlsdci@uno.localdomain>","References":"<20220721121310.1286862-1-kieran.bingham@ideasonboard.com>\n\t<20220721121310.1286862-10-kieran.bingham@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20220721121310.1286862-10-kieran.bingham@ideasonboard.com>","Subject":"Re: [libcamera-devel] [RFC PATCH 09/12] ipa: libipa: algorithm:\n\tprocess(): Pass frame number","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 <libcamera-devel@lists.libcamera.org>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":24155,"web_url":"https://patchwork.libcamera.org/comment/24155/","msgid":"<165886141102.3981176.17463890441482204279@Monstersaurus>","date":"2022-07-26T18:50:11","subject":"Re: [libcamera-devel] [RFC PATCH 09/12] ipa: libipa: algorithm:\n\tprocess(): Pass frame number","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Jacopo Mondi (2022-07-25 16:48:42)\n> Hi Kieran\n> \n> On Thu, Jul 21, 2022 at 01:13:07PM +0100, Kieran Bingham via libcamera-devel wrote:\n> > Pass the frame number of the current frame being processed.\n> >\n> > Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> >\n> >  - Use RKISP1FrameContext from the queue during IPARkISP1::processStatsBuffer\n> >\n> > Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> \n> If I'm not mistaken this is not currently used.\n> How do you think it will ? The algorithms receive the frameContext\n> already, so they don't need the frame id to access it, right ?\n\nFor two reasons:\n - 1: Consistency of the other runtime calls \n      \"Context, Frame, FrameContext, __VAR_ARGS__\"\n\n - 2: To enable algorithms to be explicitly aware of the current frame\n      'time' being worked on.\n      While the current frame context is passed in, algorithms may\n      choose to obtain a different one.\n      For instance, the AGC may know that there is a 2 frame latency on\n      manual controls taking effect, and may instead perform a\n      FrameContext &peekAhead = fcq.get(frame + agcLatency_);\n\n\n--\nKieran\n\n> > ---\n> >  src/ipa/ipu3/algorithms/af.cpp           | 2 ++\n> >  src/ipa/ipu3/algorithms/af.h             | 4 +++-\n> >  src/ipa/ipu3/algorithms/agc.cpp          | 2 ++\n> >  src/ipa/ipu3/algorithms/agc.h            | 3 ++-\n> >  src/ipa/ipu3/algorithms/awb.cpp          | 1 +\n> >  src/ipa/ipu3/algorithms/awb.h            | 3 ++-\n> >  src/ipa/ipu3/algorithms/tone_mapping.cpp | 2 ++\n> >  src/ipa/ipu3/algorithms/tone_mapping.h   | 3 ++-\n> >  src/ipa/ipu3/ipu3.cpp                    | 2 +-\n> >  src/ipa/libipa/algorithm.cpp             | 1 +\n> >  src/ipa/libipa/algorithm.h               | 1 +\n> >  src/ipa/rkisp1/algorithms/agc.cpp        | 1 +\n> >  src/ipa/rkisp1/algorithms/agc.h          | 3 ++-\n> >  src/ipa/rkisp1/algorithms/awb.cpp        | 1 +\n> >  src/ipa/rkisp1/algorithms/awb.h          | 3 ++-\n> >  src/ipa/rkisp1/rkisp1.cpp                | 2 +-\n> >  16 files changed, 26 insertions(+), 8 deletions(-)\n> >\n> > diff --git a/src/ipa/ipu3/algorithms/af.cpp b/src/ipa/ipu3/algorithms/af.cpp\n> > index 1faf92969ee5..29a9f520d93c 100644\n> > --- a/src/ipa/ipu3/algorithms/af.cpp\n> > +++ b/src/ipa/ipu3/algorithms/af.cpp\n> > @@ -409,6 +409,7 @@ bool Af::afIsOutOfFocus(IPAContext context)\n> >  /**\n> >   * \\brief Determine the max contrast image and lens position.\n> >   * \\param[in] context The IPA context.\n> > + * \\param[in] frame The frame context sequence number\n> >   * \\param[in] frameContext The current frame context\n> >   * \\param[in] stats The statistics buffer of IPU3.\n> >   *\n> > @@ -424,6 +425,7 @@ bool Af::afIsOutOfFocus(IPAContext context)\n> >   * [1] Hill Climbing Algorithm, https://en.wikipedia.org/wiki/Hill_climbing\n> >   */\n> >  void Af::process(IPAContext &context,\n> > +              [[maybe_unused]] unsigned int frame,\n> >                [[maybe_unused]] IPU3FrameContext &frameContext,\n> >                const ipu3_uapi_stats_3a *stats)\n> >  {\n> > diff --git a/src/ipa/ipu3/algorithms/af.h b/src/ipa/ipu3/algorithms/af.h\n> > index 4e2bbd08c3bf..977112506c98 100644\n> > --- a/src/ipa/ipu3/algorithms/af.h\n> > +++ b/src/ipa/ipu3/algorithms/af.h\n> > @@ -31,10 +31,12 @@ public:\n> >       ~Af() = default;\n> >\n> >       int configure(IPAContext &context, const IPAConfigInfo &configInfo) override;\n> > +\n> >       void prepare(IPAContext &context, unsigned int frame,\n> >                    IPU3FrameContext &frameContext,\n> >                    ipu3_uapi_params *params) override;\n> > -     void process(IPAContext &context, IPU3FrameContext &frameContext,\n> > +     void process(IPAContext &context, unsigned int frame,\n> > +                  IPU3FrameContext &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 92ea6249798d..00ef54d45574 100644\n> > --- a/src/ipa/ipu3/algorithms/agc.cpp\n> > +++ b/src/ipa/ipu3/algorithms/agc.cpp\n> > @@ -317,6 +317,7 @@ double Agc::estimateLuminance(IPAActiveState &activeState,\n> >  /**\n> >   * \\brief Process IPU3 statistics, and run AGC operations\n> >   * \\param[in] context The shared IPA context\n> > + * \\param[in] frame The current frame sequence number\n> >   * \\param[in] frameContext The current frame context\n> >   * \\param[in] stats The IPU3 statistics and ISP results\n> >   *\n> > @@ -324,6 +325,7 @@ double Agc::estimateLuminance(IPAActiveState &activeState,\n> >   * new exposure and gain for the scene.\n> >   */\n> >  void Agc::process(IPAContext &context,\n> > +               [[maybe_unused]] unsigned int frame,\n> >                 IPU3FrameContext &frameContext,\n> >                 const ipu3_uapi_stats_3a *stats)\n> >  {\n> > diff --git a/src/ipa/ipu3/algorithms/agc.h b/src/ipa/ipu3/algorithms/agc.h\n> > index 96585f48933f..5bb9dc8f610e 100644\n> > --- a/src/ipa/ipu3/algorithms/agc.h\n> > +++ b/src/ipa/ipu3/algorithms/agc.h\n> > @@ -28,7 +28,8 @@ public:\n> >       ~Agc() = default;\n> >\n> >       int configure(IPAContext &context, const IPAConfigInfo &configInfo) override;\n> > -     void process(IPAContext &context, IPU3FrameContext &frameContext,\n> > +     void process(IPAContext &context, unsigned int frame,\n> > +                  IPU3FrameContext &frameContext,\n> >                    const ipu3_uapi_stats_3a *stats) override;\n> >\n> >  private:\n> > diff --git a/src/ipa/ipu3/algorithms/awb.cpp b/src/ipa/ipu3/algorithms/awb.cpp\n> > index b110ad404fd1..8943ead6fc4c 100644\n> > --- a/src/ipa/ipu3/algorithms/awb.cpp\n> > +++ b/src/ipa/ipu3/algorithms/awb.cpp\n> > @@ -388,6 +388,7 @@ void Awb::calculateWBGains(const ipu3_uapi_stats_3a *stats)\n> >   * \\copydoc libcamera::ipa::Algorithm::process\n> >   */\n> >  void Awb::process(IPAContext &context,\n> > +               [[maybe_unused]] unsigned int frame,\n> >                 [[maybe_unused]] IPU3FrameContext &frameContext,\n> >                 const ipu3_uapi_stats_3a *stats)\n> >  {\n> > diff --git a/src/ipa/ipu3/algorithms/awb.h b/src/ipa/ipu3/algorithms/awb.h\n> > index 731e5bae17de..094b177672ca 100644\n> > --- a/src/ipa/ipu3/algorithms/awb.h\n> > +++ b/src/ipa/ipu3/algorithms/awb.h\n> > @@ -43,7 +43,8 @@ public:\n> >       void prepare(IPAContext &context, unsigned int frame,\n> >                    IPU3FrameContext &frameContext,\n> >                    ipu3_uapi_params *params) override;\n> > -     void process(IPAContext &context, IPU3FrameContext &frameContext,\n> > +     void process(IPAContext &context, unsigned int frame,\n> > +                  IPU3FrameContext &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 9ca3f471cbaf..e545011ce203 100644\n> > --- a/src/ipa/ipu3/algorithms/tone_mapping.cpp\n> > +++ b/src/ipa/ipu3/algorithms/tone_mapping.cpp\n> > @@ -76,6 +76,7 @@ void ToneMapping::prepare([[maybe_unused]] IPAContext &context,\n> >  /**\n> >   * \\brief Calculate the tone mapping look up table\n> >   * \\param context The shared IPA context\n> > + * \\param frame The current frame sequence number\n> >   * \\param frameContext The current frame context\n> >   * \\param stats The IPU3 statistics and ISP results\n> >   *\n> > @@ -83,6 +84,7 @@ void ToneMapping::prepare([[maybe_unused]] IPAContext &context,\n> >   * our gamma setting.\n> >   */\n> >  void ToneMapping::process(IPAContext &context,\n> > +                       [[maybe_unused]] unsigned int frame,\n> >                         [[maybe_unused]] IPU3FrameContext &frameContext,\n> >                         [[maybe_unused]] const ipu3_uapi_stats_3a *stats)\n> >  {\n> > diff --git a/src/ipa/ipu3/algorithms/tone_mapping.h b/src/ipa/ipu3/algorithms/tone_mapping.h\n> > index cfb3de01b7f3..a3ab285c927f 100644\n> > --- a/src/ipa/ipu3/algorithms/tone_mapping.h\n> > +++ b/src/ipa/ipu3/algorithms/tone_mapping.h\n> > @@ -21,7 +21,8 @@ public:\n> >       int configure(IPAContext &context, const IPAConfigInfo &configInfo) override;\n> >       void prepare(IPAContext &context, unsigned int frame,\n> >                    IPU3FrameContext &frameContext, ipu3_uapi_params *params) override;\n> > -     void process(IPAContext &context, IPU3FrameContext &frameContext,\n> > +     void process(IPAContext &context, unsigned int frame,\n> > +                  IPU3FrameContext &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 5663b1f4bb51..4d7a54f8d1a5 100644\n> > --- a/src/ipa/ipu3/ipu3.cpp\n> > +++ b/src/ipa/ipu3/ipu3.cpp\n> > @@ -585,7 +585,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_, frame, frameContext, stats);\n> >\n> >       setControls(frame);\n> >\n> > diff --git a/src/ipa/libipa/algorithm.cpp b/src/ipa/libipa/algorithm.cpp\n> > index bc7c130d3e09..65e9e8a56fc4 100644\n> > --- a/src/ipa/libipa/algorithm.cpp\n> > +++ b/src/ipa/libipa/algorithm.cpp\n> > @@ -87,6 +87,7 @@ namespace ipa {\n> >   * \\fn Algorithm::process()\n> >   * \\brief Process ISP statistics, and run algorithm operations\n> >   * \\param[in] context The shared IPA context\n> > + * \\param[in] frame The frame context sequence number\n> >   * \\param[in] frameContext The current frame's context\n> >   * \\param[in] stats The IPA statistics and ISP results\n> >   *\n> > diff --git a/src/ipa/libipa/algorithm.h b/src/ipa/libipa/algorithm.h\n> > index ce5c7cc491d8..1d2544a767eb 100644\n> > --- a/src/ipa/libipa/algorithm.h\n> > +++ b/src/ipa/libipa/algorithm.h\n> > @@ -43,6 +43,7 @@ public:\n> >       }\n> >\n> >       virtual void process([[maybe_unused]] typename Module::Context &context,\n> > +                          [[maybe_unused]] unsigned int frame,\n> >                            [[maybe_unused]] typename Module::FrameContext &frameContext,\n> >                            [[maybe_unused]] const typename Module::Stats *stats)\n> >       {\n> > diff --git a/src/ipa/rkisp1/algorithms/agc.cpp b/src/ipa/rkisp1/algorithms/agc.cpp\n> > index 2d436511caf7..60018db73260 100644\n> > --- a/src/ipa/rkisp1/algorithms/agc.cpp\n> > +++ b/src/ipa/rkisp1/algorithms/agc.cpp\n> > @@ -281,6 +281,7 @@ double Agc::measureBrightness(const rkisp1_cif_isp_hist_stat *hist) const\n> >   * new exposure and gain for the scene.\n> >   */\n> >  void Agc::process(IPAContext &context,\n> > +               [[maybe_unused]] unsigned int frame,\n> >                 [[maybe_unused]] RKISP1FrameContext &frameContext,\n> >                 const rkisp1_stat_buffer *stats)\n> >  {\n> > diff --git a/src/ipa/rkisp1/algorithms/agc.h b/src/ipa/rkisp1/algorithms/agc.h\n> > index 7844cd2e3b47..05bda50c5962 100644\n> > --- a/src/ipa/rkisp1/algorithms/agc.h\n> > +++ b/src/ipa/rkisp1/algorithms/agc.h\n> > @@ -31,7 +31,8 @@ public:\n> >       void prepare(IPAContext &context, unsigned int frame,\n> >                    RKISP1FrameContext &frameContext,\n> >                    rkisp1_params_cfg *params) override;\n> > -     void process(IPAContext &context, RKISP1FrameContext &frameContext,\n> > +     void process(IPAContext &context, unsigned int frame,\n> > +                  RKISP1FrameContext &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 1af6d98c5252..b3ffa6cda4ea 100644\n> > --- a/src/ipa/rkisp1/algorithms/awb.cpp\n> > +++ b/src/ipa/rkisp1/algorithms/awb.cpp\n> > @@ -123,6 +123,7 @@ void Awb::prepare(IPAContext &context,\n> >   * \\copydoc libcamera::ipa::Algorithm::process\n> >   */\n> >  void Awb::process([[maybe_unused]] IPAContext &context,\n> > +               [[maybe_unused]] unsigned int frame,\n> >                 [[maybe_unused]] RKISP1FrameContext &frameCtx,\n> >                 const rkisp1_stat_buffer *stats)\n> >  {\n> > diff --git a/src/ipa/rkisp1/algorithms/awb.h b/src/ipa/rkisp1/algorithms/awb.h\n> > index 8fd5b706861a..510fbad9958e 100644\n> > --- a/src/ipa/rkisp1/algorithms/awb.h\n> > +++ b/src/ipa/rkisp1/algorithms/awb.h\n> > @@ -25,7 +25,8 @@ public:\n> >       void prepare(IPAContext &context, unsigned int frame,\n> >                    RKISP1FrameContext &frameContext,\n> >                    rkisp1_params_cfg *params) override;\n> > -     void process(IPAContext &context, RKISP1FrameContext &frameCtx,\n> > +     void process(IPAContext &context, unsigned int frame,\n> > +                  RKISP1FrameContext &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 f97484ce5030..b468e08a67fa 100644\n> > --- a/src/ipa/rkisp1/rkisp1.cpp\n> > +++ b/src/ipa/rkisp1/rkisp1.cpp\n> > @@ -308,7 +308,7 @@ void IPARkISP1::processStatsBuffer(const uint32_t frame, const uint32_t bufferId\n> >       unsigned int aeState = 0;\n> >\n> >       for (auto const &algo : algorithms())\n> > -             algo->process(context_, frameContext, stats);\n> > +             algo->process(context_, frame, frameContext, stats);\n> >\n> >       setControls(frame);\n> >\n> > --\n> > 2.34.1\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 E5751BE173\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 26 Jul 2022 18:50:15 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 4D9C363312;\n\tTue, 26 Jul 2022 20:50:15 +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 0C41B60487\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 26 Jul 2022 20:50:14 +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 4F9F1735;\n\tTue, 26 Jul 2022 20:50:13 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1658861415;\n\tbh=Lk40hXA4Re3LNXngbnlZtLpa23eajOLupUgX/TUfnRg=;\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:Cc:\n\tFrom;\n\tb=tPMWth1b6J1uS8HMRQSZofXyrCLcZxfBqnr+kQA638+BFVvWJG3BdtO+9RGq5J6AM\n\tefqhx/UwBoSOL+CYkuwDkrPdST1AmF8YJ4uIUEtDM0q7y1pirhC5cLC/Ynj+mtHlA0\n\tTBnaZ7gPE30Kbh+Ljhdg+A7M6ES3kNT3iXBhFIJ/P7GtxpA6jD/7gprWjcKObF51+s\n\th98K3RESMTH4/kPlMkcJUtjVV42+XNhcgrk0o8i+dV/bIiT2Azdo/pvd5O8HyxvtfD\n\t3cMVZOWq+sRk12BUovAwvKrk5+//K7kn87BUhROtxAk9ViMYo3EqHpLHt0mDBh3/or\n\tE394B2hazTY7Q==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1658861413;\n\tbh=Lk40hXA4Re3LNXngbnlZtLpa23eajOLupUgX/TUfnRg=;\n\th=In-Reply-To:References:Subject:From:Cc:To:Date:From;\n\tb=b9hWPHQReOJXUgxiCcMJ9/a5J/9BHP1CeKe1BnCcf4ahQtNvmULyngX8bymXvzJMU\n\tZCVCJ2zwr/ufW+UQun5qXVZcN75/CDJCSLUudmQR0/G+s8PAIigmy9936PSNjNicIi\n\tDxVt78iqQbXrtj7dbKRzw8Siy3EuAnTlMbwesPMs="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"b9hWPHQR\"; dkim-atps=neutral","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20220725154842.c2kb2auji3vlsdci@uno.localdomain>","References":"<20220721121310.1286862-1-kieran.bingham@ideasonboard.com>\n\t<20220721121310.1286862-10-kieran.bingham@ideasonboard.com>\n\t<20220725154842.c2kb2auji3vlsdci@uno.localdomain>","To":"Jacopo Mondi <jacopo@jmondi.org>","Date":"Tue, 26 Jul 2022 19:50:11 +0100","Message-ID":"<165886141102.3981176.17463890441482204279@Monstersaurus>","User-Agent":"alot/0.10","Subject":"Re: [libcamera-devel] [RFC PATCH 09/12] ipa: libipa: algorithm:\n\tprocess(): Pass frame number","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>","Cc":"libcamera devel <libcamera-devel@lists.libcamera.org>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]