Show a patch.

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

{
    "id": 14802,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/14802/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/14802/",
    "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": "<20211126104045.4756-7-david.plowman@raspberrypi.com>",
    "date": "2021-11-26T10:40:44",
    "name": "[libcamera-devel,v7,6/7] libcamera: Add validateColorSpaces to CameraConfiguration class",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "562eaa633eeb7e82ef4b43a09474e727b1ef93d2",
    "submitter": {
        "id": 42,
        "url": "https://patchwork.libcamera.org/api/1.1/people/42/?format=api",
        "name": "David Plowman",
        "email": "david.plowman@raspberrypi.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/14802/mbox/",
    "series": [
        {
            "id": 2761,
            "url": "https://patchwork.libcamera.org/api/1.1/series/2761/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2761",
            "date": "2021-11-26T10:40:38",
            "name": "Colour spaces",
            "version": 7,
            "mbox": "https://patchwork.libcamera.org/series/2761/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/14802/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/14802/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 D90DFC324F\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 26 Nov 2021 10:41:13 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 75538604FB;\n\tFri, 26 Nov 2021 11:41:13 +0100 (CET)",
            "from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com\n\t[IPv6:2a00:1450:4864:20::32e])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 00BBE604FB\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 26 Nov 2021 11:41:04 +0100 (CET)",
            "by mail-wm1-x32e.google.com with SMTP id y196so7709171wmc.3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 26 Nov 2021 02:41:03 -0800 (PST)",
            "from pi4-davidp.pitowers.org\n\t([2a00:1098:3142:14:e4a2:3070:eea4:e434])\n\tby smtp.gmail.com with ESMTPSA id\n\ty7sm5106795wrw.55.2021.11.26.02.41.02\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tFri, 26 Nov 2021 02:41:03 -0800 (PST)"
        ],
        "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=\"nInGg2E1\"; 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=lQA2w7ytVML8JdHRQ+4Ft1+guf03qBPRjj4QjqFWCO4=;\n\tb=nInGg2E1KFRogqn1VjojU8rl9XX3D4hgc4rKKyPbeds8PJJvUBezda/+5csm+UXrM/\n\tWmQW0/Kp+0PECl6w9R3vbLP01UMrOc7qVFfqPNeUgwNBH7R98X7thlS/mciKJkTnmY+y\n\tpRU/EKQ9rxTYy1tuy67kwsEt16N0d8Xi6crC48d0fZ+Q+J5drXyQ0y8mdPZtFfvm3xYw\n\tXIbRafm8Snz9udeaJVRrw0Gxd7+FcGLM/sxEA36djcTjJnBJRf+S5oaOZpnd+9svD7sX\n\tBmbU5y5MjxCjRd6M6T0u4Z8vgqNppebsGXDrfxbADHLR81/O2Qn4nHtCA8Jep3Ck5+Jh\n\t3obw==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\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=lQA2w7ytVML8JdHRQ+4Ft1+guf03qBPRjj4QjqFWCO4=;\n\tb=Q+8x7YeCJsyCxdx30cDN8wASPmRL76RHFYBzq2Stm87/kX/XQfQR9K59RRE7yF9uRs\n\tNzJMpFHpL3CKnoJDwq8zLHdFlT3GL8stMehlb1eLWU4AzgWvOzc5OBYgzMjZ0DL42ItK\n\t0GEhbn/z71S0ccSGs0azfX7JWjeTBLdBtbXNLpsojUwVE68MXyTnMfeNHoPNjSJYf0E9\n\taWbiR6nvqL0kqtzsWxWTzuYYrar7Lr637NDgwJrMCKhlLhpG4X1F4MGcRt9VPYePz+eH\n\tPhHU6StytRzoInpB3AYBlfGRaQRgLSYSoZsWSj0rsue11P7ifXWaCWxiqUYXotXl9dC0\n\tDxdA==",
        "X-Gm-Message-State": "AOAM533tdTFGPmsFqU2Ny7t2vGfYFcOS+DJ/CnJ/VKIuuJMksUM0ErVn\n\tpOH/ljPpGqsEBqA5TZeXqB4xvg==",
        "X-Google-Smtp-Source": "ABdhPJy/bppEN57LazOMLYWuohtUrIZQQX929gcu87Sj6o4ITYMFlUMhpMbTSw+y22S5TgHBOP+0FQ==",
        "X-Received": "by 2002:a7b:c844:: with SMTP id\n\tc4mr14214111wml.148.1637923263658; \n\tFri, 26 Nov 2021 02:41:03 -0800 (PST)",
        "From": "David Plowman <david.plowman@raspberrypi.com>",
        "To": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>,\n\tKieran Bingham <kieran.bingham@ideasonboard.com>,\n\tHans Verkuil <hverkuil-cisco@xs4all.nl>, Tomasz Figa <tfiga@google.com>, \n\tJacopo Mondi <jacopo@jmondi.org>,\n\tNaushir Patuck <naush@raspberrypi.com>, \n\tlibcamera-devel@lists.libcamera.org",
        "Date": "Fri, 26 Nov 2021 10:40:44 +0000",
        "Message-Id": "<20211126104045.4756-7-david.plowman@raspberrypi.com>",
        "X-Mailer": "git-send-email 2.30.2",
        "In-Reply-To": "<20211126104045.4756-1-david.plowman@raspberrypi.com>",
        "References": "<20211126104045.4756-1-david.plowman@raspberrypi.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v7 6/7] libcamera: Add validateColorSpaces\n\tto CameraConfiguration class",
        "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 method forces raw streams to have the \"raw\" color space, and also\noptionally makes all output streams to share the same color space as\nsome platforms may require this.\n\nSigned-off-by: David Plowman <david.plowman@raspberrypi.com>\n---\n include/libcamera/camera.h |  2 ++\n src/libcamera/camera.cpp   | 38 ++++++++++++++++++++++++++++++++++++++\n 2 files changed, 40 insertions(+)",
    "diff": "diff --git a/include/libcamera/camera.h b/include/libcamera/camera.h\nindex a7759ccb..32a7f812 100644\n--- a/include/libcamera/camera.h\n+++ b/include/libcamera/camera.h\n@@ -69,6 +69,8 @@ public:\n protected:\n \tCameraConfiguration();\n \n+\tStatus validateColorSpaces(bool sharedColorSpace);\n+\n \tstd::vector<StreamConfiguration> config_;\n };\n \ndiff --git a/src/libcamera/camera.cpp b/src/libcamera/camera.cpp\nindex 400a7cf0..dd06f600 100644\n--- a/src/libcamera/camera.cpp\n+++ b/src/libcamera/camera.cpp\n@@ -20,6 +20,7 @@\n \n #include \"libcamera/internal/camera.h\"\n #include \"libcamera/internal/camera_controls.h\"\n+#include \"libcamera/internal/formats.h\"\n #include \"libcamera/internal/pipeline_handler.h\"\n \n /**\n@@ -314,6 +315,43 @@ std::size_t CameraConfiguration::size() const\n \treturn config_.size();\n }\n \n+static bool isRaw(const PixelFormat &pixFmt)\n+{\n+\tconst PixelFormatInfo &info = PixelFormatInfo::info(pixFmt);\n+\treturn info.isValid() &&\n+\t       info.colourEncoding == PixelFormatInfo::ColourEncodingRAW;\n+}\n+\n+CameraConfiguration::Status CameraConfiguration::validateColorSpaces(bool shareOuputColorSpaces)\n+{\n+\tStatus status = Valid;\n+\n+\t/*\n+\t * Set all raw streams to the Raw color space, and make a note of the largest\n+\t * non-raw stream with a defined color space (if there is one).\n+\t */\n+\tint index = -1;\n+\tfor (auto [i, cfg] : utils::enumerate(config_)) {\n+\t\tif (isRaw(cfg.pixelFormat))\n+\t\t\tcfg.colorSpace = ColorSpace::Raw;\n+\t\telse if (cfg.colorSpace && (index == -1 || cfg.size > config_[i].size))\n+\t\t\tindex = i;\n+\t}\n+\n+\t/* Make all output color spaces the same, if requested. */\n+\tif (index >= 0 && shareOuputColorSpaces) {\n+\t\tfor (auto &cfg : config_) {\n+\t\t\tif (!isRaw(cfg.pixelFormat) &&\n+\t\t\t    cfg.colorSpace != config_[index].colorSpace) {\n+\t\t\t\tcfg.colorSpace = config_[index].colorSpace;\n+\t\t\t\tstatus = Adjusted;\n+\t\t\t}\n+\t\t}\n+\t}\n+\n+\treturn status;\n+}\n+\n /**\n  * \\var CameraConfiguration::transform\n  * \\brief User-specified transform to be applied to the image\n",
    "prefixes": [
        "libcamera-devel",
        "v7",
        "6/7"
    ]
}