Files
external_libcamera/include/libcamera/internal/bayer_format.h
David Plowman bdf04cca08 libcamera: Add support for monochrome sensors
This commit adds support for monochrome (greyscale) raw sensors. These
are sensors that have no colour filter array, so all pixels are the
same and there are no distinct colour channels.

These sensors still require many of an ISP's processing stages, such
as denoise, tone mapping, but not those that involve colours (such as
demosaic, or colour matrices).

Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-06-28 19:33:42 +03:00

70 lines
1.3 KiB
C++

/* SPDX-License-Identifier: LGPL-2.1-or-later */
/*
* Copyright (C) 2020, Raspberry Pi (Trading) Ltd.
*
* bayer_format.h - Bayer Pixel Format
*/
#ifndef __LIBCAMERA_INTERNAL_BAYER_FORMAT_H__
#define __LIBCAMERA_INTERNAL_BAYER_FORMAT_H__
#include <stdint.h>
#include <string>
#include "libcamera/internal/v4l2_pixelformat.h"
namespace libcamera {
enum class Transform;
class BayerFormat
{
public:
enum Order : uint8_t {
BGGR = 0,
GBRG = 1,
GRBG = 2,
RGGB = 3,
MONO = 4
};
enum Packing : uint16_t {
None = 0,
CSI2Packed = 1,
IPU3Packed = 2,
};
constexpr BayerFormat()
: order(Order::BGGR), bitDepth(0), packing(Packing::None)
{
}
constexpr BayerFormat(Order o, uint8_t b, Packing p)
: order(o), bitDepth(b), packing(p)
{
}
static const BayerFormat &fromMbusCode(unsigned int mbusCode);
bool isValid() const { return bitDepth != 0; }
std::string toString() const;
V4L2PixelFormat toV4L2PixelFormat() const;
static BayerFormat fromV4L2PixelFormat(V4L2PixelFormat v4l2Format);
BayerFormat transform(Transform t) const;
Order order;
uint8_t bitDepth;
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__ */