Patch Detail
Show a patch.
GET /api/1.1/patches/16218/?format=api
{ "id": 16218, "url": "https://patchwork.libcamera.org/api/1.1/patches/16218/?format=api", "web_url": "https://patchwork.libcamera.org/patch/16218/", "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": "<20220613142853.98484-10-jeanmichel.hautbois@ideasonboard.com>", "date": "2022-06-13T14:28:52", "name": "[libcamera-devel,09/10] ipa: raspberrypi: Set a constrained range", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "02189e548d501497505ee3c91eb5d5712e1e751c", "submitter": { "id": 75, "url": "https://patchwork.libcamera.org/api/1.1/people/75/?format=api", "name": "Jean-Michel Hautbois", "email": "jeanmichel.hautbois@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/16218/mbox/", "series": [ { "id": 3174, "url": "https://patchwork.libcamera.org/api/1.1/series/3174/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3174", "date": "2022-06-13T14:28:43", "name": "ipa: raspberrypi: Introduce an autofocus algorithm", "version": 1, "mbox": "https://patchwork.libcamera.org/series/3174/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/16218/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/16218/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 6A0B4C327A\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 13 Jun 2022 14:29:12 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id E54FE65657;\n\tMon, 13 Jun 2022 16:29:11 +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 E870465643\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 13 Jun 2022 16:29:01 +0200 (CEST)", "from tatooine.ideasonboard.com (unknown\n\t[IPv6:2a01:e0a:169:7140:a1c7:c28c:7720:9b30])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 97BDB440;\n\tMon, 13 Jun 2022 16:29:01 +0200 (CEST)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1655130551;\n\tbh=iWjADkK045MYS1Dm7UxHvu762oUHDwJbDtPi/pi8KmE=;\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=Qe+zXQBN/MFQvgju6b9BXwokkYvoH2lmGjO5qKhN4H136i9Gon3E5lk7mcFQ8CZRr\n\tQb2Dv1bvK5bGtXSNYcAt3VxF7T5Pe64C43VngRUJ2BwStcxEvB0a9dRvsVEbEm4BqH\n\tfMq5Pf9T/gwA7EYLLc6PfpOi+6F0vJUjEJ/yDUZeiNRL3u3ZUYiBD+46hMZQDir7qZ\n\tZ4bvXj9VfULCfIXErGutvrLRwn3/+utclKTLf+6CpCqWaqQ0HH6ksnUJTVESNSnO1l\n\tRDVHTTEz3s6lj9RCgsSBln82T0yID+FvEvIzJvgqSCU6Zn/eqi/KWr/HsP7SrmVQrc\n\tg4t/kJVFcZSXQ==", "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1655130541;\n\tbh=iWjADkK045MYS1Dm7UxHvu762oUHDwJbDtPi/pi8KmE=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=csmdBXU+9pfhcUtIBzW7Hxi8wgadCaB2pOQ5YysGg4SQ6SfQu7I/afqL/wxuCeviv\n\tgoZY/gGkvi7u1amCorlexKuMg43G8ZFJ8oObf7Hsnrl077z+FEjTHj9hIFK91aWX2W\n\t2HNmnM/1OTuI0ebKQwQsCC+MKAt7j1GZnwYA1uYg=" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"csmdBXU+\"; dkim-atps=neutral", "To": "libcamera-devel@lists.libcamera.org", "Date": "Mon, 13 Jun 2022 16:28:52 +0200", "Message-Id": "<20220613142853.98484-10-jeanmichel.hautbois@ideasonboard.com>", "X-Mailer": "git-send-email 2.34.1", "In-Reply-To": "<20220613142853.98484-1-jeanmichel.hautbois@ideasonboard.com>", "References": "<20220613142853.98484-1-jeanmichel.hautbois@ideasonboard.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH 09/10] ipa: raspberrypi: Set a constrained\n\trange", "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": "Jean-Michel Hautbois via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>", "Reply-To": "Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "Give the algorithm a way to have a constrained range for the lens.\nAdd a default SetRange() call and implement it to set the low bound\nand high bound for the search.\n\nThere is no functionnal change expected but gives the ability for the\npipeline handler to set the range at runtime.\n\nSigned-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>\n---\n .../raspberrypi/controller/af_algorithm.hpp | 2 ++\n src/ipa/raspberrypi/controller/iob/af.cpp | 24 ++++++++++++++-----\n src/ipa/raspberrypi/controller/iob/af.h | 4 ++++\n 3 files changed, 24 insertions(+), 6 deletions(-)", "diff": "diff --git a/src/ipa/raspberrypi/controller/af_algorithm.hpp b/src/ipa/raspberrypi/controller/af_algorithm.hpp\nindex 925b2d03..0008113b 100644\n--- a/src/ipa/raspberrypi/controller/af_algorithm.hpp\n+++ b/src/ipa/raspberrypi/controller/af_algorithm.hpp\n@@ -28,6 +28,8 @@ public:\n \tvirtual void SetWindows(const libcamera::Rectangle &afWindows) = 0;\n \t// set AF range\n \tvirtual void SetRange(const uint32_t &range) = 0;\n+\t// set Lens Range\n+\tvirtual void SetLensRange(const uint32_t &low, const uint32_t &high) = 0;\n \t// set AF speed\n \tvirtual void setSpeed(const uint32_t &speed) = 0;\n };\ndiff --git a/src/ipa/raspberrypi/controller/iob/af.cpp b/src/ipa/raspberrypi/controller/iob/af.cpp\nindex 1d9bc2bc..a10e1d0a 100644\n--- a/src/ipa/raspberrypi/controller/iob/af.cpp\n+++ b/src/ipa/raspberrypi/controller/iob/af.cpp\n@@ -40,7 +40,7 @@ Af::Af(Controller *controller)\n \t: AfAlgorithm(controller), focus_(0), bestFocus_(0),\n \t currentContrast_(0.0), previousContrast_(0.0), maxContrast_(0.0),\n \t maxStep_(0), coarseCompleted_(false), fineCompleted_(false),\n-\t mode_(libcamera::controls::AfModeManual)\n+\t mode_(libcamera::controls::AfModeManual), lowStep_(0), highStep_(kMaxFocusSteps)\n {\n }\n \n@@ -90,6 +90,18 @@ void Af::SetRange([[maybe_unused]] const uint32_t &range)\n {\n }\n \n+void Af::SetLensRange(const uint32_t &low, const uint32_t &high)\n+{\n+\tlowStep_ = low;\n+\thighStep_ = high;\n+\n+\tLOG(IoBAf, Debug) << \"Lens range set between \" << lowStep_\n+\t\t\t << \" and \" << highStep_;\n+\n+\tfocus_ = lowStep_;\n+\tmaxStep_ = highStep_;\n+}\n+\n void Af::setSpeed([[maybe_unused]] const uint32_t &speed)\n {\n }\n@@ -118,7 +130,7 @@ void Af::afCoarseScan()\n \t\tstatus_.lensPosition = focus_;\n \t\tpreviousContrast_ = 0;\n \t\tmaxStep_ = std::clamp(focus_ + static_cast<uint32_t>((focus_ * kFineRange)),\n-\t\t\t\t 0U, kMaxFocusSteps);\n+\t\t\t\t 0U, highStep_);\n \t}\n }\n \n@@ -136,7 +148,7 @@ void Af::afFineScan()\n \n bool Af::afScan(uint32_t minSteps)\n {\n-\tif (focus_ > maxStep_) {\n+\tif (focus_ + minSteps > maxStep_) {\n \t\t/* If the max step is reached, move lens to the position. */\n \t\tstatus_.lensPosition = bestFocus_;\n \t\treturn true;\n@@ -180,13 +192,13 @@ bool Af::afScan(uint32_t minSteps)\n void Af::afReset()\n {\n \tLOG(IoBAf, Debug) << \"Reset AF parameters\";\n-\tstatus_.lensPosition = 0;\n-\tfocus_ = 0;\n+\tstatus_.lensPosition = lowStep_;\n+\tfocus_ = lowStep_;\n+\tmaxStep_ = highStep_;\n \tstatus_.state = libcamera::controls::AfStateScanning;\n \tpreviousContrast_ = 0.0;\n \tcoarseCompleted_ = false;\n \tfineCompleted_ = false;\n-\tmaxStep_ = kMaxFocusSteps;\n \tmaxContrast_ = 0.0;\n }\n \ndiff --git a/src/ipa/raspberrypi/controller/iob/af.h b/src/ipa/raspberrypi/controller/iob/af.h\nindex 12d7bbbd..52b9c37d 100644\n--- a/src/ipa/raspberrypi/controller/iob/af.h\n+++ b/src/ipa/raspberrypi/controller/iob/af.h\n@@ -29,6 +29,7 @@ public:\n \tvoid Pause(const uint32_t &pause) override;\n \tvoid SetWindows(const libcamera::Rectangle &afWindows) override;\n \tvoid SetRange(const uint32_t &range) override;\n+\tvoid SetLensRange(const uint32_t &low, const uint32_t &high) override;\n \tvoid setSpeed(const uint32_t &speed) override;\n private:\n \tbool afNeedIgnoreFrame();\n@@ -58,6 +59,9 @@ private:\n \tbool fineCompleted_;\n \n \tuint32_t mode_;\n+\n+\tuint32_t lowStep_;\n+\tuint32_t highStep_;\n };\n \n } /* namespace RPiController */\n", "prefixes": [ "libcamera-devel", "09/10" ] }