[{"id":21927,"web_url":"https://patchwork.libcamera.org/comment/21927/","msgid":"<9c2de696-a910-fc36-a4d5-8298a1620229@ideasonboard.com>","date":"2022-01-03T17:19:59","subject":"Re: [libcamera-devel] [PATCH 1/4] libipa: algorithm: Pass frame\n\tnumber to prepare() and process()","submitter":{"id":75,"url":"https://patchwork.libcamera.org/api/people/75/","name":"Jean-Michel Hautbois","email":"jeanmichel.hautbois@ideasonboard.com"},"content":"Hi Umang,\n\nThanks for the patch.\n\nOn 03/01/2022 18:09, Umang Jain wrote:\n> The frame number will be used to retrieve their respective\n> IPAFrameContext from a container in subsequent commits.\n> \n> Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>\n> ---\n>   src/ipa/ipu3/algorithms/agc.cpp          | 3 ++-\n>   src/ipa/ipu3/algorithms/agc.h            | 2 +-\n>   src/ipa/ipu3/algorithms/awb.cpp          | 4 ++--\n>   src/ipa/ipu3/algorithms/awb.h            | 4 ++--\n>   src/ipa/ipu3/algorithms/blc.cpp          | 6 ++++--\n>   src/ipa/ipu3/algorithms/blc.h            | 2 +-\n>   src/ipa/ipu3/algorithms/tone_mapping.cpp | 7 +++++--\n>   src/ipa/ipu3/algorithms/tone_mapping.h   | 4 ++--\n>   src/ipa/ipu3/ipu3.cpp                    | 4 ++--\n>   src/ipa/libipa/algorithm.cpp             | 2 ++\n>   src/ipa/libipa/algorithm.h               | 6 ++++--\n>   11 files changed, 27 insertions(+), 17 deletions(-)\n> \n> diff --git a/src/ipa/ipu3/algorithms/agc.cpp b/src/ipa/ipu3/algorithms/agc.cpp\n> index 8d6f18f6..1d0778d8 100644\n> --- a/src/ipa/ipu3/algorithms/agc.cpp\n> +++ b/src/ipa/ipu3/algorithms/agc.cpp\n> @@ -307,13 +307,14 @@ double Agc::estimateLuminance(IPAFrameContext &frameContext,\n>   \n>   /**\n>    * \\brief Process IPU3 statistics, and run AGC operations\n> + * \\param frame The frame number\n>    * \\param[in] context The shared IPA context\n>    * \\param[in] stats The IPU3 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, const ipu3_uapi_stats_3a *stats)\n> +void Agc::process(const uint32_t frame, IPAContext &context, const ipu3_uapi_stats_3a *stats)\n\nThis is true for all the rest: why are you passing it to the function \ninstead of including it in the frameContext ?\n\n>   {\n>   \t/*\n>   \t * Estimate the gain needed to have the proportion of pixels in a given\n> diff --git a/src/ipa/ipu3/algorithms/agc.h b/src/ipa/ipu3/algorithms/agc.h\n> index 96ec7005..c6ab8e91 100644\n> --- a/src/ipa/ipu3/algorithms/agc.h\n> +++ b/src/ipa/ipu3/algorithms/agc.h\n> @@ -28,7 +28,7 @@ public:\n>   \t~Agc() = default;\n>   \n>   \tint configure(IPAContext &context, const IPAConfigInfo &configInfo) override;\n> -\tvoid process(IPAContext &context, const ipu3_uapi_stats_3a *stats) override;\n> +\tvoid process(const uint32_t frame, IPAContext &context, const ipu3_uapi_stats_3a *stats) override;\n>   \n>   private:\n>   \tdouble measureBrightness(const ipu3_uapi_stats_3a *stats,\n> diff --git a/src/ipa/ipu3/algorithms/awb.cpp b/src/ipa/ipu3/algorithms/awb.cpp\n> index 1dc27fc9..99fb5305 100644\n> --- a/src/ipa/ipu3/algorithms/awb.cpp\n> +++ b/src/ipa/ipu3/algorithms/awb.cpp\n> @@ -379,7 +379,7 @@ void Awb::calculateWBGains(const ipu3_uapi_stats_3a *stats)\n>   /**\n>    * \\copydoc libcamera::ipa::Algorithm::process\n>    */\n> -void Awb::process(IPAContext &context, const ipu3_uapi_stats_3a *stats)\n> +void Awb::process(const uint32_t frame, IPAContext &context, const ipu3_uapi_stats_3a *stats)\n>   {\n>   \tcalculateWBGains(stats);\n>   \n> @@ -403,7 +403,7 @@ constexpr uint16_t Awb::threshold(float value)\n>   /**\n>    * \\copydoc libcamera::ipa::Algorithm::prepare\n>    */\n> -void Awb::prepare(IPAContext &context, ipu3_uapi_params *params)\n> +void Awb::prepare([[maybe_unused]] const uint32_t frame, IPAContext &context, ipu3_uapi_params *params)\n>   {\n>   \t/*\n>   \t * Green saturation thresholds are reduced because we are using the\n> diff --git a/src/ipa/ipu3/algorithms/awb.h b/src/ipa/ipu3/algorithms/awb.h\n> index ab4b0a33..ef177a4a 100644\n> --- a/src/ipa/ipu3/algorithms/awb.h\n> +++ b/src/ipa/ipu3/algorithms/awb.h\n> @@ -39,8 +39,8 @@ public:\n>   \t~Awb();\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, const ipu3_uapi_stats_3a *stats) override;\n> +\tvoid prepare(const uint32_t frame, IPAContext &context, ipu3_uapi_params *params) override;\n> +\tvoid process(const uint32_t frame, IPAContext &context, const ipu3_uapi_stats_3a *stats) override;\n>   \n>   private:\n>   \t/* \\todo Make these structs available to all the ISPs ? */\n> diff --git a/src/ipa/ipu3/algorithms/blc.cpp b/src/ipa/ipu3/algorithms/blc.cpp\n> index 78ab7bff..e9b4bed8 100644\n> --- a/src/ipa/ipu3/algorithms/blc.cpp\n> +++ b/src/ipa/ipu3/algorithms/blc.cpp\n> @@ -38,14 +38,16 @@ BlackLevelCorrection::BlackLevelCorrection()\n>   \n>   /**\n>    * \\brief Fill in the parameter structure, and enable black level correction\n> + * \\param frame The frame number\n>    * \\param context The shared IPA context\n>    * \\param params The IPU3 parameters\n>    *\n>    * Populate the IPU3 parameter structure with the correction values for each\n>    * channel and enable the corresponding ImgU block processing.\n>    */\n> -void BlackLevelCorrection::prepare([[maybe_unused]] IPAContext &context,\n> -\t\t\t      ipu3_uapi_params *params)\n> +void BlackLevelCorrection::prepare([[maybe_unused]] const uint32_t frame,\n> +\t\t\t\t   [[maybe_unused]] IPAContext &context,\n> +\t\t\t\t   ipu3_uapi_params *params)\n>   {\n>   \t/*\n>   \t * The Optical Black Level correction values\n> diff --git a/src/ipa/ipu3/algorithms/blc.h b/src/ipa/ipu3/algorithms/blc.h\n> index d8da1748..e4c22070 100644\n> --- a/src/ipa/ipu3/algorithms/blc.h\n> +++ b/src/ipa/ipu3/algorithms/blc.h\n> @@ -18,7 +18,7 @@ class BlackLevelCorrection : public Algorithm\n>   public:\n>   \tBlackLevelCorrection();\n>   \n> -\tvoid prepare(IPAContext &context, ipu3_uapi_params *params) override;\n> +\tvoid prepare(const uint32_t frame, IPAContext &context, ipu3_uapi_params *params) override;\n>   };\n>   \n>   } /* namespace ipa::ipu3::algorithms */\n> diff --git a/src/ipa/ipu3/algorithms/tone_mapping.cpp b/src/ipa/ipu3/algorithms/tone_mapping.cpp\n> index 2040eda5..bba5bc9a 100644\n> --- a/src/ipa/ipu3/algorithms/tone_mapping.cpp\n> +++ b/src/ipa/ipu3/algorithms/tone_mapping.cpp\n> @@ -49,13 +49,15 @@ int ToneMapping::configure(IPAContext &context,\n>   \n>   /**\n>    * \\brief Fill in the parameter structure, and enable gamma control\n> + * \\param frame The frame number\n>    * \\param context The shared IPA context\n>    * \\param params The IPU3 parameters\n>    *\n>    * Populate the IPU3 parameter structure with our tone mapping look up table and\n>    * enable the gamma control module in the processing blocks.\n>    */\n> -void ToneMapping::prepare([[maybe_unused]] IPAContext &context,\n> +void ToneMapping::prepare([[maybe_unused]] const uint32_t frame,\n> +\t\t\t  [[maybe_unused]] IPAContext &context,\n>   \t\t\t  ipu3_uapi_params *params)\n>   {\n>   \t/* Copy the calculated LUT into the parameters buffer. */\n> @@ -71,13 +73,14 @@ void ToneMapping::prepare([[maybe_unused]] IPAContext &context,\n>   \n>   /**\n>    * \\brief Calculate the tone mapping look up table\n> + * \\param frame The frame number\n>    * \\param context The shared IPA context\n>    * \\param stats The IPU3 statistics and ISP results\n>    *\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,\n> +void ToneMapping::process(const uint32_t frame, IPAContext &context,\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 b727ab1e..041c9c0d 100644\n> --- a/src/ipa/ipu3/algorithms/tone_mapping.h\n> +++ b/src/ipa/ipu3/algorithms/tone_mapping.h\n> @@ -19,8 +19,8 @@ public:\n>   \tToneMapping();\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, const ipu3_uapi_stats_3a *stats) override;\n> +\tvoid prepare(const uint32_t frame, IPAContext &context, ipu3_uapi_params *params) override;\n> +\tvoid process(const uint32_t frame, IPAContext &context, const ipu3_uapi_stats_3a *stats) override;\n>   \n>   private:\n>   \tdouble gamma_;\n> diff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp\n> index 3d307708..aef232c3 100644\n> --- a/src/ipa/ipu3/ipu3.cpp\n> +++ b/src/ipa/ipu3/ipu3.cpp\n> @@ -595,7 +595,7 @@ void IPAIPU3::fillParams(unsigned int frame, ipu3_uapi_params *params)\n>   \tparams->use = {};\n>   \n>   \tfor (auto const &algo : algorithms_)\n> -\t\talgo->prepare(context_, params);\n> +\t\talgo->prepare(frame, context_, params);\n>   \n>   \tIPU3Action op;\n>   \top.op = ActionParamFilled;\n> @@ -620,7 +620,7 @@ void IPAIPU3::parseStatistics(unsigned int frame,\n>   \tControlList ctrls(controls::controls);\n>   \n>   \tfor (auto const &algo : algorithms_)\n> -\t\talgo->process(context_, stats);\n> +\t\talgo->process(frame, context_, stats);\n>   \n>   \tsetControls(frame);\n>   \n> diff --git a/src/ipa/libipa/algorithm.cpp b/src/ipa/libipa/algorithm.cpp\n> index 398d5372..01967f07 100644\n> --- a/src/ipa/libipa/algorithm.cpp\n> +++ b/src/ipa/libipa/algorithm.cpp\n> @@ -48,6 +48,7 @@ namespace ipa {\n>   /**\n>    * \\fn Algorithm::prepare()\n>    * \\brief Fill the \\a params buffer with ISP processing parameters for a frame\n> + * \\param[in] frame The frame number\n>    * \\param[in] context The shared IPA context\n>    * \\param[out] params The ISP specific parameters.\n>    *\n> @@ -63,6 +64,7 @@ namespace ipa {\n>   /**\n>    * \\fn Algorithm::process()\n>    * \\brief Process ISP statistics, and run algorithm operations\n> + * \\param[in] frame The frame number\n>    * \\param[in] context The shared IPA 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 766aee5d..1df93625 100644\n> --- a/src/ipa/libipa/algorithm.h\n> +++ b/src/ipa/libipa/algorithm.h\n> @@ -22,12 +22,14 @@ public:\n>   \t\treturn 0;\n>   \t}\n>   \n> -\tvirtual void prepare([[maybe_unused]] Context &context,\n> +\tvirtual void prepare([[maybe_unused]] const uint32_t frame,\n> +\t\t\t     [[maybe_unused]] Context &context,\n>   \t\t\t     [[maybe_unused]] Params *params)\n>   \t{\n>   \t}\n>   \n> -\tvirtual void process([[maybe_unused]] Context &context,\n> +\tvirtual void process([[maybe_unused]] const uint32_t frame,\n> +\t\t\t     [[maybe_unused]] Context &context,\n>   \t\t\t     [[maybe_unused]] const Stats *stats)\n>   \t{\n>   \t}\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 DB012BF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon,  3 Jan 2022 17:20:04 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 395046090D;\n\tMon,  3 Jan 2022 18:20:04 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 2D660604F4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  3 Jan 2022 18:20:02 +0100 (CET)","from [IPV6:2a01:e0a:169:7140:7998:b779:8975:661d] (unknown\n\t[IPv6:2a01:e0a:169:7140:7998:b779:8975:661d])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id BB72FCC;\n\tMon,  3 Jan 2022 18:20:01 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"eA8FgA9W\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1641230401;\n\tbh=rJhuFt0RZa3UKY7O0dyw5oXA4BeSf6+0g5uAS3Z2hoo=;\n\th=Date:Subject:To:References:From:In-Reply-To:From;\n\tb=eA8FgA9WGlP5lc/zyglCChMbM6Uhq24DSs3/9XPCPBo8RhKbq1YR2t+3znufaqOSR\n\t/umwJm0UeWHnJQy3SiZ2lLDB9e2Q3j3mEcmhvzEBShYVo+bb/Ai71XEwEwY4P5P95K\n\tZ1LcB2QPse07F8iSnkdfc24kPLYhrbgg1VdAU+H0=","Message-ID":"<9c2de696-a910-fc36-a4d5-8298a1620229@ideasonboard.com>","Date":"Mon, 3 Jan 2022 18:19:59 +0100","MIME-Version":"1.0","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101\n\tThunderbird/91.3.1","Content-Language":"en-US","To":"Umang Jain <umang.jain@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","References":"<20220103170956.323025-1-umang.jain@ideasonboard.com>\n\t<20220103170956.323025-2-umang.jain@ideasonboard.com>","From":"Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>","In-Reply-To":"<20220103170956.323025-2-umang.jain@ideasonboard.com>","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"7bit","Subject":"Re: [libcamera-devel] [PATCH 1/4] libipa: algorithm: Pass frame\n\tnumber to prepare() and 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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":21933,"web_url":"https://patchwork.libcamera.org/comment/21933/","msgid":"<f9f2879d-3a7f-2220-e5f2-d400a4cfb32c@ideasonboard.com>","date":"2022-01-04T03:13:37","subject":"Re: [libcamera-devel] [PATCH 1/4] libipa: algorithm: Pass frame\n\tnumber to prepare() and process()","submitter":{"id":86,"url":"https://patchwork.libcamera.org/api/people/86/","name":"Umang Jain","email":"umang.jain@ideasonboard.com"},"content":"Hi JM,\n\nOn 1/3/22 10:49 PM, Jean-Michel Hautbois wrote:\n> Hi Umang,\n>\n> Thanks for the patch.\n>\n> On 03/01/2022 18:09, Umang Jain wrote:\n>> The frame number will be used to retrieve their respective\n>> IPAFrameContext from a container in subsequent commits.\n>>\n>> Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>\n>> ---\n>>   src/ipa/ipu3/algorithms/agc.cpp          | 3 ++-\n>>   src/ipa/ipu3/algorithms/agc.h            | 2 +-\n>>   src/ipa/ipu3/algorithms/awb.cpp          | 4 ++--\n>>   src/ipa/ipu3/algorithms/awb.h            | 4 ++--\n>>   src/ipa/ipu3/algorithms/blc.cpp          | 6 ++++--\n>>   src/ipa/ipu3/algorithms/blc.h            | 2 +-\n>>   src/ipa/ipu3/algorithms/tone_mapping.cpp | 7 +++++--\n>>   src/ipa/ipu3/algorithms/tone_mapping.h   | 4 ++--\n>>   src/ipa/ipu3/ipu3.cpp                    | 4 ++--\n>>   src/ipa/libipa/algorithm.cpp             | 2 ++\n>>   src/ipa/libipa/algorithm.h               | 6 ++++--\n>>   11 files changed, 27 insertions(+), 17 deletions(-)\n>>\n>> diff --git a/src/ipa/ipu3/algorithms/agc.cpp \n>> b/src/ipa/ipu3/algorithms/agc.cpp\n>> index 8d6f18f6..1d0778d8 100644\n>> --- a/src/ipa/ipu3/algorithms/agc.cpp\n>> +++ b/src/ipa/ipu3/algorithms/agc.cpp\n>> @@ -307,13 +307,14 @@ double Agc::estimateLuminance(IPAFrameContext \n>> &frameContext,\n>>     /**\n>>    * \\brief Process IPU3 statistics, and run AGC operations\n>> + * \\param frame The frame number\n>>    * \\param[in] context The shared IPA context\n>>    * \\param[in] stats The IPU3 statistics and ISP results\n>>    *\n>>    * Identify the current image brightness, and use that to estimate \n>> the optimal\n>>    * new exposure and gain for the scene.\n>>    */\n>> -void Agc::process(IPAContext &context, const ipu3_uapi_stats_3a *stats)\n>> +void Agc::process(const uint32_t frame, IPAContext &context, const \n>> ipu3_uapi_stats_3a *stats)\n>\n> This is true for all the rest: why are you passing it to the function \n> instead of including it in the frameContext ?\n\n\nI couldn't understand the initial part - \"This is true for all the rest\"\n\nI think going forwards, IPAContext will be more whole-some preserving \nthe context of all the frames queued to IPU3, hence  I don't want to \nintroduce any per-frame member variable there, although I am not very \nmuch opposed to the idea.\n\nThe Algorithm prepare() and process() are documented to be run \"for \nevery frame\", hence  I find passing the frame-number to those functions \nas a more suitable option.\n\n>\n>>   {\n>>       /*\n>>        * Estimate the gain needed to have the proportion of pixels in \n>> a given\n>> diff --git a/src/ipa/ipu3/algorithms/agc.h \n>> b/src/ipa/ipu3/algorithms/agc.h\n>> index 96ec7005..c6ab8e91 100644\n>> --- a/src/ipa/ipu3/algorithms/agc.h\n>> +++ b/src/ipa/ipu3/algorithms/agc.h\n>> @@ -28,7 +28,7 @@ public:\n>>       ~Agc() = default;\n>>         int configure(IPAContext &context, const IPAConfigInfo \n>> &configInfo) override;\n>> -    void process(IPAContext &context, const ipu3_uapi_stats_3a \n>> *stats) override;\n>> +    void process(const uint32_t frame, IPAContext &context, const \n>> ipu3_uapi_stats_3a *stats) override;\n>>     private:\n>>       double measureBrightness(const ipu3_uapi_stats_3a *stats,\n>> diff --git a/src/ipa/ipu3/algorithms/awb.cpp \n>> b/src/ipa/ipu3/algorithms/awb.cpp\n>> index 1dc27fc9..99fb5305 100644\n>> --- a/src/ipa/ipu3/algorithms/awb.cpp\n>> +++ b/src/ipa/ipu3/algorithms/awb.cpp\n>> @@ -379,7 +379,7 @@ void Awb::calculateWBGains(const \n>> ipu3_uapi_stats_3a *stats)\n>>   /**\n>>    * \\copydoc libcamera::ipa::Algorithm::process\n>>    */\n>> -void Awb::process(IPAContext &context, const ipu3_uapi_stats_3a *stats)\n>> +void Awb::process(const uint32_t frame, IPAContext &context, const \n>> ipu3_uapi_stats_3a *stats)\n>>   {\n>>       calculateWBGains(stats);\n>>   @@ -403,7 +403,7 @@ constexpr uint16_t Awb::threshold(float value)\n>>   /**\n>>    * \\copydoc libcamera::ipa::Algorithm::prepare\n>>    */\n>> -void Awb::prepare(IPAContext &context, ipu3_uapi_params *params)\n>> +void Awb::prepare([[maybe_unused]] const uint32_t frame, IPAContext \n>> &context, ipu3_uapi_params *params)\n>>   {\n>>       /*\n>>        * Green saturation thresholds are reduced because we are using \n>> the\n>> diff --git a/src/ipa/ipu3/algorithms/awb.h \n>> b/src/ipa/ipu3/algorithms/awb.h\n>> index ab4b0a33..ef177a4a 100644\n>> --- a/src/ipa/ipu3/algorithms/awb.h\n>> +++ b/src/ipa/ipu3/algorithms/awb.h\n>> @@ -39,8 +39,8 @@ public:\n>>       ~Awb();\n>>         int configure(IPAContext &context, const IPAConfigInfo \n>> &configInfo) override;\n>> -    void prepare(IPAContext &context, ipu3_uapi_params *params) \n>> override;\n>> -    void process(IPAContext &context, const ipu3_uapi_stats_3a \n>> *stats) override;\n>> +    void prepare(const uint32_t frame, IPAContext &context, \n>> ipu3_uapi_params *params) override;\n>> +    void process(const uint32_t frame, IPAContext &context, const \n>> ipu3_uapi_stats_3a *stats) override;\n>>     private:\n>>       /* \\todo Make these structs available to all the ISPs ? */\n>> diff --git a/src/ipa/ipu3/algorithms/blc.cpp \n>> b/src/ipa/ipu3/algorithms/blc.cpp\n>> index 78ab7bff..e9b4bed8 100644\n>> --- a/src/ipa/ipu3/algorithms/blc.cpp\n>> +++ b/src/ipa/ipu3/algorithms/blc.cpp\n>> @@ -38,14 +38,16 @@ BlackLevelCorrection::BlackLevelCorrection()\n>>     /**\n>>    * \\brief Fill in the parameter structure, and enable black level \n>> correction\n>> + * \\param frame The frame number\n>>    * \\param context The shared IPA context\n>>    * \\param params The IPU3 parameters\n>>    *\n>>    * Populate the IPU3 parameter structure with the correction values \n>> for each\n>>    * channel and enable the corresponding ImgU block processing.\n>>    */\n>> -void BlackLevelCorrection::prepare([[maybe_unused]] IPAContext \n>> &context,\n>> -                  ipu3_uapi_params *params)\n>> +void BlackLevelCorrection::prepare([[maybe_unused]] const uint32_t \n>> frame,\n>> +                   [[maybe_unused]] IPAContext &context,\n>> +                   ipu3_uapi_params *params)\n>>   {\n>>       /*\n>>        * The Optical Black Level correction values\n>> diff --git a/src/ipa/ipu3/algorithms/blc.h \n>> b/src/ipa/ipu3/algorithms/blc.h\n>> index d8da1748..e4c22070 100644\n>> --- a/src/ipa/ipu3/algorithms/blc.h\n>> +++ b/src/ipa/ipu3/algorithms/blc.h\n>> @@ -18,7 +18,7 @@ class BlackLevelCorrection : public Algorithm\n>>   public:\n>>       BlackLevelCorrection();\n>>   -    void prepare(IPAContext &context, ipu3_uapi_params *params) \n>> override;\n>> +    void prepare(const uint32_t frame, IPAContext &context, \n>> ipu3_uapi_params *params) override;\n>>   };\n>>     } /* namespace ipa::ipu3::algorithms */\n>> diff --git a/src/ipa/ipu3/algorithms/tone_mapping.cpp \n>> b/src/ipa/ipu3/algorithms/tone_mapping.cpp\n>> index 2040eda5..bba5bc9a 100644\n>> --- a/src/ipa/ipu3/algorithms/tone_mapping.cpp\n>> +++ b/src/ipa/ipu3/algorithms/tone_mapping.cpp\n>> @@ -49,13 +49,15 @@ int ToneMapping::configure(IPAContext &context,\n>>     /**\n>>    * \\brief Fill in the parameter structure, and enable gamma control\n>> + * \\param frame The frame number\n>>    * \\param context The shared IPA context\n>>    * \\param params The IPU3 parameters\n>>    *\n>>    * Populate the IPU3 parameter structure with our tone mapping look \n>> up table and\n>>    * enable the gamma control module in the processing blocks.\n>>    */\n>> -void ToneMapping::prepare([[maybe_unused]] IPAContext &context,\n>> +void ToneMapping::prepare([[maybe_unused]] const uint32_t frame,\n>> +              [[maybe_unused]] IPAContext &context,\n>>                 ipu3_uapi_params *params)\n>>   {\n>>       /* Copy the calculated LUT into the parameters buffer. */\n>> @@ -71,13 +73,14 @@ void ToneMapping::prepare([[maybe_unused]] \n>> IPAContext &context,\n>>     /**\n>>    * \\brief Calculate the tone mapping look up table\n>> + * \\param frame The frame number\n>>    * \\param context The shared IPA context\n>>    * \\param stats The IPU3 statistics and ISP results\n>>    *\n>>    * The tone mapping look up table is generated as an inverse power \n>> curve from\n>>    * our gamma setting.\n>>    */\n>> -void ToneMapping::process(IPAContext &context,\n>> +void ToneMapping::process(const uint32_t frame, IPAContext &context,\n>>                 [[maybe_unused]] const ipu3_uapi_stats_3a *stats)\n>>   {\n>>       /*\n>> diff --git a/src/ipa/ipu3/algorithms/tone_mapping.h \n>> b/src/ipa/ipu3/algorithms/tone_mapping.h\n>> index b727ab1e..041c9c0d 100644\n>> --- a/src/ipa/ipu3/algorithms/tone_mapping.h\n>> +++ b/src/ipa/ipu3/algorithms/tone_mapping.h\n>> @@ -19,8 +19,8 @@ public:\n>>       ToneMapping();\n>>         int configure(IPAContext &context, const IPAConfigInfo \n>> &configInfo) override;\n>> -    void prepare(IPAContext &context, ipu3_uapi_params *params) \n>> override;\n>> -    void process(IPAContext &context, const ipu3_uapi_stats_3a \n>> *stats) override;\n>> +    void prepare(const uint32_t frame, IPAContext &context, \n>> ipu3_uapi_params *params) override;\n>> +    void process(const uint32_t frame, IPAContext &context, const \n>> ipu3_uapi_stats_3a *stats) override;\n>>     private:\n>>       double gamma_;\n>> diff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp\n>> index 3d307708..aef232c3 100644\n>> --- a/src/ipa/ipu3/ipu3.cpp\n>> +++ b/src/ipa/ipu3/ipu3.cpp\n>> @@ -595,7 +595,7 @@ void IPAIPU3::fillParams(unsigned int frame, \n>> ipu3_uapi_params *params)\n>>       params->use = {};\n>>         for (auto const &algo : algorithms_)\n>> -        algo->prepare(context_, params);\n>> +        algo->prepare(frame, context_, params);\n>>         IPU3Action op;\n>>       op.op = ActionParamFilled;\n>> @@ -620,7 +620,7 @@ void IPAIPU3::parseStatistics(unsigned int frame,\n>>       ControlList ctrls(controls::controls);\n>>         for (auto const &algo : algorithms_)\n>> -        algo->process(context_, stats);\n>> +        algo->process(frame, context_, stats);\n>>         setControls(frame);\n>>   diff --git a/src/ipa/libipa/algorithm.cpp \n>> b/src/ipa/libipa/algorithm.cpp\n>> index 398d5372..01967f07 100644\n>> --- a/src/ipa/libipa/algorithm.cpp\n>> +++ b/src/ipa/libipa/algorithm.cpp\n>> @@ -48,6 +48,7 @@ namespace ipa {\n>>   /**\n>>    * \\fn Algorithm::prepare()\n>>    * \\brief Fill the \\a params buffer with ISP processing parameters \n>> for a frame\n>> + * \\param[in] frame The frame number\n>>    * \\param[in] context The shared IPA context\n>>    * \\param[out] params The ISP specific parameters.\n>>    *\n>> @@ -63,6 +64,7 @@ namespace ipa {\n>>   /**\n>>    * \\fn Algorithm::process()\n>>    * \\brief Process ISP statistics, and run algorithm operations\n>> + * \\param[in] frame The frame number\n>>    * \\param[in] context The shared IPA 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 766aee5d..1df93625 100644\n>> --- a/src/ipa/libipa/algorithm.h\n>> +++ b/src/ipa/libipa/algorithm.h\n>> @@ -22,12 +22,14 @@ public:\n>>           return 0;\n>>       }\n>>   -    virtual void prepare([[maybe_unused]] Context &context,\n>> +    virtual void prepare([[maybe_unused]] const uint32_t frame,\n>> +                 [[maybe_unused]] Context &context,\n>>                    [[maybe_unused]] Params *params)\n>>       {\n>>       }\n>>   -    virtual void process([[maybe_unused]] Context &context,\n>> +    virtual void process([[maybe_unused]] const uint32_t frame,\n>> +                 [[maybe_unused]] Context &context,\n>>                    [[maybe_unused]] const Stats *stats)\n>>       {\n>>       }\n>>","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id EBC0BBF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  4 Jan 2022 03:13:45 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 4420160868;\n\tTue,  4 Jan 2022 04:13:45 +0100 (CET)","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 0931C604F8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  4 Jan 2022 04:13:44 +0100 (CET)","from [IPv6:2401:4900:1f3e:193e:9a73:f356:8c6a:a1aa] (unknown\n\t[IPv6:2401:4900:1f3e:193e:9a73:f356:8c6a:a1aa])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id CFEA9501;\n\tTue,  4 Jan 2022 04:13:42 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"da5uG6cw\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1641266023;\n\tbh=byZvKTeSZGekS3tFhHj7wUHlvFaKuiaI5EJ92zNjmK0=;\n\th=Subject:To:References:From:Date:In-Reply-To:From;\n\tb=da5uG6cwZy5jtPG45Zl6DAcuD+T1htVo5pEj+/8EjeaPbQfdeZbLR4/Yk9gyd92GP\n\tJvblDzgaQFa693P6QVhc+/3YzSLwcQ6DlIdsSc9L/6qQWnPrDu2rh0a7H7k7uBmJ/6\n\tBOUDpifP5Y/7VGkcfmVHWA4zt65Zj4t62kxWQNgo=","To":"Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","References":"<20220103170956.323025-1-umang.jain@ideasonboard.com>\n\t<20220103170956.323025-2-umang.jain@ideasonboard.com>\n\t<9c2de696-a910-fc36-a4d5-8298a1620229@ideasonboard.com>","From":"Umang Jain <umang.jain@ideasonboard.com>","Message-ID":"<f9f2879d-3a7f-2220-e5f2-d400a4cfb32c@ideasonboard.com>","Date":"Tue, 4 Jan 2022 08:43:37 +0530","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101\n\tThunderbird/78.10.2","MIME-Version":"1.0","In-Reply-To":"<9c2de696-a910-fc36-a4d5-8298a1620229@ideasonboard.com>","Content-Type":"text/plain; charset=utf-8; format=flowed","Content-Transfer-Encoding":"8bit","Content-Language":"en-US","Subject":"Re: [libcamera-devel] [PATCH 1/4] libipa: algorithm: Pass frame\n\tnumber to prepare() and 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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]