Show a patch.

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

{
    "id": 17750,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/17750/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/17750/",
    "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": "<20221103104027.4197-2-david.plowman@raspberrypi.com>",
    "date": "2022-11-03T10:40:26",
    "name": "[libcamera-devel,RFC,1/2] libcamera: bayer_format: Add toMbusCode method",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "1afea04919f62331b8f33bfdaa5900a646dcb753",
    "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/17750/mbox/",
    "series": [
        {
            "id": 3595,
            "url": "https://patchwork.libcamera.org/api/1.1/series/3595/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3595",
            "date": "2022-11-03T10:40:25",
            "name": "Resolve invalid attempts to set sensor flip controls",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/3595/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/17750/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/17750/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 469BAC3285\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu,  3 Nov 2022 10:40:37 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 75A7163080;\n\tThu,  3 Nov 2022 11:40:35 +0100 (CET)",
            "from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com\n\t[IPv6:2a00:1450:4864:20::32a])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 872E763037\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  3 Nov 2022 11:40:33 +0100 (CET)",
            "by mail-wm1-x32a.google.com with SMTP id\n\tp13-20020a05600c468d00b003cf8859ed1bso914506wmo.1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 03 Nov 2022 03:40:33 -0700 (PDT)",
            "from pi4-davidp.lan (plowpeople3.plus.com. [80.229.223.72])\n\tby smtp.gmail.com with ESMTPSA id\n\tf15-20020a5d50cf000000b0022e36c1113fsm516363wrt.13.2022.11.03.03.40.31\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tThu, 03 Nov 2022 03:40:32 -0700 (PDT)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1667472035;\n\tbh=PPn+BaSabQ56UJEYn4f/uNz4wcJVOI+k1B0UOdn8sHU=;\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:\n\tFrom;\n\tb=pJgnHzzEmI+ML/YXjg5SiqbuMUMIsozO6kZ+34Pz2qMSqEOB/H/xlQNSLjO1JTG1M\n\tQ+4SGe/aazUQiAf843jQcHv5dtyu8pAa9EXmKqo5F8IHblsLQvTXUCeOlM/N8b4mFR\n\t9ojiENXdB9F13PZYOdRo+EgC4EB0YVtSGkAZYivuylz5sA//W2V3RTdPioeXUovy3J\n\tWjNbmyAfs5QMYyu9EIeZsEChOtSqnuy6YHHfSdjYSkgAyzzqa4WCw+svMTy3Evqffn\n\tpyjQeNm0u2sLAQP7IXulpi3HcoZ3HblTrX6uiIP1rQttJzjRtyFrkRf6kWjz7mRko8\n\tgsVTyTK1Jo0zw==",
            "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:from:to:cc:subject:date\n\t:message-id:reply-to;\n\tbh=+brAMRKPod66CqD4qVrWYNSEjZMifCSp+0eKyFT0UZY=;\n\tb=Ila0xqbClBgK5QEI4YXp8HnDhKcRn40pOhm2acnsb8t4TPR+a7ukePjTUUYrRiX1oS\n\tVuOw47mHvHcn0f0sWawz3zagsgNV8aPK0sRmVBMuAP5PZoCzm9993pl0oj/KnnaFc8nf\n\tNJv8jSeLulwD2FOkSQYgU7jf88G7AJBZYj8fswlwqxZZirE9KoAOIBsvD9gAfe2Q6j9T\n\tTqGaa2ZlFAy44xMof6eDqpB2opJliwZ4MTiPG0KWwz+36TjJBqJ1ciOsCMwKF0BaQtec\n\tmtK2j0FSXwf3b2NhBegHMhZAFlk5UfppLjy2rc1TmJpwMmu1wqSRmERGvWig+1nyG8aZ\n\tlvRw=="
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"Ila0xqbC\"; dkim-atps=neutral",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc\n\t:subject:date:message-id:reply-to;\n\tbh=+brAMRKPod66CqD4qVrWYNSEjZMifCSp+0eKyFT0UZY=;\n\tb=WIBsHJzV/Z7SpcNdxH1jluepGaTQJkFWuiqcc+YoASiqXwHcq3XsaIHTa2NfO/aVXc\n\tvi++Jc80L4ZL/Vn35AZB9DnTqjtQVcsBdLMyfgxRiQ5ltPVS8s3xqS5QDF1cKMMHzsNT\n\t7hyi5ksSQA77MsjYwU4JwNqhwhtL2SDnuPYn9Rdy0UhzectU13ogqgsomGOUkatsL0fx\n\tBT0hdikRYSRD4k5eBwSg80o6624Z8FTpyUrC9lxkK1pC4oZ1LsFACAMHdY5lpPY8Hq43\n\tCFyo1pwVAuRbybEiE9pGZizGJMkF+SK/h0w6nvP5utiqst5aocuyDM+qJco0/d05cGEn\n\t8Zaw==",
        "X-Gm-Message-State": "ACrzQf04Yc5R9WDmeBY26vB1lc+a8JgT8ThVF5qAYqXvghrURkDLVewK\n\tBqmMk32DajiGjpeTdkpZUo9DfEbgnDScPQ==",
        "X-Google-Smtp-Source": "AMsMyM57U7R5FqeLGyieu8PDE9O+XpM4+Q8NCT+wsxKNwgF5Hy2W0HfTJCZ5yVScpJ3yLCIaZFIxYw==",
        "X-Received": "by 2002:a05:600c:500e:b0:3cf:89c5:c233 with SMTP id\n\tn14-20020a05600c500e00b003cf89c5c233mr2825163wmr.28.1667472032836; \n\tThu, 03 Nov 2022 03:40:32 -0700 (PDT)",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Thu,  3 Nov 2022 10:40:26 +0000",
        "Message-Id": "<20221103104027.4197-2-david.plowman@raspberrypi.com>",
        "X-Mailer": "git-send-email 2.30.2",
        "In-Reply-To": "<20221103104027.4197-1-david.plowman@raspberrypi.com>",
        "References": "<20221103104027.4197-1-david.plowman@raspberrypi.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [RFC PATCH 1/2] libcamera: bayer_format: Add\n\ttoMbusCode method",
        "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": "David Plowman via libcamera-devel <libcamera-devel@lists.libcamera.org>",
        "Reply-To": "David Plowman <david.plowman@raspberrypi.com>",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "This makes it easier to perform transformations on Bayer type mbus\ncodes by converting them to a BayerFormat, doing the transform, and\nthen converting them back again.\n\nSigned-off-by: David Plowman <david.plowman@raspberrypi.com>\n---\n include/libcamera/internal/bayer_format.h |  1 +\n src/libcamera/bayer_format.cpp            | 12 ++++++++++++\n 2 files changed, 13 insertions(+)",
    "diff": "diff --git a/include/libcamera/internal/bayer_format.h b/include/libcamera/internal/bayer_format.h\nindex 78ba3969..09f756c4 100644\n--- a/include/libcamera/internal/bayer_format.h\n+++ b/include/libcamera/internal/bayer_format.h\n@@ -47,6 +47,7 @@ public:\n \t}\n \n \tstatic const BayerFormat &fromMbusCode(unsigned int mbusCode);\n+\tunsigned int toMbusCode(bool &valid) const;\n \tbool isValid() const { return bitDepth != 0; }\n \n \tstd::string toString() const;\ndiff --git a/src/libcamera/bayer_format.cpp b/src/libcamera/bayer_format.cpp\nindex f27cc166..a03c58c0 100644\n--- a/src/libcamera/bayer_format.cpp\n+++ b/src/libcamera/bayer_format.cpp\n@@ -226,6 +226,18 @@ const BayerFormat &BayerFormat::fromMbusCode(unsigned int mbusCode)\n \t\treturn it->second;\n }\n \n+/**\n+ * \\brief Retrieve the media bus code corresponding this this BayerFormat\n+ * \\param[out] valid Set to true if a matching media bus code was found, else false\n+ */\n+unsigned int BayerFormat::toMbusCode(bool &valid) const\n+{\n+\tauto it = std::find_if(mbusCodeToBayer.begin(), mbusCodeToBayer.end(),\n+\t\t\t       [this](const auto &i) { return i.second == *this; });\n+\tvalid = it != mbusCodeToBayer.end();\n+\treturn valid ? it->first : 0;\n+}\n+\n /**\n  * \\fn BayerFormat::isValid()\n  * \\brief Return whether a BayerFormat is valid\n",
    "prefixes": [
        "libcamera-devel",
        "RFC",
        "1/2"
    ]
}