Show a patch.

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

{
    "id": 14358,
    "url": "https://patchwork.libcamera.org/api/patches/14358/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/14358/",
    "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": "<20211027092803.3671096-5-naush@raspberrypi.com>",
    "date": "2021-10-27T09:27:58",
    "name": "[libcamera-devel,v3,4/9] libcamera: bayer_format: Add PixelFormat conversion helpers to BayerFormat class",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "f4b8ac4c52ab92743bf374dac2e0e363b47b0019",
    "submitter": {
        "id": 34,
        "url": "https://patchwork.libcamera.org/api/people/34/?format=api",
        "name": "Naushir Patuck",
        "email": "naush@raspberrypi.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/14358/mbox/",
    "series": [
        {
            "id": 2660,
            "url": "https://patchwork.libcamera.org/api/series/2660/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2660",
            "date": "2021-10-27T09:27:54",
            "name": "Raspberry Pi: Conversion to media controller",
            "version": 3,
            "mbox": "https://patchwork.libcamera.org/series/2660/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/14358/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/14358/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 D9801BDB1C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 27 Oct 2021 09:28:16 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 6E05B64892;\n\tWed, 27 Oct 2021 11:28:16 +0200 (CEST)",
            "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 852CF64885\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 27 Oct 2021 11:28:10 +0200 (CEST)",
            "by mail-wr1-x434.google.com with SMTP id o14so2927055wra.12\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 27 Oct 2021 02:28:10 -0700 (PDT)",
            "from naush-laptop.pitowers.org\n\t([2a00:1098:3142:14:6561:eb24:3f00:ce98])\n\tby smtp.gmail.com with ESMTPSA id\n\tx2sm2861360wmj.3.2021.10.27.02.28.09\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tWed, 27 Oct 2021 02:28:09 -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=\"pg8rgFZr\"; 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=dqhDVpcqqWaGNFNTkUlgCHkGNjN4Xyh6MA+fZBZUJt8=;\n\tb=pg8rgFZrPIi/gDYYZ0XrtCrBw5pkXqR/kjRZBWHe6Mk56sJUINJZtDUUQABCbPT++l\n\tLU8OmjpGUm0CxDC9BCB0VqojVd0Lal2YIEudo0kBwhTB7zBzab7YhJxDxSGCyayTiZeG\n\tr6a1vI00iN/pJ22YDO9DeFMt6hUWBxB2jpaeixxAOqJ78JYDZlCqDfzS6SZzl8QjFwd4\n\t9YYBUtSdWfllJV/YyWofNh5oKKGx+hwPjX6OW6FvX28A4+Y9jPkH/+70/lylvK9mZyC9\n\twTuffXwpq4dD/+1+Y1YbDLKjTNIpu69A/WQLqgEgGA3gWvRhDFMPcXjiMSQ4QzGFLDIb\n\t0XYg==",
        "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=dqhDVpcqqWaGNFNTkUlgCHkGNjN4Xyh6MA+fZBZUJt8=;\n\tb=YGCE6sXaZ+XyKcUrIYxARL2xLNVXKbJV8DCNaEyIvInjpF5kHZlpgm/FIZrzppjih7\n\t6vCsZ1ZX7XiupRmX/JzI/Ykgf1jOrZtRTp9AHR6TcSL3Xl5er8lcTiTgw9oYTAExxeUp\n\tneuTzzUjC+9I27IGvFH3dmRoUjGaBkatVsG6WPRx4abE25UXyR1q7v/WGf88WSxxrOrf\n\tvmvTvnW4hNh1J5MWvkkM2VsLJajPr3Ixbz2qdLcqJc5TAWaAVwJp+x+PuOhoLPUZqGwG\n\ti1wGaQe59y3LHYb+atJfR26zMyTaGp1/M3o5g6USNXdbdJDCoxXktgAT0tOHgZCFqzra\n\tpohA==",
        "X-Gm-Message-State": "AOAM530EqyUyafx11fHsK+QCm67Kqs3KJrFU4xXcNw87ZodaJ79TDg0h\n\tDTjz1unZtJLEBMZDoQKrmL4Ht1kU0o7u7j55",
        "X-Google-Smtp-Source": "ABdhPJz6ZDMIfcpYWTHKoVL0A9dpa11Fw75iyMpjYwJ56kpwe3uxiActXrX8yPE+NVxUBwt4RDZqlQ==",
        "X-Received": "by 2002:adf:a556:: with SMTP id\n\tj22mr37971095wrb.431.1635326890018; \n\tWed, 27 Oct 2021 02:28:10 -0700 (PDT)",
        "From": "Naushir Patuck <naush@raspberrypi.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Wed, 27 Oct 2021 10:27:58 +0100",
        "Message-Id": "<20211027092803.3671096-5-naush@raspberrypi.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "In-Reply-To": "<20211027092803.3671096-1-naush@raspberrypi.com>",
        "References": "<20211027092803.3671096-1-naush@raspberrypi.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v3 4/9] libcamera: bayer_format: Add\n\tPixelFormat conversion helpers to BayerFormat 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": "Add BayerFormat::toPixelFormat() and BayerFormat::fromPixelFormat() helper\nfunctions to convert between BayerFormat and PixelFormat types.\n\nSigned-off-by: Naushir Patuck <naush@raspberrypi.com>\nReviewed-by: David Plowman <david.plowman@raspberrypi.com>\n---\n include/libcamera/internal/bayer_format.h |  4 ++++\n src/libcamera/bayer_format.cpp            | 29 +++++++++++++++++++++++\n 2 files changed, 33 insertions(+)",
    "diff": "diff --git a/include/libcamera/internal/bayer_format.h b/include/libcamera/internal/bayer_format.h\nindex 723382d4168d..ee96b9a86707 100644\n--- a/include/libcamera/internal/bayer_format.h\n+++ b/include/libcamera/internal/bayer_format.h\n@@ -10,6 +10,8 @@\n #include <stdint.h>\n #include <string>\n \n+#include <libcamera/pixel_format.h>\n+\n #include \"libcamera/internal/v4l2_pixelformat.h\"\n \n namespace libcamera {\n@@ -50,6 +52,8 @@ public:\n \n \tV4L2PixelFormat toV4L2PixelFormat() const;\n \tstatic BayerFormat fromV4L2PixelFormat(V4L2PixelFormat v4l2Format);\n+\tPixelFormat toPixelFormat() const;\n+\tstatic BayerFormat fromPixelFormat(PixelFormat format);\n \tBayerFormat transform(Transform t) const;\n \n \tOrder order;\ndiff --git a/src/libcamera/bayer_format.cpp b/src/libcamera/bayer_format.cpp\nindex 94e2294d7f6c..1edd238829ce 100644\n--- a/src/libcamera/bayer_format.cpp\n+++ b/src/libcamera/bayer_format.cpp\n@@ -305,6 +305,35 @@ BayerFormat BayerFormat::fromV4L2PixelFormat(V4L2PixelFormat v4l2Format)\n \treturn BayerFormat();\n }\n \n+/**\n+ * \\brief Convert a BayerFormat into the corresponding PixelFormat\n+ * \\return The PixelFormat corresponding to this BayerFormat\n+ */\n+PixelFormat BayerFormat::toPixelFormat() const\n+{\n+\tconst auto it = bayerToFormat.find(*this);\n+\tif (it != bayerToFormat.end())\n+\t\treturn it->second.pixelFormat;\n+\n+\treturn PixelFormat();\n+}\n+\n+/**\n+ * \\brief Convert a PixelFormat into the corresponding BayerFormat\n+ * \\return The BayerFormat corresponding to this PixelFormat\n+ */\n+BayerFormat BayerFormat::fromPixelFormat(PixelFormat format)\n+{\n+\tauto it = std::find_if(bayerToFormat.begin(), bayerToFormat.end(),\n+\t\t\t       [format](const auto &i) {\n+\t\t\t\t       return i.second.pixelFormat == format;\n+\t\t\t       });\n+\tif (it == bayerToFormat.end())\n+\t\treturn BayerFormat{};\n+\n+\treturn it->first;\n+}\n+\n /**\n  * \\brief Apply a transform to this BayerFormat\n  * \\param[in] t The transform to apply\n",
    "prefixes": [
        "libcamera-devel",
        "v3",
        "4/9"
    ]
}