{"id":16721,"url":"https://patchwork.libcamera.org/api/1.1/patches/16721/?format=json","web_url":"https://patchwork.libcamera.org/patch/16721/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20220721121310.1286862-10-kieran.bingham@ideasonboard.com>","date":"2022-07-21T12:13:07","name":"[libcamera-devel,RFC,09/12] ipa: libipa: algorithm: process(): Pass frame number","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"c40fbeb53ccb8c893911f92eaefc1051369a2d12","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/1.1/people/4/?format=json","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"delegate":{"id":11,"url":"https://patchwork.libcamera.org/api/1.1/users/11/?format=json","username":"kbingham","first_name":"Kieran","last_name":"Bingham","email":"kieran.bingham@ideasonboard.com"},"mbox":"https://patchwork.libcamera.org/patch/16721/mbox/","series":[{"id":3313,"url":"https://patchwork.libcamera.org/api/1.1/series/3313/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=3313","date":"2022-07-21T12:12:58","name":"libcamera: Align IPU3 and RKISP1 interfaces","version":1,"mbox":"https://patchwork.libcamera.org/series/3313/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/16721/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/16721/checks/","tags":{},"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 3B459BD1F1\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 21 Jul 2022 12:13:26 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 70A2563328;\n\tThu, 21 Jul 2022 14:13:25 +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 F23B36331B\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 21 Jul 2022 14:13:15 +0200 (CEST)","from Monstersaurus.local\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 A0637A38;\n\tThu, 21 Jul 2022 14:13:15 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1658405605;\n\tbh=K0XorCX5KY7XxeTZMPMU0sCi5tEzVXKrVmQfZ0KyRBU=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=uydiM5TRcxtnT9VQaPw6a1d5DCIjvt2a0svQg7aVHpOAVgmOTzFucnr5JhGXsmrc0\n\tBC25e9Y8xAVUq5EGyZZmnSAnwOTGHQhfr1kNgwTcCAxFD9ciLx6iPMoLXtW1hh6/vX\n\tD47u2hC7eXEsdi2yVc+QXh1kQXWlX03wnN/MDJ0b9ZtX2YLsh9JEY37reaJfWmG3Ki\n\th1UDrATN9eL4YfnDfhMUFGQ7uTzVmKoz7FAYKqnRs3eJBF2tO0ZY9nUVjrpF5l4lTa\n\tUaxhylEuEj6KFqTdqDCdns1a2tQxIjQfJo81J09QeA0WBIjx8ySkz66mvODqoNiWwQ\n\tmfD+Xfmd0CxZg==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1658405595;\n\tbh=K0XorCX5KY7XxeTZMPMU0sCi5tEzVXKrVmQfZ0KyRBU=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=WkRR/HxzyID9VeiSlQLOj0ZnrlkAAr0jn9BGhK/A/Znpie89glC86zpAGIT7iGw79\n\tuCrtH9jq5YHbneTyRJKMktB/IFliQXf88TGzOlOG3XcNC6ob5kne+9lTWB4PvipL9Z\n\tuWhOuXb9S6Up+co70cMj3UvXsWyS6AbxiZFQgAbc="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"WkRR/Hxz\"; dkim-atps=neutral","To":"libcamera devel <libcamera-devel@lists.libcamera.org>","Date":"Thu, 21 Jul 2022 13:13:07 +0100","Message-Id":"<20220721121310.1286862-10-kieran.bingham@ideasonboard.com>","X-Mailer":"git-send-email 2.34.1","In-Reply-To":"<20220721121310.1286862-1-kieran.bingham@ideasonboard.com>","References":"<20220721121310.1286862-1-kieran.bingham@ideasonboard.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Pass the frame number of the current frame being processed.\n\nSigned-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n - Use RKISP1FrameContext from the queue during IPARkISP1::processStatsBuffer\n\nSigned-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\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(-)","diff":"diff --git a/src/ipa/ipu3/algorithms/af.cpp b/src/ipa/ipu3/algorithms/af.cpp\nindex 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 {\ndiff --git a/src/ipa/ipu3/algorithms/af.h b/src/ipa/ipu3/algorithms/af.h\nindex 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:\ndiff --git a/src/ipa/ipu3/algorithms/agc.cpp b/src/ipa/ipu3/algorithms/agc.cpp\nindex 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 {\ndiff --git a/src/ipa/ipu3/algorithms/agc.h b/src/ipa/ipu3/algorithms/agc.h\nindex 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:\ndiff --git a/src/ipa/ipu3/algorithms/awb.cpp b/src/ipa/ipu3/algorithms/awb.cpp\nindex 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 {\ndiff --git a/src/ipa/ipu3/algorithms/awb.h b/src/ipa/ipu3/algorithms/awb.h\nindex 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:\ndiff --git a/src/ipa/ipu3/algorithms/tone_mapping.cpp b/src/ipa/ipu3/algorithms/tone_mapping.cpp\nindex 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 {\ndiff --git a/src/ipa/ipu3/algorithms/tone_mapping.h b/src/ipa/ipu3/algorithms/tone_mapping.h\nindex 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:\ndiff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp\nindex 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 \ndiff --git a/src/ipa/libipa/algorithm.cpp b/src/ipa/libipa/algorithm.cpp\nindex 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  *\ndiff --git a/src/ipa/libipa/algorithm.h b/src/ipa/libipa/algorithm.h\nindex 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{\ndiff --git a/src/ipa/rkisp1/algorithms/agc.cpp b/src/ipa/rkisp1/algorithms/agc.cpp\nindex 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 {\ndiff --git a/src/ipa/rkisp1/algorithms/agc.h b/src/ipa/rkisp1/algorithms/agc.h\nindex 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:\ndiff --git a/src/ipa/rkisp1/algorithms/awb.cpp b/src/ipa/rkisp1/algorithms/awb.cpp\nindex 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 {\ndiff --git a/src/ipa/rkisp1/algorithms/awb.h b/src/ipa/rkisp1/algorithms/awb.h\nindex 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:\ndiff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp\nindex 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","prefixes":["libcamera-devel","RFC","09/12"]}