Show a patch.

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

{
    "id": 12649,
    "url": "https://patchwork.libcamera.org/api/patches/12649/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/12649/",
    "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": "<20210618161807.24242-2-david.plowman@raspberrypi.com>",
    "date": "2021-06-18T16:18:05",
    "name": "[libcamera-devel,v2,1/3] libcamera: Add support for monochrome sensors",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "a63f130b790cd5f7003394c29974bb779f093a94",
    "submitter": {
        "id": 42,
        "url": "https://patchwork.libcamera.org/api/people/42/?format=api",
        "name": "David Plowman",
        "email": "david.plowman@raspberrypi.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/12649/mbox/",
    "series": [
        {
            "id": 2152,
            "url": "https://patchwork.libcamera.org/api/series/2152/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2152",
            "date": "2021-06-18T16:18:04",
            "name": "Support monochrome raw sensors",
            "version": 2,
            "mbox": "https://patchwork.libcamera.org/series/2152/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/12649/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/12649/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 E9EA2BD78E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 18 Jun 2021 16:18:16 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 9087D68942;\n\tFri, 18 Jun 2021 18:18:15 +0200 (CEST)",
            "from mail-wm1-x332.google.com (mail-wm1-x332.google.com\n\t[IPv6:2a00:1450:4864:20::332])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 8607460298\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 18 Jun 2021 18:18:13 +0200 (CEST)",
            "by mail-wm1-x332.google.com with SMTP id k42so4116959wms.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 18 Jun 2021 09:18:13 -0700 (PDT)",
            "from pi4-davidp.lan (plowpeople3.plus.com. [80.229.223.72])\n\tby smtp.gmail.com with ESMTPSA id\n\tz5sm8908492wrp.92.2021.06.18.09.18.12\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tFri, 18 Jun 2021 09:18:12 -0700 (PDT)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=raspberrypi.com header.i=@raspberrypi.com\n\theader.b=\"VWCdEynX\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=dX7vDkJOH13e4PMs9zqtfbDImO7crkG0/86wTonUNiI=;\n\tb=VWCdEynXpS5UFLow2lvRQr9sO5c64YX/vnu8C0izIXgL3gFDP+pv9ZB/Amci7fOhE7\n\tlbQ4/BDdMBSfeAq5kox2LV62rcaVVndSm9zMlPFVACdMYQTJE2UabS6O1c+TEnWATIIi\n\tl3ua41JplepKXA++zwZu2/m2FVSdyxODl0d4QKNZKg7tmT5vdFiO0Ufn1KQFf81QbESC\n\tZ9puk+3j/5iiXjltOLHRub8vMk7BPlUb0mEaz6nsaoBnrA4z671fWDeTOi2v1G4aoyVN\n\tnIjHCP+/ZopNK1pM/k6kfyooaWQYZOGaDRHkitb2A1bNDDNxYRon74GxYWDQq/6xnwQN\n\tGm9Q==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references:mime-version:content-transfer-encoding;\n\tbh=dX7vDkJOH13e4PMs9zqtfbDImO7crkG0/86wTonUNiI=;\n\tb=DjboRjL+qJfOWueN1hsdTK5n/zGDxcPPtZrVXkFwSDIQW5cpTagfDaSp32XUgtGC4R\n\tWggDsMnPireqaE/NxFR5k8CWAxeTIWchlZJ2AqAclN0vuOLC1oWEjhTdR4H3J9g3dtDN\n\tX8dDwxtBo8G+6Dp+NH1mvfCKEcmYvQDi5vQnNFVEo4s1vOscx2Ir/uk1cAiNukFvEtRh\n\t0qg3MUQnbTobVJCNIdAoB3JwNhGXI6zVgmlwJ/M7y/xye/LWH3SE9YlMBV9fEuwK3GBZ\n\txhQrkvR/HTBO8kIetS8xb06btGJStKhnF4qQZAHJsBe8ss1YejGTPSRJOF7ncym7u7Dq\n\tSu/w==",
        "X-Gm-Message-State": "AOAM531unL1PNEoPZuJ/CSeQMh0XnVbIwG08jz0ffEATUfG5DqoQwdKE\n\t0kpMpbtthUpUR+4S4zcAs3N7F44zPONtSb2l",
        "X-Google-Smtp-Source": "ABdhPJxbK1sr/yeUXS5Gi351SYyrw/PqhAZbydVbc+WXaz7fdP/gXH0DIhEh9U6zWuvcfwb9I0rW/Q==",
        "X-Received": "by 2002:a05:600c:2150:: with SMTP id\n\tv16mr10502668wml.170.1624033093067; \n\tFri, 18 Jun 2021 09:18:13 -0700 (PDT)",
        "From": "David Plowman <david.plowman@raspberrypi.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Fri, 18 Jun 2021 17:18:05 +0100",
        "Message-Id": "<20210618161807.24242-2-david.plowman@raspberrypi.com>",
        "X-Mailer": "git-send-email 2.20.1",
        "In-Reply-To": "<20210618161807.24242-1-david.plowman@raspberrypi.com>",
        "References": "<20210618161807.24242-1-david.plowman@raspberrypi.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v2 1/3] libcamera: Add support for\n\tmonochrome sensors",
        "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>",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "This commit adds support for monochrome (greyscale) raw sensors. These\nare sensors that have no colour filter array, so all pixels are the\nsame and there are no distinct colour channels.\n\nThese sensors still require many of an ISP's processing stages, such\nas denoise, tone mapping, but not those that involve colours (such as\ndemosaic, or colour matrices).\n\nSigned-off-by: David Plowman <david.plowman@raspberrypi.com>\n---\n include/libcamera/internal/bayer_format.h |  3 ++-\n src/libcamera/bayer_format.cpp            | 14 ++++++++++++--\n src/libcamera/camera_sensor.cpp           |  3 +++\n src/libcamera/property_ids.yaml           |  4 ++++\n 4 files changed, 21 insertions(+), 3 deletions(-)",
    "diff": "diff --git a/include/libcamera/internal/bayer_format.h b/include/libcamera/internal/bayer_format.h\nindex 5b8c1dc9..723382d4 100644\n--- a/include/libcamera/internal/bayer_format.h\n+++ b/include/libcamera/internal/bayer_format.h\n@@ -23,7 +23,8 @@ public:\n \t\tBGGR = 0,\n \t\tGBRG = 1,\n \t\tGRBG = 2,\n-\t\tRGGB = 3\n+\t\tRGGB = 3,\n+\t\tMONO = 4\n \t};\n \n \tenum Packing : uint16_t {\ndiff --git a/src/libcamera/bayer_format.cpp b/src/libcamera/bayer_format.cpp\nindex ed61202c..11355f14 100644\n--- a/src/libcamera/bayer_format.cpp\n+++ b/src/libcamera/bayer_format.cpp\n@@ -45,6 +45,8 @@ namespace libcamera {\n  * \\brief G then R on the first row, B then G on the second row.\n  * \\var BayerFormat::RGGB\n  * \\brief R then G on the first row, G then B on the second row.\n+ * \\var BayerFormat::MONO\n+ * \\brief Monochrome image data, there is no colour filter array.\n  */\n \n /**\n@@ -111,6 +113,8 @@ const std::map<BayerFormat, V4L2PixelFormat, BayerFormatComparator> bayerToV4l2{\n \t{ { BayerFormat::GBRG, 16, BayerFormat::None }, V4L2PixelFormat(V4L2_PIX_FMT_SGBRG16) },\n \t{ { BayerFormat::GRBG, 16, BayerFormat::None }, V4L2PixelFormat(V4L2_PIX_FMT_SGRBG16) },\n \t{ { BayerFormat::RGGB, 16, BayerFormat::None }, V4L2PixelFormat(V4L2_PIX_FMT_SRGGB16) },\n+\t{ { BayerFormat::MONO, 8, BayerFormat::None }, V4L2PixelFormat(V4L2_PIX_FMT_GREY) },\n+\t{ { BayerFormat::MONO, 10, BayerFormat::CSI2Packed }, V4L2PixelFormat(V4L2_PIX_FMT_Y10P) },\n };\n \n const std::unordered_map<unsigned int, BayerFormat> mbusCodeToBayer{\n@@ -146,6 +150,8 @@ const std::unordered_map<unsigned int, BayerFormat> mbusCodeToBayer{\n \t{ MEDIA_BUS_FMT_SGBRG16_1X16, { BayerFormat::GBRG, 16, BayerFormat::None } },\n \t{ MEDIA_BUS_FMT_SGRBG16_1X16, { BayerFormat::GRBG, 16, BayerFormat::None } },\n \t{ MEDIA_BUS_FMT_SRGGB16_1X16, { BayerFormat::RGGB, 16, BayerFormat::None } },\n+\t{ MEDIA_BUS_FMT_Y8_1X8, { BayerFormat::MONO, 8, BayerFormat::None } },\n+\t{ MEDIA_BUS_FMT_Y10_1X10, { BayerFormat::MONO, 10, BayerFormat::None } },\n };\n \n } /* namespace */\n@@ -198,9 +204,10 @@ std::string BayerFormat::toString() const\n \t\t\"BGGR\",\n \t\t\"GBRG\",\n \t\t\"GRBG\",\n-\t\t\"RGGB\"\n+\t\t\"RGGB\",\n+\t\t\"MONO\"\n \t};\n-\tif (isValid() && order <= RGGB)\n+\tif (isValid() && order <= MONO)\n \t\tresult = orderStrings[order];\n \telse\n \t\treturn \"INVALID\";\n@@ -280,6 +287,9 @@ BayerFormat BayerFormat::transform(Transform t) const\n {\n \tBayerFormat result = *this;\n \n+\tif (order == MONO)\n+\t\treturn result;\n+\n \t/*\n \t * Observe that flipping bit 0 of the Order enum performs a horizontal\n \t * mirror on the Bayer pattern (e.g. RGGB goes to GRBG). Similarly,\ndiff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp\nindex 3e135353..fb67c15a 100644\n--- a/src/libcamera/camera_sensor.cpp\n+++ b/src/libcamera/camera_sensor.cpp\n@@ -427,6 +427,9 @@ int CameraSensor::initProperties()\n \t\tcase BayerFormat::RGGB:\n \t\t\tcfa = properties::draft::RGGB;\n \t\t\tbreak;\n+\t\tcase BayerFormat::MONO:\n+\t\t\tcfa = properties::draft::MONO;\n+\t\t\tbreak;\n \t\t}\n \n \t\tproperties_.set(properties::draft::ColorFilterArrangement, cfa);\ndiff --git a/src/libcamera/property_ids.yaml b/src/libcamera/property_ids.yaml\nindex 104e9aaf..87be68f7 100644\n--- a/src/libcamera/property_ids.yaml\n+++ b/src/libcamera/property_ids.yaml\n@@ -706,5 +706,9 @@ controls:\n           description: |\n             Sensor is not Bayer; output has 3 16-bit values for each pixel,\n             instead of just 1 16-bit value per pixel.\n+        - name: MONO\n+          value: 5\n+          description: |\n+            Sensor is not Bayer; output consits of a single colour channel.\n \n ...\n",
    "prefixes": [
        "libcamera-devel",
        "v2",
        "1/3"
    ]
}