Patch Detail
Show a patch.
GET /api/patches/19066/?format=api
{ "id": 19066, "url": "https://patchwork.libcamera.org/api/patches/19066/?format=api", "web_url": "https://patchwork.libcamera.org/patch/19066/", "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": "<20230921165550.50956-3-jacopo.mondi@ideasonboard.com>", "date": "2023-09-21T16:55:39", "name": "[libcamera-devel,v5,02/13] libcamera: camera: Introduce SensorConfiguration", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "b98928f92a5046520c70df2461a8e33ed60779c6", "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/19066/mbox/", "series": [ { "id": 4034, "url": "https://patchwork.libcamera.org/api/series/4034/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4034", "date": "2023-09-21T16:55:37", "name": "libcamera: Introduce SensorConfiguration", "version": 5, "mbox": "https://patchwork.libcamera.org/series/4034/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/19066/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/19066/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 928E6BE080\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 21 Sep 2023 16:56:06 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 29D6562931;\n\tThu, 21 Sep 2023 18:56:06 +0200 (CEST)", "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 9B7D3628D8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 21 Sep 2023 18:56:02 +0200 (CEST)", "from uno.lan (93-46-82-201.ip106.fastwebnet.it [93.46.82.201])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 0AA491102;\n\tThu, 21 Sep 2023 18:54:25 +0200 (CEST)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1695315366;\n\tbh=SDH2KAbVTR5TNQvMXIpZykP2Hw6R4tHgoHOdK/Qwe8c=;\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=QTGmfs5biQq5TkiYMhnyXYihGDlmC+JhDbc4H6DugDJ+xxcpr9XZ+TL9bU3wAuq3a\n\tnFCbeAMwYPpdf5qeStvp1e5CRmf74HvWnH4P4CkseBqceiegz19dgOX/zNQG9LEC0T\n\tIByAIbc2by0slfrMKA/ZKGLLLcEDRPEEiwSL9etsOEJo3g//+qNyp/8WjIIBKvzRMN\n\tFwDFADZZ73awQ22/aKBhLBpprj4owtLRSYdMBNugxAXqp8GTYXdcCwbvqLgeoxSZ4B\n\tFq6CfPqLhDaNVGpq3o/gVwaHxzcDbcFnie/FvcyppZhKYUFPGMw4J8+LIXCSSYb73+\n\t/Ks6s0NikPebA==", "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1695315265;\n\tbh=SDH2KAbVTR5TNQvMXIpZykP2Hw6R4tHgoHOdK/Qwe8c=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=s7jcjVMXmgbLfskUF6KPRCKP2p2LC8a1SCbi0QiFWnQndey8iYyTLz8unE/RBZm5c\n\te0nhyqOd7BFTA5dWTgpzu4RuD69X0dB0uoJIQJ/0x2n3l+JioKwXZwnh6Ep8DSI+7Y\n\ty0cNDTAOV1pfVbvTJpIQ/b8pfATUbxw8DMr3D/jU=" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"s7jcjVMX\"; dkim-atps=neutral", "To": "libcamera-devel@lists.libcamera.org", "Date": "Thu, 21 Sep 2023 18:55:39 +0200", "Message-ID": "<20230921165550.50956-3-jacopo.mondi@ideasonboard.com>", "X-Mailer": "git-send-email 2.42.0", "In-Reply-To": "<20230921165550.50956-1-jacopo.mondi@ideasonboard.com>", "References": "<20230921165550.50956-1-jacopo.mondi@ideasonboard.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v5 02/13] 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>\nReviewed-by: Naushir Patuck <naush@raspberrypi.com>\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n---\n include/libcamera/camera.h | 27 +++++++\n src/libcamera/camera.cpp | 144 +++++++++++++++++++++++++++++++++++++\n 2 files changed, 171 insertions(+)", "diff": "diff --git a/include/libcamera/camera.h b/include/libcamera/camera.h\nindex 004bc89455f5..92a948e0f53b 100644\n--- a/include/libcamera/camera.h\n+++ b/include/libcamera/camera.h\n@@ -9,6 +9,7 @@\n \n #include <initializer_list>\n #include <memory>\n+#include <optional>\n #include <set>\n #include <stdint.h>\n #include <string>\n@@ -19,6 +20,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 +32,30 @@ 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+};\n+\n class CameraConfiguration\n {\n public:\n@@ -66,6 +92,7 @@ public:\n \tbool empty() const;\n \tstd::size_t size() const;\n \n+\tstd::optional<SensorConfiguration> sensorConfig;\n \tTransform transform;\n \n protected:\ndiff --git a/src/libcamera/camera.cpp b/src/libcamera/camera.cpp\nindex 0eecee766f00..05a47444be89 100644\n--- a/src/libcamera/camera.cpp\n+++ b/src/libcamera/camera.cpp\n@@ -97,6 +97,16 @@\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-model Camera Sensor Model\n+ *\n+ * By default, libcamera configures the camera sensor automatically based on the\n+ * configuration of the streams. Applications may instead specify a manual\n+ * configuration for the camera sensor. This allows precise control of the frame\n+ * geometry and frame rate delivered by the sensor.\n+ *\n+ * More details about the camera sensor model implemented by libcamera are\n+ * available in the libcamera camera-sensor-model documentation page.\n+ *\n * \\subsection digital-zoom Digital Zoom\n *\n * Digital zoom is implemented as a combination of the cropping and scaling\n@@ -111,6 +121,127 @@ 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+ * \\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+ * \\brief Validate the sensor configuration\n+ *\n+ * A sensor configuration is valid if it's fully populated.\n+ *\n+ * \\todo For now allow applications to populate the bitDepth and the outputSize\n+ * only as skipping and binnings factors are initialized to 1 and the analog\n+ * crop is ignored.\n+ *\n+ * \\return True if the sensor configuration is valid, false otherwise.\n+ */\n+bool SensorConfiguration::valid() 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 true;\n+\n+\treturn false;\n+}\n+\n /**\n * \\class CameraConfiguration\n * \\brief Hold configuration for streams of the camera\n@@ -391,6 +522,19 @@ 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 member allows control of 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+ * The camera sensor configuration applies to all streams produced by a camera\n+ * from the same image source.\n+ */\n+\n /**\n * \\var CameraConfiguration::transform\n * \\brief User-specified transform to be applied to the image\n", "prefixes": [ "libcamera-devel", "v5", "02/13" ] }