From c440c828bc071effb76e60968c9d4a4a74c134df Mon Sep 17 00:00:00 2001 From: Sebastian Fricke Date: Tue, 26 Jan 2021 19:48:52 +0100 Subject: 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 Reviewed-by: Laurent Pinchart Signed-off-by: Laurent Pinchart --- include/libcamera/internal/bayer_format.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'include/libcamera') 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__ */ -- cgit v1.2.1