{"id":16213,"url":"https://patchwork.libcamera.org/api/1.1/patches/16213/?format=json","web_url":"https://patchwork.libcamera.org/patch/16213/","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":"<20220613142853.98484-5-jeanmichel.hautbois@ideasonboard.com>","date":"2022-06-13T14:28:47","name":"[libcamera-devel,04/10] ipa: raspberrypi: Send the AF status back","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"8a4f1825b37c9339972f73ac281827e8b72531b8","submitter":{"id":75,"url":"https://patchwork.libcamera.org/api/1.1/people/75/?format=json","name":"Jean-Michel Hautbois","email":"jeanmichel.hautbois@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/16213/mbox/","series":[{"id":3174,"url":"https://patchwork.libcamera.org/api/1.1/series/3174/?format=json","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/16213/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/16213/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 C3F82C3276\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 13 Jun 2022 14:29:09 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 80D6F65637;\n\tMon, 13 Jun 2022 16:29:07 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id C472D65635\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 13 Jun 2022 16:29:00 +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 7845687B;\n\tMon, 13 Jun 2022 16:29:00 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1655130547;\n\tbh=kWPYmsC3gArNgGN0Lgmk04URpBFgcaidkxOv3EkffAE=;\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=OOQDcdUAFHlW2jkNNYs0kHBJRPhCJxNGiaVOpYjXHo6QdXe+2Fc3TdpJKvAavHH1K\n\t73e7sWk46ztOMXX1FlmjvSJAgJI8VX9qIdKMBDPTbBnhylLWN7sVBrMM2rJ4rwVcUi\n\tRtwzloTXcP+L+kvZy4RxrukYZKiQFRkwK8pXZgUKvUZzeI3mdspnZ8VkdlESIp+Em9\n\tEspm7A2aRRM9uBz+LpIFJ/W/tVo3sl0pCpkw57AgDo8AIGl5FnPRr5eogxNjpBdNvf\n\t2Oozf0wJbPqnj+Z5ySo6QQVfaYV3nBxGoT6ZY8ZtYTa93XOJL8EB1BYyiFDnsLvga9\n\tvP9KPaJFTEMAQ==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1655130540;\n\tbh=kWPYmsC3gArNgGN0Lgmk04URpBFgcaidkxOv3EkffAE=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=SP3rZjTI3x4nX6UHx+BTIkqjPv3I7Si0WAGKpkcL97A2RmAx16l4UnJGQhEUtz6CD\n\tAwzqaaJRLUTz8cyZHrNC8Ov0TaPKlRXh4idRfPjVu6MlP9SWIxkwm1c+YYXnpT9rJ7\n\t3l4iP6+L0p9nVQ2w+q9knEvgQdZGGsBB7vUUGDv4="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"SP3rZjTI\"; dkim-atps=neutral","To":"libcamera-devel@lists.libcamera.org","Date":"Mon, 13 Jun 2022 16:28:47 +0200","Message-Id":"<20220613142853.98484-5-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 04/10] ipa: raspberrypi: Send the AF\n\tstatus back","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":"The user can read the status for each frame with the AfState control\nvalue. Populate the AF status into the metadata when it is available.\n\nSigned-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>\n---\n include/libcamera/ipa/raspberrypi.h |  3 ++-\n src/ipa/raspberrypi/raspberrypi.cpp | 13 +++++++++++++\n 2 files changed, 15 insertions(+), 1 deletion(-)","diff":"diff --git a/include/libcamera/ipa/raspberrypi.h b/include/libcamera/ipa/raspberrypi.h\nindex 6a56b008..519f7160 100644\n--- a/include/libcamera/ipa/raspberrypi.h\n+++ b/include/libcamera/ipa/raspberrypi.h\n@@ -45,7 +45,8 @@ static const ControlInfoMap Controls({\n \t\t{ &controls::ColourCorrectionMatrix, ControlInfo(-16.0f, 16.0f) },\n \t\t{ &controls::ScalerCrop, ControlInfo(Rectangle{}, Rectangle(65535, 65535, 65535, 65535), Rectangle{}) },\n \t\t{ &controls::FrameDurationLimits, ControlInfo(INT64_C(1000), INT64_C(1000000000)) },\n-\t\t{ &controls::draft::NoiseReductionMode, ControlInfo(controls::draft::NoiseReductionModeValues) }\n+\t\t{ &controls::draft::NoiseReductionMode, ControlInfo(controls::draft::NoiseReductionModeValues) },\n+\t\t{ &controls::AfState, ControlInfo(controls::AfStateValues) }\n \t}, controls::controls);\n \n } /* namespace RPi */\ndiff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp\nindex 1e9e2e61..a4e1c834 100644\n--- a/src/ipa/raspberrypi/raspberrypi.cpp\n+++ b/src/ipa/raspberrypi/raspberrypi.cpp\n@@ -547,6 +547,11 @@ void IPARPi::reportMetadata()\n \t\t\tm[i] = ccmStatus->matrix[i];\n \t\tlibcameraMetadata_.set(controls::ColourCorrectionMatrix, m);\n \t}\n+\n+\tAfStatus *afStatus = rpiMetadata_.GetLocked<AfStatus>(\"af.status\");\n+\tif (afStatus) {\n+\t\tlibcameraMetadata_.set(controls::AfState, afStatus->state);\n+\t}\n }\n \n bool IPARPi::validateSensorControls()\n@@ -1101,6 +1106,14 @@ void IPARPi::processStats(unsigned int bufferId)\n \n \t\tsetDelayedControls.emit(ctrls);\n \t}\n+\n+\tstruct AfStatus afStatus;\n+\tif (rpiMetadata_.Get(\"af.status\", afStatus) == 0) {\n+\t\tControlList lensCtrls(lensCtrls_);\n+\t\tlensCtrls.set(V4L2_CID_FOCUS_ABSOLUTE,\n+\t\t\t      static_cast<int32_t>(afStatus.lensPosition));\n+\t\tsetLensControls.emit(lensCtrls);\n+\t}\n }\n \n void IPARPi::applyAWB(const struct AwbStatus *awbStatus, ControlList &ctrls)\n","prefixes":["libcamera-devel","04/10"]}