summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSebastian Fricke <sebastian.fricke@posteo.net>2021-01-26 19:48:52 +0100
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2021-02-04 21:00:38 +0200
commitc440c828bc071effb76e60968c9d4a4a74c134df (patch)
treedc1cd84c3e2c0fe82189d06961d253806ad626a1 /src
parent11a946bc22212abd9eef467633e8ab359df57299 (diff)
libcamera: bayer_format: Overload ==/!= operators for BayerFormats
Enable to test two Bayer formats for equality by checking if the order of the color channels, the bit depth of the pattern, and the packing scheme match. Additionally, add the reverse operation (!=), which negates the equality test result. Signed-off-by: Sebastian Fricke <sebastian.fricke@posteo.net> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'src')
-rw-r--r--src/libcamera/bayer_format.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/libcamera/bayer_format.cpp b/src/libcamera/bayer_format.cpp
index 1acf91d4..ae730d94 100644
--- a/src/libcamera/bayer_format.cpp
+++ b/src/libcamera/bayer_format.cpp
@@ -216,6 +216,23 @@ std::string BayerFormat::toString() const
}
/**
+ * \brief Compare two BayerFormats for equality
+ * \return True if order, bitDepth and packing are equal, or false otherwise
+ */
+bool operator==(const BayerFormat &lhs, const BayerFormat &rhs)
+{
+ return lhs.order == rhs.order && lhs.bitDepth == rhs.bitDepth &&
+ lhs.packing == rhs.packing;
+}
+
+/**
+ * \fn bool operator!=(const BayerFormat &lhs, const BayerFormat &rhs)
+ * \brief Compare two BayerFormats for inequality
+ * \return True if either order, bitdepth or packing are not equal, or false
+ * otherwise
+ */
+
+/**
* \brief Convert a BayerFormat into the corresponding V4L2PixelFormat
* \return The V4L2PixelFormat corresponding to this BayerFormat
*/