{"id":14269,"url":"https://patchwork.libcamera.org/api/patches/14269/?format=json","web_url":"https://patchwork.libcamera.org/patch/14269/","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":"<20211022151218.111966-4-jeanmichel.hautbois@ideasonboard.com>","date":"2021-10-22T15:12:02","name":"[libcamera-devel,v3,03/19] ipa: ipu3: Document the IPAIPU3 class","commit_ref":null,"pull_url":null,"state":"changes-requested","archived":false,"hash":"152f69ba922ac3a8701048173ee1daff159977ab","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/14269/mbox/","series":[{"id":2651,"url":"https://patchwork.libcamera.org/api/series/2651/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=2651","date":"2021-10-22T15:11:59","name":"Document IPU3 IPA","version":3,"mbox":"https://patchwork.libcamera.org/series/2651/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/14269/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/14269/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 DAA35BF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 22 Oct 2021 15:12:32 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 96FFF68F78;\n\tFri, 22 Oct 2021 17:12:29 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 4A2CF68F59\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 22 Oct 2021 17:12:23 +0200 (CEST)","from tatooine.ideasonboard.com (unknown\n\t[IPv6:2a01:e0a:169:7140:22cc:3af6:5ccb:8367])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 0FE4351D;\n\tFri, 22 Oct 2021 17:12:23 +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=\"VNNp0AS4\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1634915543;\n\tbh=pNgbVFKKknOgR3FSFlOW42jzqNL66l/hekBY7m/7azQ=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=VNNp0AS4MQBTUFblzSv80twlExaBc8wJEkmenLuCobkDe7O80tLxoDR1XiaO2vROU\n\t9Y7HKwgHE3hauIxG8GfgcORRHoX1k4UADHPW/1k1z+GpWFKdbr19ZwLTsxyLr2++gZ\n\t3lpjthFVgVRKpLuZf9Jr4oSJX5gcgxJ88EZ8KtG0=","From":"Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Fri, 22 Oct 2021 17:12:02 +0200","Message-Id":"<20211022151218.111966-4-jeanmichel.hautbois@ideasonboard.com>","X-Mailer":"git-send-email 2.32.0","In-Reply-To":"<20211022151218.111966-1-jeanmichel.hautbois@ideasonboard.com>","References":"<20211022151218.111966-1-jeanmichel.hautbois@ideasonboard.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v3 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>\n---\n src/ipa/ipu3/ipu3.cpp | 83 +++++++++++++++++++++++++++++++++++++------\n 1 file changed, 73 insertions(+), 10 deletions(-)","diff":"diff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp\nindex 6e28a5aa..c5461d8e 100644\n--- a/src/ipa/ipu3/ipu3.cpp\n+++ b/src/ipa/ipu3/ipu3.cpp\n@@ -301,9 +301,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@@ -332,9 +332,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@@ -395,7 +395,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@@ -426,8 +426,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@@ -581,6 +588,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@@ -590,6 +601,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@@ -601,6 +616,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@@ -642,12 +661,26 @@ void IPAIPU3::processEvent(const IPU3Event &event)\n \t}\n }\n \n+/**\n+ * \\brief Process a control list for a request from the application\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 current frame number\n+ * \\param[inout] params the parameter buffer to update\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@@ -670,6 +703,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 current frame number\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@@ -693,6 +736,13 @@ void IPAIPU3::parseStatistics(unsigned int frame,\n \tqueueFrameAction.emit(frame, op);\n }\n \n+/**\n+ * \\brief Handle V4L2 controls for a given \\a frame number\n+ * \\param[in] frame The frame on which the V4L2 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@@ -711,10 +761,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@@ -723,6 +778,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","v3","03/19"]}