Patch Detail
Show a patch.
GET /api/1.1/patches/9494/?format=api
{ "id": 9494, "url": "https://patchwork.libcamera.org/api/1.1/patches/9494/?format=api", "web_url": "https://patchwork.libcamera.org/patch/9494/", "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": "<20200904103042.1593-5-david.plowman@raspberrypi.com>", "date": "2020-09-04T10:30:38", "name": "[libcamera-devel,v7,4/8] libcamera: Add BayerFormat type", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "05f21e2f8268fbe1a87f6581ee646cf60402e24c", "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/9494/mbox/", "series": [ { "id": 1265, "url": "https://patchwork.libcamera.org/api/1.1/series/1265/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1265", "date": "2020-09-04T10:30:34", "name": "2D transforms", "version": 7, "mbox": "https://patchwork.libcamera.org/series/1265/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/9494/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/9494/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 AC840BE174\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 4 Sep 2020 10:30:52 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 7585760371;\n\tFri, 4 Sep 2020 12:30:52 +0200 (CEST)", "from mail-wr1-x442.google.com (mail-wr1-x442.google.com\n\t[IPv6:2a00:1450:4864:20::442])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id C57C762946\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 4 Sep 2020 12:30:50 +0200 (CEST)", "by mail-wr1-x442.google.com with SMTP id c18so6191335wrm.9\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 04 Sep 2020 03:30:50 -0700 (PDT)", "from pi4-davidp.lan (plowpeople3.plus.com. [80.229.223.72])\n\tby smtp.gmail.com with ESMTPSA id\n\tq4sm10294542wru.65.2020.09.04.03.30.49\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tFri, 04 Sep 2020 03:30:49 -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=\"ksjb1mQ6\"; 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=gf20xRgK5cHl2EqM3znt2oz2qj8hNXxwCTdPCxaBoOg=;\n\tb=ksjb1mQ6lTRBNl3TjvARg18v6TrHDOP5pvqx562rKKBhQOmPwVV99dpkl2oTJaYy6V\n\tSl6vBq9sitdkXUI3NuhVR4gojBq6D0wE/sfa34bD/pKnx4dupKzGiWIJaM5FiyOwtTRJ\n\tRl/X5XcjCR8mNLTpV57plTck2UFopX6pSk9rirX2XlKYt9hLNBfE/ACsAhGTKh2pOZAY\n\t63S7vFZhMMOBwoz45XtFRw8GcFPcfzGTtWtMmfv//IzO6XsZmRvJSYs4fMqpWmLG998D\n\t/Zs4rI6dNErbTep+n8+nZVzOdXPEVmVfj3eROxlu1zr0v0VvXS/HTZFFUryJm9aikHq9\n\tt0RA==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\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=gf20xRgK5cHl2EqM3znt2oz2qj8hNXxwCTdPCxaBoOg=;\n\tb=lKm0KbphGAiBVfppZ6ND8+rntvP06KFyqbSi1Q40neOFGhaJHn7gaPJu1/9qFtHo/V\n\tb/zyziKFfgsVnRyaujnCPXv0E/NnsWhwv7LWKqfTC++k3s32LiYqdSAvZ0N/THglGcv0\n\tXv8wNBUWqO1vri2xTka3VAAr+VdZTzqorHno/LQchmWJhfbXDKR+3S+qAHQUTmxqZ9YE\n\ttB4NaA2YLuJSMJEOiigtX9mFh03NTqVW2KTUY120ItxDQn7YpGGbeztfsOhg8KXwVeYd\n\ttrcl53YToh4s5758Y8Rvmho4belJFIA3q6Vun1u1dWHAngER647bOBN1o2AaItY4Rn3p\n\t7mng==", "X-Gm-Message-State": "AOAM530pLkGWMFqG506Pxu3ynRt5726esI6IwJorFQdouUdgU2pg5AAU\n\tGAseXCYfujzMtbVKbivT4r0NinfNoeKZTw==", "X-Google-Smtp-Source": "ABdhPJzbs79bSDy2zRLlq58cIzeaCSPiBgCyPMppv4GuTlbprZ6z2FyD93wSonsXqiFj635YnMwlDg==", "X-Received": "by 2002:a5d:69c2:: with SMTP id s2mr6905975wrw.389.1599215449943;\n\tFri, 04 Sep 2020 03:30:49 -0700 (PDT)", "From": "David Plowman <david.plowman@raspberrypi.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Fri, 4 Sep 2020 11:30:38 +0100", "Message-Id": "<20200904103042.1593-5-david.plowman@raspberrypi.com>", "X-Mailer": "git-send-email 2.20.1", "In-Reply-To": "<20200904103042.1593-1-david.plowman@raspberrypi.com>", "References": "<20200904103042.1593-1-david.plowman@raspberrypi.com>", "MIME-Version": "1.0", "Subject": "[libcamera-devel] [PATCH v7 4/8] libcamera: Add BayerFormat type", "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>", "Content-Type": "text/plain; charset=\"us-ascii\"", "Content-Transfer-Encoding": "7bit", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "This type encodes BayerFormats in an explicit way, that makes them\neasier to use than some of the other more opaque type formats. This\nmakes the BayerFormat useful for editing or manipulating Bayer types\nmore easily.\n\nSigned-off-by: David Plowman <david.plowman@raspberrypi.com>\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n---\n include/libcamera/internal/bayer_format.h | 60 ++++++\n src/libcamera/bayer_format.cpp | 231 ++++++++++++++++++++++\n src/libcamera/meson.build | 1 +\n 3 files changed, 292 insertions(+)\n create mode 100644 include/libcamera/internal/bayer_format.h\n create mode 100644 src/libcamera/bayer_format.cpp", "diff": "diff --git a/include/libcamera/internal/bayer_format.h b/include/libcamera/internal/bayer_format.h\nnew file mode 100644\nindex 0000000..deeef5b\n--- /dev/null\n+++ b/include/libcamera/internal/bayer_format.h\n@@ -0,0 +1,60 @@\n+/* SPDX-License-Identifier: LGPL-2.1-or-later */\n+/*\n+ * Copyright (C) 2020, Raspberry Pi (Trading) Ltd.\n+ *\n+ * bayer_format.h - Bayer Pixel Format\n+ */\n+#ifndef __LIBCAMERA_INTERNAL_BAYER_FORMAT_H__\n+#define __LIBCAMERA_INTERNAL_BAYER_FORMAT_H__\n+\n+#include <stdint.h>\n+#include <string>\n+\n+#include \"libcamera/internal/v4l2_pixelformat.h\"\n+\n+namespace libcamera {\n+\n+enum class Transform;\n+\n+class BayerFormat\n+{\n+public:\n+\tenum Order : uint8_t {\n+\t\tBGGR = 0,\n+\t\tGBRG = 1,\n+\t\tGRBG = 2,\n+\t\tRGGB = 3\n+\t};\n+\n+\tenum Modifier : uint16_t {\n+\t\tNone = 0,\n+\t\tPacked = 1,\n+\t};\n+\n+\tconstexpr BayerFormat()\n+\t\t: order(Order::BGGR), bitDepth(0), modifiers(Modifier::None)\n+\t{\n+\t}\n+\n+\tconstexpr BayerFormat(Order o, uint8_t b, Modifier m)\n+\t\t: order(o), bitDepth(b), modifiers(m)\n+\t{\n+\t}\n+\n+\texplicit BayerFormat(V4L2PixelFormat v4l2Format);\n+\tbool isValid() const { return bitDepth != 0; }\n+\n+\tstd::string toString() const;\n+\n+\tV4L2PixelFormat toV4L2PixelFormat() const;\n+\tBayerFormat transform(Transform t) const;\n+\n+\tOrder order;\n+\tuint8_t bitDepth;\n+\n+\tModifier modifiers;\n+};\n+\n+} /* namespace libcamera */\n+\n+#endif /* __LIBCAMERA_INTERNAL_BAYER_FORMAT_H__ */\ndiff --git a/src/libcamera/bayer_format.cpp b/src/libcamera/bayer_format.cpp\nnew file mode 100644\nindex 0000000..3780d7d\n--- /dev/null\n+++ b/src/libcamera/bayer_format.cpp\n@@ -0,0 +1,231 @@\n+/* SPDX-License-Identifier: LGPL-2.1-or-later */\n+/*\n+ * Copyright (C) 2020, Raspberry Pi (Trading) Limited\n+ *\n+ * bayer_format.cpp - class to represent Bayer formats\n+ */\n+\n+#include \"libcamera/internal/bayer_format.h\"\n+\n+#include <map>\n+\n+#include <libcamera/transform.h>\n+\n+/**\n+ * \\file bayer_format.h\n+ * \\brief Class to represent Bayer formats and manipulate them\n+ */\n+\n+namespace libcamera {\n+\n+/**\n+ * \\class BayerFormat\n+ * \\brief Class to represent a raw image Bayer format\n+ *\n+ * This class encodes the different Bayer formats in such a way that they can\n+ * be easily manipulated. For example, the bit depth or Bayer order can be\n+ * easily altered - the Bayer order can even be \"transformed\" in the same\n+ * manner as happens in many sensors when their horizontal or vertical \"flip\"\n+ * controls are set.\n+ */\n+\n+/**\n+ * \\enum BayerFormat::Order\n+ * \\brief The order of the colour channels in the Bayer pattern\n+ *\n+ * \\var BayerFormat::BGGR\n+ * \\brief B then G on the first row, G then R on the second row.\n+ * \\var BayerFormat::GBRG\n+ * \\brief G then B on the first row, R then G on the second row.\n+ * \\var BayerFormat::GRBG\n+ * \\brief G then R on the first row, B then G on the second row.\n+ * \\var BayerFormat::RGGB\n+ * \\brief T then G on the first row, G then B on the second row.\n+ */\n+\n+/**\n+ * \\enum BayerFormat::Modifier\n+ * \\brief Modifiers that can apply to a BayerFormat\n+ *\n+ * \\var BayerFormat::None\n+ * \\brief No modifiers\n+ * \\var BayerFormat::Packed\n+ * \\brief Format uses MIPI CSI-2 style packing\n+ */\n+\n+namespace {\n+\n+const std::map<V4L2PixelFormat, BayerFormat> v4l2ToBayer{\n+\t{ V4L2PixelFormat(V4L2_PIX_FMT_SBGGR8), { BayerFormat::BGGR, 8, BayerFormat::None } },\n+\t{ V4L2PixelFormat(V4L2_PIX_FMT_SGBRG8), { BayerFormat::GBRG, 8, BayerFormat::None } },\n+\t{ V4L2PixelFormat(V4L2_PIX_FMT_SGRBG8), { BayerFormat::GRBG, 8, BayerFormat::None } },\n+\t{ V4L2PixelFormat(V4L2_PIX_FMT_SRGGB8), { BayerFormat::RGGB, 8, BayerFormat::None } },\n+\t{ V4L2PixelFormat(V4L2_PIX_FMT_SBGGR10), { BayerFormat::BGGR, 10, BayerFormat::None } },\n+\t{ V4L2PixelFormat(V4L2_PIX_FMT_SGBRG10), { BayerFormat::GBRG, 10, BayerFormat::None } },\n+\t{ V4L2PixelFormat(V4L2_PIX_FMT_SGRBG10), { BayerFormat::GRBG, 10, BayerFormat::None } },\n+\t{ V4L2PixelFormat(V4L2_PIX_FMT_SRGGB10), { BayerFormat::RGGB, 10, BayerFormat::None } },\n+\t{ V4L2PixelFormat(V4L2_PIX_FMT_SBGGR10P), { BayerFormat::BGGR, 10, BayerFormat::Packed } },\n+\t{ V4L2PixelFormat(V4L2_PIX_FMT_SGBRG10P), { BayerFormat::GBRG, 10, BayerFormat::Packed } },\n+\t{ V4L2PixelFormat(V4L2_PIX_FMT_SGRBG10P), { BayerFormat::GRBG, 10, BayerFormat::Packed } },\n+\t{ V4L2PixelFormat(V4L2_PIX_FMT_SRGGB10P), { BayerFormat::RGGB, 10, BayerFormat::Packed } },\n+\t{ V4L2PixelFormat(V4L2_PIX_FMT_SBGGR12), { BayerFormat::BGGR, 12, BayerFormat::None } },\n+\t{ V4L2PixelFormat(V4L2_PIX_FMT_SGBRG12), { BayerFormat::GBRG, 12, BayerFormat::None } },\n+\t{ V4L2PixelFormat(V4L2_PIX_FMT_SGRBG12), { BayerFormat::GRBG, 12, BayerFormat::None } },\n+\t{ V4L2PixelFormat(V4L2_PIX_FMT_SRGGB12), { BayerFormat::RGGB, 12, BayerFormat::None } },\n+\t{ V4L2PixelFormat(V4L2_PIX_FMT_SBGGR12P), { BayerFormat::BGGR, 12, BayerFormat::Packed } },\n+\t{ V4L2PixelFormat(V4L2_PIX_FMT_SGBRG12P), { BayerFormat::GBRG, 12, BayerFormat::Packed } },\n+\t{ V4L2PixelFormat(V4L2_PIX_FMT_SGRBG12P), { BayerFormat::GRBG, 12, BayerFormat::Packed } },\n+\t{ V4L2PixelFormat(V4L2_PIX_FMT_SRGGB12P), { BayerFormat::RGGB, 12, BayerFormat::Packed } },\n+\t{ V4L2PixelFormat(V4L2_PIX_FMT_SBGGR16), { BayerFormat::BGGR, 16, BayerFormat::None } },\n+\t{ V4L2PixelFormat(V4L2_PIX_FMT_SGBRG16), { BayerFormat::GBRG, 16, BayerFormat::None } },\n+\t{ V4L2PixelFormat(V4L2_PIX_FMT_SGRBG16), { BayerFormat::GRBG, 16, BayerFormat::None } },\n+\t{ V4L2PixelFormat(V4L2_PIX_FMT_SRGGB16), { BayerFormat::RGGB, 16, BayerFormat::None } },\n+};\n+\n+/* Define a slightly arbitrary ordering so that we can use a std::map. */\n+struct BayerFormatComparator {\n+\tbool operator()(const BayerFormat &left, const BayerFormat &right) const\n+\t{\n+\t\treturn left.bitDepth > right.bitDepth ||\n+\t\t (left.bitDepth == right.bitDepth && left.order > right.order) ||\n+\t\t (left.bitDepth == right.bitDepth && left.order == right.order &&\n+\t\t\tleft.modifiers > right.modifiers);\n+\t}\n+};\n+\n+const std::map<BayerFormat, V4L2PixelFormat, BayerFormatComparator> bayerToV4l2{\n+\t{ { BayerFormat::BGGR, 8, BayerFormat::None }, V4L2PixelFormat(V4L2_PIX_FMT_SBGGR8) },\n+\t{ { BayerFormat::GBRG, 8, BayerFormat::None }, V4L2PixelFormat(V4L2_PIX_FMT_SGBRG8) },\n+\t{ { BayerFormat::GRBG, 8, BayerFormat::None }, V4L2PixelFormat(V4L2_PIX_FMT_SGRBG8) },\n+\t{ { BayerFormat::RGGB, 8, BayerFormat::None }, V4L2PixelFormat(V4L2_PIX_FMT_SRGGB8) },\n+\t{ { BayerFormat::BGGR, 10, BayerFormat::None }, V4L2PixelFormat(V4L2_PIX_FMT_SBGGR10) },\n+\t{ { BayerFormat::GBRG, 10, BayerFormat::None }, V4L2PixelFormat(V4L2_PIX_FMT_SGBRG10) },\n+\t{ { BayerFormat::GRBG, 10, BayerFormat::None }, V4L2PixelFormat(V4L2_PIX_FMT_SGRBG10) },\n+\t{ { BayerFormat::RGGB, 10, BayerFormat::None }, V4L2PixelFormat(V4L2_PIX_FMT_SRGGB10) },\n+\t{ { BayerFormat::BGGR, 10, BayerFormat::Packed }, V4L2PixelFormat(V4L2_PIX_FMT_SBGGR10P) },\n+\t{ { BayerFormat::GBRG, 10, BayerFormat::Packed }, V4L2PixelFormat(V4L2_PIX_FMT_SGBRG10P) },\n+\t{ { BayerFormat::GRBG, 10, BayerFormat::Packed }, V4L2PixelFormat(V4L2_PIX_FMT_SGRBG10P) },\n+\t{ { BayerFormat::RGGB, 10, BayerFormat::Packed }, V4L2PixelFormat(V4L2_PIX_FMT_SRGGB10P) },\n+\t{ { BayerFormat::BGGR, 12, BayerFormat::None }, V4L2PixelFormat(V4L2_PIX_FMT_SBGGR12) },\n+\t{ { BayerFormat::GBRG, 12, BayerFormat::None }, V4L2PixelFormat(V4L2_PIX_FMT_SGBRG12) },\n+\t{ { BayerFormat::GRBG, 12, BayerFormat::None }, V4L2PixelFormat(V4L2_PIX_FMT_SGRBG12) },\n+\t{ { BayerFormat::RGGB, 12, BayerFormat::None }, V4L2PixelFormat(V4L2_PIX_FMT_SRGGB12) },\n+\t{ { BayerFormat::BGGR, 12, BayerFormat::Packed }, V4L2PixelFormat(V4L2_PIX_FMT_SBGGR12P) },\n+\t{ { BayerFormat::GBRG, 12, BayerFormat::Packed }, V4L2PixelFormat(V4L2_PIX_FMT_SGBRG12P) },\n+\t{ { BayerFormat::GRBG, 12, BayerFormat::Packed }, V4L2PixelFormat(V4L2_PIX_FMT_SGRBG12P) },\n+\t{ { BayerFormat::RGGB, 12, BayerFormat::Packed }, V4L2PixelFormat(V4L2_PIX_FMT_SRGGB12P) },\n+\t{ { BayerFormat::BGGR, 16, BayerFormat::None }, V4L2PixelFormat(V4L2_PIX_FMT_SBGGR16) },\n+\t{ { BayerFormat::GBRG, 16, BayerFormat::None }, V4L2PixelFormat(V4L2_PIX_FMT_SGBRG16) },\n+\t{ { BayerFormat::GRBG, 16, BayerFormat::None }, V4L2PixelFormat(V4L2_PIX_FMT_SGRBG16) },\n+\t{ { BayerFormat::RGGB, 16, BayerFormat::None }, V4L2PixelFormat(V4L2_PIX_FMT_SRGGB16) },\n+};\n+\n+} // namespace\n+\n+/**\n+ * \\fn BayerFormat::BayerFormat()\n+ * \\brief Construct an empty (and invalid) BayerFormat\n+ */\n+\n+/**\n+ * \\fn BayerFormat::BayerFormat(Order o, uint8_t b, Modifier m)\n+ * \\brief Construct a BayerFormat from explicit values\n+ */\n+\n+/**\n+ * \\brief Construct a BayerFormat from a V4L2PixelFormat\n+ * \\param[in] v4l2Format The raw format to convert into a BayerFormat\n+ */\n+BayerFormat::BayerFormat(V4L2PixelFormat v4l2Format)\n+{\n+\tconst auto it = v4l2ToBayer.find(v4l2Format);\n+\tif (it == v4l2ToBayer.end())\n+\t\tbitDepth = 0;\n+\telse\n+\t\t*this = it->second;\n+}\n+\n+/**\n+ * \\fn BayerFormat::isValid()\n+ * \\brief Return whether a BayerFormat is valid\n+ */\n+\n+/**\n+ * \\brief Returns a readable string representation of the BayerFormat\n+ */\n+std::string BayerFormat::toString() const\n+{\n+\tstd::string result;\n+\n+\tstatic const char *orderStrings[] = {\n+\t\t\"BGGR\",\n+\t\t\"GBRG\",\n+\t\t\"GRBG\",\n+\t\t\"RGGB\"\n+\t};\n+\tif (order <= RGGB)\n+\t\tresult = orderStrings[order];\n+\telse\n+\t\tresult = \"unknown\";\n+\n+\tresult += \"-\" + std::to_string(bitDepth);\n+\n+\tif (modifiers & Packed)\n+\t\tresult += \"-P\";\n+\n+\treturn result;\n+}\n+\n+/**\n+ * \\brief Convert a BayerFormat into the corresponding V4L2PixelFormat\n+ */\n+V4L2PixelFormat BayerFormat::toV4L2PixelFormat() const\n+{\n+\tconst auto it = bayerToV4l2.find(*this);\n+\tif (it != bayerToV4l2.end())\n+\t\treturn it->second;\n+\n+\treturn V4L2PixelFormat();\n+}\n+\n+/**\n+ * \\brief Apply a transform to this BayerFormat.\n+ * \\param[in] t The transform to apply\n+ *\n+ * For example, performing a horizontal flip on the Bayer pattern RGGB causes\n+ * the RG rows of pixels to become GR, and the GB rows become BG. So the final\n+ * result in this case would be GRBG.\n+ */\n+BayerFormat BayerFormat::transform(Transform t) const\n+{\n+\tBayerFormat result = *this;\n+\n+\t/*\n+\t * Observe that flipping bit 0 of the Order enum performs a horizontal\n+\t * mirror on the Bayer pattern (e.g. RGGB goes to GRBG). Similarly,\n+\t * flipping bit 1 performs a vertical mirror operation on it. Hence:\n+\t */\n+\tif (!!(t & Transform::HFlip))\n+\t\tresult.order = static_cast<Order>(result.order ^ 1);\n+\tif (!!(t & Transform::VFlip))\n+\t\tresult.order = static_cast<Order>(result.order ^ 2);\n+\n+\treturn result;\n+}\n+\n+/**\n+ * \\var BayerFormat::order\n+ * \\brief The order of the colour channels in the Bayer pattern\n+ */\n+\n+/**\n+ * \\var BayerFormat::bitDepth\n+ * \\brief The bit depth of the samples in the Bayer pattern\n+ */\n+\n+/**\n+ * \\var BayerFormat::modifiers\n+ * \\brief Any modifier flags applied to this BayerFormat\n+ */\n+\n+} /* namespace libcamera */\ndiff --git a/src/libcamera/meson.build b/src/libcamera/meson.build\nindex edec55e..86c225f 100644\n--- a/src/libcamera/meson.build\n+++ b/src/libcamera/meson.build\n@@ -1,6 +1,7 @@\n # SPDX-License-Identifier: CC0-1.0\n \n libcamera_sources = files([\n+ 'bayer_format.cpp',\n 'bound_method.cpp',\n 'buffer.cpp',\n 'byte_stream_buffer.cpp',\n", "prefixes": [ "libcamera-devel", "v7", "4/8" ] }