Show a patch.

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

{
    "id": 17836,
    "url": "https://patchwork.libcamera.org/api/patches/17836/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/17836/",
    "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": "<20221122113049.3951-2-david.plowman@raspberrypi.com>",
    "date": "2022-11-22T11:30:48",
    "name": "[libcamera-devel,v3,1/2] libcamera: bayer_format: Add toMbusCode method",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "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/17836/mbox/",
    "series": [
        {
            "id": 3628,
            "url": "https://patchwork.libcamera.org/api/series/3628/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3628",
            "date": "2022-11-22T11:30:47",
            "name": "Resolve invalid attempts to set sensor flip controls",
            "version": 3,
            "mbox": "https://patchwork.libcamera.org/series/3628/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/17836/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/17836/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 71491BDE6B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 22 Nov 2022 11:30:55 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 68B9D6331F;\n\tTue, 22 Nov 2022 12:30:54 +0100 (CET)",
            "from mail-wr1-x434.google.com (mail-wr1-x434.google.com\n\t[IPv6:2a00:1450:4864:20::434])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id BFA80603CE\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 22 Nov 2022 12:30:52 +0100 (CET)",
            "by mail-wr1-x434.google.com with SMTP id x17so10789125wrn.6\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 22 Nov 2022 03:30:52 -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\ti6-20020a05600c354600b003cf894c05e4sm22713522wmq.22.2022.11.22.03.30.51\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 22 Nov 2022 03:30:51 -0800 (PST)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1669116654;\n\tbh=QeE2XrkMAXBq+xIM6/xevcr7Oh2p3OxWkukLjNSxJy0=;\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=GJbZOISVbPWXddqETRyGwB8uKEb5oKt8Et1/WaLolo8Jpqu2s1HshCidYavg74USN\n\tIOUuZ21avNdrDJ99b9cmn9rSMCv4dl/ZsRnF2MNQ9daqOWUJmbtYpA8HZyr8LLV/Fe\n\ttJhzO/KSDhmh/ddNODEZdpo85BGp8EEuitu/FmSjyMSaJts5IB1ErhvkoPBBJx/8NZ\n\tqQwL/u49ZGSV2uzO1NBh1Mw3B01DSdYKzgAUgbpCDtzKT9Xa9cnWJ0Ja2TJrx1jIfV\n\tmEeXnLJStc+6wPUYaUNuH2xwpfft+iRrBAskdBHY6A8yIRn1AM6GqVJbx3oCCFQgiK\n\tTHDoGpwMryg2g==",
            "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=sEHYM3NRf6pMdIrl/YwUGcydrfNxZgsax8Tl7eXR3Tw=;\n\tb=M/9yL6q45d7y25MiWKMrOI2BDQ/huTa6N7P4Q6l3nabuqTyAW/pqQj/7K9fFcaa/wX\n\t+XNsFhqK99ccKoGTG60xhsNJCNX7NQAc0mHSY5rIMt1sBPS96FtMfPozulvyVQLbcWP+\n\tnv17JzItCZGq8dRZ2NI25Ao1zN2KVW0WYmmueF/71amRxtqGD1mO8WVw2aWeXIGdW3i1\n\tJ/4mO/CYRdzfqAjGut68k+J89kHUp+oEXCTpUdTLDC4pLhxpU3c5VneCOgervaLAE/Ls\n\tUB5S10CQ2uIzfzutDwfZ8np/aOgRm8stMcuLYbpbjrKqGG4sJq1iWx8Gn/vqlgioEcPA\n\twpjA=="
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"M/9yL6q4\"; 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=sEHYM3NRf6pMdIrl/YwUGcydrfNxZgsax8Tl7eXR3Tw=;\n\tb=wafOOsq0SdJDORwreTLRyKor0BVgprnRC1CCP887iYBvNgyrA0DjL/K355tfcuoCbK\n\tWW31G8F5TRPDQEXS4CRTWk1GgEZ3WjnvlyE/ACw4ntP/8VGHlT/CqnBqwMxTsQf/ABN7\n\t2XUd+UOy5xstlPNswpkipPKY3aTWsdvYt+bpOukp5KdyUL/kskk6P/yTQeBxgzGLUBVI\n\tWS3aR+PdxA+oCVGHnWmzmtrboQ7HxtsZ9pGNy1qfWPUBwEjCSTn4pE0Yrao67aRf845e\n\tPduDBW/u7YU5a6Z+qqp9HicbMwFmpy/K0HWy+MswZKrMmJBz4cZNulTXycQ8H9PMoKMT\n\tyTYA==",
        "X-Gm-Message-State": "ANoB5pkTeU26cepZGeuCZo1kF/ZHvMIzxfuT8w/iVgxthF0BMWAs845j\n\t1+0b7M1ysuxeS1MYXKhhPL9zEkA4YMh5bA==",
        "X-Google-Smtp-Source": "AA0mqf6C1SD+eXX8is+8hoaGV4b+wlI28NewVQtc7w28UdlX+1UYqZTre3NE42T1vkuvx9CuwgnSaQ==",
        "X-Received": "by 2002:a5d:4984:0:b0:236:4e72:23ba with SMTP id\n\tr4-20020a5d4984000000b002364e7223bamr14343438wrq.385.1669116652146; \n\tTue, 22 Nov 2022 03:30:52 -0800 (PST)",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Tue, 22 Nov 2022 11:30:48 +0000",
        "Message-Id": "<20221122113049.3951-2-david.plowman@raspberrypi.com>",
        "X-Mailer": "git-send-email 2.30.2",
        "In-Reply-To": "<20221122113049.3951-1-david.plowman@raspberrypi.com>",
        "References": "<20221122113049.3951-1-david.plowman@raspberrypi.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v3 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>\nReviewed-by: Jacopo Mondi <jacopo@jmondi.org>\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",
        "v3",
        "1/2"
    ]
}