mirror of
https://git.libcamera.org/libcamera/libcamera.git
synced 2025-07-23 08:35:07 +03:00
Add the Raspberry Pi 5 PiSP specific compressed Bayer format types 1/2: - V4L2_PIX_FMT_PISP_COMP1_xxx - V4L2_PIX_FMT_PISP_COMP2_xxx Add the Raspberry Pi 5 PiSP Frontend and Backend config formats: - V4L2_META_FMT_RPI_FE_CFG - V4L2_META_FMT_RPI_BE_CFG Add the Raspberry Pi 5 PiSP Frontend statistics format: - V4L2_META_FMT_RPI_FE_STATS Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: David Plowman <david.plowman@raspberrypi.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
76 lines
1.4 KiB
C++
76 lines
1.4 KiB
C++
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
|
/*
|
|
* Copyright (C) 2020, Raspberry Pi Ltd
|
|
*
|
|
* Bayer Pixel Format
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <ostream>
|
|
#include <stdint.h>
|
|
#include <string>
|
|
|
|
#include <libcamera/pixel_format.h>
|
|
|
|
#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 class Packing : uint16_t {
|
|
None = 0,
|
|
CSI2 = 1,
|
|
IPU3 = 2,
|
|
PISP1 = 3,
|
|
PISP2 = 4,
|
|
};
|
|
|
|
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);
|
|
PixelFormat toPixelFormat() const;
|
|
static BayerFormat fromPixelFormat(PixelFormat format);
|
|
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);
|
|
}
|
|
|
|
std::ostream &operator<<(std::ostream &out, const BayerFormat &f);
|
|
|
|
} /* namespace libcamera */
|