Patch Detail
Show a patch.
GET /api/1.1/patches/18512/?format=api
{ "id": 18512, "url": "https://patchwork.libcamera.org/api/1.1/patches/18512/?format=api", "web_url": "https://patchwork.libcamera.org/patch/18512/", "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": "<20230331081930.19289-6-dse@thaumatec.com>", "date": "2023-03-31T08:19:25", "name": "[libcamera-devel,v6,05/10] ipa: af_hill_climbing: Add \"Windows\" metering mode", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "00d8ec36ccb412d950d85fb99c75f2b4246fa84e", "submitter": { "id": 126, "url": "https://patchwork.libcamera.org/api/1.1/people/126/?format=api", "name": "Daniel Semkowicz", "email": "dse@thaumatec.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/18512/mbox/", "series": [ { "id": 3831, "url": "https://patchwork.libcamera.org/api/1.1/series/3831/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3831", "date": "2023-03-31T08:19:21", "name": "ipa: rkisp1: Add autofocus algorithm", "version": 6, "mbox": "https://patchwork.libcamera.org/series/3831/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/18512/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/18512/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 6D476C329F\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 31 Mar 2023 08:19:58 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 300E26275E;\n\tFri, 31 Mar 2023 10:19:57 +0200 (CEST)", "from mail-lf1-x130.google.com (mail-lf1-x130.google.com\n\t[IPv6:2a00:1450:4864:20::130])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 54E8362722\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 31 Mar 2023 10:19:50 +0200 (CEST)", "by mail-lf1-x130.google.com with SMTP id h25so27886772lfv.6\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 31 Mar 2023 01:19:50 -0700 (PDT)", "from localhost.localdomain ([91.90.166.178])\n\tby smtp.gmail.com with ESMTPSA id\n\tt1-20020ac24c01000000b004e84a8c3d86sm281459lfq.42.2023.03.31.01.19.49\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tFri, 31 Mar 2023 01:19:49 -0700 (PDT)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1680250797;\n\tbh=UhL1xu+M5DkWdlIAnFE96GJAJsI2ezOWH1CcduS/W6c=;\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=Etx/tDtCUgjfZLLmV0FmngAr68AK5kbzpbHRMKjA/wmDaOjvtOq7O/ZbN15deO37Q\n\tsUQg+ACpn9ATQLcjAwvq2dtuFISMgxlytrnCST9a9i3IGwQavGlxzbsw8qpz8IQ36z\n\tglZH6Jr6JKxZVQ87r2GlUgfpZiUSQpez52nx9pd631maw74w1a21AfangPoGliwdew\n\taZbE45QlYnnWwuXNJ4J8gkWLVms/wQHE07nODbKOL0t9/WYhxfRCs0g8gD4Jqo1xN0\n\t+13XoDpiSPLq71d94rC/tGHDD5FS7mDGutAPsb88j83LGbBjP7u9ylI+37XpB7WV3X\n\t9VRZsBspjsG4g==", "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=thaumatec-com.20210112.gappssmtp.com; s=20210112; t=1680250789;\n\tx=1682842789; \n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:from:to:cc:subject:date\n\t:message-id:reply-to;\n\tbh=euwlN3aSuvomdf/PRBNJbZXtWLrJyd6jWu6M9zlbGas=;\n\tb=VmQdnUmVoUf+M0W4FNUtyo5HPNp0OTg402wi7IrsygRYbMm021GAcb1/o6B5d++J8v\n\tCNpuj9w6cR190QlgD5gl0iDYN5fxI0ZqnUEwg9Utt7atsa1nPirClqq2ZL/jcq0sC4Ob\n\t9moSi1PqGpMYUQ/kdPe1IZNxErfiUusFpbQNenLz/8P7iCoP9klQzoCLq4WAEz/0Sklf\n\t9LOyfb1skS5mUkC6/H088ZpLY4hdiO6q/cE0Tqerhvwh3nLLaJwcypIcqE/BY/C904HD\n\tHGPmjz3jairIIw3KGGpqh9k0ADIGUkUm4PImXm/calsnLOJIzsUatonmZeyKEBo5ljFW\n\tUUtg==" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected)\n\theader.d=thaumatec-com.20210112.gappssmtp.com\n\theader.i=@thaumatec-com.20210112.gappssmtp.com header.b=\"VmQdnUmV\"; \n\tdkim-atps=neutral", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112; t=1680250789; x=1682842789;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc\n\t:subject:date:message-id:reply-to;\n\tbh=euwlN3aSuvomdf/PRBNJbZXtWLrJyd6jWu6M9zlbGas=;\n\tb=zsCLt6qYq3Wlh7nYbX9Beta/oYreS4rABmQ7fWYM3KqSlyiBCoceY12NA+JDT07o5l\n\tiNXM8XV7DAamG1pYVSAryAVMY3y5f538XQL/LjnQnSTQGKajpFxzJxWZXIaCAuUSYpPE\n\tEE/9+fsjrBeHTIz3bOe9X0XMe8elVFaEwlfyntmwAjobt7S7V8ntx36+cp+vh+HO7JVo\n\tW3P+EGle4/26eLpCAHZTw3MEr8d+bzHJkxPQPPQ1Zcb/PQMSEiYMkg2q/jzM+3e531J8\n\tRVer2CqMql+yjU0H6+G0vNq/oqDWS7pkfezj1Zhany4L4goXuaXaJtu/sMUKQ+KhlqtW\n\twVpg==", "X-Gm-Message-State": "AAQBX9dxV1W1Dba6s+6ouoceQ/1xXX8cX5WIddZEmPBckp7MkIOaTbPr\n\tenj1U0WLTm0H6shE4TqJrdQEsbGurEpqdYmXPAzqkQ==", "X-Google-Smtp-Source": "AKy350YT3xInhHyUREfCj9LrlbRd5Zo57Kroyl+PYcdqWZSae4JN9XHtaHfxGY0rBQsHjHn3MItHCA==", "X-Received": "by 2002:a19:f60e:0:b0:4a9:39f4:579a with SMTP id\n\tx14-20020a19f60e000000b004a939f4579amr7419903lfe.66.1680250789602; \n\tFri, 31 Mar 2023 01:19:49 -0700 (PDT)", "To": "libcamera-devel@lists.libcamera.org", "Date": "Fri, 31 Mar 2023 10:19:25 +0200", "Message-Id": "<20230331081930.19289-6-dse@thaumatec.com>", "X-Mailer": "git-send-email 2.39.2", "In-Reply-To": "<20230331081930.19289-1-dse@thaumatec.com>", "References": "<20230331081930.19289-1-dse@thaumatec.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v6 05/10] ipa: af_hill_climbing: Add\n\t\"Windows\" metering mode", "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": "Daniel Semkowicz via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>", "Reply-To": "Daniel Semkowicz <dse@thaumatec.com>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "Add support for setting user defined auto focus window in the\nAfHillClimbing. This enables usage of AfMetering and AfWindows controls.\nEach time, there is a need for changing the window configuration in the\nISP, the signal is emitted. Platform layer that wants to use\nthe \"Windows\" metering mode, needs to connect to this signal\nand configure the ISP on each emission.\n\nCurrently only one window is supported.\n\nSigned-off-by: Daniel Semkowicz <dse@thaumatec.com>\n---\n .../libipa/algorithms/af_hill_climbing.cpp | 62 +++++++++++++++++--\n src/ipa/libipa/algorithms/af_hill_climbing.h | 10 +++\n 2 files changed, 66 insertions(+), 6 deletions(-)", "diff": "diff --git a/src/ipa/libipa/algorithms/af_hill_climbing.cpp b/src/ipa/libipa/algorithms/af_hill_climbing.cpp\nindex 244b8803..0fb17df3 100644\n--- a/src/ipa/libipa/algorithms/af_hill_climbing.cpp\n+++ b/src/ipa/libipa/algorithms/af_hill_climbing.cpp\n@@ -63,9 +63,8 @@ LOG_DEFINE_CATEGORY(Af)\n * movement range rather than coarse search result.\n * \\todo Implement setRange.\n * \\todo Implement setSpeed.\n- * \\todo Implement setMeteringMode.\n- * \\todo Implement setWindows.\n * \\todo Implement the AfPauseDeferred mode.\n+ * \\todo Implement support for multiple AF windows.\n */\n \n /**\n@@ -99,6 +98,27 @@ int AfHillClimbing::init(int32_t minFocusPosition, int32_t maxFocusPosition,\n \treturn 0;\n }\n \n+/**\n+ * \\brief Configure the AfHillClimbing with sensor information\n+ * \\param[in] outputSize Camera sensor output size\n+ *\n+ * This method should be called in the libcamera::ipa::Algorithm::configure()\n+ * method of the platform layer.\n+ */\n+void AfHillClimbing::configure(const Size &outputSize)\n+{\n+\t/*\n+\t * Default AF window of 3/4 size of the camera sensor output,\n+\t * placed at the center\n+\t */\n+\tdefaultWindow_ = Rectangle(static_cast<int>(outputSize.width / 8),\n+\t\t\t\t static_cast<int>(outputSize.height / 8),\n+\t\t\t\t 3 * outputSize.width / 4,\n+\t\t\t\t 3 * outputSize.height / 4);\n+\n+\twindowUpdateRequested.emit(defaultWindow_);\n+}\n+\n /**\n * \\brief Run the auto focus algorithm loop\n * \\param[in] currentContrast New value of contrast measured for current frame\n@@ -185,6 +205,14 @@ void AfHillClimbing::skipFrames(uint32_t n)\n \t\tframesToSkip_ = n;\n }\n \n+/**\n+ * \\var AfHillClimbing::windowUpdateRequested\n+ * \\brief Signal emitted when change in AF window was requested\n+ *\n+ * Platform layer supporting AF windows should connect to this signal\n+ * and configure the ISP with new window on each emition.\n+ */\n+\n void AfHillClimbing::setMode(controls::AfModeEnum mode)\n {\n \tif (mode == mode_)\n@@ -210,14 +238,36 @@ void AfHillClimbing::setSpeed([[maybe_unused]] controls::AfSpeedEnum speed)\n \tLOG(Af, Error) << \"setSpeed() not implemented!\";\n }\n \n-void AfHillClimbing::setMeteringMode([[maybe_unused]] controls::AfMeteringEnum metering)\n+void AfHillClimbing::setMeteringMode(controls::AfMeteringEnum metering)\n {\n-\tLOG(Af, Error) << \"setMeteringMode() not implemented!\";\n+\tif (metering == meteringMode_)\n+\t\treturn;\n+\n+\tmeteringMode_ = metering;\n+\n+\tswitch (metering) {\n+\tcase controls::AfMeteringAuto:\n+\t\twindowUpdateRequested.emit(defaultWindow_);\n+\t\tbreak;\n+\tcase controls::AfMeteringWindows:\n+\t\twindowUpdateRequested.emit(userWindow_);\n+\t\tbreak;\n+\t}\n }\n \n-void AfHillClimbing::setWindows([[maybe_unused]] Span<const Rectangle> windows)\n+void AfHillClimbing::setWindows(Span<const Rectangle> windows)\n {\n-\tLOG(Af, Error) << \"setWindows() not implemented!\";\n+\tif (windows.size() != 1) {\n+\t\tLOG(Af, Error) << \"Only one AF window is supported\";\n+\t\treturn;\n+\t}\n+\n+\tLOG(Af, Debug) << \"setWindows: \" << windows[0];\n+\n+\tuserWindow_ = windows[0];\n+\n+\tif (meteringMode_ == controls::AfMeteringWindows)\n+\t\twindowUpdateRequested.emit(userWindow_);\n }\n \n void AfHillClimbing::setTrigger(controls::AfTriggerEnum trigger)\ndiff --git a/src/ipa/libipa/algorithms/af_hill_climbing.h b/src/ipa/libipa/algorithms/af_hill_climbing.h\nindex 2147939b..0f7c65db 100644\n--- a/src/ipa/libipa/algorithms/af_hill_climbing.h\n+++ b/src/ipa/libipa/algorithms/af_hill_climbing.h\n@@ -10,6 +10,7 @@\n #pragma once\n \n #include <libcamera/base/log.h>\n+#include <libcamera/base/signal.h>\n \n #include \"af.h\"\n \n@@ -26,12 +27,15 @@ class AfHillClimbing : public Af\n public:\n \tint init(int32_t minFocusPosition, int32_t maxFocusPosition,\n \t\t const YamlObject &tuningData);\n+\tvoid configure(const Size &outputSize);\n \tint32_t process(double currentContrast);\n \tvoid skipFrames(uint32_t n);\n \n \tcontrols::AfStateEnum state() override { return state_; }\n \tcontrols::AfPauseStateEnum pauseState() override { return pauseState_; }\n \n+\tSignal<const Rectangle &> windowUpdateRequested;\n+\n private:\n \tvoid setMode(controls::AfModeEnum mode) override;\n \tvoid setRange(controls::AfRangeEnum range) override;\n@@ -54,6 +58,7 @@ private:\n \tcontrols::AfModeEnum mode_ = controls::AfModeManual;\n \tcontrols::AfStateEnum state_ = controls::AfStateIdle;\n \tcontrols::AfPauseStateEnum pauseState_ = controls::AfPauseStateRunning;\n+\tcontrols::AfMeteringEnum meteringMode_ = controls::AfMeteringAuto;\n \n \t/* Current focus lens position. */\n \tint32_t lensPosition_ = 0;\n@@ -84,6 +89,11 @@ private:\n \n \t/* Max ratio of variance change, 0.0 < maxChange_ < 1.0. */\n \tdouble maxChange_;\n+\n+\t/* Default AF window. */\n+\tRectangle defaultWindow_;\n+\t/* AF window set by user using AF_WINDOWS control. */\n+\tRectangle userWindow_;\n };\n \n } /* namespace ipa::algorithms */\n", "prefixes": [ "libcamera-devel", "v6", "05/10" ] }