libcamera: bayer_format: Add the fromV4L2PixelFormat function

Add a static member function to get the corresponding BayerFormat from a
given V4L2PixelFormat. The motivation behind this patch is to align the
overall structure of the BayerFormat class with other parts of the code
base, such as the V4L2PixelFormat class.

The downside of this change is a slightly worse time complexity, but
the upside is a smaller codebase and lower memory consumption. As the
function is probably not used very frequently, I tend to favor the
mentioned upsides.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Sebastian Fricke <sebastian.fricke@posteo.net>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
Sebastian Fricke 2021-01-26 19:48:50 +01:00 committed by Laurent Pinchart
parent 515211e8ef
commit 83e434b2dc
3 changed files with 21 additions and 2 deletions

View file

@ -49,6 +49,7 @@ public:
std::string toString() const;
V4L2PixelFormat toV4L2PixelFormat() const;
static BayerFormat fromV4L2PixelFormat(V4L2PixelFormat v4l2Format);
BayerFormat transform(Transform t) const;
Order order;