Patch Detail
Show a patch.
GET /api/1.1/patches/24239/?format=api
{ "id": 24239, "url": "https://patchwork.libcamera.org/api/1.1/patches/24239/?format=api", "web_url": "https://patchwork.libcamera.org/patch/24239/", "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": "<20250827090739.86955-3-david.plowman@raspberrypi.com>", "date": "2025-08-27T09:07:29", "name": "[RFC,02/12] libcamera: Add BayerFormat::toMbusCode", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "5e6899751fbb1b1ebd8bcedda659496ba87819b3", "submitter": { "id": 42, "url": "https://patchwork.libcamera.org/api/1.1/people/42/?format=api", "name": "David Plowman", "email": "david.plowman@raspberrypi.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/24239/mbox/", "series": [ { "id": 5407, "url": "https://patchwork.libcamera.org/api/1.1/series/5407/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=5407", "date": "2025-08-27T09:07:27", "name": "Bayer Re-Processing", "version": 1, "mbox": "https://patchwork.libcamera.org/series/5407/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/24239/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/24239/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 316F7BD87C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 27 Aug 2025 09:07:56 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 1B94A692FB;\n\tWed, 27 Aug 2025 11:07:49 +0200 (CEST)", "from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com\n\t[IPv6:2a00:1450:4864:20::32a])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 772C2692EB\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 27 Aug 2025 11:07:45 +0200 (CEST)", "by mail-wm1-x32a.google.com with SMTP id\n\t5b1f17b1804b1-45a1b004954so51909275e9.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 27 Aug 2025 02:07:45 -0700 (PDT)", "from raspberrypi.pitowers.org\n\t([2a00:1098:3142:1f:ffc9:aff6:7f7f:893b])\n\tby smtp.gmail.com with ESMTPSA id\n\t5b1f17b1804b1-45b6f30fe02sm21498675e9.18.2025.08.27.02.07.43\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tWed, 27 Aug 2025 02:07:44 -0700 (PDT)" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key;\n\tunprotected) header.d=raspberrypi.com header.i=@raspberrypi.com\n\theader.b=\"tOkjfdeY\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google; t=1756285665; x=1756890465;\n\tdarn=lists.libcamera.org; \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=Sua0fW4TmtI2NRqqSMfXISvx8gNaU/HRu7j90J3GPoE=;\n\tb=tOkjfdeYkWgFASAOMkXgs44TGSUuWXCJ473dH3dVmLsFIkFnB9ahqpXQ1vzu5J0n6p\n\tuQRlM+3PqvW7VyrcJOGDayPA5+ctnt5BdaRMS/nvbvyp7PvKmEZKpZmvbZx8KeYP/4YA\n\thQU3DclF3IbeGZ2hOZ3teaamvIubKQiEF/vyUqi+K/UvffSPGxP7bX+tem10lGHu+At8\n\tnHK1KJ87i1Pzbob6Bk75xVUgRo88vFV/7tYVI5xh2StK9J7Gi6eEFtKqyu9a4S9wez8d\n\tB5zFZXdl56WEFOhUs+dOO+09pHWWkMyYswj1S4UjnEPjpwfOrzLDQDKFsgaq6dnvq4ZR\n\t0VnQ==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1756285665; x=1756890465;\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=Sua0fW4TmtI2NRqqSMfXISvx8gNaU/HRu7j90J3GPoE=;\n\tb=AHOHgLYLzN9Z1wHgiaggPHu69Mzj7rwjuF0hrJJtBhC24L9ubSDXt3+0MrRZIqzPzs\n\tZwvHV1d0QAwoKXgXBLERW7c7IxKyPStOPsMsaRAtHaG1tM1Rrqg335HXK+dqe8svmnWq\n\t8VaC6sAARn/vu8c8SadJI2Zr4aBTo0fc+bd9iZw1kLwJjUQfYNLyehk2CVpm1g9lPXmd\n\t8k9E/NQg6Re0WuxTHMDb86UdPHlu59vtxN7PiQJeE34AV4j2Bhec1ZK1ep9Sa/5mJrfP\n\tQ2uqg/XaG/ewOACdOcyVDPVQpcOetpiha3QUxbdJTRwk59lTQYazgj2osxosaBJPwQ9s\n\t5gyg==", "X-Gm-Message-State": "AOJu0YyT+Eam/WCtAbTi412Q/4glLAyqbSpNVRaNXz3fhnY6n/2Is5+D\n\tZYEve/syfbjcng8U5kmQDWDoklu2WsQXKfyPo+EEijezbiQtcJRKybVptYLLEwSPKeZqeL+cyKz\n\tKEsrN", "X-Gm-Gg": "ASbGncvW0HL0YqWk1cgyfCv9n8XVgjc8PeWvbNqWAC5lBHkApTz8ZfmDoljiw40ejKB\n\tte30IY+C3ZMJNA7Yo+N2WBzfnJJjhC8DHSwJknpWiy4hDlzbR2IGXCmSer1iI0XTjz9S4swNWIC\n\tW8tMSrUORkqyM0w/tSRfWCo8ScM8KmUUHlpm0TRcbi878oibKlhnyUQNuap6namZ7pvQCI1nJO3\n\tinrz1A/Zp9diMB+wg78LJVvfg+wfqRe8I9q05yZKGgevMs6dPxal+RDn283x/sDc2Xdt8K4YrDQ\n\tMKmTz+X+wVbdm1yBKui7LRlSLFjNmeXD0AdWd+TjtsiG8ANQ5fha23Ib4bSzKZU91C3mMyvnv8E\n\tqlDW43wDCz5Z+w5sgphx3F7pTNQXMzn9HEyO1+Taerfz6oQ2Xc4OconV2gsxT0NDjRZIil1zkBf\n\tCVaETBkB584aKhQlZJ5r1sEZhyOmtkb9UueAsiMFc5aoLsOKEnrdqQ2aZpfquG", "X-Google-Smtp-Source": "AGHT+IEMuPeTAyXray2xtje4tJ6CkmcQAi2cZ/XeJbdvG6af5uog1UtlaKbu2svo/w6KIUd2qV8g/w==", "X-Received": "by 2002:a05:600c:154f:b0:458:6733:fb43 with SMTP id\n\t5b1f17b1804b1-45b517c552dmr144163855e9.19.1756285664593; \n\tWed, 27 Aug 2025 02:07:44 -0700 (PDT)", "From": "David Plowman <david.plowman@raspberrypi.com>", "To": "libcamera-devel@lists.libcamera.org", "Cc": "David Plowman <david.plowman@raspberrypi.com>", "Subject": "[RFC PATCH 02/12] libcamera: Add BayerFormat::toMbusCode", "Date": "Wed, 27 Aug 2025 10:07:29 +0100", "Message-Id": "<20250827090739.86955-3-david.plowman@raspberrypi.com>", "X-Mailer": "git-send-email 2.39.5", "In-Reply-To": "<20250827090739.86955-1-david.plowman@raspberrypi.com>", "References": "<20250827090739.86955-1-david.plowman@raspberrypi.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "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": "Multiple places now need this, so centralise it here.\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 | 124 ++++++++++++++++++++++\n 2 files changed, 125 insertions(+)", "diff": "diff --git a/include/libcamera/internal/bayer_format.h b/include/libcamera/internal/bayer_format.h\nindex 5c14bb5f..f2f22932 100644\n--- a/include/libcamera/internal/bayer_format.h\n+++ b/include/libcamera/internal/bayer_format.h\n@@ -53,6 +53,7 @@ public:\n \n \tstd::string toString() const;\n \n+\tunsigned int toMbusCode() const;\n \tV4L2PixelFormat toV4L2PixelFormat() const;\n \tstatic BayerFormat fromV4L2PixelFormat(V4L2PixelFormat v4l2Format);\n \tPixelFormat toPixelFormat() const;\ndiff --git a/src/libcamera/bayer_format.cpp b/src/libcamera/bayer_format.cpp\nindex 3dab91fc..9e9d50fc 100644\n--- a/src/libcamera/bayer_format.cpp\n+++ b/src/libcamera/bayer_format.cpp\n@@ -331,6 +331,130 @@ std::ostream &operator<<(std::ostream &out, const BayerFormat &f)\n \treturn out;\n }\n \n+const std::vector<std::pair<BayerFormat, unsigned int>> BayerToMbusCodeMap{\n+\t{\n+\t\t{ BayerFormat::BGGR, 8, BayerFormat::Packing::None },\n+\t\tMEDIA_BUS_FMT_SBGGR8_1X8,\n+\t},\n+\t{\n+\t\t{ BayerFormat::GBRG, 8, BayerFormat::Packing::None },\n+\t\tMEDIA_BUS_FMT_SGBRG8_1X8,\n+\t},\n+\t{\n+\t\t{ BayerFormat::GRBG, 8, BayerFormat::Packing::None },\n+\t\tMEDIA_BUS_FMT_SGRBG8_1X8,\n+\t},\n+\t{\n+\t\t{ BayerFormat::RGGB, 8, BayerFormat::Packing::None },\n+\t\tMEDIA_BUS_FMT_SRGGB8_1X8,\n+\t},\n+\t{\n+\t\t{ BayerFormat::BGGR, 10, BayerFormat::Packing::None },\n+\t\tMEDIA_BUS_FMT_SBGGR10_1X10,\n+\t},\n+\t{\n+\t\t{ BayerFormat::GBRG, 10, BayerFormat::Packing::None },\n+\t\tMEDIA_BUS_FMT_SGBRG10_1X10,\n+\t},\n+\t{\n+\t\t{ BayerFormat::GRBG, 10, BayerFormat::Packing::None },\n+\t\tMEDIA_BUS_FMT_SGRBG10_1X10,\n+\t},\n+\t{\n+\t\t{ BayerFormat::RGGB, 10, BayerFormat::Packing::None },\n+\t\tMEDIA_BUS_FMT_SRGGB10_1X10,\n+\t},\n+\t{\n+\t\t{ BayerFormat::BGGR, 12, BayerFormat::Packing::None },\n+\t\tMEDIA_BUS_FMT_SBGGR12_1X12,\n+\t},\n+\t{\n+\t\t{ BayerFormat::GBRG, 12, BayerFormat::Packing::None },\n+\t\tMEDIA_BUS_FMT_SGBRG12_1X12,\n+\t},\n+\t{\n+\t\t{ BayerFormat::GRBG, 12, BayerFormat::Packing::None },\n+\t\tMEDIA_BUS_FMT_SGRBG12_1X12,\n+\t},\n+\t{\n+\t\t{ BayerFormat::RGGB, 12, BayerFormat::Packing::None },\n+\t\tMEDIA_BUS_FMT_SRGGB12_1X12,\n+\t},\n+\t{\n+\t\t{ BayerFormat::BGGR, 14, BayerFormat::Packing::None },\n+\t\tMEDIA_BUS_FMT_SBGGR14_1X14,\n+\t},\n+\t{\n+\t\t{ BayerFormat::GBRG, 14, BayerFormat::Packing::None },\n+\t\tMEDIA_BUS_FMT_SGBRG14_1X14,\n+\t},\n+\t{\n+\t\t{ BayerFormat::GRBG, 14, BayerFormat::Packing::None },\n+\t\tMEDIA_BUS_FMT_SGRBG14_1X14,\n+\t},\n+\t{\n+\t\t{ BayerFormat::RGGB, 14, BayerFormat::Packing::None },\n+\t\tMEDIA_BUS_FMT_SRGGB14_1X14,\n+\t},\n+\t{\n+\t\t{ BayerFormat::BGGR, 16, BayerFormat::Packing::None },\n+\t\tMEDIA_BUS_FMT_SBGGR16_1X16,\n+\t},\n+\t{\n+\t\t{ BayerFormat::GBRG, 16, BayerFormat::Packing::None },\n+\t\tMEDIA_BUS_FMT_SGBRG16_1X16,\n+\t},\n+\t{\n+\t\t{ BayerFormat::GRBG, 16, BayerFormat::Packing::None },\n+\t\tMEDIA_BUS_FMT_SGRBG16_1X16,\n+\t},\n+\t{\n+\t\t{ BayerFormat::RGGB, 16, BayerFormat::Packing::None },\n+\t\tMEDIA_BUS_FMT_SRGGB16_1X16,\n+\t},\n+\t{\n+\t\t{ BayerFormat::BGGR, 16, BayerFormat::Packing::PISP1 },\n+\t\tMEDIA_BUS_FMT_SBGGR16_1X16,\n+\t},\n+\t{\n+\t\t{ BayerFormat::GBRG, 16, BayerFormat::Packing::PISP1 },\n+\t\tMEDIA_BUS_FMT_SGBRG16_1X16,\n+\t},\n+\t{\n+\t\t{ BayerFormat::GRBG, 16, BayerFormat::Packing::PISP1 },\n+\t\tMEDIA_BUS_FMT_SGRBG16_1X16,\n+\t},\n+\t{\n+\t\t{ BayerFormat::RGGB, 16, BayerFormat::Packing::PISP1 },\n+\t\tMEDIA_BUS_FMT_SRGGB16_1X16,\n+\t},\n+\t{\n+\t\t{ BayerFormat::RGGB, 16, BayerFormat::Packing::PISP1 },\n+\t\tMEDIA_BUS_FMT_SRGGB16_1X16,\n+\t},\n+\t{\n+\t\t{ BayerFormat::MONO, 16, BayerFormat::Packing::None },\n+\t\tMEDIA_BUS_FMT_Y16_1X16,\n+\t},\n+\t{\n+\t\t{ BayerFormat::MONO, 16, BayerFormat::Packing::PISP1 },\n+\t\tMEDIA_BUS_FMT_Y16_1X16,\n+\t},\n+};\n+\n+unsigned int BayerFormat::toMbusCode() const\n+{\n+\tconst auto it = std::find_if(BayerToMbusCodeMap.begin(), BayerToMbusCodeMap.end(),\n+\t\t\t\t [this](const std::pair<BayerFormat, unsigned int> &match) {\n+\t\t\t\t\t return *this == match.first;\n+\t\t\t\t });\n+\n+\tif (it != BayerToMbusCodeMap.end())\n+\t\treturn it->second;\n+\n+\treturn 0;\n+}\n+\n /**\n * \\fn bool operator!=(const BayerFormat &lhs, const BayerFormat &rhs)\n * \\brief Compare two BayerFormats for inequality\n", "prefixes": [ "RFC", "02/12" ] }