libcamera: bayer_format: Add support for mbus codes

The existing implementation of the BayerFormat class supports
converting a V4L2PixelFormat to a BayerFormat and vice-versa.

Expand the class by adding support for converting a media bus code
to a BayerFormat instance, by providing a conversion table and a
dedicated static methods.

Do not provide support for converting a BayerFormat to a media bus code
as there's no 1-to-1 mapping between the two.

Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
This commit is contained in:
Jacopo Mondi
2020-12-18 15:51:39 +01:00
parent 5d3d0dcedb
commit 1c0096d751
2 changed files with 56 additions and 0 deletions
@@ -43,6 +43,7 @@ public:
}
explicit BayerFormat(V4L2PixelFormat v4l2Format);
static const BayerFormat &fromMbusCode(unsigned int mbusCode);
bool isValid() const { return bitDepth != 0; }
std::string toString() const;