{"id":14336,"url":"https://patchwork.libcamera.org/api/patches/14336/?format=json","web_url":"https://patchwork.libcamera.org/patch/14336/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/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":"<20211026112340.110169-4-jeanmichel.hautbois@ideasonboard.com>","date":"2021-10-26T11:23:24","name":"[libcamera-devel,v5,03/19] ipa: ipu3: Document the IPAIPU3 class","commit_ref":"08df88e5b464796ddd1f52d56801a74a85e4d842","pull_url":null,"state":"accepted","archived":false,"hash":"7f6aa49e4a7e6423680f467ca7f7032715a5f844","submitter":{"id":75,"url":"https://patchwork.libcamera.org/api/people/75/?format=json","name":"Jean-Michel Hautbois","email":"jeanmichel.hautbois@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/14336/mbox/","series":[{"id":2658,"url":"https://patchwork.libcamera.org/api/series/2658/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=2658","date":"2021-10-26T11:23:21","name":"Document IPU3 IPA","version":5,"mbox":"https://patchwork.libcamera.org/series/2658/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/14336/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/14336/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 39CDFBF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 26 Oct 2021 11:23:54 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 7114B64880;\n\tTue, 26 Oct 2021 13:23:51 +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 2777760123\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 26 Oct 2021 13:23:45 +0200 (CEST)","from tatooine.ideasonboard.com (unknown\n\t[IPv6:2a01:e0a:169:7140:dce3:eb54:18d7:6f3d])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id BD8543F0;\n\tTue, 26 Oct 2021 13:23:44 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"O+bCl7NJ\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1635247424;\n\tbh=P093pxkw4YOZQ8H/jSNiEbY6yjgf0lm7dU3cjuD+wao=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=O+bCl7NJL1qEas7Rrj1fbdvj3wAzUEZIMjpgKkOtbGtSNIlZZX2zb3b0bslP8aSmS\n\tKgeV+07SYKplotnaV5+iyImib619jectEdIGSRbRO4oqaF9ADhQGESkww/GzHS7eGO\n\t5S9rLX7A8klfYzaqc6LkA7CRiCWB0xOJJgYSIfhY=","From":"Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Tue, 26 Oct 2021 13:23:24 +0200","Message-Id":"<20211026112340.110169-4-jeanmichel.hautbois@ideasonboard.com>","X-Mailer":"git-send-email 2.32.0","In-Reply-To":"<20211026112340.110169-1-jeanmichel.hautbois@ideasonboard.com>","References":"<20211026112340.110169-1-jeanmichel.hautbois@ideasonboard.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v5 03/19] ipa: ipu3: Document the IPAIPU3\n\tclass","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>"},"content":"Clarify the roles and interactions between the pipeline handler events\nand the algorithm calls by documenting all the remaining functions of\nthe class.\n\nSigned-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>\nSigned-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\nReviewed-by: Umang Jain <umang.jain@ideasonboard.com>\n---\n src/ipa/ipu3/ipu3.cpp | 87 +++++++++++++++++++++++++++++++++++++------\n 1 file changed, 76 insertions(+), 11 deletions(-)","diff":"diff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp\nindex 1f501821..177b67b0 100644\n--- a/src/ipa/ipu3/ipu3.cpp\n+++ b/src/ipa/ipu3/ipu3.cpp\n@@ -305,9 +305,9 @@ private:\n \tstruct IPAContext context_;\n };\n \n-/*\n- * Compute IPASessionConfiguration using the sensor information and the sensor\n- * v4l2 controls.\n+/**\n+ * \\brief Compute IPASessionConfiguration using the sensor information and the\n+ * sensor V4L2 controls\n  */\n void IPAIPU3::updateSessionConfiguration(const IPACameraSensorInfo &sensorInfo,\n \t\t\t\t\t const ControlInfoMap &sensorControls)\n@@ -336,9 +336,9 @@ void IPAIPU3::updateSessionConfiguration(const IPACameraSensorInfo &sensorInfo,\n \tcontext_.configuration.agc.maxAnalogueGain = camHelper_->gain(maxGain);\n }\n \n-/*\n- * Compute camera controls using the sensor information and the sensor\n- * v4l2 controls.\n+/**\n+ * \\brief Compute camera controls using the sensor information and the sensor\n+ * V4L2 controls\n  *\n  * Some of the camera controls are computed by the pipeline handler, some others\n  * by the IPA module which is in charge of handling, for example, the exposure\n@@ -399,7 +399,7 @@ void IPAIPU3::updateControls(const IPACameraSensorInfo &sensorInfo,\n }\n \n /**\n- * Initialize the IPA module and its controls.\n+ * \\brief Initialize the IPA module and its controls\n  *\n  * This function receives the camera sensor information from the pipeline\n  * handler, computes the limits of the controls it handles and returns\n@@ -430,8 +430,15 @@ int IPAIPU3::init(const IPASettings &settings,\n \treturn 0;\n }\n \n+/**\n+ * \\brief Perform any processing required before the first frame\n+ */\n int IPAIPU3::start()\n {\n+\t/*\n+\t * Set the sensors V4L2 controls before the first frame to ensure that\n+\t * we have an expected and known configuration from the start.\n+\t */\n \tsetControls(0);\n \n \treturn 0;\n@@ -512,7 +519,7 @@ void IPAIPU3::calculateBdsGrid(const Size &bdsOutputSize)\n  * handler\n  * \\param[in] ipaControls The IPA controls to update\n  *\n- * Calculate the best grid for the statistics based on the Pipeline Handler BDS\n+ * Calculate the best grid for the statistics based on the pipeline handler BDS\n  * output, and parse the minimum and maximum exposure and analogue gain control\n  * values.\n  *\n@@ -585,6 +592,10 @@ int IPAIPU3::configure(const IPAConfigInfo &configInfo,\n \treturn 0;\n }\n \n+/**\n+ * \\brief Map the parameters and stats buffers allocated in the pipeline handler\n+ * \\param[in] buffers The buffers to map\n+ */\n void IPAIPU3::mapBuffers(const std::vector<IPABuffer> &buffers)\n {\n \tfor (const IPABuffer &buffer : buffers) {\n@@ -594,6 +605,10 @@ void IPAIPU3::mapBuffers(const std::vector<IPABuffer> &buffers)\n \t}\n }\n \n+/**\n+ * \\brief Unmap the parameters and stats buffers\n+ * \\param[in] ids The IDs of the buffers to unmap\n+ */\n void IPAIPU3::unmapBuffers(const std::vector<unsigned int> &ids)\n {\n \tfor (unsigned int id : ids) {\n@@ -605,6 +620,10 @@ void IPAIPU3::unmapBuffers(const std::vector<unsigned int> &ids)\n \t}\n }\n \n+/**\n+ * \\brief Process an event generated by the pipeline handler\n+ * \\param[in] event The event sent from pipeline handler\n+ */\n void IPAIPU3::processEvent(const IPU3Event &event)\n {\n \tswitch (event.op) {\n@@ -646,12 +665,28 @@ void IPAIPU3::processEvent(const IPU3Event &event)\n \t}\n }\n \n+/**\n+ * \\brief Process a control list for a request from the application\n+ * \\param[in] frame The number of the frame which will be processed next\n+ * \\param[in] controls The controls for the \\a frame\n+ *\n+ * Parse the request to handle any IPA-managed controls that were set from the\n+ * application such as manual sensor settings.\n+ */\n void IPAIPU3::processControls([[maybe_unused]] unsigned int frame,\n \t\t\t      [[maybe_unused]] const ControlList &controls)\n {\n \t/* \\todo Start processing for 'frame' based on 'controls'. */\n }\n \n+/**\n+ * \\brief Fill the ImgU parameter buffer for the next frame\n+ * \\param[in] frame The number of the latest frame processed\n+ * \\param[out] params The parameter buffer to fill\n+ *\n+ * Algorithms are expected to fill the IPU3 parameter buffer for the next\n+ * frame given their most recent processing of the ImgU statistics.\n+ */\n void IPAIPU3::fillParams(unsigned int frame, ipu3_uapi_params *params)\n {\n \t/*\n@@ -674,6 +709,16 @@ void IPAIPU3::fillParams(unsigned int frame, ipu3_uapi_params *params)\n \tqueueFrameAction.emit(frame, op);\n }\n \n+/**\n+ * \\brief Process the statistics generated by the ImgU\n+ * \\param[in] frame The number of the latest frame processed\n+ * \\param[in] frameTimestamp The current frame timestamp\n+ * \\param[in] stats The IPU3 statistics and ISP results\n+ *\n+ * Parse the most recently processed image statistics from the ImgU. The\n+ * statistics are passed to each algorithm module to run their calculations and\n+ * update their state accordingly.\n+ */\n void IPAIPU3::parseStatistics(unsigned int frame,\n \t\t\t      [[maybe_unused]] int64_t frameTimestamp,\n \t\t\t      [[maybe_unused]] const ipu3_uapi_stats_3a *stats)\n@@ -697,6 +742,13 @@ void IPAIPU3::parseStatistics(unsigned int frame,\n \tqueueFrameAction.emit(frame, op);\n }\n \n+/**\n+ * \\brief Handle sensor controls for a given \\a frame number\n+ * \\param[in] frame The frame on which the sensor controls should be set\n+ *\n+ * Send the desired sensor control values to the pipeline handler to request\n+ * that they are applied on the camera sensor.\n+ */\n void IPAIPU3::setControls(unsigned int frame)\n {\n \tIPU3Action op;\n@@ -715,10 +767,15 @@ void IPAIPU3::setControls(unsigned int frame)\n \n } /* namespace ipa::ipu3 */\n \n-/*\n- * External IPA module interface\n+/**\n+ * \\brief External IPA module interface\n+ *\n+ * The IPAModuleInfo is required to match an IPA module construction against the\n+ * intented pipeline handler with the module. The API and pipeline handler\n+ * versions must match the corresponding IPA interface and pipeline handler.\n+ *\n+ * \\sa struct IPAModuleInfo\n  */\n-\n extern \"C\" {\n const struct IPAModuleInfo ipaModuleInfo = {\n \tIPA_MODULE_API_VERSION,\n@@ -727,6 +784,14 @@ const struct IPAModuleInfo ipaModuleInfo = {\n \t\"ipu3\",\n };\n \n+/**\n+ * \\brief Create an instance of the IPA interface\n+ *\n+ * This function is the entry point of the IPA module. It is called by the IPA\n+ * manager to create an instance of the IPA interface for each camera. When\n+ * matched against with a pipeline handler, the IPAManager will construct an IPA\n+ * instance for each associated Camera.\n+ */\n IPAInterface *ipaCreate()\n {\n \treturn new ipa::ipu3::IPAIPU3();\n","prefixes":["libcamera-devel","v5","03/19"]}