{"id":8440,"url":"https://patchwork.libcamera.org/api/1.1/patches/8440/?format=json","web_url":"https://patchwork.libcamera.org/patch/8440/","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":"<20200626102531.1187650-5-naush@raspberrypi.com>","date":"2020-06-26T10:25:31","name":"[libcamera-devel,4/4] libcamera: ipa: raspberrypi: Populate focus FoM from the ISP statistics","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"2b2c279c879f0fe750f6676a27a2a5c20cffcadd","submitter":{"id":34,"url":"https://patchwork.libcamera.org/api/1.1/people/34/?format=json","name":"Naushir Patuck","email":"naush@raspberrypi.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/8440/mbox/","series":[{"id":1044,"url":"https://patchwork.libcamera.org/api/1.1/series/1044/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1044","date":"2020-06-26T10:25:27","name":"Focus feedback control","version":1,"mbox":"https://patchwork.libcamera.org/series/1044/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/8440/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/8440/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 E9AD8C0109\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 26 Jun 2020 10:25:55 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id A9461609E1;\n\tFri, 26 Jun 2020 12:25:55 +0200 (CEST)","from mail-wm1-x342.google.com (mail-wm1-x342.google.com\n\t[IPv6:2a00:1450:4864:20::342])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id A6DEC609C3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 26 Jun 2020 12:25:52 +0200 (CEST)","by mail-wm1-x342.google.com with SMTP id g75so8320443wme.5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 26 Jun 2020 03:25:52 -0700 (PDT)","from naushir-VirtualBox.patuck.local ([88.97.76.4])\n\tby smtp.gmail.com with ESMTPSA id\n\tr8sm21959679wrp.40.2020.06.26.03.25.51\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tFri, 26 Jun 2020 03:25:51 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=raspberrypi.com header.i=@raspberrypi.com\n\theader.b=\"pWYUEeuC\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=3RU7nfROHXCrdwxGepRolrIoDIpO0fD+jscobJR6rCE=;\n\tb=pWYUEeuCebhaEj8X4U9WqHl8ql4oI5ErgL878bARbQvDDefs8cUmItcFEaIK4jj+Lj\n\tkSXBEdkUn/bBbHcu1H5asOGobH8Yk0EN2QUFyWFriFnMJlogJQ1Q1j3vuoxZk/IQzlOZ\n\tX8GQsf3+71Uo/eIoO9ASDCcBkmHB11hBDDGoQLRJaR65WwCUV1j+Vl1U8v6A+D6uwpqv\n\t1X3vaGplZh5h6XqLdzqYo5ht/Lk3ULbKGNU3Plj+xnsoIjGCGowsXABae/jW1A19pGqX\n\t++It4Xgbcl2eUET465OBgGbrIZsY1LJlBqqkdnBYL7sOL4VkD++6MlgBTI6FIHseF+zF\n\tjjIQ==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references:mime-version:content-transfer-encoding;\n\tbh=3RU7nfROHXCrdwxGepRolrIoDIpO0fD+jscobJR6rCE=;\n\tb=pHfWrjxXMDCdPcd7mI9dT/RYNi7uInpRTFIiJnavzgxMt7jpA+XBjiP2at0helsMYz\n\ttcr+hl1rs/dpH4njvVi/O0+ijQ6W2qm9eNXW+n0pF/uqQBcTiuGZWZxH72VKKUwkwhCZ\n\t9PyX9oeOl4ijwGhVqGMyjLprRkGHPV510H6kgusDJF9NXl+GffTnczyulZ00Azcl2jnE\n\tjt/hZwUF5gk3UowfPIDhU+8ozYcwVojv+9mLqO7olHw6VYX1uo+N75Ft5gWZqqPhNIJO\n\tn21Wnfrl6vmB51uR5aMsc/A7d+Za+NnJmmBYyoMZiF+pvdYl7eCD4RztO5fMG4P74vgo\n\tf5GQ==","X-Gm-Message-State":"AOAM5301J+47XI4lhiJDYIW1DCOt2YMSHLfbK9ybAhmfuCcTGZaz/eoi\n\taLk1ujyzie2ZZ+XNxoAcprha8e336FU=","X-Google-Smtp-Source":"ABdhPJxOhVy3mTi9xOfQCDfhhiemLGeiK5dZTRGaMQusDbmjJS3drBSRN+OKJF/1jAVGsnVfV8dy0g==","X-Received":"by 2002:a1c:2044:: with SMTP id g65mr589495wmg.127.1593167152170;\n\tFri, 26 Jun 2020 03:25:52 -0700 (PDT)","From":"Naushir Patuck <naush@raspberrypi.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Fri, 26 Jun 2020 11:25:31 +0100","Message-Id":"<20200626102531.1187650-5-naush@raspberrypi.com>","X-Mailer":"git-send-email 2.25.1","In-Reply-To":"<20200626102531.1187650-1-naush@raspberrypi.com>","References":"<20200626102531.1187650-1-naush@raspberrypi.com>","MIME-Version":"1.0","Subject":"[libcamera-devel] [PATCH 4/4] libcamera: ipa: raspberrypi: Populate\n\tfocus FoM from the ISP statistics","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>","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Switch FocusStatus::num to unsigned int for convenience.\n\nFill in libcamera::controls::FocusFoM with the average of the middle two\nregions (across a 4x3 grid) FoM statistics from the ISP.\n\nSigned-off-by: Naushir Patuck <naush@raspberrypi.com>\n---\n src/ipa/raspberrypi/controller/focus_status.h |  2 +-\n src/ipa/raspberrypi/raspberrypi.cpp           | 12 ++++++++++++\n 2 files changed, 13 insertions(+), 1 deletion(-)","diff":"diff --git a/src/ipa/raspberrypi/controller/focus_status.h b/src/ipa/raspberrypi/controller/focus_status.h\nindex 3ad88777..ace2fe2c 100644\n--- a/src/ipa/raspberrypi/controller/focus_status.h\n+++ b/src/ipa/raspberrypi/controller/focus_status.h\n@@ -17,7 +17,7 @@ extern \"C\" {\n #endif\n \n struct FocusStatus {\n-\tint num;\n+\tunsigned int num;\n \tuint32_t focus_measures[FOCUS_REGIONS];\n };\n \ndiff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp\nindex 62730198..b1f27861 100644\n--- a/src/ipa/raspberrypi/raspberrypi.cpp\n+++ b/src/ipa/raspberrypi/raspberrypi.cpp\n@@ -42,6 +42,7 @@\n #include \"contrast_status.h\"\n #include \"controller.hpp\"\n #include \"dpc_status.h\"\n+#include \"focus_status.h\"\n #include \"geq_status.h\"\n #include \"lux_status.h\"\n #include \"metadata.hpp\"\n@@ -405,6 +406,17 @@ void IPARPi::reportMetadata()\n \t\t\t\t\t static_cast<int32_t>(blackLevelStatus->black_level_g),\n \t\t\t\t\t static_cast<int32_t>(blackLevelStatus->black_level_g),\n \t\t\t\t\t static_cast<int32_t>(blackLevelStatus->black_level_b) });\n+\n+\tFocusStatus *focusStatus = rpiMetadata_.GetLocked<FocusStatus>(\"focus.status\");\n+\tif (focusStatus && focusStatus->num == 12) {\n+\t\t/*\n+\t\t * We get a 4x3 grid of regions by default. Calculate the average\n+\t\t * FoM over the central two positions to give an overall scene FoM.\n+\t\t * This can change later if it is not deemed suitable.\n+\t\t */\n+\t\tint32_t focusFoM = (focusStatus->focus_measures[5] + focusStatus->focus_measures[6]) / 2;\n+\t\tlibcameraMetadata_.set(controls::FocusFoM, focusFoM);\n+\t}\n }\n \n /*\n","prefixes":["libcamera-devel","4/4"]}