{"id":11724,"url":"https://patchwork.libcamera.org/api/1.1/patches/11724/?format=json","web_url":"https://patchwork.libcamera.org/patch/11724/","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":"<20210325134325.21098-4-jacopo@jmondi.org>","date":"2021-03-25T13:43:25","name":"[libcamera-devel,v3,3/3] android: camera_device: Report sensor physical size","commit_ref":null,"pull_url":null,"state":"not-applicable","archived":false,"hash":"5c0be62e94c415bc4c34549701516cb92257955a","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/1.1/people/3/?format=json","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/11724/mbox/","series":[{"id":1836,"url":"https://patchwork.libcamera.org/api/1.1/series/1836/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1836","date":"2021-03-25T13:43:22","name":"libcamera: Add sensor database","version":3,"mbox":"https://patchwork.libcamera.org/series/1836/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/11724/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/11724/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 3C173C32EB\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 25 Mar 2021 13:43:00 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id E5F5668DA2;\n\tThu, 25 Mar 2021 14:42:59 +0100 (CET)","from relay9-d.mail.gandi.net (relay9-d.mail.gandi.net\n\t[217.70.183.199])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 1660A68D66\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 25 Mar 2021 14:42:58 +0100 (CET)","from uno.LocalDomain (93-61-96-190.ip145.fastwebnet.it\n\t[93.61.96.190]) (Authenticated sender: jacopo@jmondi.org)\n\tby relay9-d.mail.gandi.net (Postfix) with ESMTPSA id 90C91FF814;\n\tThu, 25 Mar 2021 13:42:57 +0000 (UTC)"],"X-Originating-IP":"93.61.96.190","From":"Jacopo Mondi <jacopo@jmondi.org>","To":"libcamera-devel@lists.libcamera.org","Date":"Thu, 25 Mar 2021 14:43:25 +0100","Message-Id":"<20210325134325.21098-4-jacopo@jmondi.org>","X-Mailer":"git-send-email 2.30.0","In-Reply-To":"<20210325134325.21098-1-jacopo@jmondi.org>","References":"<20210325134325.21098-1-jacopo@jmondi.org>","MIME-Version":"1.0","Subject":"[libcamera-devel] [PATCH v3 3/3] android: camera_device: Report\n\tsensor physical size","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":"Calculate the value of the ANDROID_SENSOR_INFO_PHYSICAL_SIZE property\nmultiplying the number of sensor's readable pixels with the pixel unit\ncell size if provided by the Camera.\n\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n src/android/camera_device.cpp | 16 +++++++++-------\n 1 file changed, 9 insertions(+), 7 deletions(-)","diff":"diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp\nindex 5fbf6f82ee9a..ef5ed37e829a 100644\n--- a/src/android/camera_device.cpp\n+++ b/src/android/camera_device.cpp\n@@ -940,6 +940,15 @@ const camera_metadata_t *CameraDevice::getStaticMetadata()\n \t\t};\n \t\tstaticMetadata_->addEntry(ANDROID_SENSOR_INFO_PIXEL_ARRAY_SIZE,\n \t\t\t\t\t  data.data(), data.size());\n+\n+\tstd::vector<float> physicalSize(2);\n+\tif (properties.contains(properties::UnitCellSize)) {\n+\t\tconst Size &unitCellSize =\n+\t\t\tproperties.get<Size>(properties::UnitCellSize);\n+\t\tphysicalSize[0] = unitCellSize.width * pixelArraySize[0] / 1e6f;\n+\t\tphysicalSize[1] = unitCellSize.height * pixelArraySize[1] / 1e6f;\n+\t\tstaticMetadata_->addEntry(ANDROID_SENSOR_INFO_PHYSICAL_SIZE,\n+\t\t\t\t\t  physicalSize.data(), physicalSize.size());\n \t}\n \n \t{\n@@ -987,13 +996,6 @@ const camera_metadata_t *CameraDevice::getStaticMetadata()\n \t\t\t\t  testPatterModes.data(),\n \t\t\t\t  testPatterModes.size());\n \n-\tstd::vector<float> physicalSize = {\n-\t\t2592, 1944,\n-\t};\n-\tstaticMetadata_->addEntry(ANDROID_SENSOR_INFO_PHYSICAL_SIZE,\n-\t\t\t\t  physicalSize.data(),\n-\t\t\t\t  physicalSize.size());\n-\n \tuint8_t timestampSource = ANDROID_SENSOR_INFO_TIMESTAMP_SOURCE_UNKNOWN;\n \tstaticMetadata_->addEntry(ANDROID_SENSOR_INFO_TIMESTAMP_SOURCE,\n \t\t\t\t  &timestampSource, 1);\n","prefixes":["libcamera-devel","v3","3/3"]}