{"id":15641,"url":"https://patchwork.libcamera.org/api/1.1/patches/15641/?format=json","web_url":"https://patchwork.libcamera.org/patch/15641/","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":"<20220406141709.164794-7-umang.jain@ideasonboard.com>","date":"2022-04-06T14:17:09","name":"[libcamera-devel,IPAIPU3,v5,6/6] ipa: ipu3: Inline parseStatistics() into processStatsBuffer()","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"0b77e41218f87f8ff05b123cff6dae1612693c0c","submitter":{"id":86,"url":"https://patchwork.libcamera.org/api/1.1/people/86/?format=json","name":"Umang Jain","email":"umang.jain@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/15641/mbox/","series":[{"id":3037,"url":"https://patchwork.libcamera.org/api/1.1/series/3037/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=3037","date":"2022-04-06T14:17:03","name":"ipa: ipu3: Replace event-based ops with dedicated functions","version":5,"mbox":"https://patchwork.libcamera.org/series/3037/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/15641/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/15641/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 65DEEC3256\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  6 Apr 2022 14:17:42 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 2982165644;\n\tWed,  6 Apr 2022 16:17:42 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id C05BC633A4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  6 Apr 2022 16:17:40 +0200 (CEST)","from perceval.ideasonboard.com (unknown [27.57.186.178])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id EC12E482;\n\tWed,  6 Apr 2022 16:17:38 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1649254662;\n\tbh=hM+QtYApyJn6xFKXIdi7rcRUtSQGmYDu2MruGUIJ7Ww=;\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=qQqcQ4Onl3ked7bvCxnGFDtJYfS7a/jUK5rwkXN5Bl5cfGD0inlqgar6E40RrSpvC\n\tdNYiQTGk3tnEuHH2cEWMYtx/e2sRfMum/6Ze8WqDr/sP0TFEqoP+FWaxvmvzreT/eR\n\tZQhMb0BFsL1l66CouSWomSSV19VhfbqdkzawbJavhkerDAn1N+H4VZwqmCVKpl/BEf\n\tpgvhfWYO1MVPDcWIrRg5ysLj8YoHjPGaryuMIgwfI7o4C8Py41nbj+75WNJGRGxtmY\n\t4Mb9sjZSjjx4GCfgMybCBfjXg8/WfOKjSMcddAYglu4vRhjTgUk68muxfKJzM+Fr28\n\tAijpUn++YX7wA==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1649254660;\n\tbh=hM+QtYApyJn6xFKXIdi7rcRUtSQGmYDu2MruGUIJ7Ww=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=EkkeVIJQvg3Azvi4yboccaDWsNtP86H/lqYPXc59j88Annew+xQbMJkLqT6MweLu9\n\tjIJ9RSHGM9CLObQL3rnkKAgRuSWUa3826tbv/a+FYSZvttuR7weliLPQF9X05NX4DG\n\tItBqvndc96UIm6X/bNpQ7iiJgvjIylSnZPVchdAY="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"EkkeVIJQ\"; dkim-atps=neutral","To":"libcamera-devel@lists.libcamera.org","Date":"Wed,  6 Apr 2022 19:47:09 +0530","Message-Id":"<20220406141709.164794-7-umang.jain@ideasonboard.com>","X-Mailer":"git-send-email 2.31.1","In-Reply-To":"<20220406141709.164794-1-umang.jain@ideasonboard.com>","References":"<20220406141709.164794-1-umang.jain@ideasonboard.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [IPAIPU3 PATCH v5 6/6] ipa: ipu3: Inline\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>\nReviewed-by: Laurent Pinchart <laurent.pinchart@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 0543a2e..7ecd377 100644\n--- a/ipu3.cpp\n+++ b/ipu3.cpp\n@@ -60,10 +60,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@@ -379,43 +375,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@@ -438,11 +397,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@@ -472,6 +431,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","v5","6/6"]}