Patch Detail
Show a patch.
GET /api/1.1/patches/10611/?format=api
{ "id": 10611, "url": "https://patchwork.libcamera.org/api/1.1/patches/10611/?format=api", "web_url": "https://patchwork.libcamera.org/patch/10611/", "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": "<20201208090042.4824-3-jacopo@jmondi.org>", "date": "2020-12-08T09:00:42", "name": "[libcamera-devel,2/2] android: camera_device: Get sensor properties from DB", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "8cf544a4182786fa2ce3bbda0389dd059faf5ce8", "submitter": { "id": 3, "url": "https://patchwork.libcamera.org/api/1.1/people/3/?format=api", "name": "Jacopo Mondi", "email": "jacopo@jmondi.org" }, "delegate": { "id": 15, "url": "https://patchwork.libcamera.org/api/1.1/users/15/?format=api", "username": "jmondi", "first_name": "Jacopo", "last_name": "Mondi", "email": "jacopo@jmondi.org" }, "mbox": "https://patchwork.libcamera.org/patch/10611/mbox/", "series": [ { "id": 1514, "url": "https://patchwork.libcamera.org/api/1.1/series/1514/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1514", "date": "2020-12-08T09:00:40", "name": "libcamera: Introduce sensor database", "version": 1, "mbox": "https://patchwork.libcamera.org/series/1514/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/10611/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/10611/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 99376BDB22\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 8 Dec 2020 09:00:41 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 8D60267E74;\n\tTue, 8 Dec 2020 10:00:40 +0100 (CET)", "from relay11.mail.gandi.net (relay11.mail.gandi.net\n\t[217.70.178.231])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id A20F8635F2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 8 Dec 2020 10:00:38 +0100 (CET)", "from uno.lan (2-224-242-101.ip172.fastwebnet.it [2.224.242.101])\n\t(Authenticated sender: jacopo@jmondi.org)\n\tby relay11.mail.gandi.net (Postfix) with ESMTPSA id 657F2100009\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 8 Dec 2020 09:00:38 +0000 (UTC)" ], "From": "Jacopo Mondi <jacopo@jmondi.org>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Tue, 8 Dec 2020 10:00:42 +0100", "Message-Id": "<20201208090042.4824-3-jacopo@jmondi.org>", "X-Mailer": "git-send-email 2.29.1", "In-Reply-To": "<20201208090042.4824-1-jacopo@jmondi.org>", "References": "<20201208090042.4824-1-jacopo@jmondi.org>", "MIME-Version": "1.0", "Subject": "[libcamera-devel] [PATCH 2/2] android: camera_device: Get sensor\n\tproperties from DB", "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": "Use the newly introduced camera sensor database to retrieve the\nphysical size of the sensor to register the\nANDROID_SENSOR_INFO_PHYSICAL_SIZE property.\n\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n src/android/camera_device.cpp | 27 ++++++++++++++++++++++-----\n 1 file changed, 22 insertions(+), 5 deletions(-)", "diff": "diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp\nindex 872c7b18ee49..0c756f14c29c 100644\n--- a/src/android/camera_device.cpp\n+++ b/src/android/camera_device.cpp\n@@ -13,6 +13,7 @@\n #include <tuple>\n #include <vector>\n \n+#include <libcamera/camera_sensor_database.h>\n #include <libcamera/control_ids.h>\n #include <libcamera/controls.h>\n #include <libcamera/formats.h>\n@@ -595,6 +596,19 @@ const camera_metadata_t *CameraDevice::getStaticMetadata()\n \tconst ControlInfoMap &controlsInfo = camera_->controls();\n \tconst ControlList &properties = camera_->properties();\n \n+\t/*\n+\t * If the camera sensor is not supported we get an empty SensorEntry.\n+\t * Record that in the log as all the properties retrieved from the\n+\t * empty SensorEntry will be zero.\n+\t */\n+\tconst std::string sensorModel = properties.get<std::string>(properties::Model);\n+\tif (!sensorDatabase.contains(sensorModel)) {\n+\t\tLOG(HAL, Info) << \"Camera sensor \" << sensorModel\n+\t\t\t << \" not supported.\";\n+\t\tLOG(HAL, Info) << \"All sensor-related properties will be set to zero\";\n+\t}\n+\tconst SensorEntry &sensorEntry = sensorDatabase.get(sensorModel);\n+\n \t/* Color correction static metadata. */\n \t{\n \t\tstd::vector<uint8_t> data;\n@@ -775,12 +789,15 @@ 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+\t/*\n+\t * ANDROID_SENSOR_INFO_PHYSICAL_SIZE is in expressed in millimeters\n+\t * while the sensor database reports the physical sizes in nanometers.\n+\t */\n+\tstd::vector<float> physicalSize;\n+\tphysicalSize[0] = static_cast<float>(sensorEntry.physicalSize.width * 10e6);\n+\tphysicalSize[1] = static_cast<float>(sensorEntry.physicalSize.height * 10e6);\n \tstaticMetadata_->addEntry(ANDROID_SENSOR_INFO_PHYSICAL_SIZE,\n-\t\t\t\t physicalSize.data(),\n-\t\t\t\t physicalSize.size());\n+\t\t\t\t physicalSize.data(), physicalSize.size());\n \n \tuint8_t timestampSource = ANDROID_SENSOR_INFO_TIMESTAMP_SOURCE_UNKNOWN;\n \tstaticMetadata_->addEntry(ANDROID_SENSOR_INFO_TIMESTAMP_SOURCE,\n", "prefixes": [ "libcamera-devel", "2/2" ] }