Patch Detail
Show a patch.
GET /api/1.1/patches/17635/?format=api
{ "id": 17635, "url": "https://patchwork.libcamera.org/api/1.1/patches/17635/?format=api", "web_url": "https://patchwork.libcamera.org/patch/17635/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/1.1/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20221019110434.17767-3-laurent.pinchart@ideasonboard.com>", "date": "2022-10-19T11:04:32", "name": "[libcamera-devel,v1,2/4] ipa: Pass metadata to Algorithm::process() function", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "251a8d04e712e26b72ca4f3d7e44b8eaee7209b0", "submitter": { "id": 2, "url": "https://patchwork.libcamera.org/api/1.1/people/2/?format=api", "name": "Laurent Pinchart", "email": "laurent.pinchart@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/17635/mbox/", "series": [ { "id": 3567, "url": "https://patchwork.libcamera.org/api/1.1/series/3567/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3567", "date": "2022-10-19T11:04:30", "name": "ipa: Fill metadata in individual algorithms", "version": 1, "mbox": "https://patchwork.libcamera.org/series/3567/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/17635/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/17635/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 70571BD16B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 19 Oct 2022 11:05:04 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id B155662E59;\n\tWed, 19 Oct 2022 13:05:03 +0200 (CEST)", "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 148A162E45\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 19 Oct 2022 13:05:01 +0200 (CEST)", "from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi\n\t[62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id A38A05A4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 19 Oct 2022 13:05:00 +0200 (CEST)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1666177503;\n\tbh=I0pSobrHpsk5LfES/QvWcPKwDxBmazYuDuK3ZzGhAB8=;\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=Ql0aefxxSxEuAbdMgpr5/SLIuzDw3zcf8gn77lsUcVz2L2oZRv12Lmkt2lQipJbx9\n\t9reUjBzimnCHbDJ03Xm69aWG3Vpt1UtKLqiAEl1vrBQ0uA/iNx9u2h+Tib5s/iTIcS\n\tsGJUg6Lz3GTf9DJ4XuAubRImlgmKVhlDmouQIf8/Df3a2G5OFQs6kpHbNYwICfh+pw\n\tPWmD4hiNdDY+pj73ZtyjzYRaGB3mZxtx0q9imCsuAdDFnX1MBRLyhSgTFBaqJF4x2C\n\taErxYQ5oJhL21zT0TQLFe76tBfRRKNynrO0Yn6ZfTvgG9j8FkeDEYzcizKT2x7UEbR\n\tZMmQaX8drXFYg==", "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1666177500;\n\tbh=I0pSobrHpsk5LfES/QvWcPKwDxBmazYuDuK3ZzGhAB8=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=I1V0lrU+D9K6cBzuTMMlnoWVk9OYFHeW8VDJB8JRQAj9N8l5ojMkTe9ZecozftD58\n\t/CGNyAgX1Ucwvf8CWuciwkSkKIz3MAUgjfriaXGATuUm4UytyGj4dQREE0XAhnv5Gk\n\twuhAFhzbKIKt0PycruB8SlBtYQafSgZfJztes1ns=" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"I1V0lrU+\"; dkim-atps=neutral", "To": "libcamera-devel@lists.libcamera.org", "Date": "Wed, 19 Oct 2022 14:04:32 +0300", "Message-Id": "<20221019110434.17767-3-laurent.pinchart@ideasonboard.com>", "X-Mailer": "git-send-email 2.37.3", "In-Reply-To": "<20221019110434.17767-1-laurent.pinchart@ideasonboard.com>", "References": "<20221019110434.17767-1-laurent.pinchart@ideasonboard.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v1 2/4] ipa: Pass metadata to\n\tAlgorithm::process() function", "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": "Laurent Pinchart via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>", "Reply-To": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "Extend the Algorithm::process() function with a metadata control list,\nto be filled by individual algorithms with frame metadata. Update the\nrkisp1 and ipu3 IPA modules accordingly, and drop the dead code in the\nIPARkISP1::prepareMetadata() function while at it.\n\nThis only creates the infrastructure, filling metadata in individual\nalgorithms will be handled separately.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/ipa/ipu3/algorithms/af.cpp | 2 ++\n src/ipa/ipu3/algorithms/af.h | 2 +-\n src/ipa/ipu3/algorithms/agc.cpp | 2 ++\n src/ipa/ipu3/algorithms/agc.h | 2 +-\n src/ipa/ipu3/algorithms/awb.cpp | 1 +\n src/ipa/ipu3/algorithms/awb.h | 2 +-\n src/ipa/ipu3/algorithms/tone_mapping.cpp | 2 ++\n src/ipa/ipu3/algorithms/tone_mapping.h | 2 +-\n src/ipa/ipu3/ipu3.cpp | 3 ++-\n src/ipa/libipa/algorithm.cpp | 5 +++--\n src/ipa/libipa/algorithm.h | 1 +\n src/ipa/rkisp1/algorithms/agc.cpp | 4 +++-\n src/ipa/rkisp1/algorithms/agc.h | 2 +-\n src/ipa/rkisp1/algorithms/awb.cpp | 1 +\n src/ipa/rkisp1/algorithms/awb.h | 2 +-\n src/ipa/rkisp1/rkisp1.cpp | 17 +++--------------\n 16 files changed, 26 insertions(+), 24 deletions(-)", "diff": "diff --git a/src/ipa/ipu3/algorithms/af.cpp b/src/ipa/ipu3/algorithms/af.cpp\nindex 75632aa39d21..2d728871a63b 100644\n--- a/src/ipa/ipu3/algorithms/af.cpp\n+++ b/src/ipa/ipu3/algorithms/af.cpp\n@@ -408,6 +408,7 @@ bool Af::afIsOutOfFocus(IPAContext &context)\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[out] metadata Metadata for the frame, to be filled by the algorithm\n * \\param[in] stats The statistics buffer of IPU3\n *\n * Ideally, a clear image also has a relatively higher contrast. So, every\n@@ -423,6 +424,7 @@ bool Af::afIsOutOfFocus(IPAContext &context)\n */\n void Af::process(IPAContext &context, [[maybe_unused]] const uint32_t frame,\n \t\t [[maybe_unused]] IPAFrameContext &frameContext,\n+\t\t [[maybe_unused]] ControlList &metadata,\n \t\t const ipu3_uapi_stats_3a *stats)\n {\n \t/* Evaluate the AF buffer length */\ndiff --git a/src/ipa/ipu3/algorithms/af.h b/src/ipa/ipu3/algorithms/af.h\nindex 89d37ac18615..ea7ca647df12 100644\n--- a/src/ipa/ipu3/algorithms/af.h\n+++ b/src/ipa/ipu3/algorithms/af.h\n@@ -35,7 +35,7 @@ public:\n \t\t IPAFrameContext &frameContext,\n \t\t ipu3_uapi_params *params) override;\n \tvoid process(IPAContext &context, const uint32_t frame,\n-\t\t IPAFrameContext &frameContext,\n+\t\t IPAFrameContext &frameContext, ControlList &metadata,\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 a1a3c38ffe84..44dd5c809e26 100644\n--- a/src/ipa/ipu3/algorithms/agc.cpp\n+++ b/src/ipa/ipu3/algorithms/agc.cpp\n@@ -319,6 +319,7 @@ double Agc::estimateLuminance(IPAActiveState &activeState,\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[out] metadata Metadata for the frame, to be filled by the algorithm\n * \\param[in] stats The IPU3 statistics and ISP results\n *\n * Identify the current image brightness, and use that to estimate the optimal\n@@ -326,6 +327,7 @@ double Agc::estimateLuminance(IPAActiveState &activeState,\n */\n void Agc::process(IPAContext &context, [[maybe_unused]] const uint32_t frame,\n \t\t IPAFrameContext &frameContext,\n+\t\t [[maybe_unused]] ControlList &metadata,\n \t\t const ipu3_uapi_stats_3a *stats)\n {\n \t/*\ndiff --git a/src/ipa/ipu3/algorithms/agc.h b/src/ipa/ipu3/algorithms/agc.h\nindex 59b4b9843c2f..9106cbefe87a 100644\n--- a/src/ipa/ipu3/algorithms/agc.h\n+++ b/src/ipa/ipu3/algorithms/agc.h\n@@ -29,7 +29,7 @@ public:\n \n \tint configure(IPAContext &context, const IPAConfigInfo &configInfo) override;\n \tvoid process(IPAContext &context, const uint32_t frame,\n-\t\t IPAFrameContext &frameContext,\n+\t\t IPAFrameContext &frameContext, ControlList &metadata,\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 0dbd7d4c374f..836eb0687181 100644\n--- a/src/ipa/ipu3/algorithms/awb.cpp\n+++ b/src/ipa/ipu3/algorithms/awb.cpp\n@@ -389,6 +389,7 @@ void Awb::calculateWBGains(const ipu3_uapi_stats_3a *stats)\n */\n void Awb::process(IPAContext &context, [[maybe_unused]] const uint32_t frame,\n \t\t [[maybe_unused]] IPAFrameContext &frameContext,\n+\t\t [[maybe_unused]] ControlList &metadata,\n \t\t const ipu3_uapi_stats_3a *stats)\n {\n \tcalculateWBGains(stats);\ndiff --git a/src/ipa/ipu3/algorithms/awb.h b/src/ipa/ipu3/algorithms/awb.h\nindex 28e2d38a711c..c38c425c3654 100644\n--- a/src/ipa/ipu3/algorithms/awb.h\n+++ b/src/ipa/ipu3/algorithms/awb.h\n@@ -43,7 +43,7 @@ public:\n \t\t IPAFrameContext &frameContext,\n \t\t ipu3_uapi_params *params) override;\n \tvoid process(IPAContext &context, const uint32_t frame,\n-\t\t IPAFrameContext &frameContext,\n+\t\t IPAFrameContext &frameContext, ControlList &metadata,\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 eac3d4064443..6fcc03f3fcf7 100644\n--- a/src/ipa/ipu3/algorithms/tone_mapping.cpp\n+++ b/src/ipa/ipu3/algorithms/tone_mapping.cpp\n@@ -78,6 +78,7 @@ void ToneMapping::prepare([[maybe_unused]] IPAContext &context,\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[out] metadata Metadata for the frame, to be filled by the algorithm\n * \\param[in] stats The IPU3 statistics and ISP results\n *\n * The tone mapping look up table is generated as an inverse power curve from\n@@ -85,6 +86,7 @@ void ToneMapping::prepare([[maybe_unused]] IPAContext &context,\n */\n void ToneMapping::process(IPAContext &context, [[maybe_unused]] const uint32_t frame,\n \t\t\t [[maybe_unused]] IPAFrameContext &frameContext,\n+\t\t\t [[maybe_unused]] ControlList &metadata,\n \t\t\t [[maybe_unused]] const ipu3_uapi_stats_3a *stats)\n {\n \t/*\ndiff --git a/src/ipa/ipu3/algorithms/tone_mapping.h b/src/ipa/ipu3/algorithms/tone_mapping.h\nindex 822e5168df82..ab2a1c000f2f 100644\n--- a/src/ipa/ipu3/algorithms/tone_mapping.h\n+++ b/src/ipa/ipu3/algorithms/tone_mapping.h\n@@ -22,7 +22,7 @@ public:\n \tvoid prepare(IPAContext &context, const uint32_t frame,\n \t\t IPAFrameContext &frameContext, ipu3_uapi_params *params) override;\n \tvoid process(IPAContext &context, const uint32_t frame,\n-\t\t IPAFrameContext &frameContext,\n+\t\t IPAFrameContext &frameContext, ControlList &metadata,\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 891643e057b8..0ccc6bf5c8af 100644\n--- a/src/ipa/ipu3/ipu3.cpp\n+++ b/src/ipa/ipu3/ipu3.cpp\n@@ -631,9 +631,10 @@ void IPAIPU3::processStatsBuffer(const uint32_t frame,\n \tdouble lineDuration = context_.configuration.sensor.lineDuration.get<std::micro>();\n \tint32_t vBlank = context_.configuration.sensor.defVBlank;\n \tControlList ctrls(controls::controls);\n+\tControlList metadata(controls::controls);\n \n \tfor (auto const &algo : algorithms())\n-\t\talgo->process(context_, frame, frameContext, stats);\n+\t\talgo->process(context_, frame, frameContext, metadata, stats);\n \n \tsetControls(frame);\n \ndiff --git a/src/ipa/libipa/algorithm.cpp b/src/ipa/libipa/algorithm.cpp\nindex 55abddab2b0a..a34c583d947e 100644\n--- a/src/ipa/libipa/algorithm.cpp\n+++ b/src/ipa/libipa/algorithm.cpp\n@@ -106,12 +106,13 @@ namespace ipa {\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[out] metadata Metadata for the frame, to be filled by the algorithm\n * \\param[in] stats The IPA statistics and ISP results\n *\n * This function is called while camera is running for every frame processed by\n * the ISP, to process statistics generated from that frame by the ISP.\n- * Algorithms shall use this data to run calculations and update their state\n- * accordingly.\n+ * Algorithms shall use this data to run calculations, update their state\n+ * accordingly, and fill the frame metadata.\n *\n * Processing shall not take an undue amount of time, and any extended or\n * computationally expensive calculations or operations must be handled\ndiff --git a/src/ipa/libipa/algorithm.h b/src/ipa/libipa/algorithm.h\nindex d8601f9ccaff..793247be8129 100644\n--- a/src/ipa/libipa/algorithm.h\n+++ b/src/ipa/libipa/algorithm.h\n@@ -55,6 +55,7 @@ public:\n \tvirtual void process([[maybe_unused]] typename Module::Context &context,\n \t\t\t [[maybe_unused]] const uint32_t frame,\n \t\t\t [[maybe_unused]] typename Module::FrameContext &frameContext,\n+\t\t\t [[maybe_unused]] ControlList &metadata,\n \t\t\t [[maybe_unused]] const typename Module::Stats *stats)\n \t{\n \t}\ndiff --git a/src/ipa/rkisp1/algorithms/agc.cpp b/src/ipa/rkisp1/algorithms/agc.cpp\nindex 04062a364e7f..9de11a2a3bca 100644\n--- a/src/ipa/rkisp1/algorithms/agc.cpp\n+++ b/src/ipa/rkisp1/algorithms/agc.cpp\n@@ -288,7 +288,9 @@ 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, [[maybe_unused]] const uint32_t frame,\n-\t\t IPAFrameContext &frameContext, const rkisp1_stat_buffer *stats)\n+\t\t IPAFrameContext &frameContext,\n+\t\t [[maybe_unused]] ControlList &metadata,\n+\t\t const rkisp1_stat_buffer *stats)\n {\n \t/*\n \t * \\todo Verify that the exposure and gain applied by the sensor for\ndiff --git a/src/ipa/rkisp1/algorithms/agc.h b/src/ipa/rkisp1/algorithms/agc.h\nindex 9ad5c32fd6f6..99af09167331 100644\n--- a/src/ipa/rkisp1/algorithms/agc.h\n+++ b/src/ipa/rkisp1/algorithms/agc.h\n@@ -30,7 +30,7 @@ public:\n \t\t IPAFrameContext &frameContext,\n \t\t rkisp1_params_cfg *params) override;\n \tvoid process(IPAContext &context, const uint32_t frame,\n-\t\t IPAFrameContext &frameContext,\n+\t\t IPAFrameContext &frameContext, ControlList &metadata,\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 3349948a3acf..9b97db7d5c5a 100644\n--- a/src/ipa/rkisp1/algorithms/awb.cpp\n+++ b/src/ipa/rkisp1/algorithms/awb.cpp\n@@ -208,6 +208,7 @@ void Awb::queueRequest(IPAContext &context,\n void Awb::process(IPAContext &context,\n \t\t [[maybe_unused]] const uint32_t frame,\n \t\t IPAFrameContext &frameContext,\n+\t\t [[maybe_unused]] ControlList &metadata,\n \t\t const rkisp1_stat_buffer *stats)\n {\n \tconst rkisp1_cif_isp_stat *params = &stats->params;\ndiff --git a/src/ipa/rkisp1/algorithms/awb.h b/src/ipa/rkisp1/algorithms/awb.h\nindex d76b538288ec..3659b2d5405f 100644\n--- a/src/ipa/rkisp1/algorithms/awb.h\n+++ b/src/ipa/rkisp1/algorithms/awb.h\n@@ -27,7 +27,7 @@ public:\n \t\t\t IPAFrameContext &frameContext,\n \t\t\t const ControlList &controls) override;\n \tvoid process(IPAContext &context, const uint32_t frame,\n-\t\t IPAFrameContext &frameCtx,\n+\t\t IPAFrameContext &frameContext, ControlList &metadata,\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 3f5c1a58695c..bef5211d5c34 100644\n--- a/src/ipa/rkisp1/rkisp1.cpp\n+++ b/src/ipa/rkisp1/rkisp1.cpp\n@@ -69,7 +69,6 @@ protected:\n \n private:\n \tvoid setControls(unsigned int frame);\n-\tvoid prepareMetadata(unsigned int frame, unsigned int aeState);\n \n \tstd::map<unsigned int, FrameBuffer> buffers_;\n \tstd::map<unsigned int, MappedFrameBuffer> mappedBuffers_;\n@@ -338,14 +337,14 @@ void IPARkISP1::processStatsBuffer(const uint32_t frame, const uint32_t bufferId\n \tframeContext.sensor.gain =\n \t\tcamHelper_->gain(sensorControls.get(V4L2_CID_ANALOGUE_GAIN).get<int32_t>());\n \n-\tunsigned int aeState = 0;\n+\tControlList metadata(controls::controls);\n \n \tfor (auto const &algo : algorithms())\n-\t\talgo->process(context_, frame, frameContext, stats);\n+\t\talgo->process(context_, frame, frameContext, metadata, stats);\n \n \tsetControls(frame);\n \n-\tprepareMetadata(frame, aeState);\n+\tmetadataReady.emit(frame, metadata);\n }\n \n void IPARkISP1::setControls(unsigned int frame)\n@@ -366,16 +365,6 @@ void IPARkISP1::setControls(unsigned int frame)\n \tsetSensorControls.emit(frame, ctrls);\n }\n \n-void IPARkISP1::prepareMetadata(unsigned int frame, unsigned int aeState)\n-{\n-\tControlList ctrls(controls::controls);\n-\n-\tif (aeState)\n-\t\tctrls.set(controls::AeLocked, aeState == 2);\n-\n-\tmetadataReady.emit(frame, ctrls);\n-}\n-\n } /* namespace ipa::rkisp1 */\n \n /*\n", "prefixes": [ "libcamera-devel", "v1", "2/4" ] }