1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
/* SPDX-License-Identifier: LGPL-2.1-or-later */
/*
* Copyright (C) 2021, Raspberry Pi Ltd
*
* color_space.h - color space definitions
*/
#pragma once
#include <optional>
#include <string>
namespace libcamera {
class ColorSpace
{
public:
enum class Primaries {
Raw,
Smpte170m,
Rec709,
Rec2020,
};
enum class TransferFunction {
Linear,
Srgb,
Rec709,
};
enum class YcbcrEncoding {
None,
Rec601,
Rec709,
Rec2020,
};
enum class Range {
Full,
Limited,
};
constexpr ColorSpace(Primaries p, TransferFunction t, YcbcrEncoding e, Range r)
: primaries(p), transferFunction(t), ycbcrEncoding(e), range(r)
{
}
static const ColorSpace Raw;
static const ColorSpace Jpeg;
static const ColorSpace Srgb;
static const ColorSpace Smpte170m;
static const ColorSpace Rec709;
static const ColorSpace Rec2020;
Primaries primaries;
TransferFunction transferFunction;
YcbcrEncoding ycbcrEncoding;
Range range;
std::string toString() const;
static std::string toString(const std::optional<ColorSpace> &colorSpace);
};
bool operator==(const ColorSpace &lhs, const ColorSpace &rhs);
static inline bool operator!=(const ColorSpace &lhs, const ColorSpace &rhs)
{
return !(lhs == rhs);
}
} /* namespace libcamera */
|