diff options
-rw-r--r-- | include/libcamera/internal/bayer_format.h | 6 | ||||
-rw-r--r-- | src/libcamera/bayer_format.cpp | 17 |
2 files changed, 23 insertions, 0 deletions
diff --git a/include/libcamera/internal/bayer_format.h b/include/libcamera/internal/bayer_format.h index 62814154..5b8c1dc9 100644 --- a/include/libcamera/internal/bayer_format.h +++ b/include/libcamera/internal/bayer_format.h @@ -57,6 +57,12 @@ public: Packing packing; }; +bool operator==(const BayerFormat &lhs, const BayerFormat &rhs); +static inline bool operator!=(const BayerFormat &lhs, const BayerFormat &rhs) +{ + return !(lhs == rhs); +} + } /* namespace libcamera */ #endif /* __LIBCAMERA_INTERNAL_BAYER_FORMAT_H__ */ 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 */ |