Patch Detail
Show a patch.
GET /api/patches/12597/?format=api
{ "id": 12597, "url": "https://patchwork.libcamera.org/api/patches/12597/?format=api", "web_url": "https://patchwork.libcamera.org/patch/12597/", "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": "<20210615105139.16171-2-david.plowman@raspberrypi.com>", "date": "2021-06-15T10:51:37", "name": "[libcamera-devel,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/12597/mbox/", "series": [ { "id": 2135, "url": "https://patchwork.libcamera.org/api/series/2135/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2135", "date": "2021-06-15T10:51:36", "name": "Support monochrome raw sensors", "version": 1, "mbox": "https://patchwork.libcamera.org/series/2135/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/12597/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/12597/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 EDB8BBD78E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 15 Jun 2021 10:51:45 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 67E966029A;\n\tTue, 15 Jun 2021 12:51:44 +0200 (CEST)", "from mail-wm1-x335.google.com (mail-wm1-x335.google.com\n\t[IPv6:2a00:1450:4864:20::335])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 1D4D66029D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 15 Jun 2021 12:51:43 +0200 (CEST)", "by mail-wm1-x335.google.com with SMTP id m3so8634022wms.4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 15 Jun 2021 03:51:43 -0700 (PDT)", "from pi4-davidp.pitowers.org\n\t([2a00:1098:3142:14:1ce1:9965:4328:89c4])\n\tby smtp.gmail.com with ESMTPSA id\n\tu15sm1796300wmq.48.2021.06.15.03.51.42\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 15 Jun 2021 03:51:42 -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=\"T6bUvqAn\"; 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=T6bUvqAn9xdjqppS+0rudUm4aO6nBQ3DvEw1HwhFPkPwNQ76rn4jiml9nGDV5Reoot\n\t7BZKINudAGDb3FXfVk9y47QRykid5f/0R/xIQO+zW4Gwp7DeqoHjH2EXBzKrWTFiBzho\n\t6If9eBObUBj9lXtJvj7qcmcP3ePyuNhjr4DUe+mJwCcxYfBH5OnwSdahbfSHIBPwHi2R\n\tT4NHr525VDGXzxgBYjDze8I6vZnx8eH1gq1j3ewwWRmmDMSZGz0DiWN1OzWZ6voXK09H\n\tOB1peQqpa/5SWtdRzYMTH4Op26VhDO155f40rhZBS4jlDvmaL1pA0RfGb3XaZAxpIMC9\n\tJyoQ==", "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=AtUDu81N0afHCKNGJX2YQg0QrP+gUUbGiYsRYVWok8BWgmYmcqKtMZG2R7aDUvgrwy\n\tSsDyea4fxXpwrD3t38vQC7Babyms3hj/d0uL5zdB0rFrpMB4kX6h/qukHgpCJ9N9AfwI\n\thk1bPcDolOAzlJJByASPwSCMUnL/xyu/E+zmvs/ALomi04ke0VRNZ15P208+2tBH3DxS\n\txciobtr+uypkek/skgy+lHLGdkzb711csHu/Clh9fkgdxCQKFNX7Napfit/kyotKq8LW\n\tgJwhE9dd9vvw4eOry5fso9NrCnbBO0zjuBmZt91gukKb/RKfG257dVHmUgNonJhh/AsD\n\tHtvQ==", "X-Gm-Message-State": "AOAM531V3f7c/1sJ0nNii9v1qFCOt2WZ3Ol+/UzaeS8zWUymKFrU49O7\n\t2fG/ST+QvmQtF7vW/stdXFPDNTAUUCiPLOFp", "X-Google-Smtp-Source": "ABdhPJwI5t5EOqQeTgxGTtyZdtzBHxcZsRuF2/xtALJpMVNmDyaAER6i/oEY0IQqBvLrRu8dRDg90Q==", "X-Received": "by 2002:a05:600c:3397:: with SMTP id\n\to23mr22178712wmp.10.1623754302597; \n\tTue, 15 Jun 2021 03:51:42 -0700 (PDT)", "From": "David Plowman <david.plowman@raspberrypi.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Tue, 15 Jun 2021 11:51:37 +0100", "Message-Id": "<20210615105139.16171-2-david.plowman@raspberrypi.com>", "X-Mailer": "git-send-email 2.20.1", "In-Reply-To": "<20210615105139.16171-1-david.plowman@raspberrypi.com>", "References": "<20210615105139.16171-1-david.plowman@raspberrypi.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH 1/3] libcamera: Add support for monochrome\n\tsensors", "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", "1/3" ] }