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>
This commit is contained in:
parent
11a946bc22
commit
c440c828bc
2 changed files with 23 additions and 0 deletions
|
@ -57,6 +57,12 @@ public:
|
||||||
Packing packing;
|
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 */
|
} /* namespace libcamera */
|
||||||
|
|
||||||
#endif /* __LIBCAMERA_INTERNAL_BAYER_FORMAT_H__ */
|
#endif /* __LIBCAMERA_INTERNAL_BAYER_FORMAT_H__ */
|
||||||
|
|
|
@ -215,6 +215,23 @@ std::string BayerFormat::toString() const
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \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
|
* \brief Convert a BayerFormat into the corresponding V4L2PixelFormat
|
||||||
* \return The V4L2PixelFormat corresponding to this BayerFormat
|
* \return The V4L2PixelFormat corresponding to this BayerFormat
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue