Patch Detail
Show a patch.
GET /api/1.1/patches/12157/?format=api
{ "id": 12157, "url": "https://patchwork.libcamera.org/api/1.1/patches/12157/?format=api", "web_url": "https://patchwork.libcamera.org/patch/12157/", "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": "<20210430173803.198220-2-jacopo@jmondi.org>", "date": "2021-04-30T17:38:01", "name": "[libcamera-devel,v6,1/3] libcamera: Introduce camera sensor properties", "commit_ref": "a58a94e4c21465ede803c48162f1f791188a17f4", "pull_url": null, "state": "accepted", "archived": false, "hash": "f5923a6e2feefc86aaa6767c4669ed9150cbc94c", "submitter": { "id": 3, "url": "https://patchwork.libcamera.org/api/1.1/people/3/?format=api", "name": "Jacopo Mondi", "email": "jacopo@jmondi.org" }, "delegate": { "id": 14, "url": "https://patchwork.libcamera.org/api/1.1/users/14/?format=api", "username": "pinchartl", "first_name": "Laurent", "last_name": "Pinchart", "email": "laurent.pinchart@ideasonboard.com" }, "mbox": "https://patchwork.libcamera.org/patch/12157/mbox/", "series": [ { "id": 1991, "url": "https://patchwork.libcamera.org/api/1.1/series/1991/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1991", "date": "2021-04-30T17:38:00", "name": "Introduce CameraSensorProperties database", "version": 6, "mbox": "https://patchwork.libcamera.org/series/1991/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/12157/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/12157/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 43A71BDE4F\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 30 Apr 2021 17:37:30 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 13D0968914;\n\tFri, 30 Apr 2021 19:37:28 +0200 (CEST)", "from relay12.mail.gandi.net (relay12.mail.gandi.net\n\t[217.70.178.232])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 9AB3B688A5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 30 Apr 2021 19:37:26 +0200 (CEST)", "from uno.LocalDomain (93-61-96-190.ip145.fastwebnet.it\n\t[93.61.96.190]) (Authenticated sender: jacopo@jmondi.org)\n\tby relay12.mail.gandi.net (Postfix) with ESMTPSA id 31DEF200006;\n\tFri, 30 Apr 2021 17:37:26 +0000 (UTC)" ], "From": "Jacopo Mondi <jacopo@jmondi.org>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Fri, 30 Apr 2021 19:38:01 +0200", "Message-Id": "<20210430173803.198220-2-jacopo@jmondi.org>", "X-Mailer": "git-send-email 2.31.1", "In-Reply-To": "<20210430173803.198220-1-jacopo@jmondi.org>", "References": "<20210430173803.198220-1-jacopo@jmondi.org>", "MIME-Version": "1.0", "Subject": "[libcamera-devel] [PATCH v6 1/3] libcamera: Introduce camera sensor\n\tproperties", "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": "Introduce a database of camera sensor properties, which contains\ninformation on the camera sensor which are not possible, or desirable,\nto retrieve from the device at run time.\n\nThe camera sensor database is accessed through a static function and\nis indexed using the camera sensor model as reported by\nproperties::Model.\n\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n .../internal/camera_sensor_properties.h | 24 +++++++\n include/libcamera/internal/meson.build | 1 +\n src/libcamera/camera_sensor_properties.cpp | 71 +++++++++++++++++++\n src/libcamera/meson.build | 1 +\n 4 files changed, 97 insertions(+)\n create mode 100644 include/libcamera/internal/camera_sensor_properties.h\n create mode 100644 src/libcamera/camera_sensor_properties.cpp", "diff": "diff --git a/include/libcamera/internal/camera_sensor_properties.h b/include/libcamera/internal/camera_sensor_properties.h\nnew file mode 100644\nindex 000000000000..f5e242cb34a2\n--- /dev/null\n+++ b/include/libcamera/internal/camera_sensor_properties.h\n@@ -0,0 +1,24 @@\n+/* SPDX-License-Identifier: LGPL-2.1-or-later */\n+/*\n+ * Copyright (C) 2021, Google Inc.\n+ *\n+ * camera_sensor_properties.h - Database of camera sensor properties\n+ */\n+#ifndef __LIBCAMERA_SENSOR_CAMERA_SENSOR_PROPERTIES_H__\n+#define __LIBCAMERA_SENSOR_CAMERA_SENSOR_PROPERTIES_H__\n+\n+#include <string>\n+\n+#include <libcamera/geometry.h>\n+\n+namespace libcamera {\n+\n+struct CameraSensorProperties {\n+\tstatic const CameraSensorProperties *get(const std::string &sensor);\n+\n+\tSize unitCellSize;\n+};\n+\n+} /* namespace libcamera */\n+\n+#endif /* __LIBCAMERA_SENSOR_CAMERA_SENSOR_PROPERTIES_H__ */\ndiff --git a/include/libcamera/internal/meson.build b/include/libcamera/internal/meson.build\nindex 1fe3918cfe93..6cff1b9032c6 100644\n--- a/include/libcamera/internal/meson.build\n+++ b/include/libcamera/internal/meson.build\n@@ -15,6 +15,7 @@ libcamera_internal_headers = files([\n 'byte_stream_buffer.h',\n 'camera_controls.h',\n 'camera_sensor.h',\n+ 'camera_sensor_properties.h',\n 'control_serializer.h',\n 'control_validator.h',\n 'delayed_controls.h',\ndiff --git a/src/libcamera/camera_sensor_properties.cpp b/src/libcamera/camera_sensor_properties.cpp\nnew file mode 100644\nindex 000000000000..6ded31dcae4f\n--- /dev/null\n+++ b/src/libcamera/camera_sensor_properties.cpp\n@@ -0,0 +1,71 @@\n+/* SPDX-License-Identifier: LGPL-2.1-or-later */\n+/*\n+ * Copyright (C) 2021, Google Inc.\n+ *\n+ * camera_sensor_properties.cpp - Database of camera sensor properties\n+ */\n+\n+#include \"libcamera/internal/camera_sensor_properties.h\"\n+\n+#include <map>\n+\n+#include \"libcamera/internal/log.h\"\n+\n+/**\n+ * \\file camera_sensor_properties.h\n+ * \\brief Database of camera sensor properties\n+ *\n+ * The database of camera sensor properties collects static information about\n+ * camera sensors that is not possible or desirable to retrieve from the device\n+ * at run time.\n+ *\n+ * The database is indexed using the camera sensor model, as reported by the\n+ * properties::Model property, and for each supported sensor it contains a\n+ * list of properties.\n+ */\n+\n+namespace libcamera {\n+\n+LOG_DEFINE_CATEGORY(CameraSensorProperties)\n+\n+/**\n+ * \\struct CameraSensorProperties\n+ * \\brief Database of camera sensor properties\n+ *\n+ * \\var CameraSensorProperties::unitCellSize\n+ * \\brief The physical size of a pixel, including pixel edges, in nanometers.\n+ */\n+\n+/**\n+ * \\brief Retrieve the properties associated with a sensor\n+ * \\param sensor The sensor model name as reported by properties::Model\n+ * \\return A pointer to the CameraSensorProperties instance associated with a sensor\n+ * or nullptr if the sensor is not supported\n+ */\n+const CameraSensorProperties *CameraSensorProperties::get(const std::string &sensor)\n+{\n+\tstatic const std::map<std::string, const CameraSensorProperties> sensorProps = {\n+\t\t{ \"imx219\", {\n+\t\t\t.unitCellSize = { 1120, 1120 },\n+\t\t} },\n+\t\t{ \"ov5670\", {\n+\t\t\t.unitCellSize = { 1120, 1120 },\n+\t\t} },\n+\t\t{ \"ov13858\", {\n+\t\t\t.unitCellSize = { 1120, 1120 },\n+\t\t} },\n+\t};\n+\n+\tconst auto it = sensorProps.find(sensor);\n+\tif (it == sensorProps.end()) {\n+\t\tLOG(CameraSensorProperties, Warning)\n+\t\t\t<< \"No static properties available for '\" << sensor << \"'\";\n+\t\tLOG(CameraSensorProperties, Warning)\n+\t\t\t<< \"Please consider updating the camera sensor properties database\";\n+\t\treturn nullptr;\n+\t}\n+\n+\treturn &it->second;\n+}\n+\n+} /* namespace libcamera */\ndiff --git a/src/libcamera/meson.build b/src/libcamera/meson.build\nindex e0a48aa23ea5..675053d41513 100644\n--- a/src/libcamera/meson.build\n+++ b/src/libcamera/meson.build\n@@ -9,6 +9,7 @@ libcamera_sources = files([\n 'camera_controls.cpp',\n 'camera_manager.cpp',\n 'camera_sensor.cpp',\n+ 'camera_sensor_properties.cpp',\n 'class.cpp',\n 'controls.cpp',\n 'control_serializer.cpp',\n", "prefixes": [ "libcamera-devel", "v6", "1/3" ] }