Patch Detail
Show a patch.
GET /api/1.1/patches/14442/?format=api
{ "id": 14442, "url": "https://patchwork.libcamera.org/api/1.1/patches/14442/?format=api", "web_url": "https://patchwork.libcamera.org/patch/14442/", "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": "<20211101091510.23204-8-naush@raspberrypi.com>", "date": "2021-11-01T09:15:06", "name": "[libcamera-devel,v5,07/11] libcamera: bayer_format: Add PixelFormat conversion helpers to BayerFormat class", "commit_ref": "91bd175c8f43bf66a039f9979ed89103808aef0b", "pull_url": null, "state": "accepted", "archived": false, "hash": "55e76b3b24bd0410f80e669e7b7296782bd857d3", "submitter": { "id": 34, "url": "https://patchwork.libcamera.org/api/1.1/people/34/?format=api", "name": "Naushir Patuck", "email": "naush@raspberrypi.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/14442/mbox/", "series": [ { "id": 2684, "url": "https://patchwork.libcamera.org/api/1.1/series/2684/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2684", "date": "2021-11-01T09:14:59", "name": "Raspberry Pi: Conversion to media controller", "version": 5, "mbox": "https://patchwork.libcamera.org/series/2684/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/14442/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/14442/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 82A9BC324E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 1 Nov 2021 09:15:22 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 374AA60326;\n\tMon, 1 Nov 2021 10:15:22 +0100 (CET)", "from mail-wm1-x329.google.com (mail-wm1-x329.google.com\n\t[IPv6:2a00:1450:4864:20::329])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 5700B600C8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 1 Nov 2021 10:15:18 +0100 (CET)", "by mail-wm1-x329.google.com with SMTP id\n\tj128-20020a1c2386000000b003301a98dd62so8282498wmj.5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 01 Nov 2021 02:15:18 -0700 (PDT)", "from naush-laptop.pitowers.org\n\t([2a00:1098:3142:14:3a2b:9d8c:92b9:ece6])\n\tby smtp.gmail.com with ESMTPSA id\n\tw10sm13168849wrq.88.2021.11.01.02.15.17\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tMon, 01 Nov 2021 02:15:17 -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=\"CC54aEAQ\"; 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=YPq00NOuoRgq46bBhppDBKpNY7cAdhvldaSzvXvOLbo=;\n\tb=CC54aEAQgdstehTc4vf/gb45MzoUJImCC5bBe/aCpHbkY33409EL3gxNUHfGwsxn7U\n\toDaz+urJ98BgxMZdszkwDCK3uAE6RklCGxwwCLk5uvpSGhR/fvUfcr0ejCKivQSHEbwx\n\tCzl2SB8Uyp1ed/1B5nTL1+qrbT+UjephMfIf8FEgvJe8oZqrJEsht9mJf+MJ3nK6so7h\n\tnmf3/V0TnPUTPdKo1aOYlRKdXEOKfrcrqJ1smzYZLKHUK4R5KkbxbIhXXwB5zbFbFVCm\n\tLw5anrtqOut5L/qSCxbvmrXJw1I5g1s2VdDDWh9E8PHseAA3dQVAFkye1dTh3Zp2H1xt\n\tdsRA==", "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=YPq00NOuoRgq46bBhppDBKpNY7cAdhvldaSzvXvOLbo=;\n\tb=vO6JUGiEiWESJE28akCAzcZGli1sqfUrI1BGUQkifZr1jg0bXicT/MjVDpv7M6KZCy\n\tbP5kBsbepUZfSKyNcvRZI8gKT1Udm8vpRAPdaMDz/ngCt3SDb2w/ZPZBDrf1sGlmZ2/+\n\tCQ2bofuSS0+IK6TWRMCMpqb1ZZkSi0FCqf9epFqli8NRt3LabCcZ9LYuEcpl3qncTmEZ\n\t+FikpZOE/k6NV+mnmX+NJfv49eM5GLEaIVXxuFdUEGydVa39GgREyT8R29PKDRwH7bXL\n\tGYLncLT6e640ih4601E/xHM4+onq+ulm6yRiFydmSGb+Rd9jJMyq0A0Xm7eJzi4MXP0i\n\tGF7A==", "X-Gm-Message-State": "AOAM533hJq6trqXAlUz/6gaH9vl+TDVTAbr0+CLgS32HLjkvuMICeoRz\n\t06WRzhRLj9CkSl2QL7Pl61/DpmmtISoRIyQG", "X-Google-Smtp-Source": "ABdhPJxKOdXT/TzHVMjPROpVPMncNJCfvVUj236lj7KOreA4P/HOK1Q+L8HbVJxO/mdrdf0F6Vp9aw==", "X-Received": "by 2002:a05:600c:202:: with SMTP id\n\t2mr11958755wmi.134.1635758117905; \n\tMon, 01 Nov 2021 02:15:17 -0700 (PDT)", "From": "Naushir Patuck <naush@raspberrypi.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Mon, 1 Nov 2021 09:15:06 +0000", "Message-Id": "<20211101091510.23204-8-naush@raspberrypi.com>", "X-Mailer": "git-send-email 2.25.1", "In-Reply-To": "<20211101091510.23204-1-naush@raspberrypi.com>", "References": "<20211101091510.23204-1-naush@raspberrypi.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v5 07/11] 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>\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.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 d9a56d744a25..79a25b52582d 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 8665a025f7e0..1805d6fbbab9 100644\n--- a/src/libcamera/bayer_format.cpp\n+++ b/src/libcamera/bayer_format.cpp\n@@ -307,6 +307,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+\tconst auto it = std::find_if(bayerToFormat.begin(), bayerToFormat.end(),\n+\t\t\t\t [format](const auto &i) {\n+\t\t\t\t\treturn i.second.pixelFormat == format;\n+\t\t\t\t });\n+\tif (it != bayerToFormat.end())\n+\t\treturn it->first;\n+\n+\treturn BayerFormat();\n+}\n+\n /**\n * \\brief Apply a transform to this BayerFormat\n * \\param[in] t The transform to apply\n", "prefixes": [ "libcamera-devel", "v5", "07/11" ] }