Show a patch.

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

{
    "id": 17766,
    "url": "https://patchwork.libcamera.org/api/patches/17766/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/17766/",
    "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": "<20221110144556.7858-2-david.plowman@raspberrypi.com>",
    "date": "2022-11-10T14:45:51",
    "name": "[libcamera-devel,1/6] libcamera: bayer_format: Add toMbusCode method",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "5258153d4d910cd765662ebbec681b3f06217f12",
    "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/17766/mbox/",
    "series": [
        {
            "id": 3602,
            "url": "https://patchwork.libcamera.org/api/series/3602/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3602",
            "date": "2022-11-10T14:45:50",
            "name": "Resolve invalid attempts to set sensor flip controls",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/3602/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/17766/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/17766/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 8736DC3285\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 10 Nov 2022 14:46:06 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id E65F56307F;\n\tThu, 10 Nov 2022 15:46:04 +0100 (CET)",
            "from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com\n\t[IPv6:2a00:1450:4864:20::42d])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id C90E86307B\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 10 Nov 2022 15:46:03 +0100 (CET)",
            "by mail-wr1-x42d.google.com with SMTP id v1so2549349wrt.11\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 10 Nov 2022 06:46: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\tu24-20020a7bc058000000b003b476cabf1csm5249759wmc.26.2022.11.10.06.46.02\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tThu, 10 Nov 2022 06:46:02 -0800 (PST)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1668091564;\n\tbh=7XAMEwB+kGGG0KsM65uR/xgA8tfU2IrSJ/iTMvN5CvY=;\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=SoMeucCBBjDgNfpb2J/U/M6/J8QltYcQwsj9OBvJtKY8CE4Ro4e4r+IduXnSu6WU9\n\toJHG/fE8CbPzMPh0xWELyjis86KN2kkKoOHbup+BMz01gS0AIZpFRTlOnwHbm2YkrZ\n\tgsNIc5iD4hSUlh5gnxYgWWc/7m9SDomaGAlAEvMLkhKFHjcakgny3w7eOts+NXwP5J\n\taz8Jl4rMrkVq4JIWEaKBHo0sSqYPtpXVGtgIMSDwq+RafzzcAFfvokVOjWvfwpjdru\n\to1DAOBGgQW596tACFv+yFl+q3vEV9FizG64Cq0FxRrFMX19TFP2sskM43I1DDn3ww+\n\taL0ZQVRIUT58g==",
            "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=VyI3v9GDjJiklg6l9N/VsNz/O4lNh0mKH20mHfn4OpM=;\n\tb=hmTHNnP3jj0dzQSAVvUwxn+jvtS9sYr8O7/2BHvJyXGUFzg/SA7EglGw09cH/Zm/HK\n\tNzCv0kxpLBJf8O78V/pMZQSgdP0kcGxvKaSWr0I1csowip4Bs1fsDiKGPfajG+c4KNyl\n\tt7z5YWyZlhiSIeeRaySsrkKkc+QOucei0A8V416COZiZDlL8Mkn8Xxc3AwQ05H/HDH8/\n\t8JYunNHIfMnQoNNsbzVKOuQrUjZMdP4Ws8I2R3P5oGXrV68UrGe+ci6kycvPj/qPRLhA\n\t99XJcyiEPRk114ic9UzLMT+yiIqrgb6phfYz2DNcqUEDac5HINSkYe04cKoZhVBxHzAb\n\tcNtg=="
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"hmTHNnP3\"; 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=VyI3v9GDjJiklg6l9N/VsNz/O4lNh0mKH20mHfn4OpM=;\n\tb=UOuibCbxCc/P2JYWVkeryAgT7yW6q49nPMpb3bEiJSSoJCi+0yc4hZ7k/RViBLrHU+\n\tPU3pZ8Du7U4necV/5dkaJCPLK4wFOvXvHwI05VevEIfvVBz7IcxrrAdMKhfyim1jAHir\n\tItE7kPSPZmPdxZPrxJKjx2dP4vEm1EKS5aXxQIZ0p3gg52C1TpFkXI3pH4CLMka4/741\n\tLXHh8AFLJgPgL4vN/FZyuj6tTIJnJ0m7GpiVAp8f0OVYuAogczPyKbdrEi7B36zsqxyr\n\tKIqo6NU/yKmr/i2FycoHSWfqjnXhMfMty+82/eQleWBFeYmdpB04HSAkfmv+chmPqkNp\n\tRTPg==",
        "X-Gm-Message-State": "ACrzQf1FjJDmdGPEpN2Y7ZsMhhGqWojg7McHJskSetei28VU+pGDYGGa\n\t19fyM5TAYo9PaS4gQ9KtfpJrlCNPjI98uA==",
        "X-Google-Smtp-Source": "AMsMyM6uRS/3Flla60Wuoop8WRyQuDLrYOdJbgcuq44BgO+rC+hZaAdIjoVNa65xTH6mplKbulfNtQ==",
        "X-Received": "by 2002:a5d:448d:0:b0:235:98b:6145 with SMTP id\n\tj13-20020a5d448d000000b00235098b6145mr41260843wrq.421.1668091563088; \n\tThu, 10 Nov 2022 06:46:03 -0800 (PST)",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Thu, 10 Nov 2022 14:45:51 +0000",
        "Message-Id": "<20221110144556.7858-2-david.plowman@raspberrypi.com>",
        "X-Mailer": "git-send-email 2.30.2",
        "In-Reply-To": "<20221110144556.7858-1-david.plowman@raspberrypi.com>",
        "References": "<20221110144556.7858-1-david.plowman@raspberrypi.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH 1/6] 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            | 11 +++++++++++\n 2 files changed, 12 insertions(+)",
    "diff": "diff --git a/include/libcamera/internal/bayer_format.h b/include/libcamera/internal/bayer_format.h\nindex 78ba3969..3601dccb 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() 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..fdbc4af1 100644\n--- a/src/libcamera/bayer_format.cpp\n+++ b/src/libcamera/bayer_format.cpp\n@@ -226,6 +226,17 @@ 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+ * \\return The corresponding media bus code, or zero if none was found\n+ */\n+unsigned int BayerFormat::toMbusCode() 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+\treturn it != mbusCodeToBayer.end() ? it->first : 0;\n+}\n+\n /**\n  * \\fn BayerFormat::isValid()\n  * \\brief Return whether a BayerFormat is valid\n",
    "prefixes": [
        "libcamera-devel",
        "1/6"
    ]
}