Show a patch.

GET /api/1.1/patches/18911/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 18911,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/18911/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/18911/",
    "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": "<20230731113115.5915-3-jacopo.mondi@ideasonboard.com>",
    "date": "2023-07-31T11:31:13",
    "name": "[libcamera-devel,v2,2/4] libcamera: camera: Introduce SensorConfiguration",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "e4763d2947908ecbb922dbd526e983c6e19b8c6e",
    "submitter": {
        "id": 143,
        "url": "https://patchwork.libcamera.org/api/1.1/people/143/?format=api",
        "name": "Jacopo Mondi",
        "email": "jacopo.mondi@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/18911/mbox/",
    "series": [
        {
            "id": 3997,
            "url": "https://patchwork.libcamera.org/api/1.1/series/3997/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3997",
            "date": "2023-07-31T11:31:11",
            "name": "libcamera: Introduce SensorConfiguration",
            "version": 2,
            "mbox": "https://patchwork.libcamera.org/series/3997/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/18911/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/18911/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 6A70BBDB13\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 31 Jul 2023 11:31:39 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 08DC1627EF;\n\tMon, 31 Jul 2023 13:31:39 +0200 (CEST)",
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 7FEBD627EB\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 31 Jul 2023 13:31:35 +0200 (CEST)",
            "from uno.localdomain (mob-5-90-53-43.net.vodafone.it [5.90.53.43])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 19CEE2E4;\n\tMon, 31 Jul 2023 13:30:33 +0200 (CEST)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1690803099;\n\tbh=ogfu11CIYcM1FohqFm16DG+TxS/dMichXJQoX9mpRK8=;\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=y/kgX3WudhHMC1LCcWmRkbjbohSzgewQNekY4GhWLtsAoQm4SY1nQOcVketu8K6QX\n\tsbmrJ6Wz5sW3kfeC9yU5h/gh0wiwPlRaS0HnC5t8qDFFASYcmnMhxgM578RDbUlkTT\n\tN2zhnibW5LeXtNt6jiORHGl4pW6kqwMerDwjGU8r5MdHyyrUawcsFsd1YAQd5jEFue\n\tj/NHI4WtrG5/ZyFnEJQpGCyiPs8Nx9sgt7P2eNublnRj/cwm1ubYVu/YnQ7QbImfn5\n\teVnsHqTInY+XRpns5805dlbpOzdg+hAAc6eJpSK5s1RyGYggg/x26TU8SzBctuqbXp\n\tZZspxtm4dqG6g==",
            "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1690803033;\n\tbh=ogfu11CIYcM1FohqFm16DG+TxS/dMichXJQoX9mpRK8=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=B+R5/20z0R9V0TnBJJSL2nLf/INPgONrg/0rJ0EfgIZeBBbla5Q8E70jQovJxtxmu\n\tTkqy/BDgGeXlkHhpSNOIkdYR8sWE+gIIyPIjtOoRmmVs+fDKLo9jdve8qw6/Mdfm26\n\tc/FZW1BVDaVMJg6cFnCe7uV/QEfQRxBwn/8YdfTw="
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"B+R5/20z\"; dkim-atps=neutral",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Mon, 31 Jul 2023 13:31:13 +0200",
        "Message-Id": "<20230731113115.5915-3-jacopo.mondi@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.40.1",
        "In-Reply-To": "<20230731113115.5915-1-jacopo.mondi@ideasonboard.com>",
        "References": "<20230731113115.5915-1-jacopo.mondi@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v2 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>\nReviewed-by: Naushir Patuck <naush@raspberrypi.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..e796a5da28c6 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 allow applications to\n+ * populate 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 allow applications to\n+ * populate 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",
        "v2",
        "2/4"
    ]
}