Patch Detail
Show a patch.
GET /api/patches/17887/?format=api
{ "id": 17887, "url": "https://patchwork.libcamera.org/api/patches/17887/?format=api", "web_url": "https://patchwork.libcamera.org/patch/17887/", "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": "<20221124121220.47000-2-jacopo@jmondi.org>", "date": "2022-11-24T12:12:12", "name": "[libcamera-devel,1/9] libcamera: bayer_format: Add toMbusCode method", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "5258153d4d910cd765662ebbec681b3f06217f12", "submitter": { "id": 3, "url": "https://patchwork.libcamera.org/api/people/3/?format=api", "name": "Jacopo Mondi", "email": "jacopo@jmondi.org" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/17887/mbox/", "series": [ { "id": 3638, "url": "https://patchwork.libcamera.org/api/series/3638/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3638", "date": "2022-11-24T12:12:11", "name": "libcamera: camera_sensor: Centralize flips handling", "version": 1, "mbox": "https://patchwork.libcamera.org/series/3638/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/17887/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/17887/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 754C3BDE6B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 24 Nov 2022 12:12:30 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 45FCC63321;\n\tThu, 24 Nov 2022 13:12:30 +0100 (CET)", "from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net\n\t[IPv6:2001:4b98:dc4:8::222])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 7A5A36331A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 24 Nov 2022 13:12:27 +0100 (CET)", "(Authenticated sender: jacopo@jmondi.org)\n\tby mail.gandi.net (Postfix) with ESMTPSA id 6B1D24000E;\n\tThu, 24 Nov 2022 12:12:26 +0000 (UTC)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1669291950;\n\tbh=cMyh8jAUSIrQxf42ySkdTyCgVYV2cIDPeSWBXmpbK9I=;\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=av5Tn1KkMTdW7ere3Nb7GgcTsL2K+34eSj7ZgMrgbrCFJa1HQ9UsWLMuM3w5H88Zk\n\t+tJ7NdBGQnL3Q3tqzUGTlOQOJfkRnpepKOPyJ34/8TQowhnWpMzhxB7iLVKLJCw90o\n\tV8Fzn6xg9aLGH7t4B6ZqZCdDtDT/LalCMufVqjnnsAGNblNVaLXXTuWjKSY7/5r94X\n\tDbmp80ijNjMnl3du3t3FC0ah5CHbu8oQjSs41AzFlXsTI90CKd+raYRaHIBaV9xPMB\n\tg0lasnw1Z08iPpgJd2jMhjz+q6vii1QAdQmCDCY7VBNHf4C5RX4TlqGmwhEM/zXtPi\n\tYZYgYQ5lbJSfg==", "To": "libcamera-devel@lists.libcamera.org", "Date": "Thu, 24 Nov 2022 13:12:12 +0100", "Message-Id": "<20221124121220.47000-2-jacopo@jmondi.org>", "X-Mailer": "git-send-email 2.38.1", "In-Reply-To": "<20221124121220.47000-1-jacopo@jmondi.org>", "References": "<20221124121220.47000-1-jacopo@jmondi.org>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH 1/9] 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": "Jacopo Mondi via libcamera-devel <libcamera-devel@lists.libcamera.org>", "Reply-To": "Jacopo Mondi <jacopo@jmondi.org>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "From: David Plowman <david.plowman@raspberrypi.com>\n\nThis 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 78ba3969913d..3601dccb7228 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 f27cc1662d25..fdbc4af1dcc0 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/9" ] }