Patch Detail
Show a patch.
GET /api/patches/18878/?format=api
{ "id": 18878, "url": "https://patchwork.libcamera.org/api/patches/18878/?format=api", "web_url": "https://patchwork.libcamera.org/patch/18878/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/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": "<20230724123907.29086-3-jacopo.mondi@ideasonboard.com>", "date": "2023-07-24T12:39:05", "name": "[libcamera-devel,2/4] libcamera: camera: Introduce SensorConfiguration", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "f12e4d442a4bb90a3f1cbf444378a1fb58aa15e8", "submitter": { "id": 143, "url": "https://patchwork.libcamera.org/api/people/143/?format=api", "name": "Jacopo Mondi", "email": "jacopo.mondi@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/18878/mbox/", "series": [ { "id": 3983, "url": "https://patchwork.libcamera.org/api/series/3983/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3983", "date": "2023-07-24T12:39:03", "name": "libcamera: Introduce SensorConfiguration", "version": 1, "mbox": "https://patchwork.libcamera.org/series/3983/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/18878/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/18878/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 E6AB5BDC71\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 24 Jul 2023 12:39:22 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 975F8628CC;\n\tMon, 24 Jul 2023 14:39:22 +0200 (CEST)", "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 81253628C4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 24 Jul 2023 14:39:19 +0200 (CEST)", "from uno.localdomain (mob-5-91-20-233.net.vodafone.it\n\t[5.91.20.233])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 93C24735;\n\tMon, 24 Jul 2023 14:38:21 +0200 (CEST)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1690202362;\n\tbh=wyT8uP/9d/bafQbibSZu2mwhkPJaSLjDCV9gHLqlIF8=;\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:Cc:\n\tFrom;\n\tb=gYEyu+TYvfcRAsCyp9R5SwWBYVbPZv/gLVY21Jwnrxl67t2Tnv64fMqPQWm6VkEIh\n\tLqfBojI1XpppbEi/xajva+ckmplcIBFqkHDDjfo/3fEWwblQqyRfaQO+3i24s08S4H\n\tyaLUmkuOt0HfMnSn6q5dZowBzmz1djeHeFKfu/cM9moGnmeeQg/GDlDLOvEAI5pVS2\n\tQSIi4egaoop6qyjI1qxA2lgzIwhjAovimGo1wN9kdSv82lSc2nxXTUgfBk2MQVfguW\n\tHBQvM5enmRG1MjFt0YbR36LQ/Z79VldKt3E/VjbnVDvuNSFZ/xZCzgZkRw16U51MSQ\n\t7VqnEJycQwBUw==", "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1690202301;\n\tbh=wyT8uP/9d/bafQbibSZu2mwhkPJaSLjDCV9gHLqlIF8=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=WV5tRrz9/Xw73uWOqjsORHmxyV2jPU3uxFJ1FLXW7TxxgF1LUanNL4U3bry7PMUko\n\tkixp6VYdMv0EkWtC2gOaFqDJo/XDbLZ6Gp87DXGU93k61tzZ2gLy4I+byWu0x97cIK\n\ttyMAvgF54gUZZDlNQ+0ObfzLrQjgg0+MZ0eBYdiM=" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"WV5tRrz9\"; dkim-atps=neutral", "To": "libcamera-devel@lists.libcamera.org", "Date": "Mon, 24 Jul 2023 14:39:05 +0200", "Message-Id": "<20230724123907.29086-3-jacopo.mondi@ideasonboard.com>", "X-Mailer": "git-send-email 2.40.1", "In-Reply-To": "<20230724123907.29086-1-jacopo.mondi@ideasonboard.com>", "References": "<20230724123907.29086-1-jacopo.mondi@ideasonboard.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH 2/4] libcamera: camera: Introduce\n\tSensorConfiguration", "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": "Jacopo Mondi via libcamera-devel <libcamera-devel@lists.libcamera.org>", "Reply-To": "Jacopo Mondi <jacopo.mondi@ideasonboard.com>", "Cc": "Jacopo Mondi <jacopo.mondi@ideasonboard.com>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "Introduce SensorConfiguration in the libcamera API.\n\nThe SensorConfiguration is part of the CameraConfiguration class\nand allows applications to control the sensor settings.\n\nSigned-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\n---\n include/libcamera/camera.h | 43 +++++++++\n src/libcamera/camera.cpp | 180 +++++++++++++++++++++++++++++++++++++\n 2 files changed, 223 insertions(+)", "diff": "diff --git a/include/libcamera/camera.h b/include/libcamera/camera.h\nindex 004bc89455f5..b2aa8d467feb 100644\n--- a/include/libcamera/camera.h\n+++ b/include/libcamera/camera.h\n@@ -19,6 +19,7 @@\n #include <libcamera/base/signal.h>\n \n #include <libcamera/controls.h>\n+#include <libcamera/geometry.h>\n #include <libcamera/request.h>\n #include <libcamera/stream.h>\n #include <libcamera/transform.h>\n@@ -30,6 +31,47 @@ class FrameBufferAllocator;\n class PipelineHandler;\n class Request;\n \n+class SensorConfiguration\n+{\n+public:\n+\tunsigned int bitDepth = 0;\n+\n+\tRectangle analogCrop;\n+\n+\tstruct {\n+\t\tunsigned int binX = 1;\n+\t\tunsigned int binY = 1;\n+\t} binning;\n+\n+\tstruct {\n+\t\tunsigned int xOddInc = 1;\n+\t\tunsigned int xEvenInc = 1;\n+\t\tunsigned int yOddInc = 1;\n+\t\tunsigned int yEvenInc = 1;\n+\t} skipping;\n+\n+\tSize outputSize;\n+\n+\tbool valid() const\n+\t{\n+\t\treturn validate() != Invalid;\n+\t}\n+\n+\texplicit operator bool() const\n+\t{\n+\t\treturn validate() == Populated;\n+\t}\n+\n+private:\n+\tenum Status {\n+\t\tUnpopulated,\n+\t\tPopulated,\n+\t\tInvalid,\n+\t};\n+\n+\tStatus validate() const;\n+};\n+\n class CameraConfiguration\n {\n public:\n@@ -66,6 +108,7 @@ public:\n \tbool empty() const;\n \tstd::size_t size() const;\n \n+\tSensorConfiguration sensorConfig;\n \tTransform transform;\n \n protected:\ndiff --git a/src/libcamera/camera.cpp b/src/libcamera/camera.cpp\nindex 0eecee766f00..b58d120cd802 100644\n--- a/src/libcamera/camera.cpp\n+++ b/src/libcamera/camera.cpp\n@@ -97,6 +97,21 @@\n * implemented in the above order at the hardware level. The libcamera pipeline\n * handlers translate the pipeline model to the real hardware configuration.\n *\n+ * \\subsection camera-sensor-mode Camera Sensor Model\n+ *\n+ * libcamera allows applications to control the configuration of the camera\n+ * sensor, particularly it allows to control the frame geometry and frame\n+ * delivery rate of the sensor.\n+ *\n+ * The camera sensor configuration applies to all streams produced by a camera\n+ * from the same image source.\n+ *\n+ * More details about the libcamera implemented camera sensor model are\n+ * available in the libcamera camera-sensor-model documentation page.\n+ *\n+ * The sensor configuration is specified by applications by populating the\n+ * CameraConfiguration::sensorConfig class member.\n+ *\n * \\subsection digital-zoom Digital Zoom\n *\n * Digital zoom is implemented as a combination of the cropping and scaling\n@@ -111,6 +126,161 @@ namespace libcamera {\n \n LOG_DECLARE_CATEGORY(Camera)\n \n+/**\n+ * \\class SensorConfiguration\n+ * \\brief Camera sensor configuration\n+ *\n+ * The SensorConfiguration class collects parameters to control the operations\n+ * of the camera sensor, accordingly to the abstract camera sensor model\n+ * implemented by libcamera.\n+ *\n+ * \\todo Applications shall fully populate all fields of the\n+ * CameraConfiguration::sensorConfig class members before validating the\n+ * CameraConfiguration. If the SensorConfiguration is not fully populated, or if\n+ * any of its parameters cannot be applied to the sensor in use, the\n+ * CameraConfiguration validation process will fail and return\n+ * CameraConfiguration::Status::Invalid.\n+ *\n+ * Applications that populate the SensorConfiguration class members are\n+ * expected to be highly-specialized applications that know what sensor\n+ * they are operating with and what parameters are valid for the sensor in use.\n+ *\n+ * A detailed description of the abstract camera sensor model implemented by\n+ * libcamera and the description of its configuration parameters is available\n+ * in the libcamera documentation camera-sensor-model file.\n+ */\n+\n+/**\n+ * \\enum SensorConfiguration::Status\n+ * \\brief The sensor configuration validation status\n+ */\n+\n+/**\n+ * \\var SensorConfiguration::bitDepth\n+ * \\brief The sensor image format bit depth\n+ *\n+ * The number of bits (resolution) used to represent a pixel sample.\n+ */\n+\n+/**\n+ * \\var SensorConfiguration::analogCrop\n+ * \\brief The analog crop rectangle\n+ *\n+ * The selected portion of the active pixel array used to produce the image\n+ * frame.\n+ */\n+\n+/**\n+ * \\var SensorConfiguration::binning\n+ * \\brief Sensor binning configuration\n+ *\n+ * Refer to the camera-sensor-model documentation for an accurate description\n+ * of the binning operations. Disabled by default.\n+ */\n+\n+/**\n+ * \\var SensorConfiguration::binX\n+ * \\brief Horizontal binning factor\n+ *\n+ * The horizontal binning factor. Default to 1.\n+ */\n+\n+/**\n+ * \\var SensorConfiguration::binY\n+ * \\brief Vertical binning factor\n+ *\n+ * The vertical binning factor. Default to 1.\n+ */\n+\n+/**\n+ * \\var SensorConfiguration::skipping\n+ * \\brief The sensor skipping configuration\n+ *\n+ * Refer to the camera-sensor-model documentation for an accurate description\n+ * of the skipping operations.\n+ *\n+ * If no skipping is performed, all the structure fields should be\n+ * set to 1. Disabled by default.\n+ */\n+\n+/**\n+ * \\var SensorConfiguration::xOddInc\n+ * \\brief Horizontal increment for odd rows. Default to 1.\n+ */\n+\n+/**\n+ * \\var SensorConfiguration::xEvenInc\n+ * \\brief Horizontal increment for even rows. Default to 1.\n+ */\n+\n+/**\n+ * \\var SensorConfiguration::yOddInc\n+ * \\brief Vertical increment for odd columns. Default to 1.\n+ */\n+\n+/**\n+ * \\var SensorConfiguration::yEvenInc\n+ * \\brief Vertical increment for even columns. Default to 1.\n+ */\n+\n+/**\n+ * \\var SensorConfiguration::outputSize\n+ * \\brief The frame output (visible) size\n+ *\n+ * The size of the data frame as received by the host processor.\n+ */\n+\n+/**\n+ * \\fn SensorConfiguration::valid() const\n+ * \\brief Validate the SensorConfiguration\n+ *\n+ * Validate the sensor configuration.\n+ *\n+ * \\todo A sensor configuration is valid (or well-formed) if it's either\n+ * completely un-populated or fully populated. For now allows to populate\n+ * the bitDepth and the outputSize only.\n+ *\n+ * \\return True if the SensorConfiguration is either fully populated or\n+ * un-populated, false otherwise\n+ */\n+\n+/**\n+ * \\fn SensorConfiguration::operator bool() const\n+ * \\brief Test if a SensorConfiguration is fully populated\n+ * \\return True if the SensorConfiguration is fully populated\n+ */\n+\n+/**\n+ * \\brief Validate the sensor configuration\n+ *\n+ * \\todo A sensor configuration is valid (or well-formed) if it's either\n+ * completely un-populated or fully populated. For now allows to populate\n+ * the bitDepth and the outputSize only.\n+ *\n+ * \\return The sensor configuration status\n+ * \\retval Unpopulated The sensor configuration is fully unpopulated\n+ * \\retval Populated The sensor configuration is fully populated\n+ * \\retval Invalid The sensor configuration is invalid (not fully populated\n+ * and not fully unpopulated)\n+ */\n+SensorConfiguration::Status SensorConfiguration::validate() const\n+{\n+\tif (bitDepth && binning.binX && binning.binY &&\n+\t skipping.xOddInc && skipping.yOddInc &&\n+\t skipping.xEvenInc && skipping.yEvenInc &&\n+\t !outputSize.isNull())\n+\t\treturn Populated;\n+\n+\tif (!bitDepth &&\n+\t binning.binX <= 1 && binning.binY <= 1 &&\n+\t skipping.xOddInc <= 1 && skipping.yOddInc <= 1 &&\n+\t skipping.xEvenInc <= 1 && skipping.yEvenInc <= 1 &&\n+\t outputSize.isNull())\n+\t\treturn Unpopulated;\n+\n+\treturn Invalid;\n+}\n+\n /**\n * \\class CameraConfiguration\n * \\brief Hold configuration for streams of the camera\n@@ -391,6 +561,16 @@ CameraConfiguration::Status CameraConfiguration::validateColorSpaces(ColorSpaceF\n \treturn status;\n }\n \n+/**\n+ * \\var CameraConfiguration::sensorConfig\n+ * \\brief The camera sensor configuration\n+ *\n+ * The sensorConfig field allows to control the configuration of the camera\n+ * sensor. Refer to the camera-sensor-model documentation and to the\n+ * SensorConfiguration class documentation for details about the sensor\n+ * configuration process.\n+ */\n+\n /**\n * \\var CameraConfiguration::transform\n * \\brief User-specified transform to be applied to the image\n", "prefixes": [ "libcamera-devel", "2/4" ] }