{"id":15599,"url":"https://patchwork.libcamera.org/api/patches/15599/?format=json","web_url":"https://patchwork.libcamera.org/patch/15599/","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":"<20220331163058.171418-7-umang.jain@ideasonboard.com>","date":"2022-03-31T16:30:58","name":"[libcamera-devel,IPAIPU3,v4,6/6] ipa: ipu3: Inlink parseStatistics() into processStatsBuffer()","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"0b77e41218f87f8ff05b123cff6dae1612693c0c","submitter":{"id":86,"url":"https://patchwork.libcamera.org/api/people/86/?format=json","name":"Umang Jain","email":"umang.jain@ideasonboard.com"},"delegate":{"id":12,"url":"https://patchwork.libcamera.org/api/users/12/?format=json","username":"uajain","first_name":"Umang","last_name":"Jain","email":"umang.jain@ideasonboard.com"},"mbox":"https://patchwork.libcamera.org/patch/15599/mbox/","series":[{"id":3020,"url":"https://patchwork.libcamera.org/api/series/3020/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=3020","date":"2022-03-31T16:30:52","name":"ipa: ipu3: Replace event-based ops with dedicated functions​","version":4,"mbox":"https://patchwork.libcamera.org/series/3020/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/15599/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/15599/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 88D96C3256\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 31 Mar 2022 16:31:38 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 3C49C6563F;\n\tThu, 31 Mar 2022 18:31:38 +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 7927C65637\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 31 Mar 2022 18:31:36 +0200 (CEST)","from perceval.ideasonboard.com (unknown [103.74.73.150])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 8AD118E6;\n\tThu, 31 Mar 2022 18:31:31 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1648744298;\n\tbh=3ccGD3IjTda+w4Gj9Sb9LbL0gb50X1i1BGLRk7TpEqg=;\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=FZwIlDVIxTGnukZPeYdyvfDJXDX9y2Fzmd5utw9GNlvzuBZMwdKDyN3Wfi9FbyzhQ\n\tnTa+W2fm0O/gI8fhgFd6DB1+GBiZWPQE9vqPvpJ0I/LF0PWwNZ+2ryfL+xZ3Q2RU2d\n\t2JvmGYaL80tlQe1e0gt/+wiqthUOoe69fw4mc19oBxIQ/r2QjKv6RoSX5X9Q9JFpQG\n\tPd3Rekk5WkBYvW98JPqq6UTHwCjbboRh1r+fzpJahRWFKFDm1zLZx59sZjRcWmTXF0\n\tKR6MgfjeqyY+F4Q40RKc2+tWNmKwt5YNf5K6FN3tinxcAYR2p4H0e6rMiO/XjgdFhc\n\t6Y8B7p7MPgN3g==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1648744296;\n\tbh=3ccGD3IjTda+w4Gj9Sb9LbL0gb50X1i1BGLRk7TpEqg=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=knkiCqQdSEUWwDMty3CyNX+eRtK9f8Js0wgkZe3+PDTg+0Dfl6fkDrYh7/teJImiR\n\tZJ+f7Mnre44BQGFQSYe9K6B1u26T0gsH6YxI/NzY7PuO3UcF2O+YWpnmuMVpK5fEBN\n\tf5UC+l9R+W8cEfWdN5i8xCblYktafrY7/KACHN1g="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"knkiCqQd\"; dkim-atps=neutral","To":"libcamera-devel@lists.libcamera.org","Date":"Thu, 31 Mar 2022 22:00:58 +0530","Message-Id":"<20220331163058.171418-7-umang.jain@ideasonboard.com>","X-Mailer":"git-send-email 2.31.1","In-Reply-To":"<20220331163058.171418-1-umang.jain@ideasonboard.com>","References":"<20220331163058.171418-1-umang.jain@ideasonboard.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [IPAIPU3 PATCH v4 6/6] ipa: ipu3: Inlink\n\tparseStatistics() into processStatsBuffer()","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":"Umang Jain via libcamera-devel <libcamera-devel@lists.libcamera.org>","Reply-To":"Umang Jain <umang.jain@ideasonboard.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Since we have moved away from switch/case on the operation ID,\nthere's little reason to split the operation in two functions.\n\nSigned-off-by: Umang Jain <umang.jain@ideasonboard.com>\n---\n ipu3.cpp | 74 ++++++++++++++++++++++++--------------------------------\n 1 file changed, 31 insertions(+), 43 deletions(-)","diff":"diff --git a/ipu3.cpp b/ipu3.cpp\nindex a435005..9063d7e 100644\n--- a/ipu3.cpp\n+++ b/ipu3.cpp\n@@ -61,10 +61,6 @@ private:\n \t\t\t    const ControlInfoMap &sensorControls,\n \t\t\t    ControlInfoMap *ipaControls);\n \tvoid runAiq(unsigned int frame);\n-\tvoid parseStatistics(unsigned int frame,\n-\t\t\t     int64_t frameTimestamp,\n-\t\t\t     const ipu3_uapi_stats_3a *stats,\n-\t\t\t     const ControlList& sensorCtrls);\n \n \tvoid setControls(unsigned int frame);\n \n@@ -380,43 +376,6 @@ void IPAIPU3::processStatsBuffer(const uint32_t frame, const int64_t frameTimest\n \tconst ipu3_uapi_stats_3a *stats =\n \t\treinterpret_cast<ipu3_uapi_stats_3a *>(mem.data());\n \n-\tparseStatistics(frame, frameTimestamp, stats, sensorControls);\n-}\n-\n-void IPAIPU3::runAiq([[maybe_unused]] unsigned int frame)\n-{\n-\t/* Run algorithms into/using this context structure */\n-\tresultsHistory_.extendOne();\n-\taiq::AiqResults& latestResults = resultsHistory_.latest();\n-\n-\t/* Todo: Refactor AiqInputParameters interface to set following parameters. */\n-\taiqInputParams_.afParams.lens_position = lensPosition_;\n-\taiqInputParams_.afParams.lens_movement_start_timestamp = lensMovementStartTime_;\n-\n-\taiq_.run2a(frame, aiqInputParams_, latestResults);\n-\n-\texposure_ = latestResults.ae()->exposures[0].sensor_exposure->coarse_integration_time;\n-\tgain_ = latestResults.ae()->exposures[0].sensor_exposure->analog_gain_code_global;\n-\n-\t/*\n-\t * Af algorithm compares the timestamp of start of the lens movement and\n-\t * that of the statistics generated to estimate whether next lens\n-\t * position should be produced.\n-\t * \\todo use the lens movement start time reported by the pipeline handler.\n-\t */\n-\tif (lensPosition_ != latestResults.af()->next_lens_position) {\n-\t\tutils::time_point time = utils::clock::now();\n-\t\tuint64_t usecs = std::chrono::duration_cast<std::chrono::microseconds>(time.time_since_epoch()).count();\n-\t\tlensMovementStartTime_ = usecs;\n-\t}\n-\tlensPosition_ = latestResults.af()->next_lens_position;\n-}\n-\n-void IPAIPU3::parseStatistics(unsigned int frame,\n-\t\t\t      int64_t frameTimestamp,\n-\t\t\t      const ipu3_uapi_stats_3a *stats,\n-\t\t\t      const ControlList& sensorCtrls)\n-{\n \tControlList ctrls(controls::controls);\n \n \t/* \\todo React to statistics and update internal state machine. */\n@@ -439,11 +398,11 @@ void IPAIPU3::parseStatistics(unsigned int frame,\n \tint32_t effectiveGain = 0;\n \tControlValue ctrlValue;\n \n-\tctrlValue = sensorCtrls.get(V4L2_CID_EXPOSURE);\n+\tctrlValue = sensorControls.get(V4L2_CID_EXPOSURE);\n \tif (!ctrlValue.isNone())\n \t\teffectiveExpo = ctrlValue.get<int32_t>();\n \n-\tctrlValue = sensorCtrls.get(V4L2_CID_ANALOGUE_GAIN);\n+\tctrlValue = sensorControls.get(V4L2_CID_ANALOGUE_GAIN);\n \tif (!ctrlValue.isNone())\n \t\teffectiveGain = ctrlValue.get<int32_t>();\n \n@@ -473,6 +432,35 @@ void IPAIPU3::parseStatistics(unsigned int frame,\n \tmetadataReady.emit(frame, ctrls);\n }\n \n+void IPAIPU3::runAiq([[maybe_unused]] unsigned int frame)\n+{\n+\t/* Run algorithms into/using this context structure */\n+\tresultsHistory_.extendOne();\n+\taiq::AiqResults& latestResults = resultsHistory_.latest();\n+\n+\t/* Todo: Refactor AiqInputParameters interface to set following parameters. */\n+\taiqInputParams_.afParams.lens_position = lensPosition_;\n+\taiqInputParams_.afParams.lens_movement_start_timestamp = lensMovementStartTime_;\n+\n+\taiq_.run2a(frame, aiqInputParams_, latestResults);\n+\n+\texposure_ = latestResults.ae()->exposures[0].sensor_exposure->coarse_integration_time;\n+\tgain_ = latestResults.ae()->exposures[0].sensor_exposure->analog_gain_code_global;\n+\n+\t/*\n+\t * Af algorithm compares the timestamp of start of the lens movement and\n+\t * that of the statistics generated to estimate whether next lens\n+\t * position should be produced.\n+\t * \\todo use the lens movement start time reported by the pipeline handler.\n+\t */\n+\tif (lensPosition_ != latestResults.af()->next_lens_position) {\n+\t\tutils::time_point time = utils::clock::now();\n+\t\tuint64_t usecs = std::chrono::duration_cast<std::chrono::microseconds>(time.time_since_epoch()).count();\n+\t\tlensMovementStartTime_ = usecs;\n+\t}\n+\tlensPosition_ = latestResults.af()->next_lens_position;\n+}\n+\n void IPAIPU3::setControls(unsigned int frame)\n {\n \tControlList sensorCtrls(ctrls_);\n","prefixes":["libcamera-devel","IPAIPU3","v4","6/6"]}